@xnetx/tinyc-native-x86_64-w64-mingw32 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/natives/x86_64-w64-mingw32/toolchain/x86_64-w64-mingw32/tinyc.exe +0 -0
  2. package/package.json +1 -1
  3. package/sysroot/x86_64-w64-mingw32/include/libtcc.h +125 -116
  4. package/sysroot/x86_64-w64-mingw32/include/tinyc_io.h +131 -123
  5. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/_mingw.h +171 -171
  6. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/arm_neon.h +3585 -0
  7. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/assert.h +62 -62
  8. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/avx2intrin.h +93 -0
  9. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/avx512bwintrin.h +128 -0
  10. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/avx512cdintrin.h +31 -0
  11. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/avx512dqintrin.h +123 -0
  12. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/avx512fintrin.h +1075 -0
  13. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/avx512vbmiintrin.h +30 -0
  14. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/avx512vlintrin.h +1633 -0
  15. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/avx512vnniintrin.h +33 -0
  16. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/avxintrin.h +675 -0
  17. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/conio.h +409 -409
  18. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/ctype.h +281 -281
  19. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/dir.h +31 -31
  20. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/direct.h +68 -68
  21. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/dirent.h +135 -135
  22. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/dos.h +55 -55
  23. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/emmintrin.h +213 -0
  24. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/errno.h +75 -75
  25. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/excpt.h +123 -123
  26. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/f16cintrin.h +29 -0
  27. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/fcntl.h +52 -52
  28. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/fenv.h +108 -108
  29. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/float.h +75 -75
  30. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/fmaintrin.h +141 -0
  31. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/immintrin.h +21 -0
  32. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/inttypes.h +297 -297
  33. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/io.h +418 -418
  34. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/iso646.h +36 -36
  35. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/limits.h +116 -116
  36. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/locale.h +91 -91
  37. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/malloc.h +181 -181
  38. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/math.h +497 -497
  39. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/mem.h +13 -13
  40. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/memory.h +40 -40
  41. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/process.h +176 -176
  42. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/riscv_vector.h +12334 -0
  43. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/conio_s.h +42 -42
  44. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/crtdbg_s.h +19 -19
  45. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/io_s.h +33 -33
  46. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/mbstring_s.h +52 -52
  47. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/search_s.h +25 -25
  48. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/stdio_s.h +145 -145
  49. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/stdlib_s.h +67 -67
  50. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/stralign_s.h +30 -30
  51. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/string_s.h +41 -41
  52. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/sys/timeb_s.h +34 -34
  53. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/tchar_s.h +266 -266
  54. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/time_s.h +61 -61
  55. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/wchar_s.h +128 -128
  56. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/setjmp.h +199 -199
  57. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/share.h +28 -28
  58. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/signal.h +63 -63
  59. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/smmintrin.h +74 -0
  60. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/stdalign.h +16 -16
  61. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/stdarg.h +14 -14
  62. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/stdatomic.h +171 -171
  63. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/stdbool.h +11 -11
  64. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/stddef.h +39 -39
  65. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/stdint.h +212 -212
  66. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/stdio.h +429 -429
  67. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/stdlib.h +606 -606
  68. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/stdnoreturn.h +7 -7
  69. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/string.h +164 -164
  70. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sys/fcntl.h +13 -13
  71. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sys/file.h +14 -14
  72. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sys/locking.h +30 -30
  73. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sys/stat.h +290 -290
  74. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sys/time.h +69 -69
  75. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sys/timeb.h +133 -133
  76. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sys/types.h +123 -123
  77. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sys/unistd.h +14 -14
  78. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sys/utime.h +146 -146
  79. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/tcc/tcc_libm.h +618 -618
  80. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/tccdefs.h +338 -338
  81. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/tcclib.h +82 -82
  82. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/tchar.h +1102 -1102
  83. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/tgmath.h +89 -89
  84. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/time.h +287 -287
  85. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/tmmintrin.h +19 -0
  86. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/uchar.h +33 -33
  87. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/unistd.h +1 -1
  88. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/vadefs.h +11 -11
  89. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/values.h +4 -4
  90. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/varargs.h +12 -12
  91. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/wchar.h +873 -873
  92. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/wctype.h +172 -172
  93. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/basetsd.h +149 -149
  94. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/basetyps.h +85 -85
  95. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/guiddef.h +156 -156
  96. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/poppack.h +8 -8
  97. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/pshpack1.h +8 -8
  98. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/pshpack2.h +8 -8
  99. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/pshpack4.h +8 -8
  100. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/pshpack8.h +8 -8
  101. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/qos.h +72 -72
  102. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/shellapi.h +59 -59
  103. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/winbase.h +2966 -2966
  104. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/wincon.h +309 -309
  105. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/windef.h +293 -293
  106. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/windows.h +127 -127
  107. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/winerror.h +3166 -3166
  108. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/wingdi.h +4080 -4080
  109. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/winnls.h +778 -778
  110. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/winnt.h +5994 -5994
  111. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/winreg.h +272 -272
  112. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/winsock2.h +1474 -1474
  113. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/winuser.h +5652 -5652
  114. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/winver.h +160 -160
  115. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/ws2ipdef.h +21 -21
  116. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/ws2tcpip.h +391 -391
  117. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/xmmintrin.h +170 -0
  118. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/lib/gdi32.def +337 -337
  119. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/lib/kernel32.def +776 -776
  120. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/lib/libtcc1.a +0 -0
  121. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/lib/msvcrt.def +1320 -1320
  122. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/lib/runmain.o +0 -0
  123. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/lib/user32.def +658 -658
  124. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/lib/ws2_32.def +198 -198
  125. package/sysroot/x86_64-w64-mingw32/manifest.json +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xnetx/tinyc-native-x86_64-w64-mingw32",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "TinyC native binaries for host x86_64-w64-mingw32 (dual-form TCC builds and target sysroots).",
5
5
  "license": "LGPL-2.1-or-later",
6
6
  "os": [
@@ -1,116 +1,125 @@
1
- #ifndef LIBTCC_H
2
- #define LIBTCC_H
3
-
4
- #ifndef LIBTCCAPI
5
- # define LIBTCCAPI
6
- #endif
7
-
8
- #ifdef __cplusplus
9
- extern "C" {
10
- #endif
11
-
12
- /*****************************/
13
- /* set custom allocator for all allocations (optional), NULL for default. */
14
- typedef void *TCCReallocFunc(void *ptr, unsigned long size);
15
- LIBTCCAPI void tcc_set_realloc(TCCReallocFunc *my_realloc);
16
-
17
- /*****************************/
18
- typedef struct TCCState TCCState;
19
-
20
- /* create a new TCC compilation context */
21
- LIBTCCAPI TCCState *tcc_new(void);
22
-
23
- /* free a TCC compilation context */
24
- LIBTCCAPI void tcc_delete(TCCState *s);
25
-
26
- /* set CONFIG_TCCDIR at runtime */
27
- LIBTCCAPI void tcc_set_lib_path(TCCState *s, const char *path);
28
-
29
- /* set error/warning callback (optional) */
30
- typedef void TCCErrorFunc(void *opaque, const char *msg);
31
- LIBTCCAPI void tcc_set_error_func(TCCState *s, void *error_opaque, TCCErrorFunc *error_func);
32
-
33
- /* set options as from command line (multiple supported) */
34
- LIBTCCAPI int tcc_set_options(TCCState *s, const char *str);
35
-
36
- /*****************************/
37
- /* preprocessor */
38
-
39
- /* add include path */
40
- LIBTCCAPI int tcc_add_include_path(TCCState *s, const char *pathname);
41
-
42
- /* add in system include path */
43
- LIBTCCAPI int tcc_add_sysinclude_path(TCCState *s, const char *pathname);
44
-
45
- /* define preprocessor symbol 'sym'. value can be NULL, sym can be "sym=val" */
46
- LIBTCCAPI void tcc_define_symbol(TCCState *s, const char *sym, const char *value);
47
-
48
- /* undefine preprocess symbol 'sym' */
49
- LIBTCCAPI void tcc_undefine_symbol(TCCState *s, const char *sym);
50
-
51
- /*****************************/
52
- /* compiling */
53
-
54
- /* add a file (C file, dll, object, library, ld script). Return -1 if error. */
55
- LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename);
56
-
57
- /* compile a string containing a C source. Return -1 if error. */
58
- LIBTCCAPI int tcc_compile_string(TCCState *s, const char *buf);
59
-
60
- /* Tip: to have more specific errors/warnings from tcc_compile_string(),
61
- you can prefix the string with "#line <num> \"<filename>\"\n" */
62
-
63
- /*****************************/
64
- /* linking commands */
65
-
66
- /* set output type. MUST BE CALLED before any compilation */
67
- LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type);
68
- #define TCC_OUTPUT_MEMORY 1 /* output will be run in memory */
69
- #define TCC_OUTPUT_EXE 2 /* executable file */
70
- #define TCC_OUTPUT_DLL 4 /* dynamic library */
71
- #define TCC_OUTPUT_OBJ 3 /* object file */
72
- #define TCC_OUTPUT_PREPROCESS 5 /* only preprocess */
73
-
74
- /* equivalent to -Lpath option */
75
- LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname);
76
-
77
- /* the library name is the same as the argument of the '-l' option */
78
- LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname);
79
-
80
- /* add a symbol to the compiled program */
81
- LIBTCCAPI int tcc_add_symbol(TCCState *s, const char *name, const void *val);
82
-
83
- /* output an executable, library or object file. DO NOT call
84
- tcc_relocate() before. */
85
- LIBTCCAPI int tcc_output_file(TCCState *s, const char *filename);
86
-
87
- /* link and run main() function and return its value. DO NOT call
88
- tcc_relocate() before. */
89
- LIBTCCAPI int tcc_run(TCCState *s, int argc, char **argv);
90
-
91
- /* do all relocations (needed before using tcc_get_symbol()) */
92
- LIBTCCAPI int tcc_relocate(TCCState *s1);
93
-
94
- /* return symbol value or NULL if not found */
95
- LIBTCCAPI void *tcc_get_symbol(TCCState *s, const char *name);
96
-
97
- /* list all (global) symbols and their values via 'symbol_cb()' */
98
- LIBTCCAPI void tcc_list_symbols(TCCState *s, void *ctx,
99
- void (*symbol_cb)(void *ctx, const char *name, const void *val));
100
-
101
- /* experimental/advanced section (see libtcc_test_mt.c for an example) */
102
-
103
- /* catch runtime exceptions (optionally limit backtraces at top_func),
104
- when using tcc_set_options("-bt") and when not using tcc_run() */
105
- LIBTCCAPI void *_tcc_setjmp(TCCState *s1, void *jmp_buf, void *top_func, void *longjmp);
106
- #define tcc_setjmp(s1,jb,f) setjmp(_tcc_setjmp(s1, jb, f, longjmp))
107
-
108
- /* custom error printer for runtime exceptions. Returning 0 stops backtrace */
109
- typedef int TCCBtFunc(void *udata, void *pc, const char *file, int line, const char* func, const char *msg);
110
- LIBTCCAPI void tcc_set_backtrace_func(TCCState *s1, void* userdata, TCCBtFunc*);
111
-
112
- #ifdef __cplusplus
113
- }
114
- #endif
115
-
116
- #endif
1
+ #ifndef LIBTCC_H
2
+ #define LIBTCC_H
3
+
4
+ #ifndef LIBTCCAPI
5
+ # define LIBTCCAPI
6
+ #endif
7
+
8
+ #ifdef __cplusplus
9
+ extern "C" {
10
+ #endif
11
+
12
+ /*****************************/
13
+ /* set custom allocator for all allocations (optional), NULL for default. */
14
+ typedef void *TCCReallocFunc(void *ptr, unsigned long size);
15
+ LIBTCCAPI void tcc_set_realloc(TCCReallocFunc *my_realloc);
16
+
17
+ /*****************************/
18
+ typedef struct TCCState TCCState;
19
+ typedef struct TCCIO TCCIO;
20
+
21
+ /* create a new TCC compilation context */
22
+ LIBTCCAPI TCCState *tcc_new(void);
23
+
24
+ /* free a TCC compilation context */
25
+ LIBTCCAPI void tcc_delete(TCCState *s);
26
+
27
+ /* set CONFIG_TCCDIR at runtime */
28
+ LIBTCCAPI void tcc_set_lib_path(TCCState *s, const char *path);
29
+
30
+ /* set error/warning callback (optional) */
31
+ typedef void TCCErrorFunc(void *opaque, const char *msg);
32
+ LIBTCCAPI void tcc_set_error_func(TCCState *s, void *error_opaque, TCCErrorFunc *error_func);
33
+
34
+ /* tinyc: install a TCCIO (tinyc_io.h) on a state; NULL restores the
35
+ * stdio default. All of the state's compiler output - diagnostics
36
+ * without an error callback, -E output, run stdio - goes through it. */
37
+ LIBTCCAPI void tcc_set_io(TCCState *s, TCCIO *io);
38
+ /* tinyc: the state's IO, or the stdio singleton when none (or a NULL
39
+ * state) is given. Never returns NULL. */
40
+ LIBTCCAPI TCCIO *tcc_get_io(TCCState *s);
41
+
42
+ /* set options as from command line (multiple supported) */
43
+ LIBTCCAPI int tcc_set_options(TCCState *s, const char *str);
44
+
45
+ /*****************************/
46
+ /* preprocessor */
47
+
48
+ /* add include path */
49
+ LIBTCCAPI int tcc_add_include_path(TCCState *s, const char *pathname);
50
+
51
+ /* add in system include path */
52
+ LIBTCCAPI int tcc_add_sysinclude_path(TCCState *s, const char *pathname);
53
+
54
+ /* define preprocessor symbol 'sym'. value can be NULL, sym can be "sym=val" */
55
+ LIBTCCAPI void tcc_define_symbol(TCCState *s, const char *sym, const char *value);
56
+
57
+ /* undefine preprocess symbol 'sym' */
58
+ LIBTCCAPI void tcc_undefine_symbol(TCCState *s, const char *sym);
59
+
60
+ /*****************************/
61
+ /* compiling */
62
+
63
+ /* add a file (C file, dll, object, library, ld script). Return -1 if error. */
64
+ LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename);
65
+
66
+ /* compile a string containing a C source. Return -1 if error. */
67
+ LIBTCCAPI int tcc_compile_string(TCCState *s, const char *buf);
68
+
69
+ /* Tip: to have more specific errors/warnings from tcc_compile_string(),
70
+ you can prefix the string with "#line <num> \"<filename>\"\n" */
71
+
72
+ /*****************************/
73
+ /* linking commands */
74
+
75
+ /* set output type. MUST BE CALLED before any compilation */
76
+ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type);
77
+ #define TCC_OUTPUT_MEMORY 1 /* output will be run in memory */
78
+ #define TCC_OUTPUT_EXE 2 /* executable file */
79
+ #define TCC_OUTPUT_DLL 4 /* dynamic library */
80
+ #define TCC_OUTPUT_OBJ 3 /* object file */
81
+ #define TCC_OUTPUT_PREPROCESS 5 /* only preprocess */
82
+
83
+ /* equivalent to -Lpath option */
84
+ LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname);
85
+
86
+ /* the library name is the same as the argument of the '-l' option */
87
+ LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname);
88
+
89
+ /* add a symbol to the compiled program */
90
+ LIBTCCAPI int tcc_add_symbol(TCCState *s, const char *name, const void *val);
91
+
92
+ /* output an executable, library or object file. DO NOT call
93
+ tcc_relocate() before. */
94
+ LIBTCCAPI int tcc_output_file(TCCState *s, const char *filename);
95
+
96
+ /* link and run main() function and return its value. DO NOT call
97
+ tcc_relocate() before. */
98
+ LIBTCCAPI int tcc_run(TCCState *s, int argc, char **argv);
99
+
100
+ /* do all relocations (needed before using tcc_get_symbol()) */
101
+ LIBTCCAPI int tcc_relocate(TCCState *s1);
102
+
103
+ /* return symbol value or NULL if not found */
104
+ LIBTCCAPI void *tcc_get_symbol(TCCState *s, const char *name);
105
+
106
+ /* list all (global) symbols and their values via 'symbol_cb()' */
107
+ LIBTCCAPI void tcc_list_symbols(TCCState *s, void *ctx,
108
+ void (*symbol_cb)(void *ctx, const char *name, const void *val));
109
+
110
+ /* experimental/advanced section (see libtcc_test_mt.c for an example) */
111
+
112
+ /* catch runtime exceptions (optionally limit backtraces at top_func),
113
+ when using tcc_set_options("-bt") and when not using tcc_run() */
114
+ LIBTCCAPI void *_tcc_setjmp(TCCState *s1, void *jmp_buf, void *top_func, void *longjmp);
115
+ #define tcc_setjmp(s1,jb,f) setjmp(_tcc_setjmp(s1, jb, f, longjmp))
116
+
117
+ /* custom error printer for runtime exceptions. Returning 0 stops backtrace */
118
+ typedef int TCCBtFunc(void *udata, void *pc, const char *file, int line, const char* func, const char *msg);
119
+ LIBTCCAPI void tcc_set_backtrace_func(TCCState *s1, void* userdata, TCCBtFunc*);
120
+
121
+ #ifdef __cplusplus
122
+ }
123
+ #endif
124
+
125
+ #endif
@@ -1,123 +1,131 @@
1
- /* tinyc_io.h - IO abstraction for the TinyC dual-form kernel.
2
- *
3
- * All compiler-owned input/output goes through a TCCIO object.
4
- * A NULL TCCIO everywhere in this API means the stdio implementation:
5
- * output goes directly to the process's real stdout/stderr and input
6
- * comes from the real stdin.
7
- */
8
- #ifndef TINYC_IO_H
9
- #define TINYC_IO_H
10
-
11
- #include <stddef.h>
12
- #include <stdio.h>
13
-
14
- #ifdef __cplusplus
15
- extern "C" {
16
- #endif
17
-
18
- typedef struct TCCIO TCCIO;
19
- struct TCCIO {
20
- void *ctx;
21
- /* Return the number of bytes consumed, or -1 on error. */
22
- int (*write_out)(void *ctx, const char *buf, size_t len);
23
- int (*write_err)(void *ctx, const char *buf, size_t len);
24
- /* Return bytes read (0 = EOF), or -1 on error. */
25
- int (*read_in)(void *ctx, char *buf, size_t cap);
26
- void (*flush)(void *ctx);
27
- /* Internal: release ctx. Set by constructors, used by tcc_io_free. */
28
- void (*destroy_ctx)(void *ctx);
29
- int is_singleton; /* stdio/null: tcc_io_free is a no-op */
30
- };
31
-
32
- /* ---- ready-made implementations ------------------------------------ */
33
-
34
- /* The default: out -> stdout, err -> stderr, in <- stdin. Singleton. */
35
- TCCIO *tcc_io_stdio(void);
36
- /* Discards all output, input is always EOF. Singleton. */
37
- TCCIO *tcc_io_null(void);
38
- /* Accumulates out and err in two separate memory buffers. */
39
- TCCIO *tcc_io_buffer(void);
40
- /* Accumulates out and err in one shared buffer, in write order. */
41
- TCCIO *tcc_io_buffer_merged(void);
42
- /* Writes to files it opens itself (closed by tcc_io_free).
43
- * err_path == NULL sends err to the same file as out. */
44
- TCCIO *tcc_io_file(const char *out_path, const char *err_path);
45
- /* Writes to borrowed file descriptors (never closed by tcc_io_free).
46
- * A descriptor of -1 leaves that channel on stdio. */
47
- TCCIO *tcc_io_fd(int out_fd, int err_fd, int in_fd);
48
- /* Writes to borrowed FILE* streams (never closed by tcc_io_free).
49
- * A NULL stream leaves that channel on stdio. */
50
- TCCIO *tcc_io_FILE(FILE *out, FILE *err, FILE *in);
51
- /* Fully custom callbacks. Any callback may be NULL (channel = stdio). */
52
- TCCIO *tcc_io_callback(int (*write_out)(void *, const char *, size_t),
53
- int (*write_err)(void *, const char *, size_t),
54
- int (*read_in)(void *, char *, size_t),
55
- void *ctx);
56
- /* Sends every channel to both a and b. Takes ownership of neither. */
57
- TCCIO *tcc_io_tee(TCCIO *a, TCCIO *b);
58
-
59
- void tcc_io_free(TCCIO *io);
60
-
61
- /* Buffer implementations only: channel 0 = out, 1 = err.
62
- * For the merged buffer both channels return the same data. */
63
- const char *tcc_io_buffer_data(TCCIO *io, int channel, size_t *len);
64
- void tcc_io_buffer_clear(TCCIO *io);
65
-
66
- /* ---- current IO (used by the compiler's own output paths) ---------- */
67
-
68
- /* Install io as the current IO for subsequent compiler output.
69
- * NULL restores the stdio default. */
70
- void tinyc_set_io(TCCIO *io);
71
- TCCIO *tinyc_get_io(void);
72
-
73
- /* Write helpers honoring the current IO (stdio when none is set). */
74
- int tinyc_io_write_out(const char *buf, size_t len);
75
- int tinyc_io_write_err(const char *buf, size_t len);
76
- void tinyc_io_out_str(const char *s);
77
- void tinyc_io_err_str(const char *s);
78
- void tinyc_io_out_fmt(const char *fmt, ...);
79
- void tinyc_io_err_line(const char *s); /* writes s + "\n" to err */
80
- void tinyc_io_flush_all(void);
81
-
82
- /* On Linux: a FILE* whose writes forward to the current IO's out
83
- * channel, or NULL when the current IO is the stdio default. */
84
- FILE *tinyc_io_open_out_stream(void);
85
-
86
- /* ---- -run stdio redirection ----------------------------------------- */
87
-
88
- /* Called by tcc_run around the run program's entry point. When the
89
- * current IO is a non-stdio TCCIO, the process's fd 0/1/2 are
90
- * redirected through it for the duration of the run: fd 0 is fed the
91
- * bytes read_in returns (then EOF), and what the program writes to
92
- * fd 1/2 is delivered to write_out/write_err, per channel, when the
93
- * run ends. The host's fds are restored by tinyc_run_redirect_end.
94
- * With no IO installed, or the stdio IO, both functions are no-ops
95
- * and the run program uses the process's real stdio.
96
- * keep_stdin != 0 leaves fd 0 alone (tcc_run has already reopened
97
- * stdin from a file for the program). Nested calls are counted:
98
- * only the outermost pair redirects. */
99
- void tinyc_run_redirect_begin(int keep_stdin);
100
- void tinyc_run_redirect_end(void);
101
-
102
- /* ---- run-path diagnostic markers ------------------------------------ */
103
-
104
- /* Append one line to the platform diagnostic markers file
105
- * (tinyc_init.markers on Windows). The run path calls these at its
106
- * internal stage boundaries so that a crash inside tcc_run leaves
107
- * the last completed stage on record. Only the Windows image has
108
- * a markers file; everywhere else these are no-ops. */
109
- void tinyc_diag_mark(const char *line);
110
- void tinyc_diag_mark_ptr(const char *label, const void *p);
111
-
112
- /* ---- dual-form entry points ----------------------------------------- */
113
-
114
- /* The compiler's real main, exported from the dual-form file. */
115
- int tinyc_main(int argc, char **argv);
116
- /* tinyc_main with an IO installed for the duration of the call.
117
- * The previous IO is restored before returning. */
118
- int tinyc_main_io(int argc, char **argv, TCCIO *io);
119
-
120
- #ifdef __cplusplus
121
- }
122
- #endif
123
- #endif /* TINYC_IO_H */
1
+ /* tinyc_io.h - IO abstraction for the TinyC dual-form kernel.
2
+ *
3
+ * All compiler-owned input/output goes through a TCCIO object owned
4
+ * by a TCCState: tcc_set_io (libtcc.h) installs one on a state, and
5
+ * every compiler output path of that state - diagnostics, help,
6
+ * version, -E output, the -run stdio redirect - goes through it.
7
+ * There is no process-wide current IO. A state with no IO installed,
8
+ * and a NULL TCCIO everywhere in this API, mean the stdio
9
+ * implementation: output goes directly to the process's real
10
+ * stdout/stderr and input comes from the real stdin.
11
+ */
12
+ #ifndef TINYC_IO_H
13
+ #define TINYC_IO_H
14
+
15
+ #include <stddef.h>
16
+ #include <stdio.h>
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif
21
+
22
+ typedef struct TCCIO TCCIO;
23
+ struct TCCIO {
24
+ void *ctx;
25
+ /* Return the number of bytes consumed, or -1 on error. */
26
+ int (*write_out)(void *ctx, const char *buf, size_t len);
27
+ int (*write_err)(void *ctx, const char *buf, size_t len);
28
+ /* Return bytes read (0 = EOF), or -1 on error. */
29
+ int (*read_in)(void *ctx, char *buf, size_t cap);
30
+ void (*flush)(void *ctx);
31
+ /* Internal: release ctx. Set by constructors, used by tcc_io_free. */
32
+ void (*destroy_ctx)(void *ctx);
33
+ int is_singleton; /* stdio/null: tcc_io_free is a no-op */
34
+ };
35
+
36
+ /* ---- ready-made implementations ------------------------------------ */
37
+
38
+ /* The default: out -> stdout, err -> stderr, in <- stdin. Singleton. */
39
+ TCCIO *tcc_io_stdio(void);
40
+ /* Discards all output, input is always EOF. Singleton. */
41
+ TCCIO *tcc_io_null(void);
42
+ /* Accumulates out and err in two separate memory buffers. */
43
+ TCCIO *tcc_io_buffer(void);
44
+ /* Accumulates out and err in one shared buffer, in write order. */
45
+ TCCIO *tcc_io_buffer_merged(void);
46
+ /* Writes to files it opens itself (closed by tcc_io_free).
47
+ * err_path == NULL sends err to the same file as out. */
48
+ TCCIO *tcc_io_file(const char *out_path, const char *err_path);
49
+ /* Writes to borrowed file descriptors (never closed by tcc_io_free).
50
+ * A descriptor of -1 leaves that channel on stdio. */
51
+ TCCIO *tcc_io_fd(int out_fd, int err_fd, int in_fd);
52
+ /* Writes to borrowed FILE* streams (never closed by tcc_io_free).
53
+ * A NULL stream leaves that channel on stdio. */
54
+ TCCIO *tcc_io_FILE(FILE *out, FILE *err, FILE *in);
55
+ /* Fully custom callbacks. Any callback may be NULL (channel = stdio). */
56
+ TCCIO *tcc_io_callback(int (*write_out)(void *, const char *, size_t),
57
+ int (*write_err)(void *, const char *, size_t),
58
+ int (*read_in)(void *, char *, size_t),
59
+ void *ctx);
60
+ /* Sends every channel to both a and b. Takes ownership of neither. */
61
+ TCCIO *tcc_io_tee(TCCIO *a, TCCIO *b);
62
+
63
+ void tcc_io_free(TCCIO *io);
64
+
65
+ /* Buffer implementations only: channel 0 = out, 1 = err.
66
+ * For the merged buffer both channels return the same data. */
67
+ const char *tcc_io_buffer_data(TCCIO *io, int channel, size_t *len);
68
+ void tcc_io_buffer_clear(TCCIO *io);
69
+
70
+ /* ---- write helpers (used by the compiler's own output paths) ------- */
71
+
72
+ /* Each helper takes the IO to write to - a state's IO as returned by
73
+ * tcc_get_io (libtcc.h), or any TCCIO directly. A NULL IO, like a
74
+ * state with nothing installed, resolves to the stdio singleton. */
75
+ int tinyc_io_write_out(TCCIO *io, const char *buf, size_t len);
76
+ int tinyc_io_write_err(TCCIO *io, const char *buf, size_t len);
77
+ void tinyc_io_out_str(TCCIO *io, const char *s);
78
+ void tinyc_io_err_str(TCCIO *io, const char *s);
79
+ void tinyc_io_out_fmt(TCCIO *io, const char *fmt, ...);
80
+ void tinyc_io_err_fmt(TCCIO *io, const char *fmt, ...);
81
+ void tinyc_io_err_line(TCCIO *io, const char *s); /* writes s + "\n" to err */
82
+ /* Flush io; on Windows also delivers any of io's -E stream output
83
+ * still sitting in its temp file (see tinyc_io_open_out_stream). */
84
+ void tinyc_io_flush(TCCIO *io);
85
+
86
+ /* A FILE* whose writes forward to io's out channel, or NULL when io
87
+ * resolves to the stdio default (callers then keep using stdout). */
88
+ FILE *tinyc_io_open_out_stream(TCCIO *io);
89
+
90
+ /* ---- -run stdio redirection ----------------------------------------- */
91
+
92
+ /* Called by tcc_run around the run program's entry point, with the
93
+ * running state's IO. When that IO is a non-stdio TCCIO, the
94
+ * process's fd 0/1/2 are redirected through it for the duration of
95
+ * the run: fd 0 is fed the bytes read_in returns (then EOF), and
96
+ * what the program writes to fd 1/2 is delivered to write_out /
97
+ * write_err, per channel, when the run ends. The host's fds are
98
+ * restored by tinyc_run_redirect_end. With the stdio IO both
99
+ * functions are no-ops and the run program uses the process's real
100
+ * stdio. keep_stdin != 0 leaves fd 0 alone (tcc_run has already
101
+ * reopened stdin from a file for the program). Nested calls are
102
+ * counted: only the outermost pair redirects. */
103
+ void tinyc_run_redirect_begin(TCCIO *io, int keep_stdin);
104
+ void tinyc_run_redirect_end(void);
105
+
106
+ /* ---- run-path diagnostic markers ------------------------------------ */
107
+
108
+ /* Append one line to the platform diagnostic markers file
109
+ * (tinyc_init.markers on Windows). The run path calls these at its
110
+ * internal stage boundaries so that a crash inside tcc_run leaves
111
+ * the last completed stage on record. Only the Windows image has
112
+ * a markers file; everywhere else these are no-ops. */
113
+ void tinyc_diag_mark(const char *line);
114
+ void tinyc_diag_mark_ptr(const char *label, const void *p);
115
+
116
+ /* ---- dual-form entry points ----------------------------------------- */
117
+
118
+ /* The compiler's real main, exported from the dual-form file. */
119
+ int tinyc_main(int argc, char **argv);
120
+ /* tinyc_main with io installed on every state main creates during
121
+ * the call (main builds a fresh state per pass). States created
122
+ * through the tcc_* API are unaffected. */
123
+ int tinyc_main_with_io(int argc, char **argv, TCCIO *io);
124
+ /* tinyc_main_with_io, plus a flush of io once main has returned:
125
+ * the form the packages' CLI capture calls bind. */
126
+ int tinyc_main_io(int argc, char **argv, TCCIO *io);
127
+
128
+ #ifdef __cplusplus
129
+ }
130
+ #endif
131
+ #endif /* TINYC_IO_H */