├── .gitignore ├── create_window_in_script ├── create_window_in_script.vcxproj ├── create_window_in_script.vcxproj.filters ├── hello_win.c └── main.cpp ├── libtcc_example.sln ├── libtcc_test ├── libtcc_test.c ├── libtcc_test.vcxproj └── libtcc_test.vcxproj.filters └── tcc ├── bin ├── alloca86-bt.o ├── alloca86.o ├── bcheck.o ├── chkstk.o ├── crt1.o ├── dllcrt1.o ├── dllmain.o ├── examples │ ├── dll.c │ ├── fib.c │ ├── hello_dll.c │ ├── hello_win.c │ └── tests │ │ ├── Makefile │ │ ├── asmtest.S │ │ ├── boundtest.c │ │ ├── gcctestsuite.sh │ │ ├── libtcc_test.c │ │ ├── tcctest.c │ │ └── tests2 │ │ ├── 00_assignment.c │ │ ├── 00_assignment.expect │ │ ├── 01_comment.c │ │ ├── 01_comment.expect │ │ ├── 02_printf.c │ │ ├── 02_printf.expect │ │ ├── 03_struct.c │ │ ├── 03_struct.expect │ │ ├── 04_for.c │ │ ├── 04_for.expect │ │ ├── 05_array.c │ │ ├── 05_array.expect │ │ ├── 06_case.c │ │ ├── 06_case.expect │ │ ├── 07_function.c │ │ ├── 07_function.expect │ │ ├── 08_while.c │ │ ├── 08_while.expect │ │ ├── 09_do_while.c │ │ ├── 09_do_while.expect │ │ ├── 10_pointer.c │ │ ├── 10_pointer.expect │ │ ├── 11_precedence.c │ │ ├── 11_precedence.expect │ │ ├── 12_hashdefine.c │ │ ├── 12_hashdefine.expect │ │ ├── 13_integer_literals.c │ │ ├── 13_integer_literals.expect │ │ ├── 14_if.c │ │ ├── 14_if.expect │ │ ├── 15_recursion.c │ │ ├── 15_recursion.expect │ │ ├── 16_nesting.c │ │ ├── 16_nesting.expect │ │ ├── 17_enum.c │ │ ├── 17_enum.expect │ │ ├── 18_include.c │ │ ├── 18_include.expect │ │ ├── 18_include.h │ │ ├── 19_pointer_arithmetic.c │ │ ├── 19_pointer_arithmetic.expect │ │ ├── 20_pointer_comparison.c │ │ ├── 20_pointer_comparison.expect │ │ ├── 21_char_array.c │ │ ├── 21_char_array.expect │ │ ├── 22_floating_point.c │ │ ├── 22_floating_point.expect │ │ ├── 23_type_coercion.c │ │ ├── 23_type_coercion.expect │ │ ├── 24_math_library.c │ │ ├── 24_math_library.expect │ │ ├── 25_quicksort.c │ │ ├── 25_quicksort.expect │ │ ├── 26_character_constants.c │ │ ├── 26_character_constants.expect │ │ ├── 27_sizeof.c │ │ ├── 27_sizeof.expect │ │ ├── 28_strings.c │ │ ├── 28_strings.expect │ │ ├── 29_array_address.c │ │ ├── 29_array_address.expect │ │ ├── 30_hanoi.c │ │ ├── 30_hanoi.expect │ │ ├── 31_args.c │ │ ├── 31_args.expect │ │ ├── 32_led.c │ │ ├── 32_led.expect │ │ ├── 33_ternary_op.c │ │ ├── 33_ternary_op.expect │ │ ├── 34_array_assignment.c │ │ ├── 34_array_assignment.expect │ │ ├── 35_sizeof.c │ │ ├── 35_sizeof.expect │ │ ├── 36_array_initialisers.c │ │ ├── 36_array_initialisers.expect │ │ ├── 37_sprintf.c │ │ ├── 37_sprintf.expect │ │ ├── 38_multiple_array_index.c │ │ ├── 38_multiple_array_index.expect │ │ ├── 39_typedef.c │ │ ├── 39_typedef.expect │ │ ├── 40_stdio.c │ │ ├── 40_stdio.expect │ │ ├── 41_hashif.c │ │ ├── 41_hashif.expect │ │ ├── 42_function_pointer.c │ │ ├── 42_function_pointer.expect │ │ ├── 43_void_param.c │ │ ├── 43_void_param.expect │ │ ├── 44_scoped_declarations.c │ │ ├── 44_scoped_declarations.expect │ │ ├── 45_empty_for.c │ │ ├── 45_empty_for.expect │ │ ├── 46_grep.c │ │ ├── 47_switch_return.c │ │ ├── 47_switch_return.expect │ │ ├── 48_nested_break.c │ │ ├── 48_nested_break.expect │ │ ├── 49_bracket_evaluation.c │ │ ├── 49_bracket_evaluation.expect │ │ ├── 50_logical_second_arg.c │ │ ├── 50_logical_second_arg.expect │ │ ├── 51_static.c │ │ ├── 51_static.expect │ │ ├── 52_unnamed_enum.c │ │ ├── 52_unnamed_enum.expect │ │ ├── 54_goto.c │ │ ├── 54_goto.expect │ │ ├── 55_lshift_type.c │ │ ├── 55_lshift_type.expect │ │ ├── LICENSE │ │ └── Makefile ├── generate_crt.bat ├── include │ ├── _mingw.h │ ├── assert.h │ ├── conio.h │ ├── ctype.h │ ├── dir.h │ ├── direct.h │ ├── dirent.h │ ├── dos.h │ ├── errno.h │ ├── excpt.h │ ├── fcntl.h │ ├── fenv.h │ ├── float.h │ ├── inttypes.h │ ├── io.h │ ├── limits.h │ ├── locale.h │ ├── malloc.h │ ├── math.h │ ├── mem.h │ ├── memory.h │ ├── process.h │ ├── sec_api │ │ ├── conio_s.h │ │ ├── crtdbg_s.h │ │ ├── io_s.h │ │ ├── mbstring_s.h │ │ ├── search_s.h │ │ ├── stdio_s.h │ │ ├── stdlib_s.h │ │ ├── stralign_s.h │ │ ├── string_s.h │ │ ├── sys │ │ │ └── timeb_s.h │ │ ├── tchar_s.h │ │ ├── time_s.h │ │ └── wchar_s.h │ ├── setjmp.h │ ├── share.h │ ├── signal.h │ ├── stdarg.h │ ├── stdbool.h │ ├── stddef.h │ ├── stdint.h │ ├── stdio.h │ ├── stdlib.h │ ├── string.h │ ├── sys │ │ ├── fcntl.h │ │ ├── file.h │ │ ├── locking.h │ │ ├── stat.h │ │ ├── time.h │ │ ├── timeb.h │ │ ├── types.h │ │ ├── unistd.h │ │ └── utime.h │ ├── tcclib.h │ ├── tchar.h │ ├── time.h │ ├── vadefs.h │ ├── values.h │ ├── varargs.h │ ├── wchar.h │ ├── wctype.h │ └── winapi │ │ ├── basetsd.h │ │ ├── basetyps.h │ │ ├── guiddef.h │ │ ├── intrin.h │ │ ├── poppack.h │ │ ├── pshpack1.h │ │ ├── pshpack2.h │ │ ├── pshpack4.h │ │ ├── pshpack8.h │ │ ├── reason.h │ │ ├── specstrings.h │ │ ├── stralign.h │ │ ├── tvout.h │ │ ├── winbase.h │ │ ├── wincon.h │ │ ├── windef.h │ │ ├── windows.h │ │ ├── winerror.h │ │ ├── wingdi.h │ │ ├── winnetwk.h │ │ ├── winnls.h │ │ ├── winnt.h │ │ ├── winreg.h │ │ ├── winuser.h │ │ └── winver.h ├── lib │ ├── alloca86-bt.S │ ├── alloca86.S │ ├── bcheck.c │ ├── chkstk.S │ ├── crt1.c │ ├── dllcrt1.c │ ├── dllmain.c │ ├── gdi32.def │ ├── kernel32.def │ ├── libtcc1.a │ ├── libtcc1.c │ ├── msvcrt.def │ ├── user32.def │ └── wincrt1.c ├── libtcc.exp ├── libtcc1.o └── wincrt1.o ├── include └── libtcc.h └── lib └── libtcc.exp /.gitignore: -------------------------------------------------------------------------------- 1 | *.sdf 2 | *.opensdf 3 | *.user 4 | *.suo 5 | Debug 6 | /GeneratedFiles 7 | /ipch 8 | Win32 9 | Release -------------------------------------------------------------------------------- /create_window_in_script/create_window_in_script.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {DC36A44B-B454-4C55-8F8F-97EEE66168D8} 15 | Win32Proj 16 | create_window_in_script 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | true 42 | 43 | 44 | false 45 | 46 | 47 | 48 | 49 | 50 | Level3 51 | Disabled 52 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 53 | $(SolutionDir)tcc\include;%(AdditionalIncludeDirectories) 54 | 55 | 56 | Console 57 | true 58 | $(SolutionDir)tcc\lib;%(AdditionalLibraryDirectories) 59 | libtcc.lib;%(AdditionalDependencies) 60 | 61 | 62 | xcopy /Y /E $(SolutionDir)tcc\bin\* $(OutDir) 63 | 64 | 65 | 66 | 67 | Level3 68 | 69 | 70 | MaxSpeed 71 | true 72 | true 73 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 74 | $(SolutionDir)tcc\include;%(AdditionalIncludeDirectories) 75 | 76 | 77 | Console 78 | true 79 | true 80 | true 81 | $(SolutionDir)tcc\lib;%(AdditionalLibraryDirectories) 82 | libtcc.lib;%(AdditionalDependencies) 83 | 84 | 85 | xcopy /Y /E $(SolutionDir)tcc\bin\* $(OutDir) 86 | 87 | 88 | 89 | 90 | xcopy %(FullPath) $(OutDir) 91 | xcopy %(FullPath) $(OutDir) 92 | true 93 | true 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /create_window_in_script/create_window_in_script.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {bd1f857a-eb08-4b1b-a762-ac75cb156232} 18 | 19 | 20 | 21 | 22 | 源文件 23 | 24 | 25 | script 26 | 27 | 28 | -------------------------------------------------------------------------------- /create_window_in_script/hello_win.c: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | // 3 | // HELLO_WIN.C - Windows GUI 'Hello World!' Example 4 | // 5 | //+--------------------------------------------------------------------------- 6 | 7 | #include 8 | 9 | #define APPNAME "HELLO_WIN" 10 | 11 | char szAppName[] = APPNAME; // The name of this application 12 | char szTitle[] = APPNAME; // The title bar text 13 | char pWindowText[100]; 14 | 15 | void CenterWindow(HWND hWnd); 16 | 17 | //+--------------------------------------------------------------------------- 18 | // 19 | // Function: WndProc 20 | // 21 | // Synopsis: very unusual type of function - gets called by system to 22 | // process windows messages. 23 | // 24 | // Arguments: same as always. 25 | //---------------------------------------------------------------------------- 26 | 27 | LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 28 | { 29 | switch (message) { 30 | 31 | // ----------------------- first and last 32 | case WM_CREATE: 33 | CenterWindow(hwnd); 34 | break; 35 | 36 | case WM_DESTROY: 37 | PostQuitMessage(0); 38 | break; 39 | 40 | // ----------------------- get out of it... 41 | case WM_RBUTTONUP: 42 | DestroyWindow(hwnd); 43 | break; 44 | 45 | case WM_KEYDOWN: 46 | if (VK_ESCAPE == wParam) 47 | DestroyWindow(hwnd); 48 | break; 49 | 50 | // ----------------------- display our minimal info 51 | case WM_PAINT: 52 | { 53 | PAINTSTRUCT ps; 54 | HDC hdc; 55 | RECT rc; 56 | hdc = BeginPaint(hwnd, &ps); 57 | 58 | GetClientRect(hwnd, &rc); 59 | SetTextColor(hdc, RGB(240,240,96)); 60 | SetBkMode(hdc, TRANSPARENT); 61 | DrawText(hdc, pWindowText, -1, &rc, DT_CENTER|DT_SINGLELINE|DT_VCENTER); 62 | 63 | EndPaint(hwnd, &ps); 64 | break; 65 | } 66 | 67 | // ----------------------- let windows do all other stuff 68 | default: 69 | return DefWindowProc(hwnd, message, wParam, lParam); 70 | } 71 | return 0; 72 | } 73 | 74 | //+--------------------------------------------------------------------------- 75 | // 76 | // Function: WinMain 77 | // 78 | // Synopsis: standard entrypoint for GUI Win32 apps 79 | // 80 | //---------------------------------------------------------------------------- 81 | int script_main() 82 | { 83 | MSG msg; 84 | WNDCLASS wc; 85 | HWND hwnd; 86 | 87 | get_text(pWindowText); 88 | 89 | // Fill in window class structure with parameters that describe 90 | // the main window. 91 | 92 | ZeroMemory(&wc, sizeof wc); 93 | wc.hInstance = GetModuleHandle(NULL); 94 | wc.lpszClassName = szAppName; 95 | wc.lpfnWndProc = (WNDPROC)WndProc; 96 | wc.style = CS_DBLCLKS|CS_VREDRAW|CS_HREDRAW; 97 | wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); 98 | wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); 99 | wc.hCursor = LoadCursor(NULL, IDC_ARROW); 100 | 101 | if (FALSE == RegisterClass(&wc)) 102 | return 0; 103 | 104 | // create the browser 105 | hwnd = CreateWindow( 106 | szAppName, 107 | szTitle, 108 | WS_OVERLAPPEDWINDOW|WS_VISIBLE, 109 | CW_USEDEFAULT, 110 | CW_USEDEFAULT, 111 | 360,//CW_USEDEFAULT, 112 | 240,//CW_USEDEFAULT, 113 | 0, 114 | 0, 115 | GetModuleHandle(NULL), 116 | 0); 117 | 118 | if (NULL == hwnd) 119 | return 0; 120 | 121 | // Main message loop: 122 | while (GetMessage(&msg, NULL, 0, 0) > 0) { 123 | TranslateMessage(&msg); 124 | DispatchMessage(&msg); 125 | } 126 | 127 | return msg.wParam; 128 | } 129 | 130 | //+--------------------------------------------------------------------------- 131 | 132 | //+--------------------------------------------------------------------------- 133 | 134 | void CenterWindow(HWND hwnd_self) 135 | { 136 | HWND hwnd_parent; 137 | RECT rw_self, rc_parent, rw_parent; 138 | int xpos, ypos; 139 | 140 | hwnd_parent = GetParent(hwnd_self); 141 | if (NULL == hwnd_parent) 142 | hwnd_parent = GetDesktopWindow(); 143 | 144 | GetWindowRect(hwnd_parent, &rw_parent); 145 | GetClientRect(hwnd_parent, &rc_parent); 146 | GetWindowRect(hwnd_self, &rw_self); 147 | 148 | xpos = rw_parent.left + (rc_parent.right + rw_self.left - rw_self.right) / 2; 149 | ypos = rw_parent.top + (rc_parent.bottom + rw_self.top - rw_self.bottom) / 2; 150 | 151 | SetWindowPos( 152 | hwnd_self, NULL, 153 | xpos, ypos, 0, 0, 154 | SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE 155 | ); 156 | } 157 | 158 | //+--------------------------------------------------------------------------- 159 | -------------------------------------------------------------------------------- /create_window_in_script/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/junjiexing/libtcc_example/e5902e8f023b0a6a76d1b3c45ab76945453e6f59/create_window_in_script/main.cpp -------------------------------------------------------------------------------- /libtcc_example.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtcc_test", "libtcc_test\libtcc_test.vcxproj", "{2EE9FBAE-35B9-4F28-A185-FB371A1FC6CB}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "create_window_in_script", "create_window_in_script\create_window_in_script.vcxproj", "{DC36A44B-B454-4C55-8F8F-97EEE66168D8}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {2EE9FBAE-35B9-4F28-A185-FB371A1FC6CB}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {2EE9FBAE-35B9-4F28-A185-FB371A1FC6CB}.Debug|Win32.Build.0 = Debug|Win32 16 | {2EE9FBAE-35B9-4F28-A185-FB371A1FC6CB}.Release|Win32.ActiveCfg = Release|Win32 17 | {2EE9FBAE-35B9-4F28-A185-FB371A1FC6CB}.Release|Win32.Build.0 = Release|Win32 18 | {DC36A44B-B454-4C55-8F8F-97EEE66168D8}.Debug|Win32.ActiveCfg = Debug|Win32 19 | {DC36A44B-B454-4C55-8F8F-97EEE66168D8}.Debug|Win32.Build.0 = Debug|Win32 20 | {DC36A44B-B454-4C55-8F8F-97EEE66168D8}.Release|Win32.ActiveCfg = Release|Win32 21 | {DC36A44B-B454-4C55-8F8F-97EEE66168D8}.Release|Win32.Build.0 = Release|Win32 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /libtcc_test/libtcc_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Simple Test program for libtcc 3 | * 4 | * libtcc can be useful to use tcc as a "backend" for a code generator. 5 | */ 6 | #include 7 | #include 8 | #include 9 | 10 | #include "libtcc.h" 11 | 12 | /* this function is called by the generated code */ 13 | int add(int a, int b) 14 | { 15 | return a + b; 16 | } 17 | 18 | char my_program[] = 19 | "int fib(int n)\n" 20 | "{\n" 21 | " if (n <= 2)\n" 22 | " return 1;\n" 23 | " else\n" 24 | " return fib(n-1) + fib(n-2);\n" 25 | "}\n" 26 | "\n" 27 | "int foo(int n)\n" 28 | "{\n" 29 | " printf(\"Hello World!\\n\");\n" 30 | " printf(\"fib(%d) = %d\\n\", n, fib(n));\n" 31 | " printf(\"add(%d, %d) = %d\\n\", n, 2 * n, add(n, 2 * n));\n" 32 | " return 0;\n" 33 | "}\n"; 34 | 35 | int main(int argc, char **argv) 36 | { 37 | TCCState *s; 38 | int (*func)(int); 39 | 40 | s = tcc_new(); 41 | if (!s) { 42 | fprintf(stderr, "Could not create tcc state\n"); 43 | exit(1); 44 | } 45 | 46 | /* if tcclib.h and libtcc1.a are not installed, where can we find them */ 47 | if (argc == 2 && !memcmp(argv[1], "lib_path=",9)) 48 | tcc_set_lib_path(s, argv[1]+9); 49 | 50 | /* MUST BE CALLED before any compilation */ 51 | tcc_set_output_type(s, TCC_OUTPUT_MEMORY); 52 | 53 | if (tcc_compile_string(s, my_program) == -1) 54 | return 1; 55 | 56 | /* as a test, we add a symbol that the compiled program can use. 57 | You may also open a dll with tcc_add_dll() and use symbols from that */ 58 | tcc_add_symbol(s, "add", add); 59 | 60 | /* relocate the code */ 61 | if (tcc_relocate(s, TCC_RELOCATE_AUTO) < 0) 62 | return 1; 63 | 64 | /* get entry symbol */ 65 | func = tcc_get_symbol(s, "foo"); 66 | if (!func) 67 | return 1; 68 | 69 | /* run the code */ 70 | func(32); 71 | 72 | /* delete the state */ 73 | tcc_delete(s); 74 | 75 | return 0; 76 | } 77 | -------------------------------------------------------------------------------- /libtcc_test/libtcc_test.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {2EE9FBAE-35B9-4F28-A185-FB371A1FC6CB} 15 | Win32Proj 16 | libtcc_test 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | true 42 | 43 | 44 | false 45 | 46 | 47 | 48 | 49 | 50 | Level3 51 | Disabled 52 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 53 | $(SolutionDir)tcc\include;%(AdditionalIncludeDirectories) 54 | 55 | 56 | Console 57 | true 58 | $(SolutionDir)tcc\lib;%(AdditionalLibraryDirectories) 59 | libtcc.lib;%(AdditionalDependencies) 60 | 61 | 62 | xcopy /Y /E $(SolutionDir)tcc\bin\* $(OutDir) 63 | 64 | 65 | 66 | 67 | Level3 68 | 69 | 70 | MaxSpeed 71 | true 72 | true 73 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 74 | $(SolutionDir)tcc\include;%(AdditionalIncludeDirectories) 75 | 76 | 77 | Console 78 | true 79 | true 80 | true 81 | $(SolutionDir)tcc\lib;%(AdditionalLibraryDirectories) 82 | libtcc.lib;%(AdditionalDependencies) 83 | 84 | 85 | xcopy /Y /E $(SolutionDir)tcc\bin\* $(OutDir) 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /libtcc_test/libtcc_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 源文件 20 | 21 | 22 | -------------------------------------------------------------------------------- /tcc/bin/alloca86-bt.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/junjiexing/libtcc_example/e5902e8f023b0a6a76d1b3c45ab76945453e6f59/tcc/bin/alloca86-bt.o -------------------------------------------------------------------------------- /tcc/bin/alloca86.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/junjiexing/libtcc_example/e5902e8f023b0a6a76d1b3c45ab76945453e6f59/tcc/bin/alloca86.o -------------------------------------------------------------------------------- /tcc/bin/bcheck.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/junjiexing/libtcc_example/e5902e8f023b0a6a76d1b3c45ab76945453e6f59/tcc/bin/bcheck.o -------------------------------------------------------------------------------- /tcc/bin/chkstk.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/junjiexing/libtcc_example/e5902e8f023b0a6a76d1b3c45ab76945453e6f59/tcc/bin/chkstk.o -------------------------------------------------------------------------------- /tcc/bin/crt1.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/junjiexing/libtcc_example/e5902e8f023b0a6a76d1b3c45ab76945453e6f59/tcc/bin/crt1.o -------------------------------------------------------------------------------- /tcc/bin/dllcrt1.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/junjiexing/libtcc_example/e5902e8f023b0a6a76d1b3c45ab76945453e6f59/tcc/bin/dllcrt1.o -------------------------------------------------------------------------------- /tcc/bin/dllmain.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/junjiexing/libtcc_example/e5902e8f023b0a6a76d1b3c45ab76945453e6f59/tcc/bin/dllmain.o -------------------------------------------------------------------------------- /tcc/bin/examples/dll.c: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | // 3 | // dll.c - Windows DLL example - dynamically linked part 4 | // 5 | 6 | #include 7 | #define DLL_EXPORT __declspec(dllexport) 8 | 9 | DLL_EXPORT void HelloWorld (void) 10 | { 11 | MessageBox (0, "Hello World!", "From DLL", MB_ICONINFORMATION); 12 | } 13 | -------------------------------------------------------------------------------- /tcc/bin/examples/fib.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int fib(n) 4 | { 5 | if (n <= 2) 6 | return 1; 7 | else 8 | return fib(n-1) + fib(n-2); 9 | } 10 | 11 | int main(int argc, char **argv) 12 | { 13 | int n; 14 | if (argc < 2) { 15 | printf("usage: fib n\n" 16 | "Compute nth Fibonacci number\n"); 17 | return 1; 18 | } 19 | 20 | n = atoi(argv[1]); 21 | printf("fib(%d) = %d\n", n, fib(n)); 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /tcc/bin/examples/hello_dll.c: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | // 3 | // HELLO_DLL.C - Windows DLL example - main application part 4 | // 5 | 6 | #include 7 | 8 | void HelloWorld (void); 9 | 10 | int WINAPI WinMain( 11 | HINSTANCE hInstance, 12 | HINSTANCE hPrevInstance, 13 | LPSTR lpCmdLine, 14 | int nCmdShow) 15 | { 16 | HelloWorld(); 17 | return 0; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /tcc/bin/examples/hello_win.c: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | // 3 | // HELLO_WIN.C - Windows GUI 'Hello World!' Example 4 | // 5 | //+--------------------------------------------------------------------------- 6 | 7 | #include 8 | 9 | #define APPNAME "HELLO_WIN" 10 | 11 | char szAppName[] = APPNAME; // The name of this application 12 | char szTitle[] = APPNAME; // The title bar text 13 | const char *pWindowText; 14 | 15 | void CenterWindow(HWND hWnd); 16 | 17 | //+--------------------------------------------------------------------------- 18 | // 19 | // Function: WndProc 20 | // 21 | // Synopsis: very unusual type of function - gets called by system to 22 | // process windows messages. 23 | // 24 | // Arguments: same as always. 25 | //---------------------------------------------------------------------------- 26 | 27 | LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 28 | { 29 | switch (message) { 30 | 31 | // ----------------------- first and last 32 | case WM_CREATE: 33 | CenterWindow(hwnd); 34 | break; 35 | 36 | case WM_DESTROY: 37 | PostQuitMessage(0); 38 | break; 39 | 40 | // ----------------------- get out of it... 41 | case WM_RBUTTONUP: 42 | DestroyWindow(hwnd); 43 | break; 44 | 45 | case WM_KEYDOWN: 46 | if (VK_ESCAPE == wParam) 47 | DestroyWindow(hwnd); 48 | break; 49 | 50 | // ----------------------- display our minimal info 51 | case WM_PAINT: 52 | { 53 | PAINTSTRUCT ps; 54 | HDC hdc; 55 | RECT rc; 56 | hdc = BeginPaint(hwnd, &ps); 57 | 58 | GetClientRect(hwnd, &rc); 59 | SetTextColor(hdc, RGB(240,240,96)); 60 | SetBkMode(hdc, TRANSPARENT); 61 | DrawText(hdc, pWindowText, -1, &rc, DT_CENTER|DT_SINGLELINE|DT_VCENTER); 62 | 63 | EndPaint(hwnd, &ps); 64 | break; 65 | } 66 | 67 | // ----------------------- let windows do all other stuff 68 | default: 69 | return DefWindowProc(hwnd, message, wParam, lParam); 70 | } 71 | return 0; 72 | } 73 | 74 | //+--------------------------------------------------------------------------- 75 | // 76 | // Function: WinMain 77 | // 78 | // Synopsis: standard entrypoint for GUI Win32 apps 79 | // 80 | //---------------------------------------------------------------------------- 81 | int APIENTRY WinMain( 82 | HINSTANCE hInstance, 83 | HINSTANCE hPrevInstance, 84 | LPSTR lpCmdLine, 85 | int nCmdShow 86 | ) 87 | { 88 | MSG msg; 89 | WNDCLASS wc; 90 | HWND hwnd; 91 | 92 | pWindowText = lpCmdLine[0] ? lpCmdLine : "Hello Windows!"; 93 | 94 | // Fill in window class structure with parameters that describe 95 | // the main window. 96 | 97 | ZeroMemory(&wc, sizeof wc); 98 | wc.hInstance = hInstance; 99 | wc.lpszClassName = szAppName; 100 | wc.lpfnWndProc = (WNDPROC)WndProc; 101 | wc.style = CS_DBLCLKS|CS_VREDRAW|CS_HREDRAW; 102 | wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); 103 | wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); 104 | wc.hCursor = LoadCursor(NULL, IDC_ARROW); 105 | 106 | if (FALSE == RegisterClass(&wc)) 107 | return 0; 108 | 109 | // create the browser 110 | hwnd = CreateWindow( 111 | szAppName, 112 | szTitle, 113 | WS_OVERLAPPEDWINDOW|WS_VISIBLE, 114 | CW_USEDEFAULT, 115 | CW_USEDEFAULT, 116 | 360,//CW_USEDEFAULT, 117 | 240,//CW_USEDEFAULT, 118 | 0, 119 | 0, 120 | hInstance, 121 | 0); 122 | 123 | if (NULL == hwnd) 124 | return 0; 125 | 126 | // Main message loop: 127 | while (GetMessage(&msg, NULL, 0, 0) > 0) { 128 | TranslateMessage(&msg); 129 | DispatchMessage(&msg); 130 | } 131 | 132 | return msg.wParam; 133 | } 134 | 135 | //+--------------------------------------------------------------------------- 136 | 137 | //+--------------------------------------------------------------------------- 138 | 139 | void CenterWindow(HWND hwnd_self) 140 | { 141 | HWND hwnd_parent; 142 | RECT rw_self, rc_parent, rw_parent; 143 | int xpos, ypos; 144 | 145 | hwnd_parent = GetParent(hwnd_self); 146 | if (NULL == hwnd_parent) 147 | hwnd_parent = GetDesktopWindow(); 148 | 149 | GetWindowRect(hwnd_parent, &rw_parent); 150 | GetClientRect(hwnd_parent, &rc_parent); 151 | GetWindowRect(hwnd_self, &rw_self); 152 | 153 | xpos = rw_parent.left + (rc_parent.right + rw_self.left - rw_self.right) / 2; 154 | ypos = rw_parent.top + (rc_parent.bottom + rw_self.top - rw_self.bottom) / 2; 155 | 156 | SetWindowPos( 157 | hwnd_self, NULL, 158 | xpos, ypos, 0, 0, 159 | SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE 160 | ); 161 | } 162 | 163 | //+--------------------------------------------------------------------------- 164 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/boundtest.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define NB_ITS 1000000 5 | //#define NB_ITS 1 6 | #define TAB_SIZE 100 7 | 8 | int tab[TAB_SIZE]; 9 | int ret_sum; 10 | char tab3[256]; 11 | 12 | int test1(void) 13 | { 14 | int i, sum = 0; 15 | for(i=0;i= 2) 222 | index = atoi(argv[1]); 223 | /* well, we also use bounds on this ! */ 224 | ftest = table_test[index]; 225 | ftest(); 226 | 227 | return 0; 228 | } 229 | 230 | /* 231 | * without bound 0.77 s 232 | * with bounds 4.73 233 | */ 234 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/gcctestsuite.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | TESTSUITE_PATH=$HOME/gcc/gcc-3.2/gcc/testsuite/gcc.c-torture 4 | TCC="./tcc -B. -I. -DNO_TRAMPOLINES" 5 | rm -f tcc.sum tcc.log 6 | nb_failed="0" 7 | 8 | for src in $TESTSUITE_PATH/compile/*.c ; do 9 | echo $TCC -o /tmp/test.o -c $src 10 | $TCC -o /tmp/test.o -c $src >> tcc.log 2>&1 11 | if [ "$?" = "0" ] ; then 12 | result="PASS" 13 | else 14 | result="FAIL" 15 | nb_failed=$(( $nb_failed + 1 )) 16 | fi 17 | echo "$result: $src" >> tcc.sum 18 | done 19 | 20 | for src in $TESTSUITE_PATH/execute/*.c ; do 21 | echo $TCC $src 22 | $TCC $src >> tcc.log 2>&1 23 | if [ "$?" = "0" ] ; then 24 | result="PASS" 25 | else 26 | result="FAIL" 27 | nb_failed=$(( $nb_failed + 1 )) 28 | fi 29 | echo "$result: $src" >> tcc.sum 30 | done 31 | 32 | echo "$nb_failed test(s) failed." >> tcc.sum 33 | echo "$nb_failed test(s) failed." 34 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/libtcc_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Simple Test program for libtcc 3 | * 4 | * libtcc can be useful to use tcc as a "backend" for a code generator. 5 | */ 6 | #include 7 | #include 8 | #include 9 | 10 | #include "libtcc.h" 11 | 12 | /* this function is called by the generated code */ 13 | int add(int a, int b) 14 | { 15 | return a + b; 16 | } 17 | 18 | char my_program[] = 19 | "int fib(int n)\n" 20 | "{\n" 21 | " if (n <= 2)\n" 22 | " return 1;\n" 23 | " else\n" 24 | " return fib(n-1) + fib(n-2);\n" 25 | "}\n" 26 | "\n" 27 | "int foo(int n)\n" 28 | "{\n" 29 | " printf(\"Hello World!\\n\");\n" 30 | " printf(\"fib(%d) = %d\\n\", n, fib(n));\n" 31 | " printf(\"add(%d, %d) = %d\\n\", n, 2 * n, add(n, 2 * n));\n" 32 | " return 0;\n" 33 | "}\n"; 34 | 35 | int main(int argc, char **argv) 36 | { 37 | TCCState *s; 38 | int (*func)(int); 39 | 40 | s = tcc_new(); 41 | if (!s) { 42 | fprintf(stderr, "Could not create tcc state\n"); 43 | exit(1); 44 | } 45 | 46 | /* if tcclib.h and libtcc1.a are not installed, where can we find them */ 47 | if (argc == 2 && !memcmp(argv[1], "lib_path=",9)) 48 | tcc_set_lib_path(s, argv[1]+9); 49 | 50 | /* MUST BE CALLED before any compilation */ 51 | tcc_set_output_type(s, TCC_OUTPUT_MEMORY); 52 | 53 | if (tcc_compile_string(s, my_program) == -1) 54 | return 1; 55 | 56 | /* as a test, we add a symbol that the compiled program can use. 57 | You may also open a dll with tcc_add_dll() and use symbols from that */ 58 | tcc_add_symbol(s, "add", add); 59 | 60 | /* relocate the code */ 61 | if (tcc_relocate(s, TCC_RELOCATE_AUTO) < 0) 62 | return 1; 63 | 64 | /* get entry symbol */ 65 | func = tcc_get_symbol(s, "foo"); 66 | if (!func) 67 | return 1; 68 | 69 | /* run the code */ 70 | func(32); 71 | 72 | /* delete the state */ 73 | tcc_delete(s); 74 | 75 | return 0; 76 | } 77 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/00_assignment.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a; 6 | a = 42; 7 | printf("%d\n", a); 8 | 9 | int b = 64; 10 | printf("%d\n", b); 11 | 12 | int c = 12, d = 34; 13 | printf("%d, %d\n", c, d); 14 | 15 | return 0; 16 | } 17 | 18 | // vim: set expandtab ts=4 sw=3 sts=3 tw=80 : 19 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/00_assignment.expect: -------------------------------------------------------------------------------- 1 | 42 2 | 64 3 | 12, 34 4 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/01_comment.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("Hello\n"); 6 | printf("Hello\n"); /* this is a comment */ printf("Hello\n"); 7 | printf("Hello\n"); 8 | // this is also a comment sayhello(); 9 | printf("Hello\n"); 10 | 11 | return 0; 12 | } 13 | 14 | // vim: set expandtab ts=4 sw=3 sts=3 tw=80 : 15 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/01_comment.expect: -------------------------------------------------------------------------------- 1 | Hello 2 | Hello 3 | Hello 4 | Hello 5 | Hello 6 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/02_printf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("Hello world\n"); 6 | 7 | int Count; 8 | for (Count = -5; Count <= 5; Count++) 9 | printf("Count = %d\n", Count); 10 | 11 | printf("String 'hello', 'there' is '%s', '%s'\n", "hello", "there"); 12 | printf("Character 'A' is '%c'\n", 65); 13 | printf("Character 'a' is '%c'\n", 'a'); 14 | 15 | return 0; 16 | } 17 | 18 | // vim: set expandtab ts=4 sw=3 sts=3 tw=80 : 19 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/02_printf.expect: -------------------------------------------------------------------------------- 1 | Hello world 2 | Count = -5 3 | Count = -4 4 | Count = -3 5 | Count = -2 6 | Count = -1 7 | Count = 0 8 | Count = 1 9 | Count = 2 10 | Count = 3 11 | Count = 4 12 | Count = 5 13 | String 'hello', 'there' is 'hello', 'there' 14 | Character 'A' is 'A' 15 | Character 'a' is 'a' 16 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/03_struct.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct fred 4 | { 5 | int boris; 6 | int natasha; 7 | }; 8 | 9 | void main() 10 | { 11 | struct fred bloggs; 12 | 13 | bloggs.boris = 12; 14 | bloggs.natasha = 34; 15 | 16 | printf("%d\n", bloggs.boris); 17 | printf("%d\n", bloggs.natasha); 18 | 19 | struct fred jones[2]; 20 | jones[0].boris = 12; 21 | jones[0].natasha = 34; 22 | jones[1].boris = 56; 23 | jones[1].natasha = 78; 24 | 25 | printf("%d\n", jones[0].boris); 26 | printf("%d\n", jones[0].natasha); 27 | printf("%d\n", jones[1].boris); 28 | printf("%d\n", jones[1].natasha); 29 | 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/03_struct.expect: -------------------------------------------------------------------------------- 1 | 12 2 | 34 3 | 12 4 | 34 5 | 56 6 | 78 7 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/04_for.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int Count; 6 | 7 | for (Count = 1; Count <= 10; Count++) 8 | { 9 | printf("%d\n", Count); 10 | } 11 | 12 | return 0; 13 | } 14 | 15 | // vim: set expandtab ts=4 sw=3 sts=3 tw=80 : 16 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/04_for.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/05_array.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int Count; 6 | int Array[10]; 7 | 8 | for (Count = 1; Count <= 10; Count++) 9 | { 10 | Array[Count-1] = Count * Count; 11 | } 12 | 13 | for (Count = 0; Count < 10; Count++) 14 | { 15 | printf("%d\n", Array[Count]); 16 | } 17 | 18 | return 0; 19 | } 20 | 21 | // vim: set expandtab ts=4 sw=3 sts=3 tw=80 : 22 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/05_array.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 4 3 | 9 4 | 16 5 | 25 6 | 36 7 | 49 8 | 64 9 | 81 10 | 100 11 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/06_case.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int Count; 6 | 7 | for (Count = 0; Count < 4; Count++) 8 | { 9 | printf("%d\n", Count); 10 | switch (Count) 11 | { 12 | case 1: 13 | printf("%d\n", 1); 14 | break; 15 | 16 | case 2: 17 | printf("%d\n", 2); 18 | break; 19 | 20 | default: 21 | printf("%d\n", 0); 22 | break; 23 | } 24 | } 25 | 26 | return 0; 27 | } 28 | 29 | // vim: set expandtab ts=4 sw=3 sts=3 tw=80 : 30 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/06_case.expect: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 1 4 | 1 5 | 2 6 | 2 7 | 3 8 | 0 9 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/07_function.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int myfunc(int x) 4 | { 5 | return x * x; 6 | } 7 | 8 | void vfunc(int a) 9 | { 10 | printf("a=%d\n", a); 11 | } 12 | 13 | void qfunc() 14 | { 15 | printf("qfunc()\n"); 16 | } 17 | 18 | int main() 19 | { 20 | printf("%d\n", myfunc(3)); 21 | printf("%d\n", myfunc(4)); 22 | 23 | vfunc(1234); 24 | 25 | qfunc(); 26 | 27 | return 0; 28 | } 29 | 30 | // vim: set expandtab ts=4 sw=3 sts=3 tw=80 : 31 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/07_function.expect: -------------------------------------------------------------------------------- 1 | 9 2 | 16 3 | a=1234 4 | qfunc() 5 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/08_while.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a; 6 | int p; 7 | int t; 8 | 9 | a = 1; 10 | p = 0; 11 | t = 0; 12 | 13 | while (a < 100) 14 | { 15 | printf("%d\n", a); 16 | t = a; 17 | a = t + p; 18 | p = t; 19 | } 20 | 21 | return 0; 22 | } 23 | 24 | // vim: set expandtab ts=4 sw=3 sts=3 tw=80 : 25 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/08_while.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 2 4 | 3 5 | 5 6 | 8 7 | 13 8 | 21 9 | 34 10 | 55 11 | 89 12 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/09_do_while.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a; 6 | int p; 7 | int t; 8 | 9 | a = 1; 10 | p = 0; 11 | t = 0; 12 | 13 | do 14 | { 15 | printf("%d\n", a); 16 | t = a; 17 | a = t + p; 18 | p = t; 19 | } while (a < 100); 20 | 21 | return 0; 22 | } 23 | 24 | // vim: set expandtab ts=4 sw=3 sts=3 tw=80 : 25 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/09_do_while.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 2 4 | 3 5 | 5 6 | 8 7 | 13 8 | 21 9 | 34 10 | 55 11 | 89 12 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/10_pointer.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct ziggy 4 | { 5 | int a; 6 | int b; 7 | int c; 8 | } bolshevic; 9 | 10 | int main() 11 | { 12 | int a; 13 | int *b; 14 | int c; 15 | 16 | a = 42; 17 | b = &a; 18 | printf("a = %d\n", *b); 19 | 20 | bolshevic.a = 12; 21 | bolshevic.b = 34; 22 | bolshevic.c = 56; 23 | 24 | printf("bolshevic.a = %d\n", bolshevic.a); 25 | printf("bolshevic.b = %d\n", bolshevic.b); 26 | printf("bolshevic.c = %d\n", bolshevic.c); 27 | 28 | struct ziggy *tsar = &bolshevic; 29 | 30 | printf("tsar->a = %d\n", tsar->a); 31 | printf("tsar->b = %d\n", tsar->b); 32 | printf("tsar->c = %d\n", tsar->c); 33 | 34 | b = &(bolshevic.b); 35 | printf("bolshevic.b = %d\n", *b); 36 | 37 | return 0; 38 | } 39 | 40 | // vim: set expandtab ts=4 sw=3 sts=3 tw=80 : 41 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/10_pointer.expect: -------------------------------------------------------------------------------- 1 | a = 42 2 | bolshevic.a = 12 3 | bolshevic.b = 34 4 | bolshevic.c = 56 5 | tsar->a = 12 6 | tsar->b = 34 7 | tsar->c = 56 8 | bolshevic.b = 34 9 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/11_precedence.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a; 6 | int b; 7 | int c; 8 | int d; 9 | int e; 10 | int f; 11 | int x; 12 | int y; 13 | 14 | a = 12; 15 | b = 34; 16 | c = 56; 17 | d = 78; 18 | e = 0; 19 | f = 1; 20 | 21 | printf("%d\n", c + d); 22 | printf("%d\n", (y = c + d)); 23 | printf("%d\n", e || e && f); 24 | printf("%d\n", e || f && f); 25 | printf("%d\n", e && e || f); 26 | printf("%d\n", e && f || f); 27 | printf("%d\n", a && f | f); 28 | printf("%d\n", a | b ^ c & d); 29 | printf("%d, %d\n", a == a, a == b); 30 | printf("%d, %d\n", a != a, a != b); 31 | printf("%d\n", a != b && c != d); 32 | printf("%d\n", a + b * c / f); 33 | printf("%d\n", a + b * c / f); 34 | printf("%d\n", (4 << 4)); 35 | printf("%d\n", (64 >> 4)); 36 | 37 | return 0; 38 | } 39 | 40 | // vim: set expandtab ts=4 sw=3 sts=3 tw=80 : 41 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/11_precedence.expect: -------------------------------------------------------------------------------- 1 | 134 2 | 134 3 | 0 4 | 1 5 | 1 6 | 1 7 | 1 8 | 46 9 | 1, 0 10 | 0, 1 11 | 1 12 | 1916 13 | 1916 14 | 64 15 | 4 16 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/12_hashdefine.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define FRED 12 4 | #define BLOGGS(x) (12*(x)) 5 | 6 | int main() 7 | { 8 | printf("%d\n", FRED); 9 | printf("%d, %d, %d\n", BLOGGS(1), BLOGGS(2), BLOGGS(3)); 10 | 11 | return 0; 12 | } 13 | 14 | // vim: set expandtab ts=4 sw=3 sts=3 tw=80 : 15 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/12_hashdefine.expect: -------------------------------------------------------------------------------- 1 | 12 2 | 12, 24, 36 3 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/13_integer_literals.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a = 24680; 6 | int b = 01234567; 7 | int c = 0x2468ac; 8 | int d = 0x2468AC; 9 | int e = 0b010101010101; 10 | 11 | printf("%d\n", a); 12 | printf("%d\n", b); 13 | printf("%d\n", c); 14 | printf("%d\n", d); 15 | printf("%d\n", e); 16 | 17 | return 0; 18 | } 19 | 20 | // vim: set expandtab ts=4 sw=3 sts=3 tw=80 : 21 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/13_integer_literals.expect: -------------------------------------------------------------------------------- 1 | 24680 2 | 342391 3 | 2386092 4 | 2386092 5 | 1365 6 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/14_if.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a = 1; 6 | 7 | if (a) 8 | printf("a is true\n"); 9 | else 10 | printf("a is false\n"); 11 | 12 | int b = 0; 13 | if (b) 14 | printf("b is true\n"); 15 | else 16 | printf("b is false\n"); 17 | 18 | return 0; 19 | } 20 | 21 | // vim: set expandtab ts=4 sw=3 sts=3 tw=80 : 22 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/14_if.expect: -------------------------------------------------------------------------------- 1 | a is true 2 | b is false 3 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/15_recursion.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int factorial(int i) 4 | { 5 | if (i < 2) 6 | return i; 7 | else 8 | return i * factorial(i - 1); 9 | } 10 | 11 | int main() 12 | { 13 | int Count; 14 | 15 | for (Count = 1; Count <= 10; Count++) 16 | printf("%d\n", factorial(Count)); 17 | 18 | return 0; 19 | } 20 | 21 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 22 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/15_recursion.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 6 4 | 24 5 | 120 6 | 720 7 | 5040 8 | 40320 9 | 362880 10 | 3628800 11 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/16_nesting.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int x, y, z; 6 | 7 | for (x = 0; x < 2; x++) 8 | { 9 | for (y = 0; y < 3; y++) 10 | { 11 | for (z = 0; z < 3; z++) 12 | { 13 | printf("%d %d %d\n", x, y, z); 14 | } 15 | } 16 | } 17 | 18 | return 0; 19 | } 20 | 21 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 22 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/16_nesting.expect: -------------------------------------------------------------------------------- 1 | 0 0 0 2 | 0 0 1 3 | 0 0 2 4 | 0 1 0 5 | 0 1 1 6 | 0 1 2 7 | 0 2 0 8 | 0 2 1 9 | 0 2 2 10 | 1 0 0 11 | 1 0 1 12 | 1 0 2 13 | 1 1 0 14 | 1 1 1 15 | 1 1 2 16 | 1 2 0 17 | 1 2 1 18 | 1 2 2 19 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/17_enum.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | enum fred 4 | { 5 | a, 6 | b, 7 | c, 8 | d, 9 | e = 54, 10 | f = 73, 11 | g, 12 | h 13 | }; 14 | 15 | int main() 16 | { 17 | enum fred frod; 18 | 19 | printf("%d %d %d %d %d %d %d %d\n", a, b, c, d, e, f, g, h); 20 | /* printf("%d\n", frod); */ 21 | frod = 12; 22 | printf("%d\n", frod); 23 | frod = e; 24 | printf("%d\n", frod); 25 | 26 | return 0; 27 | } 28 | 29 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 30 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/17_enum.expect: -------------------------------------------------------------------------------- 1 | 0 1 2 3 54 73 74 75 2 | 12 3 | 54 4 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/18_include.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("including\n"); 6 | #include "18_include.h" 7 | printf("done\n"); 8 | 9 | return 0; 10 | } 11 | 12 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 13 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/18_include.expect: -------------------------------------------------------------------------------- 1 | including 2 | included 3 | done 4 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/18_include.h: -------------------------------------------------------------------------------- 1 | printf("included\n"); 2 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/19_pointer_arithmetic.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a; 6 | int *b; 7 | int *c; 8 | 9 | a = 42; 10 | b = &a; 11 | c = NULL; 12 | 13 | printf("%d\n", *b); 14 | 15 | if (b == NULL) 16 | printf("b is NULL\n"); 17 | else 18 | printf("b is not NULL\n"); 19 | 20 | if (c == NULL) 21 | printf("c is NULL\n"); 22 | else 23 | printf("c is not NULL\n"); 24 | 25 | return 0; 26 | } 27 | 28 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 29 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/19_pointer_arithmetic.expect: -------------------------------------------------------------------------------- 1 | 42 2 | b is not NULL 3 | c is NULL 4 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/20_pointer_comparison.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a; 6 | int b; 7 | int *d; 8 | int *e; 9 | d = &a; 10 | e = &b; 11 | a = 12; 12 | b = 34; 13 | printf("%d\n", *d); 14 | printf("%d\n", *e); 15 | printf("%d\n", d == e); 16 | printf("%d\n", d != e); 17 | d = e; 18 | printf("%d\n", d == e); 19 | printf("%d\n", d != e); 20 | 21 | return 0; 22 | } 23 | 24 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 25 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/20_pointer_comparison.expect: -------------------------------------------------------------------------------- 1 | 12 2 | 34 3 | 0 4 | 1 5 | 1 6 | 0 7 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/21_char_array.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int x = 'a'; 6 | char y = x; 7 | 8 | char *a = "hello"; 9 | 10 | printf("%s\n", a); 11 | 12 | int c; 13 | c = *a; 14 | 15 | char *b; 16 | for (b = a; *b != 0; b++) 17 | printf("%c: %d\n", *b, *b); 18 | 19 | char destarray[10]; 20 | char *dest = &destarray[0]; 21 | char *src = a; 22 | 23 | while (*src != 0) 24 | *dest++ = *src++; 25 | 26 | *dest = 0; 27 | 28 | printf("copied string is %s\n", destarray); 29 | 30 | return 0; 31 | } 32 | 33 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 34 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/21_char_array.expect: -------------------------------------------------------------------------------- 1 | hello 2 | h: 104 3 | e: 101 4 | l: 108 5 | l: 108 6 | o: 111 7 | copied string is hello 8 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/22_floating_point.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | // variables 7 | float a = 12.34 + 56.78; 8 | printf("%f\n", a); 9 | 10 | // infix operators 11 | printf("%f\n", 12.34 + 56.78); 12 | printf("%f\n", 12.34 - 56.78); 13 | printf("%f\n", 12.34 * 56.78); 14 | printf("%f\n", 12.34 / 56.78); 15 | 16 | // comparison operators 17 | printf("%d %d %d %d %d %d\n", 12.34 < 56.78, 12.34 <= 56.78, 12.34 == 56.78, 12.34 >= 56.78, 12.34 > 56.78, 12.34 != 56.78); 18 | printf("%d %d %d %d %d %d\n", 12.34 < 12.34, 12.34 <= 12.34, 12.34 == 12.34, 12.34 >= 12.34, 12.34 > 12.34, 12.34 != 12.34); 19 | printf("%d %d %d %d %d %d\n", 56.78 < 12.34, 56.78 <= 12.34, 56.78 == 12.34, 56.78 >= 12.34, 56.78 > 12.34, 56.78 != 12.34); 20 | 21 | // assignment operators 22 | a = 12.34; 23 | a += 56.78; 24 | printf("%f\n", a); 25 | 26 | a = 12.34; 27 | a -= 56.78; 28 | printf("%f\n", a); 29 | 30 | a = 12.34; 31 | a *= 56.78; 32 | printf("%f\n", a); 33 | 34 | a = 12.34; 35 | a /= 56.78; 36 | printf("%f\n", a); 37 | 38 | // prefix operators 39 | printf("%f\n", +12.34); 40 | printf("%f\n", -12.34); 41 | 42 | // type coercion 43 | a = 2; 44 | printf("%f\n", a); 45 | printf("%f\n", sin(2)); 46 | 47 | return 0; 48 | } 49 | 50 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 51 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/22_floating_point.expect: -------------------------------------------------------------------------------- 1 | 69.120003 2 | 69.120000 3 | -44.440000 4 | 700.665200 5 | 0.217330 6 | 1 1 0 0 0 1 7 | 0 1 1 1 0 0 8 | 0 0 0 1 1 1 9 | 69.120003 10 | -44.439999 11 | 700.665222 12 | 0.217330 13 | 12.340000 14 | -12.340000 15 | 2.000000 16 | 0.909297 17 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/23_type_coercion.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void charfunc(char a) 4 | { 5 | printf("char: %c\n", a); 6 | } 7 | 8 | void intfunc(int a) 9 | { 10 | printf("int: %d\n", a); 11 | } 12 | 13 | void floatfunc(float a) 14 | { 15 | printf("float: %f\n", a); 16 | } 17 | 18 | int main() 19 | { 20 | charfunc('a'); 21 | charfunc(98); 22 | charfunc(99.0); 23 | 24 | intfunc('a'); 25 | intfunc(98); 26 | intfunc(99.0); 27 | 28 | floatfunc('a'); 29 | floatfunc(98); 30 | floatfunc(99.0); 31 | 32 | /* printf("%c %d %f\n", 'a', 'b', 'c'); */ 33 | /* printf("%c %d %f\n", 97, 98, 99); */ 34 | /* printf("%c %d %f\n", 97.0, 98.0, 99.0); */ 35 | 36 | char b = 97; 37 | char c = 97.0; 38 | 39 | printf("%d %d\n", b, c); 40 | 41 | int d = 'a'; 42 | int e = 97.0; 43 | 44 | printf("%d %d\n", d, e); 45 | 46 | float f = 'a'; 47 | float g = 97; 48 | 49 | printf("%f %f\n", f, g); 50 | 51 | return 0; 52 | } 53 | 54 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 55 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/23_type_coercion.expect: -------------------------------------------------------------------------------- 1 | char: a 2 | char: b 3 | char: c 4 | int: 97 5 | int: 98 6 | int: 99 7 | float: 97.000000 8 | float: 98.000000 9 | float: 99.000000 10 | 97 97 11 | 97 97 12 | 97.000000 97.000000 13 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/24_math_library.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | printf("%f\n", sin(0.12)); 7 | printf("%f\n", cos(0.12)); 8 | printf("%f\n", tan(0.12)); 9 | printf("%f\n", asin(0.12)); 10 | printf("%f\n", acos(0.12)); 11 | printf("%f\n", atan(0.12)); 12 | printf("%f\n", sinh(0.12)); 13 | printf("%f\n", cosh(0.12)); 14 | printf("%f\n", tanh(0.12)); 15 | printf("%f\n", exp(0.12)); 16 | printf("%f\n", fabs(-0.12)); 17 | printf("%f\n", log(0.12)); 18 | printf("%f\n", log10(0.12)); 19 | printf("%f\n", pow(0.12, 0.12)); 20 | printf("%f\n", sqrt(0.12)); 21 | printf("%f\n", round(12.34)); 22 | printf("%f\n", ceil(12.34)); 23 | printf("%f\n", floor(12.34)); 24 | 25 | return 0; 26 | } 27 | 28 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 29 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/24_math_library.expect: -------------------------------------------------------------------------------- 1 | 0.119712 2 | 0.992809 3 | 0.120579 4 | 0.120290 5 | 1.450506 6 | 0.119429 7 | 0.120288 8 | 1.007209 9 | 0.119427 10 | 1.127497 11 | 0.120000 12 | -2.120264 13 | -0.920819 14 | 0.775357 15 | 0.346410 16 | 12.000000 17 | 13.000000 18 | 12.000000 19 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/25_quicksort.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int array[16]; 4 | 5 | //Swap integer values by array indexes 6 | void swap(int a, int b) 7 | { 8 | int tmp = array[a]; 9 | array[a] = array[b]; 10 | array[b] = tmp; 11 | } 12 | 13 | //Partition the array into two halves and return the 14 | //index about which the array is partitioned 15 | int partition(int left, int right) 16 | { 17 | int pivotIndex = left; 18 | int pivotValue = array[pivotIndex]; 19 | int index = left; 20 | int i; 21 | 22 | swap(pivotIndex, right); 23 | for(i = left; i < right; i++) 24 | { 25 | if(array[i] < pivotValue) 26 | { 27 | swap(i, index); 28 | index += 1; 29 | } 30 | } 31 | swap(right, index); 32 | 33 | return index; 34 | } 35 | 36 | //Quicksort the array 37 | void quicksort(int left, int right) 38 | { 39 | if(left >= right) 40 | return; 41 | 42 | int index = partition(left, right); 43 | quicksort(left, index - 1); 44 | quicksort(index + 1, right); 45 | } 46 | 47 | int main() 48 | { 49 | int i; 50 | 51 | array[0] = 62; 52 | array[1] = 83; 53 | array[2] = 4; 54 | array[3] = 89; 55 | array[4] = 36; 56 | array[5] = 21; 57 | array[6] = 74; 58 | array[7] = 37; 59 | array[8] = 65; 60 | array[9] = 33; 61 | array[10] = 96; 62 | array[11] = 38; 63 | array[12] = 53; 64 | array[13] = 16; 65 | array[14] = 74; 66 | array[15] = 55; 67 | 68 | for (i = 0; i < 16; i++) 69 | printf("%d ", array[i]); 70 | 71 | printf("\n"); 72 | 73 | quicksort(0, 15); 74 | 75 | for (i = 0; i < 16; i++) 76 | printf("%d ", array[i]); 77 | 78 | printf("\n"); 79 | 80 | return 0; 81 | } 82 | 83 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 84 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/25_quicksort.expect: -------------------------------------------------------------------------------- 1 | 62 83 4 89 36 21 74 37 65 33 96 38 53 16 74 55 2 | 4 16 21 33 36 37 38 53 55 62 65 74 74 83 89 96 3 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/26_character_constants.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("%d\n", '\1'); 6 | printf("%d\n", '\10'); 7 | printf("%d\n", '\100'); 8 | printf("%d\n", '\x01'); 9 | printf("%d\n", '\x0e'); 10 | printf("%d\n", '\x10'); 11 | printf("%d\n", '\x40'); 12 | printf("test \x40\n"); 13 | 14 | return 0; 15 | } 16 | 17 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 18 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/26_character_constants.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 8 3 | 64 4 | 1 5 | 14 6 | 16 7 | 64 8 | test @ 9 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/27_sizeof.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | char a; 6 | int b; 7 | double c; 8 | 9 | printf("%d\n", sizeof(a)); 10 | printf("%d\n", sizeof(b)); 11 | printf("%d\n", sizeof(c)); 12 | 13 | return 0; 14 | } 15 | 16 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 17 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/27_sizeof.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 4 3 | 8 4 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/28_strings.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() 6 | { 7 | char a[10]; 8 | 9 | strcpy(a, "hello"); 10 | printf("%s\n", a); 11 | 12 | strncpy(a, "gosh", 2); 13 | printf("%s\n", a); 14 | 15 | printf("%d\n", strcmp(a, "apple") > 0); 16 | printf("%d\n", strcmp(a, "goere") > 0); 17 | printf("%d\n", strcmp(a, "zebra") < 0); 18 | 19 | printf("%d\n", strlen(a)); 20 | 21 | strcat(a, "!"); 22 | printf("%s\n", a); 23 | 24 | printf("%d\n", strncmp(a, "apple", 2) > 0); 25 | printf("%d\n", strncmp(a, "goere", 2) == 0); 26 | printf("%d\n", strncmp(a, "goerg", 2) == 0); 27 | printf("%d\n", strncmp(a, "zebra", 2) < 0); 28 | 29 | printf("%s\n", index(a, 'o')); 30 | printf("%s\n", rindex(a, 'l')); 31 | printf("%d\n", rindex(a, 'x') == NULL); 32 | 33 | memset(&a[1], 'r', 4); 34 | printf("%s\n", a); 35 | 36 | memcpy(&a[2], a, 2); 37 | printf("%s\n", a); 38 | 39 | printf("%d\n", memcmp(a, "apple", 4) > 0); 40 | printf("%d\n", memcmp(a, "grgr", 4) == 0); 41 | printf("%d\n", memcmp(a, "zebra", 4) < 0); 42 | 43 | return 0; 44 | } 45 | 46 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 47 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/28_strings.expect: -------------------------------------------------------------------------------- 1 | hello 2 | gollo 3 | 1 4 | 1 5 | 1 6 | 5 7 | gollo! 8 | 1 9 | 1 10 | 1 11 | 1 12 | ollo! 13 | lo! 14 | 1 15 | grrrr! 16 | grgrr! 17 | 1 18 | 1 19 | 1 20 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/29_array_address.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | char a[10]; 7 | strcpy(a, "abcdef"); 8 | printf("%s\n", &a[1]); 9 | 10 | return 0; 11 | } 12 | 13 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 14 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/29_array_address.expect: -------------------------------------------------------------------------------- 1 | bcdef 2 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/30_hanoi.c: -------------------------------------------------------------------------------- 1 | /* example from http://barnyard.syr.edu/quickies/hanoi.c */ 2 | 3 | /* hanoi.c: solves the tower of hanoi problem. (Programming exercise.) */ 4 | /* By Terry R. McConnell (12/2/97) */ 5 | /* Compile: cc -o hanoi hanoi.c */ 6 | 7 | /* This program does no error checking. But then, if it's right, 8 | it's right ... right ? */ 9 | 10 | 11 | /* The original towers of hanoi problem seems to have been originally posed 12 | by one M. Claus in 1883. There is a popular legend that goes along with 13 | it that has been often repeated and paraphrased. It goes something like this: 14 | In the great temple at Benares there are 3 golden spikes. On one of them, 15 | God placed 64 disks increasing in size from bottom to top, at the beginning 16 | of time. Since then, and to this day, the priest on duty constantly transfers 17 | disks, one at a time, in such a way that no larger disk is ever put on top 18 | of a smaller one. When the disks have been transferred entirely to another 19 | spike the Universe will come to an end in a large thunderclap. 20 | 21 | This paraphrases the original legend due to DeParville, La Nature, Paris 1884, 22 | Part I, 285-286. For this and further information see: Mathematical 23 | Recreations & Essays, W.W. Rouse Ball, MacMillan, NewYork, 11th Ed. 1967, 24 | 303-305. 25 | * 26 | * 27 | */ 28 | 29 | #include 30 | #include 31 | 32 | #define TRUE 1 33 | #define FALSE 0 34 | 35 | /* This is the number of "disks" on tower A initially. Taken to be 64 in the 36 | * legend. The number of moves required, in general, is 2^N - 1. For N = 64, 37 | * this is 18,446,744,073,709,551,615 */ 38 | #define N 4 39 | 40 | /* These are the three towers. For example if the state of A is 0,1,3,4, that 41 | * means that there are three discs on A of sizes 1, 3, and 4. (Think of right 42 | * as being the "down" direction.) */ 43 | int A[N], B[N], C[N]; 44 | 45 | void Hanoi(int,int*,int*,int*); 46 | 47 | /* Print the current configuration of A, B, and C to the screen */ 48 | void PrintAll() 49 | { 50 | int i; 51 | 52 | printf("A: "); 53 | for(i=0;i 2 | 3 | int main(int argc, char **argv) 4 | { 5 | int Count; 6 | 7 | printf("hello world %d\n", argc); 8 | for (Count = 0; Count < argc; Count++) 9 | printf("arg %d: %s\n", Count, argv[Count]); 10 | 11 | return 0; 12 | } 13 | 14 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 15 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/31_args.expect: -------------------------------------------------------------------------------- 1 | hello world 6 2 | arg 0: 31_args.c 3 | arg 1: - 4 | arg 2: arg1 5 | arg 3: arg2 6 | arg 4: arg3 7 | arg 5: arg4 8 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/32_led.expect: -------------------------------------------------------------------------------- 1 | _ _ _ _ 2 | | _| _| |_| |_ |_ | 3 | | |_ _| | _| |_| | 4 | 5 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/33_ternary_op.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int Count; 6 | 7 | for (Count = 0; Count < 10; Count++) 8 | { 9 | printf("%d\n", (Count < 5) ? (Count*Count) : (Count * 3)); 10 | } 11 | 12 | return 0; 13 | } 14 | 15 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 16 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/33_ternary_op.expect: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 4 4 | 9 5 | 16 6 | 15 7 | 18 8 | 21 9 | 24 10 | 27 11 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/34_array_assignment.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a[4]; 6 | 7 | a[0] = 12; 8 | a[1] = 23; 9 | a[2] = 34; 10 | a[3] = 45; 11 | 12 | printf("%d %d %d %d\n", a[0], a[1], a[2], a[3]); 13 | 14 | int b[4]; 15 | 16 | b = a; 17 | 18 | printf("%d %d %d %d\n", b[0], b[1], b[2], b[3]); 19 | 20 | return 0; 21 | } 22 | 23 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 24 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/34_array_assignment.expect: -------------------------------------------------------------------------------- 1 | 12 23 34 45 2 | 12 23 34 45 3 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/35_sizeof.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | char a; 6 | short b; 7 | 8 | printf("%d %d\n", sizeof(char), sizeof(a)); 9 | printf("%d %d\n", sizeof(short), sizeof(b)); 10 | 11 | return 0; 12 | } 13 | 14 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 15 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/35_sizeof.expect: -------------------------------------------------------------------------------- 1 | 1 1 2 | 2 2 3 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/36_array_initialisers.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int Count; 6 | 7 | int Array[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753 }; 8 | 9 | for (Count = 0; Count < 10; Count++) 10 | printf("%d: %d\n", Count, Array[Count]); 11 | 12 | int Array2[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753, }; 13 | 14 | for (Count = 0; Count < 10; Count++) 15 | printf("%d: %d\n", Count, Array2[Count]); 16 | 17 | 18 | return 0; 19 | } 20 | 21 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 22 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/36_array_initialisers.expect: -------------------------------------------------------------------------------- 1 | 0: 12 2 | 1: 34 3 | 2: 56 4 | 3: 78 5 | 4: 90 6 | 5: 123 7 | 6: 456 8 | 7: 789 9 | 8: 8642 10 | 9: 9753 11 | 0: 12 12 | 1: 34 13 | 2: 56 14 | 3: 78 15 | 4: 90 16 | 5: 123 17 | 6: 456 18 | 7: 789 19 | 8: 8642 20 | 9: 9753 21 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/37_sprintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | char Buf[100]; 6 | int Count; 7 | 8 | for (Count = 1; Count <= 20; Count++) 9 | { 10 | sprintf(Buf, "->%02d<-\n", Count); 11 | printf("%s", Buf); 12 | } 13 | 14 | return 0; 15 | } 16 | 17 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 18 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/37_sprintf.expect: -------------------------------------------------------------------------------- 1 | ->01<- 2 | ->02<- 3 | ->03<- 4 | ->04<- 5 | ->05<- 6 | ->06<- 7 | ->07<- 8 | ->08<- 9 | ->09<- 10 | ->10<- 11 | ->11<- 12 | ->12<- 13 | ->13<- 14 | ->14<- 15 | ->15<- 16 | ->16<- 17 | ->17<- 18 | ->18<- 19 | ->19<- 20 | ->20<- 21 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/38_multiple_array_index.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a[4][4]; 6 | int b = 0; 7 | int x; 8 | int y; 9 | 10 | for (x = 0; x < 4; x++) 11 | { 12 | for (y = 0; y < 4; y++) 13 | { 14 | b++; 15 | a[x][y] = b; 16 | } 17 | } 18 | 19 | for (x = 0; x < 4; x++) 20 | { 21 | printf("x=%d: ", x); 22 | for (y = 0; y < 4; y++) 23 | { 24 | printf("%d ", a[x][y]); 25 | } 26 | printf("\n"); 27 | } 28 | 29 | return 0; 30 | } 31 | 32 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 33 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/38_multiple_array_index.expect: -------------------------------------------------------------------------------- 1 | x=0: 1 2 3 4 2 | x=1: 5 6 7 8 3 | x=2: 9 10 11 12 4 | x=3: 13 14 15 16 5 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/39_typedef.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | typedef int MyInt; 4 | 5 | struct FunStruct 6 | { 7 | int i; 8 | int j; 9 | }; 10 | 11 | typedef struct FunStruct MyFunStruct; 12 | 13 | typedef MyFunStruct *MoreFunThanEver; 14 | 15 | int main() 16 | { 17 | MyInt a = 1; 18 | printf("%d\n", a); 19 | 20 | MyFunStruct b; 21 | b.i = 12; 22 | b.j = 34; 23 | printf("%d,%d\n", b.i, b.j); 24 | 25 | MoreFunThanEver c = &b; 26 | printf("%d,%d\n", c->i, c->j); 27 | 28 | return 0; 29 | } 30 | 31 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 32 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/39_typedef.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 12,34 3 | 12,34 4 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/40_stdio.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | FILE *f = fopen("fred.txt", "w"); 6 | fwrite("hello\nhello\n", 1, 12, f); 7 | fclose(f); 8 | 9 | char freddy[7]; 10 | f = fopen("fred.txt", "r"); 11 | if (fread(freddy, 1, 6, f) != 6) 12 | printf("couldn't read fred.txt\n"); 13 | 14 | freddy[6] = '\0'; 15 | fclose(f); 16 | 17 | printf("%s", freddy); 18 | 19 | int InChar; 20 | char ShowChar; 21 | f = fopen("fred.txt", "r"); 22 | while ( (InChar = fgetc(f)) != EOF) 23 | { 24 | ShowChar = InChar; 25 | if (ShowChar < ' ') 26 | ShowChar = '.'; 27 | 28 | printf("ch: %d '%c'\n", InChar, ShowChar); 29 | } 30 | fclose(f); 31 | 32 | f = fopen("fred.txt", "r"); 33 | while ( (InChar = getc(f)) != EOF) 34 | { 35 | ShowChar = InChar; 36 | if (ShowChar < ' ') 37 | ShowChar = '.'; 38 | 39 | printf("ch: %d '%c'\n", InChar, ShowChar); 40 | } 41 | fclose(f); 42 | 43 | f = fopen("fred.txt", "r"); 44 | while (fgets(freddy, sizeof(freddy), f) != NULL) 45 | printf("x: %s", freddy); 46 | 47 | fclose(f); 48 | 49 | return 0; 50 | } 51 | 52 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 53 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/40_stdio.expect: -------------------------------------------------------------------------------- 1 | hello 2 | ch: 104 'h' 3 | ch: 101 'e' 4 | ch: 108 'l' 5 | ch: 108 'l' 6 | ch: 111 'o' 7 | ch: 10 '.' 8 | ch: 104 'h' 9 | ch: 101 'e' 10 | ch: 108 'l' 11 | ch: 108 'l' 12 | ch: 111 'o' 13 | ch: 10 '.' 14 | ch: 104 'h' 15 | ch: 101 'e' 16 | ch: 108 'l' 17 | ch: 108 'l' 18 | ch: 111 'o' 19 | ch: 10 '.' 20 | ch: 104 'h' 21 | ch: 101 'e' 22 | ch: 108 'l' 23 | ch: 108 'l' 24 | ch: 111 'o' 25 | ch: 10 '.' 26 | x: hello 27 | x: hello 28 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/41_hashif.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("#include test\n"); 6 | 7 | #if 1 8 | #if 0 9 | printf("a\n"); 10 | #else 11 | printf("b\n"); 12 | #endif 13 | #else 14 | #if 0 15 | printf("c\n"); 16 | #else 17 | printf("d\n"); 18 | #endif 19 | #endif 20 | 21 | #if 0 22 | #if 1 23 | printf("e\n"); 24 | #else 25 | printf("f\n"); 26 | #endif 27 | #else 28 | #if 1 29 | printf("g\n"); 30 | #else 31 | printf("h\n"); 32 | #endif 33 | #endif 34 | 35 | #define DEF 36 | 37 | #ifdef DEF 38 | #ifdef DEF 39 | printf("i\n"); 40 | #else 41 | printf("j\n"); 42 | #endif 43 | #else 44 | #ifdef DEF 45 | printf("k\n"); 46 | #else 47 | printf("l\n"); 48 | #endif 49 | #endif 50 | 51 | #ifndef DEF 52 | #ifndef DEF 53 | printf("m\n"); 54 | #else 55 | printf("n\n"); 56 | #endif 57 | #else 58 | #ifndef DEF 59 | printf("o\n"); 60 | #else 61 | printf("p\n"); 62 | #endif 63 | #endif 64 | 65 | #define ONE 1 66 | #define ZERO 0 67 | 68 | #if ONE 69 | #if ZERO 70 | printf("q\n"); 71 | #else 72 | printf("r\n"); 73 | #endif 74 | #else 75 | #if ZERO 76 | printf("s\n"); 77 | #else 78 | printf("t\n"); 79 | #endif 80 | #endif 81 | 82 | return 0; 83 | } 84 | 85 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 86 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/41_hashif.expect: -------------------------------------------------------------------------------- 1 | #include test 2 | b 3 | g 4 | i 5 | p 6 | r 7 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/42_function_pointer.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int fred(int p) 4 | { 5 | printf("yo %d\n", p); 6 | return 42; 7 | } 8 | 9 | int (*f)(int) = &fred; 10 | 11 | int main() 12 | { 13 | printf("%d\n", (*f)(24)); 14 | 15 | return 0; 16 | } 17 | 18 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 19 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/42_function_pointer.expect: -------------------------------------------------------------------------------- 1 | yo 24 2 | 42 3 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/43_void_param.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void fred(void) 4 | { 5 | printf("yo\n"); 6 | } 7 | 8 | int main() 9 | { 10 | fred(); 11 | 12 | return 0; 13 | } 14 | 15 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 16 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/43_void_param.expect: -------------------------------------------------------------------------------- 1 | yo 2 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/44_scoped_declarations.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a; 6 | 7 | for (a = 0; a < 2; a++) 8 | { 9 | int b = a; 10 | } 11 | 12 | printf("it's all good\n"); 13 | 14 | return 0; 15 | } 16 | 17 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 18 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/44_scoped_declarations.expect: -------------------------------------------------------------------------------- 1 | it's all good 2 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/45_empty_for.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int Count = 0; 6 | 7 | for (;;) 8 | { 9 | Count++; 10 | printf("%d\n", Count); 11 | if (Count >= 10) 12 | break; 13 | } 14 | 15 | return 0; 16 | } 17 | 18 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 19 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/45_empty_for.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/47_switch_return.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void fred(int x) 4 | { 5 | switch (x) 6 | { 7 | case 1: printf("1\n"); return; 8 | case 2: printf("2\n"); break; 9 | case 3: printf("3\n"); return; 10 | } 11 | 12 | printf("out\n"); 13 | } 14 | 15 | int main() 16 | { 17 | fred(1); 18 | fred(2); 19 | fred(3); 20 | 21 | return 0; 22 | } 23 | 24 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 25 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/47_switch_return.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | out 4 | 3 5 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/48_nested_break.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a; 6 | char b; 7 | 8 | a = 0; 9 | while (a < 2) 10 | { 11 | printf("%d", a++); 12 | break; 13 | 14 | b = 'A'; 15 | while (b < 'C') 16 | { 17 | printf("%c", b++); 18 | } 19 | printf("e"); 20 | } 21 | printf("\n"); 22 | 23 | return 0; 24 | } 25 | 26 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 27 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/48_nested_break.expect: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/49_bracket_evaluation.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct point 4 | { 5 | double x; 6 | double y; 7 | }; 8 | 9 | struct point point_array[100]; 10 | 11 | int main() 12 | { 13 | int my_point = 10; 14 | 15 | point_array[my_point].x = 12.34; 16 | point_array[my_point].y = 56.78; 17 | 18 | printf("%f, %f\n", point_array[my_point].x, point_array[my_point].y); 19 | 20 | return 0; 21 | } 22 | 23 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 24 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/49_bracket_evaluation.expect: -------------------------------------------------------------------------------- 1 | 12.340000, 56.780000 2 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/50_logical_second_arg.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int fred() 4 | { 5 | printf("fred\n"); 6 | return 0; 7 | } 8 | 9 | int joe() 10 | { 11 | printf("joe\n"); 12 | return 1; 13 | } 14 | 15 | int main() 16 | { 17 | printf("%d\n", fred() && joe()); 18 | printf("%d\n", fred() || joe()); 19 | printf("%d\n", joe() && fred()); 20 | printf("%d\n", joe() || fred()); 21 | printf("%d\n", fred() && (1 + joe())); 22 | printf("%d\n", fred() || (0 + joe())); 23 | printf("%d\n", joe() && (0 + fred())); 24 | printf("%d\n", joe() || (1 + fred())); 25 | 26 | return 0; 27 | } 28 | 29 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 30 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/50_logical_second_arg.expect: -------------------------------------------------------------------------------- 1 | fred 2 | 0 3 | fred 4 | joe 5 | 1 6 | joe 7 | fred 8 | 0 9 | joe 10 | 1 11 | fred 12 | 0 13 | fred 14 | joe 15 | 1 16 | joe 17 | fred 18 | 0 19 | joe 20 | 1 21 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/51_static.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static int fred = 1234; 4 | static int joe; 5 | 6 | void henry() 7 | { 8 | static int fred = 4567; 9 | 10 | printf("%d\n", fred); 11 | fred++; 12 | } 13 | 14 | int main() 15 | { 16 | printf("%d\n", fred); 17 | henry(); 18 | henry(); 19 | henry(); 20 | henry(); 21 | printf("%d\n", fred); 22 | fred = 8901; 23 | joe = 2345; 24 | printf("%d\n", fred); 25 | printf("%d\n", joe); 26 | 27 | return 0; 28 | } 29 | 30 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 31 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/51_static.expect: -------------------------------------------------------------------------------- 1 | 1234 2 | 4567 3 | 4568 4 | 4569 5 | 4570 6 | 1234 7 | 8901 8 | 2345 9 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/52_unnamed_enum.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | enum fred { a, b, c }; 4 | 5 | int main() 6 | { 7 | printf("a=%d\n", a); 8 | printf("b=%d\n", b); 9 | printf("c=%d\n", c); 10 | 11 | enum fred d; 12 | 13 | typedef enum { e, f, g } h; 14 | typedef enum { i, j, k } m; 15 | 16 | printf("e=%d\n", e); 17 | printf("f=%d\n", f); 18 | printf("g=%d\n", g); 19 | 20 | printf("i=%d\n", i); 21 | printf("j=%d\n", j); 22 | printf("k=%d\n", k); 23 | 24 | return 0; 25 | } 26 | 27 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 28 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/52_unnamed_enum.expect: -------------------------------------------------------------------------------- 1 | a=0 2 | b=1 3 | c=2 4 | e=0 5 | f=1 6 | g=2 7 | i=0 8 | j=1 9 | k=2 10 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/54_goto.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void fred() 4 | { 5 | printf("In fred()\n"); 6 | goto done; 7 | printf("In middle\n"); 8 | done: 9 | printf("At end\n"); 10 | } 11 | 12 | void joe() 13 | { 14 | int b = 5678; 15 | 16 | printf("In joe()\n"); 17 | 18 | { 19 | int c = 1234; 20 | printf("c = %d\n", c); 21 | goto outer; 22 | printf("uh-oh\n"); 23 | } 24 | 25 | outer: 26 | 27 | printf("done\n"); 28 | } 29 | 30 | void henry() 31 | { 32 | int a; 33 | 34 | printf("In henry()\n"); 35 | goto inner; 36 | 37 | { 38 | int b; 39 | inner: 40 | b = 1234; 41 | printf("b = %d\n", b); 42 | } 43 | 44 | printf("done\n"); 45 | } 46 | 47 | int main() 48 | { 49 | fred(); 50 | joe(); 51 | henry(); 52 | 53 | return 0; 54 | } 55 | 56 | /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ 57 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/54_goto.expect: -------------------------------------------------------------------------------- 1 | In fred() 2 | At end 3 | In joe() 4 | c = 1234 5 | done 6 | In henry() 7 | b = 1234 8 | done 9 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/55_lshift_type.c: -------------------------------------------------------------------------------- 1 | /* $Id: lshift-type.c 53089 2012-07-06 11:18:26Z vinc17/ypig $ 2 | 3 | Tests on left-shift type, written by Vincent Lefevre . 4 | 5 | ISO C99 TC3 says: [6.5.7#3] "The integer promotions are performed on 6 | each of the operands. The type of the result is that of the promoted 7 | left operand." 8 | */ 9 | 10 | #include 11 | 12 | #define PTYPE(M) ((M) < 0 || -(M) < 0 ? -1 : 1) * (int) sizeof((M)+0) 13 | #define CHECK(X,T) check(#X, PTYPE(X), PTYPE((X) << (T) 1)) 14 | #define TEST1(X,T) do { CHECK(X,T); CHECK(X,unsigned T); } while (0) 15 | #define TEST2(X) \ 16 | do \ 17 | { \ 18 | TEST1((X),short); \ 19 | TEST1((X),int); \ 20 | TEST1((X),long); \ 21 | TEST1((X),long long); \ 22 | } \ 23 | while (0) 24 | #define TEST3(X,T) do { TEST2((T)(X)); TEST2((unsigned T)(X)); } while (0) 25 | #define TEST4(X) \ 26 | do \ 27 | { \ 28 | TEST3((X),short); \ 29 | TEST3((X),int); \ 30 | TEST3((X),long); \ 31 | TEST3((X),long long); \ 32 | } \ 33 | while (0) 34 | 35 | static int debug, nfailed = 0; 36 | 37 | static void check (const char *s, int arg1, int shift) 38 | { 39 | int failed = arg1 != shift; 40 | if (debug || failed) 41 | printf ("%s %d %d\n", s, arg1, shift); 42 | nfailed += failed; 43 | } 44 | 45 | int main (int argc, char **argv) 46 | { 47 | debug = argc > 1; 48 | TEST4(1); 49 | TEST4(-1); 50 | printf ("%d test(s) failed\n", nfailed); 51 | return nfailed != 0; 52 | } 53 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/55_lshift_type.expect: -------------------------------------------------------------------------------- 1 | 0 test(s) failed 2 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/LICENSE: -------------------------------------------------------------------------------- 1 | The tests in this directory are either directly copied from the picoc project or 2 | are subsequently modified and added to for the purpose of TinyCC project. All 3 | these modifications are licensed under the same terms as TinyCC as specified in 4 | the file COPYING. 5 | 6 | === picoc license === 7 | 8 | Copyright (c) 2009-2011, Zik Saleeba 9 | All rights reserved. 10 | 11 | Redistribution and use in source and binary forms, with or without 12 | modification, are permitted provided that the following conditions are 13 | met: 14 | 15 | * Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in 20 | the documentation and/or other materials provided with the 21 | distribution. 22 | 23 | * Neither the name of the Zik Saleeba nor the names of its 24 | contributors may be used to endorse or promote products derived 25 | from this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | -------------------------------------------------------------------------------- /tcc/bin/examples/tests/tests2/Makefile: -------------------------------------------------------------------------------- 1 | TOP = ../.. 2 | include $(TOP)/Makefile 3 | VPATH = $(top_srcdir)/tests/tests2 4 | 5 | TCCFLAGS = -B$(TOP) 6 | ifdef CONFIG_WIN32 7 | TCCFLAGS = -B$(top_srcdir)/win32 -I$(top_srcdir)/include -L$(TOP) 8 | endif 9 | 10 | ifeq ($(TARGETOS),Darwin) 11 | CFLAGS += -Wl,-flat_namespace,-undefined,warning 12 | TCCFLAGS += -D_ANSI_SOURCE 13 | export MACOSX_DEPLOYMENT_TARGET:=10.2 14 | endif 15 | 16 | TCC_RUN = $(TOP)/tcc $(TCCFLAGS) -run 17 | 18 | TESTS = \ 19 | 00_assignment.test \ 20 | 01_comment.test \ 21 | 02_printf.test \ 22 | 03_struct.test \ 23 | 04_for.test \ 24 | 05_array.test \ 25 | 06_case.test \ 26 | 07_function.test \ 27 | 08_while.test \ 28 | 09_do_while.test \ 29 | 10_pointer.test \ 30 | 11_precedence.test \ 31 | 12_hashdefine.test \ 32 | 13_integer_literals.test \ 33 | 14_if.test \ 34 | 15_recursion.test \ 35 | 16_nesting.test \ 36 | 17_enum.test \ 37 | 18_include.test \ 38 | 19_pointer_arithmetic.test \ 39 | 20_pointer_comparison.test \ 40 | 21_char_array.test \ 41 | 22_floating_point.test \ 42 | 23_type_coercion.test \ 43 | 24_math_library.test \ 44 | 25_quicksort.test \ 45 | 26_character_constants.test \ 46 | 27_sizeof.test \ 47 | 28_strings.test \ 48 | 29_array_address.test \ 49 | 31_args.test \ 50 | 32_led.test \ 51 | 33_ternary_op.test \ 52 | 35_sizeof.test \ 53 | 36_array_initialisers.test \ 54 | 37_sprintf.test \ 55 | 38_multiple_array_index.test \ 56 | 39_typedef.test \ 57 | 40_stdio.test \ 58 | 41_hashif.test \ 59 | 42_function_pointer.test \ 60 | 43_void_param.test \ 61 | 44_scoped_declarations.test \ 62 | 45_empty_for.test \ 63 | 47_switch_return.test \ 64 | 48_nested_break.test \ 65 | 49_bracket_evaluation.test \ 66 | 50_logical_second_arg.test \ 67 | 51_static.test \ 68 | 52_unnamed_enum.test \ 69 | 54_goto.test \ 70 | 55_lshift_type.test 71 | 72 | # 30_hanoi.test -- seg fault in the code, gcc as well 73 | # 34_array_assignment.test -- array assignment is not in C standard 74 | # 46_grep.test -- does not compile even with gcc 75 | 76 | # some tests do not pass on all platforms, remove them for now 77 | ifeq ($(TARGETOS),Darwin) 78 | TESTS := $(filter-out 40_stdio.test,$(TESTS)) 79 | endif 80 | ifdef CONFIG_WIN32 81 | TESTS := $(filter-out 24_math_library.test 28_strings.test,$(TESTS)) 82 | endif 83 | 84 | %.test: %.c %.expect 85 | @echo Test: $*... 86 | @if [ "x`echo $* | grep args`" != "x" ]; \ 87 | then $(TCC_RUN) $< - arg1 arg2 arg3 arg4 >$*.output; \ 88 | else $(TCC_RUN) $< >$*.output; \ 89 | fi 90 | @if diff -bu $(<:.c=.expect) $*.output ; \ 91 | then rm -f $*.output; \ 92 | else exit 1; \ 93 | fi 94 | 95 | all test: $(TESTS) 96 | 97 | clean: 98 | rm -vf fred.txt *.output 99 | -------------------------------------------------------------------------------- /tcc/bin/generate_crt.bat: -------------------------------------------------------------------------------- 1 | cd /d %~dp0 2 | 3 | echo generating crt... 4 | 5 | @set target=-DTCC_TARGET_PE -DTCC_TARGET_I386 6 | 7 | .\tcc %target% -c lib/libtcc1.c 8 | .\tcc %target% -c lib/crt1.c 9 | .\tcc %target% -c lib/wincrt1.c 10 | .\tcc %target% -c lib/dllcrt1.c 11 | .\tcc %target% -c lib/dllmain.c 12 | .\tcc %target% -c lib/chkstk.S 13 | .\tcc %target% -c lib/alloca86.S 14 | .\tcc %target% -c lib/alloca86-bt.S 15 | .\tcc %target% -c lib/bcheck.c 16 | tiny_libmaker lib/libtcc1.a libtcc1.o alloca86.o alloca86-bt.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o bcheck.o -------------------------------------------------------------------------------- /tcc/bin/include/_mingw.h: -------------------------------------------------------------------------------- 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 28 | #include 29 | 30 | #define __int8 char 31 | #define __int16 short 32 | #define __int32 int 33 | #define __int64 long long 34 | 35 | #define __cdecl __attribute__((__cdecl__)) 36 | #define __declspec(x) __attribute__((x)) 37 | #define __unaligned __attribute__((packed)) 38 | #define __fastcall __attribute__((fastcall)) 39 | 40 | #define __MSVCRT__ 1 41 | #undef _MSVCRT_ 42 | #define __MINGW_IMPORT extern __declspec(dllimport) 43 | #define __MINGW_ATTRIB_NORETURN 44 | #define __MINGW_ATTRIB_CONST 45 | #define __MINGW_ATTRIB_DEPRECATED 46 | #define __MINGW_ATTRIB_MALLOC 47 | #define __MINGW_ATTRIB_PURE 48 | #define __MINGW_ATTRIB_NONNULL(arg) 49 | #define __MINGW_NOTHROW 50 | #define __GNUC_VA_LIST 51 | 52 | #define _CRTIMP extern 53 | #define __CRT_INLINE extern __inline__ 54 | 55 | #define _CRT_ALIGN(x) __attribute__((aligned(x))) 56 | #define DECLSPEC_ALIGN(x) __attribute__((aligned(x))) 57 | #define _CRT_PACKING 8 58 | #define __CRT_UNALIGNED 59 | #define _CONST_RETURN 60 | 61 | #define __CRT_STRINGIZE(_Value) #_Value 62 | #define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value) 63 | #define __CRT_WIDE(_String) L ## _String 64 | #define _CRT_WIDE(_String) __CRT_WIDE(_String) 65 | 66 | #ifdef _WIN64 67 | #define __stdcall 68 | #define _AMD64_ 1 69 | #define __x86_64 1 70 | #define USE_MINGW_SETJMP_TWO_ARGS 71 | #define mingw_getsp tinyc_getbp 72 | #define __TRY__ 73 | #else 74 | #define __stdcall __attribute__((__stdcall__)) 75 | #define _X86_ 1 76 | #define WIN32 1 77 | #define _USE_32BIT_TIME_T 78 | #define __TRY__ void __try__(void**), *_sehrec[6]; __try__(_sehrec); 79 | #endif 80 | 81 | /* in stddef.h */ 82 | #define _SIZE_T_DEFINED 83 | #define _SSIZE_T_DEFINED 84 | #define _PTRDIFF_T_DEFINED 85 | #define _WCHAR_T_DEFINED 86 | #define _UINTPTR_T_DEFINED 87 | #define _INTPTR_T_DEFINED 88 | 89 | #define _INTEGRAL_MAX_BITS 64 90 | 91 | typedef long __time32_t; 92 | #define _TIME32_T_DEFINED 93 | typedef __int64 __time64_t; 94 | #define _TIME64_T_DEFINED 95 | #ifdef _USE_32BIT_TIME_T 96 | typedef __time32_t time_t; 97 | #define _TIME_T_DEFINED 98 | #else 99 | typedef __time64_t time_t; 100 | #define _TIME_T_DEFINED 101 | #endif 102 | 103 | typedef unsigned long size_t; 104 | #define _SIZE_T_DEFINED 105 | typedef long ssize_t; 106 | #define _SSIZE_T_DEFINED 107 | 108 | typedef unsigned int wint_t; 109 | typedef unsigned short wctype_t; 110 | #define _WCTYPE_T_DEFINED 111 | typedef unsigned short wchar_t; 112 | #define _WCHAR_T_DEFINED 113 | 114 | typedef int errno_t; 115 | #define _ERRCODE_DEFINED 116 | 117 | typedef struct threadlocaleinfostruct *pthreadlocinfo; 118 | typedef struct threadmbcinfostruct *pthreadmbcinfo; 119 | typedef struct localeinfo_struct _locale_tstruct,*_locale_t; 120 | 121 | /* for winapi */ 122 | #define _ANONYMOUS_UNION 123 | #define _ANONYMOUS_STRUCT 124 | #define DECLSPEC_NORETURN 125 | #define DECLARE_STDCALL_P(type) __stdcall type 126 | #define NOSERVICE 1 127 | #define NOMCX 1 128 | #define NOIME 1 129 | #ifndef WIN32_LEAN_AND_MEAN 130 | # define WIN32_LEAN_AND_MEAN 1 131 | #endif 132 | #ifndef WINVER 133 | # define WINVER 0x0502 134 | #endif 135 | #ifndef _WIN32_WINNT 136 | # define _WIN32_WINNT 0x502 137 | #endif 138 | 139 | #endif /* __MINGW_H */ 140 | -------------------------------------------------------------------------------- /tcc/bin/include/assert.h: -------------------------------------------------------------------------------- 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 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 | extern void __cdecl _wassert(const wchar_t *_Message,const wchar_t *_File,unsigned _Line); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #ifndef assert 49 | #define assert(_Expression) (void)((!!(_Expression)) || (_wassert(_CRT_WIDE(#_Expression),_CRT_WIDE(__FILE__),__LINE__),0)) 50 | #endif 51 | 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /tcc/bin/include/dir.h: -------------------------------------------------------------------------------- 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 | /* 7 | * dir.h 8 | * 9 | * This file OBSOLESCENT and only provided for backward compatibility. 10 | * Please use io.h instead. 11 | * 12 | * This file is part of the Mingw32 package. 13 | * 14 | * Contributors: 15 | * Created by Colin Peters 16 | * Mumit Khan 17 | * 18 | * THIS SOFTWARE IS NOT COPYRIGHTED 19 | * 20 | * This source code is offered for use in the public domain. You may 21 | * use, modify or distribute it freely. 22 | * 23 | * This code is distributed in the hope that it will be useful but 24 | * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 25 | * DISCLAIMED. This includes but is not limited to warranties of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 27 | * 28 | */ 29 | 30 | #include 31 | 32 | -------------------------------------------------------------------------------- /tcc/bin/include/direct.h: -------------------------------------------------------------------------------- 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 _INC_DIRECT 7 | #define _INC_DIRECT 8 | 9 | #include <_mingw.h> 10 | #include 11 | 12 | #pragma pack(push,_CRT_PACKING) 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef _DISKFREE_T_DEFINED 19 | #define _DISKFREE_T_DEFINED 20 | struct _diskfree_t { 21 | unsigned total_clusters; 22 | unsigned avail_clusters; 23 | unsigned sectors_per_cluster; 24 | unsigned bytes_per_sector; 25 | }; 26 | #endif 27 | 28 | _CRTIMP char *__cdecl _getcwd(char *_DstBuf,int _SizeInBytes); 29 | _CRTIMP char *__cdecl _getdcwd(int _Drive,char *_DstBuf,int _SizeInBytes); 30 | char *__cdecl _getdcwd_nolock(int _Drive,char *_DstBuf,int _SizeInBytes); 31 | _CRTIMP int __cdecl _chdir(const char *_Path); 32 | _CRTIMP int __cdecl _mkdir(const char *_Path); 33 | _CRTIMP int __cdecl _rmdir(const char *_Path); 34 | _CRTIMP int __cdecl _chdrive(int _Drive); 35 | _CRTIMP int __cdecl _getdrive(void); 36 | _CRTIMP unsigned long __cdecl _getdrives(void); 37 | 38 | #ifndef _GETDISKFREE_DEFINED 39 | #define _GETDISKFREE_DEFINED 40 | _CRTIMP unsigned __cdecl _getdiskfree(unsigned _Drive,struct _diskfree_t *_DiskFree); 41 | #endif 42 | 43 | #ifndef _WDIRECT_DEFINED 44 | #define _WDIRECT_DEFINED 45 | _CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords); 46 | _CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int _SizeInWords); 47 | wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int _SizeInWords); 48 | _CRTIMP int __cdecl _wchdir(const wchar_t *_Path); 49 | _CRTIMP int __cdecl _wmkdir(const wchar_t *_Path); 50 | _CRTIMP int __cdecl _wrmdir(const wchar_t *_Path); 51 | #endif 52 | 53 | #ifndef NO_OLDNAMES 54 | 55 | #define diskfree_t _diskfree_t 56 | 57 | char *__cdecl getcwd(char *_DstBuf,int _SizeInBytes); 58 | int __cdecl chdir(const char *_Path); 59 | int __cdecl mkdir(const char *_Path); 60 | int __cdecl rmdir(const char *_Path); 61 | #endif 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #pragma pack(pop) 68 | #endif 69 | -------------------------------------------------------------------------------- /tcc/bin/include/dirent.h: -------------------------------------------------------------------------------- 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 | /* All the headers include this file. */ 7 | #include <_mingw.h> 8 | 9 | #ifndef __STRICT_ANSI__ 10 | 11 | #ifndef _DIRENT_H_ 12 | #define _DIRENT_H_ 13 | 14 | 15 | #pragma pack(push,_CRT_PACKING) 16 | 17 | #include 18 | 19 | #ifndef RC_INVOKED 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | struct dirent 26 | { 27 | long d_ino; /* Always zero. */ 28 | unsigned short d_reclen; /* Always zero. */ 29 | unsigned short d_namlen; /* Length of name in d_name. */ 30 | char* d_name; /* File name. */ 31 | /* NOTE: The name in the dirent structure points to the name in the 32 | * finddata_t structure in the DIR. */ 33 | }; 34 | 35 | /* 36 | * This is an internal data structure. Good programmers will not use it 37 | * except as an argument to one of the functions below. 38 | * dd_stat field is now int (was short in older versions). 39 | */ 40 | typedef struct 41 | { 42 | /* disk transfer area for this dir */ 43 | struct _finddata_t dd_dta; 44 | 45 | /* dirent struct to return from dir (NOTE: this makes this thread 46 | * safe as long as only one thread uses a particular DIR struct at 47 | * a time) */ 48 | struct dirent dd_dir; 49 | 50 | /* _findnext handle */ 51 | long dd_handle; 52 | 53 | /* 54 | * Status of search: 55 | * 0 = not started yet (next entry to read is first entry) 56 | * -1 = off the end 57 | * positive = 0 based index of next entry 58 | */ 59 | int dd_stat; 60 | 61 | /* given path for dir with search pattern (struct is extended) */ 62 | char dd_name[1]; 63 | } DIR; 64 | 65 | DIR* __cdecl opendir (const char*); 66 | struct dirent* __cdecl readdir (DIR*); 67 | int __cdecl closedir (DIR*); 68 | void __cdecl rewinddir (DIR*); 69 | long __cdecl telldir (DIR*); 70 | void __cdecl seekdir (DIR*, long); 71 | 72 | 73 | /* wide char versions */ 74 | 75 | struct _wdirent 76 | { 77 | long d_ino; /* Always zero. */ 78 | unsigned short d_reclen; /* Always zero. */ 79 | unsigned short d_namlen; /* Length of name in d_name. */ 80 | wchar_t* d_name; /* File name. */ 81 | /* NOTE: The name in the dirent structure points to the name in the * wfinddata_t structure in the _WDIR. */ 82 | }; 83 | 84 | /* 85 | * This is an internal data structure. Good programmers will not use it 86 | * except as an argument to one of the functions below. 87 | */ 88 | typedef struct 89 | { 90 | /* disk transfer area for this dir */ 91 | struct _wfinddata_t dd_dta; 92 | 93 | /* dirent struct to return from dir (NOTE: this makes this thread 94 | * safe as long as only one thread uses a particular DIR struct at 95 | * a time) */ 96 | struct _wdirent dd_dir; 97 | 98 | /* _findnext handle */ 99 | long dd_handle; 100 | 101 | /* 102 | * Status of search: 103 | * 0 = not started yet (next entry to read is first entry) 104 | * -1 = off the end 105 | * positive = 0 based index of next entry 106 | */ 107 | int dd_stat; 108 | 109 | /* given path for dir with search pattern (struct is extended) */ 110 | wchar_t dd_name[1]; 111 | } _WDIR; 112 | 113 | 114 | 115 | _WDIR* __cdecl _wopendir (const wchar_t*); 116 | struct _wdirent* __cdecl _wreaddir (_WDIR*); 117 | int __cdecl _wclosedir (_WDIR*); 118 | void __cdecl _wrewinddir (_WDIR*); 119 | long __cdecl _wtelldir (_WDIR*); 120 | void __cdecl _wseekdir (_WDIR*, long); 121 | 122 | 123 | #ifdef __cplusplus 124 | } 125 | #endif 126 | 127 | #endif /* Not RC_INVOKED */ 128 | 129 | #pragma pack(pop) 130 | 131 | #endif /* Not _DIRENT_H_ */ 132 | 133 | 134 | #endif /* Not __STRICT_ANSI__ */ 135 | 136 | -------------------------------------------------------------------------------- /tcc/bin/include/dos.h: -------------------------------------------------------------------------------- 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 _INC_DOS 7 | #define _INC_DOS 8 | 9 | #include <_mingw.h> 10 | #include 11 | 12 | #pragma pack(push,_CRT_PACKING) 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef _DISKFREE_T_DEFINED 19 | #define _DISKFREE_T_DEFINED 20 | 21 | struct _diskfree_t { 22 | unsigned total_clusters; 23 | unsigned avail_clusters; 24 | unsigned sectors_per_cluster; 25 | unsigned bytes_per_sector; 26 | }; 27 | #endif 28 | 29 | #define _A_NORMAL 0x00 30 | #define _A_RDONLY 0x01 31 | #define _A_HIDDEN 0x02 32 | #define _A_SYSTEM 0x04 33 | #define _A_SUBDIR 0x10 34 | #define _A_ARCH 0x20 35 | 36 | #ifndef _GETDISKFREE_DEFINED 37 | #define _GETDISKFREE_DEFINED 38 | _CRTIMP unsigned __cdecl _getdiskfree(unsigned _Drive,struct _diskfree_t *_DiskFree); 39 | #endif 40 | 41 | #if (defined(_X86_) && !defined(__x86_64)) 42 | void __cdecl _disable(void); 43 | void __cdecl _enable(void); 44 | #endif 45 | 46 | #ifndef NO_OLDNAMES 47 | #define diskfree_t _diskfree_t 48 | #endif 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #pragma pack(pop) 55 | #endif 56 | -------------------------------------------------------------------------------- /tcc/bin/include/errno.h: -------------------------------------------------------------------------------- 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 _INC_ERRNO 7 | #define _INC_ERRNO 8 | 9 | #include <_mingw.h> 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #ifndef _CRT_ERRNO_DEFINED 16 | #define _CRT_ERRNO_DEFINED 17 | _CRTIMP extern int *__cdecl _errno(void); 18 | #define errno (*_errno()) 19 | 20 | errno_t __cdecl _set_errno(int _Value); 21 | errno_t __cdecl _get_errno(int *_Value); 22 | #endif 23 | 24 | #define EPERM 1 25 | #define ENOENT 2 26 | #define ESRCH 3 27 | #define EINTR 4 28 | #define EIO 5 29 | #define ENXIO 6 30 | #define E2BIG 7 31 | #define ENOEXEC 8 32 | #define EBADF 9 33 | #define ECHILD 10 34 | #define EAGAIN 11 35 | #define ENOMEM 12 36 | #define EACCES 13 37 | #define EFAULT 14 38 | #define EBUSY 16 39 | #define EEXIST 17 40 | #define EXDEV 18 41 | #define ENODEV 19 42 | #define ENOTDIR 20 43 | #define EISDIR 21 44 | #define ENFILE 23 45 | #define EMFILE 24 46 | #define ENOTTY 25 47 | #define EFBIG 27 48 | #define ENOSPC 28 49 | #define ESPIPE 29 50 | #define EROFS 30 51 | #define EMLINK 31 52 | #define EPIPE 32 53 | #define EDOM 33 54 | #define EDEADLK 36 55 | #define ENAMETOOLONG 38 56 | #define ENOLCK 39 57 | #define ENOSYS 40 58 | #define ENOTEMPTY 41 59 | 60 | #ifndef RC_INVOKED 61 | #if !defined(_SECURECRT_ERRCODE_VALUES_DEFINED) 62 | #define _SECURECRT_ERRCODE_VALUES_DEFINED 63 | #define EINVAL 22 64 | #define ERANGE 34 65 | #define EILSEQ 42 66 | #define STRUNCATE 80 67 | #endif 68 | #endif 69 | 70 | #define EDEADLOCK EDEADLK 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | #endif 76 | -------------------------------------------------------------------------------- /tcc/bin/include/excpt.h: -------------------------------------------------------------------------------- 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 _INC_EXCPT 7 | #define _INC_EXCPT 8 | 9 | #include <_mingw.h> 10 | 11 | #pragma pack(push,_CRT_PACKING) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | struct _EXCEPTION_POINTERS; 18 | 19 | #ifndef EXCEPTION_DISPOSITION 20 | #define EXCEPTION_DISPOSITION int 21 | #endif 22 | #define ExceptionContinueExecution 0 23 | #define ExceptionContinueSearch 1 24 | #define ExceptionNestedException 2 25 | #define ExceptionCollidedUnwind 3 26 | 27 | #if (defined(_X86_) && !defined(__x86_64)) 28 | struct _EXCEPTION_RECORD; 29 | struct _CONTEXT; 30 | 31 | EXCEPTION_DISPOSITION __cdecl _except_handler(struct _EXCEPTION_RECORD *_ExceptionRecord,void *_EstablisherFrame,struct _CONTEXT *_ContextRecord,void *_DispatcherContext); 32 | #elif defined(__ia64__) 33 | 34 | typedef struct _EXCEPTION_POINTERS *Exception_info_ptr; 35 | struct _EXCEPTION_RECORD; 36 | struct _CONTEXT; 37 | struct _DISPATCHER_CONTEXT; 38 | 39 | _CRTIMP EXCEPTION_DISPOSITION __cdecl __C_specific_handler (struct _EXCEPTION_RECORD *_ExceptionRecord,unsigned __int64 _MemoryStackFp,unsigned __int64 _BackingStoreFp,struct _CONTEXT *_ContextRecord,struct _DISPATCHER_CONTEXT *_DispatcherContext,unsigned __int64 _GlobalPointer); 40 | #elif defined(__x86_64) 41 | 42 | struct _EXCEPTION_RECORD; 43 | struct _CONTEXT; 44 | #endif 45 | 46 | #define GetExceptionCode _exception_code 47 | #define exception_code _exception_code 48 | #define GetExceptionInformation (struct _EXCEPTION_POINTERS *)_exception_info 49 | #define exception_info (struct _EXCEPTION_POINTERS *)_exception_info 50 | #define AbnormalTermination _abnormal_termination 51 | #define abnormal_termination _abnormal_termination 52 | 53 | unsigned long __cdecl _exception_code(void); 54 | void *__cdecl _exception_info(void); 55 | int __cdecl _abnormal_termination(void); 56 | 57 | #define EXCEPTION_EXECUTE_HANDLER 1 58 | #define EXCEPTION_CONTINUE_SEARCH 0 59 | #define EXCEPTION_CONTINUE_EXECUTION -1 60 | 61 | /* CRT stuff */ 62 | typedef void (__cdecl * _PHNDLR)(int); 63 | 64 | struct _XCPT_ACTION { 65 | unsigned long XcptNum; 66 | int SigNum; 67 | _PHNDLR XcptAction; 68 | }; 69 | 70 | extern struct _XCPT_ACTION _XcptActTab[]; 71 | extern int _XcptActTabCount; 72 | extern int _XcptActTabSize; 73 | extern int _First_FPE_Indx; 74 | extern int _Num_FPE; 75 | 76 | int __cdecl __CppXcptFilter(unsigned long _ExceptionNum,struct _EXCEPTION_POINTERS * _ExceptionPtr); 77 | int __cdecl _XcptFilter(unsigned long _ExceptionNum,struct _EXCEPTION_POINTERS * _ExceptionPtr); 78 | 79 | /* 80 | * The type of function that is expected as an exception handler to be 81 | * installed with _try1. 82 | */ 83 | typedef EXCEPTION_DISPOSITION (*PEXCEPTION_HANDLER)(struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*); 84 | 85 | #ifndef HAVE_NO_SEH 86 | /* 87 | * This is not entirely necessary, but it is the structure installed by 88 | * the _try1 primitive below. 89 | */ 90 | typedef struct _EXCEPTION_REGISTRATION { 91 | struct _EXCEPTION_REGISTRATION *prev; 92 | EXCEPTION_DISPOSITION (*handler)(struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*); 93 | } EXCEPTION_REGISTRATION, *PEXCEPTION_REGISTRATION; 94 | 95 | typedef EXCEPTION_REGISTRATION EXCEPTION_REGISTRATION_RECORD; 96 | typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD; 97 | #endif 98 | 99 | #if (defined(_X86_) && !defined(__x86_64)) 100 | #define __try1(pHandler) \ 101 | __asm__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : "g" (pHandler)); 102 | 103 | #define __except1 \ 104 | __asm__ ("movl (%%esp),%%eax;movl %%eax,%%fs:0;addl $8,%%esp;" \ 105 | : : : "%eax"); 106 | #elif defined(__x86_64) 107 | #define __try1(pHandler) \ 108 | __asm__ ("pushq %0;pushq %%gs:0;movq %%rsp,%%gs:0;" : : "g" (pHandler)); 109 | 110 | #define __except1 \ 111 | __asm__ ("movq (%%rsp),%%rax;movq %%rax,%%gs:0;addq $16,%%rsp;" \ 112 | : : : "%rax"); 113 | #else 114 | #define __try1(pHandler) 115 | #define __except1 116 | #endif 117 | 118 | #ifdef __cplusplus 119 | } 120 | #endif 121 | 122 | #pragma pack(pop) 123 | #endif 124 | -------------------------------------------------------------------------------- /tcc/bin/include/fcntl.h: -------------------------------------------------------------------------------- 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 | #include <_mingw.h> 7 | 8 | #include 9 | 10 | #ifndef _INC_FCNTL 11 | #define _INC_FCNTL 12 | 13 | #define _O_RDONLY 0x0000 14 | #define _O_WRONLY 0x0001 15 | #define _O_RDWR 0x0002 16 | #define _O_APPEND 0x0008 17 | #define _O_CREAT 0x0100 18 | #define _O_TRUNC 0x0200 19 | #define _O_EXCL 0x0400 20 | #define _O_TEXT 0x4000 21 | #define _O_BINARY 0x8000 22 | #define _O_WTEXT 0x10000 23 | #define _O_U16TEXT 0x20000 24 | #define _O_U8TEXT 0x40000 25 | #define _O_ACCMODE (_O_RDONLY|_O_WRONLY|_O_RDWR) 26 | 27 | #define _O_RAW _O_BINARY 28 | #define _O_NOINHERIT 0x0080 29 | #define _O_TEMPORARY 0x0040 30 | #define _O_SHORT_LIVED 0x1000 31 | 32 | #define _O_SEQUENTIAL 0x0020 33 | #define _O_RANDOM 0x0010 34 | 35 | #if !defined(NO_OLDNAMES) || defined(_POSIX) 36 | #define O_RDONLY _O_RDONLY 37 | #define O_WRONLY _O_WRONLY 38 | #define O_RDWR _O_RDWR 39 | #define O_APPEND _O_APPEND 40 | #define O_CREAT _O_CREAT 41 | #define O_TRUNC _O_TRUNC 42 | #define O_EXCL _O_EXCL 43 | #define O_TEXT _O_TEXT 44 | #define O_BINARY _O_BINARY 45 | #define O_RAW _O_BINARY 46 | #define O_TEMPORARY _O_TEMPORARY 47 | #define O_NOINHERIT _O_NOINHERIT 48 | #define O_SEQUENTIAL _O_SEQUENTIAL 49 | #define O_RANDOM _O_RANDOM 50 | #define O_ACCMODE _O_ACCMODE 51 | #endif 52 | #endif 53 | -------------------------------------------------------------------------------- /tcc/bin/include/fenv.h: -------------------------------------------------------------------------------- 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 _FENV_H_ 7 | #define _FENV_H_ 8 | 9 | #include <_mingw.h> 10 | 11 | /* FPU status word exception flags */ 12 | #define FE_INVALID 0x01 13 | #define FE_DENORMAL 0x02 14 | #define FE_DIVBYZERO 0x04 15 | #define FE_OVERFLOW 0x08 16 | #define FE_UNDERFLOW 0x10 17 | #define FE_INEXACT 0x20 18 | #define FE_ALL_EXCEPT (FE_INVALID | FE_DENORMAL | FE_DIVBYZERO \ 19 | | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT) 20 | 21 | /* FPU control word rounding flags */ 22 | #define FE_TONEAREST 0x0000 23 | #define FE_DOWNWARD 0x0400 24 | #define FE_UPWARD 0x0800 25 | #define FE_TOWARDZERO 0x0c00 26 | 27 | /* The MXCSR exception flags are the same as the 28 | FE flags. */ 29 | #define __MXCSR_EXCEPT_FLAG_SHIFT 0 30 | 31 | /* How much to shift FE status word exception flags 32 | to get MXCSR rounding flags, */ 33 | #define __MXCSR_ROUND_FLAG_SHIFT 3 34 | 35 | #ifndef RC_INVOKED 36 | /* 37 | For now, support only for the basic abstraction of flags that are 38 | either set or clear. fexcept_t could be structure that holds more 39 | info about the fp environment. 40 | */ 41 | typedef unsigned short fexcept_t; 42 | 43 | /* This 32-byte struct represents the entire floating point 44 | environment as stored by fnstenv or fstenv, augmented by 45 | the contents of the MXCSR register, as stored by stmxcsr 46 | (if CPU supports it). */ 47 | typedef struct 48 | { 49 | unsigned short __control_word; 50 | unsigned short __unused0; 51 | unsigned short __status_word; 52 | unsigned short __unused1; 53 | unsigned short __tag_word; 54 | unsigned short __unused2; 55 | unsigned int __ip_offset; /* instruction pointer offset */ 56 | unsigned short __ip_selector; 57 | unsigned short __opcode; 58 | unsigned int __data_offset; 59 | unsigned short __data_selector; 60 | unsigned short __unused3; 61 | unsigned int __mxcsr; /* contents of the MXCSR register */ 62 | } fenv_t; 63 | 64 | 65 | /*The C99 standard (7.6.9) allows us to define implementation-specific macros for 66 | different fp environments */ 67 | 68 | /* The default Intel x87 floating point environment (64-bit mantissa) */ 69 | #define FE_PC64_ENV ((const fenv_t *)-1) 70 | 71 | /* The floating point environment set by MSVCRT _fpreset (53-bit mantissa) */ 72 | #define FE_PC53_ENV ((const fenv_t *)-2) 73 | 74 | /* The FE_DFL_ENV macro is required by standard. 75 | fesetenv will use the environment set at app startup.*/ 76 | #define FE_DFL_ENV ((const fenv_t *) 0) 77 | 78 | #ifdef __cplusplus 79 | extern "C" { 80 | #endif 81 | 82 | /*TODO: Some of these could be inlined */ 83 | /* 7.6.2 Exception */ 84 | 85 | extern int __cdecl feclearexcept (int); 86 | extern int __cdecl fegetexceptflag (fexcept_t * flagp, int excepts); 87 | extern int __cdecl feraiseexcept (int excepts ); 88 | extern int __cdecl fesetexceptflag (const fexcept_t *, int); 89 | extern int __cdecl fetestexcept (int excepts); 90 | 91 | /* 7.6.3 Rounding */ 92 | 93 | extern int __cdecl fegetround (void); 94 | extern int __cdecl fesetround (int mode); 95 | 96 | /* 7.6.4 Environment */ 97 | 98 | extern int __cdecl fegetenv(fenv_t * envp); 99 | extern int __cdecl fesetenv(const fenv_t * ); 100 | extern int __cdecl feupdateenv(const fenv_t *); 101 | extern int __cdecl feholdexcept(fenv_t *); 102 | 103 | #ifdef __cplusplus 104 | } 105 | #endif 106 | #endif /* Not RC_INVOKED */ 107 | 108 | #endif /* ndef _FENV_H */ 109 | -------------------------------------------------------------------------------- /tcc/bin/include/float.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLOAT_H_ 2 | #define _FLOAT_H_ 3 | 4 | #define FLT_RADIX 2 5 | 6 | /* IEEE float */ 7 | #define FLT_MANT_DIG 24 8 | #define FLT_DIG 6 9 | #define FLT_ROUNDS 1 10 | #define FLT_EPSILON 1.19209290e-07F 11 | #define FLT_MIN_EXP (-125) 12 | #define FLT_MIN 1.17549435e-38F 13 | #define FLT_MIN_10_EXP (-37) 14 | #define FLT_MAX_EXP 128 15 | #define FLT_MAX 3.40282347e+38F 16 | #define FLT_MAX_10_EXP 38 17 | 18 | /* IEEE double */ 19 | #define DBL_MANT_DIG 53 20 | #define DBL_DIG 15 21 | #define DBL_EPSILON 2.2204460492503131e-16 22 | #define DBL_MIN_EXP (-1021) 23 | #define DBL_MIN 2.2250738585072014e-308 24 | #define DBL_MIN_10_EXP (-307) 25 | #define DBL_MAX_EXP 1024 26 | #define DBL_MAX 1.7976931348623157e+308 27 | #define DBL_MAX_10_EXP 308 28 | 29 | /* horrible intel long double */ 30 | #ifdef __i386__ 31 | 32 | #define LDBL_MANT_DIG 64 33 | #define LDBL_DIG 18 34 | #define LDBL_EPSILON 1.08420217248550443401e-19L 35 | #define LDBL_MIN_EXP (-16381) 36 | #define LDBL_MIN 3.36210314311209350626e-4932L 37 | #define LDBL_MIN_10_EXP (-4931) 38 | #define LDBL_MAX_EXP 16384 39 | #define LDBL_MAX 1.18973149535723176502e+4932L 40 | #define LDBL_MAX_10_EXP 4932 41 | 42 | #else 43 | 44 | /* same as IEEE double */ 45 | #define LDBL_MANT_DIG 53 46 | #define LDBL_DIG 15 47 | #define LDBL_EPSILON 2.2204460492503131e-16 48 | #define LDBL_MIN_EXP (-1021) 49 | #define LDBL_MIN 2.2250738585072014e-308 50 | #define LDBL_MIN_10_EXP (-307) 51 | #define LDBL_MAX_EXP 1024 52 | #define LDBL_MAX 1.7976931348623157e+308 53 | #define LDBL_MAX_10_EXP 308 54 | 55 | #endif 56 | 57 | #endif /* _FLOAT_H_ */ 58 | -------------------------------------------------------------------------------- /tcc/bin/include/limits.h: -------------------------------------------------------------------------------- 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 | #include <_mingw.h> 7 | 8 | #ifndef _INC_LIMITS 9 | #define _INC_LIMITS 10 | 11 | /* 12 | * File system limits 13 | * 14 | * TODO: NAME_MAX and OPEN_MAX are file system limits or not? Are they the 15 | * same as FILENAME_MAX and FOPEN_MAX from stdio.h? 16 | * NOTE: Apparently the actual size of PATH_MAX is 260, but a space is 17 | * required for the NUL. TODO: Test? 18 | */ 19 | #define PATH_MAX (259) 20 | 21 | #define CHAR_BIT 8 22 | #define SCHAR_MIN (-128) 23 | #define SCHAR_MAX 127 24 | #define UCHAR_MAX 0xff 25 | 26 | #define CHAR_MIN SCHAR_MIN 27 | #define CHAR_MAX SCHAR_MAX 28 | 29 | #define MB_LEN_MAX 5 30 | #define SHRT_MIN (-32768) 31 | #define SHRT_MAX 32767 32 | #define USHRT_MAX 0xffff 33 | #define INT_MIN (-2147483647 - 1) 34 | #define INT_MAX 2147483647 35 | #define UINT_MAX 0xffffffff 36 | #define LONG_MIN (-2147483647L - 1) 37 | #define LONG_MAX 2147483647L 38 | #define ULONG_MAX 0xffffffffUL 39 | #define LLONG_MAX 9223372036854775807ll 40 | #define LLONG_MIN (-9223372036854775807ll - 1) 41 | #define ULLONG_MAX 0xffffffffffffffffull 42 | 43 | #if _INTEGRAL_MAX_BITS >= 8 44 | #define _I8_MIN (-127 - 1) 45 | #define _I8_MAX 127i8 46 | #define _UI8_MAX 0xffu 47 | #endif 48 | 49 | #if _INTEGRAL_MAX_BITS >= 16 50 | #define _I16_MIN (-32767 - 1) 51 | #define _I16_MAX 32767i16 52 | #define _UI16_MAX 0xffffu 53 | #endif 54 | 55 | #if _INTEGRAL_MAX_BITS >= 32 56 | #define _I32_MIN (-2147483647 - 1) 57 | #define _I32_MAX 2147483647 58 | #define _UI32_MAX 0xffffffffu 59 | #endif 60 | 61 | #if defined(__GNUC__) 62 | #undef LONG_LONG_MAX 63 | #define LONG_LONG_MAX 9223372036854775807ll 64 | #undef LONG_LONG_MIN 65 | #define LONG_LONG_MIN (-LONG_LONG_MAX-1) 66 | #undef ULONG_LONG_MAX 67 | #define ULONG_LONG_MAX (2ull * LONG_LONG_MAX + 1ull) 68 | #endif 69 | 70 | #if _INTEGRAL_MAX_BITS >= 64 71 | #define _I64_MIN (-9223372036854775807ll - 1) 72 | #define _I64_MAX 9223372036854775807ll 73 | #define _UI64_MAX 0xffffffffffffffffull 74 | #endif 75 | 76 | #ifndef SIZE_MAX 77 | #ifdef _WIN64 78 | #define SIZE_MAX _UI64_MAX 79 | #else 80 | #define SIZE_MAX UINT_MAX 81 | #endif 82 | #endif 83 | 84 | #ifdef _POSIX_ 85 | #define _POSIX_ARG_MAX 4096 86 | #define _POSIX_CHILD_MAX 6 87 | #define _POSIX_LINK_MAX 8 88 | #define _POSIX_MAX_CANON 255 89 | #define _POSIX_MAX_INPUT 255 90 | #define _POSIX_NAME_MAX 14 91 | #define _POSIX_NGROUPS_MAX 0 92 | #define _POSIX_OPEN_MAX 16 93 | #define _POSIX_PATH_MAX 255 94 | #define _POSIX_PIPE_BUF 512 95 | #define _POSIX_SSIZE_MAX 32767 96 | #define _POSIX_STREAM_MAX 8 97 | #define _POSIX_TZNAME_MAX 3 98 | #define ARG_MAX 14500 99 | #define LINK_MAX 1024 100 | #define MAX_CANON _POSIX_MAX_CANON 101 | #define MAX_INPUT _POSIX_MAX_INPUT 102 | #define NAME_MAX 255 103 | #define NGROUPS_MAX 16 104 | #define OPEN_MAX 32 105 | #define PATH_MAX 512 106 | #define PIPE_BUF _POSIX_PIPE_BUF 107 | #define SSIZE_MAX _POSIX_SSIZE_MAX 108 | #define STREAM_MAX 20 109 | #define TZNAME_MAX 10 110 | #endif 111 | #endif 112 | -------------------------------------------------------------------------------- /tcc/bin/include/locale.h: -------------------------------------------------------------------------------- 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 _INC_LOCALE 7 | #define _INC_LOCALE 8 | 9 | #include <_mingw.h> 10 | 11 | #pragma pack(push,_CRT_PACKING) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | #ifndef NULL 18 | #ifdef __cplusplus 19 | #define NULL 0 20 | #else 21 | #define NULL ((void *)0) 22 | #endif 23 | #endif 24 | 25 | #define LC_ALL 0 26 | #define LC_COLLATE 1 27 | #define LC_CTYPE 2 28 | #define LC_MONETARY 3 29 | #define LC_NUMERIC 4 30 | #define LC_TIME 5 31 | 32 | #define LC_MIN LC_ALL 33 | #define LC_MAX LC_TIME 34 | 35 | #ifndef _LCONV_DEFINED 36 | #define _LCONV_DEFINED 37 | struct lconv { 38 | char *decimal_point; 39 | char *thousands_sep; 40 | char *grouping; 41 | char *int_curr_symbol; 42 | char *currency_symbol; 43 | char *mon_decimal_point; 44 | char *mon_thousands_sep; 45 | char *mon_grouping; 46 | char *positive_sign; 47 | char *negative_sign; 48 | char int_frac_digits; 49 | char frac_digits; 50 | char p_cs_precedes; 51 | char p_sep_by_space; 52 | char n_cs_precedes; 53 | char n_sep_by_space; 54 | char p_sign_posn; 55 | char n_sign_posn; 56 | }; 57 | #endif 58 | 59 | #ifndef _CONFIG_LOCALE_SWT 60 | #define _CONFIG_LOCALE_SWT 61 | 62 | #define _ENABLE_PER_THREAD_LOCALE 0x1 63 | #define _DISABLE_PER_THREAD_LOCALE 0x2 64 | #define _ENABLE_PER_THREAD_LOCALE_GLOBAL 0x10 65 | #define _DISABLE_PER_THREAD_LOCALE_GLOBAL 0x20 66 | #define _ENABLE_PER_THREAD_LOCALE_NEW 0x100 67 | #define _DISABLE_PER_THREAD_LOCALE_NEW 0x200 68 | 69 | #endif 70 | 71 | int __cdecl _configthreadlocale(int _Flag); 72 | char *__cdecl setlocale(int _Category,const char *_Locale); 73 | _CRTIMP struct lconv *__cdecl localeconv(void); 74 | _locale_t __cdecl _get_current_locale(void); 75 | _locale_t __cdecl _create_locale(int _Category,const char *_Locale); 76 | void __cdecl _free_locale(_locale_t _Locale); 77 | _locale_t __cdecl __get_current_locale(void); 78 | _locale_t __cdecl __create_locale(int _Category,const char *_Locale); 79 | void __cdecl __free_locale(_locale_t _Locale); 80 | 81 | #ifndef _WLOCALE_DEFINED 82 | #define _WLOCALE_DEFINED 83 | _CRTIMP wchar_t *__cdecl _wsetlocale(int _Category,const wchar_t *_Locale); 84 | #endif 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #pragma pack(pop) 91 | #endif 92 | -------------------------------------------------------------------------------- /tcc/bin/include/mem.h: -------------------------------------------------------------------------------- 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 | /* 7 | * This file is part of the Mingw32 package. 8 | * 9 | * mem.h maps to string.h 10 | */ 11 | #ifndef __STRICT_ANSI__ 12 | #include 13 | #endif 14 | -------------------------------------------------------------------------------- /tcc/bin/include/memory.h: -------------------------------------------------------------------------------- 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 _INC_MEMORY 7 | #define _INC_MEMORY 8 | 9 | #include <_mingw.h> 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #ifndef _CONST_RETURN 16 | #define _CONST_RETURN 17 | #endif 18 | 19 | #define _WConst_return _CONST_RETURN 20 | 21 | #ifndef _CRT_MEMORY_DEFINED 22 | #define _CRT_MEMORY_DEFINED 23 | _CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount); 24 | _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount); 25 | _CRTIMP int __cdecl _memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); 26 | _CRTIMP int __cdecl _memicmp_l(const void *_Buf1,const void *_Buf2,size_t _Size,_locale_t _Locale); 27 | int __cdecl memcmp(const void *_Buf1,const void *_Buf2,size_t _Size); 28 | void *__cdecl memcpy(void *_Dst,const void *_Src,size_t _Size); 29 | void *__cdecl memset(void *_Dst,int _Val,size_t _Size); 30 | 31 | #ifndef NO_OLDNAMES 32 | void *__cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size); 33 | int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); 34 | #endif 35 | #endif 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | #endif 41 | -------------------------------------------------------------------------------- /tcc/bin/include/sec_api/conio_s.h: -------------------------------------------------------------------------------- 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 | 7 | #ifndef _INC_CONIO_S 8 | #define _INC_CONIO_S 9 | 10 | #include 11 | 12 | #if defined(MINGW_HAS_SECURE_API) 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | _CRTIMP errno_t __cdecl _cgets_s(char *_Buffer,size_t _Size,size_t *_SizeRead); 19 | _CRTIMP int __cdecl _cprintf_s(const char *_Format,...); 20 | _CRTIMP int __cdecl _cscanf_s(const char *_Format,...); 21 | _CRTIMP int __cdecl _cscanf_s_l(const char *_Format,_locale_t _Locale,...); 22 | _CRTIMP int __cdecl _vcprintf_s(const char *_Format,va_list _ArgList); 23 | _CRTIMP int __cdecl _cprintf_s_l(const char *_Format,_locale_t _Locale,...); 24 | _CRTIMP int __cdecl _vcprintf_s_l(const char *_Format,_locale_t _Locale,va_list _ArgList); 25 | 26 | #ifndef _WCONIO_DEFINED_S 27 | #define _WCONIO_DEFINED_S 28 | _CRTIMP errno_t __cdecl _cgetws_s(wchar_t *_Buffer,size_t _SizeInWords,size_t *_SizeRead); 29 | _CRTIMP int __cdecl _cwprintf_s(const wchar_t *_Format,...); 30 | _CRTIMP int __cdecl _cwscanf_s(const wchar_t *_Format,...); 31 | _CRTIMP int __cdecl _cwscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); 32 | _CRTIMP int __cdecl _vcwprintf_s(const wchar_t *_Format,va_list _ArgList); 33 | _CRTIMP int __cdecl _cwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); 34 | _CRTIMP int __cdecl _vcwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); 35 | #endif 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | #endif 43 | -------------------------------------------------------------------------------- /tcc/bin/include/sec_api/crtdbg_s.h: -------------------------------------------------------------------------------- 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 | 7 | #ifndef _INC_CRTDBG_S 8 | #define _INC_CRTDBG_S 9 | 10 | #include 11 | 12 | #if defined(MINGW_HAS_SECURE_API) 13 | 14 | #define _dupenv_s_dbg(ps1,size,s2,t,f,l) _dupenv_s(ps1,size,s2) 15 | #define _wdupenv_s_dbg(ps1,size,s2,t,f,l) _wdupenv_s(ps1,size,s2) 16 | 17 | #endif 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /tcc/bin/include/sec_api/io_s.h: -------------------------------------------------------------------------------- 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 _INC_IO_S 7 | #define _INC_IO_S 8 | 9 | #include 10 | 11 | #if defined(MINGW_HAS_SECURE_API) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | _CRTIMP errno_t __cdecl _access_s(const char *_Filename,int _AccessMode); 18 | _CRTIMP errno_t __cdecl _chsize_s(int _FileHandle,__int64 _Size); 19 | _CRTIMP errno_t __cdecl _mktemp_s(char *_TemplateName,size_t _Size); 20 | _CRTIMP errno_t __cdecl _umask_s(int _NewMode,int *_OldMode); 21 | 22 | #ifndef _WIO_S_DEFINED 23 | #define _WIO_S_DEFINED 24 | _CRTIMP errno_t __cdecl _waccess_s(const wchar_t *_Filename,int _AccessMode); 25 | _CRTIMP errno_t __cdecl _wmktemp_s(wchar_t *_TemplateName,size_t _SizeInWords); 26 | #endif 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif 33 | #endif 34 | -------------------------------------------------------------------------------- /tcc/bin/include/sec_api/mbstring_s.h: -------------------------------------------------------------------------------- 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 _INC_MBSTRING_S 7 | #define _INC_MBSTRING_S 8 | 9 | #include 10 | 11 | #if defined(MINGW_HAS_SECURE_API) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | #ifndef _MBSTRING_S_DEFINED 18 | #define _MBSTRING_S_DEFINED 19 | _CRTIMP errno_t __cdecl _mbscat_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src); 20 | _CRTIMP errno_t __cdecl _mbscat_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,_locale_t _Locale); 21 | _CRTIMP errno_t __cdecl _mbscpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src); 22 | _CRTIMP errno_t __cdecl _mbscpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,_locale_t _Locale); 23 | _CRTIMP errno_t __cdecl _mbslwr_s(unsigned char *_Str,size_t _SizeInBytes); 24 | _CRTIMP errno_t __cdecl _mbslwr_s_l(unsigned char *_Str,size_t _SizeInBytes,_locale_t _Locale); 25 | _CRTIMP errno_t __cdecl _mbsnbcat_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); 26 | _CRTIMP errno_t __cdecl _mbsnbcat_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); 27 | _CRTIMP errno_t __cdecl _mbsnbcpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); 28 | _CRTIMP errno_t __cdecl _mbsnbcpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); 29 | _CRTIMP errno_t __cdecl _mbsnbset_s(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Ch,size_t _MaxCount); 30 | _CRTIMP errno_t __cdecl _mbsnbset_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Ch,size_t _MaxCount,_locale_t _Locale); 31 | _CRTIMP errno_t __cdecl _mbsncat_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); 32 | _CRTIMP errno_t __cdecl _mbsncat_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); 33 | _CRTIMP errno_t __cdecl _mbsncpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); 34 | _CRTIMP errno_t __cdecl _mbsncpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); 35 | _CRTIMP errno_t __cdecl _mbsnset_s(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val,size_t _MaxCount); 36 | _CRTIMP errno_t __cdecl _mbsnset_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val,size_t _MaxCount,_locale_t _Locale); 37 | _CRTIMP errno_t __cdecl _mbsset_s(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val); 38 | _CRTIMP errno_t __cdecl _mbsset_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val,_locale_t _Locale); 39 | _CRTIMP unsigned char *__cdecl _mbstok_s(unsigned char *_Str,const unsigned char *_Delim,unsigned char **_Context); 40 | _CRTIMP unsigned char *__cdecl _mbstok_s_l(unsigned char *_Str,const unsigned char *_Delim,unsigned char **_Context,_locale_t _Locale); 41 | _CRTIMP errno_t __cdecl _mbsupr_s(unsigned char *_Str,size_t _SizeInBytes); 42 | _CRTIMP errno_t __cdecl _mbsupr_s_l(unsigned char *_Str,size_t _SizeInBytes,_locale_t _Locale); 43 | _CRTIMP errno_t __cdecl _mbccpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,int *_PCopied,const unsigned char *_Src); 44 | _CRTIMP errno_t __cdecl _mbccpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,int *_PCopied,const unsigned char *_Src,_locale_t _Locale); 45 | #endif 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif 52 | #endif 53 | -------------------------------------------------------------------------------- /tcc/bin/include/sec_api/search_s.h: -------------------------------------------------------------------------------- 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 _INC_SEARCH_S 7 | #define _INC_SEARCH_S 8 | 9 | #include 10 | 11 | #if defined(MINGW_HAS_SECURE_API) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | _CRTIMP void *__cdecl _lfind_s(const void *_Key,const void *_Base,unsigned int *_NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(void *,const void *,const void *),void *_Context); 18 | _CRTIMP void *__cdecl _lsearch_s(const void *_Key,void *_Base,unsigned int *_NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(void *,const void *,const void *),void *_Context); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif 25 | #endif 26 | -------------------------------------------------------------------------------- /tcc/bin/include/sec_api/stdlib_s.h: -------------------------------------------------------------------------------- 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 _INC_STDLIB_S 7 | #define _INC_STDLIB_S 8 | 9 | #include 10 | 11 | #if defined(MINGW_HAS_SECURE_API) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | _CRTIMP errno_t __cdecl _dupenv_s(char **_PBuffer,size_t *_PBufferSizeInBytes,const char *_VarName); 18 | _CRTIMP errno_t __cdecl _itoa_s(int _Value,char *_DstBuf,size_t _Size,int _Radix); 19 | #if _INTEGRAL_MAX_BITS >= 64 20 | _CRTIMP errno_t __cdecl _i64toa_s(__int64 _Val,char *_DstBuf,size_t _Size,int _Radix); 21 | _CRTIMP errno_t __cdecl _ui64toa_s(unsigned __int64 _Val,char *_DstBuf,size_t _Size,int _Radix); 22 | #endif 23 | _CRTIMP errno_t __cdecl _ltoa_s(long _Val,char *_DstBuf,size_t _Size,int _Radix); 24 | _CRTIMP errno_t __cdecl mbstowcs_s(size_t *_PtNumOfCharConverted,wchar_t *_DstBuf,size_t _SizeInWords,const char *_SrcBuf,size_t _MaxCount); 25 | _CRTIMP errno_t __cdecl _mbstowcs_s_l(size_t *_PtNumOfCharConverted,wchar_t *_DstBuf,size_t _SizeInWords,const char *_SrcBuf,size_t _MaxCount,_locale_t _Locale); 26 | _CRTIMP errno_t __cdecl _ultoa_s(unsigned long _Val,char *_DstBuf,size_t _Size,int _Radix); 27 | _CRTIMP errno_t __cdecl _wctomb_s_l(int *_SizeConverted,char *_MbCh,size_t _SizeInBytes,wchar_t _WCh,_locale_t _Locale); 28 | _CRTIMP errno_t __cdecl wcstombs_s(size_t *_PtNumOfCharConverted,char *_Dst,size_t _DstSizeInBytes,const wchar_t *_Src,size_t _MaxCountInBytes); 29 | _CRTIMP errno_t __cdecl _wcstombs_s_l(size_t *_PtNumOfCharConverted,char *_Dst,size_t _DstSizeInBytes,const wchar_t *_Src,size_t _MaxCountInBytes,_locale_t _Locale); 30 | 31 | #ifndef _WSTDLIB_S_DEFINED 32 | #define _WSTDLIB_S_DEFINED 33 | _CRTIMP errno_t __cdecl _itow_s (int _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); 34 | _CRTIMP errno_t __cdecl _ltow_s (long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); 35 | _CRTIMP errno_t __cdecl _ultow_s (unsigned long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); 36 | _CRTIMP errno_t __cdecl _wgetenv_s(size_t *_ReturnSize,wchar_t *_DstBuf,size_t _DstSizeInWords,const wchar_t *_VarName); 37 | _CRTIMP errno_t __cdecl _wdupenv_s(wchar_t **_Buffer,size_t *_BufferSizeInWords,const wchar_t *_VarName); 38 | #if _INTEGRAL_MAX_BITS >= 64 39 | _CRTIMP errno_t __cdecl _i64tow_s(__int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); 40 | _CRTIMP errno_t __cdecl _ui64tow_s(unsigned __int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); 41 | #endif 42 | #endif 43 | 44 | #ifndef _POSIX_ 45 | _CRTIMP errno_t __cdecl _ecvt_s(char *_DstBuf,size_t _Size,double _Val,int _NumOfDights,int *_PtDec,int *_PtSign); 46 | _CRTIMP errno_t __cdecl _fcvt_s(char *_DstBuf,size_t _Size,double _Val,int _NumOfDec,int *_PtDec,int *_PtSign); 47 | _CRTIMP errno_t __cdecl _gcvt_s(char *_DstBuf,size_t _Size,double _Val,int _NumOfDigits); 48 | _CRTIMP errno_t __cdecl _makepath_s(char *_PathResult,size_t _Size,const char *_Drive,const char *_Dir,const char *_Filename,const char *_Ext); 49 | _CRTIMP errno_t __cdecl _putenv_s(const char *_Name,const char *_Value); 50 | _CRTIMP errno_t __cdecl _searchenv_s(const char *_Filename,const char *_EnvVar,char *_ResultPath,size_t _SizeInBytes); 51 | _CRTIMP errno_t __cdecl _splitpath_s(const char *_FullPath,char *_Drive,size_t _DriveSize,char *_Dir,size_t _DirSize,char *_Filename,size_t _FilenameSize,char *_Ext,size_t _ExtSize); 52 | 53 | #ifndef _WSTDLIBP_S_DEFINED 54 | #define _WSTDLIBP_S_DEFINED 55 | _CRTIMP errno_t __cdecl _wmakepath_s(wchar_t *_PathResult,size_t _SizeInWords,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); 56 | _CRTIMP errno_t __cdecl _wputenv_s(const wchar_t *_Name,const wchar_t *_Value); 57 | _CRTIMP errno_t __cdecl _wsearchenv_s(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath,size_t _SizeInWords); 58 | _CRTIMP errno_t __cdecl _wsplitpath_s(const wchar_t *_FullPath,wchar_t *_Drive,size_t _DriveSizeInWords,wchar_t *_Dir,size_t _DirSizeInWords,wchar_t *_Filename,size_t _FilenameSizeInWords,wchar_t *_Ext,size_t _ExtSizeInWords); 59 | #endif 60 | #endif 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif 67 | #endif 68 | -------------------------------------------------------------------------------- /tcc/bin/include/sec_api/stralign_s.h: -------------------------------------------------------------------------------- 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 __STRALIGN_H_S_ 7 | #define __STRALIGN_H_S_ 8 | 9 | #include 10 | 11 | #if defined(MINGW_HAS_SECURE_API) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | #if !defined(I_X86_) && defined(_WSTRING_S_DEFINED) 18 | #if defined(__cplusplus) && defined(_WConst_Return) 19 | static __inline PUWSTR ua_wcscpy_s(PUWSTR Destination,size_t DestinationSize,PCUWSTR Source) { 20 | if(WSTR_ALIGNED(Source) && WSTR_ALIGNED(Destination)) return (wcscpy_s((PWSTR)Destination,DestinationSize,(PCWSTR)Source)==0 ? Destination : NULL); 21 | return uaw_wcscpy((PCUWSTR)String,Character); 22 | } 23 | #endif 24 | #endif 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | #endif 30 | #endif 31 | -------------------------------------------------------------------------------- /tcc/bin/include/sec_api/string_s.h: -------------------------------------------------------------------------------- 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 _INC_STRING_S 7 | #define _INC_STRING_S 8 | 9 | #include 10 | 11 | #if defined(MINGW_HAS_SECURE_API) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | _CRTIMP errno_t __cdecl _strset_s(char *_Dst,size_t _DstSize,int _Value); 18 | _CRTIMP errno_t __cdecl _strerror_s(char *_Buf,size_t _SizeInBytes,const char *_ErrMsg); 19 | _CRTIMP errno_t __cdecl _strlwr_s(char *_Str,size_t _Size); 20 | _CRTIMP errno_t __cdecl _strlwr_s_l(char *_Str,size_t _Size,_locale_t _Locale); 21 | _CRTIMP errno_t __cdecl _strnset_s(char *_Str,size_t _Size,int _Val,size_t _MaxCount); 22 | _CRTIMP errno_t __cdecl _strupr_s(char *_Str,size_t _Size); 23 | _CRTIMP errno_t __cdecl _strupr_s_l(char *_Str,size_t _Size,_locale_t _Locale); 24 | #ifndef _WSTRING_S_DEFINED 25 | #define _WSTRING_S_DEFINED 26 | _CRTIMP wchar_t *__cdecl wcstok_s(wchar_t *_Str,const wchar_t *_Delim,wchar_t **_Context); 27 | _CRTIMP errno_t __cdecl _wcserror_s(wchar_t *_Buf,size_t _SizeInWords,int _ErrNum); 28 | _CRTIMP errno_t __cdecl __wcserror_s(wchar_t *_Buffer,size_t _SizeInWords,const wchar_t *_ErrMsg); 29 | _CRTIMP errno_t __cdecl _wcsnset_s(wchar_t *_Dst,size_t _DstSizeInWords,wchar_t _Val,size_t _MaxCount); 30 | _CRTIMP errno_t __cdecl _wcsset_s(wchar_t *_Str,size_t _SizeInWords,wchar_t _Val); 31 | _CRTIMP errno_t __cdecl _wcslwr_s(wchar_t *_Str,size_t _SizeInWords); 32 | _CRTIMP errno_t __cdecl _wcslwr_s_l(wchar_t *_Str,size_t _SizeInWords,_locale_t _Locale); 33 | _CRTIMP errno_t __cdecl _wcsupr_s(wchar_t *_Str,size_t _Size); 34 | _CRTIMP errno_t __cdecl _wcsupr_s_l(wchar_t *_Str,size_t _Size,_locale_t _Locale); 35 | #endif 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | #endif 41 | #endif 42 | -------------------------------------------------------------------------------- /tcc/bin/include/sec_api/sys/timeb_s.h: -------------------------------------------------------------------------------- 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 | 7 | #ifndef _TIMEB_H_S 8 | #define _TIMEB_H_S 9 | 10 | #include 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | #if defined(MINGW_HAS_SECURE_API) 17 | 18 | #ifdef _USE_32BIT_TIME_T 19 | #define _ftime_s _ftime32_s 20 | #else 21 | #define _ftime_s _ftime64_s 22 | #endif 23 | 24 | _CRTIMP errno_t __cdecl _ftime32_s(struct __timeb32 *_Time); 25 | #if _INTEGRAL_MAX_BITS >= 64 26 | _CRTIMP errno_t __cdecl _ftime64_s(struct __timeb64 *_Time); 27 | #endif 28 | #endif 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /tcc/bin/include/sec_api/time_s.h: -------------------------------------------------------------------------------- 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 _TIME_H__S 7 | #define _TIME_H__S 8 | 9 | #include 10 | 11 | #if defined(MINGW_HAS_SECURE_API) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | _CRTIMP errno_t __cdecl _ctime32_s(char *_Buf,size_t _SizeInBytes,const __time32_t *_Time); 18 | _CRTIMP errno_t __cdecl _gmtime32_s(struct tm *_Tm,const __time32_t *_Time); 19 | _CRTIMP errno_t __cdecl _localtime32_s(struct tm *_Tm,const __time32_t *_Time); 20 | _CRTIMP errno_t __cdecl _strdate_s(char *_Buf,size_t _SizeInBytes); 21 | _CRTIMP errno_t __cdecl _strtime_s(char *_Buf ,size_t _SizeInBytes); 22 | #if _INTEGRAL_MAX_BITS >= 64 23 | _CRTIMP errno_t __cdecl _ctime64_s(char *_Buf,size_t _SizeInBytes,const __time64_t *_Time); 24 | _CRTIMP errno_t __cdecl _gmtime64_s(struct tm *_Tm,const __time64_t *_Time); 25 | _CRTIMP errno_t __cdecl _localtime64_s(struct tm *_Tm,const __time64_t *_Time); 26 | #endif 27 | 28 | #ifndef _WTIME_S_DEFINED 29 | #define _WTIME_S_DEFINED 30 | _CRTIMP errno_t __cdecl _wasctime_s(wchar_t *_Buf,size_t _SizeInWords,const struct tm *_Tm); 31 | _CRTIMP errno_t __cdecl _wctime32_s(wchar_t *_Buf,size_t _SizeInWords,const __time32_t *_Time); 32 | _CRTIMP errno_t __cdecl _wstrdate_s(wchar_t *_Buf,size_t _SizeInWords); 33 | _CRTIMP errno_t __cdecl _wstrtime_s(wchar_t *_Buf,size_t _SizeInWords); 34 | #if _INTEGRAL_MAX_BITS >= 64 35 | _CRTIMP errno_t __cdecl _wctime64_s(wchar_t *_Buf,size_t _SizeInWords,const __time64_t *_Time); 36 | #endif 37 | 38 | #if !defined (RC_INVOKED) && !defined (_INC_WTIME_S_INL) 39 | #define _INC_WTIME_S_INL 40 | #ifdef _USE_32BIT_TIME_T 41 | __CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime32_s(_Buffer,_SizeInWords,_Time); } 42 | #else 43 | __CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime64_s(_Buffer,_SizeInWords,_Time); } 44 | #endif 45 | #endif 46 | #endif 47 | 48 | #ifndef RC_INVOKED 49 | #ifdef _USE_32BIT_TIME_T 50 | __CRT_INLINE errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime32_s(_Tm,_Time); } 51 | #else 52 | __CRT_INLINE errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime64_s(_Tm,_Time); } 53 | #endif 54 | #endif 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif 61 | #endif 62 | -------------------------------------------------------------------------------- /tcc/bin/include/setjmp.h: -------------------------------------------------------------------------------- 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 _INC_SETJMP 7 | #define _INC_SETJMP 8 | 9 | #include <_mingw.h> 10 | 11 | #pragma pack(push,_CRT_PACKING) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | #if (defined(_X86_) && !defined(__x86_64)) 18 | 19 | #define _JBLEN 16 20 | #define _JBTYPE int 21 | 22 | typedef struct __JUMP_BUFFER { 23 | unsigned long Ebp; 24 | unsigned long Ebx; 25 | unsigned long Edi; 26 | unsigned long Esi; 27 | unsigned long Esp; 28 | unsigned long Eip; 29 | unsigned long Registration; 30 | unsigned long TryLevel; 31 | unsigned long Cookie; 32 | unsigned long UnwindFunc; 33 | unsigned long UnwindData[6]; 34 | } _JUMP_BUFFER; 35 | #elif defined(__ia64__) 36 | typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128 { 37 | __int64 LowPart; 38 | __int64 HighPart; 39 | } SETJMP_FLOAT128; 40 | 41 | #define _JBLEN 33 42 | typedef SETJMP_FLOAT128 _JBTYPE; 43 | 44 | typedef struct __JUMP_BUFFER { 45 | 46 | unsigned long iAReserved[6]; 47 | 48 | unsigned long Registration; 49 | unsigned long TryLevel; 50 | unsigned long Cookie; 51 | unsigned long UnwindFunc; 52 | 53 | unsigned long UnwindData[6]; 54 | 55 | SETJMP_FLOAT128 FltS0; 56 | SETJMP_FLOAT128 FltS1; 57 | SETJMP_FLOAT128 FltS2; 58 | SETJMP_FLOAT128 FltS3; 59 | SETJMP_FLOAT128 FltS4; 60 | SETJMP_FLOAT128 FltS5; 61 | SETJMP_FLOAT128 FltS6; 62 | SETJMP_FLOAT128 FltS7; 63 | SETJMP_FLOAT128 FltS8; 64 | SETJMP_FLOAT128 FltS9; 65 | SETJMP_FLOAT128 FltS10; 66 | SETJMP_FLOAT128 FltS11; 67 | SETJMP_FLOAT128 FltS12; 68 | SETJMP_FLOAT128 FltS13; 69 | SETJMP_FLOAT128 FltS14; 70 | SETJMP_FLOAT128 FltS15; 71 | SETJMP_FLOAT128 FltS16; 72 | SETJMP_FLOAT128 FltS17; 73 | SETJMP_FLOAT128 FltS18; 74 | SETJMP_FLOAT128 FltS19; 75 | __int64 FPSR; 76 | __int64 StIIP; 77 | __int64 BrS0; 78 | __int64 BrS1; 79 | __int64 BrS2; 80 | __int64 BrS3; 81 | __int64 BrS4; 82 | __int64 IntS0; 83 | __int64 IntS1; 84 | __int64 IntS2; 85 | __int64 IntS3; 86 | __int64 RsBSP; 87 | __int64 RsPFS; 88 | __int64 ApUNAT; 89 | __int64 ApLC; 90 | __int64 IntSp; 91 | __int64 IntNats; 92 | __int64 Preds; 93 | 94 | } _JUMP_BUFFER; 95 | #elif defined(__x86_64) 96 | typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128 { 97 | unsigned __int64 Part[2]; 98 | } SETJMP_FLOAT128; 99 | 100 | #define _JBLEN 16 101 | typedef SETJMP_FLOAT128 _JBTYPE; 102 | 103 | typedef struct _JUMP_BUFFER { 104 | unsigned __int64 Frame; 105 | unsigned __int64 Rbx; 106 | unsigned __int64 Rsp; 107 | unsigned __int64 Rbp; 108 | unsigned __int64 Rsi; 109 | unsigned __int64 Rdi; 110 | unsigned __int64 R12; 111 | unsigned __int64 R13; 112 | unsigned __int64 R14; 113 | unsigned __int64 R15; 114 | unsigned __int64 Rip; 115 | unsigned __int64 Spare; 116 | SETJMP_FLOAT128 Xmm6; 117 | SETJMP_FLOAT128 Xmm7; 118 | SETJMP_FLOAT128 Xmm8; 119 | SETJMP_FLOAT128 Xmm9; 120 | SETJMP_FLOAT128 Xmm10; 121 | SETJMP_FLOAT128 Xmm11; 122 | SETJMP_FLOAT128 Xmm12; 123 | SETJMP_FLOAT128 Xmm13; 124 | SETJMP_FLOAT128 Xmm14; 125 | SETJMP_FLOAT128 Xmm15; 126 | } _JUMP_BUFFER; 127 | #endif 128 | #ifndef _JMP_BUF_DEFINED 129 | typedef _JBTYPE jmp_buf[_JBLEN]; 130 | #define _JMP_BUF_DEFINED 131 | #endif 132 | 133 | void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp(void); 134 | 135 | #ifdef USE_MINGW_SETJMP_TWO_ARGS 136 | #ifndef _INC_SETJMPEX 137 | #define setjmp(BUF) _setjmp((BUF),mingw_getsp()) 138 | int __cdecl __attribute__ ((__nothrow__)) _setjmp(jmp_buf _Buf,void *_Ctx); 139 | #else 140 | #undef setjmp 141 | #define setjmp(BUF) _setjmpex((BUF),mingw_getsp()) 142 | #define setjmpex(BUF) _setjmpex((BUF),mingw_getsp()) 143 | int __cdecl __attribute__ ((__nothrow__)) _setjmpex(jmp_buf _Buf,void *_Ctx); 144 | #endif 145 | #else 146 | #ifndef _INC_SETJMPEX 147 | #define setjmp _setjmp 148 | #endif 149 | int __cdecl __attribute__ ((__nothrow__)) setjmp(jmp_buf _Buf); 150 | #endif 151 | 152 | __declspec(noreturn) __attribute__ ((__nothrow__)) void __cdecl ms_longjmp(jmp_buf _Buf,int _Value)/* throw(...)*/; 153 | __declspec(noreturn) __attribute__ ((__nothrow__)) void __cdecl longjmp(jmp_buf _Buf,int _Value); 154 | 155 | #ifdef __cplusplus 156 | } 157 | #endif 158 | 159 | #pragma pack(pop) 160 | #endif 161 | -------------------------------------------------------------------------------- /tcc/bin/include/share.h: -------------------------------------------------------------------------------- 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 _INC_SHARE 7 | #define _INC_SHARE 8 | 9 | #ifndef _WIN32 10 | #error Only Win32 target is supported! 11 | #endif 12 | 13 | #define _SH_COMPAT 0x00 14 | #define _SH_DENYRW 0x10 15 | #define _SH_DENYWR 0x20 16 | #define _SH_DENYRD 0x30 17 | #define _SH_DENYNO 0x40 18 | #define _SH_SECURE 0x80 19 | 20 | #ifndef NO_OLDNAMES 21 | #define SH_COMPAT _SH_COMPAT 22 | #define SH_DENYRW _SH_DENYRW 23 | #define SH_DENYWR _SH_DENYWR 24 | #define SH_DENYRD _SH_DENYRD 25 | #define SH_DENYNO _SH_DENYNO 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /tcc/bin/include/signal.h: -------------------------------------------------------------------------------- 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 _INC_SIGNAL 7 | #define _INC_SIGNAL 8 | 9 | #include <_mingw.h> 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #ifndef _SIG_ATOMIC_T_DEFINED 16 | #define _SIG_ATOMIC_T_DEFINED 17 | typedef int sig_atomic_t; 18 | #endif 19 | 20 | #define NSIG 23 21 | 22 | #define SIGHUP 1 /* hangup */ 23 | #define SIGINT 2 24 | #define SIGQUIT 3 /* quit */ 25 | #define SIGILL 4 26 | #define SIGTRAP 5 /* trace trap (not reset when caught) */ 27 | #define SIGIOT 6 /* IOT instruction */ 28 | #define SIGABRT 6 /* used by abort, replace SIGIOT in the future */ 29 | #define SIGEMT 7 /* EMT instruction */ 30 | #define SIGFPE 8 31 | #define SIGKILL 9 /* kill (cannot be caught or ignored) */ 32 | #define SIGBUS 10 /* bus error */ 33 | #define SIGSEGV 11 34 | #define SIGSYS 12 /* bad argument to system call */ 35 | #define SIGPIPE 13 /* write on a pipe with no one to read it */ 36 | #ifdef __USE_MINGW_ALARM 37 | #define SIGALRM 14 /* alarm clock */ 38 | #endif 39 | #define SIGTERM 15 40 | #define SIGBREAK 21 41 | #define SIGABRT2 22 42 | 43 | #define SIGABRT_COMPAT 6 44 | 45 | typedef void (*__p_sig_fn_t)(int); 46 | 47 | #define SIG_DFL (__p_sig_fn_t)0 48 | #define SIG_IGN (__p_sig_fn_t)1 49 | #define SIG_GET (__p_sig_fn_t)2 50 | #define SIG_SGE (__p_sig_fn_t)3 51 | #define SIG_ACK (__p_sig_fn_t)4 52 | #define SIG_ERR (__p_sig_fn_t)-1 53 | 54 | extern void **__cdecl __pxcptinfoptrs(void); 55 | #define _pxcptinfoptrs (*__pxcptinfoptrs()) 56 | 57 | __p_sig_fn_t __cdecl signal(int _SigNum,__p_sig_fn_t _Func); 58 | int __cdecl raise(int _SigNum); 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | #endif 64 | -------------------------------------------------------------------------------- /tcc/bin/include/stdarg.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDARG_H 2 | #define _STDARG_H 3 | 4 | #ifdef __x86_64__ 5 | #ifndef _WIN64 6 | 7 | typedef void *va_list; 8 | 9 | va_list __va_start(void *fp); 10 | void *__va_arg(va_list ap, int arg_type, int size); 11 | va_list __va_copy(va_list src); 12 | void __va_end(va_list ap); 13 | 14 | #define va_start(ap, last) ((ap) = __va_start(__builtin_frame_address(0))) 15 | #define va_arg(ap, type) \ 16 | (*(type *)(__va_arg(ap, __builtin_va_arg_types(type), sizeof(type)))) 17 | #define va_copy(dest, src) ((dest) = __va_copy(src)) 18 | #define va_end(ap) __va_end(ap) 19 | 20 | #else /* _WIN64 */ 21 | typedef char *va_list; 22 | #define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+7)&~7) 23 | #define va_arg(ap,type) (ap += (sizeof(type)+7)&~7, *(type *)(ap - ((sizeof(type)+7)&~7))) 24 | #define va_copy(dest, src) (dest) = (src) 25 | #define va_end(ap) 26 | #endif 27 | 28 | #else /* __i386__ */ 29 | typedef char *va_list; 30 | /* only correct for i386 */ 31 | #define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3) 32 | #define va_arg(ap,type) (ap += (sizeof(type)+3)&~3, *(type *)(ap - ((sizeof(type)+3)&~3))) 33 | #define va_copy(dest, src) (dest) = (src) 34 | #define va_end(ap) 35 | #endif 36 | 37 | /* fix a buggy dependency on GCC in libio.h */ 38 | typedef va_list __gnuc_va_list; 39 | #define _VA_LIST_DEFINED 40 | 41 | #endif /* _STDARG_H */ 42 | -------------------------------------------------------------------------------- /tcc/bin/include/stdbool.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDBOOL_H 2 | #define _STDBOOL_H 3 | 4 | /* ISOC99 boolean */ 5 | 6 | #define bool _Bool 7 | #define true 1 8 | #define false 0 9 | 10 | #endif /* _STDBOOL_H */ 11 | -------------------------------------------------------------------------------- /tcc/bin/include/stddef.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDDEF_H 2 | #define _STDDEF_H 3 | 4 | typedef __SIZE_TYPE__ size_t; 5 | typedef __PTRDIFF_TYPE__ ssize_t; 6 | typedef __WCHAR_TYPE__ wchar_t; 7 | typedef __PTRDIFF_TYPE__ ptrdiff_t; 8 | typedef __PTRDIFF_TYPE__ intptr_t; 9 | typedef __SIZE_TYPE__ uintptr_t; 10 | 11 | #ifndef __int8_t_defined 12 | #define __int8_t_defined 13 | typedef signed char int8_t; 14 | typedef signed short int int16_t; 15 | typedef signed int int32_t; 16 | typedef signed long long int int64_t; 17 | typedef unsigned char uint8_t; 18 | typedef unsigned short int uint16_t; 19 | typedef unsigned int uint32_t; 20 | typedef unsigned long long int uint64_t; 21 | #endif 22 | 23 | #define NULL ((void*)0) 24 | #define offsetof(type, field) ((size_t)&((type *)0)->field) 25 | 26 | void *alloca(size_t size); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /tcc/bin/include/sys/fcntl.h: -------------------------------------------------------------------------------- 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 | /* 7 | * This file is part of the Mingw32 package. 8 | * 9 | * This fcntl.h maps to the root fcntl.h 10 | */ 11 | #ifndef __STRICT_ANSI__ 12 | #include 13 | #endif 14 | -------------------------------------------------------------------------------- /tcc/bin/include/sys/file.h: -------------------------------------------------------------------------------- 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 | /* 7 | * This file is part of the Mingw32 package. 8 | * 9 | * This file.h maps to the root fcntl.h 10 | * TODO? 11 | */ 12 | #ifndef __STRICT_ANSI__ 13 | #include 14 | #endif 15 | -------------------------------------------------------------------------------- /tcc/bin/include/sys/locking.h: -------------------------------------------------------------------------------- 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 _INC_LOCKING 7 | #define _INC_LOCKING 8 | 9 | #ifndef _WIN32 10 | #error Only Win32 target is supported! 11 | #endif 12 | 13 | /* All the headers include this file. */ 14 | #include <_mingw.h> 15 | 16 | #define _LK_UNLCK 0 17 | #define _LK_LOCK 1 18 | #define _LK_NBLCK 2 19 | #define _LK_RLCK 3 20 | #define _LK_NBRLCK 4 21 | 22 | #ifndef NO_OLDNAMES 23 | #define LK_UNLCK _LK_UNLCK 24 | #define LK_LOCK _LK_LOCK 25 | #define LK_NBLCK _LK_NBLCK 26 | #define LK_RLCK _LK_RLCK 27 | #define LK_NBRLCK _LK_NBRLCK 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /tcc/bin/include/sys/time.h: -------------------------------------------------------------------------------- 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 | 7 | #ifndef _SYS_TIME_H_ 8 | #define _SYS_TIME_H_ 9 | 10 | #include 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | #ifndef __STRICT_ANSI__ 17 | #ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */ 18 | #define _TIMEVAL_DEFINED 19 | struct timeval { 20 | long tv_sec; 21 | long tv_usec; 22 | }; 23 | #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) 24 | #define timercmp(tvp, uvp, cmp) \ 25 | (((tvp)->tv_sec != (uvp)->tv_sec) ? \ 26 | ((tvp)->tv_sec cmp (uvp)->tv_sec) : \ 27 | ((tvp)->tv_usec cmp (uvp)->tv_usec)) 28 | #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 29 | #endif /* _TIMEVAL_DEFINED */ 30 | 31 | #ifndef _TIMEZONE_DEFINED /* also in sys/time.h */ 32 | #define _TIMEZONE_DEFINED 33 | /* Provided for compatibility with code that assumes that 34 | the presence of gettimeofday function implies a definition 35 | of struct timezone. */ 36 | struct timezone 37 | { 38 | int tz_minuteswest; /* of Greenwich */ 39 | int tz_dsttime; /* type of dst correction to apply */ 40 | }; 41 | 42 | extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z); 43 | 44 | #endif 45 | 46 | /* 47 | Implementation as per: 48 | The Open Group Base Specifications, Issue 6 49 | IEEE Std 1003.1, 2004 Edition 50 | 51 | The timezone pointer arg is ignored. Errors are ignored. 52 | */ 53 | #ifndef _GETTIMEOFDAY_DEFINED 54 | #define _GETTIMEOFDAY_DEFINED 55 | int __cdecl gettimeofday(struct timeval *__restrict__, 56 | void *__restrict__ /* tzp (unused) */); 57 | #endif 58 | 59 | #endif /* __STRICT_ANSI__ */ 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | /* Adding timespec definition. */ 66 | #include 67 | 68 | 69 | #endif /* _SYS_TIME_H_ */ 70 | -------------------------------------------------------------------------------- /tcc/bin/include/sys/timeb.h: -------------------------------------------------------------------------------- 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 _TIMEB_H_ 7 | #define _TIMEB_H_ 8 | 9 | #include <_mingw.h> 10 | 11 | #ifndef _WIN32 12 | #error Only Win32 target is supported! 13 | #endif 14 | 15 | #pragma pack(push,_CRT_PACKING) 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | #ifndef _CRTIMP 22 | #define _CRTIMP __declspec(dllimport) 23 | #endif 24 | 25 | #ifndef __TINYC__ //gr 26 | #ifdef _USE_32BIT_TIME_T 27 | #ifdef _WIN64 28 | #undef _USE_32BIT_TIME_T 29 | #endif 30 | #else 31 | #if _INTEGRAL_MAX_BITS < 64 32 | #define _USE_32BIT_TIME_T 33 | #endif 34 | #endif 35 | #endif 36 | 37 | #ifndef _TIME32_T_DEFINED 38 | typedef long __time32_t; 39 | #define _TIME32_T_DEFINED 40 | #endif 41 | 42 | #ifndef _TIME64_T_DEFINED 43 | #if _INTEGRAL_MAX_BITS >= 64 44 | typedef __int64 __time64_t; 45 | #endif 46 | #define _TIME64_T_DEFINED 47 | #endif 48 | 49 | #ifndef _TIME_T_DEFINED 50 | #ifdef _USE_32BIT_TIME_T 51 | typedef __time32_t time_t; 52 | #else 53 | typedef __time64_t time_t; 54 | #endif 55 | #define _TIME_T_DEFINED 56 | #endif 57 | 58 | #ifndef _TIMEB_DEFINED 59 | #define _TIMEB_DEFINED 60 | 61 | struct __timeb32 { 62 | __time32_t time; 63 | unsigned short millitm; 64 | short timezone; 65 | short dstflag; 66 | }; 67 | 68 | #ifndef NO_OLDNAMES 69 | struct timeb { 70 | time_t time; 71 | unsigned short millitm; 72 | short timezone; 73 | short dstflag; 74 | }; 75 | #endif 76 | 77 | #if _INTEGRAL_MAX_BITS >= 64 78 | struct __timeb64 { 79 | __time64_t time; 80 | unsigned short millitm; 81 | short timezone; 82 | short dstflag; 83 | }; 84 | #endif 85 | 86 | #ifdef _USE_32BIT_TIME_T 87 | #define _timeb __timeb32 88 | //gr #define _ftime _ftime32 89 | #define _ftime32 _ftime 90 | #else 91 | #define _timeb __timeb64 92 | #define _ftime _ftime64 93 | #endif 94 | #endif 95 | 96 | _CRTIMP void __cdecl _ftime32(struct __timeb32 *_Time); 97 | #if _INTEGRAL_MAX_BITS >= 64 98 | _CRTIMP void __cdecl _ftime64(struct __timeb64 *_Time); 99 | #endif 100 | 101 | #ifndef _TIMESPEC_DEFINED 102 | #define _TIMESPEC_DEFINED 103 | struct timespec { 104 | time_t tv_sec; /* Seconds */ 105 | long tv_nsec; /* Nanoseconds */ 106 | }; 107 | 108 | struct itimerspec { 109 | struct timespec it_interval; /* Timer period */ 110 | struct timespec it_value; /* Timer expiration */ 111 | }; 112 | #endif 113 | 114 | #if !defined (RC_INVOKED) && !defined (NO_OLDNAMES) 115 | #ifdef _USE_32BIT_TIME_T 116 | __CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) { 117 | _ftime32((struct __timeb32 *)_Tmb); 118 | } 119 | #else 120 | __CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) { 121 | _ftime64((struct __timeb64 *)_Tmb); 122 | } 123 | #endif 124 | #endif 125 | 126 | #ifdef __cplusplus 127 | } 128 | #endif 129 | 130 | #pragma pack(pop) 131 | 132 | #include 133 | #endif 134 | -------------------------------------------------------------------------------- /tcc/bin/include/sys/types.h: -------------------------------------------------------------------------------- 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 _INC_TYPES 7 | #define _INC_TYPES 8 | 9 | #ifndef _WIN32 10 | #error Only Win32 target is supported! 11 | #endif 12 | 13 | #include <_mingw.h> 14 | 15 | #ifndef __TINYC__ //gr 16 | #ifdef _USE_32BIT_TIME_T 17 | #ifdef _WIN64 18 | #undef _USE_32BIT_TIME_T 19 | #endif 20 | #else 21 | #if _INTEGRAL_MAX_BITS < 64 22 | #define _USE_32BIT_TIME_T 23 | #endif 24 | #endif 25 | #endif 26 | 27 | #ifndef _TIME32_T_DEFINED 28 | #define _TIME32_T_DEFINED 29 | typedef long __time32_t; 30 | #endif 31 | 32 | #ifndef _TIME64_T_DEFINED 33 | #define _TIME64_T_DEFINED 34 | #if _INTEGRAL_MAX_BITS >= 64 35 | typedef __int64 __time64_t; 36 | #endif 37 | #endif 38 | 39 | #ifndef _TIME_T_DEFINED 40 | #define _TIME_T_DEFINED 41 | #ifdef _USE_32BIT_TIME_T 42 | typedef __time32_t time_t; 43 | #else 44 | typedef __time64_t time_t; 45 | #endif 46 | #endif 47 | 48 | #ifndef _INO_T_DEFINED 49 | #define _INO_T_DEFINED 50 | typedef unsigned short _ino_t; 51 | #ifndef NO_OLDNAMES 52 | typedef unsigned short ino_t; 53 | #endif 54 | #endif 55 | 56 | #ifndef _DEV_T_DEFINED 57 | #define _DEV_T_DEFINED 58 | typedef unsigned int _dev_t; 59 | #ifndef NO_OLDNAMES 60 | typedef unsigned int dev_t; 61 | #endif 62 | #endif 63 | 64 | #ifndef _PID_T_ 65 | #define _PID_T_ 66 | #ifndef _WIN64 67 | typedef int _pid_t; 68 | #else 69 | typedef __int64 _pid_t; 70 | #endif 71 | 72 | #ifndef NO_OLDNAMES 73 | typedef _pid_t pid_t; 74 | #endif 75 | #endif /* Not _PID_T_ */ 76 | 77 | #ifndef _MODE_T_ 78 | #define _MODE_T_ 79 | typedef unsigned short _mode_t; 80 | 81 | #ifndef NO_OLDNAMES 82 | typedef _mode_t mode_t; 83 | #endif 84 | #endif /* Not _MODE_T_ */ 85 | 86 | #ifndef _OFF_T_DEFINED 87 | #define _OFF_T_DEFINED 88 | #ifndef _OFF_T_ 89 | #define _OFF_T_ 90 | typedef long _off_t; 91 | #if !defined(NO_OLDNAMES) || defined(_POSIX) 92 | typedef long off_t; 93 | #endif 94 | #endif 95 | #endif 96 | 97 | #ifndef _OFF64_T_DEFINED 98 | #define _OFF64_T_DEFINED 99 | typedef long long _off64_t; 100 | #if !defined(NO_OLDNAMES) || defined(_POSIX) 101 | typedef long long off64_t; 102 | #endif 103 | #endif 104 | 105 | #ifndef _TIMESPEC_DEFINED 106 | #define _TIMESPEC_DEFINED 107 | struct timespec { 108 | time_t tv_sec; /* Seconds */ 109 | long tv_nsec; /* Nanoseconds */ 110 | }; 111 | 112 | struct itimerspec { 113 | struct timespec it_interval; /* Timer period */ 114 | struct timespec it_value; /* Timer expiration */ 115 | }; 116 | #endif 117 | 118 | #endif 119 | -------------------------------------------------------------------------------- /tcc/bin/include/sys/unistd.h: -------------------------------------------------------------------------------- 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 | /* 7 | * This file is part of the Mingw32 package. 8 | * 9 | * unistd.h maps (roughly) to io.h 10 | */ 11 | #ifndef __STRICT_ANSI__ 12 | #include 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /tcc/bin/include/sys/utime.h: -------------------------------------------------------------------------------- 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 _INC_UTIME 7 | #define _INC_UTIME 8 | 9 | #ifndef _WIN32 10 | #error Only Win32 target is supported! 11 | #endif 12 | 13 | #include <_mingw.h> 14 | 15 | #pragma pack(push,_CRT_PACKING) 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | #ifndef _CRTIMP 22 | #define _CRTIMP __declspec(dllimport) 23 | #endif 24 | 25 | #ifndef _WCHAR_T_DEFINED 26 | typedef unsigned short wchar_t; 27 | #define _WCHAR_T_DEFINED 28 | #endif 29 | 30 | #ifndef __TINYC__ //gr 31 | #ifdef _USE_32BIT_TIME_T 32 | #ifdef _WIN64 33 | #undef _USE_32BIT_TIME_T 34 | #endif 35 | #else 36 | #if _INTEGRAL_MAX_BITS < 64 37 | #define _USE_32BIT_TIME_T 38 | #endif 39 | #endif 40 | #endif 41 | 42 | #ifndef _TIME32_T_DEFINED 43 | #define _TIME32_T_DEFINED 44 | typedef long __time32_t; 45 | #endif 46 | 47 | #ifndef _TIME64_T_DEFINED 48 | #define _TIME64_T_DEFINED 49 | #if _INTEGRAL_MAX_BITS >= 64 50 | typedef __int64 __time64_t; 51 | #endif 52 | #endif 53 | 54 | #ifndef _TIME_T_DEFINED 55 | #define _TIME_T_DEFINED 56 | #ifdef _USE_32BIT_TIME_T 57 | typedef __time32_t time_t; 58 | #else 59 | typedef __time64_t time_t; 60 | #endif 61 | #endif 62 | 63 | #ifndef _UTIMBUF_DEFINED 64 | #define _UTIMBUF_DEFINED 65 | 66 | struct _utimbuf { 67 | time_t actime; 68 | time_t modtime; 69 | }; 70 | 71 | struct __utimbuf32 { 72 | __time32_t actime; 73 | __time32_t modtime; 74 | }; 75 | 76 | #if _INTEGRAL_MAX_BITS >= 64 77 | struct __utimbuf64 { 78 | __time64_t actime; 79 | __time64_t modtime; 80 | }; 81 | #endif 82 | 83 | #ifndef NO_OLDNAMES 84 | struct utimbuf { 85 | time_t actime; 86 | time_t modtime; 87 | }; 88 | 89 | struct utimbuf32 { 90 | __time32_t actime; 91 | __time32_t modtime; 92 | }; 93 | #endif 94 | #endif 95 | 96 | _CRTIMP int __cdecl _utime32(const char *_Filename,struct __utimbuf32 *_Time); 97 | _CRTIMP int __cdecl _futime32(int _FileDes,struct __utimbuf32 *_Time); 98 | _CRTIMP int __cdecl _wutime32(const wchar_t *_Filename,struct __utimbuf32 *_Time); 99 | #if _INTEGRAL_MAX_BITS >= 64 100 | _CRTIMP int __cdecl _utime64(const char *_Filename,struct __utimbuf64 *_Time); 101 | _CRTIMP int __cdecl _futime64(int _FileDes,struct __utimbuf64 *_Time); 102 | _CRTIMP int __cdecl _wutime64(const wchar_t *_Filename,struct __utimbuf64 *_Time); 103 | #endif 104 | 105 | #ifndef RC_INVOKED 106 | #ifdef _USE_32BIT_TIME_T 107 | __CRT_INLINE int __cdecl _utime(const char *_Filename,struct _utimbuf *_Utimbuf) { 108 | return _utime32(_Filename,(struct __utimbuf32 *)_Utimbuf); 109 | } 110 | __CRT_INLINE int __cdecl _futime(int _Desc,struct _utimbuf *_Utimbuf) { 111 | return _futime32(_Desc,(struct __utimbuf32 *)_Utimbuf); 112 | } 113 | __CRT_INLINE int __cdecl _wutime(const wchar_t *_Filename,struct _utimbuf *_Utimbuf) { 114 | return _wutime32(_Filename,(struct __utimbuf32 *)_Utimbuf); 115 | } 116 | #else 117 | __CRT_INLINE int __cdecl _utime(const char *_Filename,struct _utimbuf *_Utimbuf) { 118 | return _utime64(_Filename,(struct __utimbuf64 *)_Utimbuf); 119 | } 120 | __CRT_INLINE int __cdecl _futime(int _Desc,struct _utimbuf *_Utimbuf) { 121 | return _futime64(_Desc,(struct __utimbuf64 *)_Utimbuf); 122 | } 123 | __CRT_INLINE int __cdecl _wutime(const wchar_t *_Filename,struct _utimbuf *_Utimbuf) { 124 | return _wutime64(_Filename,(struct __utimbuf64 *)_Utimbuf); 125 | } 126 | #endif 127 | 128 | #ifndef NO_OLDNAMES 129 | #ifdef _USE_32BIT_TIME_T 130 | __CRT_INLINE int __cdecl utime(const char *_Filename,struct utimbuf *_Utimbuf) { 131 | return _utime32(_Filename,(struct __utimbuf32 *)_Utimbuf); 132 | } 133 | #else 134 | __CRT_INLINE int __cdecl utime(const char *_Filename,struct utimbuf *_Utimbuf) { 135 | return _utime64(_Filename,(struct __utimbuf64 *)_Utimbuf); 136 | } 137 | #endif 138 | #endif 139 | #endif 140 | 141 | #ifdef __cplusplus 142 | } 143 | #endif 144 | 145 | #pragma pack(pop) 146 | #endif 147 | -------------------------------------------------------------------------------- /tcc/bin/include/tcclib.h: -------------------------------------------------------------------------------- 1 | /* Simple libc header for TCC 2 | * 3 | * Add any function you want from the libc there. This file is here 4 | * only for your convenience so that you do not need to put the whole 5 | * glibc include files on your floppy disk 6 | */ 7 | #ifndef _TCCLIB_H 8 | #define _TCCLIB_H 9 | 10 | #include 11 | #include 12 | 13 | /* stdlib.h */ 14 | void *calloc(size_t nmemb, size_t size); 15 | void *malloc(size_t size); 16 | void free(void *ptr); 17 | void *realloc(void *ptr, size_t size); 18 | int atoi(const char *nptr); 19 | long int strtol(const char *nptr, char **endptr, int base); 20 | unsigned long int strtoul(const char *nptr, char **endptr, int base); 21 | void exit(int); 22 | 23 | /* stdio.h */ 24 | typedef struct __FILE FILE; 25 | #define EOF (-1) 26 | extern FILE *stdin; 27 | extern FILE *stdout; 28 | extern FILE *stderr; 29 | FILE *fopen(const char *path, const char *mode); 30 | FILE *fdopen(int fildes, const char *mode); 31 | FILE *freopen(const char *path, const char *mode, FILE *stream); 32 | int fclose(FILE *stream); 33 | size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); 34 | size_t fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream); 35 | int fgetc(FILE *stream); 36 | char *fgets(char *s, int size, FILE *stream); 37 | int getc(FILE *stream); 38 | int getchar(void); 39 | char *gets(char *s); 40 | int ungetc(int c, FILE *stream); 41 | int fflush(FILE *stream); 42 | 43 | int printf(const char *format, ...); 44 | int fprintf(FILE *stream, const char *format, ...); 45 | int sprintf(char *str, const char *format, ...); 46 | int snprintf(char *str, size_t size, const char *format, ...); 47 | int asprintf(char **strp, const char *format, ...); 48 | int dprintf(int fd, const char *format, ...); 49 | int vprintf(const char *format, va_list ap); 50 | int vfprintf(FILE *stream, const char *format, va_list ap); 51 | int vsprintf(char *str, const char *format, va_list ap); 52 | int vsnprintf(char *str, size_t size, const char *format, va_list ap); 53 | int vasprintf(char **strp, const char *format, va_list ap); 54 | int vdprintf(int fd, const char *format, va_list ap); 55 | 56 | void perror(const char *s); 57 | 58 | /* string.h */ 59 | char *strcat(char *dest, const char *src); 60 | char *strchr(const char *s, int c); 61 | char *strrchr(const char *s, int c); 62 | char *strcpy(char *dest, const char *src); 63 | void *memcpy(void *dest, const void *src, size_t n); 64 | void *memmove(void *dest, const void *src, size_t n); 65 | void *memset(void *s, int c, size_t n); 66 | char *strdup(const char *s); 67 | 68 | /* dlfcn.h */ 69 | #define RTLD_LAZY 0x001 70 | #define RTLD_NOW 0x002 71 | #define RTLD_GLOBAL 0x100 72 | 73 | void *dlopen(const char *filename, int flag); 74 | const char *dlerror(void); 75 | void *dlsym(void *handle, char *symbol); 76 | int dlclose(void *handle); 77 | 78 | #endif /* _TCCLIB_H */ 79 | -------------------------------------------------------------------------------- /tcc/bin/include/vadefs.h: -------------------------------------------------------------------------------- 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 _INC_VADEFS 7 | #define _INC_VADEFS 8 | 9 | //!__TINYC__: GNUC specific stuff removed 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /tcc/bin/include/values.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TODO: Nothing here yet. Should provide UNIX compatibility constants 3 | * comparible to those in limits.h and float.h. 4 | */ 5 | -------------------------------------------------------------------------------- /tcc/bin/include/varargs.h: -------------------------------------------------------------------------------- 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 _VARARGS_H 7 | #define _VARARGS_H 8 | 9 | #error "TinyCC no longer implements ." 10 | #error "Revise your code to use ." 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /tcc/bin/include/wctype.h: -------------------------------------------------------------------------------- 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 _INC_WCTYPE 7 | #define _INC_WCTYPE 8 | 9 | #ifndef _WIN32 10 | #error Only Win32 target is supported! 11 | #endif 12 | 13 | #include <_mingw.h> 14 | 15 | #pragma pack(push,_CRT_PACKING) 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | #ifndef _CRTIMP 22 | #define _CRTIMP __declspec(dllimport) 23 | #endif 24 | 25 | #ifndef _WCHAR_T_DEFINED 26 | typedef unsigned short wchar_t; 27 | #define _WCHAR_T_DEFINED 28 | #endif 29 | 30 | #ifndef _WCTYPE_T_DEFINED 31 | typedef unsigned short wint_t; 32 | typedef unsigned short wctype_t; 33 | #define _WCTYPE_T_DEFINED 34 | #endif 35 | 36 | #ifndef WEOF 37 | #define WEOF (wint_t)(0xFFFF) 38 | #endif 39 | 40 | #ifndef _CRT_CTYPEDATA_DEFINED 41 | #define _CRT_CTYPEDATA_DEFINED 42 | #ifndef _CTYPE_DISABLE_MACROS 43 | 44 | #ifndef __PCTYPE_FUNC 45 | #define __PCTYPE_FUNC __pctype_func() 46 | #ifdef _MSVCRT_ 47 | #define __pctype_func() (_pctype) 48 | #else 49 | #define __pctype_func() (*_imp___pctype) 50 | #endif 51 | #endif 52 | 53 | #ifndef _pctype 54 | #ifdef _MSVCRT_ 55 | extern unsigned short *_pctype; 56 | #else 57 | extern unsigned short **_imp___pctype; 58 | #define _pctype (*_imp___pctype) 59 | #endif 60 | #endif 61 | 62 | #endif 63 | #endif 64 | 65 | #ifndef _CRT_WCTYPEDATA_DEFINED 66 | #define _CRT_WCTYPEDATA_DEFINED 67 | #ifndef _CTYPE_DISABLE_MACROS 68 | #ifndef _wctype 69 | #ifdef _MSVCRT_ 70 | extern unsigned short *_wctype; 71 | #else 72 | extern unsigned short **_imp___wctype; 73 | #define _wctype (*_imp___wctype) 74 | #endif 75 | #endif 76 | 77 | #ifndef _pwctype 78 | #ifdef _MSVCRT_ 79 | extern unsigned short *_pwctype; 80 | #else 81 | extern unsigned short **_imp___pwctype; 82 | #define _pwctype (*_imp___pwctype) 83 | #define __pwctype_func() (*_imp___pwctype) 84 | #endif 85 | #endif 86 | #endif 87 | #endif 88 | 89 | #define _UPPER 0x1 90 | #define _LOWER 0x2 91 | #define _DIGIT 0x4 92 | #define _SPACE 0x8 93 | 94 | #define _PUNCT 0x10 95 | #define _CONTROL 0x20 96 | #define _BLANK 0x40 97 | #define _HEX 0x80 98 | 99 | #define _LEADBYTE 0x8000 100 | #define _ALPHA (0x0100|_UPPER|_LOWER) 101 | 102 | #ifndef _WCTYPE_DEFINED 103 | #define _WCTYPE_DEFINED 104 | 105 | int __cdecl iswalpha(wint_t); 106 | int __cdecl iswupper(wint_t); 107 | int __cdecl iswlower(wint_t); 108 | int __cdecl iswdigit(wint_t); 109 | int __cdecl iswxdigit(wint_t); 110 | int __cdecl iswspace(wint_t); 111 | int __cdecl iswpunct(wint_t); 112 | int __cdecl iswalnum(wint_t); 113 | int __cdecl iswprint(wint_t); 114 | int __cdecl iswgraph(wint_t); 115 | int __cdecl iswcntrl(wint_t); 116 | int __cdecl iswascii(wint_t); 117 | int __cdecl isleadbyte(int); 118 | wint_t __cdecl towupper(wint_t); 119 | wint_t __cdecl towlower(wint_t); 120 | int __cdecl iswctype(wint_t,wctype_t); 121 | _CRTIMP int __cdecl __iswcsymf(wint_t); 122 | _CRTIMP int __cdecl __iswcsym(wint_t); 123 | int __cdecl is_wctype(wint_t,wctype_t); 124 | #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) 125 | int __cdecl isblank(int _C); 126 | #endif 127 | #endif 128 | 129 | #ifndef _WCTYPE_INLINE_DEFINED 130 | #define _WCTYPE_INLINE_DEFINED 131 | #ifndef __cplusplus 132 | #define iswalpha(_c) (iswctype(_c,_ALPHA)) 133 | #define iswupper(_c) (iswctype(_c,_UPPER)) 134 | #define iswlower(_c) (iswctype(_c,_LOWER)) 135 | #define iswdigit(_c) (iswctype(_c,_DIGIT)) 136 | #define iswxdigit(_c) (iswctype(_c,_HEX)) 137 | #define iswspace(_c) (iswctype(_c,_SPACE)) 138 | #define iswpunct(_c) (iswctype(_c,_PUNCT)) 139 | #define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) 140 | #define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) 141 | #define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) 142 | #define iswcntrl(_c) (iswctype(_c,_CONTROL)) 143 | #define iswascii(_c) ((unsigned)(_c) < 0x80) 144 | #define isleadbyte(c) (__pctype_func()[(unsigned char)(c)] & _LEADBYTE) 145 | #else 146 | __CRT_INLINE int __cdecl iswalpha(wint_t _C) {return (iswctype(_C,_ALPHA)); } 147 | __CRT_INLINE int __cdecl iswupper(wint_t _C) {return (iswctype(_C,_UPPER)); } 148 | __CRT_INLINE int __cdecl iswlower(wint_t _C) {return (iswctype(_C,_LOWER)); } 149 | __CRT_INLINE int __cdecl iswdigit(wint_t _C) {return (iswctype(_C,_DIGIT)); } 150 | __CRT_INLINE int __cdecl iswxdigit(wint_t _C) {return (iswctype(_C,_HEX)); } 151 | __CRT_INLINE int __cdecl iswspace(wint_t _C) {return (iswctype(_C,_SPACE)); } 152 | __CRT_INLINE int __cdecl iswpunct(wint_t _C) {return (iswctype(_C,_PUNCT)); } 153 | __CRT_INLINE int __cdecl iswalnum(wint_t _C) {return (iswctype(_C,_ALPHA|_DIGIT)); } 154 | __CRT_INLINE int __cdecl iswprint(wint_t _C) {return (iswctype(_C,_BLANK|_PUNCT|_ALPHA|_DIGIT)); } 155 | __CRT_INLINE int __cdecl iswgraph(wint_t _C) {return (iswctype(_C,_PUNCT|_ALPHA|_DIGIT)); } 156 | __CRT_INLINE int __cdecl iswcntrl(wint_t _C) {return (iswctype(_C,_CONTROL)); } 157 | __CRT_INLINE int __cdecl iswascii(wint_t _C) {return ((unsigned)(_C) < 0x80); } 158 | __CRT_INLINE int __cdecl isleadbyte(int _C) {return (__pctype_func()[(unsigned char)(_C)] & _LEADBYTE); } 159 | #endif 160 | #endif 161 | 162 | typedef wchar_t wctrans_t; 163 | wint_t __cdecl towctrans(wint_t,wctrans_t); 164 | wctrans_t __cdecl wctrans(const char *); 165 | wctype_t __cdecl wctype(const char *); 166 | 167 | #ifdef __cplusplus 168 | } 169 | #endif 170 | 171 | #pragma pack(pop) 172 | #endif 173 | -------------------------------------------------------------------------------- /tcc/bin/include/winapi/basetyps.h: -------------------------------------------------------------------------------- 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 | #if !defined(_BASETYPS_H_) 7 | #define _BASETYPS_H_ 8 | 9 | #ifdef __cplusplus 10 | #define EXTERN_C extern "C" 11 | #else 12 | #define EXTERN_C extern 13 | #endif 14 | 15 | #define STDMETHODCALLTYPE WINAPI 16 | #define STDMETHODVCALLTYPE __cdecl 17 | 18 | #define STDAPICALLTYPE WINAPI 19 | #define STDAPIVCALLTYPE __cdecl 20 | 21 | #define STDAPI EXTERN_C HRESULT WINAPI 22 | #define STDAPI_(type) EXTERN_C type WINAPI 23 | 24 | #define STDMETHODIMP HRESULT WINAPI 25 | #define STDMETHODIMP_(type) type WINAPI 26 | 27 | #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE 28 | #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE 29 | 30 | #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE 31 | #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE 32 | 33 | #if defined(__cplusplus) && !defined(CINTERFACE) 34 | 35 | #define __STRUCT__ struct 36 | #define STDMETHOD(method) virtual HRESULT WINAPI method 37 | #define STDMETHOD_(type,method) virtual type WINAPI method 38 | #define STDMETHODV(method) virtual HRESULT STDMETHODVCALLTYPE method 39 | #define STDMETHODV_(type,method) virtual type STDMETHODVCALLTYPE method 40 | #define PURE = 0 41 | #define THIS_ 42 | #define THIS void 43 | #define DECLARE_INTERFACE(iface) __STRUCT__ iface 44 | #define DECLARE_INTERFACE_(iface,baseiface) __STRUCT__ iface : public baseiface 45 | #else 46 | 47 | #ifndef __OBJC__ 48 | #define interface struct 49 | #endif 50 | 51 | #define STDMETHOD(method) HRESULT (WINAPI *method) 52 | #define STDMETHOD_(type,method) type (WINAPI *method) 53 | #define STDMETHODV(method) HRESULT (STDMETHODVCALLTYPE *method) 54 | #define STDMETHODV_(type,method) type (STDMETHODVCALLTYPE *method) 55 | 56 | #define PURE 57 | #define THIS_ INTERFACE *This, 58 | #define THIS INTERFACE *This 59 | #ifdef CONST_VTABLE 60 | #define DECLARE_INTERFACE(iface) typedef struct iface { \ 61 | const struct iface##Vtbl *lpVtbl; } iface; \ 62 | typedef const struct iface##Vtbl iface##Vtbl; \ 63 | const struct iface##Vtbl 64 | #else 65 | #define DECLARE_INTERFACE(iface) typedef struct iface { \ 66 | struct iface##Vtbl *lpVtbl; \ 67 | } iface; \ 68 | typedef struct iface##Vtbl iface##Vtbl; \ 69 | struct iface##Vtbl 70 | #endif 71 | #define DECLARE_INTERFACE_(iface,baseiface) DECLARE_INTERFACE(iface) 72 | #endif 73 | 74 | #include 75 | 76 | #ifndef _ERROR_STATUS_T_DEFINED 77 | #define _ERROR_STATUS_T_DEFINED 78 | typedef unsigned long error_status_t; 79 | #endif 80 | 81 | #ifndef _WCHAR_T_DEFINED 82 | typedef unsigned short wchar_t; 83 | #define _WCHAR_T_DEFINED 84 | #endif 85 | #endif 86 | -------------------------------------------------------------------------------- /tcc/bin/include/winapi/guiddef.h: -------------------------------------------------------------------------------- 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 GUID_DEFINED 7 | #define GUID_DEFINED 8 | typedef struct _GUID { 9 | unsigned long Data1; 10 | unsigned short Data2; 11 | unsigned short Data3; 12 | unsigned char Data4[8 ]; 13 | } GUID; 14 | #endif 15 | 16 | #ifndef FAR 17 | #define FAR 18 | #endif 19 | 20 | #ifndef DECLSPEC_SELECTANY 21 | #define DECLSPEC_SELECTANY __declspec(selectany) 22 | #endif 23 | 24 | #ifndef EXTERN_C 25 | #ifdef __cplusplus 26 | #define EXTERN_C extern "C" 27 | #else 28 | #define EXTERN_C extern 29 | #endif 30 | #endif 31 | 32 | #ifdef DEFINE_GUID 33 | #undef DEFINE_GUID 34 | #endif 35 | 36 | #ifdef INITGUID 37 | #ifdef __cplusplus 38 | #define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID DECLSPEC_SELECTANY name = { l,w1,w2,{ b1,b2,b3,b4,b5,b6,b7,b8 } } 39 | #else 40 | #define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID DECLSPEC_SELECTANY name = { l,w1,w2,{ b1,b2,b3,b4,b5,b6,b7,b8 } } 41 | #endif 42 | #else 43 | #define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID name 44 | #endif 45 | 46 | #define DEFINE_OLEGUID(name,l,w1,w2) DEFINE_GUID(name,l,w1,w2,0xC0,0,0,0,0,0,0,0x46) 47 | 48 | #ifndef _GUIDDEF_H_ 49 | #define _GUIDDEF_H_ 50 | 51 | #ifndef __LPGUID_DEFINED__ 52 | #define __LPGUID_DEFINED__ 53 | typedef GUID *LPGUID; 54 | #endif 55 | 56 | #ifndef __LPCGUID_DEFINED__ 57 | #define __LPCGUID_DEFINED__ 58 | typedef const GUID *LPCGUID; 59 | #endif 60 | 61 | #ifndef __IID_DEFINED__ 62 | #define __IID_DEFINED__ 63 | 64 | typedef GUID IID; 65 | typedef IID *LPIID; 66 | #define IID_NULL GUID_NULL 67 | #define IsEqualIID(riid1,riid2) IsEqualGUID(riid1,riid2) 68 | typedef GUID CLSID; 69 | typedef CLSID *LPCLSID; 70 | #define CLSID_NULL GUID_NULL 71 | #define IsEqualCLSID(rclsid1,rclsid2) IsEqualGUID(rclsid1,rclsid2) 72 | typedef GUID FMTID; 73 | typedef FMTID *LPFMTID; 74 | #define FMTID_NULL GUID_NULL 75 | #define IsEqualFMTID(rfmtid1,rfmtid2) IsEqualGUID(rfmtid1,rfmtid2) 76 | 77 | #ifdef __midl_proxy 78 | #define __MIDL_CONST 79 | #else 80 | #define __MIDL_CONST const 81 | #endif 82 | 83 | #ifndef _REFGUID_DEFINED 84 | #define _REFGUID_DEFINED 85 | #ifdef __cplusplus 86 | #define REFGUID const GUID & 87 | #else 88 | #define REFGUID const GUID *__MIDL_CONST 89 | #endif 90 | #endif 91 | 92 | #ifndef _REFIID_DEFINED 93 | #define _REFIID_DEFINED 94 | #ifdef __cplusplus 95 | #define REFIID const IID & 96 | #else 97 | #define REFIID const IID *__MIDL_CONST 98 | #endif 99 | #endif 100 | 101 | #ifndef _REFCLSID_DEFINED 102 | #define _REFCLSID_DEFINED 103 | #ifdef __cplusplus 104 | #define REFCLSID const IID & 105 | #else 106 | #define REFCLSID const IID *__MIDL_CONST 107 | #endif 108 | #endif 109 | 110 | #ifndef _REFFMTID_DEFINED 111 | #define _REFFMTID_DEFINED 112 | #ifdef __cplusplus 113 | #define REFFMTID const IID & 114 | #else 115 | #define REFFMTID const IID *__MIDL_CONST 116 | #endif 117 | #endif 118 | #endif 119 | 120 | #ifndef _SYS_GUID_OPERATORS_ 121 | #define _SYS_GUID_OPERATORS_ 122 | #include 123 | 124 | #ifdef __cplusplus 125 | __inline int InlineIsEqualGUID(REFGUID rguid1,REFGUID rguid2) { 126 | return (((unsigned long *) &rguid1)[0]==((unsigned long *) &rguid2)[0] && ((unsigned long *) &rguid1)[1]==((unsigned long *) &rguid2)[1] && 127 | ((unsigned long *) &rguid1)[2]==((unsigned long *) &rguid2)[2] && ((unsigned long *) &rguid1)[3]==((unsigned long *) &rguid2)[3]); 128 | } 129 | __inline int IsEqualGUID(REFGUID rguid1,REFGUID rguid2) { return !memcmp(&rguid1,&rguid2,sizeof(GUID)); } 130 | #else 131 | #define InlineIsEqualGUID(rguid1,rguid2) (((unsigned long *) rguid1)[0]==((unsigned long *) rguid2)[0] && ((unsigned long *) rguid1)[1]==((unsigned long *) rguid2)[1] && ((unsigned long *) rguid1)[2]==((unsigned long *) rguid2)[2] && ((unsigned long *) rguid1)[3]==((unsigned long *) rguid2)[3]) 132 | #define IsEqualGUID(rguid1,rguid2) (!memcmp(rguid1,rguid2,sizeof(GUID))) 133 | #endif 134 | 135 | #ifdef __INLINE_ISEQUAL_GUID 136 | #undef IsEqualGUID 137 | #define IsEqualGUID(rguid1,rguid2) InlineIsEqualGUID(rguid1,rguid2) 138 | #endif 139 | 140 | #define IsEqualIID(riid1,riid2) IsEqualGUID(riid1,riid2) 141 | #define IsEqualCLSID(rclsid1,rclsid2) IsEqualGUID(rclsid1,rclsid2) 142 | 143 | #if !defined _SYS_GUID_OPERATOR_EQ_ && !defined _NO_SYS_GUID_OPERATOR_EQ_ 144 | #define _SYS_GUID_OPERATOR_EQ_ 145 | #ifdef __cplusplus 146 | __inline int operator==(REFGUID guidOne,REFGUID guidOther) { return IsEqualGUID(guidOne,guidOther); } 147 | __inline int operator!=(REFGUID guidOne,REFGUID guidOther) { return !(guidOne==guidOther); } 148 | #endif 149 | #endif 150 | #endif 151 | #endif 152 | -------------------------------------------------------------------------------- /tcc/bin/include/winapi/intrin.h: -------------------------------------------------------------------------------- 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 __INTRIN_H_ 7 | #define __INTRIN_H_ 8 | 9 | //!__TINYC__: intrinsic stuff removed 10 | 11 | #endif /* end __INTRIN_H_ */ 12 | -------------------------------------------------------------------------------- /tcc/bin/include/winapi/poppack.h: -------------------------------------------------------------------------------- 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 | #if !(defined(lint) || defined(RC_INVOKED)) 7 | #pragma pack(pop) 8 | #endif 9 | -------------------------------------------------------------------------------- /tcc/bin/include/winapi/pshpack1.h: -------------------------------------------------------------------------------- 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 | #if !(defined(lint) || defined(RC_INVOKED)) 7 | #pragma pack(push,1) 8 | #endif 9 | -------------------------------------------------------------------------------- /tcc/bin/include/winapi/pshpack2.h: -------------------------------------------------------------------------------- 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 | #if !(defined(lint) || defined(RC_INVOKED)) 7 | #pragma pack(push,2) 8 | #endif 9 | -------------------------------------------------------------------------------- /tcc/bin/include/winapi/pshpack4.h: -------------------------------------------------------------------------------- 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 | #if !(defined(lint) || defined(RC_INVOKED)) 7 | #pragma pack(push,4) 8 | #endif 9 | -------------------------------------------------------------------------------- /tcc/bin/include/winapi/pshpack8.h: -------------------------------------------------------------------------------- 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 | #if !(defined(lint) || defined(RC_INVOKED)) 7 | #pragma pack(push,8) 8 | #endif 9 | -------------------------------------------------------------------------------- /tcc/bin/include/winapi/reason.h: -------------------------------------------------------------------------------- 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 | #if !defined SENTINEL_Reason 7 | #define SENTINEL_Reason 8 | 9 | #define SHTDN_REASON_FLAG_COMMENT_REQUIRED 0x01000000 10 | #define SHTDN_REASON_FLAG_DIRTY_PROBLEM_ID_REQUIRED 0x02000000 11 | #define SHTDN_REASON_FLAG_CLEAN_UI 0x04000000 12 | #define SHTDN_REASON_FLAG_DIRTY_UI 0x08000000 13 | #define SHTDN_REASON_FLAG_USER_DEFINED 0x40000000 14 | #define SHTDN_REASON_FLAG_PLANNED 0x80000000 15 | #define SHTDN_REASON_MAJOR_OTHER 0x00000000 16 | #define SHTDN_REASON_MAJOR_NONE 0x00000000 17 | #define SHTDN_REASON_MAJOR_HARDWARE 0x00010000 18 | #define SHTDN_REASON_MAJOR_OPERATINGSYSTEM 0x00020000 19 | #define SHTDN_REASON_MAJOR_SOFTWARE 0x00030000 20 | #define SHTDN_REASON_MAJOR_APPLICATION 0x00040000 21 | #define SHTDN_REASON_MAJOR_SYSTEM 0x00050000 22 | #define SHTDN_REASON_MAJOR_POWER 0x00060000 23 | #define SHTDN_REASON_MAJOR_LEGACY_API 0x00070000 24 | #define SHTDN_REASON_MINOR_OTHER 0x00000000 25 | #define SHTDN_REASON_MINOR_NONE 0x000000ff 26 | #define SHTDN_REASON_MINOR_MAINTENANCE 0x00000001 27 | #define SHTDN_REASON_MINOR_INSTALLATION 0x00000002 28 | #define SHTDN_REASON_MINOR_UPGRADE 0x00000003 29 | #define SHTDN_REASON_MINOR_RECONFIG 0x00000004 30 | #define SHTDN_REASON_MINOR_HUNG 0x00000005 31 | #define SHTDN_REASON_MINOR_UNSTABLE 0x00000006 32 | #define SHTDN_REASON_MINOR_DISK 0x00000007 33 | #define SHTDN_REASON_MINOR_PROCESSOR 0x00000008 34 | #define SHTDN_REASON_MINOR_NETWORKCARD 0x00000009 35 | #define SHTDN_REASON_MINOR_POWER_SUPPLY 0x0000000a 36 | #define SHTDN_REASON_MINOR_CORDUNPLUGGED 0x0000000b 37 | #define SHTDN_REASON_MINOR_ENVIRONMENT 0x0000000c 38 | #define SHTDN_REASON_MINOR_HARDWARE_DRIVER 0x0000000d 39 | #define SHTDN_REASON_MINOR_OTHERDRIVER 0x0000000e 40 | #define SHTDN_REASON_MINOR_BLUESCREEN 0x0000000F 41 | #define SHTDN_REASON_MINOR_SERVICEPACK 0x00000010 42 | #define SHTDN_REASON_MINOR_HOTFIX 0x00000011 43 | #define SHTDN_REASON_MINOR_SECURITYFIX 0x00000012 44 | #define SHTDN_REASON_MINOR_SECURITY 0x00000013 45 | #define SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY 0x00000014 46 | #define SHTDN_REASON_MINOR_WMI 0x00000015 47 | #define SHTDN_REASON_MINOR_SERVICEPACK_UNINSTALL 0x00000016 48 | #define SHTDN_REASON_MINOR_HOTFIX_UNINSTALL 0x00000017 49 | #define SHTDN_REASON_MINOR_SECURITYFIX_UNINSTALL 0x00000018 50 | #define SHTDN_REASON_MINOR_MMC 0x00000019 51 | #define SHTDN_REASON_MINOR_SYSTEMRESTORE 0x0000001a 52 | #define SHTDN_REASON_MINOR_TERMSRV 0x00000020 53 | #define SHTDN_REASON_MINOR_DC_PROMOTION 0x00000021 54 | #define SHTDN_REASON_MINOR_DC_DEMOTION 0x00000022 55 | #define SHTDN_REASON_UNKNOWN SHTDN_REASON_MINOR_NONE 56 | #define SHTDN_REASON_LEGACY_API (SHTDN_REASON_MAJOR_LEGACY_API | SHTDN_REASON_FLAG_PLANNED) 57 | #define SHTDN_REASON_VALID_BIT_MASK 0xc0ffffff 58 | 59 | #define PCLEANUI (SHTDN_REASON_FLAG_PLANNED | SHTDN_REASON_FLAG_CLEAN_UI) 60 | #define UCLEANUI (SHTDN_REASON_FLAG_CLEAN_UI) 61 | #define PDIRTYUI (SHTDN_REASON_FLAG_PLANNED | SHTDN_REASON_FLAG_DIRTY_UI) 62 | #define UDIRTYUI (SHTDN_REASON_FLAG_DIRTY_UI) 63 | 64 | #define MAX_REASON_NAME_LEN 64 65 | #define MAX_REASON_DESC_LEN 256 66 | #define MAX_REASON_BUGID_LEN 32 67 | #define MAX_REASON_COMMENT_LEN 512 68 | #define SHUTDOWN_TYPE_LEN 32 69 | 70 | #define POLICY_SHOWREASONUI_NEVER 0 71 | #define POLICY_SHOWREASONUI_ALWAYS 1 72 | #define POLICY_SHOWREASONUI_WORKSTATIONONLY 2 73 | #define POLICY_SHOWREASONUI_SERVERONLY 3 74 | 75 | #define SNAPSHOT_POLICY_NEVER 0 76 | #define SNAPSHOT_POLICY_ALWAYS 1 77 | #define SNAPSHOT_POLICY_UNPLANNED 2 78 | 79 | #define MAX_NUM_REASONS 256 80 | #endif 81 | -------------------------------------------------------------------------------- /tcc/bin/include/winapi/specstrings.h: -------------------------------------------------------------------------------- 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 | 7 | #define __specstrings 8 | -------------------------------------------------------------------------------- /tcc/bin/include/winapi/tvout.h: -------------------------------------------------------------------------------- 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 __TVOUT__ 7 | #define __TVOUT__ 8 | 9 | #include 10 | 11 | typedef struct _VIDEOPARAMETERS { 12 | GUID Guid; 13 | ULONG dwOffset; 14 | ULONG dwCommand; 15 | ULONG dwFlags; 16 | ULONG dwMode; 17 | ULONG dwTVStandard; 18 | ULONG dwAvailableModes; 19 | ULONG dwAvailableTVStandard; 20 | ULONG dwFlickerFilter; 21 | ULONG dwOverScanX; 22 | ULONG dwOverScanY; 23 | ULONG dwMaxUnscaledX; 24 | ULONG dwMaxUnscaledY; 25 | ULONG dwPositionX; 26 | ULONG dwPositionY; 27 | ULONG dwBrightness; 28 | ULONG dwContrast; 29 | ULONG dwCPType; 30 | ULONG dwCPCommand; 31 | ULONG dwCPStandard; 32 | ULONG dwCPKey; 33 | ULONG bCP_APSTriggerBits; 34 | UCHAR bOEMCopyProtection[256]; 35 | } VIDEOPARAMETERS,*PVIDEOPARAMETERS,*LPVIDEOPARAMETERS; 36 | 37 | #define VP_COMMAND_GET 0x0001 38 | #define VP_COMMAND_SET 0x0002 39 | 40 | #define VP_FLAGS_TV_MODE 0x0001 41 | #define VP_FLAGS_TV_STANDARD 0x0002 42 | #define VP_FLAGS_FLICKER 0x0004 43 | #define VP_FLAGS_OVERSCAN 0x0008 44 | #define VP_FLAGS_MAX_UNSCALED 0x0010 45 | #define VP_FLAGS_POSITION 0x0020 46 | #define VP_FLAGS_BRIGHTNESS 0x0040 47 | #define VP_FLAGS_CONTRAST 0x0080 48 | #define VP_FLAGS_COPYPROTECT 0x0100 49 | 50 | #define VP_MODE_WIN_GRAPHICS 0x0001 51 | #define VP_MODE_TV_PLAYBACK 0x0002 52 | 53 | #define VP_TV_STANDARD_NTSC_M 0x0001 54 | #define VP_TV_STANDARD_NTSC_M_J 0x0002 55 | #define VP_TV_STANDARD_PAL_B 0x0004 56 | #define VP_TV_STANDARD_PAL_D 0x0008 57 | #define VP_TV_STANDARD_PAL_H 0x0010 58 | #define VP_TV_STANDARD_PAL_I 0x0020 59 | #define VP_TV_STANDARD_PAL_M 0x0040 60 | #define VP_TV_STANDARD_PAL_N 0x0080 61 | #define VP_TV_STANDARD_SECAM_B 0x0100 62 | #define VP_TV_STANDARD_SECAM_D 0x0200 63 | #define VP_TV_STANDARD_SECAM_G 0x0400 64 | #define VP_TV_STANDARD_SECAM_H 0x0800 65 | #define VP_TV_STANDARD_SECAM_K 0x1000 66 | #define VP_TV_STANDARD_SECAM_K1 0x2000 67 | #define VP_TV_STANDARD_SECAM_L 0x4000 68 | #define VP_TV_STANDARD_WIN_VGA 0x8000 69 | #define VP_TV_STANDARD_NTSC_433 0x00010000 70 | #define VP_TV_STANDARD_PAL_G 0x00020000 71 | #define VP_TV_STANDARD_PAL_60 0x00040000 72 | #define VP_TV_STANDARD_SECAM_L1 0x00080000 73 | 74 | #define VP_CP_TYPE_APS_TRIGGER 0x0001 75 | #define VP_CP_TYPE_MACROVISION 0x0002 76 | #define VP_CP_CMD_ACTIVATE 0x0001 77 | #define VP_CP_CMD_DEACTIVATE 0x0002 78 | #define VP_CP_CMD_CHANGE 0x0004 79 | #endif 80 | -------------------------------------------------------------------------------- /tcc/bin/include/winapi/windows.h: -------------------------------------------------------------------------------- 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 _WINDOWS_ 7 | #define _WINDOWS_ 8 | 9 | #ifndef WINVER 10 | #define WINVER 0x0502 11 | #endif 12 | 13 | #include <_mingw.h> 14 | 15 | #ifndef _INC_WINDOWS 16 | #define _INC_WINDOWS 17 | 18 | #if defined(RC_INVOKED) && !defined(NOWINRES) 19 | 20 | #include 21 | #else 22 | 23 | #ifdef RC_INVOKED 24 | #define NOATOM 25 | #define NOGDI 26 | #define NOGDICAPMASKS 27 | #define NOMETAFILE 28 | #define NOMINMAX 29 | #define NOMSG 30 | #define NOOPENFILE 31 | #define NORASTEROPS 32 | #define NOSCROLL 33 | #define NOSOUND 34 | #define NOSYSMETRICS 35 | #define NOTEXTMETRIC 36 | #define NOWH 37 | #define NOCOMM 38 | #define NOKANJI 39 | #define NOCRYPT 40 | #define NOMCX 41 | #endif 42 | 43 | #if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) && (defined(_X86_) && !defined(__x86_64)) 44 | #define I_X86_ 45 | #endif 46 | 47 | #if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(__x86_64) 48 | #define _AMD64_ 49 | #endif 50 | 51 | #if !defined(I_X86_) && !(defined(_X86_) && !defined(__x86_64)) && !defined(_AMD64_) && defined(__ia64__) 52 | #if !defined(_IA64_) 53 | #define _IA64_ 54 | #endif 55 | #endif 56 | 57 | #ifndef RC_INVOKED 58 | #include 59 | #include 60 | #endif 61 | 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | 72 | #ifndef WIN32_LEAN_AND_MEAN 73 | #include 74 | #include 75 | #include 76 | #include 77 | #include 78 | #include 79 | #include 80 | #include 81 | #include 82 | #include 83 | #include 84 | #ifndef NOCRYPT 85 | #include 86 | #include 87 | #include 88 | #endif 89 | 90 | #ifndef NOUSER 91 | #ifndef NOGDI 92 | #include 93 | #ifdef INC_OLE1 94 | #include 95 | #else 96 | #include 97 | #endif 98 | #include 99 | #endif 100 | #endif 101 | #endif 102 | 103 | #include 104 | 105 | #ifdef INC_OLE2 106 | #include 107 | #endif 108 | 109 | #ifndef NOSERVICE 110 | #include 111 | #endif 112 | 113 | #ifndef NOMCX 114 | #include 115 | #endif 116 | 117 | #ifndef NOIME 118 | #include 119 | #endif 120 | 121 | #endif 122 | #endif 123 | #endif 124 | -------------------------------------------------------------------------------- /tcc/bin/lib/alloca86-bt.S: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------- */ 2 | /* alloca86-bt.S */ 3 | 4 | .globl __bound_alloca 5 | 6 | __bound_alloca: 7 | pop %edx 8 | pop %eax 9 | mov %eax, %ecx 10 | add $3,%eax 11 | and $-4,%eax 12 | jz p6 13 | 14 | #ifdef TCC_TARGET_PE 15 | p4: 16 | cmp $4096,%eax 17 | jle p5 18 | sub $4096,%esp 19 | sub $4096,%eax 20 | test %eax,(%esp) 21 | jmp p4 22 | 23 | p5: 24 | #endif 25 | 26 | sub %eax,%esp 27 | mov %esp,%eax 28 | 29 | push %edx 30 | push %eax 31 | push %ecx 32 | push %eax 33 | call __bound_new_region 34 | add $8, %esp 35 | pop %eax 36 | pop %edx 37 | 38 | p6: 39 | push %edx 40 | push %edx 41 | ret 42 | 43 | /* mark stack as nonexecutable */ 44 | #if defined __ELF__ && defined __linux__ 45 | .section .note.GNU-stack,"",@progbits 46 | #endif 47 | /* ---------------------------------------------- */ 48 | -------------------------------------------------------------------------------- /tcc/bin/lib/alloca86.S: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------- */ 2 | /* alloca86.S */ 3 | 4 | .globl alloca 5 | 6 | alloca: 7 | pop %edx 8 | pop %eax 9 | add $3,%eax 10 | and $-4,%eax 11 | jz p3 12 | 13 | #ifdef TCC_TARGET_PE 14 | p1: 15 | cmp $4096,%eax 16 | jle p2 17 | sub $4096,%esp 18 | sub $4096,%eax 19 | test %eax,(%esp) 20 | jmp p1 21 | p2: 22 | #endif 23 | 24 | sub %eax,%esp 25 | mov %esp,%eax 26 | p3: 27 | push %edx 28 | push %edx 29 | ret 30 | 31 | /* mark stack as nonexecutable */ 32 | #if defined __ELF__ && defined __linux__ 33 | .section .note.GNU-stack,"",@progbits 34 | #endif 35 | /* ---------------------------------------------- */ 36 | -------------------------------------------------------------------------------- /tcc/bin/lib/chkstk.S: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------- */ 2 | /* chkstk86.s */ 3 | 4 | /* ---------------------------------------------- */ 5 | #ifndef TCC_TARGET_X86_64 6 | /* ---------------------------------------------- */ 7 | 8 | .globl __chkstk 9 | 10 | __chkstk: 11 | xchg (%esp),%ebp /* store ebp, get ret.addr */ 12 | push %ebp /* push ret.addr */ 13 | lea 4(%esp),%ebp /* setup frame ptr */ 14 | push %ecx /* save ecx */ 15 | mov %ebp,%ecx 16 | P0: 17 | sub $4096,%ecx 18 | test %eax,(%ecx) 19 | sub $4096,%eax 20 | cmp $4096,%eax 21 | jge P0 22 | sub %eax,%ecx 23 | test %eax,(%ecx) 24 | 25 | mov %esp,%eax 26 | mov %ecx,%esp 27 | mov (%eax),%ecx /* restore ecx */ 28 | jmp *4(%eax) 29 | 30 | /* ---------------------------------------------- */ 31 | #else 32 | /* ---------------------------------------------- */ 33 | 34 | .globl __chkstk 35 | 36 | __chkstk: 37 | xchg (%rsp),%rbp /* store ebp, get ret.addr */ 38 | push %rbp /* push ret.addr */ 39 | lea 8(%rsp),%rbp /* setup frame ptr */ 40 | push %rcx /* save ecx */ 41 | mov %rbp,%rcx 42 | movslq %eax,%rax 43 | P0: 44 | sub $4096,%rcx 45 | test %rax,(%rcx) 46 | sub $4096,%rax 47 | cmp $4096,%rax 48 | jge P0 49 | sub %rax,%rcx 50 | test %rax,(%rcx) 51 | 52 | mov %rsp,%rax 53 | mov %rcx,%rsp 54 | mov (%rax),%rcx /* restore ecx */ 55 | jmp *8(%rax) 56 | 57 | /* ---------------------------------------------- */ 58 | /* setjmp/longjmp support */ 59 | 60 | .globl tinyc_getbp 61 | tinyc_getbp: 62 | mov %rbp,%rax 63 | ret 64 | 65 | /* ---------------------------------------------- */ 66 | #endif 67 | /* ---------------------------------------------- */ 68 | 69 | 70 | /* ---------------------------------------------- */ 71 | #ifndef TCC_TARGET_X86_64 72 | /* ---------------------------------------------- */ 73 | 74 | /* 75 | int _except_handler3( 76 | PEXCEPTION_RECORD exception_record, 77 | PEXCEPTION_REGISTRATION registration, 78 | PCONTEXT context, 79 | PEXCEPTION_REGISTRATION dispatcher 80 | ); 81 | 82 | int __cdecl _XcptFilter( 83 | unsigned long xcptnum, 84 | PEXCEPTION_POINTERS pxcptinfoptrs 85 | ); 86 | 87 | struct _sehrec { 88 | void *esp; // 0 89 | void *exception_pointers; // 1 90 | void *prev; // 2 91 | void *handler; // 3 92 | void *scopetable; // 4 93 | int trylevel; // 5 94 | void *ebp // 6 95 | }; 96 | 97 | // this is what the assembler code below means: 98 | __try 99 | { 100 | // ... 101 | } 102 | __except (_XcptFilter(GetExceptionCode(), GetExceptionInformation())) 103 | { 104 | exit(GetExceptionCode()); 105 | } 106 | */ 107 | 108 | .globl _exception_info 109 | _exception_info: 110 | mov 1*4-24(%ebp),%eax 111 | ret 112 | 113 | .globl _exception_code 114 | _exception_code: 115 | call _exception_info 116 | mov (%eax),%eax 117 | mov (%eax),%eax 118 | ret 119 | 120 | seh_filter: 121 | call _exception_info 122 | push %eax 123 | call _exception_code 124 | push %eax 125 | call _XcptFilter 126 | add $ 8,%esp 127 | ret 128 | 129 | seh_except: 130 | mov 0*4-24(%ebp),%esp 131 | call _exception_code 132 | push %eax 133 | call _exit 134 | 135 | // msvcrt wants scopetables aligned and in read-only segment (using .text) 136 | .align 4 137 | seh_scopetable: 138 | .long -1 139 | .long seh_filter 140 | .long seh_except 141 | 142 | seh_handler: 143 | jmp _except_handler3 144 | 145 | .globl ___try__ 146 | ___try__: 147 | .globl __try__ 148 | __try__: 149 | push %ebp 150 | mov 8(%esp),%ebp 151 | 152 | // void *esp; 153 | lea 12(%esp),%eax 154 | mov %eax,0*4(%ebp) 155 | 156 | // void *exception_pointers; 157 | xor %eax,%eax 158 | mov %eax,1*4(%ebp) 159 | 160 | // void *prev; 161 | mov %fs:0,%eax 162 | mov %eax,2*4(%ebp) 163 | 164 | // void *handler; 165 | mov $ seh_handler,%eax 166 | mov %eax,3*4(%ebp) 167 | 168 | // void *scopetable; 169 | mov $ seh_scopetable,%eax 170 | mov %eax,4*4(%ebp) 171 | 172 | // int trylevel; 173 | xor %eax,%eax 174 | mov %eax,5*4(%ebp) 175 | 176 | // register new SEH 177 | lea 2*4(%ebp),%eax 178 | mov %eax,%fs:0 179 | 180 | pop %ebp 181 | ret 182 | 183 | /* ---------------------------------------------- */ 184 | #else 185 | /* ---------------------------------------------- */ 186 | 187 | /* SEH on x86-64 not implemented */ 188 | 189 | /* ---------------------------------------------- */ 190 | #endif 191 | /* ---------------------------------------------- */ 192 | -------------------------------------------------------------------------------- /tcc/bin/lib/crt1.c: -------------------------------------------------------------------------------- 1 | // ============================================= 2 | // crt1.c 3 | 4 | #include 5 | 6 | #define __UNKNOWN_APP 0 7 | #define __CONSOLE_APP 1 8 | #define __GUI_APP 2 9 | void __set_app_type(int); 10 | void _controlfp(unsigned a, unsigned b); 11 | 12 | typedef struct 13 | { 14 | int newmode; 15 | } _startupinfo; 16 | 17 | void __getmainargs(int *pargc, char ***pargv, char ***penv, int globb, _startupinfo*); 18 | int main(int argc, char **argv, char **env); 19 | 20 | int _start(void) 21 | { 22 | __TRY__ 23 | int argc; char **argv; char **env; int ret; 24 | _startupinfo start_info = {0}; 25 | 26 | _controlfp(0x10000, 0x30000); 27 | __set_app_type(__CONSOLE_APP); 28 | __getmainargs(&argc, &argv, &env, 0, &start_info); 29 | 30 | ret = main(argc, argv, env); 31 | exit(ret); 32 | } 33 | 34 | // ============================================= 35 | -------------------------------------------------------------------------------- /tcc/bin/lib/dllcrt1.c: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | 3 | #include 4 | 5 | BOOL WINAPI DllMain (HANDLE hDll, DWORD dwReason, LPVOID lpReserved); 6 | 7 | BOOL WINAPI _dllstart(HANDLE hDll, DWORD dwReason, LPVOID lpReserved) 8 | { 9 | BOOL bRet; 10 | bRet = DllMain (hDll, dwReason, lpReserved); 11 | return bRet; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /tcc/bin/lib/dllmain.c: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | 3 | #include 4 | 5 | BOOL WINAPI DllMain (HANDLE hDll, DWORD dwReason, LPVOID lpReserved) 6 | { 7 | return TRUE; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /tcc/bin/lib/libtcc1.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/junjiexing/libtcc_example/e5902e8f023b0a6a76d1b3c45ab76945453e6f59/tcc/bin/lib/libtcc1.a -------------------------------------------------------------------------------- /tcc/bin/lib/wincrt1.c: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | 3 | #include 4 | #include 5 | 6 | #define __UNKNOWN_APP 0 7 | #define __CONSOLE_APP 1 8 | #define __GUI_APP 2 9 | void __set_app_type(int); 10 | void _controlfp(unsigned a, unsigned b); 11 | 12 | int _winstart(void) 13 | { 14 | __TRY__ 15 | char *szCmd; 16 | STARTUPINFO startinfo; 17 | int fShow; 18 | int ret; 19 | 20 | __set_app_type(__GUI_APP); 21 | _controlfp(0x10000, 0x30000); 22 | 23 | szCmd = GetCommandLine(); 24 | if (szCmd) { 25 | while (' ' == *szCmd) 26 | szCmd++; 27 | if ('\"' == *szCmd) { 28 | while (*++szCmd) 29 | if ('\"' == *szCmd) { 30 | szCmd++; 31 | break; 32 | } 33 | } else { 34 | while (*szCmd && ' ' != *szCmd) 35 | szCmd++; 36 | } 37 | while (' ' == *szCmd) 38 | szCmd++; 39 | } 40 | 41 | GetStartupInfo(&startinfo); 42 | fShow = startinfo.wShowWindow; 43 | if (0 == (startinfo.dwFlags & STARTF_USESHOWWINDOW)) 44 | fShow = SW_SHOWDEFAULT; 45 | 46 | ret = WinMain(GetModuleHandle(NULL), NULL, szCmd, fShow); 47 | exit(ret); 48 | } 49 | 50 | int _runwinmain(int argc, char **argv) 51 | { 52 | char *szCmd, *p; 53 | 54 | p = GetCommandLine(); 55 | szCmd = NULL; 56 | if (argc > 1) 57 | szCmd = strstr(p, argv[1]); 58 | if (NULL == szCmd) 59 | szCmd = ""; 60 | else if (szCmd > p && szCmd[-1] == '\"') 61 | --szCmd; 62 | return WinMain(GetModuleHandle(NULL), NULL, szCmd, SW_SHOWDEFAULT); 63 | } 64 | 65 | -------------------------------------------------------------------------------- /tcc/bin/libtcc.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/junjiexing/libtcc_example/e5902e8f023b0a6a76d1b3c45ab76945453e6f59/tcc/bin/libtcc.exp -------------------------------------------------------------------------------- /tcc/bin/libtcc1.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/junjiexing/libtcc_example/e5902e8f023b0a6a76d1b3c45ab76945453e6f59/tcc/bin/libtcc1.o -------------------------------------------------------------------------------- /tcc/bin/wincrt1.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/junjiexing/libtcc_example/e5902e8f023b0a6a76d1b3c45ab76945453e6f59/tcc/bin/wincrt1.o -------------------------------------------------------------------------------- /tcc/include/libtcc.h: -------------------------------------------------------------------------------- 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 | struct TCCState; 13 | 14 | typedef struct TCCState TCCState; 15 | 16 | /* create a new TCC compilation context */ 17 | LIBTCCAPI TCCState *tcc_new(void); 18 | 19 | /* free a TCC compilation context */ 20 | LIBTCCAPI void tcc_delete(TCCState *s); 21 | 22 | /* set CONFIG_TCCDIR at runtime */ 23 | LIBTCCAPI void tcc_set_lib_path(TCCState *s, const char *path); 24 | 25 | /* set error/warning display callback */ 26 | LIBTCCAPI void tcc_set_error_func(TCCState *s, void *error_opaque, 27 | void (*error_func)(void *opaque, const char *msg)); 28 | 29 | /* set options as from command line (multiple supported) */ 30 | LIBTCCAPI int tcc_set_options(TCCState *s, const char *str); 31 | 32 | /*****************************/ 33 | /* preprocessor */ 34 | 35 | /* add include path */ 36 | LIBTCCAPI int tcc_add_include_path(TCCState *s, const char *pathname); 37 | 38 | /* add in system include path */ 39 | LIBTCCAPI int tcc_add_sysinclude_path(TCCState *s, const char *pathname); 40 | 41 | /* define preprocessor symbol 'sym'. Can put optional value */ 42 | LIBTCCAPI void tcc_define_symbol(TCCState *s, const char *sym, const char *value); 43 | 44 | /* undefine preprocess symbol 'sym' */ 45 | LIBTCCAPI void tcc_undefine_symbol(TCCState *s, const char *sym); 46 | 47 | /*****************************/ 48 | /* compiling */ 49 | 50 | /* add a file (C file, dll, object, library, ld script). Return -1 if error. */ 51 | LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename); 52 | 53 | /* compile a string containing a C source. Return -1 if error. */ 54 | LIBTCCAPI int tcc_compile_string(TCCState *s, const char *buf); 55 | 56 | /*****************************/ 57 | /* linking commands */ 58 | 59 | /* set output type. MUST BE CALLED before any compilation */ 60 | LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type); 61 | #define TCC_OUTPUT_MEMORY 0 /* output will be run in memory (default) */ 62 | #define TCC_OUTPUT_EXE 1 /* executable file */ 63 | #define TCC_OUTPUT_DLL 2 /* dynamic library */ 64 | #define TCC_OUTPUT_OBJ 3 /* object file */ 65 | #define TCC_OUTPUT_PREPROCESS 4 /* only preprocess (used internally) */ 66 | 67 | /* equivalent to -Lpath option */ 68 | LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname); 69 | 70 | /* the library name is the same as the argument of the '-l' option */ 71 | LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname); 72 | 73 | /* add a symbol to the compiled program */ 74 | LIBTCCAPI int tcc_add_symbol(TCCState *s, const char *name, const void *val); 75 | 76 | /* output an executable, library or object file. DO NOT call 77 | tcc_relocate() before. */ 78 | LIBTCCAPI int tcc_output_file(TCCState *s, const char *filename); 79 | 80 | /* link and run main() function and return its value. DO NOT call 81 | tcc_relocate() before. */ 82 | LIBTCCAPI int tcc_run(TCCState *s, int argc, char **argv); 83 | 84 | /* do all relocations (needed before using tcc_get_symbol()) */ 85 | LIBTCCAPI int tcc_relocate(TCCState *s1, void *ptr); 86 | /* possible values for 'ptr': 87 | - TCC_RELOCATE_AUTO : Allocate and manage memory internally 88 | - NULL : return required memory size for the step below 89 | - memory address : copy code to memory passed by the caller 90 | returns -1 if error. */ 91 | #define TCC_RELOCATE_AUTO (void*)1 92 | 93 | /* return symbol value or NULL if not found */ 94 | LIBTCCAPI void *tcc_get_symbol(TCCState *s, const char *name); 95 | 96 | #ifdef __cplusplus 97 | } 98 | #endif 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /tcc/lib/libtcc.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/junjiexing/libtcc_example/e5902e8f023b0a6a76d1b3c45ab76945453e6f59/tcc/lib/libtcc.exp --------------------------------------------------------------------------------