1 // =============================================
4 // _UNICODE for tchar.h, UNICODE for API
10 #define _UNKNOWN_APP 0
11 #define _CONSOLE_APP 1
14 #define _MCW_PC 0x00030000 // Precision Control
15 #define _PC_24 0x00020000 // 24 bits
16 #define _PC_53 0x00010000 // 53 bits
17 #define _PC_64 0x00000000 // 64 bits
20 #define __tgetmainargs __wgetmainargs
21 #define _tstart _wstart
23 #define _runtmain _runwmain
25 #define __tgetmainargs __getmainargs
26 #define _tstart _start
28 #define _runtmain _runmain
31 typedef struct { int newmode
; } _startupinfo
;
32 int __cdecl
__tgetmainargs(int *pargc
, _TCHAR
***pargv
, _TCHAR
***penv
, int globb
, _startupinfo
*);
33 void __cdecl
__set_app_type(int apptype
);
34 unsigned int __cdecl
_controlfp(unsigned int new_value
, unsigned int mask
);
35 extern int _tmain(int argc
, _TCHAR
* argv
[], _TCHAR
* env
[]);
37 /* Allow command-line globbing with "int _dowildcard = 1;" in the user source */
43 _startupinfo start_info
= {0};
45 // Sets the current application type
46 __set_app_type(_CONSOLE_APP
);
48 // Set default FP precision to 53 bits (8-byte double)
49 // _MCW_PC (Precision control) is not supported on ARM
50 #if defined __i386__ || defined __x86_64__
51 _controlfp(_PC_53
, _MCW_PC
);
54 __tgetmainargs( &__argc
, &__targv
, &_tenviron
, _dowildcard
, &start_info
);
55 exit(_tmain(__argc
, __targv
, _tenviron
));
58 int _runtmain(int argc
, /* as tcc passed in */ char **argv
)
61 _startupinfo start_info
= {0};
63 __tgetmainargs(&__argc
, &__targv
, &_tenviron
, _dowildcard
, &start_info
);
64 /* may be wrong when tcc has received wildcards (*.c) */
66 __targv
+= __argc
- argc
;
73 #if defined __i386__ || defined __x86_64__
74 _controlfp(_PC_53
, _MCW_PC
);
76 return _tmain(__argc
, __targv
, _tenviron
);
79 // =============================================