Handle big bitcode files.

Split the bitcode file into segments due to Java method size limitation.

Change-Id: I4c171c40a45067da63098deb2408449dab38b041
diff --git a/slang_rs_reflect_utils.hpp b/slang_rs_reflect_utils.hpp
index a00288a..7324565 100644
--- a/slang_rs_reflect_utils.hpp
+++ b/slang_rs_reflect_utils.hpp
@@ -5,45 +5,60 @@
 
 namespace slang {
 
+// BitCode storage type
+enum BitCodeStorageType {
+  BCST_APK_RESOURCE,
+  BCST_JAVA_CODE
+};
+
 class RSSlangReflectUtils {
-public:
-   // Compuate a Java source file path from a given prefixPath and its package.
-   // Eg, given prefixPath=./foo/bar and packageName=com.x.y, then it returns
-   // ./foo/bar/com/x/y
-   static std::string ComputePackagedPath(const std::string& prefixPath,
-                                          const std::string& packageName);
+ public:
 
-   // Compute Java class name from a .rs file name.
-   // Any non-alnum character will be discarded. The result will be camel-cased.
-   // Eg, with rsFileName=./foo/bar/my_renderscript_file.rs it returns
-   // "MyRenderscriptFile".
-   // rsFileName: the input .rs file name (with or without path).
-   static std::string JavaClassNameFromRSFileName(const char* rsFileName);
+  // Encode a binary bitcode file into a Java source file.
+  // rsFileName: the original .rs file name (with or without path).
+  // bcFileName: where is the bit code file
+  // reflectPath: where to output the generated Java file, no package name in
+  // it.
+  // packageName: the package of the output Java file.
+  struct BitCodeAccessorContext {
+    const char* rsFileName;
+    const char* bcFileName;
+    const char* reflectPath;
+    const char* packageName;
 
-   // Compute a bitcode file name (no extension) from a .rs file name.
-   // Because the bitcode file name may be used as Resource ID in the generated
-   // class (something like R.raw.<bitcode_filename>), Any non-alnum character
-   // will be discarded.
-   // The difference from JavaClassNameFromRSFileName() is that the result is
-   // not converted to camel case.
-   // Eg, with rsFileName=./foo/bar/my_renderscript_file.rs it returns
-   // "myrenderscriptfile"
-   // rsFileName: the input .rs file name (with or without path).
-   static std::string BCFileNameFromRSFileName(const char* rsFileName);
+    BitCodeStorageType bcStorage;
+  };
 
-   // "mkdir -p"
-   static bool mkdir_p(const char* path);
+  // Compuate a Java source file path from a given prefixPath and its package.
+  // Eg, given prefixPath=./foo/bar and packageName=com.x.y, then it returns
+  // ./foo/bar/com/x/y
+  static std::string ComputePackagedPath(const char* prefixPath,
+                                         const char* packageName);
 
-   // Encode a binary bitcode file into a Java source file.
-   // rsFileName: the original .rs file name (with or without path).
-   // inputBCFileName: the bitcode file to be encoded.
-   // outputPath: where to output the generated Java file, no package name in
-   // it.
-   // packageName: the package of the output Java file.
-   static bool EncodeBitcodeToJavaFile(const char* rsFileName,
-                                       const char* inputBCFileName,
-                                       const std::string& outputPath,
-                                       const std::string& packageName);
+  // Compute Java class name from a .rs file name.
+  // Any non-alnum character will be discarded. The result will be camel-cased.
+  // Eg, with rsFileName=./foo/bar/my_renderscript_file.rs it returns
+  // "MyRenderscriptFile".
+  // rsFileName: the input .rs file name (with or without path).
+  static std::string JavaClassNameFromRSFileName(const char* rsFileName);
+
+  // Compute a bitcode file name (no extension) from a .rs file name.
+  // Because the bitcode file name may be used as Resource ID in the generated
+  // class (something like R.raw.<bitcode_filename>), Any non-alnum character
+  // will be discarded.
+  // The difference from JavaClassNameFromRSFileName() is that the result is
+  // not converted to camel case.
+  // Eg, with rsFileName=./foo/bar/my_renderscript_file.rs it returns
+  // "myrenderscriptfile"
+  // rsFileName: the input .rs file name (with or without path).
+  static std::string BCFileNameFromRSFileName(const char* rsFileName);
+
+  // "mkdir -p"
+  static bool mkdir_p(const char* path);
+
+
+  // Generate the bit code accessor Java source file.
+  static bool GenerateBitCodeAccessor(const BitCodeAccessorContext& context);
 
 };