- remove outdated files from mingw lib

- remove allowwarnings=true

svn path=/trunk/; revision=38108
This commit is contained in:
Timo Kreuzer 2008-12-15 14:02:28 +00:00
parent 32dfe68057
commit e50e0d8646
14 changed files with 2 additions and 1055 deletions

View file

@ -1,16 +0,0 @@
/*
* CRTfmode.c
* This file has no copyright assigned and is placed in the Public Domain.
* This file is a part of the mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within the package.
*
* Include this object to set _CRT_fmode to a state that will cause
* _mingw32_init_fmode to leave all file modes in their default state
* (basically text mode).
*
* To use this object include the object file in your link command:
* gcc -o foo.exe foo.o CRTfmode.o
*
*/
int _CRT_fmode = 0;

View file

@ -1,16 +0,0 @@
/*
* CRTglob.c
* This file has no copyright assigned and is placed in the Public Domain.
* This file is a part of the mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within the package.
*
* Include this object file to set _CRT_glob to a state that will
* turn on command line globbing by default. NOTE: _CRT_glob has a default
* state of on. Specify CRT_noglob.o to turn off globbing by default.
*
* To use this object include the object file in your link command:
* gcc -o foo.exe foo.o CRTglob.o
*
*/
int _CRT_glob = -1;

View file

@ -1,24 +0,0 @@
/*
* CRTinit.c
* This file has no copyright assigned and is placed in the Public Domain.
* This file is a part of the mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within the package.
*
* A dummy version of _CRT_INIT for MS compatibility. Programs, or more often
* dlls, which use the static version of the MSVC run time are supposed to
* call _CRT_INIT to initialize the run time library in DllMain. This does
* not appear to be necessary when using crtdll or the dll versions of the
* MSVC runtime, so the dummy call simply does nothing.
*
* This object file is included as a standard in the link process as provided
* by the appropriate GCC frontend.
*
* To use this object include the object file in your link command:
* gcc -o foo.exe foo.o CRTinit.o
*
*/
void
_CRT_INIT ()
{
}

View file

@ -1,19 +0,0 @@
#ifdef CRTDLL
#undef CRTDLL
#endif
#include "internal.h"
extern int _dowildcard;
#ifdef WPRFLAG
int __CRTDECL
__wsetargv (void)
#else
int __CRTDECL
__setargv (void)
#endif
{
_dowildcard = 1;
return 0;
}

View file

@ -1,156 +0,0 @@
#include "cpu_features.h"
#if defined(_MSC_VER)
#include <intrin.h>
#endif
/* level 1 edx bits */
#define EDX_CX8 (1 << 8) /* CMPXCHG8B */
#define EDX_CMOV (1 << 15)
#define EDX_MMX (1 << 23)
#define EDX_FXSR (1 << 24) /* FXSAVE and FXRSTOR */
#define EDX_SSE (1 << 25)
#define EDX_SSE2 (1 << 26)
/* level 1 ecx bits */
#define ECX_SSE3 (1 << 0)
#define ECX_CX16 (1 << 13) /* CMPXCHG16B */
/* extended level 0x80000001 edx bits */
#define EDX_3DNOW (1 << 31)
#define EDX_3DNOWP (1 << 30)
#define EDX_LM (1 << 29) /*LONG MODE */
/* Combine the different cpuid flags into a single bitmap. */
unsigned int __cpu_features = 0;
#ifdef __i386__
#if defined(__GNUC__)
#define __cpuid(level,a,b,c,d) \
__asm__ __volatile__ ("cpuid;" \
: "=a" (a), "=b" (b), "=c" (c), "=d" (d)\
: "0" (level))
#elif defined(_MSC_VER)
void ___cpuid (int level, unsigned int * a, unsigned int * b, unsigned int * c, unsigned int * d)
{
int info[4];
__cpuid (info, level);
*a = info[0];
*b = info[1];
*c = info[2];
*d = info[3];
}
#define __cpuid(level,a,b,c,d) \
___cpuid(level, &(a), &(b), &(c), &(d))
#endif
static
unsigned int __detect_cpuid (void)
{
/* Try to change the value of CPUID bit (bit 21) in EFLAGS.
If the bit can be toggled, CPUID is supported. */
#if defined(__GNUC__)
unsigned int eax, ebx;
asm volatile ("pushfl; pushfl; popl %0;"
"movl %0,%1; xorl %2,%0;"
"pushl %0; popfl; pushfl; popl %0; popfl"
: "=&r" (eax), "=&r" (ebx)
: "i" (0x00200000));
return (eax ^ ebx) & 0x00200000;
#elif defined(_MSC_VER)
unsigned int retval;
__asm
{
pushf
pushf
pop eax
mov ebx, eax
xor eax, 00200000h
push eax
popf
pushf
pop eax
popf
xor eax, ebx
mov [retval], eax
}
return retval & 0x00200000;
#endif
}
#endif
void __cpu_features_init (void)
{
#ifdef __i386__
unsigned int eax, ebx, ecx, edx;
if (!__detect_cpuid ())
return;
__cpuid (0, eax, ebx, ecx, edx);
if (eax == 0)
return;
__cpuid (1, eax, ebx, ecx, edx);
if (edx & EDX_CX8)
__cpu_features |= _CRT_CMPXCHG8B;
if (edx & EDX_CMOV)
__cpu_features |= _CRT_CMOV;
if (edx & EDX_MMX)
__cpu_features |= _CRT_MMX;
if (edx & EDX_FXSR)
__cpu_features |= _CRT_FXSR;
if (edx & EDX_SSE)
__cpu_features |= _CRT_SSE;
if (edx & EDX_SSE2)
__cpu_features |= _CRT_SSE2;
if (ecx & ECX_SSE3)
__cpu_features |= _CRT_SSE3;
if (ecx & ECX_CX16)
__cpu_features |= _CRT_CMPXCHG16B;
__cpuid (0x80000000, eax, ebx, ecx, edx);
if (eax < 0x80000001)
return;
__cpuid (0x80000001, eax, ebx, ecx, edx);
if (edx & EDX_3DNOW)
__cpu_features |= _CRT_3DNOW;
if (edx & EDX_3DNOWP)
__cpu_features |= _CRT_3DNOWP;
#endif
}
#ifdef TEST
#include <stdio.h>
#define report(feature) \
if ((feature) & __cpu_features) printf( #feature " found\n")
int main()
{
__cpu_features_init();
report(_CRT_CMPXCHG8B);
report(_CRT_CMOV);
report(_CRT_MMX);
report(_CRT_FXSR);
report(_CRT_SSE);
report(_CRT_SSE2);
report(_CRT_SSE3);
report(_CRT_CMPXCHG16B);
report(_CRT_3DNOW);
report(_CRT_3DNOWP);
return 0;
}
#endif

View file

@ -1,23 +0,0 @@
#ifndef _CPU_FEATURES_H
#define _CPU_FEATURES_H
#define _CRT_CMPXCHG8B 0x0001
#define _CRT_CMOV 0x0002
#define _CRT_MMX 0x0004
#define _CRT_FXSR 0x0008
#define _CRT_SSE 0x0010
#define _CRT_SSE2 0x0020
#define _CRT_SSE3 0x0040
#define _CRT_CMPXCHG16B 0x0080
#define _CRT_3DNOW 0x0100
#define _CRT_3DNOWP 0x0200
extern unsigned int __cpu_features;
/* Currently we use this in fpenv functions */
#define __HAS_SSE __cpu_features & _CRT_SSE
void __cpu_features_init (void);
#endif

View file

@ -1,310 +0,0 @@
/*
* crt1.c
* This file has no copyright assigned and is placed in the Public Domain.
* This file is a part of the mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within the package.
*
* Source code for the startup proceedures used by all programs. This code
* is compiled to make crt1.o, which should be located in the library path.
*
*/
/* Hide the declaration of _fmode with dllimport attribute in stdlib.h to
avoid problems with older GCC. */
#define __IN_MINGW_RUNTIME
#include <stdlib.h>
#include <stdio.h>
#include <io.h>
#include <process.h>
#include <float.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <signal.h>
/* NOTE: The code for initializing the _argv, _argc, and environ variables
* has been moved to a separate .c file which is included in both
* crt1.c and dllcrt1.c. This means changes in the code don't have to
* be manually synchronized, but it does lead to this not-generally-
* a-good-idea use of include. */
#include "init.c"
#include "cpu_features.h"
extern void _pei386_runtime_relocator (void);
extern int main (int, char **, char **);
/*
* Must have the correct app type for MSVCRT.
*/
#ifdef __MSVCRT__
#define __UNKNOWN_APP 0
#define __CONSOLE_APP 1
#define __GUI_APP 2
#ifndef _M_PPC
__MINGW_IMPORT
#endif
void __set_app_type(int);
#endif /* __MSVCRT__ */
/* Global _fmode for this .exe, not the one in msvcrt.dll,
The default is set in txtmode.o in libmingw32.a */
/* Override the dllimport'd declarations in stdlib.h */
#undef _fmode
extern int _fmode;
#ifdef __MSVCRT__
extern int* __p__fmode(void); /* To access the dll _fmode */
#endif
/*
* Setup the default file handles to have the _CRT_fmode mode, as well as
* any new files created by the user.
*/
extern int _CRT_fmode;
static void
_mingw32_init_fmode (void)
{
/* Don't set the std file mode if the user hasn't set any value for it. */
if (_CRT_fmode)
{
_fmode = _CRT_fmode;
/*
* This overrides the default file mode settings for stdin,
* stdout and stderr. At first I thought you would have to
* test with isatty, but it seems that the DOS console at
* least is smart enough to handle _O_BINARY stdout and
* still display correctly.
*/
if (stdin)
{
_setmode (_fileno (stdin), _CRT_fmode);
}
if (stdout)
{
_setmode (_fileno (stdout), _CRT_fmode);
}
if (stderr)
{
_setmode (_fileno (stderr), _CRT_fmode);
}
}
/* Now sync the dll _fmode to the one for this .exe. */
#ifdef __MSVCRT__
*__p__fmode() = _fmode;
#else
*_imp___fmode_dll = _fmode;
#endif
}
/* This function will be called when a trap occurs. Thanks to Jacob
Navia for his contribution. */
static LONG CALLBACK
_gnu_exception_handler (EXCEPTION_POINTERS * exception_data)
{
void (*old_handler) (int);
LONG action = EXCEPTION_CONTINUE_SEARCH;
int reset_fpu = 0;
switch (exception_data->ExceptionRecord->ExceptionCode)
{
case EXCEPTION_ACCESS_VIOLATION:
/* test if the user has set SIGSEGV */
old_handler = signal (SIGSEGV, SIG_DFL);
if (old_handler == SIG_IGN)
{
/* this is undefined if the signal was raised by anything other
than raise (). */
signal (SIGSEGV, SIG_IGN);
action = EXCEPTION_CONTINUE_EXECUTION;
}
else if (old_handler != SIG_DFL)
{
/* This means 'old' is a user defined function. Call it */
(*old_handler) (SIGSEGV);
action = EXCEPTION_CONTINUE_EXECUTION;
}
break;
case EXCEPTION_ILLEGAL_INSTRUCTION:
case EXCEPTION_PRIV_INSTRUCTION:
/* test if the user has set SIGILL */
old_handler = signal (SIGILL, SIG_DFL);
if (old_handler == SIG_IGN)
{
/* this is undefined if the signal was raised by anything other
than raise (). */
signal (SIGILL, SIG_IGN);
action = EXCEPTION_CONTINUE_EXECUTION;
}
else if (old_handler != SIG_DFL)
{
/* This means 'old' is a user defined function. Call it */
(*old_handler) (SIGILL);
action = EXCEPTION_CONTINUE_EXECUTION;
}
break;
case EXCEPTION_FLT_INVALID_OPERATION:
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
case EXCEPTION_FLT_DENORMAL_OPERAND:
case EXCEPTION_FLT_OVERFLOW:
case EXCEPTION_FLT_UNDERFLOW:
case EXCEPTION_FLT_INEXACT_RESULT:
reset_fpu = 1;
/* fall through. */
case EXCEPTION_INT_DIVIDE_BY_ZERO:
/* test if the user has set SIGFPE */
old_handler = signal (SIGFPE, SIG_DFL);
if (old_handler == SIG_IGN)
{
signal (SIGFPE, SIG_IGN);
if (reset_fpu)
_fpreset ();
action = EXCEPTION_CONTINUE_EXECUTION;
}
else if (old_handler != SIG_DFL)
{
/* This means 'old' is a user defined function. Call it */
(*old_handler) (SIGFPE);
action = EXCEPTION_CONTINUE_EXECUTION;
}
break;
default:
break;
}
return action;
}
/*
* The function mainCRTStartup is the entry point for all console programs.
*/
static void __attribute__((noreturn))
__mingw_CRTStartup (void)
{
int nRet;
/*
* Set up the top-level exception handler so that signal handling
* works as expected. The mapping between ANSI/POSIX signals and
* Win32 SE is not 1-to-1, so caveat emptore.
*
*/
SetUnhandledExceptionFilter (_gnu_exception_handler);
/*
* Initialize floating point unit.
*/
__cpu_features_init (); /* Do we have SSE, etc.*/
_fpreset (); /* Supplied by the runtime library. */
/*
* Set up __argc, __argv and _environ.
*/
_mingw32_init_mainargs ();
/*
* Sets the default file mode.
* If _CRT_fmode is set, also set mode for stdin, stdout
* and stderr, as well
* NOTE: DLLs don't do this because that would be rude!
*/
_mingw32_init_fmode ();
/* Adust references to dllimported data that have non-zero offsets. */
#if defined(__i386__)
_pei386_runtime_relocator ();
#endif
#if defined(__GNUC__)
#if defined(__i386__)
/* Align the stack to 16 bytes for the sake of SSE ops in main
or in functions inlined into main. */
asm __volatile__ ("andl $-16, %%esp" : : : "%esp");
#elif defined(__mips__)
/* Align the stack to 16 bytes */
asm __volatile__ ("andi %sp,%sp,-16" : : : "%sp");
#elif defined(__PowerPC__)
/* Align the stack to 16 bytes */
asm __volatile__ ("li 0,15\n\tandc 1,1,0" : : : "r1");
#else
#error Unsupported architecture
#endif
#elif defined(_MSC_VER)
#if defined(_M_IX86)
/* Align the stack to 16 bytes for the sake of SSE ops in main
or in functions inlined into main. */
__asm and esp, 0FFFFFFF0h
#else
#error TODO
#endif
#else
#error TODO
#endif
/*
* Call the main function. If the user does not supply one
* the one in the 'libmingw32.a' library will be linked in, and
* that one calls WinMain. See main.c in the 'lib' dir
* for more details.
*/
nRet = main (_argc, _argv, _environ);
/*
* Perform exit processing for the C library. This means
* flushing output and calling 'atexit' registered functions.
*/
_cexit ();
ExitProcess (nRet);
}
/*
* The function mainCRTStartup is the entry point for all console programs.
*/
void
mainCRTStartup (void)
{
#ifdef __MSVCRT__
__set_app_type (__CONSOLE_APP);
#endif
__mingw_CRTStartup ();
}
/*
* For now the GUI startup function is the same as the console one.
* This simply gets rid of the annoying warning about not being able
* to find WinMainCRTStartup when linking GUI applications.
*/
void
WinMainCRTStartup (void)
{
#ifdef __MSVCRT__
__set_app_type (__GUI_APP);
#endif
__mingw_CRTStartup ();
}
#if 0
/*
* We force use of library version of atexit, which is only
* visible in import lib as _imp__atexit
*/
extern int (*_imp__atexit)(void (*)(void));
int atexit (void (* pfn )(void) )
{
return ( (*_imp__atexit)(pfn));
}
/* Likewise for non-ANSI _onexit */
extern _onexit_t (*_imp___onexit)(_onexit_t);
_onexit_t
_onexit (_onexit_t pfn )
{
return (*_imp___onexit)(pfn);
}
#endif

View file

@ -1,185 +0,0 @@
/*
* dllcrt1.c
* This file has no copyright assigned and is placed in the Public Domain.
* This file is a part of the mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within the package.
*
* Initialization code for DLLs.
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <io.h>
#include <process.h>
#include <errno.h>
#include <windows.h>
/* Unlike normal crt1, I don't initialize the FPU, because the process
* should have done that already. I also don't set the file handle modes,
* because that would be rude. */
#ifdef __GNUC__
extern void __main ();
extern void __do_global_dtors ();
#endif
typedef void (* p_atexit_fn )(void);
static p_atexit_fn* first_atexit;
static p_atexit_fn* next_atexit;
static void
__dll_exit (void);
/* This is based on the function in the Wine project's exit.c */
p_atexit_fn __dllonexit (p_atexit_fn, p_atexit_fn**, p_atexit_fn**);
extern BOOL WINAPI DllMain (HANDLE, DWORD, LPVOID);
extern void _pei386_runtime_relocator (void);
BOOL WINAPI
DllMainCRTStartup (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
{
BOOL bRet;
if (dwReason == DLL_PROCESS_ATTACH)
{
#ifdef DEBUG
printf ("%s: DLL_PROCESS_ATTACH (%d)\n", __FUNCTION__);
#endif
/* Initialize private atexit table for this dll.
32 is min size required by ANSI */
first_atexit = (p_atexit_fn*) malloc (32 * sizeof (p_atexit_fn));
if (first_atexit == NULL ) /* can't allocate memory */
{
errno=ENOMEM;
return FALSE;
}
*first_atexit = NULL;
next_atexit = first_atexit;
/* Adust references to dllimported data (from other DLL's)
that have non-zero offsets. */
_pei386_runtime_relocator ();
#ifdef __GNUC__
/* From libgcc.a, __main calls global class constructors,
__do_global_ctors, which registers __do_global_dtors
as the first entry of the private atexit table we
have just initialised */
__main ();
#endif
}
/*
* Call the user-supplied DllMain subroutine.
* This has to come after initialization of atexit table and
* registration of global constructors.
* NOTE: DllMain is optional, so libmingw32.a includes a stub
* which will be used if the user does not supply one.
*/
bRet = DllMain (hDll, dwReason, lpReserved);
/* Handle case where DllMain returns FALSE on attachment attempt. */
if ( (dwReason == DLL_PROCESS_ATTACH) && !bRet)
{
#ifdef DEBUG
printf ("%s: DLL_PROCESS_ATTACH failed, cleaning up\n", __FUNCTION__);
#endif
__dll_exit (); /* Cleanup now. This will set first_atexit to NULL so we
know we've cleaned up */
}
if (dwReason == DLL_PROCESS_DETACH)
{
#ifdef DEBUG
printf ("%s: DLL_PROCESS_DETACH (%d)\n", __FUNCTION__);
#endif
/* If not attached, return FALSE. Cleanup already done above
if failed attachment attempt. */
if (! first_atexit )
bRet = FALSE;
else
/*
* We used to call __do_global_dtors () here. This is
* no longer necessary since __do_global_dtors is now
* registered at start (last out) of private atexit table.
*/
__dll_exit ();
}
return bRet;
}
static
void
__dll_exit(void)
/* Run LIFO terminators registered in private atexit table */
{
if ( first_atexit )
{
p_atexit_fn* __last = next_atexit - 1;
while ( __last >= first_atexit )
{
if ( *__last != NULL )
{
#ifdef DEBUG
printf ("%s: Calling exit function 0x%x from 0x%x\n",
__FUNCTION__, (unsigned)(*__last),(unsigned)__last);
#endif
(**__last) ();
}
__last--;
}
free ( first_atexit ) ;
first_atexit = NULL ;
}
/*
Make sure output buffers opened by DllMain or
atexit-registered functions are flushed before detaching,
otherwise we can have problems with redirected output.
*/
fflush (NULL);
}
/*
* The atexit exported from msvcrt.dll causes problems in DLLs.
* Here, we override the exported version of atexit with one that passes the
* private table initialised in DllMainCRTStartup to __dllonexit.
* That means we have to hide the mscvrt.dll atexit because the
* atexit defined here gets __dllonexit from the same lib.
*/
#if 0
int
atexit (p_atexit_fn pfn )
{
#ifdef DEBUG
printf ("%s: registering exit function 0x%x at 0x%x\n",
__FUNCTION__, (unsigned)pfn, (unsigned)next_atexit);
#endif
return (__dllonexit (pfn, &first_atexit, &next_atexit)
== NULL ? -1 : 0 );
}
/*
* Likewise for non-ANSI function _onexit that may be called by
* code in the dll.
*/
_onexit_t
_onexit (_onexit_t pfn )
{
#ifdef DEBUG
printf ("%s: registering exit function 0x%x at 0x%x\n",
__FUNCTION__, (unsigned)pfn, (unsigned)next_atexit);
#endif
return ((_onexit_t) __dllonexit ((p_atexit_fn)pfn, &first_atexit, &next_atexit));
}
#endif

View file

@ -1,67 +0,0 @@
/*
* init.c
* This file has no copyright assigned and is placed in the Public Domain.
* This file is a part of the mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within the package.
*
* Code to initialize standard file handles and command line arguments.
* This file is #included in both crt1.c and dllcrt1.c.
*
*/
/*
* Access to a standard 'main'-like argument count and list. Also included
* is a table of environment variables.
*/
int _argc = 0;
char **_argv = 0;
/* NOTE: Thanks to Pedro A. Aranda Gutiirrez <paag@tid.es> for pointing
* this out to me. GetMainArgs (used below) takes a fourth argument
* which is an int that controls the globbing of the command line. If
* _CRT_glob is non-zero the command line will be globbed (e.g. *.*
* expanded to be all files in the startup directory). In the mingw32
* library a _CRT_glob variable is defined as being -1, enabling
* this command line globbing by default. To turn it off and do all
* command line processing yourself (and possibly escape bogons in
* MS's globbing code) include a line in one of your source modules
* defining _CRT_glob and setting it to zero, like this:
* int _CRT_glob = 0;
*/
extern int _CRT_glob;
#ifdef __MSVCRT__
typedef struct {
int newmode;
} _startupinfo;
extern void __getmainargs (int *, char ***, char ***, int, _startupinfo *);
#else
extern void __GetMainArgs (int *, char ***, char ***, int);
#endif
/*
* Initialize the _argc, _argv and environ variables.
*/
static void
_mingw32_init_mainargs ()
{
/* The environ variable is provided directly in stdlib.h through
* a dll function call. */
char **dummy_environ;
#ifdef __MSVCRT__
_startupinfo start_info;
start_info.newmode = 0;
#endif
/*
* Microsoft's runtime provides a function for doing just that.
*/
#ifdef __MSVCRT__
(void) __getmainargs (&_argc, &_argv, &dummy_environ, _CRT_glob,
&start_info);
#else
/* CRTDLL version */
(void) __GetMainArgs (&_argc, &_argv, &dummy_environ, _CRT_glob);
#endif
}

View file

@ -1,79 +0,0 @@
/*
* main.c
* This file has no copyright assigned and is placed in the Public Domain.
* This file is a part of the mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within the package.
*
* Extra startup code for applications which do not have a main function
* of their own (but do have a WinMain). Generally these are GUI
* applications, but they don't *have* to be.
*
*/
#include <stdlib.h>
#include <process.h>
#include <windows.h>
#define ISSPACE(a) (a == ' ' || a == '\t')
extern int PASCAL WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
LPSTR szCmdLine, int nShow);
int
main (int argc, const char *argv[])
{
char *szCmd;
STARTUPINFO startinfo;
int nRet;
/* Get the command line passed to the process. */
szCmd = GetCommandLineA ();
GetStartupInfoA (&startinfo);
/* Strip off the name of the application and any leading
* whitespace. */
if (szCmd)
{
while (ISSPACE (*szCmd))
{
szCmd++;
}
/* On my system I always get the app name enclosed
* in quotes... */
if (*szCmd == '\"')
{
do
{
szCmd++;
}
while (*szCmd != '\"' && *szCmd != '\0');
if (*szCmd == '\"')
{
szCmd++;
}
}
else
{
/* If no quotes then assume first token is program
* name. */
while (!ISSPACE (*szCmd) && *szCmd != '\0')
{
szCmd++;
}
}
while (ISSPACE (*szCmd))
{
szCmd++;
}
}
nRet = WinMain (GetModuleHandle (NULL), NULL, szCmd,
(startinfo.dwFlags & STARTF_USESHOWWINDOW) ?
startinfo.wShowWindow : SW_SHOWDEFAULT);
return nRet;
}

View file

@ -7,7 +7,6 @@
<library>kernel32</library>
<file>_newmode.c</file>
<file>_wgetopt.c</file>
<file>argv.c</file>
<file>atonexit.c</file>
<file>binmode.c</file>
<file>charmax.c</file>
@ -30,13 +29,13 @@
<file>xthdloc.c</file>
<file>xtxtmode.c</file>
</module>
<module name="mingw_main" type="staticlibrary" isstartuplib="true" allowwarnings="true" crt="dll">
<module name="mingw_main" type="staticlibrary" isstartuplib="true" crt="dll">
<include base="mingw_common">include</include>
<file>crt0_c.c</file>
<file>crtexe.c</file>
<file>dllargv.c</file>
</module>
<module name="mingw_wmain" type="staticlibrary" isstartuplib="true" allowwarnings="true" unicode="yes" crt="dll">
<module name="mingw_wmain" type="staticlibrary" isstartuplib="true" unicode="yes" crt="dll">
<include base="mingw_common">include</include>
<define name="WPRFLAG"/>
<file>crt0_w.c</file>

View file

@ -1,5 +0,0 @@
#include <fcntl.h>
/* Set default file mode to binary */
int _fmode = _O_BINARY;

View file

@ -1,66 +0,0 @@
/*
* init.c
* This file has no copyright assigned and is placed in the Public Domain.
* This file is a part of the mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within the package.
*
* Code to initialize standard file handles and command line arguments.
* This file is #included in both crt1.c and dllcrt1.c.
*
*/
/*
* Access to a standard 'main'-like argument count and list. Also included
* is a table of environment variables.
*/
int _argc = 0;
wchar_t **_wargv = 0;
/* NOTE: Thanks to Pedro A. Aranda Gutiirrez <paag@tid.es> for pointing
* this out to me. GetMainArgs (used below) takes a fourth argument
* which is an int that controls the globbing of the command line. If
* _CRT_glob is non-zero the command line will be globbed (e.g. *.*
* expanded to be all files in the startup directory). In the mingw32
* library a _CRT_glob variable is defined as being -1, enabling
* this command line globbing by default. To turn it off and do all
* command line processing yourself (and possibly escape bogons in
* MS's globbing code) include a line in one of your source modules
* defining _CRT_glob and setting it to zero, like this:
* int _CRT_glob = 0;
*/
extern int _CRT_glob;
#ifdef __MSVCRT__
typedef struct {
int newmode;
} _startupinfo;
extern void __wgetmainargs (int *, wchar_t ***, wchar_t ***, int, _startupinfo *);
#else
#error Cannot build unicode version against crtdll
#endif
/*
* Initialize the _argc, _argv and environ variables.
*/
static void
_mingw32_init_wmainargs ()
{
/* The environ variable is provided directly in stdlib.h through
* a dll function call. */
wchar_t **dummy_environ;
#ifdef __MSVCRT__
_startupinfo start_info;
start_info.newmode = 0;
#endif
/*
* Microsoft's runtime provides a function for doing just that.
*/
#ifdef __MSVCRT__
(void) __wgetmainargs (&_argc, &_wargv, &dummy_environ, _CRT_glob,
&start_info);
#else
#error Cannot build unicode version against crtdll
#endif
}

View file

@ -1,86 +0,0 @@
/*
* main.c
* This file has no copyright assigned and is placed in the Public Domain.
* This file is a part of the mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within the package.
*
* Extra startup code for applications which do not have a main function
* of their own (but do have a WinMain). Generally these are GUI
* applications, but they don't *have* to be.
*
*/
#include <stdlib.h>
#include <process.h>
#include <windows.h>
#define ISSPACE(a) (a == ' ' || a == '\t')
extern void __main();
extern int PASCAL wWinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
LPWSTR szCmdLine, int nShow);
int
wmain (int argc, const wchar_t *argv[], const wchar_t *environ[])
{
wchar_t *szCmd;
STARTUPINFOW startinfo;
int nRet;
#ifdef __GNUC__
/* C++ initialization. (gcc inserts this call automatically for
* a function called "main", but not for "wmain") */
__main();
#endif
/* Get the command line passed to the process. */
szCmd = GetCommandLineW ();
GetStartupInfoW (&startinfo);
/* Strip off the name of the application and any leading
* whitespace. */
if (szCmd)
{
while (ISSPACE (*szCmd))
{
szCmd++;
}
/* On my system I always get the app name enclosed
* in quotes... */
if (*szCmd == '\"')
{
do
{
szCmd++;
}
while (*szCmd != '\"' && *szCmd != '\0');
if (*szCmd == '\"')
{
szCmd++;
}
}
else
{
/* If no quotes then assume first token is program
* name. */
while (!ISSPACE (*szCmd) && *szCmd != '\0')
{
szCmd++;
}
}
while (ISSPACE (*szCmd))
{
szCmd++;
}
}
nRet = wWinMain (GetModuleHandle (NULL), NULL, szCmd,
(startinfo.dwFlags & STARTF_USESHOWWINDOW) ?
startinfo.wShowWindow : SW_SHOWDEFAULT);
return nRet;
}