2005-04-17 17:11:15 +04:00
|
|
|
// =============================================
|
|
|
|
// crt1.c
|
|
|
|
|
2014-12-30 06:25:52 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#define _UNKNOWN_APP 0
|
|
|
|
#define _CONSOLE_APP 1
|
|
|
|
#define _GUI_APP 2
|
2005-04-17 17:11:15 +04:00
|
|
|
|
2014-12-30 06:25:52 +03:00
|
|
|
#define _MCW_PC 0x00030000 // Precision Control
|
|
|
|
#define _PC_24 0x00020000 // 24 bits
|
|
|
|
#define _PC_53 0x00010000 // 53 bits
|
|
|
|
#define _PC_64 0x00000000 // 64 bits
|
2005-04-17 17:11:15 +04:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2009-07-19 00:07:10 +04:00
|
|
|
int newmode;
|
2005-04-17 17:11:15 +04:00
|
|
|
} _startupinfo;
|
|
|
|
|
2014-12-30 06:25:52 +03:00
|
|
|
int __cdecl __getmainargs(int *pargc, char ***pargv, char ***penv, int globb, _startupinfo*);
|
|
|
|
void __cdecl __set_app_type(int apptype);
|
|
|
|
unsigned int __cdecl _controlfp(unsigned int new_value, unsigned int mask);
|
|
|
|
int main(int argc, char * argv[], char * env[]);
|
|
|
|
|
2016-10-01 21:27:41 +03:00
|
|
|
/* Allow command-line globbing with "int _dowildcard = 1;" in the user source */
|
|
|
|
int _dowildcard;
|
|
|
|
|
2014-12-30 06:25:52 +03:00
|
|
|
void _start(void)
|
2005-04-17 17:11:15 +04:00
|
|
|
{
|
2010-10-19 15:15:06 +04:00
|
|
|
__TRY__
|
2016-10-01 21:27:41 +03:00
|
|
|
int argc, ret;
|
2014-12-30 06:25:52 +03:00
|
|
|
char **argv;
|
|
|
|
char **env;
|
|
|
|
_startupinfo start_info;
|
|
|
|
|
|
|
|
// Sets the current application type
|
|
|
|
__set_app_type(_CONSOLE_APP);
|
2005-04-17 17:11:15 +04:00
|
|
|
|
2014-12-30 06:25:52 +03:00
|
|
|
// Set default FP precision to 53 bits (8-byte double)
|
|
|
|
// _MCW_PC (Precision control) is not supported on
|
|
|
|
// the ARM and x64 architectures
|
2016-10-01 21:27:41 +03:00
|
|
|
#ifdef __i386
|
2014-12-30 06:25:52 +03:00
|
|
|
_controlfp(_PC_53, _MCW_PC);
|
|
|
|
#endif
|
2005-04-17 17:11:15 +04:00
|
|
|
|
2014-12-30 06:25:52 +03:00
|
|
|
start_info.newmode = 0;
|
2016-10-01 21:27:41 +03:00
|
|
|
__getmainargs( &argc, &argv, &env, _dowildcard, &start_info);
|
|
|
|
ret = main(argc, argv, env);
|
|
|
|
exit(ret);
|
2005-04-17 17:11:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// =============================================
|