Subversion Repositories Kolibri OS

Rev

Rev 647 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 647 Rev 6429
Line 1... Line 1...
1
#ifndef LIBTCC_H
1
#ifndef LIBTCC_H
2
#define LIBTCC_H
2
#define LIBTCC_H
Line -... Line 3...
-
 
3
 
-
 
4
#ifndef LIBTCCAPI
-
 
5
# define LIBTCCAPI
-
 
6
#endif
3
 
7
 
4
#ifdef __cplusplus
8
#ifdef __cplusplus
5
extern "C" {
9
extern "C" {
Line 6... Line 10...
6
#endif
10
#endif
Line 7... Line 11...
7
 
11
 
Line 8... Line 12...
8
struct TCCState;
12
struct TCCState;
9
 
13
 
Line 10... Line 14...
10
typedef struct TCCState TCCState;
14
typedef struct TCCState TCCState;
11
 
15
 
Line 12... Line 16...
12
/* create a new TCC compilation context */
16
/* create a new TCC compilation context */
13
TCCState *tcc_new(void);
17
LIBTCCAPI TCCState *tcc_new(void);
Line 14... Line 18...
14
 
18
 
15
/* free a TCC compilation context */
19
/* free a TCC compilation context */
16
void tcc_delete(TCCState *s);
20
LIBTCCAPI void tcc_delete(TCCState *s);
Line 17... Line 21...
17
 
21
 
18
/* add debug information in the generated code */
22
/* set CONFIG_TCCDIR at runtime */
Line 19... Line 23...
19
void tcc_enable_debug(TCCState *s);
23
LIBTCCAPI void tcc_set_lib_path(TCCState *s, const char *path);
20
 
24
 
Line 21... Line 25...
21
/* set error/warning display callback */
25
/* set error/warning display callback */
22
void tcc_set_error_func(TCCState *s, void *error_opaque,
26
LIBTCCAPI void tcc_set_error_func(TCCState *s, void *error_opaque,
Line 23... Line 27...
23
                        void (*error_func)(void *opaque, const char *msg));
27
    void (*error_func)(void *opaque, const char *msg));
24
 
28
 
Line 25... Line 29...
25
/* set/reset a warning */
29
/* set options as from command line (multiple supported) */
26
int tcc_set_warning(TCCState *s, const char *warning_name, int value);
30
LIBTCCAPI int tcc_set_options(TCCState *s, const char *str);
Line 27... Line 31...
27
 
31
 
28
/*****************************/
32
/*****************************/
Line 29... Line 33...
29
/* preprocessor */
33
/* preprocessor */
30
 
34
 
Line 31... Line 35...
31
/* add include path */
35
/* add include path */
-
 
36
LIBTCCAPI int tcc_add_include_path(TCCState *s, const char *pathname);
32
int tcc_add_include_path(TCCState *s, const char *pathname);
37
 
-
 
38
/* add in system include path */
33
 
39
LIBTCCAPI int tcc_add_sysinclude_path(TCCState *s, const char *pathname);
-
 
40
 
34
/* add in system include path */
41
/* define preprocessor symbol 'sym'. Can put optional value */
35
int tcc_add_sysinclude_path(TCCState *s, const char *pathname);
42
LIBTCCAPI void tcc_define_symbol(TCCState *s, const char *sym, const char *value);
36
 
-
 
37
/* define preprocessor symbol 'sym'. Can put optional value */
43
 
Line 38... Line 44...
38
void tcc_define_symbol(TCCState *s, const char *sym, const char *value);
44
/* undefine preprocess symbol 'sym' */
39
 
45
LIBTCCAPI void tcc_undefine_symbol(TCCState *s, const char *sym);
Line 40... Line 46...
40
/* undefine preprocess symbol 'sym' */
46
 
41
void tcc_undefine_symbol(TCCState *s, const char *sym);
47
/*****************************/
42
 
48
/* compiling */
43
/*****************************/
49
 
44
/* compiling */
50
/* add a file (C file, dll, object, library, ld script). Return -1 if error. */
45
 
51
LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename, int filetype);
46
/* add a file (either a C file, dll, an object, a library or an ld
-
 
47
   script). Return -1 if error. */
-
 
48
int tcc_add_file(TCCState *s, const char *filename);
52
#define TCC_FILETYPE_BINARY 1
49
 
-
 
50
/* compile a string containing a C source. Return non zero if
-
 
Line 51... Line 53...
51
   error. */
53
#define TCC_FILETYPE_C      2
52
int tcc_compile_string(TCCState *s, const char *buf);
54
#define TCC_FILETYPE_ASM    3
Line 53... Line 55...
53
 
55
#define TCC_FILETYPE_ASM_PP 4
54
/*****************************/
56
 
Line 55... Line 57...
55
/* linking commands */
57
/* compile a string containing a C source. Return -1 if error. */
56
 
58
LIBTCCAPI int tcc_compile_string(TCCState *s, const char *buf);
Line 57... Line 59...
57
/* set output type. MUST BE CALLED before any compilation */
59
 
58
#define TCC_OUTPUT_MEMORY   0 /* output will be ran in memory (no
60
/*****************************/
59
                                 output file) (default) */
61
/* linking commands */
Line 60... Line 62...
60
#define TCC_OUTPUT_EXE      1 /* executable file */
62
 
61
#define TCC_OUTPUT_DLL      2 /* dynamic library */
63
/* set output type. MUST BE CALLED before any compilation */
62
#define TCC_OUTPUT_OBJ      3 /* object file */
64
LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type);
Line 63... Line 65...
63
int tcc_set_output_type(TCCState *s, int output_type);
65
#define TCC_OUTPUT_MEMORY   1 /* output will be run in memory (default) */
-
 
66
#define TCC_OUTPUT_EXE      2 /* executable file */
-
 
67
#define TCC_OUTPUT_DLL      3 /* dynamic library */
-
 
68
#define TCC_OUTPUT_OBJ      4 /* object file */
-
 
69
#define TCC_OUTPUT_PREPROCESS 5 /* only preprocess (used internally) */
-
 
70
 
64
 
71
/* equivalent to -Lpath option */
65
#define TCC_OUTPUT_FORMAT_ELF    0 /* default output format: ELF */
72
LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname);
Line 66... Line 73...
66
#define TCC_OUTPUT_FORMAT_BINARY 1 /* binary image output */
73
 
67
#define TCC_OUTPUT_FORMAT_COFF   2 /* COFF */
74
/* the library name is the same as the argument of the '-l' option */
Line 68... Line 75...
68
 
75
LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname);
69
/* equivalent to -Lpath option */
76
 
70
int tcc_add_library_path(TCCState *s, const char *pathname);
77
/* add a symbol to the compiled program */