blob: 09f07ad26dc014fbdf09ca0506fc8b76f51158e2 [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
Shih-wei Liao9ef2f782010-10-01 12:31:37 -07006// Hide the underlying C++ implementation of Slang
Shih-wei Liao462aefd2010-06-04 15:32:04 -07007typedef int SlangCompiler;
8
9typedef enum {
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070010 SlangCompilerOutput_Assembly,
11 SlangCompilerOutput_LL,
12 SlangCompilerOutput_Bitcode,
13 SlangCompilerOutput_Nothing,
14 SlangCompilerOutput_Obj,
Shih-wei Liao462aefd2010-06-04 15:32:04 -070015
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070016 SlangCompilerOutput_Default = SlangCompilerOutput_Bitcode
Shih-wei Liao462aefd2010-06-04 15:32:04 -070017} SlangCompilerOutputTy;
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070023SlangCompiler* slangCreateCompiler(const char *targetTriple,
24 const char *targetCPU,
25 const char **targetFeatures);
Shih-wei Liao462aefd2010-06-04 15:32:04 -070026
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070027void slangAllowRSPrefix(SlangCompiler *compiler);
Kirk Stewart1fd85792010-07-07 09:51:23 -070028
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070029int slangSetSourceFromMemory(SlangCompiler *compiler,
30 const char *text,
31 size_t textLength);
32int slangSetSourceFromFile(SlangCompiler *compiler,
33 const char* fileName);
Shih-wei Liao462aefd2010-06-04 15:32:04 -070034
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070035void slangSetOutputType(SlangCompiler *compiler,
36 SlangCompilerOutputTy outputType);
Shih-wei Liao462aefd2010-06-04 15:32:04 -070037
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070038int slangSetOutputToStream(SlangCompiler *compiler, FILE *stream);
39int slangSetOutputToFile(SlangCompiler *compiler, const char *fileName);
Shih-wei Liao462aefd2010-06-04 15:32:04 -070040
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070041void slangAddIncludePath(SlangCompiler *compiler, const char *path);
Ying Wange2e522f2010-09-01 13:24:01 -070042
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070043int slangCompile(SlangCompiler *compiler);
Shih-wei Liao462aefd2010-06-04 15:32:04 -070044
Ying Wang3f8b44d2010-09-04 01:17:01 -070045// 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 Liao9ef2f782010-10-01 12:31:37 -070048int slangReflectToJava(SlangCompiler *compiler,
49 const char *packageName,
50 char realPackageName[],
51 int bSize);
52int slangReflectToJavaPath(SlangCompiler *compiler,
53 const char *pathName);
Shih-wei Liao462aefd2010-06-04 15:32:04 -070054
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070055const char* slangGetInfoLog(SlangCompiler *compiler);
56void slangGetPragmas(SlangCompiler *compiler,
57 size_t *actualStringCount,
58 size_t maxStringCount,
59 char **strings);
Shih-wei Liao462aefd2010-06-04 15:32:04 -070060
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070061const char* slangExportFuncs(SlangCompiler *compiler);
Shih-wei Liao4c9f7422010-08-05 04:30:02 -070062
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070063void slangReset(SlangCompiler *compiler);
Shih-wei Liao462aefd2010-06-04 15:32:04 -070064
65#ifdef __cplusplus
66}
67#endif
68
69
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070070#endif // _ANDROID_SLANG_H_