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
25 #define __tgetmainargs __wgetmainargs
26 #define _tstart _wstart
28 #define _runtmain _runwmain
30 #define __tgetmainargs __getmainargs
31 #define _tstart _start
33 #define _runtmain _runmain
36 int __cdecl
__tgetmainargs(int *pargc
, _TCHAR
***pargv
, _TCHAR
***penv
, int globb
, _startupinfo
*);
37 void __cdecl
__set_app_type(int apptype
);
38 unsigned int __cdecl
_controlfp(unsigned int new_value
, unsigned int mask
);
39 extern int _tmain(int argc
, _TCHAR
* argv
[], _TCHAR
* env
[]);
41 /* Allow command-line globbing with "int _dowildcard = 1;" in the user source */
50 _startupinfo start_info
;
52 // Sets the current application type
53 __set_app_type(_CONSOLE_APP
);
55 // Set default FP precision to 53 bits (8-byte double)
56 // _MCW_PC (Precision control) is not supported on
57 // the ARM and x64 architectures
59 _controlfp(_PC_53
, _MCW_PC
);
62 start_info
.newmode
= 0;
63 __tgetmainargs( &argc
, &argv
, &env
, _dowildcard
, &start_info
);
64 ret
= _tmain(argc
, argv
, env
);
68 int _runtmain(int argc
, /* as tcc passed in */ char **argv
)
72 _TCHAR
**wargv
, **wenv
;
73 _startupinfo start_info
= {0};
75 __tgetmainargs(&wargc
, &wargv
, &wenv
, _dowildcard
, &start_info
);
76 /* may be wrong when tcc has received wildcards (*.c) */
78 wargv
+= wargc
- argc
;
85 _controlfp(_PC_53
, _MCW_PC
);
87 return _tmain(argc
, argv
, _tenviron
);
90 // =============================================