Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 1 | #ifndef _ANDROID_SLANG_H_ |
| 2 | # define _ANDROID_SLANG_H_ |
| 3 | |
| 4 | #include <stdio.h> |
| 5 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 6 | // Hide the underlying C++ implementation of Slang |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 7 | typedef int SlangCompiler; |
| 8 | |
| 9 | typedef enum { |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 10 | SlangCompilerOutput_Assembly, |
| 11 | SlangCompilerOutput_LL, |
| 12 | SlangCompilerOutput_Bitcode, |
| 13 | SlangCompilerOutput_Nothing, |
| 14 | SlangCompilerOutput_Obj, |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 15 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 16 | SlangCompilerOutput_Default = SlangCompilerOutput_Bitcode |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 17 | } SlangCompilerOutputTy; |
| 18 | |
| 19 | #ifdef __cplusplus |
| 20 | extern "C" { |
| 21 | #endif |
| 22 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 23 | SlangCompiler* slangCreateCompiler(const char *targetTriple, |
| 24 | const char *targetCPU, |
| 25 | const char **targetFeatures); |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 26 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 27 | void slangAllowRSPrefix(SlangCompiler *compiler); |
Kirk Stewart | 1fd8579 | 2010-07-07 09:51:23 -0700 | [diff] [blame] | 28 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 29 | int slangSetSourceFromMemory(SlangCompiler *compiler, |
| 30 | const char *text, |
| 31 | size_t textLength); |
| 32 | int slangSetSourceFromFile(SlangCompiler *compiler, |
| 33 | const char* fileName); |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 34 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 35 | void slangSetOutputType(SlangCompiler *compiler, |
| 36 | SlangCompilerOutputTy outputType); |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 37 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 38 | int slangSetOutputToStream(SlangCompiler *compiler, FILE *stream); |
| 39 | int slangSetOutputToFile(SlangCompiler *compiler, const char *fileName); |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 40 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 41 | void slangAddIncludePath(SlangCompiler *compiler, const char *path); |
Ying Wang | e2e522f | 2010-09-01 13:24:01 -0700 | [diff] [blame] | 42 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 43 | int slangCompile(SlangCompiler *compiler); |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 44 | |
Ying Wang | 3f8b44d | 2010-09-04 01:17:01 -0700 | [diff] [blame] | 45 | // realPackageName: the buffer to receive the package name that's really |
| 46 | // applied, since the package name may be specified in the .rs file. |
| 47 | // bSize: size of the buffer outputPackageName. |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 48 | int slangReflectToJava(SlangCompiler *compiler, |
| 49 | const char *packageName, |
| 50 | char realPackageName[], |
| 51 | int bSize); |
| 52 | int slangReflectToJavaPath(SlangCompiler *compiler, |
| 53 | const char *pathName); |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 54 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 55 | const char* slangGetInfoLog(SlangCompiler *compiler); |
| 56 | void slangGetPragmas(SlangCompiler *compiler, |
| 57 | size_t *actualStringCount, |
| 58 | size_t maxStringCount, |
| 59 | char **strings); |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 60 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 61 | const char* slangExportFuncs(SlangCompiler *compiler); |
Shih-wei Liao | 4c9f742 | 2010-08-05 04:30:02 -0700 | [diff] [blame] | 62 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 63 | void slangReset(SlangCompiler *compiler); |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 64 | |
| 65 | #ifdef __cplusplus |
| 66 | } |
| 67 | #endif |
| 68 | |
| 69 | |
Shih-wei Liao | 9ef2f78 | 2010-10-01 12:31:37 -0700 | [diff] [blame] | 70 | #endif // _ANDROID_SLANG_H_ |