@xnetx/tinyc-native-x86_64-w64-mingw32 0.0.0-stage → 0.1.1

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 (110) hide show
  1. package/README.md +45 -2
  2. package/README.zh-CN.md +31 -0
  3. package/natives/x86_64-w64-mingw32/toolchain/x86_64-w64-mingw32/tinyc.exe +0 -0
  4. package/package.json +17 -4
  5. package/packaging-manifest.json +57 -0
  6. package/sysroot/x86_64-w64-mingw32/include/libtcc.h +116 -0
  7. package/sysroot/x86_64-w64-mingw32/include/tinyc_io.h +123 -0
  8. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/_mingw.h +171 -0
  9. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/assert.h +62 -0
  10. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/conio.h +409 -0
  11. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/ctype.h +281 -0
  12. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/dir.h +31 -0
  13. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/direct.h +68 -0
  14. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/dirent.h +135 -0
  15. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/dos.h +55 -0
  16. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/errno.h +75 -0
  17. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/excpt.h +123 -0
  18. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/fcntl.h +52 -0
  19. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/fenv.h +108 -0
  20. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/float.h +75 -0
  21. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/inttypes.h +297 -0
  22. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/io.h +418 -0
  23. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/iso646.h +36 -0
  24. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/limits.h +116 -0
  25. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/locale.h +91 -0
  26. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/malloc.h +181 -0
  27. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/math.h +497 -0
  28. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/mem.h +13 -0
  29. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/memory.h +40 -0
  30. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/process.h +176 -0
  31. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/conio_s.h +42 -0
  32. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/crtdbg_s.h +19 -0
  33. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/io_s.h +33 -0
  34. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/mbstring_s.h +52 -0
  35. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/search_s.h +25 -0
  36. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/stdio_s.h +145 -0
  37. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/stdlib_s.h +67 -0
  38. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/stralign_s.h +30 -0
  39. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/string_s.h +41 -0
  40. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/sys/timeb_s.h +34 -0
  41. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/tchar_s.h +266 -0
  42. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/time_s.h +61 -0
  43. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sec_api/wchar_s.h +128 -0
  44. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/setjmp.h +199 -0
  45. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/share.h +28 -0
  46. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/signal.h +63 -0
  47. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/stdalign.h +16 -0
  48. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/stdarg.h +14 -0
  49. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/stdatomic.h +171 -0
  50. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/stdbool.h +11 -0
  51. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/stddef.h +39 -0
  52. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/stdint.h +212 -0
  53. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/stdio.h +429 -0
  54. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/stdlib.h +606 -0
  55. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/stdnoreturn.h +7 -0
  56. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/string.h +164 -0
  57. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sys/fcntl.h +13 -0
  58. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sys/file.h +14 -0
  59. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sys/locking.h +30 -0
  60. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sys/stat.h +290 -0
  61. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sys/time.h +69 -0
  62. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sys/timeb.h +133 -0
  63. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sys/types.h +123 -0
  64. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sys/unistd.h +14 -0
  65. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/sys/utime.h +146 -0
  66. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/tcc/tcc_libm.h +618 -0
  67. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/tccdefs.h +338 -0
  68. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/tcclib.h +82 -0
  69. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/tchar.h +1102 -0
  70. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/tgmath.h +89 -0
  71. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/time.h +287 -0
  72. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/uchar.h +33 -0
  73. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/unistd.h +1 -0
  74. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/vadefs.h +11 -0
  75. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/values.h +4 -0
  76. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/varargs.h +12 -0
  77. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/wchar.h +873 -0
  78. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/wctype.h +172 -0
  79. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/basetsd.h +149 -0
  80. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/basetyps.h +85 -0
  81. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/guiddef.h +156 -0
  82. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/poppack.h +8 -0
  83. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/pshpack1.h +8 -0
  84. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/pshpack2.h +8 -0
  85. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/pshpack4.h +8 -0
  86. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/pshpack8.h +8 -0
  87. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/qos.h +72 -0
  88. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/shellapi.h +59 -0
  89. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/winbase.h +2966 -0
  90. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/wincon.h +309 -0
  91. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/windef.h +293 -0
  92. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/windows.h +127 -0
  93. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/winerror.h +3166 -0
  94. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/wingdi.h +4080 -0
  95. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/winnls.h +778 -0
  96. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/winnt.h +5994 -0
  97. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/winreg.h +272 -0
  98. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/winsock2.h +1474 -0
  99. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/winuser.h +5652 -0
  100. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/winver.h +160 -0
  101. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/ws2ipdef.h +21 -0
  102. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/include/winapi/ws2tcpip.h +391 -0
  103. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/lib/gdi32.def +337 -0
  104. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/lib/kernel32.def +776 -0
  105. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/lib/libtcc1.a +0 -0
  106. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/lib/msvcrt.def +1320 -0
  107. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/lib/runmain.o +0 -0
  108. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/lib/user32.def +658 -0
  109. package/sysroot/x86_64-w64-mingw32/lib/tcc/win32/lib/ws2_32.def +198 -0
  110. package/sysroot/x86_64-w64-mingw32/manifest.json +18 -0
package/README.md CHANGED
@@ -1,3 +1,46 @@
1
- # Temporary Holding Version
1
+ # @xnetx/tinyc-native-x86_64-w64-mingw32
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **English** | [简体中文](README.zh-CN.md)
4
+
5
+ Native toolchain package for the [`@xnetx/tinyc`](https://www.npmjs.com/package/@xnetx/tinyc)
6
+ Node.js package, for hosts running **Windows on x86_64** (host triple
7
+ `x86_64-w64-mingw32`).
8
+
9
+ `@xnetx/tinyc` embeds the TinyC (TCC) compiler in Node.js. This subpackage
10
+ carries the host-specific half of that distribution: the dual-form
11
+ compiler binaries — each one is both the `tcc` command-line executable
12
+ and a library exporting the libtcc `tcc_*` API — and the bundled
13
+ headers and libraries (sysroots) for every target this host builds
14
+ for:
15
+
16
+ - `x86_64-w64-mingw32` (this host)
17
+
18
+ ## Installation
19
+
20
+ You do not normally install this package directly. The main `@xnetx/tinyc`
21
+ package declares every platform subpackage in its
22
+ `optionalDependencies`, and npm installs the one whose `os` / `cpu`
23
+ fields match your machine; this package matches
24
+ `os: win32` / `cpu: x64`, so `npm install @xnetx/tinyc` brings
25
+ it in automatically on such a host.
26
+
27
+ To install it explicitly anyway:
28
+
29
+ ```sh
30
+ npm install @xnetx/tinyc-native-x86_64-w64-mingw32
31
+ ```
32
+
33
+ ## Layout
34
+
35
+ - `natives/x86_64-w64-mingw32/toolchain/<target>/tinyc.exe` — dual-form compiler
36
+ binary: runs on this host, generates code for `<target>`.
37
+ - `sysroot/<target>/` — bundled headers (`include/`) and libraries
38
+ (`lib/`) for `<target>`.
39
+ - `packaging-manifest.json` — the host/target combinations and the
40
+ output formats this package carries.
41
+
42
+ ## See also
43
+
44
+ - Main package: [`@xnetx/tinyc`](https://www.npmjs.com/package/@xnetx/tinyc)
45
+ - Repository: <https://github.com/xnetsc/tinyc-in-one>
46
+ - License: LGPL-2.1-or-later
@@ -0,0 +1,31 @@
1
+ # @xnetx/tinyc-native-x86_64-w64-mingw32
2
+
3
+ [English](README.md) | **简体中文**
4
+
5
+ [`@xnetx/tinyc`](https://www.npmjs.com/package/@xnetx/tinyc)(Node.js 包)在本宿主上的原生工具链包,宿主为 **x86_64 Windows**(宿主三元组 `x86_64-w64-mingw32`)。
6
+
7
+ `@xnetx/tinyc` 把 TinyC(TCC)编译器嵌入 Node.js。本子包是其中与宿主相关的部分:双形态编译器本体——同一个文件既是 `tcc` 命令行可执行文件,也是导出 libtcc `tcc_*` API 的库——以及本宿主可编译的全部目标的头文件与库文件(sysroot):
8
+
9
+ - `x86_64-w64-mingw32`(本宿主)
10
+
11
+ ## 安装
12
+
13
+ 通常不需要手动安装本包。主包 `@xnetx/tinyc` 把全部平台子包声明在 `optionalDependencies` 里,npm 按各子包的 `os` / `cpu` 字段自动装上与本机匹配的那一个;本包匹配 `os: win32` / `cpu: x64`,在这类宿主上 `npm install @xnetx/tinyc` 会自动带上它。
14
+
15
+ 如需显式安装:
16
+
17
+ ```sh
18
+ npm install @xnetx/tinyc-native-x86_64-w64-mingw32
19
+ ```
20
+
21
+ ## 包内布局
22
+
23
+ - `natives/x86_64-w64-mingw32/toolchain/<target>/tinyc.exe`——双形态编译器本体:在本宿主上运行、为 `<target>` 生成代码。
24
+ - `sysroot/<target>/`——该目标的头文件(`include/`)与库文件(`lib/`)。
25
+ - `packaging-manifest.json`——本包携带的宿主/目标组合与各组合的产物格式。
26
+
27
+ ## 相关链接
28
+
29
+ - 主包:[`@xnetx/tinyc`](https://www.npmjs.com/package/@xnetx/tinyc)
30
+ - 仓库:<https://github.com/xnetsc/tinyc-in-one>
31
+ - 许可证:LGPL-2.1-or-later
package/package.json CHANGED
@@ -1,6 +1,19 @@
1
1
  {
2
2
  "name": "@xnetx/tinyc-native-x86_64-w64-mingw32",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "TinyC native binaries for host x86_64-w64-mingw32 (dual-form TCC builds and target sysroots).",
5
+ "license": "LGPL-2.1-or-later",
6
+ "os": [
7
+ "win32"
8
+ ],
9
+ "cpu": [
10
+ "x64"
11
+ ],
12
+ "files": [
13
+ "natives",
14
+ "sysroot",
15
+ "packaging-manifest.json",
16
+ "README.md",
17
+ "README.zh-CN.md"
18
+ ]
19
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "tinyc",
3
+ "layout": 1,
4
+ "kernelVersion": "0.9.28rc",
5
+ "combinations": [
6
+ {
7
+ "host": "x86_64-w64-mingw32",
8
+ "target": "x86_64-w64-mingw32",
9
+ "binary": "natives/x86_64-w64-mingw32/toolchain/x86_64-w64-mingw32/tinyc.exe",
10
+ "sysroot": "sysroot/x86_64-w64-mingw32",
11
+ "isa": "x86-64 baseline; scalar floating point via SSE2 (xmm registers); no AVX code generation",
12
+ "status": "included",
13
+ "libPath": "sysroot/x86_64-w64-mingw32/lib/tcc/win32",
14
+ "libtcc1": "sysroot/x86_64-w64-mingw32/lib/tcc/win32/lib/libtcc1.a",
15
+ "outputs": {
16
+ "exe": {
17
+ "format": "PE executable",
18
+ "ext": ".exe"
19
+ },
20
+ "obj": {
21
+ "format": "COFF object",
22
+ "ext": ".o"
23
+ },
24
+ "shared": {
25
+ "format": "PE DLL",
26
+ "ext": ".dll"
27
+ },
28
+ "ar": {
29
+ "format": "ar archive",
30
+ "ext": ".a"
31
+ }
32
+ }
33
+ }
34
+ ],
35
+ "pending": [
36
+ {
37
+ "host": "x86_64-linux-gnu",
38
+ "target": "x86_64-linux-gnu",
39
+ "status": "pending"
40
+ },
41
+ {
42
+ "host": "aarch64-linux-gnu",
43
+ "target": "aarch64-linux-gnu",
44
+ "status": "pending"
45
+ },
46
+ {
47
+ "host": "arm64-apple-darwin",
48
+ "target": "arm64-apple-darwin",
49
+ "status": "pending"
50
+ },
51
+ {
52
+ "host": "x86_64-apple-darwin",
53
+ "target": "x86_64-apple-darwin",
54
+ "status": "pending"
55
+ }
56
+ ]
57
+ }
@@ -0,0 +1,116 @@
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
@@ -0,0 +1,123 @@
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 */
@@ -0,0 +1,171 @@
1
+ /*
2
+ * _mingw.h
3
+ *
4
+ * This file is for TinyCC and not part of the Mingw32 package.
5
+ *
6
+ * THIS SOFTWARE IS NOT COPYRIGHTED
7
+ *
8
+ * This source code is offered for use in the public domain. You may
9
+ * use, modify or distribute it freely.
10
+ *
11
+ * This code is distributed in the hope that it will be useful but
12
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
13
+ * DISCLAIMED. This includes but is not limited to warranties of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
+ *
16
+ */
17
+
18
+ #ifndef __MINGW_H
19
+ #define __MINGW_H
20
+
21
+ /* some winapi files define these before including _mingw.h --> */
22
+ #undef __cdecl
23
+ #undef _X86_
24
+ #undef WIN32
25
+ /* <-- */
26
+
27
+ #include <stddef.h>
28
+ #include <stdarg.h>
29
+
30
+ #define __int8 char
31
+ #define __int16 short
32
+ #define __int32 int
33
+ #define __int64 long long
34
+ #define _HAVE_INT64
35
+
36
+ #define __cdecl
37
+ #define __declspec(x) __attribute__((x))
38
+ #define __unaligned __attribute__((packed))
39
+ #define __fastcall __attribute__((fastcall))
40
+
41
+ #define __MSVCRT__ 1
42
+ #undef _MSVCRT_
43
+ #define __MINGW_IMPORT extern __declspec(dllimport)
44
+ #define __MINGW_ATTRIB_NORETURN __declspec(noreturn)
45
+ #define __MINGW_ATTRIB_CONST
46
+ #define __MINGW_ATTRIB_DEPRECATED
47
+ #define __MINGW_ATTRIB_MALLOC
48
+ #define __MINGW_ATTRIB_PURE
49
+ #define __MINGW_ATTRIB_NONNULL(arg)
50
+ #define __MINGW_NOTHROW
51
+ #define __GNUC_VA_LIST
52
+
53
+ #define _CRTIMP extern
54
+ #define __CRT_INLINE static __inline__
55
+
56
+ #define _CRT_ALIGN(x) __attribute__((aligned(x)))
57
+ #define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
58
+ #define _CRT_PACKING 8
59
+ #define __CRT_UNALIGNED
60
+ #define _CONST_RETURN
61
+
62
+ #ifndef _TRUNCATE
63
+ #define _TRUNCATE ((size_t)-1)
64
+ #endif
65
+
66
+ #define __CRT_STRINGIZE(_Value) #_Value
67
+ #define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value)
68
+ #define __CRT_WIDE(_String) L ## _String
69
+ #define _CRT_WIDE(_String) __CRT_WIDE(_String)
70
+
71
+ #ifdef _WIN64
72
+ #define __stdcall
73
+ #if defined(__aarch64__)
74
+ #define _M_ARM64 1
75
+ #define _ARM64_ 1
76
+ #else
77
+ #define _AMD64_ 1
78
+ #define __x86_64 1
79
+ #define _M_X64 100 /* Visual Studio */
80
+ #define _M_AMD64 100 /* Visual Studio */
81
+ #endif
82
+ #else
83
+ #define __stdcall __attribute__((__stdcall__))
84
+ #define _X86_ 1
85
+ #define _M_IX86 300 /* Visual Studio */
86
+ #ifndef __MINGW_USE_VC2005_COMPAT /* time became 64, but not timeval.tv_sec */
87
+ # ifndef _USE_32BIT_TIME_T
88
+ # define _USE_32BIT_TIME_T
89
+ # endif
90
+ #endif
91
+ #endif
92
+
93
+ /* in stddef.h */
94
+ #define _SIZE_T_DEFINED
95
+ #define _SSIZE_T_DEFINED
96
+ #define _PTRDIFF_T_DEFINED
97
+ #define _WCHAR_T_DEFINED
98
+ #define _UINTPTR_T_DEFINED
99
+ #define _INTPTR_T_DEFINED
100
+ #define _INTEGRAL_MAX_BITS 64
101
+
102
+ #ifndef _TIME32_T_DEFINED
103
+ #define _TIME32_T_DEFINED
104
+ typedef long __time32_t;
105
+ #endif
106
+
107
+ #ifndef _TIME64_T_DEFINED
108
+ #define _TIME64_T_DEFINED
109
+ typedef long long __time64_t;
110
+ #endif
111
+
112
+ #ifndef _TIME_T_DEFINED
113
+ #define _TIME_T_DEFINED
114
+ #ifdef _USE_32BIT_TIME_T
115
+ typedef __time32_t time_t;
116
+ #else
117
+ typedef __time64_t time_t;
118
+ #endif
119
+ #endif
120
+
121
+ #ifndef _WCTYPE_T_DEFINED
122
+ #define _WCTYPE_T_DEFINED
123
+ typedef wchar_t wctype_t;
124
+ #endif
125
+
126
+ #ifndef _WINT_T
127
+ #define _WINT_T
128
+ typedef __WINT_TYPE__ wint_t;
129
+ #endif
130
+
131
+ typedef int errno_t;
132
+ #define _ERRCODE_DEFINED
133
+
134
+ typedef struct threadlocaleinfostruct *pthreadlocinfo;
135
+ typedef struct threadmbcinfostruct *pthreadmbcinfo;
136
+ typedef struct localeinfo_struct _locale_tstruct,*_locale_t;
137
+
138
+ /* for winapi */
139
+ #define _ANONYMOUS_UNION
140
+ #define _ANONYMOUS_STRUCT
141
+ #define DECLSPEC_NORETURN __declspec(noreturn)
142
+ #define DECLARE_STDCALL_P(type) __stdcall type
143
+ #define NOSERVICE 1
144
+ #define NOMCX 1
145
+ #define NOIME 1
146
+ #define __INTRIN_H_
147
+ #ifndef DUMMYUNIONNAME
148
+ # define DUMMYUNIONNAME
149
+ # define DUMMYUNIONNAME1
150
+ # define DUMMYUNIONNAME2
151
+ # define DUMMYUNIONNAME3
152
+ # define DUMMYUNIONNAME4
153
+ # define DUMMYUNIONNAME5
154
+ #endif
155
+ #ifndef DUMMYSTRUCTNAME
156
+ # define DUMMYSTRUCTNAME
157
+ #endif
158
+ #ifndef WINVER
159
+ # define WINVER 0x0502
160
+ #endif
161
+ #ifndef _WIN32_WINNT
162
+ # define _WIN32_WINNT 0x502
163
+ #endif
164
+
165
+ #define __C89_NAMELESS
166
+ #define __MINGW_EXTENSION
167
+ #define WINAPI_FAMILY_PARTITION(X) 1
168
+ #define MINGW_HAS_SECURE_API
169
+ #define WIN32 1
170
+
171
+ #endif /* __MINGW_H */
@@ -0,0 +1,62 @@
1
+ /**
2
+ * This file has no copyright assigned and is placed in the Public Domain.
3
+ * This file is part of the w64 mingw-runtime package.
4
+ * No warranty is given; refer to the file DISCLAIMER within this package.
5
+ */
6
+ #ifndef __ASSERT_H_
7
+ #define __ASSERT_H_
8
+
9
+ #include <_mingw.h>
10
+ #ifdef __cplusplus
11
+ #include <stdlib.h>
12
+ #endif
13
+
14
+ #ifdef NDEBUG
15
+ #ifndef assert
16
+ #define assert(_Expression) ((void)0)
17
+ #endif
18
+ #else
19
+
20
+ #ifndef _CRT_TERMINATE_DEFINED
21
+ #define _CRT_TERMINATE_DEFINED
22
+ void __cdecl __MINGW_NOTHROW exit(int _Code) __MINGW_ATTRIB_NORETURN;
23
+ _CRTIMP void __cdecl __MINGW_NOTHROW _exit(int _Code) __MINGW_ATTRIB_NORETURN;
24
+ #if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
25
+ /* C99 function name */
26
+ void __cdecl _Exit(int) __MINGW_ATTRIB_NORETURN;
27
+ __CRT_INLINE __MINGW_ATTRIB_NORETURN void __cdecl _Exit(int status)
28
+ { _exit(status); }
29
+ #endif
30
+
31
+ #pragma push_macro("abort")
32
+ #undef abort
33
+ void __cdecl __declspec(noreturn) abort(void);
34
+ #pragma pop_macro("abort")
35
+
36
+ #endif
37
+
38
+ #ifdef __cplusplus
39
+ extern "C" {
40
+ #endif
41
+
42
+
43
+ extern void __cdecl _wassert(const wchar_t *_Message,const wchar_t *_File,unsigned _Line);
44
+ extern void __cdecl _assert(const char *, const char *, unsigned);
45
+
46
+ #ifdef __cplusplus
47
+ }
48
+ #endif
49
+
50
+ #ifndef assert
51
+ //#define assert(_Expression) (void)((!!(_Expression)) || (_wassert(_CRT_WIDE(#_Expression),_CRT_WIDE(__FILE__),__LINE__),0))
52
+ #define assert(e) ((e) ? (void)0 : _assert(#e, __FILE__, __LINE__))
53
+ #endif
54
+
55
+ #endif
56
+
57
+ #if (__STDC_VERSION__ >= 201112L) && !defined(static_assert)
58
+ /* C11, section 7.2: The macro static_assert expands to _Static_assert. */
59
+ #define static_assert(exp, str) _Static_assert(exp, str)
60
+ #endif
61
+
62
+ #endif