blob: 48b01e483457068e93bee3e06a5514822c7ce898 [file] [log] [blame]
Shih-wei Liao462aefd2010-06-04 15:32:04 -07001#ifndef _ANDROID_SLANG_H_
2# define _ANDROID_SLANG_H_
3
4#include <stdio.h>
5
6/* Hide the underlying C++ implementation of Slang */
7typedef int SlangCompiler;
8
9typedef enum {
10 SlangCompilerOutput_Assembly,
11 SlangCompilerOutput_LL,
12 SlangCompilerOutput_Bitcode,
13 SlangCompilerOutput_Nothing,
14 SlangCompilerOutput_Obj,
15
16 SlangCompilerOutput_Default = SlangCompilerOutput_Bitcode
17} SlangCompilerOutputTy;
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23SlangCompiler* slangCreateCompiler(const char* targetTriple, const char* targetCPU, const char** targetFeatures);
24
Kirk Stewart1fd85792010-07-07 09:51:23 -070025void slangAllowRSPrefix();
26
Shih-wei Liao462aefd2010-06-04 15:32:04 -070027int slangSetSourceFromMemory(SlangCompiler* compiler, const char* text, size_t textLength);
28int slangSetSourceFromFile(SlangCompiler* compiler, const char* fileName);
29
30void slangSetOutputType(SlangCompiler* compiler, SlangCompilerOutputTy outputType);
31
32int slangSetOutputToStream(SlangCompiler* compiler, FILE* stream);
33int slangSetOutputToFile(SlangCompiler* compiler, const char* fileName);
34
Ying Wange2e522f2010-09-01 13:24:01 -070035void slangAddIncludePath(SlangCompiler* compiler, const char* path);
36
Shih-wei Liao462aefd2010-06-04 15:32:04 -070037int slangCompile(SlangCompiler* compiler);
38
Ying Wang3f8b44d2010-09-04 01:17:01 -070039// realPackageName: the buffer to receive the package name that's really
40// applied, since the package name may be specified in the .rs file.
41// bSize: size of the buffer outputPackageName.
42int slangReflectToJava(SlangCompiler* compiler, const char* packageName,
43 char realPackageName[], int bSize);
Shih-wei Liao6de89272010-07-15 15:26:20 -070044int slangReflectToJavaPath(SlangCompiler* compiler, const char* pathName);
Shih-wei Liao462aefd2010-06-04 15:32:04 -070045
46const char* slangGetInfoLog(SlangCompiler* compiler);
47void slangGetPragmas(SlangCompiler* compiler, size_t* actualStringCount, size_t maxStringCount, char** strings);
48
Shih-wei Liao4c9f7422010-08-05 04:30:02 -070049const char* slangExportFuncs(SlangCompiler* compiler);
50
Shih-wei Liao462aefd2010-06-04 15:32:04 -070051void slangReset(SlangCompiler* compiler);
52
53#ifdef __cplusplus
54}
55#endif
56
57
58#endif /* _ANDROID_SLANG_H_ */