aboutsummaryrefslogtreecommitdiff
path: root/win32/lib
diff options
context:
space:
mode:
authorgrischka <grischka>2016-10-01 20:27:41 +0200
committergrischka <grischka>2016-10-01 20:27:41 +0200
commit8637c1d0ad08d28052efc1de5c38b63acd2c08fc (patch)
tree9aa1f1ecf3e2aceef2f11ff6eef6a5a3e0fd04fa /win32/lib
parent766ba3694dae5b3d2dfbb5c75c4ebf7069a7ce1f (diff)
downloadtinycc-8637c1d0ad08d28052efc1de5c38b63acd2c08fc.tar.gz
tinycc-8637c1d0ad08d28052efc1de5c38b63acd2c08fc.tar.bz2
Remove misc. files
- from win32/include/winapi: various .h The winapi header set cannot be complete no matter what. So lets have just the minimal set necessary to compile the examples. - remove CMake support (hard to keep up to date) - some other files Also, drop useless changes in win32/lib/(win)crt1.c
Diffstat (limited to 'win32/lib')
-rw-r--r--win32/lib/crt1.c49
-rw-r--r--win32/lib/wincrt1.c8
2 files changed, 8 insertions, 49 deletions
diff --git a/win32/lib/crt1.c b/win32/lib/crt1.c
index 1fada8b..7a2d765 100644
--- a/win32/lib/crt1.c
+++ b/win32/lib/crt1.c
@@ -1,9 +1,6 @@
// =============================================
// crt1.c
-// For ExitProcess
-// windows.h header file should be included before any other library include
-#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
@@ -16,47 +13,23 @@
#define _PC_53 0x00010000 // 53 bits
#define _PC_64 0x00000000 // 64 bits
-#ifndef __TRY__
- #ifdef _WIN64
- #define __TRY__
- #else
- #define __TRY__ void __try__(void**), *_sehrec[6]; __try__(_sehrec);
- #endif
-#endif
-
typedef struct
{
int newmode;
} _startupinfo;
-// Prototype of __getmainargs:
-// in msvcrt v6.x : returns void (windows 98, 2000)
-// in msvcrt v7.x : returns int (windows xp and above)
-// Using the last for check the result. A negative value means no success.
-// These are the test results of call to __getmainargs with the heap fully:
-// win 98, 2000 :
-// program termination with error code 255 after call _amsg_exit(8)
-// prints: "runtime error R6008\r\n- not enough space for arguments\r\n"
-// win xp :
-// returns -1
-// win 7, 8 :
-// program termination with error code -1 after call ExitProcess(-1)
-//
-// Checking the return of this function also works on windows 98 and 2000
-// because internally it sets to eax the value of the third parameter.
-// In this case is &env and at that point it is not a negative value.
-
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);
-
-void _start(void);
int main(int argc, char * argv[], char * env[]);
+/* Allow command-line globbing with "int _dowildcard = 1;" in the user source */
+int _dowildcard;
+
void _start(void)
{
__TRY__
- int argc;
+ int argc, ret;
char **argv;
char **env;
_startupinfo start_info;
@@ -67,20 +40,14 @@ void _start(void)
// Set default FP precision to 53 bits (8-byte double)
// _MCW_PC (Precision control) is not supported on
// the ARM and x64 architectures
-#if defined(_X86_) && !defined(__x86_64)
+#ifdef __i386
_controlfp(_PC_53, _MCW_PC);
#endif
start_info.newmode = 0;
- if ( __getmainargs( &argc, &argv, &env, 0, &start_info ) < 0 )
- {
- ExitProcess(-1);
- }
- else
- {
- exit( main(argc, argv, env) );
- }
-
+ __getmainargs( &argc, &argv, &env, _dowildcard, &start_info);
+ ret = main(argc, argv, env);
+ exit(ret);
}
// =============================================
diff --git a/win32/lib/wincrt1.c b/win32/lib/wincrt1.c
index cec75d7..663fd33 100644
--- a/win32/lib/wincrt1.c
+++ b/win32/lib/wincrt1.c
@@ -9,14 +9,6 @@
void __set_app_type(int);
void _controlfp(unsigned a, unsigned b);
-#ifndef __TRY__
- #ifdef _WIN64
- #define __TRY__
- #else
- #define __TRY__ void __try__(void**), *_sehrec[6]; __try__(_sehrec);
- #endif
-#endif
-
int _winstart(void)
{
__TRY__