Zonr Chang | c383a50 | 2010-10-12 01:52:08 +0800 | [diff] [blame] | 1 | /* |
Stephen Hines | 0a813a3 | 2012-08-03 16:52:40 -0700 | [diff] [blame] | 2 | * Copyright 2010-2012, The Android Open Source Project |
Zonr Chang | c383a50 | 2010-10-12 01:52:08 +0800 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Jean-Luc Brouillet | 2ce118e | 2014-05-27 17:41:22 -0700 | [diff] [blame] | 17 | #ifndef _FRAMEWORKS_COMPILE_SLANG_SLANG_RS_REFLECTION_H_ // NOLINT |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 18 | #define _FRAMEWORKS_COMPILE_SLANG_SLANG_RS_REFLECTION_H_ |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 19 | |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 20 | #include <fstream> |
| 21 | #include <iostream> |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 22 | #include <map> |
Stephen Hines | 48b72bf | 2011-06-10 15:37:27 -0700 | [diff] [blame] | 23 | #include <set> |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 24 | #include <string> |
| 25 | #include <vector> |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 26 | |
zonr | 6315f76 | 2010-10-05 15:35:14 +0800 | [diff] [blame] | 27 | #include "llvm/ADT/StringExtras.h" |
| 28 | |
Stephen Hines | 6e6578a | 2011-02-07 18:05:48 -0800 | [diff] [blame] | 29 | #include "slang_assert.h" |
zonr | 6315f76 | 2010-10-05 15:35:14 +0800 | [diff] [blame] | 30 | #include "slang_rs_export_type.h" |
Jean-Luc Brouillet | f33e156 | 2014-06-03 17:55:57 -0700 | [diff] [blame] | 31 | #include "slang_rs_reflect_utils.h" |
zonr | 6315f76 | 2010-10-05 15:35:14 +0800 | [diff] [blame] | 32 | |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 33 | namespace slang { |
| 34 | |
Jean-Luc Brouillet | 2ce118e | 2014-05-27 17:41:22 -0700 | [diff] [blame] | 35 | class RSContext; |
| 36 | class RSExportVar; |
| 37 | class RSExportFunc; |
| 38 | class RSExportForEach; |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 39 | |
Jean-Luc Brouillet | 602def7 | 2014-05-27 16:11:37 -0700 | [diff] [blame] | 40 | class RSReflectionJava { |
Jean-Luc Brouillet | 2ce118e | 2014-05-27 17:41:22 -0700 | [diff] [blame] | 41 | private: |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 42 | const RSContext *mRSContext; |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 43 | |
Jean-Luc Brouillet | 59f22c3 | 2014-06-04 14:53:48 -0700 | [diff] [blame] | 44 | // The name of the Java package name we're creating this file for, |
| 45 | // e.g. com.example.android.rs.flashlight |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 46 | std::string mPackageName; |
Jean-Luc Brouillet | 59f22c3 | 2014-06-04 14:53:48 -0700 | [diff] [blame] | 47 | // The name of the Java Renderscript package we'll be using, |
| 48 | // e.g. android.renderscript |
| 49 | // e.g. android.support.v8.renderscript |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 50 | std::string mRSPackageName; |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 51 | |
Jean-Luc Brouillet | 59f22c3 | 2014-06-04 14:53:48 -0700 | [diff] [blame] | 52 | // The directory under which we'll create the Java files, in appropriate subdirectories, |
| 53 | // e.g. /tmp/myout |
| 54 | std::string mOutputBaseDirectory; |
| 55 | // The output directory for the specfied package (mPackageName), |
| 56 | // e.g. /tmp/myout/com/example/android/rs/flashlight/ |
| 57 | // TODO This includes the terminating separator. Needed? |
| 58 | std::string mOutputDirectory; |
| 59 | |
| 60 | // The full path of the .rs file that we are reflecting. |
| 61 | std::string mRSSourceFileName; |
| 62 | // The full path where the generated bit code can be read. |
| 63 | std::string mBitCodeFileName; |
| 64 | |
| 65 | // The name of the resource we pass to the RenderScript constructor |
| 66 | // e.g. flashlight |
| 67 | std::string mResourceId; |
| 68 | // The name of the Java class we are generating for this script. |
| 69 | // e.g. ScriptC_flashlight |
| 70 | std::string mScriptClassName; |
| 71 | |
| 72 | |
| 73 | // This is set by startClass() and will change for the multiple classes generated. |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 74 | std::string mClassName; |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 75 | |
Tim Murray | 3a38b74 | 2014-07-02 10:41:08 -0700 | [diff] [blame] | 76 | // This is the token used for determining the size of a given ScriptField.Item. |
| 77 | std::string mItemSizeof; |
| 78 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 79 | bool mEmbedBitcodeInJava; |
Stephen Hines | 44d495d | 2014-05-22 19:42:55 -0700 | [diff] [blame] | 80 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 81 | int mNextExportVarSlot; |
| 82 | int mNextExportFuncSlot; |
| 83 | int mNextExportForEachSlot; |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 84 | |
Jean-Luc Brouillet | f33e156 | 2014-06-03 17:55:57 -0700 | [diff] [blame] | 85 | GeneratedFile mOut; |
| 86 | |
Jean-Luc Brouillet | 59f22c3 | 2014-06-04 14:53:48 -0700 | [diff] [blame] | 87 | std::string mLastError; |
| 88 | std::vector<std::string> *mGeneratedFileNames; |
| 89 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 90 | // A mapping from a field in a record type to its index in the rsType |
| 91 | // instance. Only used when generates TypeClass (ScriptField_*). |
| 92 | typedef std::map<const RSExportRecordType::Field *, unsigned> FieldIndexMapTy; |
| 93 | FieldIndexMapTy mFieldIndexMap; |
| 94 | // Field index of current processing TypeClass. |
| 95 | unsigned mFieldIndex; |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 96 | |
Jean-Luc Brouillet | 59f22c3 | 2014-06-04 14:53:48 -0700 | [diff] [blame] | 97 | inline void setError(const std::string &Error) { mLastError = Error; } |
| 98 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 99 | inline void clear() { |
| 100 | mClassName = ""; |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 101 | mNextExportVarSlot = 0; |
| 102 | mNextExportFuncSlot = 0; |
| 103 | mNextExportForEachSlot = 0; |
| 104 | } |
Shih-wei Liao | 9c631ff | 2010-09-17 11:57:29 -0700 | [diff] [blame] | 105 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 106 | public: |
| 107 | typedef enum { |
| 108 | AM_Public, |
| 109 | AM_Protected, |
| 110 | AM_Private, |
| 111 | AM_PublicSynchronized |
| 112 | } AccessModifier; |
Zonr Chang | 8c6d9b2 | 2010-10-07 18:01:19 +0800 | [diff] [blame] | 113 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 114 | // Generated RS Elements for type-checking code. |
| 115 | std::set<std::string> mTypesToCheck; |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 116 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 117 | // Generated FieldPackers for unsigned setters/validation. |
| 118 | std::set<std::string> mFieldPackerTypes; |
Stephen Hines | 48b72bf | 2011-06-10 15:37:27 -0700 | [diff] [blame] | 119 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 120 | bool addTypeNameForElement(const std::string &TypeName); |
| 121 | bool addTypeNameForFieldPacker(const std::string &TypeName); |
Stephen Hines | 1f6c331 | 2012-07-03 17:23:33 -0700 | [diff] [blame] | 122 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 123 | static const char *AccessModifierStr(AccessModifier AM); |
Stephen Hines | 1f6c331 | 2012-07-03 17:23:33 -0700 | [diff] [blame] | 124 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 125 | inline bool getEmbedBitcodeInJava() const { return mEmbedBitcodeInJava; } |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 126 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 127 | inline int getNextExportVarSlot() { return mNextExportVarSlot++; } |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 128 | inline int getNextExportFuncSlot() { return mNextExportFuncSlot++; } |
| 129 | inline int getNextExportForEachSlot() { return mNextExportForEachSlot++; } |
Stephen Hines | 44d495d | 2014-05-22 19:42:55 -0700 | [diff] [blame] | 130 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 131 | bool startClass(AccessModifier AM, bool IsStatic, |
| 132 | const std::string &ClassName, const char *SuperClassName, |
| 133 | std::string &ErrorMsg); |
| 134 | void endClass(); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 135 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 136 | void startFunction(AccessModifier AM, bool IsStatic, const char *ReturnType, |
| 137 | const std::string &FunctionName, int Argc, ...); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 138 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 139 | typedef std::vector<std::pair<std::string, std::string>> ArgTy; |
| 140 | void startFunction(AccessModifier AM, bool IsStatic, const char *ReturnType, |
| 141 | const std::string &FunctionName, const ArgTy &Args); |
| 142 | void endFunction(); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 143 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 144 | inline const std::string &getPackageName() const { return mPackageName; } |
| 145 | inline const std::string &getRSPackageName() const { return mRSPackageName; } |
| 146 | inline const std::string &getClassName() const { return mClassName; } |
| 147 | inline const std::string &getResourceId() const { return mResourceId; } |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 148 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 149 | void startTypeClass(const std::string &ClassName); |
| 150 | void endTypeClass(); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 151 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 152 | inline void incFieldIndex() { mFieldIndex++; } |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 153 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 154 | inline void resetFieldIndex() { mFieldIndex = 0; } |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 155 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 156 | inline void addFieldIndexMapping(const RSExportRecordType::Field *F) { |
| 157 | slangAssert((mFieldIndexMap.find(F) == mFieldIndexMap.end()) && |
| 158 | "Nested structure never occurs in C language."); |
| 159 | mFieldIndexMap.insert(std::make_pair(F, mFieldIndex)); |
| 160 | } |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 161 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 162 | inline unsigned getFieldIndex(const RSExportRecordType::Field *F) const { |
| 163 | FieldIndexMapTy::const_iterator I = mFieldIndexMap.find(F); |
| 164 | slangAssert((I != mFieldIndexMap.end()) && |
| 165 | "Requesting field is out of scope."); |
| 166 | return I->second; |
| 167 | } |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 168 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 169 | inline void clearFieldIndexMap() { mFieldIndexMap.clear(); } |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 170 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 171 | private: |
| 172 | bool genScriptClass(const std::string &ClassName, std::string &ErrorMsg); |
| 173 | void genScriptClassConstructor(); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 174 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 175 | void genInitBoolExportVariable(const std::string &VarName, |
| 176 | const clang::APValue &Val); |
| 177 | void genInitPrimitiveExportVariable(const std::string &VarName, |
| 178 | const clang::APValue &Val); |
| 179 | void genInitExportVariable(const RSExportType *ET, const std::string &VarName, |
| 180 | const clang::APValue &Val); |
Jean-Luc Brouillet | efcff10 | 2014-06-03 16:13:51 -0700 | [diff] [blame] | 181 | void genInitValue(const clang::APValue &Val, bool asBool); |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 182 | void genExportVariable(const RSExportVar *EV); |
| 183 | void genPrimitiveTypeExportVariable(const RSExportVar *EV); |
| 184 | void genPointerTypeExportVariable(const RSExportVar *EV); |
| 185 | void genVectorTypeExportVariable(const RSExportVar *EV); |
| 186 | void genMatrixTypeExportVariable(const RSExportVar *EV); |
| 187 | void genConstantArrayTypeExportVariable(const RSExportVar *EV); |
| 188 | void genRecordTypeExportVariable(const RSExportVar *EV); |
| 189 | void genPrivateExportVariable(const std::string &TypeName, |
Stephen Hines | 0d26cef | 2012-05-01 19:23:01 -0700 | [diff] [blame] | 190 | const std::string &VarName); |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 191 | void genSetExportVariable(const std::string &TypeName, const RSExportVar *EV); |
| 192 | void genGetExportVariable(const std::string &TypeName, |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 193 | const std::string &VarName); |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 194 | void genGetFieldID(const std::string &VarName); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 195 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 196 | void genExportFunction(const RSExportFunc *EF); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 197 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 198 | void genExportForEach(const RSExportForEach *EF); |
Stephen Hines | 593a894 | 2011-05-10 15:29:50 -0700 | [diff] [blame] | 199 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 200 | void genTypeCheck(const RSExportType *ET, const char *VarName); |
Stephen Hines | 48b72bf | 2011-06-10 15:37:27 -0700 | [diff] [blame] | 201 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 202 | void genTypeInstanceFromPointer(const RSExportType *ET); |
Stephen Hines | a6b5414 | 2012-04-09 18:25:08 -0700 | [diff] [blame] | 203 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 204 | void genTypeInstance(const RSExportType *ET); |
Stephen Hines | b5a89fb | 2011-05-17 14:48:02 -0700 | [diff] [blame] | 205 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 206 | void genFieldPackerInstance(const RSExportType *ET); |
Stephen Hines | 1f6c331 | 2012-07-03 17:23:33 -0700 | [diff] [blame] | 207 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 208 | bool genTypeClass(const RSExportRecordType *ERT, std::string &ErrorMsg); |
| 209 | void genTypeItemClass(const RSExportRecordType *ERT); |
| 210 | void genTypeClassConstructor(const RSExportRecordType *ERT); |
| 211 | void genTypeClassCopyToArray(const RSExportRecordType *ERT); |
| 212 | void genTypeClassCopyToArrayLocal(const RSExportRecordType *ERT); |
| 213 | void genTypeClassItemSetter(const RSExportRecordType *ERT); |
| 214 | void genTypeClassItemGetter(const RSExportRecordType *ERT); |
| 215 | void genTypeClassComponentSetter(const RSExportRecordType *ERT); |
| 216 | void genTypeClassComponentGetter(const RSExportRecordType *ERT); |
| 217 | void genTypeClassCopyAll(const RSExportRecordType *ERT); |
| 218 | void genTypeClassResize(); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 219 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 220 | void genBuildElement(const char *ElementBuilderName, |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 221 | const RSExportRecordType *ERT, |
Jean-Luc Brouillet | 2ce118e | 2014-05-27 17:41:22 -0700 | [diff] [blame] | 222 | const char *RenderScriptVar, bool IsInline); |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 223 | void genAddElementToElementBuilder(const RSExportType *ERT, |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 224 | const std::string &VarName, |
| 225 | const char *ElementBuilderName, |
Zonr Chang | 89273bd | 2010-10-14 20:57:38 +0800 | [diff] [blame] | 226 | const char *RenderScriptVar, |
| 227 | unsigned ArraySize); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 228 | |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 229 | bool genCreateFieldPacker(const RSExportType *T, const char *FieldPackerName); |
| 230 | void genPackVarOfType(const RSExportType *T, const char *VarName, |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 231 | const char *FieldPackerName); |
Jean-Luc Brouillet | 2e205d0 | 2014-06-02 21:06:52 -0700 | [diff] [blame] | 232 | void genAllocateVarOfType(const RSExportType *T, const std::string &VarName); |
| 233 | void genNewItemBufferIfNull(const char *Index); |
| 234 | void genNewItemBufferPackerIfNull(); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 235 | |
Chris Wailes | c9454af | 2014-06-13 17:25:40 -0700 | [diff] [blame] | 236 | void genPairwiseDimCheck(std::string name0, std::string name1); |
| 237 | |
Jean-Luc Brouillet | 2ce118e | 2014-05-27 17:41:22 -0700 | [diff] [blame] | 238 | public: |
Jean-Luc Brouillet | 59f22c3 | 2014-06-04 14:53:48 -0700 | [diff] [blame] | 239 | RSReflectionJava(const RSContext *Context, |
| 240 | std::vector<std::string> *GeneratedFileNames, |
| 241 | const std::string &OutputBaseDirectory, |
| 242 | const std::string &RSSourceFilename, |
| 243 | const std::string &BitCodeFileName, |
| 244 | bool EmbedBitcodeInJava); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 245 | |
Jean-Luc Brouillet | 59f22c3 | 2014-06-04 14:53:48 -0700 | [diff] [blame] | 246 | bool reflect(); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 247 | |
| 248 | inline const char *getLastError() const { |
| 249 | if (mLastError.empty()) |
Chris Wailes | 5abbe0e | 2014-08-12 15:58:29 -0700 | [diff] [blame] | 250 | return nullptr; |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 251 | else |
| 252 | return mLastError.c_str(); |
| 253 | } |
Jean-Luc Brouillet | 2ce118e | 2014-05-27 17:41:22 -0700 | [diff] [blame] | 254 | }; // class RSReflectionJava |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 255 | |
Jean-Luc Brouillet | 2ce118e | 2014-05-27 17:41:22 -0700 | [diff] [blame] | 256 | } // namespace slang |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 257 | |
Jean-Luc Brouillet | 2ce118e | 2014-05-27 17:41:22 -0700 | [diff] [blame] | 258 | #endif // _FRAMEWORKS_COMPILE_SLANG_SLANG_RS_REFLECTION_H_ NOLINT |