Zonr Chang | c383a50 | 2010-10-12 01:52:08 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2010, The Android Open Source Project |
| 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 | |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 17 | #ifndef _FRAMEWORKS_COMPILE_SLANG_SLANG_RS_REFLECTION_H_ // NOLINT |
| 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> |
| 23 | #include <string> |
| 24 | #include <vector> |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 25 | |
zonr | 6315f76 | 2010-10-05 15:35:14 +0800 | [diff] [blame] | 26 | #include "llvm/ADT/StringExtras.h" |
| 27 | |
Stephen Hines | 6e6578a | 2011-02-07 18:05:48 -0800 | [diff] [blame] | 28 | #include "slang_assert.h" |
zonr | 6315f76 | 2010-10-05 15:35:14 +0800 | [diff] [blame] | 29 | #include "slang_rs_export_type.h" |
| 30 | |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 31 | namespace slang { |
| 32 | |
zonr | 6315f76 | 2010-10-05 15:35:14 +0800 | [diff] [blame] | 33 | class RSContext; |
| 34 | class RSExportVar; |
| 35 | class RSExportFunc; |
Stephen Hines | 593a894 | 2011-05-10 15:29:50 -0700 | [diff] [blame^] | 36 | class RSExportForEach; |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 37 | |
| 38 | class RSReflection { |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 39 | private: |
| 40 | const RSContext *mRSContext; |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 41 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 42 | std::string mLastError; |
Stephen Hines | 4cc67fc | 2011-01-31 16:48:57 -0800 | [diff] [blame] | 43 | std::vector<std::string> *mGeneratedFileNames; |
| 44 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 45 | inline void setError(const std::string &Error) { mLastError = Error; } |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 46 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 47 | class Context { |
| 48 | private: |
| 49 | static const char *const ApacheLicenseNote; |
Victor Hsieh | d8a0d18 | 2010-07-07 19:22:33 +0800 | [diff] [blame] | 50 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 51 | static const char *const Import[]; |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 52 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 53 | bool mVerbose; |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 54 | |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 55 | std::string mOutputPathBase; |
Zonr Chang | 8c6d9b2 | 2010-10-07 18:01:19 +0800 | [diff] [blame] | 56 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 57 | std::string mInputRSFile; |
Ying Wang | 4e34844 | 2010-08-18 10:29:12 -0700 | [diff] [blame] | 58 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 59 | std::string mPackageName; |
| 60 | std::string mResourceId; |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 61 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 62 | std::string mClassName; |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 63 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 64 | std::string mLicenseNote; |
Shih-wei Liao | cecd11d | 2010-09-21 08:07:58 -0700 | [diff] [blame] | 65 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 66 | std::string mIndent; |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 67 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 68 | int mPaddingFieldIndex; |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 69 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 70 | int mNextExportVarSlot; |
| 71 | int mNextExportFuncSlot; |
Stephen Hines | 593a894 | 2011-05-10 15:29:50 -0700 | [diff] [blame^] | 72 | int mNextExportForEachSlot; |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 73 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 74 | // A mapping from a field in a record type to its index in the rsType |
| 75 | // instance. Only used when generates TypeClass (ScriptField_*). |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 76 | typedef std::map<const RSExportRecordType::Field*, unsigned> |
| 77 | FieldIndexMapTy; |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 78 | FieldIndexMapTy mFieldIndexMap; |
| 79 | // Field index of current processing TypeClass. |
| 80 | unsigned mFieldIndex; |
Shih-wei Liao | 9c631ff | 2010-09-17 11:57:29 -0700 | [diff] [blame] | 81 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 82 | inline void clear() { |
| 83 | mClassName = ""; |
| 84 | mIndent = ""; |
| 85 | mPaddingFieldIndex = 1; |
| 86 | mNextExportVarSlot = 0; |
| 87 | mNextExportFuncSlot = 0; |
Stephen Hines | 593a894 | 2011-05-10 15:29:50 -0700 | [diff] [blame^] | 88 | mNextExportForEachSlot = 0; |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 89 | return; |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 90 | } |
| 91 | |
Zonr Chang | 8c6d9b2 | 2010-10-07 18:01:19 +0800 | [diff] [blame] | 92 | bool openClassFile(const std::string &ClassName, |
| 93 | std::string &ErrorMsg); |
| 94 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 95 | public: |
| 96 | typedef enum { |
| 97 | AM_Public, |
| 98 | AM_Protected, |
| 99 | AM_Private |
| 100 | } AccessModifier; |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 101 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 102 | bool mUseStdout; |
| 103 | mutable std::ofstream mOF; |
| 104 | |
| 105 | static const char *AccessModifierStr(AccessModifier AM); |
| 106 | |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 107 | Context(const std::string &OutputPathBase, |
Zonr Chang | 8c6d9b2 | 2010-10-07 18:01:19 +0800 | [diff] [blame] | 108 | const std::string &InputRSFile, |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 109 | const std::string &PackageName, |
| 110 | const std::string &ResourceId, |
| 111 | bool UseStdout) |
| 112 | : mVerbose(true), |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 113 | mOutputPathBase(OutputPathBase), |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 114 | mInputRSFile(InputRSFile), |
| 115 | mPackageName(PackageName), |
| 116 | mResourceId(ResourceId), |
| 117 | mLicenseNote(ApacheLicenseNote), |
| 118 | mUseStdout(UseStdout) { |
| 119 | clear(); |
Zonr Chang | 66aa299 | 2010-10-05 15:56:31 +0800 | [diff] [blame] | 120 | resetFieldIndex(); |
| 121 | clearFieldIndexMap(); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 122 | return; |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 123 | } |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 124 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 125 | inline std::ostream &out() const { |
zonr | 6315f76 | 2010-10-05 15:35:14 +0800 | [diff] [blame] | 126 | return ((mUseStdout) ? std::cout : mOF); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 127 | } |
| 128 | inline std::ostream &indent() const { |
| 129 | out() << mIndent; |
| 130 | return out(); |
| 131 | } |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 132 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 133 | inline void incIndentLevel() { |
| 134 | mIndent.append(4, ' '); |
| 135 | return; |
| 136 | } |
| 137 | |
| 138 | inline void decIndentLevel() { |
Stephen Hines | 6e6578a | 2011-02-07 18:05:48 -0800 | [diff] [blame] | 139 | slangAssert(getIndentLevel() > 0 && "No indent"); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 140 | mIndent.erase(0, 4); |
| 141 | return; |
| 142 | } |
| 143 | |
Zonr Chang | 92b344a | 2010-10-05 20:39:03 +0800 | [diff] [blame] | 144 | inline int getIndentLevel() { return (mIndent.length() >> 2); } |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 145 | |
Zonr Chang | 92b344a | 2010-10-05 20:39:03 +0800 | [diff] [blame] | 146 | inline int getNextExportVarSlot() { return mNextExportVarSlot++; } |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 147 | |
Zonr Chang | 92b344a | 2010-10-05 20:39:03 +0800 | [diff] [blame] | 148 | inline int getNextExportFuncSlot() { return mNextExportFuncSlot++; } |
Stephen Hines | 593a894 | 2011-05-10 15:29:50 -0700 | [diff] [blame^] | 149 | inline int getNextExportForEachSlot() { return mNextExportForEachSlot++; } |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 150 | |
| 151 | // Will remove later due to field name information is not necessary for |
| 152 | // C-reflect-to-Java |
| 153 | inline std::string createPaddingField() { |
| 154 | return "#padding_" + llvm::itostr(mPaddingFieldIndex++); |
| 155 | } |
| 156 | |
| 157 | inline void setLicenseNote(const std::string &LicenseNote) { |
| 158 | mLicenseNote = LicenseNote; |
| 159 | } |
| 160 | |
| 161 | bool startClass(AccessModifier AM, |
| 162 | bool IsStatic, |
| 163 | const std::string &ClassName, |
| 164 | const char *SuperClassName, |
| 165 | std::string &ErrorMsg); |
| 166 | void endClass(); |
| 167 | |
| 168 | void startFunction(AccessModifier AM, |
| 169 | bool IsStatic, |
| 170 | const char *ReturnType, |
| 171 | const std::string &FunctionName, |
| 172 | int Argc, ...); |
| 173 | |
| 174 | typedef std::vector<std::pair<std::string, std::string> > ArgTy; |
| 175 | void startFunction(AccessModifier AM, |
| 176 | bool IsStatic, |
| 177 | const char *ReturnType, |
| 178 | const std::string &FunctionName, |
| 179 | const ArgTy &Args); |
| 180 | void endFunction(); |
| 181 | |
| 182 | void startBlock(bool ShouldIndent = false); |
| 183 | void endBlock(); |
| 184 | |
| 185 | inline const std::string &getPackageName() const { return mPackageName; } |
| 186 | inline const std::string &getClassName() const { return mClassName; } |
| 187 | inline const std::string &getResourceId() const { return mResourceId; } |
| 188 | |
| 189 | void startTypeClass(const std::string &ClassName); |
| 190 | void endTypeClass(); |
| 191 | |
Zonr Chang | 92b344a | 2010-10-05 20:39:03 +0800 | [diff] [blame] | 192 | inline void incFieldIndex() { mFieldIndex++; } |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 193 | |
Zonr Chang | 92b344a | 2010-10-05 20:39:03 +0800 | [diff] [blame] | 194 | inline void resetFieldIndex() { mFieldIndex = 0; } |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 195 | |
| 196 | inline void addFieldIndexMapping(const RSExportRecordType::Field *F) { |
Stephen Hines | 6e6578a | 2011-02-07 18:05:48 -0800 | [diff] [blame] | 197 | slangAssert((mFieldIndexMap.find(F) == mFieldIndexMap.end()) && |
| 198 | "Nested structure never occurs in C language."); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 199 | mFieldIndexMap.insert(std::make_pair(F, mFieldIndex)); |
| 200 | } |
| 201 | |
| 202 | inline unsigned getFieldIndex(const RSExportRecordType::Field *F) const { |
| 203 | FieldIndexMapTy::const_iterator I = mFieldIndexMap.find(F); |
Stephen Hines | 6e6578a | 2011-02-07 18:05:48 -0800 | [diff] [blame] | 204 | slangAssert((I != mFieldIndexMap.end()) && |
| 205 | "Requesting field is out of scope."); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 206 | return I->second; |
| 207 | } |
| 208 | |
Zonr Chang | 92b344a | 2010-10-05 20:39:03 +0800 | [diff] [blame] | 209 | inline void clearFieldIndexMap() { mFieldIndexMap.clear(); } |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 210 | }; |
| 211 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 212 | bool genScriptClass(Context &C, |
| 213 | const std::string &ClassName, |
| 214 | std::string &ErrorMsg); |
| 215 | void genScriptClassConstructor(Context &C); |
| 216 | |
| 217 | void genInitBoolExportVariable(Context &C, |
| 218 | const std::string &VarName, |
| 219 | const clang::APValue &Val); |
| 220 | void genInitPrimitiveExportVariable(Context &C, |
zonr | 6315f76 | 2010-10-05 15:35:14 +0800 | [diff] [blame] | 221 | const std::string &VarName, |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 222 | const clang::APValue &Val); |
| 223 | void genInitExportVariable(Context &C, |
| 224 | const RSExportType *ET, |
| 225 | const std::string &VarName, |
| 226 | const clang::APValue &Val); |
| 227 | void genExportVariable(Context &C, const RSExportVar *EV); |
| 228 | void genPrimitiveTypeExportVariable(Context &C, const RSExportVar *EV); |
| 229 | void genPointerTypeExportVariable(Context &C, const RSExportVar *EV); |
| 230 | void genVectorTypeExportVariable(Context &C, const RSExportVar *EV); |
Zonr Chang | 92b344a | 2010-10-05 20:39:03 +0800 | [diff] [blame] | 231 | void genMatrixTypeExportVariable(Context &C, const RSExportVar *EV); |
Zonr Chang | 2e1dba6 | 2010-10-05 22:20:11 +0800 | [diff] [blame] | 232 | void genConstantArrayTypeExportVariable(Context &C, const RSExportVar *EV); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 233 | void genRecordTypeExportVariable(Context &C, const RSExportVar *EV); |
| 234 | void genGetExportVariable(Context &C, |
| 235 | const std::string &TypeName, |
| 236 | const std::string &VarName); |
| 237 | |
| 238 | void genExportFunction(Context &C, |
| 239 | const RSExportFunc *EF); |
| 240 | |
Stephen Hines | 593a894 | 2011-05-10 15:29:50 -0700 | [diff] [blame^] | 241 | void genExportForEach(Context &C, |
| 242 | const RSExportForEach *EF); |
| 243 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 244 | bool genTypeClass(Context &C, |
| 245 | const RSExportRecordType *ERT, |
| 246 | std::string &ErrorMsg); |
Zonr Chang | 2e1dba6 | 2010-10-05 22:20:11 +0800 | [diff] [blame] | 247 | void genTypeItemClass(Context &C, const RSExportRecordType *ERT); |
Zonr Chang | 92b344a | 2010-10-05 20:39:03 +0800 | [diff] [blame] | 248 | void genTypeClassConstructor(Context &C, const RSExportRecordType *ERT); |
| 249 | void genTypeClassCopyToArray(Context &C, const RSExportRecordType *ERT); |
| 250 | void genTypeClassItemSetter(Context &C, const RSExportRecordType *ERT); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 251 | void genTypeClassItemGetter(Context &C, const RSExportRecordType *ERT); |
| 252 | void genTypeClassComponentSetter(Context &C, const RSExportRecordType *ERT); |
| 253 | void genTypeClassComponentGetter(Context &C, const RSExportRecordType *ERT); |
| 254 | void genTypeClassCopyAll(Context &C, const RSExportRecordType *ERT); |
Zonr Chang | d42a429 | 2010-10-17 02:38:43 +0800 | [diff] [blame] | 255 | void genTypeClassResize(Context &C); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 256 | |
| 257 | void genBuildElement(Context &C, |
Zonr Chang | 89273bd | 2010-10-14 20:57:38 +0800 | [diff] [blame] | 258 | const char *ElementBuilderName, |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 259 | const RSExportRecordType *ERT, |
Zonr Chang | 89273bd | 2010-10-14 20:57:38 +0800 | [diff] [blame] | 260 | const char *RenderScriptVar, |
| 261 | bool IsInline); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 262 | void genAddElementToElementBuilder(Context &C, |
| 263 | const RSExportType *ERT, |
| 264 | const std::string &VarName, |
| 265 | const char *ElementBuilderName, |
Zonr Chang | 89273bd | 2010-10-14 20:57:38 +0800 | [diff] [blame] | 266 | const char *RenderScriptVar, |
| 267 | unsigned ArraySize); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 268 | void genAddPaddingToElementBuiler(Context &C, |
| 269 | int PaddingSize, |
| 270 | const char *ElementBuilderName, |
| 271 | const char *RenderScriptVar); |
| 272 | |
| 273 | bool genCreateFieldPacker(Context &C, |
| 274 | const RSExportType *T, |
| 275 | const char *FieldPackerName); |
| 276 | void genPackVarOfType(Context &C, |
| 277 | const RSExportType *T, |
| 278 | const char *VarName, |
| 279 | const char *FieldPackerName); |
Zonr Chang | 2e1dba6 | 2010-10-05 22:20:11 +0800 | [diff] [blame] | 280 | void genAllocateVarOfType(Context &C, |
| 281 | const RSExportType *T, |
| 282 | const std::string &VarName); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 283 | void genNewItemBufferIfNull(Context &C, const char *Index); |
| 284 | void genNewItemBufferPackerIfNull(Context &C); |
| 285 | |
| 286 | public: |
Stephen Hines | 4cc67fc | 2011-01-31 16:48:57 -0800 | [diff] [blame] | 287 | explicit RSReflection(const RSContext *Context, |
| 288 | std::vector<std::string> *GeneratedFileNames) |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 289 | : mRSContext(Context), |
Stephen Hines | 4cc67fc | 2011-01-31 16:48:57 -0800 | [diff] [blame] | 290 | mLastError(""), |
| 291 | mGeneratedFileNames(GeneratedFileNames) { |
Stephen Hines | 6e6578a | 2011-02-07 18:05:48 -0800 | [diff] [blame] | 292 | slangAssert(mGeneratedFileNames && "Must supply GeneratedFileNames"); |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 293 | return; |
| 294 | } |
| 295 | |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 296 | bool reflect(const std::string &OutputPathBase, |
| 297 | const std::string &OutputPackageName, |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 298 | const std::string &InputFileName, |
| 299 | const std::string &OutputBCFileName); |
| 300 | |
| 301 | inline const char *getLastError() const { |
| 302 | if (mLastError.empty()) |
| 303 | return NULL; |
| 304 | else |
| 305 | return mLastError.c_str(); |
| 306 | } |
| 307 | }; // class RSReflection |
| 308 | |
| 309 | } // namespace slang |
| 310 | |
Stephen Hines | e639eb5 | 2010-11-08 19:27:20 -0800 | [diff] [blame] | 311 | #endif // _FRAMEWORKS_COMPILE_SLANG_SLANG_RS_REFLECTION_H_ NOLINT |