diff options
author | Danny Smith <dannysmith@users.sourceforge.net> | 2003-03-31 22:32:19 +0000 |
---|---|---|
committer | Danny Smith <dannysmith@users.sourceforge.net> | 2003-03-31 22:32:19 +0000 |
commit | 3617c9fefa934c94a5c048b0935def8d8fc2abd3 (patch) | |
tree | 9ed36d7dc476b81851205f64abf3518e88925947 | |
parent | d81e2928de6cefd3b3b8ad6420a0c30c23c1be2f (diff) | |
download | gdb-3617c9fefa934c94a5c048b0935def8d8fc2abd3.tar.gz |
Merge from mingw trunk (changes since 2003-01-27).
63 files changed, 5155 insertions, 942 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index cfbb0d4c53d..3528cc45b50 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,177 @@ +2003-04-01 Danny Smith <dannysmith@users.sourceforge.net> + + Merge from mingw trunk (changes since 2003-01-27). + + 2003-04-01 Danny Smith <dannysmith@users.sourceforge.net> + + * include/_mingw.h (_CRTIMP): Make conditional on __USE_CRTIMP. + + 2003-03-16 Danny Smith <dannysmith@users.sourceforge.net> + + * mingwex/dirent.c (_topendir): Eliminate signed/unsigned warning. + * mingwex/strtoimax.c (strtoimax): Likewise. + * mingwex/wcstoimax.c (wcstoimax): Likewise. + * mingwex/wtoll.c (wtoll): Remove unnecessary ';' + * mingwex/fesentenv.c: Include float.h. + * mingwex/math/powl.c: Eliminate type punning/strict aliasing + warning. + * mingwex/math/tanhl.c: Eliminate signed/unsigned warning in + constants. + * mingwex/math/tgammal.c: Likewise. + + 2003-03-16 Danny Smith <dannysmith@users.sourceforge.net> + + * include/utime.h: New file, forwarding to sys/utime.h. + + 2003-03-16 Danny Smith <dannysmith@users.sourceforge.net> + + * include/sys/param.h (MAXPATHLEN): Define. + + 2003-03-16 Danny Smith <dannysmith@users.sourceforge.net> + + * include/tchar.h: Ansi-fy a comment. + + 2003-03-16 Danny Smith <dannysmith@users.sourceforge.net> + + * profile/profile.h (mcount): Use __builtin_return_address + rather than inline __asm statements. + * profile/Makefile.in: Specify dependencies for mcount.o + profil.o gmon.o. + + 2003-03-10 Danny Smith <dannysmith@users.sourceforge.net> + + * include/stdlib.h (qsort): Remove const from first parm. + Thanks to: Tien-Ren Chen <trchen@sourceforge.users.net> + + 2003-03-03 Christopher Faylor <cgf@redhat.com> + + * mingwex/getopt.c: Refresh from NetBSD sources. + + 2003-03-03 Danny Smith <dannysmith@users.sourceforge.net> + + * mingwex/getopt.c: New file, copied from cygwin srcs. + * include/getopt.h: New file, copied from cygwin srcs. + * include/unistd.h: Include getopt.h. + * mingwex/Makefile.in (DISTFILES): Add getopt.c. + (POSIX_OBJS): Add getopt.o. + + 2003-03-02 Danny Smith <dannysmith@users.sourceforge.net> + + * include/stdio.h (vscanf): Add prototype. + (vfscanf): Ditto. + (vsscanf): Ditto. + (vwscanf): Ditto. + (vfwscanf): Ditto. + (vswscanf): Ditto. + * include/wchar.h (vwscanf): Add prototype. + (vfwscanf): Ditto. + (vswscanf): Ditto. + * mingwex/snprintf.c: Move to mingwex/stdio. + * mingwex/vsnprintf.c: Ditto. + * mingwex/snwprintf.c: Ditto. + * mingwex/vsnwprintf.c: Ditto. + * mingwex/Makefile.in (VPATH): Add $(srcdir)/stdio + (STDIO_DISTFILES): Add. + (DISTFILES): Adjust. + (STDIO_STUB_OBJS): Rename to STDIO_OBJS and add v*scanf objects. + (LIB_OBJS): Adjust. + (dist): Adjust. + + 2003-03-02 Aaron W LaFramboise <AWLaFramboise@aol.com> + + * mingwex/stdio: New directory + * mingwex/stdio/vfscanf.c: New file. + * mingwex/stdio/vfwscanf.c: New file. + * mingwex/stdio/vscanf.c: New file. + * mingwex/stdio/vsscanf.c: New file. + * mingwex/stdio/vswscanf.c: New file. + * mingwex/stdio/vwscanf.c: New file. + + 2003-02-25 Earnie Boyd <earnie@users.sf.net> + + * Makefile.in (libmsvcrt20.a): Remove target and dependencies. + (libmsvcrt40.a): Ditto. + + 2003-02-21 Earnie Boyd <earnie@users.sf.net> + + Thanks to David Frasier <davidf@sjsoft.com> who inspired portions of + this patch. + * Makefile.in (libmsvcrtd.a): Add target library. + (libmoldnamed.a): Ditto. + (msvcrt.def, msvcrtd.def, msvcrt20.def, msvcrt40.def): Use msvcrt.def.in + template to create. + ($(srcdir)): Remove explicit reference for depencies of object targets. + * moldname.def, moldname-msvcrt.def, moldname-crtdll.def, msvcrt.def, + msvcrt20.def, msvcrt40.def: Remove. + * msvcrt.def.in: New file (Copy of previous msvcrt.def). + + 2003-02-20 Corinna Vinschen <corinna@vinschen.de> + + * Makefile.in: Make sure libmingwex.a from current build tree is used. + + 2003-02-10 Danny Smith <dannysmith@users.sourceforge.net> + + * include/math.h: Remove _CRTIMP from pow() prototype, + unless __NO_ISOCEXT. + + 2003-02-10 Danny Smith <dannysmith@users.sourceforge.net> + + * mingwex/math/cephes_emath.h: Don't redefine INFINITY. + + 2003-02-10 Danny Smith <dannysmith@users.sourceforge.net> + + * include/_mingw.h (_CRTIMP): Define for __GNUC__ if + __declspec(dllimport) supported. + (__cdecl): Define if not already defined. + (__stdcall): Likewise. + * include/dirent.h: Qualify fuctions with __cdecl. + * include/fenv.h: Likewise. + * include/inttypes.h: Likewise. + * include/assert.h: Qualify fuctions with __cdecl. Qualify + CRT dll imports with _CRTIMP. + * include/conio.h: Likewise. + * include/ctype.h: Likewise. + * include/direct.h: Likewise. + * include/dos.h: Likewise. + * include/errno.h: Likewise. + * include/float.h: Likewise. + * include/io.h: Likewise. + * include/locale.h: Likewise. + * include/malloc.h: Likewise. + * include/math.h: Likewise. + * include/mbctype.h: Likewise. + * include/mbstring.h: Likewise. + * include/process.h: Likewise. + * include/setjmp.h: Likewise. + * include/signal.h: Likewise. + * include/stdio.h: Likewise. + * include/stdlib.h: Likewise. + * include/string.h: Likewise. + * include/time.h: Likewise. + * include/wchar.h: Likewise. + * include/wctype.h: Likewise. + * include/sys/stat.h: Likewise. + * include/sys/timeb.h: Likewise. + * include/sys/utime.h: Likewise. + + * include/ctype.h: Guard ctype inlines with __NO_INLINE__. + * include/wctype.h: Guard wctype inlines with __NO_INLINE__. + + * include/stdio.h (__VALIST): Guard against prior definition. + + 2003-02-08 Earnie Boyd <earnie@users.sf.net> + + * include/_mingw.h: Change version to 3.0 + * Makefile.in: Ditto. + + 2003-02-08 Earnie Boyd <earnie@users.sf.net> + + * include/stdlib.h: Make words after #endif a comment. + + 2003-02-07 Danny Smith <dannysmith@users.sourceforge.net> + + * include/locale.h: Include stddef.h for definition of NULL. + 2003-01-27 Danny Smith <dannysmith@users.sourceforge.net> * include/setjmp.h (_setjmp): Move from std to global @@ -128,7 +302,7 @@ 2002-10-30 Guido Serassio <serassio@libero.it> - * include/stdio.h (_getmaxstdio): Add prototype. + * include/stdio.h (_getmaxstdio): Add prototype. (_setmaxstdio): Likewise. 2002-10-19 Kang Li <rubylith@users.sourceforge.net> diff --git a/winsup/mingw/Makefile.in b/winsup/mingw/Makefile.in index 5b3a0f960e3..478e7b69930 100644 --- a/winsup/mingw/Makefile.in +++ b/winsup/mingw/Makefile.in @@ -18,7 +18,7 @@ # This makefile requires GNU make. PACKAGE = mingw-runtime -VERSION = 2.4 +VERSION = 3.0 CYGRELEASE = 1 VPATH = @srcdir@ @@ -154,17 +154,17 @@ MINGW_OBJS = CRTglob.o CRTfmode.o CRTinit.o dllmain.o gccmain.o \ pseudo-reloc.o pseudo-reloc-list.o MOLD_OBJS = ctype_old.o string_old.o -LIBS = libcrtdll.a libmsvcrt.a libmsvcrt20.a libmsvcrt40.a libmingw32.a \ - libcoldname.a libmoldname.a $(LIBM_A) libmingwthrd.a +LIBS = libcrtdll.a libmsvcrt.a libmsvcrtd.a libmingw32.a \ + libcoldname.a libmoldname.a libmoldnamed.a $(LIBM_A) libmingwthrd.a DLLS = $(THREAD_DLL_NAME) SRCDIST_FILES = CRT_noglob.c CRTfmode.c CRTglob.c CRTinit.c ChangeLog \ Makefile.in README TODO config.guess config.sub configure configure.in \ crt1.c crtdll.def crtmt.c crtst.c ctype_old.c dllcrt1.c dllmain.c \ -gccmain.c init.c install-sh jamfile main.c mkinstalldirs moldname-crtdll.def \ -moldname-msvcrt.def moldname.def moldname.def.in msvcrt.def msvcrt20.def \ -msvcrt40.def mthr.c mthr_init.c mthr_stub.c readme.txt string_old.c \ +gccmain.c init.c install-sh jamfile main.c mkinstalldirs \ +moldname.def.in msvcrt.def.in \ +mthr.c mthr_init.c mthr_stub.c readme.txt string_old.c \ CRT_fp8.c CRT_fp10.c test_headers.c txtmode.c binmode.c pseudo-reloc.c \ pseudo-reloc-list.c @@ -207,12 +207,13 @@ xx_$(THREAD_DLL_NAME) xx_mingwthrd.def: mthr.o mthr_init.o DLL_OFILES = mthr.o mthr_init.o DLL_CC_STUFF = -B./ -mdll $(MNO_CYGWIN) -Wl,--image-base,0x6FBC0000 \ -Wl,--entry,_DllMainCRTStartup@12 \ - $(DLL_OFILES) + $(DLL_OFILES) \ + -Lmingwex DLL_DLLTOOL_STUFF = --as=$(AS) --dllname $(THREAD_DLL_NAME) \ --def mingwthrd.def \ --base-file mingwthrd.base --output-exp mingwthrd.exp -$(THREAD_DLL_NAME) mingwthrd.def: $(DLL_OFILES) Makefile +$(THREAD_DLL_NAME) mingwthrd.def: $(DLL_OFILES) Makefile $(SUBDIRS) $(DLLTOOL) --as $(AS) --output-def mingwthrd.def $(DLL_OFILES) $(CC) -Wl,--base-file=mingwthrd.base $(DLL_CC_STUFF) \ -o mingwthrd_dummy.exe @@ -227,30 +228,44 @@ libmingw32.a: $(MINGW_OBJS) $(AR) rc $@ $(MINGW_OBJS) $(RANLIB) $@ -$(srcdir)/moldname-crtdll.def: moldname.def.in +msvcrt.def msvcrtd.def: msvcrt.def.in + $(CC) -DRUNTIME=$(basename $(notdir $@)) \ + -D__FILENAME__=$@ \ + -D__MSVCRT__ -C -E -P \ + -xc-header $? > $@ + +moldname-crtdll.def: moldname.def.in $(CC) -DRUNTIME=crtdll \ -D__FILENAME__=moldname-crtdll.def \ -D__CRTDLL__ -C -E -P \ -xc-header $? > $@ -$(srcdir)/moldname-msvcrt.def: moldname.def.in +moldname-msvcrt.def: moldname.def.in $(CC) -DRUNTIME=msvcrt \ -D__FILENAME__=moldname-msvcrt.def \ -D__MSVCRT__ -C -E -P \ -xc-header $? > $@ -libcoldname.a: $(srcdir)/moldname-crtdll.def $(MOLD_OBJS) +libcoldname.a: moldname-crtdll.def $(MOLD_OBJS) $(DLLTOOL) --as $(AS) -k -U \ --dllname crtdll.dll \ - --def $(srcdir)/moldname-crtdll.def \ + --def moldname-crtdll.def \ --output-lib $@ $(AR) rc $@ $(MOLD_OBJS) $(RANLIB) $@ -libmoldname.a: $(srcdir)/moldname-msvcrt.def $(MOLD_OBJS) +libmoldname.a: moldname-msvcrt.def $(MOLD_OBJS) $(DLLTOOL) --as $(AS) -k -U \ --dllname msvcrt.dll \ - --def $(srcdir)/moldname-msvcrt.def \ + --def moldname-msvcrt.def \ + --output-lib $@ + $(AR) rc $@ $(MOLD_OBJS) + $(RANLIB) $@ + +libmoldnamed.a: moldname-msvcrt.def $(MOLD_OBJS) + $(DLLTOOL) --as $(AS) -k -U \ + --dllname msvcrtd.dll \ + --def moldname-msvcrt.def \ --output-lib $@ $(AR) rc $@ $(MOLD_OBJS) $(RANLIB) $@ @@ -285,12 +300,11 @@ test_headers: clean: -rm -f *.o *.a *~ core a.out mingwthrd.def mingwthrd.base mingwthrd.exp -rm -f $(THREAD_DLL_NAME) mingwthrd_dummy.exe + -rm -f moldname-*.def @$(MAKE) subdirs DO=$@ $(FLAGS_TO_PASS) -distclean: +distclean: clean @$(MAKE) subdirs DO=$@ $(FLAGS_TO_PASS) - -rm -f *.o *.a *~ core a.out mingwthrd.def mingwthrd.base mingwthrd.exp - -rm -f $(THREAD_DLL_NAME) -rm -f config.cache config.status config.log -rm -f Makefile @@ -396,27 +410,26 @@ force: # # Dependancies # -libcrtdll.a: $(srcdir)/crtdll.def -libmsvcrt.a: $(srcdir)/msvcrt.def -libmsvcrt20.a: $(srcdir)/msvcrt20.def -libmsvcrt40.a: $(srcdir)/msvcrt40.def -CRT_noglob.o: $(srcdir)/CRT_noglob.c -CRTfmode.o: $(srcdir)/CRTfmode.c -CRTglob.o: $(srcdir)/CRTglob.c -CRTinit.o: $(srcdir)/CRTinit.c -crt1.o: $(srcdir)/crt1.c $(srcdir)/init.c -crt2.o: $(srcdir)/crt1.c $(srcdir)/init.c -crtmt.o: $(srcdir)/crtmt.c -crtst.o: $(srcdir)/crtst.c -ctype_old.o: $(srcdir)/ctype_old.c -dllcrt1.o: $(srcdir)/dllcrt1.c -dllcrt2.o: $(srcdir)/dllcrt1.c -dllmain.o: $(srcdir)/dllmain.c -main.o: $(srcdir)/main.c -oldnames.o: $(srcdir)/oldnames.c -string_old.o: $(srcdir)/string_old.c -CRT_fp8.o: $(srcdir)/CRT_fp8.c -CRT_fp10.o: $(srcdir)/CRT_fp10.c +libcrtdll.a: crtdll.def +libmsvcrt.a: msvcrt.def +libmsvcrtd.a: msvcrtd.def +CRT_noglob.o: CRT_noglob.c +CRTfmode.o: CRTfmode.c +CRTglob.o: CRTglob.c +CRTinit.o: CRTinit.c +crt1.o: crt1.c init.c +crt2.o: crt1.c init.c +crtmt.o: crtmt.c +crtst.o: crtst.c +ctype_old.o: ctype_old.c +dllcrt1.o: dllcrt1.c +dllcrt2.o: dllcrt1.c +dllmain.o: dllmain.c +main.o: main.c +oldnames.o: oldnames.c +string_old.o: string_old.c +CRT_fp8.o: CRT_fp8.c +CRT_fp10.o: CRT_fp10.c Makefile: Makefile.in config.status configure diff --git a/winsup/mingw/include/_mingw.h b/winsup/mingw/include/_mingw.h index 53a6a23f5af..9af0044524e 100644 --- a/winsup/mingw/include/_mingw.h +++ b/winsup/mingw/include/_mingw.h @@ -29,6 +29,7 @@ __DECLSPEC_SUPPORTED Defined if dllimport attribute is supported. __MINGW_IMPORT The attribute definition to specify imported variables/functions. + _CRTIMP As above. For MS compatibility. __MINGW32_VERSION Runtime version. __MINGW32_MAJOR_VERSION Runtime major version. __MINGW32_MINOR_VERSION Runtime minor version. @@ -47,6 +48,9 @@ # ifndef __MINGW_IMPORT # define __MINGW_IMPORT __declspec(dllimport) # endif +# ifndef _CRTIMP +# define _CRTIMP __declspec(dllimport) +# endif # define __DECLSPEC_SUPPORTED #else /* __GNUC__ */ # ifdef __declspec @@ -55,19 +59,32 @@ /* Note the extern. This is needed to work around GCC's limitations in handling dllimport attribute. */ # define __MINGW_IMPORT extern __attribute__((dllimport)) +# endif +# ifndef _CRTIMP +# ifdef __USE_CRTIMP +# define _CRTIMP __attribute__((dllimport)) +# else +# define _CRTIMP # endif +# endif # define __DECLSPEC_SUPPORTED # else /* __declspec */ # undef __DECLSPEC_SUPPORTED # undef __MINGW_IMPORT -# endif +# endif /* __declspec */ +# ifndef __cdecl +# define __cdecl __attribute__((cdecl)) +# endif +# ifndef __stdcall +# define __stdcall __attribute__((stdcall)) +# endif # undef __int64 # define __int64 long long #endif /* __GNUC__ */ - -#define __MINGW32_VERSION 2.4 -#define __MINGW32_MAJOR_VERSION 2 -#define __MINGW32_MINOR_VERSION 4 + +#define __MINGW32_VERSION 3.0 +#define __MINGW32_MAJOR_VERSION 3 +#define __MINGW32_MINOR_VERSION 0 /* ISO C++. */ #ifndef __HAVE_STD_CXX @@ -106,6 +123,4 @@ # define __CGLOBAL #endif - #endif /* __MINGW_H */ - diff --git a/winsup/mingw/include/assert.h b/winsup/mingw/include/assert.h new file mode 100644 index 00000000000..893db911364 --- /dev/null +++ b/winsup/mingw/include/assert.h @@ -0,0 +1,71 @@ +/* + * assert.h + * + * Define the assert macro for debug output. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp> + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision$ + * $Author$ + * $Date$ + * + */ + +#ifndef _ASSERT_H_ +#define _ASSERT_H_ + +/* All the headers include this file. */ +#include <_mingw.h> + +#ifndef RC_INVOKED + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef NDEBUG + +/* + * If not debugging, assert does nothing. + */ +#define assert(x) ((void)0) + +#else /* debugging enabled */ + +/* + * CRTDLL nicely supplies a function which does the actual output and + * call to abort. + */ +_CRTIMP void __cdecl _assert (const char*, const char*, int) +#ifdef __GNUC__ + __attribute__ ((noreturn)) +#endif + ; + +/* + * Definition of the assert macro. + */ +#define assert(e) ((e) ? (void)0 : _assert(#e, __FILE__, __LINE__)) +#endif /* NDEBUG */ + +#ifdef __cplusplus +} +#endif + +#endif /* Not RC_INVOKED */ + +#endif /* Not _ASSERT_H_ */ + diff --git a/winsup/mingw/include/conio.h b/winsup/mingw/include/conio.h new file mode 100644 index 00000000000..780ccc10da1 --- /dev/null +++ b/winsup/mingw/include/conio.h @@ -0,0 +1,73 @@ +/* + * conio.h + * + * Low level console I/O functions. Pretty please try to use the ANSI + * standard ones if you are writing new code. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp> + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision$ + * $Author$ + * $Date$ + * + */ + +#ifndef __STRICT_ANSI__ + +#ifndef _CONIO_H_ +#define _CONIO_H_ + +/* All the headers include this file. */ +#include <_mingw.h> + +#ifndef RC_INVOKED + +#ifdef __cplusplus +extern "C" { +#endif + +_CRTIMP char* __cdecl _cgets (char*); +_CRTIMP int __cdecl _cprintf (const char*, ...); +_CRTIMP int __cdecl _cputs (const char*); +_CRTIMP int __cdecl _cscanf (char*, ...); + +_CRTIMP int __cdecl _getch (void); +_CRTIMP int __cdecl _getche (void); +_CRTIMP int __cdecl _kbhit (void); +_CRTIMP int __cdecl _putch (int); +_CRTIMP int __cdecl _ungetch (int); + + +#ifndef _NO_OLDNAMES + +_CRTIMP int __cdecl getch (void); +_CRTIMP int __cdecl getche (void); +_CRTIMP int __cdecl kbhit (void); +_CRTIMP int __cdecl putch (int); +_CRTIMP int __cdecl ungetch (int); + +#endif /* Not _NO_OLDNAMES */ + + +#ifdef __cplusplus +} +#endif + +#endif /* Not RC_INVOKED */ + +#endif /* Not _CONIO_H_ */ + +#endif /* Not __STRICT_ANSI__ */ diff --git a/winsup/mingw/include/ctype.h b/winsup/mingw/include/ctype.h index ae38c35ac42..8828ba13c63 100644 --- a/winsup/mingw/include/ctype.h +++ b/winsup/mingw/include/ctype.h @@ -57,22 +57,22 @@ __BEGIN_CSTD_NAMESPACE -int isalnum(int); -int isalpha(int); -int iscntrl(int); -int isdigit(int); -int isgraph(int); -int islower(int); -int isprint(int); -int ispunct(int); -int isspace(int); -int isupper(int); -int isxdigit(int); +_CRTIMP int __cdecl isalnum(int); +_CRTIMP int __cdecl isalpha(int); +_CRTIMP int __cdecl iscntrl(int); +_CRTIMP int __cdecl isdigit(int); +_CRTIMP int __cdecl isgraph(int); +_CRTIMP int __cdecl islower(int); +_CRTIMP int __cdecl isprint(int); +_CRTIMP int __cdecl ispunct(int); +_CRTIMP int __cdecl isspace(int); +_CRTIMP int __cdecl isupper(int); +_CRTIMP int __cdecl isxdigit(int); /* These are the ANSI versions, with correct checking of argument */ -int tolower(int); -int toupper(int); +_CRTIMP int __cdecl tolower(int); +_CRTIMP int __cdecl toupper(int); /* * NOTE: The above are not old name type wrappers, but functions exported @@ -88,16 +88,16 @@ __BEGIN_CGLOBAL_NAMESPACE * These are the cheap non-std versions: The return values are undefined * if the argument is not ASCII char or is not of appropriate case */ -int _tolower(int); -int _toupper(int); +_CRTIMP int __cdecl _tolower(int); +_CRTIMP int __cdecl _toupper(int); #if !defined (__NO_CTYPE_INLINES) /* these reproduce behaviour of lib underscored versions */ -extern __inline__ int _tolower(int __c) {return ( __c -'A'+'a');} -extern __inline__ int _toupper(int __c) {return ( __c -'a'+'A');} +extern __inline__ int __cdecl _tolower(int __c) {return ( __c -'A'+'a');} +extern __inline__ int __cdecl _toupper(int __c) {return ( __c -'a'+'A');} #endif -int _isctype (int, int); +_CRTIMP int __cdecl _isctype (int, int); #endif /* __STRICT_ANSI__ */ @@ -162,21 +162,22 @@ extern unsigned short** _imp___ctype; * optimise away the constant condition. */ -#if ! (defined (__NO_CTYPE_INLINES) || defined (__STRICT_ANSI__ )) +#if ! (defined (__NO_INLINE__) || defined (__NO_CTYPE_INLINES) \ + || defined (__STRICT_ANSI__ )) /* use simple lookup if SB locale, else _isctype() */ #define __ISCTYPE(__c, __mask) \ (MB_CUR_MAX == 1 ? (_pctype[__c] & __mask) : __CGLOBAL _isctype(__c, __mask)) -extern __inline__ int isalnum(int __c) {return __ISCTYPE(__c, (_ALPHA|_DIGIT));} -extern __inline__ int isalpha(int __c) {return __ISCTYPE(__c, _ALPHA);} -extern __inline__ int iscntrl(int __c) {return __ISCTYPE(__c, _CONTROL);} -extern __inline__ int isdigit(int __c) {return __ISCTYPE(__c, _DIGIT);} -extern __inline__ int isgraph(int __c) {return __ISCTYPE(__c, (_PUNCT|_ALPHA|_DIGIT));} -extern __inline__ int islower(int __c) {return __ISCTYPE(__c, _LOWER);} -extern __inline__ int isprint(int __c) {return __ISCTYPE(__c, (_BLANK|_PUNCT|_ALPHA|_DIGIT));} -extern __inline__ int ispunct(int __c) {return __ISCTYPE(__c, _PUNCT);} -extern __inline__ int isspace(int __c) {return __ISCTYPE(__c, _SPACE);} -extern __inline__ int isupper(int __c) {return __ISCTYPE(__c, _UPPER);} -extern __inline__ int isxdigit(int __c) {return __ISCTYPE(__c, _HEX);} +extern __inline__ int __cdecl isalnum(int __c) {return __ISCTYPE(__c, (_ALPHA|_DIGIT));} +extern __inline__ int __cdecl isalpha(int __c) {return __ISCTYPE(__c, _ALPHA);} +extern __inline__ int __cdecl iscntrl(int __c) {return __ISCTYPE(__c, _CONTROL);} +extern __inline__ int __cdecl isdigit(int __c) {return __ISCTYPE(__c, _DIGIT);} +extern __inline__ int __cdecl isgraph(int __c) {return __ISCTYPE(__c, (_PUNCT|_ALPHA|_DIGIT));} +extern __inline__ int __cdecl islower(int __c) {return __ISCTYPE(__c, _LOWER);} +extern __inline__ int __cdecl isprint(int __c) {return __ISCTYPE(__c, (_BLANK|_PUNCT|_ALPHA|_DIGIT));} +extern __inline__ int __cdecl ispunct(int __c) {return __ISCTYPE(__c, _PUNCT);} +extern __inline__ int __cdecl isspace(int __c) {return __ISCTYPE(__c, _SPACE);} +extern __inline__ int __cdecl isupper(int __c) {return __ISCTYPE(__c, _UPPER);} +extern __inline__ int __cdecl isxdigit(int __c) {return __ISCTYPE(__c, _HEX);} /* TODO? Is it worth inlining ANSI tolower, toupper? Probably only if we only want C-locale. */ @@ -195,40 +196,40 @@ typedef wchar_t wctype_t; #define _WCTYPE_T_DEFINED #endif -int iswalnum(wint_t); -int iswalpha(wint_t); -int iswascii(wint_t); -int iswcntrl(wint_t); -int iswctype(wint_t, wctype_t); -int iswdigit(wint_t); -int iswgraph(wint_t); -int iswlower(wint_t); -int iswprint(wint_t); -int iswpunct(wint_t); -int iswspace(wint_t); -int iswupper(wint_t); -int iswxdigit(wint_t); - -wchar_t towlower(wchar_t); -wchar_t towupper(wchar_t); - -int isleadbyte (int); +_CRTIMP int __cdecl iswalnum(wint_t); +_CRTIMP int __cdecl iswalpha(wint_t); +_CRTIMP int __cdecl iswascii(wint_t); +_CRTIMP int __cdecl iswcntrl(wint_t); +_CRTIMP int __cdecl iswctype(wint_t, wctype_t); +_CRTIMP int __cdecl iswdigit(wint_t); +_CRTIMP int __cdecl iswgraph(wint_t); +_CRTIMP int __cdecl iswlower(wint_t); +_CRTIMP int __cdecl iswprint(wint_t); +_CRTIMP int __cdecl iswpunct(wint_t); +_CRTIMP int __cdecl iswspace(wint_t); +_CRTIMP int __cdecl iswupper(wint_t); +_CRTIMP int __cdecl iswxdigit(wint_t); + +_CRTIMP wchar_t __cdecl towlower(wchar_t); +_CRTIMP wchar_t __cdecl towupper(wchar_t); + +_CRTIMP int __cdecl isleadbyte (int); #if ! (defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) #define __WCTYPE_INLINES_DEFINED -extern __inline__ int iswalnum(wint_t __wc) {return (iswctype(__wc,_ALPHA|_DIGIT));} -extern __inline__ int iswalpha(wint_t __wc) {return (iswctype(__wc,_ALPHA));} -extern __inline__ int iswascii(wint_t __wc) {return ((__wc & ~0x7F) == 0);} -extern __inline__ int iswcntrl(wint_t __wc) {return (iswctype(__wc,_CONTROL));} -extern __inline__ int iswdigit(wint_t __wc) {return (iswctype(__wc,_DIGIT));} -extern __inline__ int iswgraph(wint_t __wc) {return (iswctype(__wc,_PUNCT|_ALPHA|_DIGIT));} -extern __inline__ int iswlower(wint_t __wc) {return (iswctype(__wc,_LOWER));} -extern __inline__ int iswprint(wint_t __wc) {return (iswctype(__wc,_BLANK|_PUNCT|_ALPHA|_DIGIT));} -extern __inline__ int iswpunct(wint_t __wc) {return (iswctype(__wc,_PUNCT));} -extern __inline__ int iswspace(wint_t __wc) {return (iswctype(__wc,_SPACE));} -extern __inline__ int iswupper(wint_t __wc) {return (iswctype(__wc,_UPPER));} -extern __inline__ int iswxdigit(wint_t __wc) {return (iswctype(__wc,_HEX));} -extern __inline__ int isleadbyte(int __c) +extern __inline__ int __cdecl iswalnum(wint_t __wc) {return (iswctype(__wc,_ALPHA|_DIGIT));} +extern __inline__ int __cdecl iswalpha(wint_t __wc) {return (iswctype(__wc,_ALPHA));} +extern __inline__ int __cdecl iswascii(wint_t __wc) {return ((__wc & ~0x7F) == 0);} +extern __inline__ int __cdecl iswcntrl(wint_t __wc) {return (iswctype(__wc,_CONTROL));} +extern __inline__ int __cdecl iswdigit(wint_t __wc) {return (iswctype(__wc,_DIGIT));} +extern __inline__ int __cdecl iswgraph(wint_t __wc) {return (iswctype(__wc,_PUNCT|_ALPHA|_DIGIT));} +extern __inline__ int __cdecl iswlower(wint_t __wc) {return (iswctype(__wc,_LOWER));} +extern __inline__ int __cdecl iswprint(wint_t __wc) {return (iswctype(__wc,_BLANK|_PUNCT|_ALPHA|_DIGIT));} +extern __inline__ int __cdecl iswpunct(wint_t __wc) {return (iswctype(__wc,_PUNCT));} +extern __inline__ int __cdecl iswspace(wint_t __wc) {return (iswctype(__wc,_SPACE));} +extern __inline__ int __cdecl iswupper(wint_t __wc) {return (iswctype(__wc,_UPPER));} +extern __inline__ int __cdecl iswxdigit(wint_t __wc) {return (iswctype(__wc,_HEX));} +extern __inline__ int __cdecl isleadbyte(int __c) {return (_pctype[(unsigned char)(__c)] & _LEADBYTE);} #endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */ __END_CSTD_NAMESPACE @@ -237,26 +238,26 @@ __END_CSTD_NAMESPACE #ifndef __STRICT_ANSI__ __BEGIN_CGLOBAL_NAMESPACE -int __isascii (int); -int __toascii (int); -int __iscsymf (int); /* Valid first character in C symbol */ -int __iscsym (int); /* Valid character in C symbol (after first) */ +_CRTIMP int __cdecl __isascii (int); +_CRTIMP int __cdecl __toascii (int); +_CRTIMP int __cdecl __iscsymf (int); /* Valid first character in C symbol */ +_CRTIMP int __cdecl __iscsym (int); /* Valid character in C symbol (after first) */ #ifndef __NO_CTYPE_INLINES -extern __inline__ int __isascii(int __c) {return ((__c & ~0x7F) == 0);} -extern __inline__ int __toascii(int __c) {return (__c & 0x7F);} -extern __inline__ int __iscsymf(int __c) {return (__CSTD isalpha(__c) || (__c == '_'));} -extern __inline__ int __iscsym(int __c) {return (__CSTD isalnum(__c) || (__c == '_'));} +extern __inline__ int __cdecl __isascii(int __c) {return ((__c & ~0x7F) == 0);} +extern __inline__ int __cdecl __toascii(int __c) {return (__c & 0x7F);} +extern __inline__ int __cdecl __iscsymf(int __c) {return (__CSTD isalpha(__c) || (__c == '_'));} +extern __inline__ int __cdecl __iscsym(int __c) {return (__CSTD isalnum(__c) || (__c == '_'));} #endif /* __NO_CTYPE_INLINES */ #ifndef _NO_OLDNAMES -int isascii (int); -int toascii (int); -int iscsymf (int); -int iscsym (int); +_CRTIMP int __cdecl isascii (int); +_CRTIMP int __cdecl toascii (int); +_CRTIMP int __cdecl iscsymf (int); +_CRTIMP int __cdecl iscsym (int); #endif /* Not _NO_OLDNAMES */ -int is_wctype(__CSTD wint_t, __CSTD wctype_t); /* Obsolete! */ +_CRTIMP int __cdecl is_wctype(__CSTD wint_t, __CSTD wctype_t); /* Obsolete! */ __END_CGLOBAL_NAMESPACE #endif /* Not __STRICT_ANSI__ */ diff --git a/winsup/mingw/include/direct.h b/winsup/mingw/include/direct.h new file mode 100644 index 00000000000..c8fec4cf425 --- /dev/null +++ b/winsup/mingw/include/direct.h @@ -0,0 +1,95 @@ +/* + * direct.h + * + * Functions for manipulating paths and directories (included from io.h) + * plus functions for setting the current drive. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp> + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision$ + * $Author$ + * $Date$ + * + */ + +#ifndef __STRICT_ANSI__ + +#ifndef _DIRECT_H_ +#define _DIRECT_H_ + +/* All the headers include this file. */ +#include <_mingw.h> + +#define __need_wchar_t +#ifndef RC_INVOKED +#include <stddef.h> +#endif /* Not RC_INVOKED */ + +#include <io.h> + +#ifndef RC_INVOKED + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _DISKFREE_T_DEFINED +/* needed by _getdiskfree (also in dos.h) */ +struct _diskfree_t { + unsigned total_clusters; + unsigned avail_clusters; + unsigned sectors_per_cluster; + unsigned bytes_per_sector; +}; +#define _DISKFREE_T_DEFINED +#endif + +/* + * You really shouldn't be using these. Use the Win32 API functions instead. + * However, it does make it easier to port older code. + */ +_CRTIMP int __cdecl _getdrive (void); +_CRTIMP unsigned long __cdecl _getdrives(void); +_CRTIMP int __cdecl _chdrive (int); +_CRTIMP char* __cdecl _getdcwd (int, char*, int); +_CRTIMP unsigned __cdecl _getdiskfree (unsigned, struct _diskfree_t *); + +#ifndef _NO_OLDNAMES +# define diskfree_t _diskfree_t +#endif + +#ifndef _WDIRECT_DEFINED +/* wide character versions. Also in wchar.h */ +#ifdef __MSVCRT__ +_CRTIMP int __cdecl _wchdir(const wchar_t*); +_CRTIMP wchar_t* __cdecl _wgetcwd(wchar_t*, int); +_CRTIMP wchar_t* __cdecl _wgetdcwd(int, wchar_t*, int); +_CRTIMP int __cdecl _wmkdir(const wchar_t*); +_CRTIMP int __cdecl _wrmdir(const wchar_t*); +#endif /* __MSVCRT__ */ +#define _WDIRECT_DEFINED +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* Not RC_INVOKED */ + +#endif /* Not _DIRECT_H_ */ + +#endif /* Not __STRICT_ANSI__ */ + diff --git a/winsup/mingw/include/dirent.h b/winsup/mingw/include/dirent.h new file mode 100644 index 00000000000..5a9246a4abe --- /dev/null +++ b/winsup/mingw/include/dirent.h @@ -0,0 +1,147 @@ +/* + * DIRENT.H (formerly DIRLIB.H) + * + * by M. J. Weinstein Released to public domain 1-Jan-89 + * + * Because I have heard that this feature (opendir, readdir, closedir) + * it so useful for programmers coming from UNIX or attempting to port + * UNIX code, and because it is reasonably light weight, I have included + * it in the Mingw32 package. I have also added an implementation of + * rewinddir, seekdir and telldir. + * - Colin Peters <colin@bird.fu.is.saga-u.ac.jp> + * + * This code is distributed in the hope that is will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includeds but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision$ + * $Author$ + * $Date$ + * + */ + +#ifndef __STRICT_ANSI__ + +#ifndef _DIRENT_H_ +#define _DIRENT_H_ + +/* All the headers include this file. */ +#include <_mingw.h> + +#include <io.h> + +#ifndef RC_INVOKED + +#ifdef __cplusplus +extern "C" { +#endif + +struct dirent +{ + long d_ino; /* Always zero. */ + unsigned short d_reclen; /* Always zero. */ + unsigned short d_namlen; /* Length of name in d_name. */ + char* d_name; /* File name. */ + /* NOTE: The name in the dirent structure points to the name in the + * finddata_t structure in the DIR. */ +}; + +/* + * This is an internal data structure. Good programmers will not use it + * except as an argument to one of the functions below. + * dd_stat field is now int (was short in older versions). + */ +typedef struct +{ + /* disk transfer area for this dir */ + struct _finddata_t dd_dta; + + /* dirent struct to return from dir (NOTE: this makes this thread + * safe as long as only one thread uses a particular DIR struct at + * a time) */ + struct dirent dd_dir; + + /* _findnext handle */ + long dd_handle; + + /* + * Status of search: + * 0 = not started yet (next entry to read is first entry) + * -1 = off the end + * positive = 0 based index of next entry + */ + int dd_stat; + + /* given path for dir with search pattern (struct is extended) */ + char dd_name[1]; +} DIR; + +DIR* __cdecl opendir (const char*); +struct dirent* __cdecl readdir (DIR*); +int __cdecl closedir (DIR*); +void __cdecl rewinddir (DIR*); +long __cdecl telldir (DIR*); +void __cdecl seekdir (DIR*, long); + + +/* wide char versions */ + +struct _wdirent +{ + long d_ino; /* Always zero. */ + unsigned short d_reclen; /* Always zero. */ + unsigned short d_namlen; /* Length of name in d_name. */ + wchar_t* d_name; /* File name. */ + /* NOTE: The name in the dirent structure points to the name in the * wfinddata_t structure in the _WDIR. */ +}; + +/* + * This is an internal data structure. Good programmers will not use it + * except as an argument to one of the functions below. + */ +typedef struct +{ + /* disk transfer area for this dir */ + struct _wfinddata_t dd_dta; + + /* dirent struct to return from dir (NOTE: this makes this thread + * safe as long as only one thread uses a particular DIR struct at + * a time) */ + struct _wdirent dd_dir; + + /* _findnext handle */ + long dd_handle; + + /* + * Status of search: + * 0 = not started yet (next entry to read is first entry) + * -1 = off the end + * positive = 0 based index of next entry + */ + int dd_stat; + + /* given path for dir with search pattern (struct is extended) */ + wchar_t dd_name[1]; +} _WDIR; + + + +_WDIR* __cdecl _wopendir (const wchar_t*); +struct _wdirent* __cdecl _wreaddir (_WDIR*); +int __cdecl _wclosedir (_WDIR*); +void __cdecl _wrewinddir (_WDIR*); +long __cdecl _wtelldir (_WDIR*); +void __cdecl _wseekdir (_WDIR*, long); + + +#ifdef __cplusplus +} +#endif + +#endif /* Not RC_INVOKED */ + +#endif /* Not _DIRENT_H_ */ + +#endif /* Not __STRICT_ANSI__ */ + diff --git a/winsup/mingw/include/dos.h b/winsup/mingw/include/dos.h new file mode 100644 index 00000000000..4f2134e7e43 --- /dev/null +++ b/winsup/mingw/include/dos.h @@ -0,0 +1,110 @@ +/* + * dos.h + * + * DOS-specific functions and structures. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by J.J. van der Heijden <J.J.vanderHeijden@student.utwente.nl> + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision$ + * $Author$ + * $Date$ + * + */ + +#ifndef __STRICT_ANSI__ + +#ifndef _DOS_H_ +#define _DOS_H_ + +/* All the headers include this file. */ +#include <_mingw.h> + +#define __need_wchar_t +#ifndef RC_INVOKED +#include <stddef.h> +#endif /* Not RC_INVOKED */ + +/* For DOS file attributes */ +#include <io.h> + +#ifndef RC_INVOKED + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __MSVCRT__ /* these are in CRTDLL, but not MSVCRT */ +#ifndef __DECLSPEC_SUPPORTED +extern unsigned int *_imp___basemajor_dll; +extern unsigned int *_imp___baseminor_dll; +extern unsigned int *_imp___baseversion_dll; +extern unsigned int *_imp___osmajor_dll; +extern unsigned int *_imp___osminor_dll; +extern unsigned int *_imp___osmode_dll; + +#define _basemajor (*_imp___basemajor_dll) +#define _baseminor (*_imp___baseminor_dll) +#define _baseversion (*_imp___baseversion_dll) +#define _osmajor (*_imp___osmajor_dll) +#define _osminor (*_imp___osminor_dll) +#define _osmode (*_imp___osmode_dll) + +#else /* __DECLSPEC_SUPPORTED */ + +__MINGW_IMPORT unsigned int _basemajor_dll; +__MINGW_IMPORT unsigned int _baseminor_dll; +__MINGW_IMPORT unsigned int _baseversion_dll; +__MINGW_IMPORT unsigned int _osmajor_dll; +__MINGW_IMPORT unsigned int _osminor_dll; +__MINGW_IMPORT unsigned int _osmode_dll; + +#define _basemajor _basemajor_dll +#define _baseminor _baseminor_dll +#define _baseversion _baseversion_dll +#define _osmajor _osmajor_dll +#define _osminor _osminor_dll +#define _osmode _osmode_dll + +#endif /* __DECLSPEC_SUPPORTED */ +#endif /* ! __MSVCRT__ */ + +#ifndef _DISKFREE_T_DEFINED +/* needed by _getdiskfree (also in direct.h) */ +struct _diskfree_t { + unsigned total_clusters; + unsigned avail_clusters; + unsigned sectors_per_cluster; + unsigned bytes_per_sector; +}; +#define _DISKFREE_T_DEFINED +#endif + +_CRTIMP unsigned __cdecl _getdiskfree (unsigned, struct _diskfree_t *); + +#ifndef _NO_OLDNAMES +# define diskfree_t _diskfree_t +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* Not RC_INVOKED */ + +#endif /* Not _DOS_H_ */ + +#endif /* Not __STRICT_ANSI__ */ + diff --git a/winsup/mingw/include/errno.h b/winsup/mingw/include/errno.h new file mode 100644 index 00000000000..e4669ccec50 --- /dev/null +++ b/winsup/mingw/include/errno.h @@ -0,0 +1,117 @@ +/* + * errno.h + * + * Error numbers and access to error reporting. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp> + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision$ + * $Author$ + * $Date$ + * + */ + +#ifndef _ERRNO_H_ +#define _ERRNO_H_ + +/* All the headers include this file. */ +#include <_mingw.h> + +/* + * Error numbers. + * TODO: Can't be sure of some of these assignments, I guessed from the + * names given by strerror and the defines in the Cygnus errno.h. A lot + * of the names from the Cygnus errno.h are not represented, and a few + * of the descriptions returned by strerror do not obviously match + * their error naming. + */ +#define EPERM 1 /* Operation not permitted */ +#define ENOFILE 2 /* No such file or directory */ +#define ENOENT 2 +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted function call */ +#define EIO 5 /* Input/output error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Arg list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file descriptor */ +#define ECHILD 10 /* No child processes */ +#define EAGAIN 11 /* Resource temporarily unavailable */ +#define ENOMEM 12 /* Not enough space */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +/* 15 - Unknown Error */ +#define EBUSY 16 /* strerror reports "Resource device" */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Improper link (cross-device link?) */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* Too many open files in system */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Inappropriate I/O control operation */ +/* 26 - Unknown Error */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Invalid seek (seek on a pipe?) */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDOM 33 /* Domain error (math functions) */ +#define ERANGE 34 /* Result too large (possibly too small) */ +/* 35 - Unknown Error */ +#define EDEADLOCK 36 /* Resource deadlock avoided (non-Cyg) */ +#define EDEADLK 36 +/* 37 - Unknown Error */ +#define ENAMETOOLONG 38 /* Filename too long (91 in Cyg?) */ +#define ENOLCK 39 /* No locks available (46 in Cyg?) */ +#define ENOSYS 40 /* Function not implemented (88 in Cyg?) */ +#define ENOTEMPTY 41 /* Directory not empty (90 in Cyg?) */ +#define EILSEQ 42 /* Illegal byte sequence */ + +/* + * NOTE: ENAMETOOLONG and ENOTEMPTY conflict with definitions in the + * sockets.h header provided with windows32api-0.1.2. + * You should go and put an #if 0 ... #endif around the whole block + * of errors (look at the comment above them). + */ + +#ifndef RC_INVOKED + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Definitions of errno. For _doserrno, sys_nerr and * sys_errlist, see + * stdlib.h. + */ +#ifdef _UWIN +#undef errno +extern int errno; +#else +_CRTIMP int* __cdecl _errno(void); +#define errno (*_errno()) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* Not RC_INVOKED */ + +#endif /* Not _ERRNO_H_ */ diff --git a/winsup/mingw/include/fenv.h b/winsup/mingw/include/fenv.h new file mode 100644 index 00000000000..43dfd338a4b --- /dev/null +++ b/winsup/mingw/include/fenv.h @@ -0,0 +1,91 @@ +#ifndef _FENV_H_ +#define _FENV_H_ + + +/* FPU status word exception flags */ +#define FE_INVALID 0x01 +#define FE_DENORMAL 0x02 +#define FE_DIVBYZERO 0x04 +#define FE_OVERFLOW 0x08 +#define FE_UNDERFLOW 0x10 +#define FE_INEXACT 0x20 +#define FE_ALL_EXCEPT (FE_INVALID | FE_DENORMAL | FE_DIVBYZERO \ + | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT) + +/* FPU control word rounding flags */ +#define FE_TONEAREST 0x0000 +#define FE_DOWNWARD 0x0400 +#define FE_UPWARD 0x0800 +#define FE_TOWARDZERO 0x0c00 + +#ifndef RC_INVOKED +/* + For now, support only for the basic abstraction of flags that are + either set or clear. fexcept_t could be structure that holds more + info about the fp environment. +*/ +typedef unsigned short fexcept_t; + +/* This 28-byte struct represents the entire floating point + environment as stored by fnstenv or fstenv */ +typedef struct +{ + unsigned short __control_word; + unsigned short __unused0; + unsigned short __status_word; + unsigned short __unused1; + unsigned short __tag_word; + unsigned short __unused2; + unsigned int __ip_offset; /* instruction pointer offset */ + unsigned short __ip_selector; + unsigned short __opcode; + unsigned int __data_offset; + unsigned short __data_selector; + unsigned short __unused3; +} fenv_t; + + +/*The C99 standard (7.6.9) allows us to define implementation-specific macros for + different fp environments */ + +/* The default Intel x87 floating point environment (64-bit mantissa) */ +#define FE_PC64_ENV ((const fenv_t *)-1) + +/* The floating point environment set by MSVCRT _fpreset (53-bit mantissa) */ +#define FE_PC53_ENV ((const fenv_t *)-2) + +/* The FE_DFL_ENV macro is required by standard. + fesetenv will use the environment set at app startup.*/ +#define FE_DFL_ENV ((const fenv_t *) 0) + +#ifdef __cplusplus +extern "C" { +#endif + +/*TODO: Some of these could be inlined */ +/* 7.6.2 Exception */ + +extern int __cdecl feclearexcept (int); +extern int __cdecl fegetexceptflag (fexcept_t * flagp, int excepts); +extern int __cdecl feraiseexcept (int excepts ); +extern int __cdecl fesetexceptflag (const fexcept_t *, int); +extern int __cdecl fetestexcept (int excepts); + +/* 7.6.3 Rounding */ + +extern int __cdecl fegetround (void); +extern int __cdecl fesetround (int mode); + +/* 7.6.4 Environment */ + +extern int __cdecl fegetenv (fenv_t * envp); +extern int __cdecl fesetenv (const fenv_t * ); +extern int __cdecl feupdateenv (const fenv_t *); +extern int __cdecl feholdexcept (fenv_t *); + +#ifdef __cplusplus +} +#endif +#endif /* Not RC_INVOKED */ + +#endif /* ndef _FENV_H */ diff --git a/winsup/mingw/include/float.h b/winsup/mingw/include/float.h new file mode 100644 index 00000000000..1e3d4aa82e4 --- /dev/null +++ b/winsup/mingw/include/float.h @@ -0,0 +1,168 @@ +/* + * float.h + * + * Constants related to floating point arithmetic. + * + * Also included here are some non-ANSI bits for accessing the floating + * point controller. + * + * NOTE: GCC provides float.h, but it doesn't include the non-standard + * stuff for accessing the fp controller. We include_next the + * GCC-supplied header and just define the MS-specific extensions + * here. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp> + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision$ + * $Author$ + * $Date$ + * + */ + +#include_next<float.h> + +#ifndef _MINGW_FLOAT_H_ +#define _MINGW_FLOAT_H_ + +/* All the headers include this file. */ +#include <_mingw.h> + +/* + * Functions and definitions for controlling the FPU. + */ +#ifndef __STRICT_ANSI__ + +/* TODO: These constants are only valid for x86 machines */ + +/* Control word masks for unMask */ +#define _MCW_EM 0x0008001F /* Error masks */ +#define _MCW_IC 0x00040000 /* Infinity */ +#define _MCW_RC 0x00000300 /* Rounding */ +#define _MCW_PC 0x00030000 /* Precision */ + +/* Control word values for unNew (use with related unMask above) */ +#define _EM_INVALID 0x00000010 +#define _EM_DENORMAL 0x00080000 +#define _EM_ZERODIVIDE 0x00000008 +#define _EM_OVERFLOW 0x00000004 +#define _EM_UNDERFLOW 0x00000002 +#define _EM_INEXACT 0x00000001 +#define _IC_AFFINE 0x00040000 +#define _IC_PROJECTIVE 0x00000000 +#define _RC_CHOP 0x00000300 +#define _RC_UP 0x00000200 +#define _RC_DOWN 0x00000100 +#define _RC_NEAR 0x00000000 +#define _PC_24 0x00020000 +#define _PC_53 0x00010000 +#define _PC_64 0x00000000 + +/* These are also defined in Mingw math.h, needed to work around + GCC build issues. */ +/* Return values for fpclass. */ +#ifndef __MINGW_FPCLASS_DEFINED +#define __MINGW_FPCLASS_DEFINED 1 +#define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */ +#define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */ +#define _FPCLASS_NINF 0x0004 /* Negative Infinity */ +#define _FPCLASS_NN 0x0008 /* Negative Normal */ +#define _FPCLASS_ND 0x0010 /* Negative Denormal */ +#define _FPCLASS_NZ 0x0020 /* Negative Zero */ +#define _FPCLASS_PZ 0x0040 /* Positive Zero */ +#define _FPCLASS_PD 0x0080 /* Positive Denormal */ +#define _FPCLASS_PN 0x0100 /* Positive Normal */ +#define _FPCLASS_PINF 0x0200 /* Positive Infinity */ +#endif /* __MINGW_FPCLASS_DEFINED */ + +/* invalid subconditions (_SW_INVALID also set) */ +#define _SW_UNEMULATED 0x0040 /* unemulated instruction */ +#define _SW_SQRTNEG 0x0080 /* square root of a neg number */ +#define _SW_STACKOVERFLOW 0x0200 /* FP stack overflow */ +#define _SW_STACKUNDERFLOW 0x0400 /* FP stack underflow */ + +/* Floating point error signals and return codes */ +#define _FPE_INVALID 0x81 +#define _FPE_DENORMAL 0x82 +#define _FPE_ZERODIVIDE 0x83 +#define _FPE_OVERFLOW 0x84 +#define _FPE_UNDERFLOW 0x85 +#define _FPE_INEXACT 0x86 +#define _FPE_UNEMULATED 0x87 +#define _FPE_SQRTNEG 0x88 +#define _FPE_STACKOVERFLOW 0x8a +#define _FPE_STACKUNDERFLOW 0x8b +#define _FPE_EXPLICITGEN 0x8c /* raise( SIGFPE ); */ + +#ifndef RC_INVOKED + +#ifdef __cplusplus +extern "C" { +#endif + +/* Set the FPU control word as cw = (cw & ~unMask) | (unNew & unMask), + * i.e. change the bits in unMask to have the values they have in unNew, + * leaving other bits unchanged. */ +_CRTIMP unsigned int __cdecl _controlfp (unsigned int unNew, unsigned int unMask); +_CRTIMP unsigned int __cdecl _control87 (unsigned int unNew, unsigned int unMask); + + +_CRTIMP unsigned int __cdecl _clearfp (void); /* Clear the FPU status word */ +_CRTIMP unsigned int __cdecl _statusfp (void); /* Report the FPU status word */ +#define _clear87 _clearfp +#define _status87 _statusfp + + +/* + MSVCRT.dll _fpreset initializes the control register to 0x27f, + the status register to zero and the tag word to 0FFFFh. + This differs from asm instruction finit/fninit which set control + word to 0x37f (64 bit mantissa precison rather than 53 bit). + By default, the mingw version of _fpreset sets fp control as + per fninit. To use the MSVCRT.dll _fpreset, include CRT_fp8.o when + building your application. +*/ +void __cdecl _fpreset (void); +void __cdecl fpreset (void); + +/* Global 'variable' for the current floating point error code. */ +_CRTIMP int * __cdecl __fpecode(void); +#define _fpecode (*(__fpecode())) + +/* + * IEEE recommended functions. MS puts them in float.h + * but they really belong in math.h. + */ + +_CRTIMP double __cdecl _chgsign (double); +_CRTIMP double __cdecl _copysign (double, double); +_CRTIMP double __cdecl _logb (double); +_CRTIMP double __cdecl _nextafter (double, double); +_CRTIMP double __cdecl _scalb (double, long); + +_CRTIMP int __cdecl _finite (double); +_CRTIMP int __cdecl _fpclass (double); +_CRTIMP int __cdecl _isnan (double); + +#ifdef __cplusplus +} +#endif + +#endif /* Not RC_INVOKED */ + +#endif /* Not __STRICT_ANSI__ */ + +#endif /* _FLOAT_H_ */ + diff --git a/winsup/mingw/include/getopt.h b/winsup/mingw/include/getopt.h new file mode 100644 index 00000000000..6b6f643b7d4 --- /dev/null +++ b/winsup/mingw/include/getopt.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 1987, 1993, 1994, 1996 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef __GETOPT_H__ +#define __GETOPT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int opterr; /* if error message should be printed */ +extern int optind; /* index into parent argv vector */ +extern int optopt; /* character checked for validity */ +extern int optreset; /* reset getopt */ +extern char *optarg; /* argument associated with option */ + +int getopt (int, char * const *, const char *); + +#ifdef __cplusplus +} +#endif + +#endif /* __GETOPT_H__ */ + +#ifndef __UNISTD_GETOPT__ +#ifndef __GETOPT_LONG_H__ +#define __GETOPT_LONG_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +struct option { + const char *name; + int has_arg; + int *flag; + int val; +}; + +int getopt_long (int, char *const *, const char *, const struct option *, int *); +#ifndef HAVE_DECL_GETOPT +#define HAVE_DECL_GETOPT 1 +#endif + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +#ifdef __cplusplus +} +#endif + +#endif /* __GETOPT_LONG_H__ */ +#endif /* __UNISTD_GETOPT__ */ diff --git a/winsup/mingw/include/inttypes.h b/winsup/mingw/include/inttypes.h index f5b4d78133b..31bfd4d20c5 100644 --- a/winsup/mingw/include/inttypes.h +++ b/winsup/mingw/include/inttypes.h @@ -254,19 +254,21 @@ typedef struct { #endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */ -extern __inline__ intmax_t imaxabs (intmax_t __j) +extern __inline__ intmax_t __cdecl imaxabs (intmax_t __j) {return (__j >= 0 ? __j : -__j);} -imaxdiv_t imaxdiv (intmax_t numer, intmax_t denom); +imaxdiv_t __cdecl imaxdiv (intmax_t numer, intmax_t denom); /* 7.8.2 Conversion functions for greatest-width integer types */ -intmax_t strtoimax (const char* __restrict__ nptr, char** __restrict__ endptr, int base); -uintmax_t strtoumax (const char* __restrict__ nptr, char** __restrict__ endptr, int base); +intmax_t __cdecl strtoimax (const char* __restrict__ nptr, + char** __restrict__ endptr, int base); +uintmax_t __cdecl strtoumax (const char* __restrict__ nptr, + char** __restrict__ endptr, int base); -intmax_t wcstoimax (const wchar_t* __restrict__ nptr, wchar_t** __restrict__ endptr, - int base); -uintmax_t wcstoumax (const wchar_t* __restrict__ nptr, wchar_t** __restrict__ endptr, - int base); +intmax_t __cdecl wcstoimax (const wchar_t* __restrict__ nptr, + wchar_t** __restrict__ endptr, int base); +uintmax_t __cdecl wcstoumax (const wchar_t* __restrict__ nptr, + wchar_t** __restrict__ endptr, int base); #ifdef __cplusplus } diff --git a/winsup/mingw/include/io.h b/winsup/mingw/include/io.h index ab12c7c1e5a..321f4d7ae3d 100644 --- a/winsup/mingw/include/io.h +++ b/winsup/mingw/include/io.h @@ -126,52 +126,52 @@ struct _wfinddatai64_t { * _findclose calls. _findnext also returns -1 if no match could be found, * and 0 if a match was found. Call _findclose when you are finished. */ -int _findfirst (const char*, struct _finddata_t*); -int _findnext (int, struct _finddata_t*); -int _findclose (int); +_CRTIMP int __cdecl _findfirst (const char*, struct _finddata_t*); +_CRTIMP int __cdecl _findnext (int, struct _finddata_t*); +_CRTIMP int __cdecl _findclose (int); -int _chdir (const char*); -char* _getcwd (char*, int); -int _mkdir (const char*); -char* _mktemp (char*); -int _rmdir (const char*); -int _chmod (const char*, int); +_CRTIMP int __cdecl _chdir (const char*); +_CRTIMP char* __cdecl _getcwd (char*, int); +_CRTIMP int __cdecl _mkdir (const char*); +_CRTIMP char* __cdecl _mktemp (char*); +_CRTIMP int __cdecl _rmdir (const char*); +_CRTIMP int __cdecl _chmod (const char*, int); #ifdef __MSVCRT__ -__int64 _filelengthi64(int); -long _findfirsti64(const char*, struct _finddatai64_t*); -int _findnexti64(long, struct _finddatai64_t*); -__int64 _lseeki64(int, __int64, int); -__int64 _telli64(int); +_CRTIMP __int64 __cdecl _filelengthi64(int); +_CRTIMP long __cdecl _findfirsti64(const char*, struct _finddatai64_t*); +_CRTIMP int __cdecl _findnexti64(long, struct _finddatai64_t*); +_CRTIMP __int64 __cdecl _lseeki64(int, __int64, int); +_CRTIMP __int64 __cdecl _telli64(int); #endif /* __MSVCRT__ */ #ifndef _NO_OLDNAMES #ifndef _UWIN -int chdir (const char*); -char* getcwd (char*, int); -int mkdir (const char*); -char* mktemp (char*); -int rmdir (const char*); -int chmod (const char*, int); +_CRTIMP int __cdecl chdir (const char*); +_CRTIMP char* __cdecl getcwd (char*, int); +_CRTIMP int __cdecl mkdir (const char*); +_CRTIMP char* __cdecl mktemp (char*); +_CRTIMP int __cdecl rmdir (const char*); +_CRTIMP int __cdecl chmod (const char*, int); #endif /* _UWIN */ #endif /* Not _NO_OLDNAMES */ -int _access (const char*, int); -int _chsize (int, long); -int _close (int); -int _commit(int); +_CRTIMP int __cdecl _access (const char*, int); +_CRTIMP int __cdecl _chsize (int, long); +_CRTIMP int __cdecl _close (int); +_CRTIMP int __cdecl _commit(int); /* NOTE: The only significant bit in unPermissions appears to be bit 7 (0x80), * the "owner write permission" bit (on FAT). */ -int _creat (const char*, int); +_CRTIMP int __cdecl _creat (const char*, int); -int _dup (int); -int _dup2 (int, int); -long _filelength (int); -long _get_osfhandle (int); -int _isatty (int); +_CRTIMP int __cdecl _dup (int); +_CRTIMP int __cdecl _dup2 (int, int); +_CRTIMP long _cdecl _filelength (int); +_CRTIMP long _cdecl _get_osfhandle (int); +_CRTIMP int __cdecl _isatty (int); /* In a very odd turn of events this function is excluded from those * files which define _STREAM_COMPAT. This is required in order to @@ -179,31 +179,31 @@ int _isatty (int); * line 107. Actually I might just be able to change the name of * the enum member in streambuf.h... we'll see. TODO */ #ifndef _STREAM_COMPAT -int _eof (int); +_CRTIMP int __cdecl _eof (int); #endif /* LK_... locking commands defined in sys/locking.h. */ -int _locking (int, int, long); +_CRTIMP int __cdecl _locking (int, int, long); -long _lseek (int, long, int); +_CRTIMP long _cdecl _lseek (int, long, int); /* Optional third argument is unsigned unPermissions. */ -int _open (const char*, int, ...); +_CRTIMP int __cdecl _open (const char*, int, ...); -int _open_osfhandle (long, int); -int _pipe (int *, unsigned int, int); -int _read (int, void*, unsigned int); -int _setmode (int, int); +_CRTIMP int __cdecl _open_osfhandle (long, int); +_CRTIMP int __cdecl _pipe (int *, unsigned int, int); +_CRTIMP int __cdecl _read (int, void*, unsigned int); +_CRTIMP int __cdecl _setmode (int, int); /* SH_... flags for nShFlags defined in share.h * Optional fourth argument is unsigned unPermissions */ -int _sopen (const char*, int, int, ...); +_CRTIMP int __cdecl _sopen (const char*, int, int, ...); -long _tell (int); +_CRTIMP long _cdecl _tell (int); /* Should umask be in sys/stat.h and/or sys/types.h instead? */ -int _umask (int); -int _unlink (const char*); -int _write (int, const void*, unsigned int); +_CRTIMP int __cdecl _umask (int); +_CRTIMP int __cdecl _unlink (const char*); +_CRTIMP int __cdecl _write (int, const void*, unsigned int); #ifndef _NO_OLDNAMES /* @@ -212,24 +212,24 @@ int _write (int, const void*, unsigned int); */ #ifndef _UWIN -int access (const char*, int); -int chsize (int, long ); -int close (int); -int creat (const char*, int); -int dup (int); -int dup2 (int, int); -int eof (int); -long filelength (int); -int isatty (int); -long lseek (int, long, int); -int open (const char*, int, ...); -int read (int, void*, unsigned int); -int setmode (int, int); -int sopen (const char*, int, int, ...); -long tell (int); -int umask (int); -int unlink (const char*); -int write (int, const void*, unsigned int); +_CRTIMP int __cdecl access (const char*, int); +_CRTIMP int __cdecl chsize (int, long ); +_CRTIMP int __cdecl close (int); +_CRTIMP int __cdecl creat (const char*, int); +_CRTIMP int __cdecl dup (int); +_CRTIMP int __cdecl dup2 (int, int); +_CRTIMP int __cdecl eof (int); +_CRTIMP long _cdecl filelength (int); +_CRTIMP int __cdecl isatty (int); +_CRTIMP long _cdecl lseek (int, long, int); +_CRTIMP int __cdecl open (const char*, int, ...); +_CRTIMP int __cdecl read (int, void*, unsigned int); +_CRTIMP int __cdecl setmode (int, int); +_CRTIMP int __cdecl sopen (const char*, int, int, ...); +_CRTIMP long _cdecl tell (int); +_CRTIMP int __cdecl umask (int); +_CRTIMP int __cdecl unlink (const char*); +_CRTIMP int __cdecl write (int, const void*, unsigned int); #endif /* _UWIN */ #endif /* Not _NO_OLDNAMES */ @@ -237,17 +237,17 @@ int write (int, const void*, unsigned int); /* Not in crtdll.dll */ #if !defined (_WIO_DEFINED) #if defined (__MSVCRT__) -int _waccess(const wchar_t*, int); -int _wchmod(const wchar_t*, int); -int _wcreat(const wchar_t*, int); -long _wfindfirst(const wchar_t*, struct _wfinddata_t*); -int _wfindnext(long, struct _wfinddata_t *); -int _wunlink(const wchar_t*); -int _wopen(const wchar_t*, int, ...); -int _wsopen(const wchar_t*, int, int, ...); -wchar_t * _wmktemp(wchar_t*); -long _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*); -int _wfindnexti64(long, struct _wfinddatai64_t*); +_CRTIMP int __cdecl _waccess(const wchar_t*, int); +_CRTIMP int __cdecl _wchmod(const wchar_t*, int); +_CRTIMP int __cdecl _wcreat(const wchar_t*, int); +_CRTIMP long _cdecl _wfindfirst(const wchar_t*, struct _wfinddata_t*); +_CRTIMP int __cdecl _wfindnext(long, struct _wfinddata_t *); +_CRTIMP int __cdecl _wunlink(const wchar_t*); +_CRTIMP int __cdecl _wopen(const wchar_t*, int, ...); +_CRTIMP int __cdecl _wsopen(const wchar_t*, int, int, ...); +_CRTIMP wchar_t * __cdecl _wmktemp(wchar_t*); +_CRTIMP long __cdecl _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*); +_CRTIMP int __cdecl _wfindnexti64(long, struct _wfinddatai64_t*); #ifndef __NO_OLDNAMES /* Where do these live? Not in libmoldname.a nor in libmsvcrt.a */ diff --git a/winsup/mingw/include/locale.h b/winsup/mingw/include/locale.h index 9bd23203c2f..cfbf9c2bff8 100644 --- a/winsup/mingw/include/locale.h +++ b/winsup/mingw/include/locale.h @@ -51,7 +51,16 @@ #ifndef RC_INVOKED +/* According to C89 std, NULL is defined in locale.h too */ +#define __need_NULL +#include <stddef.h> + __BEGIN_CSTD_NAMESPACE + +/* According to C89 std, NULL is defined in locale.h too. */ +#define __need_NULL +#include <stddef.h> + /* * The structure returned by 'localeconv'. */ @@ -77,8 +86,8 @@ struct lconv char n_sign_posn; }; -char* setlocale (int, const char*); -struct lconv* localeconv (void); +_CRTIMP char* __cdecl setlocale (int, const char*); +_CRTIMP struct lconv* __cdecl localeconv (void); __END_CSTD_NAMESPACE @@ -86,7 +95,7 @@ __END_CSTD_NAMESPACE # define __need_wchar_t # include <stddef.h> __BEGIN_CGLOBAL_NAMESPACE - wchar_t* _wsetlocale(int, const wchar_t*); +_CRTIMP wchar_t* __cdecl _wsetlocale(int, const wchar_t*); __END_CGLOBAL_NAMESPACE # define _WLOCALE_DEFINED #endif /* ndef _WLOCALE_DEFINED */ diff --git a/winsup/mingw/include/malloc.h b/winsup/mingw/include/malloc.h index 097a5e1c1f4..834e0212f14 100644 --- a/winsup/mingw/include/malloc.h +++ b/winsup/mingw/include/malloc.h @@ -60,26 +60,26 @@ extern "C" { The _heap* memory allocation functions are supported on NT but not W9x. On latter, they always set errno to ENOSYS. */ -int _heapwalk (_HEAPINFO*); +_CRTIMP int __cdecl _heapwalk (_HEAPINFO*); #ifdef __GNUC__ #define _alloca(x) __builtin_alloca((x)) #endif #ifndef _NO_OLDNAMES -int heapwalk (_HEAPINFO*); +_CRTIMP int __cdecl heapwalk (_HEAPINFO*); #ifdef __GNUC__ #define alloca(x) __builtin_alloca((x)) #endif #endif /* Not _NO_OLDNAMES */ -int _heapchk (void); /* Verify heap integrety. */ -int _heapmin (void); /* Return unused heap to the OS. */ -int _heapset (unsigned int); +_CRTIMP int __cdecl _heapchk (void); /* Verify heap integrety. */ +_CRTIMP int __cdecl _heapmin (void); /* Return unused heap to the OS. */ +_CRTIMP int __cdecl _heapset (unsigned int); -size_t _msize (void*); -size_t _get_sbh_threshold (void); -int _set_sbh_threshold (size_t); -void * _expand (void*, size_t); +_CRTIMP size_t __cdecl _msize (void*); +_CRTIMP size_t __cdecl _get_sbh_threshold (void); +_CRTIMP int __cdecl _set_sbh_threshold (size_t); +_CRTIMP void* __cdecl _expand (void*, size_t); #ifdef __cplusplus } diff --git a/winsup/mingw/include/math.h b/winsup/mingw/include/math.h index 377828973a1..10ca8c53896 100644 --- a/winsup/mingw/include/math.h +++ b/winsup/mingw/include/math.h @@ -144,34 +144,34 @@ struct _exception __END_CGLOBAL_NAMESPACE __BEGIN_CSTD_NAMESPACE -double sin (double); -double cos (double); -double tan (double); -double sinh (double); -double cosh (double); -double tanh (double); -double asin (double); -double acos (double); -double atan (double); -double atan2 (double, double); -double exp (double); -double log (double); -double log10 (double); -double pow (double, double); -double sqrt (double); -double ceil (double); -double floor (double); -double fabs (double); -extern __inline__ double fabs (double __x) +_CRTIMP double __cdecl sin (double); +_CRTIMP double __cdecl cos (double); +_CRTIMP double __cdecl tan (double); +_CRTIMP double __cdecl sinh (double); +_CRTIMP double __cdecl cosh (double); +_CRTIMP double __cdecl tanh (double); +_CRTIMP double __cdecl asin (double); +_CRTIMP double __cdecl acos (double); +_CRTIMP double __cdecl atan (double); +_CRTIMP double __cdecl atan2 (double, double); +_CRTIMP double __cdecl exp (double); +_CRTIMP double __cdecl log (double); +_CRTIMP double __cdecl log10 (double); + double __cdecl pow (double, double); +_CRTIMP double __cdecl sqrt (double); +_CRTIMP double __cdecl ceil (double); +_CRTIMP double __cdecl floor (double); +_CRTIMP double __cdecl fabs (double); +extern __inline__ __cdecl double fabs (double __x) { double res; __asm__ ("fabs;" : "=t" (res) : "0" (__x)); return res; } -double ldexp (double, int); -double frexp (double, int*); -double modf (double, double*); -double fmod (double, double); +_CRTIMP double __cdecl ldexp (double, int); +_CRTIMP double __cdecl frexp (double, int*); +_CRTIMP double __cdecl modf (double, double*); +_CRTIMP double __cdecl fmod (double, double); __END_CSTD_NAMESPACE __BEGIN_CGLOBAL_NAMESPACE @@ -185,16 +185,16 @@ struct _complex double y; /* Imaginary part */ }; -double _cabs (struct _complex); +_CRTIMP double __cdecl _cabs (struct _complex); -double _hypot (double, double); -double _j0 (double); -double _j1 (double); -double _jn (int, double); -double _y0 (double); -double _y1 (double); -double _yn (int, double); -int _matherr (struct _exception *); +_CRTIMP double __cdecl _hypot (double, double); +_CRTIMP double __cdecl _j0 (double); +_CRTIMP double __cdecl _j1 (double); +_CRTIMP double __cdecl _jn (int, double); +_CRTIMP double __cdecl _y0 (double); +_CRTIMP double __cdecl _y1 (double); +_CRTIMP double __cdecl _yn (int, double); +_CRTIMP int __cdecl _matherr (struct _exception *); /* These are also declared in Mingw float.h; needed here as well to work around GCC build issues. */ @@ -203,15 +203,15 @@ int _matherr (struct _exception *); * IEEE recommended functions */ -double _chgsign (double); -double _copysign (double, double); -double _logb (double); -double _nextafter (double, double); -double _scalb (double, long); +_CRTIMP double __cdecl _chgsign (double); +_CRTIMP double __cdecl _copysign (double, double); +_CRTIMP double __cdecl _logb (double); +_CRTIMP double __cdecl _nextafter (double, double); +_CRTIMP double __cdecl _scalb (double, long); -int _finite (double); -int _fpclass (double); -int _isnan (double); +_CRTIMP int __cdecl _finite (double); +_CRTIMP int __cdecl _fpclass (double); +_CRTIMP int __cdecl _isnan (double); /* END FLOAT.H COPY */ @@ -223,18 +223,18 @@ int _isnan (double); #if !defined (_NO_OLDNAMES) -double cabs (struct _complex); -double j0 (double); -double j1 (double); -double jn (int, double); -double y0 (double); -double y1 (double); -double yn (int, double); +_CRTIMP double __cdecl cabs (struct _complex); +_CRTIMP double __cdecl j0 (double); +_CRTIMP double __cdecl j1 (double); +_CRTIMP double __cdecl jn (int, double); +_CRTIMP double __cdecl y0 (double); +_CRTIMP double __cdecl y1 (double); +_CRTIMP double __cdecl yn (int, double); -double chgsign (double); -double scalb (double, long); -int finite (double); -int fpclass (double); +_CRTIMP double __cdecl chgsign (double); +_CRTIMP double __cdecl scalb (double, long); +_CRTIMP int __cdecl finite (double); +_CRTIMP int __cdecl fpclass (double); #endif /* Not _NO_OLDNAMES */ @@ -244,7 +244,7 @@ int fpclass (double); #ifndef __NO_ISOCEXT #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ - || !defined __STRICT_ANSI__ || defined __GLIBCPP__ + || !defined __STRICT_ANSI__ || defined __GLIBCPP__ #define NAN (0.0F/0.0F) #define HUGE_VALF (1.0F/0.0F) @@ -272,18 +272,18 @@ int fpclass (double); converted to double, and zero when converted to float.) */ -extern int __fpclassifyf (float); -extern int __fpclassify (double); +extern int __cdecl __fpclassifyf (float); +extern int __cdecl __fpclassify (double); -extern __inline__ int __fpclassifyl (long double __x){ +extern __inline__ __cdecl int __fpclassifyl (long double __x){ unsigned short sw; __asm__ ("fxam; fstsw %%ax;" : "=a" (sw): "t" (__x)); return sw & (FP_NAN | FP_NORMAL | FP_ZERO ); } -#define fpclassify(__x) (sizeof (__x) == sizeof (float) ? __fpclassifyf (__x) \ - : sizeof (__x) == sizeof (double) ? __fpclassify (__x) \ - : __fpclassifyl (__x)) +#define fpclassify(__x) (sizeof (__x) == sizeof (float) ? __fpclassifyf (__x) \ + : sizeof (__x) == sizeof (double) ? __fpclassify (__x) \ + : __fpclassifyl (__x)) /* 7.12.3.2 */ #define isfinite(__x) ((fpclassify(__x) & FP_NAN) == 0) @@ -295,7 +295,7 @@ extern __inline__ int __fpclassifyl (long double __x){ /* We don't need to worry about trucation here: A NaN stays a NaN. */ -extern __inline__ int __isnan (double __x) +extern __inline__ __cdecl int __isnan (double __x) { unsigned short sw; __asm__ ("fxam;" @@ -304,7 +304,7 @@ extern __inline__ int __isnan (double __x) == FP_NAN; } -extern __inline__ int __isnanf (float __x) +extern __inline__ __cdecl int __isnanf (float __x) { unsigned short sw; __asm__ ("fxam;" @@ -313,7 +313,7 @@ extern __inline__ int __isnanf (float __x) == FP_NAN; } -extern __inline__ int __isnanl (long double __x) +extern __inline__ __cdecl int __isnanl (long double __x) { unsigned short sw; __asm__ ("fxam;" @@ -331,18 +331,18 @@ extern __inline__ int __isnanl (long double __x) #define isnormal(__x) (fpclassify(__x) == FP_NORMAL) /* 7.12.3.6 The signbit macro */ -extern __inline__ int __signbit (double __x) { +extern __inline__ int __cdecl __signbit (double __x) { unsigned short stw; __asm__ ( "fxam; fstsw %%ax;": "=a" (stw) : "t" (__x)); return stw & 0x0200; } -extern __inline__ int __signbitf (float __x) { +extern __inline__ int __cdecl __signbitf (float __x) { unsigned short stw; __asm__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (__x)); return stw & 0x0200; } -extern __inline__ int __signbitl (long double __x) { +extern __inline__ int __cdecl __signbitl (long double __x) { unsigned short stw; __asm__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (__x)); return stw & 0x0200; @@ -354,97 +354,97 @@ extern __inline__ int __signbitl (long double __x) { : __signbitl (__x)) /* 7.12.4 Trigonometric functions: Double in C89 */ -extern float sinf (float); -extern long double sinl (long double); +extern float __cdecl sinf (float); +extern long __cdecl double sinl (long double); -extern float cosf (float); -extern long double cosl (long double); +extern float __cdecl cosf (float); +extern long double __cdecl cosl (long double); -extern float tanf (float); -extern long double tanl (long double); +extern float __cdecl tanf (float); +extern long double __cdecl tanl (long double); -extern float asinf (float); -extern long double asinl (long double); +extern float __cdecl asinf (float); +extern long double __cdecl asinl (long double); -extern float acosf (float); +extern float __cdecl acosf (float); extern long double acosl (long double); -extern float atanf (float); +extern float __cdecl atanf (float); extern long double atanl (long double); -extern float atan2f (float, float); -extern long double atan2l (long double, long double); +extern float __cdecl atan2f (float, float); +extern long double __cdecl atan2l (long double, long double); /* 7.12.5 Hyperbolic functions: Double in C89 */ -extern __inline__ float sinhf (float __x) +extern __inline__ float __cdecl sinhf (float __x) {return (float) __CSTD sinh (__x);} -extern long double sinhl (long double); +extern long double __cdecl sinhl (long double); -extern __inline__ float coshf (float __x) +extern __inline__ float __cdecl coshf (float __x) {return (float) __CSTD cosh (__x);} -extern long double coshl (long double); +extern long double __cdecl coshl (long double); -extern __inline__ float tanhf (float __x) +extern __inline__ float __cdecl tanhf (float __x) {return (float) __CSTD tanh (__x);} -extern long double tanhl (long double); +extern long double __cdecl tanhl (long double); /* * TODO: asinh, acosh, atanh */ /* 7.12.6.1 Double in C89 */ -extern __inline__ float expf (float __x) +extern __inline__ float __cdecl expf (float __x) {return (float) __CSTD exp (__x);} -extern long double expl (long double); +extern long double __cdecl expl (long double); /* 7.12.6.2 */ -extern double exp2(double); -extern float exp2f(float); -extern long double exp2l(long double); +extern double __cdecl exp2(double); +extern float __cdecl exp2f(float); +extern long double __cdecl exp2l(long double); /* 7.12.6.3 The expm1 functions: TODO */ /* 7.12.6.4 Double in C89 */ -extern __inline__ float frexpf (float __x, int* __expn) +extern __inline__ float __cdecl frexpf (float __x, int* __expn) {return (float) __CSTD frexp (__x, __expn);} -extern long double frexpl (long double, int*); +extern long double __cdecl frexpl (long double, int*); /* 7.12.6.5 */ #define FP_ILOGB0 ((int)0x80000000) #define FP_ILOGBNAN ((int)0x80000000) -extern int ilogb (double); -extern int ilogbf (float); -extern int ilogbl (long double); +extern int __cdecl ilogb (double); +extern int __cdecl ilogbf (float); +extern int __cdecl ilogbl (long double); /* 7.12.6.6 Double in C89 */ -extern __inline__ float ldexpf (float __x, int __expn) +extern __inline__ float __cdecl ldexpf (float __x, int __expn) {return (float) __CSTD ldexp (__x, __expn);} -extern long double ldexpl (long double, int); +extern long double __cdecl ldexpl (long double, int); /* 7.12.6.7 Double in C89 */ -extern float logf (float); -extern long double logl (long double); +extern float __cdecl logf (float); +extern long double __cdecl logl (long double); /* 7.12.6.8 Double in C89 */ -extern float log10f (float); -extern long double log10l (long double); +extern float __cdecl log10f (float); +extern long double __cdecl log10l (long double); /* 7.12.6.9 */ -extern double log1p(double); -extern float log1pf(float); -extern long double log1pl(long double); +extern double __cdecl log1p(double); +extern float __cdecl log1pf(float); +extern long double __cdecl log1pl(long double); /* 7.12.6.10 */ -extern double log2 (double); -extern float log2f (float); -extern long double log2l (long double); +extern double __cdecl log2 (double); +extern float __cdecl log2f (float); +extern long double __cdecl log2l (long double); /* 7.12.6.11 */ -extern double logb (double); -extern float logbf (float); -extern long double logbl (long double); +extern double __cdecl logb (double); +extern float __cdecl logbf (float); +extern long double __cdecl logbl (long double); -extern __inline__ double logb (double __x) +extern __inline__ double __cdecl logb (double __x) { double res; __asm__ ("fxtract\n\t" @@ -452,7 +452,7 @@ extern __inline__ double logb (double __x) return res; } -extern __inline__ float logbf (float __x) +extern __inline__ float __cdecl logbf (float __x) { float res; __asm__ ("fxtract\n\t" @@ -460,7 +460,7 @@ extern __inline__ float logbf (float __x) return res; } -extern __inline__ long double logbl (long double __x) +extern __inline__ long double __cdecl logbl (long double __x) { long double res; __asm__ ("fxtract\n\t" @@ -469,33 +469,33 @@ extern __inline__ long double logbl (long double __x) } /* 7.12.6.12 Double in C89 */ -extern float modff (float, float*); -extern long double modfl (long double, long double*); +extern float __cdecl modff (float, float*); +extern long double __cdecl modfl (long double, long double*); /* 7.12.6.13 */ -extern double scalbn (double, int); -extern float scalbnf (float, int); -extern long double scalbnl (long double, int); +extern double __cdecl scalbn (double, int); +extern float __cdecl scalbnf (float, int); +extern long double __cdecl scalbnl (long double, int); -extern double scalbln (double, long); -extern float scalblnf (float, long); -extern long double scalblnl (long double, long); +extern double __cdecl scalbln (double, long); +extern float __cdecl scalblnf (float, long); +extern long double __cdecl scalblnl (long double, long); /* 7.12.7.1 */ /* Implementations adapted from Cephes versions */ -extern double cbrt (double); -extern float cbrtf (float); -extern long double cbrtl (long double); +extern double __cdecl cbrt (double); +extern float __cdecl cbrtf (float); +extern long double __cdecl cbrtl (long double); /* 7.12.7.2 The fabs functions: Double in C89 */ -extern __inline__ float fabsf (float __x) +extern __inline__ float __cdecl fabsf (float __x) { float res; __asm__ ("fabs;" : "=t" (res) : "0" (__x)); return res; } -extern __inline__ long double fabsl (long double __x) +extern __inline__ long double __cdecl fabsl (long double __x) { long double res; __asm__ ("fabs;" : "=t" (res) : "0" (__x)); @@ -503,74 +503,74 @@ extern __inline__ long double fabsl (long double __x) } /* 7.12.7.3 */ -extern double hypot (double, double); /* in libmoldname.a */ -extern __inline__ float hypotf (float __x, float __y) +extern double __cdecl hypot (double, double); /* in libmoldname.a */ +extern __inline__ float __cdecl hypotf (float __x, float __y) { return (float) hypot (__x, __y);} -extern long double hypotl (long double, long double); +extern long double __cdecl hypotl (long double, long double); /* 7.12.7.4 The pow functions. Double in C89 */ -extern __inline__ float powf (float __x, float __y) +extern __inline__ float __cdecl powf (float __x, float __y) {return (float) __CSTD pow (__x, __y);} -extern long double powl (long double, long double); +extern long double __cdecl powl (long double, long double); /* 7.12.7.5 The sqrt functions. Double in C89. */ -extern float sqrtf (float); -extern long double sqrtl (long double); +extern float __cdecl sqrtf (float); +extern long double __cdecl sqrtl (long double); /* 7.12.8.1 The erf functions */ -extern double erf (double); -extern float erff (float); +extern double __cdecl erf (double); +extern float __cdecl erff (float); /* TODO -extern long double erfl (long double); +extern long double __cdecl erfl (long double); */ /* 7.12.8.2 The erfc functions */ -extern double erfc (double); -extern float erfcf (float); +extern double __cdecl erfc (double); +extern float __cdecl erfcf (float); /* TODO -extern long double erfcl (long double); +extern long double __cdecl erfcl (long double); */ /* 7.12.8.3 The lgamma functions */ -extern double lgamma (double); -extern float lgammaf (float); -extern long double lgammal (long double); +extern double __cdecl lgamma (double); +extern float __cdecl lgammaf (float); +extern long double __cdecl lgammal (long double); /* 7.12.8.4 The tgamma functions */ -extern double tgamma (double); -extern float tgammaf (float); -extern long double tgammal (long double); +extern double __cdecl tgamma (double); +extern float __cdecl tgammaf (float); +extern long double __cdecl tgammal (long double); /* 7.12.9.1 Double in C89 */ -extern float ceilf (float); -extern long double ceill (long double); +extern float __cdecl ceilf (float); +extern long double __cdecl ceill (long double); /* 7.12.9.2 Double in C89 */ -extern float floorf (float); -extern long double floorl (long double); +extern float __cdecl floorf (float); +extern long double __cdecl floorl (long double); /* 7.12.9.3 */ -extern double nearbyint ( double); -extern float nearbyintf (float); -extern long double nearbyintl (long double); +extern double __cdecl nearbyint ( double); +extern float __cdecl nearbyintf (float); +extern long double __cdecl nearbyintl (long double); /* 7.12.9.4 */ /* round, using fpu control word settings */ -extern __inline__ double rint (double __x) +extern __inline__ double __cdecl rint (double __x) { double retval; __asm__ ("frndint;": "=t" (retval) : "0" (__x)); return retval; } -extern __inline__ float rintf (float __x) +extern __inline__ float __cdecl rintf (float __x) { float retval; __asm__ ("frndint;" : "=t" (retval) : "0" (__x) ); return retval; } -extern __inline__ long double rintl (long double __x) +extern __inline__ long double __cdecl rintl (long double __x) { long double retval; __asm__ ("frndint;" : "=t" (retval) : "0" (__x) ); @@ -578,7 +578,7 @@ extern __inline__ long double rintl (long double __x) } /* 7.12.9.5 */ -extern __inline__ long lrint (double __x) +extern __inline__ long __cdecl lrint (double __x) { long retval; __asm__ __volatile__ \ @@ -586,7 +586,7 @@ extern __inline__ long lrint (double __x) return retval; } -extern __inline__ long lrintf (float __x) +extern __inline__ long __cdecl lrintf (float __x) { long retval; __asm__ __volatile__ \ @@ -594,7 +594,7 @@ extern __inline__ long lrintf (float __x) return retval; } -extern __inline__ long lrintl (long double __x) +extern __inline__ long __cdecl lrintl (long double __x) { long retval; __asm__ __volatile__ \ @@ -602,7 +602,7 @@ extern __inline__ long lrintl (long double __x) return retval; } -extern __inline__ long long llrint (double __x) +extern __inline__ long long __cdecl llrint (double __x) { long long retval; __asm__ __volatile__ \ @@ -610,7 +610,7 @@ extern __inline__ long long llrint (double __x) return retval; } -extern __inline__ long long llrintf (float __x) +extern __inline__ long long __cdecl llrintf (float __x) { long long retval; __asm__ __volatile__ \ @@ -618,7 +618,7 @@ extern __inline__ long long llrintf (float __x) return retval; } -extern __inline__ long long llrintl (long double __x) +extern __inline__ long long __cdecl llrintl (long double __x) { long long retval; __asm__ __volatile__ \ @@ -628,48 +628,48 @@ extern __inline__ long long llrintl (long double __x) /* 7.12.9.6 */ /* round away from zero, regardless of fpu control word settings */ -extern double round (double); -extern float roundf (float); -extern long double roundl (long double); +extern double __cdecl round (double); +extern float __cdecl roundf (float); +extern long double __cdecl roundl (long double); /* 7.12.9.7 */ -extern long lround (double); -extern long lroundf (float); -extern long lroundl (long double); +extern long __cdecl lround (double); +extern long __cdecl lroundf (float); +extern long __cdecl lroundl (long double); -extern long long llround (double); -extern long long llroundf (float); -extern long long llroundl (long double); +extern long long __cdecl llround (double); +extern long long __cdecl llroundf (float); +extern long long __cdecl llroundl (long double); /* 7.12.9.8 */ /* round towards zero, regardless of fpu control word settings */ -extern double trunc (double); -extern float truncf (float); -extern long double truncl (long double); +extern double __cdecl trunc (double); +extern float __cdecl truncf (float); +extern long double __cdecl truncl (long double); /* 7.12.10.1 Double in C89 */ -extern float fmodf (float, float); -extern long double fmodl (long double, long double); +extern float __cdecl fmodf (float, float); +extern long double __cdecl fmodl (long double, long double); /* 7.12.10.2 */ -extern double remainder (double, double); -extern float remainderf (float, float); -extern long double remainderl (long double, long double); +extern double __cdecl remainder (double, double); +extern float __cdecl remainderf (float, float); +extern long double __cdecl remainderl (long double, long double); /* 7.12.10.3 */ -extern double remquo(double, double, int *); -extern float remquof(float, float, int *); -extern long double remquol(long double, long double, int *); +extern double __cdecl remquo(double, double, int *); +extern float __cdecl remquof(float, float, int *); +extern long double __cdecl remquol(long double, long double, int *); /* 7.12.11.1 */ -extern double copysign (double, double); /* in libmoldname.a */ -extern float copysignf (float, float); -extern long double copysignl (long double, long double); +extern double __cdecl copysign (double, double); /* in libmoldname.a */ +extern float __cdecl copysignf (float, float); +extern long double __cdecl copysignl (long double, long double); /* 7.12.11.2 Return a NaN */ -extern double nan(const char *tagp); -extern float nanf(const char *tagp); -extern long double nanl(const char *tagp); +extern double __cdecl nan(const char *tagp); +extern float __cdecl nanf(const char *tagp); +extern long double __cdecl nanl(const char *tagp); #ifndef __STRICT_ANSI__ #define _nan() nan("") @@ -678,8 +678,8 @@ extern long double nanl(const char *tagp); #endif /* 7.12.11.3 */ -extern double nextafter (double, double); /* in libmoldname.a */ -extern float nextafterf (float, float); +extern double __cdecl nextafter (double, double); /* in libmoldname.a */ +extern float __cdecl nextafterf (float, float); /* TODO: Not yet implemented */ /* extern long double nextafterl (long double, long double); */ @@ -687,9 +687,9 @@ extern float nextafterf (float, float); /* 7.12.12.1 */ /* x > y ? (x - y) : 0.0 */ -extern double fdim (double __x, double __y); -extern float fdimf (float __x, float __y); -extern long double fdiml (long double __x, long double __y); +extern double __cdecl fdim (double __x, double __y); +extern float __cdecl fdimf (float __x, float __y); +extern long double __cdecl fdiml (long double __x, long double __y); /* fmax and fmin. NaN arguments are treated as missing data: if one argument is a NaN @@ -697,20 +697,20 @@ extern long double fdiml (long double __x, long double __y); value. */ /* 7.12.12.2 */ -extern double fmax (double, double); -extern float fmaxf (float, float); -extern long double fmaxl (long double, long double); +extern double __cdecl fmax (double, double); +extern float __cdecl fmaxf (float, float); +extern long double __cdecl fmaxl (long double, long double); /* 7.12.12.3 */ -extern double fmin (double, double); -extern float fminf (float, float); -extern long double fminl (long double, long double); +extern double __cdecl fmin (double, double); +extern float __cdecl fminf (float, float); +extern long double __cdecl fminl (long double, long double); /* 7.12.13.1 */ /* return x * y + z as a ternary op */ -extern double fma (double, double, double); -extern float fmaf (float, float, float); -extern long double fmal (long double, long double, long double); +extern double __cdecl fma (double, double, double); +extern float __cdecl fmaf (float, float, float); +extern long double __cdecl fmal (long double, long double, long double); /* 7.12.14 */ /* @@ -732,7 +732,7 @@ extern long double fmal (long double, long double, long double); #else /* helper */ -extern __inline__ int +extern __inline__ int __cdecl __fp_unordered_compare (long double __x, long double __y){ unsigned short retval; __asm__ ("fucom %%st(1);" diff --git a/winsup/mingw/include/mbctype.h b/winsup/mingw/include/mbctype.h new file mode 100644 index 00000000000..dd57a7b5cd7 --- /dev/null +++ b/winsup/mingw/include/mbctype.h @@ -0,0 +1,97 @@ +/* + * mbctype.h + * + * Functions for testing multibyte character types and converting characters. + * + * This file is part of the Mingw32 package. + * + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ + +#ifndef _MBCTYPE_H_ +#define _MBCTYPE_H_ + +/* All the headers include this file. */ +#include <_mingw.h> + +/* return values for _mbsbtype and _mbbtype in mbstring.h */ +#define _MBC_SINGLE 0 +#define _MBC_LEAD 1 +#define _MBC_TRAIL 2 +#define _MBC_ILLEGAL (-1) + +/* args for setmbcp (in lieu of actual codepage) */ +#define _MB_CP_SBCS 0 +#define _MB_CP_OEM (-2) +#define _MB_CP_ANSI (-3) +#define _MB_CP_LOCALE (-4) + +/* TODO: bit masks */ +/* +#define _MS +#define _MP +#define _M1 +#define _M2 +#define _SBUP +#define _SBLOW +*/ + +#ifndef RC_INVOKED + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __STRICT_ANSI__ + +_CRTIMP int __cdecl _setmbcp (int); +_CRTIMP int __cdecl _getmbcp (void); + +/* byte classification */ +/* NB: Corresponding _ismbc* functions are in mbstring.h */ + +_CRTIMP int __cdecl _ismbbalpha (unsigned int); +_CRTIMP int __cdecl _ismbbalnum (unsigned int); +_CRTIMP int __cdecl _ismbbgraph (unsigned int); +_CRTIMP int __cdecl _ismbbprint (unsigned int); +_CRTIMP int __cdecl _ismbbpunct (unsigned int); + +_CRTIMP int __cdecl _ismbbkana (unsigned int); +_CRTIMP int __cdecl _ismbbkalnum (unsigned int); +_CRTIMP int __cdecl _ismbbkprint (unsigned int); +_CRTIMP int __cdecl _ismbbkpunct (unsigned int); + + +/* these are also in mbstring.h */ +_CRTIMP int __cdecl _ismbblead (unsigned int); +_CRTIMP int __cdecl _ismbbtrail (unsigned int); +_CRTIMP int __cdecl _ismbslead (const unsigned char*, const unsigned char*); +_CRTIMP int __cdecl _ismbstrail (const unsigned char*, const unsigned char*); + +#ifdef __DECLSPEC_SUPPORTED +__MINGW_IMPORT unsigned char _mbctype[]; +__MINGW_IMPORT unsigned char _mbcasemap[]; +#endif + +/* TODO : _MBCS_ mappings go in tchar.h */ + +#endif /* Not strict ANSI */ + +#ifdef __cplusplus +} +#endif + +#endif /* Not RC_INVOKED */ + +#endif /* Not _MCTYPE_H_ */ + diff --git a/winsup/mingw/include/mbstring.h b/winsup/mingw/include/mbstring.h new file mode 100644 index 00000000000..4ad777602af --- /dev/null +++ b/winsup/mingw/include/mbstring.h @@ -0,0 +1,132 @@ +/* + * mbstring.h + * + * Protototypes for string functions supporting multibyte characters. + * + * This file is part of the Mingw32 package. + * + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ + +#ifndef _MBSTRING_H_ +#define _MBSTRING_H_ + +/* All the headers include this file. */ +#include <_mingw.h> + +#ifndef RC_INVOKED + +#define __need_size_t +#include <stddef.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __STRICT_ANSI__ + +/* character classification */ +_CRTIMP int __cdecl _ismbcalnum (unsigned int); +_CRTIMP int __cdecl _ismbcalpha (unsigned int); +_CRTIMP int __cdecl _ismbcdigit (unsigned int); +_CRTIMP int __cdecl _ismbcgraph (unsigned int); +_CRTIMP int __cdecl _ismbcprint (unsigned int); +_CRTIMP int __cdecl _ismbcpunct (unsigned int); +_CRTIMP int __cdecl _ismbcspace (unsigned int); +_CRTIMP int __cdecl _ismbclower (unsigned int); +_CRTIMP int __cdecl _ismbcupper (unsigned int); +_CRTIMP int __cdecl _ismbclegal (unsigned int); +_CRTIMP int __cdecl _ismbcsymbol (unsigned int); + + +/* also in mbctype.h */ +_CRTIMP int __cdecl _ismbblead (unsigned int ); +_CRTIMP int __cdecl _ismbbtrail (unsigned int ); +_CRTIMP int __cdecl _ismbslead ( const unsigned char*, const unsigned char*); +_CRTIMP int __cdecl _ismbstrail ( const unsigned char*, const unsigned char*); + +_CRTIMP unsigned int __cdecl _mbctolower (unsigned int); +_CRTIMP unsigned int __cdecl _mbctoupper (unsigned int); + +_CRTIMP void __cdecl _mbccpy (unsigned char*, const unsigned char*); +_CRTIMP size_t __cdecl _mbclen (const unsigned char*); + +_CRTIMP unsigned int __cdecl _mbbtombc (unsigned int); +_CRTIMP unsigned int __cdecl _mbctombb (unsigned int); + +/* Return value constants for these are defined in mbctype.h. */ +_CRTIMP int __cdecl _mbbtype (unsigned char, int); +_CRTIMP int __cdecl _mbsbtype (const unsigned char*, size_t); + +_CRTIMP unsigned char* __cdecl _mbscpy (unsigned char*, const unsigned char*); +_CRTIMP unsigned char* __cdecl _mbsncpy (unsigned char*, const unsigned char*, size_t); +_CRTIMP unsigned char* __cdecl _mbsnbcpy (unsigned char*, const unsigned char*, size_t); +_CRTIMP unsigned char* __cdecl _mbsset (unsigned char*, unsigned int); +_CRTIMP unsigned char* __cdecl _mbsnset (unsigned char*, unsigned int, size_t); +_CRTIMP unsigned char* __cdecl _mbsnbset (unsigned char*, unsigned int, size_t); +_CRTIMP unsigned char* __cdecl _mbsdup (const unsigned char*); +_CRTIMP unsigned char* __cdecl _mbsrev (unsigned char*); +_CRTIMP unsigned char* __cdecl _mbscat (unsigned char*, const unsigned char*); +_CRTIMP unsigned char* __cdecl _mbsncat (unsigned char*, const unsigned char*, size_t); +_CRTIMP unsigned char* __cdecl _mbsnbcat (unsigned char*, const unsigned char*, size_t); +_CRTIMP size_t __cdecl _mbslen (const unsigned char*); +_CRTIMP size_t __cdecl _mbsnbcnt (const unsigned char*, size_t); +_CRTIMP size_t __cdecl _mbsnccnt (const unsigned char*, size_t); +_CRTIMP unsigned char* __cdecl _mbschr (const unsigned char*, unsigned int); +_CRTIMP unsigned char* __cdecl _mbsrchr (const unsigned char*, unsigned int); +_CRTIMP size_t __cdecl _mbsspn (const unsigned char*, const unsigned char*); +_CRTIMP size_t __cdecl _mbscspn (const unsigned char*, const unsigned char*); +_CRTIMP unsigned char* __cdecl _mbsspnp (const unsigned char*, const unsigned char*); +_CRTIMP unsigned char* __cdecl _mbspbrk (const unsigned char*, const unsigned char*); +_CRTIMP int __cdecl _mbscmp (const unsigned char*, const unsigned char*); +_CRTIMP int __cdecl _mbsicmp (const unsigned char*, const unsigned char*); +_CRTIMP int __cdecl _mbsncmp (const unsigned char*, const unsigned char*, size_t); +_CRTIMP int __cdecl _mbsnicmp (const unsigned char*, const unsigned char*, size_t); +_CRTIMP int __cdecl _mbsnbcmp (const unsigned char*, const unsigned char*, size_t); +_CRTIMP int __cdecl _mbsnbicmp (const unsigned char*, const unsigned char*, size_t); +_CRTIMP int __cdecl _mbscoll (const unsigned char*, const unsigned char*); +_CRTIMP int __cdecl _mbsicoll (const unsigned char*, const unsigned char*); +_CRTIMP int __cdecl _mbsncoll (const unsigned char*, const unsigned char*, size_t); +_CRTIMP int __cdecl _mbsnicoll (const unsigned char*, const unsigned char*, size_t); +_CRTIMP int __cdecl _mbsnbcoll (const unsigned char*, const unsigned char*, size_t); +_CRTIMP int __cdecl _mbsnbicoll (const unsigned char*, const unsigned char*, size_t); + +_CRTIMP unsigned char* __cdecl _mbsinc (const unsigned char*); +_CRTIMP unsigned char* __cdecl _mbsninc (const unsigned char*, size_t); +_CRTIMP unsigned char* __cdecl _mbsdec (const unsigned char*, const unsigned char*); +_CRTIMP unsigned int __cdecl _mbsnextc (const unsigned char*); +_CRTIMP unsigned char* __cdecl _mbslwr (unsigned char*); +_CRTIMP unsigned char* __cdecl _mbsupr (unsigned char*); +_CRTIMP unsigned char* __cdecl _mbstok (unsigned char*, const unsigned char*); + +/* Kanji */ +_CRTIMP int __cdecl _ismbchira (unsigned int); +_CRTIMP int __cdecl _ismbckata (unsigned int); +_CRTIMP int __cdecl _ismbcl0 (unsigned int); +_CRTIMP int __cdecl _ismbcl1 (unsigned int); +_CRTIMP int __cdecl _ismbcl2 (unsigned int); +_CRTIMP unsigned int __cdecl _mbcjistojms (unsigned int); +_CRTIMP unsigned int __cdecl _mbcjmstojis (unsigned int); +_CRTIMP unsigned int __cdecl _mbctohira (unsigned int); +_CRTIMP unsigned int __cdecl _mbctokata (unsigned int); + +#endif /* Not strict ANSI */ + +#ifdef __cplusplus +} +#endif + +#endif /* Not RC_INVOKED */ +#endif /* Not _MBSTRING_H_ */ + + diff --git a/winsup/mingw/include/process.h b/winsup/mingw/include/process.h new file mode 100644 index 00000000000..3fb8ed7e066 --- /dev/null +++ b/winsup/mingw/include/process.h @@ -0,0 +1,158 @@ +/* + * process.h + * + * Function calls for spawning child processes. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp> + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision$ + * $Author$ + * $Date$ + * + */ + +#ifndef __STRICT_ANSI__ + +#ifndef _PROCESS_H_ +#define _PROCESS_H_ + +/* All the headers include this file. */ +#include <_mingw.h> + +/* Includes a definition of _pid_t and pid_t */ +#include <sys/types.h> + +/* + * Constants for cwait actions. + * Obsolete for Win32. + */ +#define _WAIT_CHILD 0 +#define _WAIT_GRANDCHILD 1 + +#ifndef _NO_OLDNAMES +#define WAIT_CHILD _WAIT_CHILD +#define WAIT_GRANDCHILD _WAIT_GRANDCHILD +#endif /* Not _NO_OLDNAMES */ + +/* + * Mode constants for spawn functions. + */ +#define _P_WAIT 0 +#define _P_NOWAIT 1 +#define _P_OVERLAY 2 +#define _OLD_P_OVERLAY _P_OVERLAY +#define _P_NOWAITO 3 +#define _P_DETACH 4 + +#ifndef _NO_OLDNAMES +#define P_WAIT _P_WAIT +#define P_NOWAIT _P_NOWAIT +#define P_OVERLAY _P_OVERLAY +#define OLD_P_OVERLAY _OLD_P_OVERLAY +#define P_NOWAITO _P_NOWAITO +#define P_DETACH _P_DETACH +#endif /* Not _NO_OLDNAMES */ + + +#ifndef RC_INVOKED + +#ifdef __cplusplus +extern "C" { +#endif + +_CRTIMP void __cdecl _cexit(void); +_CRTIMP void __cdecl _c_exit(void); + +_CRTIMP int __cdecl _cwait (int*, _pid_t, int); + +_CRTIMP _pid_t __cdecl _getpid(void); + +_CRTIMP int __cdecl _execl (const char*, const char*, ...); +_CRTIMP int __cdecl _execle (const char*, const char*, ...); +_CRTIMP int __cdecl _execlp (const char*, const char*, ...); +_CRTIMP int __cdecl _execlpe (const char*, const char*, ...); +_CRTIMP int __cdecl _execv (const char*, char* const*); +_CRTIMP int __cdecl _execve (const char*, char* const*, char* const*); +_CRTIMP int __cdecl _execvp (const char*, char* const*); +_CRTIMP int __cdecl _execvpe (const char*, char* const*, char* const*); + +_CRTIMP int __cdecl _spawnl (int, const char*, const char*, ...); +_CRTIMP int __cdecl _spawnle (int, const char*, const char*, ...); +_CRTIMP int __cdecl _spawnlp (int, const char*, const char*, ...); +_CRTIMP int __cdecl _spawnlpe (int, const char*, const char*, ...); +_CRTIMP int __cdecl _spawnv (int, const char*, char* const*); +_CRTIMP int __cdecl _spawnve (int, const char*, char* const*, char* const*); +_CRTIMP int __cdecl _spawnvp (int, const char*, char* const*); +_CRTIMP int __cdecl _spawnvpe (int, const char*, char* const*, char* const*); + +/* + * The functions _beginthreadex and _endthreadex are not provided by CRTDLL. + * They are provided by MSVCRT. + * + * NOTE: Apparently _endthread calls CloseHandle on the handle of the thread, + * making for race conditions if you are not careful. Basically you have to + * make sure that no-one is going to do *anything* with the thread handle + * after the thread calls _endthread or returns from the thread function. + * + * NOTE: No old names for these functions. Use the underscore. + */ +_CRTIMP unsigned long __cdecl + _beginthread (void (*)(void *), unsigned, void*); +_CRTIMP void __cdecl _endthread (void); + +#ifdef __MSVCRT__ +_CRTIMP unsigned long __cdecl + _beginthreadex (void *, unsigned, unsigned (__stdcall *) (void *), + void*, unsigned, unsigned*); +_CRTIMP void __cdecl _endthreadex (unsigned); +#endif + + +#ifndef _NO_OLDNAMES +/* + * Functions without the leading underscore, for portability. These functions + * live in liboldnames.a. + */ +_CRTIMP int __cdecl cwait (int*, pid_t, int); +_CRTIMP pid_t __cdecl getpid (void); +_CRTIMP int __cdecl execl (const char*, const char*, ...); +_CRTIMP int __cdecl execle (const char*, const char*, ...); +_CRTIMP int __cdecl execlp (const char*, const char*, ...); +_CRTIMP int __cdecl execlpe (const char*, const char*, ...); +_CRTIMP int __cdecl execv (const char*, char* const*); +_CRTIMP int __cdecl execve (const char*, char* const*, char* const*); +_CRTIMP int __cdecl execvp (const char*, char* const*); +_CRTIMP int __cdecl execvpe (const char*, char* const*, char* const*); +_CRTIMP int __cdecl spawnl (int, const char*, const char*, ...); +_CRTIMP int __cdecl spawnle (int, const char*, const char*, ...); +_CRTIMP int __cdecl spawnlp (int, const char*, const char*, ...); +_CRTIMP int __cdecl spawnlpe (int, const char*, const char*, ...); +_CRTIMP int __cdecl spawnv (int, const char*, char* const*); +_CRTIMP int __cdecl spawnve (int, const char*, char* const*, char* const*); +_CRTIMP int __cdecl spawnvp (int, const char*, char* const*); +_CRTIMP int __cdecl spawnvpe (int, const char*, char* const*, char* const*); +#endif /* Not _NO_OLDNAMES */ + +#ifdef __cplusplus +} +#endif + +#endif /* Not RC_INVOKED */ + +#endif /* _PROCESS_H_ not defined */ + +#endif /* Not __STRICT_ANSI__ */ + diff --git a/winsup/mingw/include/setjmp.h b/winsup/mingw/include/setjmp.h index 08de24dc03f..6737b7257ee 100644 --- a/winsup/mingw/include/setjmp.h +++ b/winsup/mingw/include/setjmp.h @@ -50,7 +50,7 @@ typedef _JBTYPE jmp_buf[_JBLEN]; * Return to the last setjmp call and act as if setjmp had returned * nVal (which had better be non-zero!). */ -void longjmp (jmp_buf, int); +_CRTIMP void __cdecl longjmp (jmp_buf, int); __END_CSTD_NAMESPACE __BEGIN_CGLOBAL_NAMESPACE @@ -58,7 +58,7 @@ __BEGIN_CGLOBAL_NAMESPACE * The function provided by CRTDLL which appears to do the actual work * of setjmp. */ -int _setjmp (__CSTD jmp_buf); +_CRTIMP int __cdecl _setjmp (__CSTD jmp_buf); #define setjmp(x) _setjmp(x) __END_CGLOBAL_NAMESPACE diff --git a/winsup/mingw/include/signal.h b/winsup/mingw/include/signal.h index 51979b838d9..8660be0bf5a 100644 --- a/winsup/mingw/include/signal.h +++ b/winsup/mingw/include/signal.h @@ -93,12 +93,12 @@ typedef int sig_atomic_t; * previous handler, or SIG_ERR if an error occurs. Initially * unhandled signals defined above will return SIG_DFL. */ -__p_sig_fn_t signal(int, __p_sig_fn_t); +_CRTIMP __p_sig_fn_t __cdecl signal(int, __p_sig_fn_t); /* * Raise the signal indicated by sig. Returns non-zero on success. */ -int raise (int); +_CRTIMP int __cdecl raise (int); __END_CSTD_NAMESPACE diff --git a/winsup/mingw/include/stddef.h b/winsup/mingw/include/stddef.h new file mode 100644 index 00000000000..37403a4b613 --- /dev/null +++ b/winsup/mingw/include/stddef.h @@ -0,0 +1,7 @@ +/* + * This is just an RC_INVOKED guard for the real stddef.h + * included in gcc system dir. One day we will delete this file. + */ +#ifndef RC_INVOKED +#include_next<stddef.h> +#endif diff --git a/winsup/mingw/include/stdio.h b/winsup/mingw/include/stdio.h index 65c4a4b7abe..95f61ecb86c 100644 --- a/winsup/mingw/include/stdio.h +++ b/winsup/mingw/include/stdio.h @@ -197,42 +197,47 @@ __BEGIN_CSTD_NAMESPACE /* * File Operations */ -FILE* fopen (const char*, const char*); -FILE* freopen (const char*, const char*, FILE*); -int fflush (FILE*); -int fclose (FILE*); +_CRTIMP FILE* __cdecl fopen (const char*, const char*); +_CRTIMP FILE* __cdecl freopen (const char*, const char*, FILE*); +_CRTIMP int __cdecl fflush (FILE*); +_CRTIMP int __cdecl fclose (FILE*); /* MS puts remove & rename (but not wide versions) in io.h also */ -int remove (const char*); -int rename (const char*, const char*); -FILE* tmpfile (void); -char* tmpnam (char*); +_CRTIMP int __cdecl remove (const char*); +_CRTIMP int __cdecl rename (const char*, const char*); +_CRTIMP FILE* __cdecl tmpfile (void); +_CRTIMP char* __cdecl tmpnam (char*); -int setvbuf (FILE*, char*, int, size_t); +_CRTIMP int __cdecl setvbuf (FILE*, char*, int, size_t); -void setbuf (FILE*, char*); +_CRTIMP void __cdecl setbuf (FILE*, char*); /* * Formatted Output */ -int fprintf (FILE*, const char*, ...); -int printf (const char*, ...); -int sprintf (char*, const char*, ...); -int vfprintf (FILE*, const char*, __VALIST); -int vprintf (const char*, __VALIST); -int vsprintf (char*, const char*, __VALIST); +_CRTIMP int __cdecl fprintf (FILE*, const char*, ...); +_CRTIMP int __cdecl printf (const char*, ...); +_CRTIMP int __cdecl sprintf (char*, const char*, ...); +_CRTIMP int __cdecl vfprintf (FILE*, const char*, __VALIST); +_CRTIMP int __cdecl vprintf (const char*, __VALIST); +_CRTIMP int __cdecl vsprintf (char*, const char*, __VALIST); __END_CSTD_NAMESPACE __BEGIN_CGLOBAL_NAMESPACE -int _snprintf (char*, __CSTD size_t, const char*, ...); -int _vsnprintf (char*, __CSTD size_t, const char*, __VALIST); +_CRTIMP int __cdecl _snprintf (char*, __CSTD size_t, const char*, ...); +_CRTIMP int __cdecl _vsnprintf (char*, __CSTD size_t, const char*, __VALIST); #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ int snprintf(char* s, __CSTD size_t, const char*, ...); extern __inline__ int vsnprintf (char* __s, __CSTD size_t __n, const char* __format, __VALIST __arg) { return _vsnprintf ( __s, __n, __format, __arg); } +int __cdecl vscanf (const char * __restrict__, __VALIST); +int __cdecl vfscanf (__CSTD FILE * __restrict__, const char * __restrict__, + __VALIST); +int __cdecl vsscanf (const char * __restrict__, + const char * __restrict__, __VALIST); #endif __END_CGLOBAL_NAMESPACE @@ -242,91 +247,91 @@ __BEGIN_CSTD_NAMESPACE * Formatted Input */ -int fscanf (FILE*, const char*, ...); -int scanf (const char*, ...); -int sscanf (const char*, const char*, ...); +_CRTIMP int __cdecl fscanf (FILE*, const char*, ...); +_CRTIMP int __cdecl scanf (const char*, ...); +_CRTIMP int __cdecl sscanf (const char*, const char*, ...); /* * Character Input and Output Functions */ -int fgetc (FILE*); -char* fgets (char*, int, FILE*); -int fputc (int, FILE*); -int fputs (const char*, FILE*); -int getc (FILE*); -int getchar (void); -char* gets (char*); -int putc (int, FILE*); -int putchar (int); -int puts (const char*); -int ungetc (int, FILE*); +_CRTIMP int __cdecl fgetc (FILE*); +_CRTIMP char* __cdecl fgets (char*, int, FILE*); +_CRTIMP int __cdecl fputc (int, FILE*); +_CRTIMP int __cdecl fputs (const char*, FILE*); +_CRTIMP int __cdecl getc (FILE*); +_CRTIMP int __cdecl getchar (void); +_CRTIMP char* __cdecl gets (char*); +_CRTIMP int __cdecl putc (int, FILE*); +_CRTIMP int __cdecl putchar (int); +_CRTIMP int __cdecl puts (const char*); +_CRTIMP int __cdecl ungetc (int, FILE*); /* * Direct Input and Output Functions */ -size_t fread (void*, size_t, size_t, FILE*); -size_t fwrite (const void*, size_t, size_t, FILE*); +_CRTIMP size_t __cdecl fread (void*, size_t, size_t, FILE*); +_CRTIMP size_t __cdecl fwrite (const void*, size_t, size_t, FILE*); /* * File Positioning Functions */ -int fseek (FILE*, long, int); -long ftell (FILE*); -void rewind (FILE*); +_CRTIMP int __cdecl fseek (FILE*, long, int); +_CRTIMP long __cdecl ftell (FILE*); +_CRTIMP void __cdecl rewind (FILE*); -int fgetpos (FILE*, fpos_t*); -int fsetpos (FILE*, const fpos_t*); +_CRTIMP int __cdecl fgetpos (FILE*, fpos_t*); +_CRTIMP int __cdecl fsetpos (FILE*, const fpos_t*); /* * Error Functions */ -void clearerr (FILE*); -int feof (FILE*); -int ferror (FILE*); -void perror (const char*); +_CRTIMP void __cdecl clearerr (FILE*); +_CRTIMP int __cdecl feof (FILE*); +_CRTIMP int __cdecl ferror (FILE*); +_CRTIMP void __cdecl perror (const char*); __END_CSTD_NAMESPACE __BEGIN_CGLOBAL_NAMESPACE #ifndef __STRICT_ANSI__ -char* _tempnam (const char*, const char*); +_CRTIMP char* __cdecl _tempnam (const char*, const char*); #ifndef NO_OLDNAMES -char* tempnam (const char*, const char*); +_CRTIMP char* __cdecl tempnam (const char*, const char*); #endif /* * Pipes */ -__CSTD FILE* _popen (const char*, const char*); -int _pclose (__CSTD FILE*); +_CRTIMP __CSTD FILE* __cdecl _popen (const char*, const char*); +_CRTIMP int __cdecl _pclose (__CSTD FILE*); #ifndef NO_OLDNAMES -__CSTD FILE* popen (const char*, const char*); -int pclose (__CSTD FILE*); +_CRTIMP __CSTD FILE* __cdecl popen (const char*, const char*); +_CRTIMP int __cdecl pclose (__CSTD FILE*); #endif /* * Other Non ANSI functions */ -int _flushall (void); -int _fgetchar (void); -int _fputchar (int); -__CSTD FILE* _fdopen (int, const char*); -int _fileno (__CSTD FILE*); -int _fcloseall(void); +_CRTIMP int __cdecl _flushall (void); +_CRTIMP int __cdecl _fgetchar (void); +_CRTIMP int __cdecl _fputchar (int); +_CRTIMP __CSTD FILE* __cdecl _fdopen (int, const char*); +_CRTIMP int __cdecl _fileno (__CSTD FILE*); +_CRTIMP int __cdecl _fcloseall(void); #ifdef __MSVCRT__ -int _getmaxstdio(void); -int _setmaxstdio(int); +_CRTIMP int __cdecl _getmaxstdio(void); +_CRTIMP int __cdecl _setmaxstdio(int); #endif #ifndef _NO_OLDNAMES -int fgetchar (void); -int fputchar (int); -__CSTD FILE* fdopen (int, const char*); -int fileno (__CSTD FILE*); +_CRTIMP int __cdecl fgetchar (void); +_CRTIMP int __cdecl fputchar (int); +_CRTIMP __CSTD FILE* __cdecl fdopen (int, const char*); +_CRTIMP int __cdecl fileno (__CSTD FILE*); #endif /* Not _NO_OLDNAMES */ #endif /* Not __STRICT_ANSI__ */ @@ -339,25 +344,25 @@ __END_CGLOBAL_NAMESPACE __BEGIN_CSTD_NAMESPACE /* also in wchar.h - keep in sync */ -int fwprintf (FILE*, const wchar_t*, ...); -int wprintf (const wchar_t*, ...); -int swprintf (wchar_t*, const wchar_t*, ...); -int vfwprintf (FILE*, const wchar_t*, __VALIST); -int vwprintf (const wchar_t*, __VALIST); -int vswprintf (wchar_t*, const wchar_t*, __VALIST); -int fwscanf (FILE*, const wchar_t*, ...); -int wscanf (const wchar_t*, ...); -int swscanf (const wchar_t*, const wchar_t*, ...); -wint_t fgetwc (FILE*); -wint_t fputwc (wchar_t, FILE*); -wint_t ungetwc (wchar_t, FILE*); +_CRTIMP int __cdecl fwprintf (FILE*, const wchar_t*, ...); +_CRTIMP int __cdecl wprintf (const wchar_t*, ...); +_CRTIMP int __cdecl swprintf (wchar_t*, const wchar_t*, ...); +_CRTIMP int __cdecl vfwprintf (FILE*, const wchar_t*, __VALIST); +_CRTIMP int __cdecl vwprintf (const wchar_t*, __VALIST); +_CRTIMP int __cdecl vswprintf (wchar_t*, const wchar_t*, __VALIST); +_CRTIMP int __cdecl fwscanf (FILE*, const wchar_t*, ...); +_CRTIMP int __cdecl wscanf (const wchar_t*, ...); +_CRTIMP int __cdecl swscanf (const wchar_t*, const wchar_t*, ...); +_CRTIMP wint_t __cdecl fgetwc (FILE*); +_CRTIMP wint_t __cdecl fputwc (wchar_t, FILE*); +_CRTIMP wint_t __cdecl ungetwc (wchar_t, FILE*); #ifdef __MSVCRT__ -wchar_t* fgetws (wchar_t*, int, FILE*); -int fputws (const wchar_t*, FILE*); -wint_t getwc (FILE*); -wint_t getwchar (void); -wint_t putwc (wint_t, FILE*); -wint_t putwchar (wint_t); +_CRTIMP wchar_t* __cdecl fgetws (wchar_t*, int, FILE*); +_CRTIMP int __cdecl fputws (const wchar_t*, FILE*); +_CRTIMP wint_t __cdecl getwc (FILE*); +_CRTIMP wint_t __cdecl getwchar (void); +_CRTIMP wint_t __cdecl putwc (wint_t, FILE*); +_CRTIMP wint_t __cdecl putwchar (wint_t); #endif __END_CSTD_NAMESPACE @@ -365,30 +370,36 @@ __BEGIN_CGLOBAL_NAMESPACE #ifdef __MSVCRT__ #ifndef __STRICT_ANSI__ -wchar_t* _getws (wchar_t*); -int _putws (const wchar_t*); -__CSTD FILE* _wfdopen(int, wchar_t *); -__CSTD FILE* _wfopen (const wchar_t*, const wchar_t*); -__CSTD FILE* _wfreopen (const wchar_t*, const wchar_t*, __CSTD FILE*); -__CSTD FILE* _wfsopen (const wchar_t*, const wchar_t*, int); -wchar_t* _wtmpnam (wchar_t*); -wchar_t* _wtempnam (const wchar_t*, const wchar_t*); -int _wrename (const wchar_t*, const wchar_t*); -int _wremove (const wchar_t*); -void _wperror (const wchar_t*); -__CSTD FILE* _wpopen (const wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl _getws (wchar_t*); +_CRTIMP int __cdecl _putws (const wchar_t*); +_CRTIMP __CSTD FILE* __cdecl __cdecl _wfdopen(int, wchar_t *); +_CRTIMP __CSTD FILE* __cdecl _wfopen (const wchar_t*, const wchar_t*); +_CRTIMP __CSTD FILE* __cdecl _wfreopen (const wchar_t*, const wchar_t*, __CSTD FILE*); +_CRTIMP __CSTD FILE* __cdecl _wfsopen (const wchar_t*, const wchar_t*, int); +_CRTIMP wchar_t* __cdecl _wtmpnam (wchar_t*); +_CRTIMP wchar_t* __cdecl _wtempnam (const wchar_t*, const wchar_t*); +_CRTIMP int __cdecl _wrename (const wchar_t*, const wchar_t*); +_CRTIMP int __cdecl _wremove (const wchar_t*); +_CRTIMP void __cdecl _wperror (const wchar_t*); +_CRTIMP __CSTD FILE* __cdecl _wpopen (const wchar_t*, const wchar_t*); #endif /* Not __STRICT_ANSI__ */ #endif /* __MSVCRT__ */ /* C99 names, but non-standard behaviour */ -int _snwprintf (wchar_t*, __CSTD size_t, const wchar_t*, ...); -int _vsnwprintf (wchar_t*, __CSTD size_t, const wchar_t*, __VALIST); +_CRTIMP int __cdecl _snwprintf (wchar_t*, __CSTD size_t, const wchar_t*, ...); +_CRTIMP int __cdecl _vsnwprintf (wchar_t*, __CSTD size_t, const wchar_t*, __VALIST); #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ -int snwprintf(wchar_t* s, __CSTD size_t n, const wchar_t* format, ...); -extern __inline__ int +int __cdecl snwprintf (wchar_t* s, __CSTD size_t n, const wchar_t* format, ...); +extern __inline__ int __cdecl vsnwprintf (wchar_t* __s, __CSTD size_t __n, const wchar_t* __format, __VALIST __arg) { return _vsnwprintf ( __s, __n, __format, __arg);} + +int __cdecl vwscanf (const wchar_t * __restrict__, __VALIST); +int __cdecl vfwscanf (__CSTD FILE * __restrict__, + const wchar_t * __restrict__, __VALIST); +int __cdecl vswscanf (const wchar_t * __restrict__, + const wchar_t * __restrict__, __VALIST); #endif __END_CGLOBAL_NAMESPACE @@ -401,23 +412,23 @@ __BEGIN_CGLOBAL_NAMESPACE #ifndef __STRICT_ANSI__ #ifdef __MSVCRT__ #ifndef NO_OLDNAMES -__CSTD FILE* wpopen (const wchar_t*, const wchar_t*); +_CRTIMP __CSTD FILE* __cdecl wpopen (const wchar_t*, const wchar_t*); #endif /* not NO_OLDNAMES */ #endif /* MSVCRT runtime */ /* * Other Non ANSI wide functions */ -__CSTD wint_t _fgetwchar (void); -__CSTD wint_t _fputwchar (__CSTD wint_t); -int _getw (__CSTD FILE*); -int _putw (int, __CSTD FILE*); +_CRTIMP __CSTD wint_t __cdecl _fgetwchar (void); +_CRTIMP __CSTD wint_t __cdecl _fputwchar (__CSTD wint_t); +_CRTIMP int __cdecl _getw (__CSTD FILE*); +_CRTIMP int __cdecl _putw (int, __CSTD FILE*); #ifndef _NO_OLDNAMES -__CSTD wint_t fgetwchar (void); -__CSTD wint_t fputwchar (__CSTD wint_t); -int getw (__CSTD FILE*); -int putw (int, __CSTD FILE*); +_CRTIMP __CSTD wint_t __cdecl fgetwchar (void); +_CRTIMP __CSTD wint_t __cdecl fputwchar (__CSTD wint_t); +_CRTIMP int __cdecl getw (__CSTD FILE*); +_CRTIMP int __cdecl putw (int, __CSTD FILE*); #endif /* Not _NO_OLDNAMES */ #ifdef __USE_MINGW_FSEEK /* These are in libmingwex.a */ @@ -425,8 +436,8 @@ int putw (int, __CSTD FILE*); * Workaround for limitations on win9x where a file contents are * not zero'd out if you seek past the end and then write. */ -int __mingw_fseek (__CSTD FILE *, long, int); -int __mingw_fwrite (const void*, __CSTD size_t, __CSTD size_t, __CSTD FILE*); +int __cdecl __mingw_fseek (__CSTD FILE *, long, int); +int __cdecl __mingw_fwrite (const void*, __CSTD size_t, __CSTD size_t, __CSTD FILE*); #define fseek(fp, offset, whence) __mingw_fseek(fp, offset, whence) #define fwrite(buffer, size, count, fp) __mingw_fwrite(buffer, size, count, fp) #endif /* __USE_MINGW_FSEEK */ diff --git a/winsup/mingw/include/stdlib.h b/winsup/mingw/include/stdlib.h index 58a8904c4df..51279ae75b3 100644 --- a/winsup/mingw/include/stdlib.h +++ b/winsup/mingw/include/stdlib.h @@ -87,9 +87,9 @@ extern char** _argv; /* imports from runtime dll of the above variables */ #ifdef __MSVCRT__ -extern int* __p___argc(void); -extern char*** __p___argv(void); -extern wchar_t*** __p___wargv(void); +_CRTIMP int* __cdecl __p___argc(void); +_CRTIMP char*** __cdecl __p___argv(void); +_CRTIMP wchar_t*** __cdecl __p___wargv(void); #define __argc (*__p___argc()) #define __argv (*__p___argv()) @@ -147,19 +147,19 @@ __MINGW_IMPORT char** __argv_dll; #undef errno extern int errno; #else -int* _errno(void); -#define errno (*_errno()) + _CRTIMP int* __cdecl _errno(void); +#define errno (*_errno()) #endif -int* __doserrno(void); -#define _doserrno (*__doserrno()) + _CRTIMP int* __cdecl __doserrno(void); +#define _doserrno (*__doserrno()) /* * Use environ from the DLL, not as a global. */ #ifdef __MSVCRT__ - extern char *** __p__environ(void); - extern wchar_t *** __p__wenviron(void); +_CRTIMP char *** __cdecl __p__environ(void); +_CRTIMP wchar_t *** __cdecl __p__wenviron(void); # define _environ (*__p__environ()) # define _wenviron (*__p__wenviron()) #else /* ! __MSVCRT__ */ @@ -219,10 +219,10 @@ __MINGW_IMPORT char* _sys_errlist[]; #ifdef __MSVCRT__ /* msvcrtxx.dll */ -extern unsigned int* __p__osver(void); -extern unsigned int* __p__winver(void); -extern unsigned int* __p__winmajor(void); -extern unsigned int* __p__winminor(void); +_CRTIMP unsigned __cdecl int* __p__osver(void); +_CRTIMP unsigned __cdecl int* __p__winver(void); +_CRTIMP unsigned __cdecl int* __p__winmajor(void); +_CRTIMP unsigned __cdecl int* __p__winminor(void); #ifndef __DECLSPEC_SUPPORTED # define _osver (*__p__osver()) @@ -234,7 +234,7 @@ __MINGW_IMPORT unsigned int _osver; __MINGW_IMPORT unsigned int _winver; __MINGW_IMPORT unsigned int _winmajor; __MINGW_IMPORT unsigned int _winminor; -#endif __DECLSPEC_SUPPORTED +#endif /* __DECLSPEC_SUPPORTED */ #else /* Not msvcrtxx.dll, thus crtdll.dll */ @@ -270,9 +270,9 @@ __MINGW_IMPORT unsigned int _winminor_dll; #if defined __MSVCRT__ /* although the _pgmptr is exported as DATA, * be safe and use the access function __p__pgmptr() to get it. */ -char** __p__pgmptr(void); +_CRTIMP char** __cdecl __p__pgmptr(void); #define _pgmptr (*__p__pgmptr()) -wchar_t** __p__wpgmptr(void); +_CRTIMP wchar_t** __cdecl __p__wpgmptr(void); #define _wpgmptr (*__p__wpgmptr()) #else /* ! __MSVCRT__ */ # ifndef __DECLSPEC_SUPPORTED @@ -322,72 +322,72 @@ __MINGW_IMPORT int _fmode_dll; __END_CGLOBAL_NAMESPACE __BEGIN_CSTD_NAMESPACE -double atof (const char*); -int atoi (const char*); -long atol (const char*); +_CRTIMP double __cdecl atof (const char*); +_CRTIMP int __cdecl atoi (const char*); +_CRTIMP long __cdecl atol (const char*); -double strtod (const char*, char**); +_CRTIMP double __cdecl strtod (const char*, char**); #if !defined __NO_ISOCEXT /* extern stubs in static libmingwex.a */ -extern __inline__ float strtof (const char *__nptr, char **__endptr) +extern __inline__ float __cdecl strtof (const char *__nptr, char **__endptr) { return (strtod (__nptr, __endptr));} -long double strtold (const char * __restrict__, char ** __restrict__); +long double __cdecl strtold (const char * __restrict__, char ** __restrict__); #endif /* __NO_ISOCEXT */ -long strtol (const char*, char**, int); -unsigned long strtoul (const char*, char**, int); +_CRTIMP long __cdecl strtol (const char*, char**, int); +_CRTIMP unsigned long __cdecl strtoul (const char*, char**, int); __END_CSTD_NAMESPACE __BEGIN_CGLOBAL_NAMESPACE -int _wtoi (const wchar_t *); -long _wtol (const wchar_t *); +_CRTIMP int __cdecl _wtoi (const wchar_t *); +_CRTIMP long __cdecl _wtol (const wchar_t *); __END_CGLOBAL_NAMESPACE __BEGIN_CSTD_NAMESPACE #ifndef _WSTDLIB_DEFINED /* also declared in wchar.h */ -double wcstod (const wchar_t*, wchar_t**); +_CRTIMP double __cdecl wcstod (const wchar_t*, wchar_t**); #if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */ -extern __inline__ float wcstof( const wchar_t *__nptr, wchar_t **__endptr) +extern __inline__ float __cdecl wcstof (const wchar_t *__nptr, wchar_t **__endptr) { return (wcstod(__nptr, __endptr)); } -long double wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__); +long double __cdecl wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__); #endif /* __NO_ISOCEXT */ -long wcstol (const wchar_t*, wchar_t**, int); -unsigned long wcstoul (const wchar_t*, wchar_t**, int); +_CRTIMP long __cdecl wcstol (const wchar_t*, wchar_t**, int); +_CRTIMP unsigned long __cdecl wcstoul (const wchar_t*, wchar_t**, int); #define _WSTDLIB_DEFINED #endif -size_t wcstombs (char*, const wchar_t*, size_t); -int wctomb (char*, wchar_t); +_CRTIMP size_t __cdecl wcstombs (char*, const wchar_t*, size_t); +_CRTIMP int __cdecl wctomb (char*, wchar_t); -int mblen (const char*, size_t); -size_t mbstowcs (wchar_t*, const char*, size_t); -int mbtowc (wchar_t*, const char*, size_t); +_CRTIMP int __cdecl mblen (const char*, size_t); +_CRTIMP size_t __cdecl mbstowcs (wchar_t*, const char*, size_t); +_CRTIMP int __cdecl mbtowc (wchar_t*, const char*, size_t); -int rand (void); -void srand (unsigned int); +_CRTIMP int __cdecl rand (void); +_CRTIMP void __cdecl srand (unsigned int); -void* calloc (size_t, size_t); -void* malloc (size_t); -void* realloc (void*, size_t); -void free (void*); +_CRTIMP void* __cdecl calloc (size_t, size_t); +_CRTIMP void* __cdecl malloc (size_t); +_CRTIMP void* __cdecl realloc (void*, size_t); +_CRTIMP void __cdecl free (void*); -void abort (void) _ATTRIB_NORETURN; -void exit (int) _ATTRIB_NORETURN; -int atexit (void (*)(void)); +_CRTIMP void __cdecl abort (void) _ATTRIB_NORETURN; +_CRTIMP void __cdecl exit (int) _ATTRIB_NORETURN; +int __cdecl atexit (void (*)(void)); -int system (const char*); -char* getenv (const char*); +_CRTIMP int __cdecl system (const char*); +_CRTIMP char* __cdecl getenv (const char*); -void* bsearch (const void*, const void*, size_t, size_t, - int (*)(const void*, const void*)); -void qsort (const void*, size_t, size_t, - int (*)(const void*, const void*)); +_CRTIMP void* __cdecl bsearch (const void*, const void*, size_t, size_t, + int (*)(const void*, const void*)); +_CRTIMP void __cdecl qsort (void*, size_t, size_t, + int (*)(const void*, const void*)); -int abs (int); -long labs (long); +_CRTIMP int __cdecl abs (int); +_CRTIMP long __cdecl labs (long); /* * div_t and ldiv_t are structures used to return the results of div and @@ -400,8 +400,8 @@ long labs (long); typedef struct { int quot, rem; } div_t; typedef struct { long quot, rem; } ldiv_t; -div_t div (int, int); -ldiv_t ldiv (long, long); +_CRTIMP div_t __cdecl div (int, int); +_CRTIMP ldiv_t __cdecl ldiv (long, long); __END_CSTD_NAMESPACE __BEGIN_CGLOBAL_NAMESPACE @@ -412,68 +412,68 @@ __BEGIN_CGLOBAL_NAMESPACE * NOTE: Officially the three following functions are obsolete. The Win32 API * functions SetErrorMode, Beep and Sleep are their replacements. */ -void _beep (unsigned int, unsigned int); -void _seterrormode (int); -void _sleep (unsigned long); +_CRTIMP void __cdecl _beep (unsigned int, unsigned int); +_CRTIMP void __cdecl _seterrormode (int); +_CRTIMP void __cdecl _sleep (unsigned long); -void _exit (int) _ATTRIB_NORETURN; +_CRTIMP void __cdecl _exit (int) _ATTRIB_NORETURN; /* _onexit is MS extension. Use atexit for portability. */ typedef int (* _onexit_t)(void); _onexit_t _onexit( _onexit_t ); -int _putenv (const char*); -void _searchenv (const char*, const char*, char*); +_CRTIMP int __cdecl _putenv (const char*); +_CRTIMP void __cdecl _searchenv (const char*, const char*, char*); -char* _ecvt (double, int, int*, int*); -char* _fcvt (double, int, int*, int*); -char* _gcvt (double, int, char*); +_CRTIMP char* __cdecl _ecvt (double, int, int*, int*); +_CRTIMP char* __cdecl _fcvt (double, int, int*, int*); +_CRTIMP char* __cdecl _gcvt (double, int, char*); -void _makepath (char*, const char*, const char*, const char*, const char*); -void _splitpath (const char*, char*, char*, char*, char*); -char* _fullpath (char*, const char*, __CSTD size_t); +_CRTIMP void __cdecl _makepath (char*, const char*, const char*, const char*, const char*); +_CRTIMP void __cdecl _splitpath (const char*, char*, char*, char*, char*); +_CRTIMP char* __cdecl _fullpath (char*, const char*, __CSTD size_t); -char* _itoa (int, char*, int); -char* _ltoa (long, char*, int); -char* _ultoa(unsigned long, char*, int); +_CRTIMP char* __cdecl _itoa (int, char*, int); +_CRTIMP char* __cdecl _ltoa (long, char*, int); +_CRTIMP char* __cdecl _ultoa(unsigned long, char*, int); wchar_t* _itow (int, wchar_t*, int); -wchar_t* _ltow (long, wchar_t*, int); -wchar_t* _ultow (unsigned long, wchar_t*, int); +_CRTIMP wchar_t* __cdecl _ltow (long, wchar_t*, int); +_CRTIMP wchar_t* __cdecl _ultow (unsigned long, wchar_t*, int); #ifdef __MSVCRT__ __int64 _atoi64(const char *); -char* _i64toa(__int64, char *, int); -char* _ui64toa(unsigned __int64, char *, int); +_CRTIMP char* __cdecl _i64toa(__int64, char *, int); +_CRTIMP char* __cdecl _ui64toa(unsigned __int64, char *, int); __int64 _wtoi64(const wchar_t *); -wchar_t* _i64tow(__int64, wchar_t *, int); -wchar_t* _ui64tow(unsigned __int64, wchar_t *, int); - -wchar_t* _wgetenv(const wchar_t*); -int _wputenv(const wchar_t*); -void _wsearchenv(const wchar_t*, const wchar_t*, wchar_t*); -void _wmakepath(wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*); -void _wsplitpath (const wchar_t*, wchar_t*, wchar_t*, wchar_t*, wchar_t*); -wchar_t* _wfullpath (wchar_t*, const wchar_t*, __CSTD size_t); - -unsigned int _rotl(unsigned int, int); -unsigned int _rotr(unsigned int, int); -unsigned long _lrotl(unsigned long, int); -unsigned long _lrotr(unsigned long, int); +_CRTIMP wchar_t* __cdecl _i64tow(__int64, wchar_t *, int); +_CRTIMP wchar_t* __cdecl _ui64tow(unsigned __int64, wchar_t *, int); + +_CRTIMP wchar_t* __cdecl _wgetenv(const wchar_t*); +_CRTIMP int __cdecl _wputenv(const wchar_t*); +_CRTIMP void __cdecl _wsearchenv(const wchar_t*, const wchar_t*, wchar_t*); +_CRTIMP void __cdecl _wmakepath(wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*); +_CRTIMP void __cdecl _wsplitpath (const wchar_t*, wchar_t*, wchar_t*, wchar_t*, wchar_t*); +_CRTIMP wchar_t* __cdecl __cdecl _wfullpath (wchar_t*, const wchar_t*, __CSTD size_t); + +_CRTIMP unsigned int __cdecl _rotl(unsigned int, int); +_CRTIMP unsigned int __cdecl _rotr(unsigned int, int); +_CRTIMP unsigned long __cdecl _lrotl(unsigned long, int); +_CRTIMP unsigned long __cdecl _lrotr(unsigned long, int); #endif #ifndef _NO_OLDNAMES -int putenv (const char*); -void searchenv (const char*, const char*, char*); +_CRTIMP int __cdecl putenv (const char*); +_CRTIMP void __cdecl searchenv (const char*, const char*, char*); -char* itoa (int, char*, int); -char* ltoa (long, char*, int); +_CRTIMP char* __cdecl itoa (int, char*, int); +_CRTIMP char* __cdecl ltoa (long, char*, int); #ifndef _UWIN -char* ecvt (double, int, int*, int*); -char* fcvt (double, int, int*, int*); -char* gcvt (double, int, char*); +_CRTIMP char* __cdecl ecvt (double, int, int*, int*); +_CRTIMP char* __cdecl fcvt (double, int, int*, int*); +_CRTIMP char* __cdecl gcvt (double, int, char*); #endif /* _UWIN */ #endif /* Not _NO_OLDNAMES */ @@ -484,26 +484,26 @@ char* gcvt (double, int, char*); #if !defined __NO_ISOCEXT /* externs in static libmingwex.a */ -void _Exit(int) _ATTRIB_NORETURN; /* Declare to get noreturn attribute. */ +void __cdecl _Exit(int) _ATTRIB_NORETURN; /* Declare to get noreturn attribute. */ #ifndef __STRICT_ANSI__ /* inline using non-ANSI exit */ extern __inline__ void _Exit(int __status) { __CGLOBAL _exit(__status); } #endif typedef struct { long long quot, rem; } lldiv_t; -lldiv_t lldiv (long long, long long); +lldiv_t __cdecl lldiv (long long, long long); -extern __inline__ long long llabs(long long __j) +extern __inline__ long long __cdecl llabs(long long __j) {return (__j >= 0 ? __j : -__j);} -long long strtoll (const char* __restrict__, char** __restrict, int); -unsigned long long strtoull (const char* __restrict__, char** __restrict__, int); +long long __cdecl strtoll (const char* __restrict__, char** __restrict, int); +unsigned long long __cdecl strtoull (const char* __restrict__, char** __restrict__, int); #if defined (__MSVCRT__) /* stub for MS _i64 versions */ -long long atoll (const char *); +long long __cdecl atoll (const char *); #if !defined (__STRICT_ANSI__) /* inline using non-ansi function */ -extern __inline__ long long atoll (const char * __c) +extern __inline__ long long __cdecl atoll (const char * __c) { return __CGLOBAL _atoi64 (__c); } #endif #endif @@ -514,23 +514,23 @@ extern __inline__ long long atoll (const char * __c) #if defined (__MSVCRT__) /* these are stubs for MS _i64 versions */ #if !defined (__STRICT_ANSI__) -char* lltoa(long long, char *, int); -char* ulltoa(unsigned long long , char *, int); +char* __cdecl lltoa(long long, char *, int); +char* __cdecl ulltoa(unsigned long long , char *, int); -long long wtoll(const wchar_t *); -wchar_t* lltow(long long, wchar_t *, int); -wchar_t* ulltow(unsigned long long, wchar_t *, int); +long long __cdecl wtoll(const wchar_t *); +wchar_t* __cdecl lltow(long long, wchar_t *, int); +wchar_t* __cdecl ulltow(unsigned long long, wchar_t *, int); /* inline using non-ansi functions */ -extern __inline__ char* lltoa(long long __n, char * __c, int __i) +extern __inline__ char* __cdecl lltoa(long long __n, char * __c, int __i) { return _i64toa (__n, __c, __i); } -extern __inline__ char* ulltoa(unsigned long long __n, char * __c, int __i) +extern __inline__ char* __cdecl ulltoa(unsigned long long __n, char * __c, int __i) { return _ui64toa (__n, __c, __i); } -extern __inline__ long long wtoll(const wchar_t * __w) +extern __inline__ long long __cdecl wtoll(const wchar_t * __w) { return _wtoi64 (__w); } -extern __inline__ wchar_t* lltow(long long __n, wchar_t * __w, int __i) +extern __inline__ wchar_t* __cdecl lltow(long long __n, wchar_t * __w, int __i) { return _i64tow (__n, __w, __i); } -extern __inline__ wchar_t* ulltow(unsigned long long __n, wchar_t * __w, int __i) +extern __inline__ wchar_t* __cdecl ulltow(unsigned long long __n, wchar_t * __w, int __i) { return _ui64tow (__n, __w, __i); } #endif /* (__STRICT_ANSI__) */ diff --git a/winsup/mingw/include/string.h b/winsup/mingw/include/string.h index 678d4991876..4b06f9df005 100644 --- a/winsup/mingw/include/string.h +++ b/winsup/mingw/include/string.h @@ -46,29 +46,29 @@ __BEGIN_CSTD_NAMESPACE /* * Prototypes of the ANSI Standard C library string functions. */ -void* memchr (const void*, int, size_t); -int memcmp (const void*, const void*, size_t); -void* memcpy (void*, const void*, size_t); -void* memmove (void*, const void*, size_t); -void* memset (void*, int, size_t); -char* strcat (char*, const char*); -char* strchr (const char*, int); -int strcmp (const char*, const char*); -int strcoll (const char*, const char*); /* Compare using locale */ -char* strcpy (char*, const char*); -size_t strcspn (const char*, const char*); -char* strerror (int); /* NOTE: NOT an old name wrapper. */ - -size_t strlen (const char*); -char* strncat (char*, const char*, size_t); -int strncmp (const char*, const char*, size_t); -char* strncpy (char*, const char*, size_t); -char* strpbrk (const char*, const char*); -char* strrchr (const char*, int); -size_t strspn (const char*, const char*); -char* strstr (const char*, const char*); -char* strtok (char*, const char*); -size_t strxfrm (char*, const char*, size_t); +_CRTIMP void* __cdecl memchr (const void*, int, size_t); +_CRTIMP int __cdecl memcmp (const void*, const void*, size_t); +_CRTIMP void* __cdecl memcpy (void*, const void*, size_t); +_CRTIMP void* __cdecl memmove (void*, const void*, size_t); +_CRTIMP void* __cdecl memset (void*, int, size_t); +_CRTIMP char* __cdecl strcat (char*, const char*); +_CRTIMP char* __cdecl strchr (const char*, int); +_CRTIMP int __cdecl strcmp (const char*, const char*); +_CRTIMP int __cdecl strcoll (const char*, const char*); /* Compare using locale */ +_CRTIMP char* __cdecl strcpy (char*, const char*); +_CRTIMP size_t __cdecl strcspn (const char*, const char*); +_CRTIMP char* __cdecl strerror (int); /* NOTE: NOT an old name wrapper. */ + +_CRTIMP size_t __cdecl strlen (const char*); +_CRTIMP char* __cdecl strncat (char*, const char*, size_t); +_CRTIMP int __cdecl strncmp (const char*, const char*, size_t); +_CRTIMP char* __cdecl strncpy (char*, const char*, size_t); +_CRTIMP char* __cdecl strpbrk (const char*, const char*); +_CRTIMP char* __cdecl strrchr (const char*, int); +_CRTIMP size_t __cdecl strspn (const char*, const char*); +_CRTIMP char* __cdecl strstr (const char*, const char*); +_CRTIMP char* __cdecl strtok (char*, const char*); +_CRTIMP size_t __cdecl strxfrm (char*, const char*, size_t); __END_CSTD_NAMESPACE #ifndef __STRICT_ANSI__ @@ -76,24 +76,24 @@ __BEGIN_CGLOBAL_NAMESPACE /* * Extra non-ANSI functions provided by the CRTDLL library */ -char* _strerror (const char *); -void* _memccpy (void*, const void*, int, __CSTD size_t); -int _memicmp (const void*, const void*, __CSTD size_t); -char* _strdup (const char*); -int _strcmpi (const char*, const char*); -int _stricmp (const char*, const char*); -int _stricoll (const char*, const char*); -char* _strlwr (char*); -int _strnicmp (const char*, const char*, __CSTD size_t); -char* _strnset (char*, int, __CSTD size_t); -char* _strrev (char*); -char* _strset (char*, int); -char* _strupr (char*); -void _swab (const char*, char*, __CSTD size_t); +_CRTIMP char* __cdecl _strerror (const char *); +_CRTIMP void* __cdecl _memccpy (void*, const void*, int, __CSTD size_t); +_CRTIMP int __cdecl _memicmp (const void*, const void*, __CSTD size_t); +_CRTIMP char* __cdecl _strdup (const char*); +_CRTIMP int __cdecl _strcmpi (const char*, const char*); +_CRTIMP int __cdecl _stricmp (const char*, const char*); +_CRTIMP int __cdecl _stricoll (const char*, const char*); +_CRTIMP char* __cdecl _strlwr (char*); +_CRTIMP int __cdecl _strnicmp (const char*, const char*, __CSTD size_t); +_CRTIMP char* __cdecl _strnset (char*, int, __CSTD size_t); +_CRTIMP char* __cdecl _strrev (char*); +_CRTIMP char* __cdecl _strset (char*, int); +_CRTIMP char* __cdecl _strupr (char*); +_CRTIMP void __cdecl _swab (const char*, char*, __CSTD size_t); #ifdef __MSVCRT__ -int _strncoll(const char*, const char*, __CSTD size_t); -int _strnicoll(const char*, const char*, __CSTD size_t); +_CRTIMP int __cdecl _strncoll(const char*, const char*, __CSTD size_t); +_CRTIMP int __cdecl _strnicoll(const char*, const char*, __CSTD size_t); #endif #ifndef _NO_OLDNAMES @@ -104,28 +104,28 @@ int _strnicoll(const char*, const char*, __CSTD size_t); * strcasecmp. */ -void* memccpy (void*, const void*, int, __CSTD size_t); -int memicmp (const void*, const void*, __CSTD size_t); -char* strdup (const char*); -int strcmpi (const char*, const char*); -int stricmp (const char*, const char*); -extern __inline__ int +_CRTIMP void* __cdecl memccpy (void*, const void*, int, __CSTD size_t); +_CRTIMP int __cdecl memicmp (const void*, const void*, __CSTD size_t); +_CRTIMP char* __cdecl strdup (const char*); +_CRTIMP int __cdecl strcmpi (const char*, const char*); +_CRTIMP int __cdecl stricmp (const char*, const char*); +extern __inline__ int __cdecl strcasecmp (const char * __sz1, const char * __sz2) {return _stricmp (__sz1, __sz2);} -int stricoll (const char*, const char*); -char* strlwr (char*); -int strnicmp (const char*, const char*, __CSTD size_t); -extern __inline__ int +_CRTIMP int __cdecl stricoll (const char*, const char*); +_CRTIMP char* __cdecl strlwr (char*); +_CRTIMP int __cdecl strnicmp (const char*, const char*, __CSTD size_t); +extern __inline__ int __cdecl strncasecmp (const char*, const char*, __CSTD size_t); -extern __inline__ int +extern __inline__ int __cdecl strncasecmp (const char * __sz1, const char * __sz2, __CSTD size_t __sizeMaxCompare) {return _strnicmp (__sz1, __sz2, __sizeMaxCompare);} -char* strnset (char*, int, __CSTD size_t); -char* strrev (char*); -char* strset (char*, int); -char* strupr (char*); +_CRTIMP char* __cdecl strnset (char*, int, __CSTD size_t); +_CRTIMP char* __cdecl strrev (char*); +_CRTIMP char* __cdecl strset (char*, int); +_CRTIMP char* __cdecl strupr (char*); #ifndef _UWIN -void swab (const char*, char*, __CSTD size_t); +_CRTIMP void __cdecl swab (const char*, char*, __CSTD size_t); #endif /* _UWIN */ #endif /* Not _NO_OLDNAMES */ @@ -141,23 +141,23 @@ __END_CGLOBAL_NAMESPACE * Also in wchar.h, where they really belong. */ __BEGIN_CSTD_NAMESPACE -wchar_t* wcscat (wchar_t*, const wchar_t*); -wchar_t* wcschr (const wchar_t*, wchar_t); -int wcscmp (const wchar_t*, const wchar_t*); -int wcscoll (const wchar_t*, const wchar_t*); -wchar_t* wcscpy (wchar_t*, const wchar_t*); -size_t wcscspn (const wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl wcscat (wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl wcschr (const wchar_t*, wchar_t); +_CRTIMP int __cdecl wcscmp (const wchar_t*, const wchar_t*); +_CRTIMP int __cdecl wcscoll (const wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl wcscpy (wchar_t*, const wchar_t*); +_CRTIMP size_t __cdecl wcscspn (const wchar_t*, const wchar_t*); /* Note: No wcserror in CRTDLL. */ -size_t wcslen (const wchar_t*); -wchar_t* wcsncat (wchar_t*, const wchar_t*, size_t); -int wcsncmp(const wchar_t*, const wchar_t*, size_t); -wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t); -wchar_t* wcspbrk(const wchar_t*, const wchar_t*); -wchar_t* wcsrchr(const wchar_t*, wchar_t); -size_t wcsspn(const wchar_t*, const wchar_t*); -wchar_t* wcsstr(const wchar_t*, const wchar_t*); -wchar_t* wcstok(wchar_t*, const wchar_t*); -size_t wcsxfrm(wchar_t*, const wchar_t*, size_t); +_CRTIMP size_t __cdecl wcslen (const wchar_t*); +_CRTIMP wchar_t* __cdecl wcsncat (wchar_t*, const wchar_t*, size_t); +_CRTIMP int __cdecl wcsncmp(const wchar_t*, const wchar_t*, size_t); +_CRTIMP wchar_t* __cdecl wcsncpy(wchar_t*, const wchar_t*, size_t); +_CRTIMP wchar_t* __cdecl wcspbrk(const wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl wcsrchr(const wchar_t*, wchar_t); +_CRTIMP size_t __cdecl wcsspn(const wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl wcsstr(const wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl wcstok(wchar_t*, const wchar_t*); +_CRTIMP size_t __cdecl wcsxfrm(wchar_t*, const wchar_t*, size_t); __END_CSTD_NAMESPACE #ifndef __STRICT_ANSI__ @@ -169,35 +169,35 @@ __BEGIN_CGLOBAL_NAMESPACE /* NOTE: _wcscmpi not provided by CRTDLL, this define is for portability */ #define _wcscmpi _wcsicmp -wchar_t* _wcsdup (const wchar_t*); -int _wcsicmp (const wchar_t*, const wchar_t*); -int _wcsicoll (const wchar_t*, const wchar_t*); -wchar_t* _wcslwr (wchar_t*); -extern __inline__ int +_CRTIMP wchar_t* __cdecl _wcsdup (const wchar_t*); +_CRTIMP int __cdecl _wcsicmp (const wchar_t*, const wchar_t*); +_CRTIMP int __cdecl _wcsicoll (const wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl _wcslwr (wchar_t*); +extern __inline__ int __cdecl wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2) {return _wcsicmp (__ws1, __ws2);} -wchar_t* _wcsnset (wchar_t*, wchar_t, __CSTD size_t); -wchar_t* _wcsrev (wchar_t*); -wchar_t* _wcsset (wchar_t*, wchar_t); -wchar_t* _wcsupr (wchar_t*); +_CRTIMP wchar_t* __cdecl _wcsnset (wchar_t*, wchar_t, __CSTD size_t); +_CRTIMP wchar_t* __cdecl _wcsrev (wchar_t*); +_CRTIMP wchar_t* __cdecl _wcsset (wchar_t*, wchar_t); +_CRTIMP wchar_t* __cdecl _wcsupr (wchar_t*); #ifdef __MSVCRT__ -int _wcsncoll(const wchar_t*, const wchar_t*, __CSTD size_t); -int _wcsnicoll(const wchar_t*, const wchar_t*, __CSTD size_t); +_CRTIMP int __cdecl _wcsncoll(const wchar_t*, const wchar_t*, __CSTD size_t); +_CRTIMP int __cdecl _wcsnicoll(const wchar_t*, const wchar_t*, __CSTD size_t); #endif #ifndef __NO_OLDNAMES /* NOTE: There is no _wcscmpi, but this is for compatibility. */ -int wcscmpi (const wchar_t*, const wchar_t*); -wchar_t* wcsdup (wchar_t*); -int wcsicmp (const wchar_t*, const wchar_t*); -int wcsicoll (const wchar_t*, const wchar_t*); -wchar_t* wcslwr (wchar_t*); -int wcsnicmp (const wchar_t*, const wchar_t*, __CSTD size_t); -wchar_t* wcsnset (wchar_t*, wchar_t, __CSTD size_t); -wchar_t* wcsrev (wchar_t*); -wchar_t* wcsset (wchar_t*, wchar_t); -wchar_t* wcsupr (wchar_t*); +_CRTIMP int __cdecl wcscmpi (const wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl wcsdup (wchar_t*); +_CRTIMP int __cdecl wcsicmp (const wchar_t*, const wchar_t*); +_CRTIMP int __cdecl wcsicoll (const wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl wcslwr (wchar_t*); +_CRTIMP int __cdecl wcsnicmp (const wchar_t*, const wchar_t*, __CSTD size_t); +_CRTIMP wchar_t* __cdecl wcsnset (wchar_t*, wchar_t, __CSTD size_t); +_CRTIMP wchar_t* __cdecl wcsrev (wchar_t*); +_CRTIMP wchar_t* __cdecl wcsset (wchar_t*, wchar_t); +_CRTIMP wchar_t* __cdecl wcsupr (wchar_t*); #endif /* Not _NO_OLDNAMES */ __END_CGLOBAL_NAMESPACE diff --git a/winsup/mingw/include/sys/param.h b/winsup/mingw/include/sys/param.h new file mode 100644 index 00000000000..5ff4c877967 --- /dev/null +++ b/winsup/mingw/include/sys/param.h @@ -0,0 +1,41 @@ +/* + * param.h + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Earnie Boyd <earnie@users.sf.net> + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision$ + * $Author$ + * $Date$ + * + */ + +#ifndef _SYS_PARAM_H +#define _SYS_PARAM_H + +#include <sys/types.h> +#include <limits.h> + +#ifndef __STRICT_ANSI__ +/* These are useful for cross-compiling */ +#define BIG_ENDIAN 4321 +#define LITTLE_ENDIAN 1234 +#define BYTE_ORDER LITTLE_ENDIAN + +#define MAXPATHLEN PATH_MAX + +#endif + +#endif diff --git a/winsup/mingw/include/sys/stat.h b/winsup/mingw/include/sys/stat.h index 6b4a25f1fb2..632034ae3cf 100644 --- a/winsup/mingw/include/sys/stat.h +++ b/winsup/mingw/include/sys/stat.h @@ -154,16 +154,16 @@ struct _stati64 { extern "C" { #endif -int _fstat (int, struct _stat*); -int _chmod (const char*, int); -int _stat (const char*, struct _stat*); +_CRTIMP int __cdecl _fstat (int, struct _stat*); +_CRTIMP int __cdecl _chmod (const char*, int); +_CRTIMP int __cdecl _stat (const char*, struct _stat*); #if defined (__MSVCRT__) -int _fstati64(int, struct _stati64 *); -int _stati64(const char *, struct _stati64 *); +_CRTIMP int __cdecl _fstati64(int, struct _stati64 *); +_CRTIMP int __cdecl _stati64(const char *, struct _stati64 *); #if !defined ( _WSTAT_DEFINED) /* also declared in wchar.h */ -int _wstat(const wchar_t*, struct _stat*); -int _wstati64 (const wchar_t*, struct _stati64*); +_CRTIMP int __cdecl _wstat(const wchar_t*, struct _stat*); +_CRTIMP int __cdecl _wstati64 (const wchar_t*, struct _stati64*); #define _WSTAT_DEFINED #endif /* _WSTAT_DEFIND */ #endif /* __MSVCRT__ */ @@ -171,9 +171,9 @@ int _wstati64 (const wchar_t*, struct _stati64*); #ifndef _NO_OLDNAMES /* These functions live in liboldnames.a. */ -int fstat (int, struct stat*); -int chmod (const char*, int); -int stat (const char*, struct stat*); +_CRTIMP int __cdecl fstat (int, struct stat*); +_CRTIMP int __cdecl chmod (const char*, int); +_CRTIMP int __cdecl stat (const char*, struct stat*); #endif /* Not _NO_OLDNAMES */ diff --git a/winsup/mingw/include/sys/timeb.h b/winsup/mingw/include/sys/timeb.h new file mode 100644 index 00000000000..16b4dc0a4f1 --- /dev/null +++ b/winsup/mingw/include/sys/timeb.h @@ -0,0 +1,82 @@ +/* + * timeb.h + * + * Support for the UNIX System V ftime system call. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp> + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision$ + * $Author$ + * $Date$ + * + */ + +#ifndef __STRICT_ANSI__ + +#ifndef _TIMEB_H_ +#define _TIMEB_H_ + +/* All the headers include this file. */ +#include <_mingw.h> + +#ifndef RC_INVOKED + +/* + * TODO: Structure not tested. + */ +struct _timeb +{ + long time; + short millitm; + short timezone; + short dstflag; +}; + +#ifndef _NO_OLDNAMES +/* + * TODO: Structure not tested. + */ +struct timeb +{ + long time; + short millitm; + short timezone; + short dstflag; +}; +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + +/* TODO: Not tested. */ +_CRTIMP void __cdecl _ftime (struct _timeb*); + +#ifndef _NO_OLDNAMES +_CRTIMP void __cdecl ftime (struct timeb*); +#endif /* Not _NO_OLDNAMES */ + +#ifdef __cplusplus +} +#endif + +#endif /* Not RC_INVOKED */ + +#endif /* Not _TIMEB_H_ */ + +#endif /* Not __STRICT_ANSI__ */ + diff --git a/winsup/mingw/include/sys/utime.h b/winsup/mingw/include/sys/utime.h index d81e2b479c3..69207553667 100644 --- a/winsup/mingw/include/sys/utime.h +++ b/winsup/mingw/include/sys/utime.h @@ -65,16 +65,16 @@ struct utimbuf extern "C" { #endif -int _utime (const char*, struct _utimbuf*); -int _futime (int, struct _utimbuf*); +_CRTIMP int __cdecl _utime (const char*, struct _utimbuf*); +_CRTIMP int __cdecl _futime (int, struct _utimbuf*); /* The wide character version, only available for MSVCRT versions of the * C runtime library. */ #ifdef __MSVCRT__ -int _wutime (const wchar_t*, struct _utimbuf*); +_CRTIMP int __cdecl _wutime (const wchar_t*, struct _utimbuf*); #endif /* MSVCRT runtime */ #ifndef _NO_OLDNAMES -int utime (const char*, struct utimbuf*); +_CRTIMP int __cdecl utime (const char*, struct utimbuf*); #endif /* Not _NO_OLDNAMES */ #ifdef __cplusplus diff --git a/winsup/mingw/include/time.h b/winsup/mingw/include/time.h index 5bc85381e5c..6ec8dd00dff 100644 --- a/winsup/mingw/include/time.h +++ b/winsup/mingw/include/time.h @@ -88,10 +88,10 @@ struct tm #define _TM_DEFINED #endif -clock_t clock (void); -time_t time (time_t*); -double difftime (time_t, time_t); -time_t mktime (struct tm*); +_CRTIMP clock_t __cdecl clock (void); +_CRTIMP time_t __cdecl time (time_t*); +_CRTIMP double __cdecl difftime (time_t, time_t); +_CRTIMP time_t __cdecl mktime (struct tm*); /* * These functions write to and return pointers to static buffers that may @@ -103,32 +103,30 @@ time_t mktime (struct tm*); * Fault and crap out your program. Guess how I know. Hint: stat called on * a directory gives 'invalid' times in st_atime etc... */ -char* asctime (const struct tm*); -char* ctime (const time_t*); -struct tm* gmtime (const time_t*); -struct tm* localtime (const time_t*); +_CRTIMP char* __cdecl asctime (const struct tm*); +_CRTIMP char* __cdecl ctime (const time_t*); +_CRTIMP struct tm* __cdecl gmtime (const time_t*); +_CRTIMP struct tm* __cdecl localtime (const time_t*); +_CRTIMP size_t __cdecl strftime (char*, size_t, const char*, const struct tm*); -size_t strftime (char*, size_t, const char*, const struct tm*); - -size_t wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*); +_CRTIMP size_t __cdecl wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*); __END_CSTD_NAMESPACE __BEGIN_CGLOBAL_NAMESPACE -#ifndef __STRICT_ANSI__ -extern void _tzset (void); - + #ifndef __STRICT_ANSI__ +extern _CRTIMP void __cdecl _tzset (void); + #ifndef _NO_OLDNAMES -extern void tzset (void); +extern _CRTIMP void __cdecl tzset (void); #endif -size_t strftime(char*, __CSTD size_t, const char*, const struct __CSTD tm*); -char* _strdate(char*); -char* _strtime(char*); - -#endif /* Not __STRICT_ANSI__ */ - +_CRTIMP size_t __cdecl strftime(char*, size_t, const char*, const struct tm*); +_CRTIMP char* __cdecl _strdate(char*); +_CRTIMP char* __cdecl _strtime(char*); + + #endif /* Not __STRICT_ANSI__ */ /* * _daylight: non zero if daylight savings time is used. * _timezone: difference in seconds between GMT and local time. @@ -138,9 +136,9 @@ char* _strtime(char*); #ifdef __MSVCRT__ /* These are for compatibility with pre-VC 5.0 suppied MSVCRT. */ -extern int* __p__daylight (void); -extern long* __p__timezone (void); -extern char** __p__tzname (void); +extern _CRTIMP int* __cdecl __p__daylight (void); +extern _CRTIMP long* __cdecl __p__timezone (void); +extern _CRTIMP char** __cdecl __p__tzname (void); __MINGW_IMPORT int _daylight; __MINGW_IMPORT long _timezone; @@ -184,10 +182,10 @@ __MINGW_IMPORT char *tzname[2]; /* wide function prototypes, also declared in wchar.h */ -wchar_t * _wasctime(const struct __CSTD tm*); -wchar_t * _wctime(const __CSTD time_t*); -wchar_t* _wstrdate(wchar_t*); -wchar_t* _wstrtime(wchar_t*); +_CRTIMP wchar_t* __cdecl _wasctime(const struct tm*); +_CRTIMP wchar_t* __cdecl _wctime(const time_t*); +_CRTIMP wchar_t* __cdecl _wstrdate(wchar_t*); +_CRTIMP wchar_t* __cdecl _wstrtime(wchar_t*); #define _WTIME_DEFINED #endif /* _WTIME_DEFINED */ diff --git a/winsup/mingw/include/unistd.h b/winsup/mingw/include/unistd.h new file mode 100644 index 00000000000..faa20565568 --- /dev/null +++ b/winsup/mingw/include/unistd.h @@ -0,0 +1,17 @@ +/* + * This file is part of the Mingw32 package. + * + * unistd.h maps (roughly) to io.h + */ + +#ifndef __STRICT_ANSI__ + +#include <io.h> +#include <process.h> + +#define __UNISTD_GETOPT__ +#include <getopt.h> +#undef __UNISTD_GETOPT__ + +#endif + diff --git a/winsup/mingw/include/utime.h b/winsup/mingw/include/utime.h new file mode 100644 index 00000000000..8285f38fdef --- /dev/null +++ b/winsup/mingw/include/utime.h @@ -0,0 +1 @@ +#include <sys/utime.h> diff --git a/winsup/mingw/include/wchar.h b/winsup/mingw/include/wchar.h index 9c62139537f..a045753a457 100644 --- a/winsup/mingw/include/wchar.h +++ b/winsup/mingw/include/wchar.h @@ -103,25 +103,25 @@ __END_CSTD_NAMESPACE __BEGIN_CSTD_NAMESPACE /* also in stdio.h - keep in sync */ -int fwprintf (FILE*, const wchar_t*, ...); -int wprintf (const wchar_t*, ...); -int swprintf (wchar_t*, const wchar_t*, ...); -int vfwprintf (FILE*, const wchar_t*, __VALIST); -int vwprintf (const wchar_t*, __VALIST); -int vswprintf (wchar_t*, const wchar_t*, __VALIST); -int fwscanf (FILE*, const wchar_t*, ...); -int wscanf (const wchar_t*, ...); -int swscanf (const wchar_t*, const wchar_t*, ...); -wint_t fgetwc (FILE*); -wint_t fputwc (wchar_t, FILE*); -wint_t ungetwc (wchar_t, FILE*); +_CRTIMP int __cdecl fwprintf (FILE*, const wchar_t*, ...); +_CRTIMP int __cdecl wprintf (const wchar_t*, ...); +_CRTIMP int __cdecl swprintf (wchar_t*, const wchar_t*, ...); +_CRTIMP int __cdecl vfwprintf (FILE*, const wchar_t*, __VALIST); +_CRTIMP int __cdecl vwprintf (const wchar_t*, __VALIST); +_CRTIMP int __cdecl vswprintf (wchar_t*, const wchar_t*, __VALIST); +_CRTIMP int __cdecl fwscanf (FILE*, const wchar_t*, ...); +_CRTIMP int __cdecl wscanf (const wchar_t*, ...); +_CRTIMP int __cdecl swscanf (const wchar_t*, const wchar_t*, ...); +_CRTIMP wint_t __cdecl fgetwc (FILE*); +_CRTIMP wint_t __cdecl fputwc (wchar_t, FILE*); +_CRTIMP wint_t __cdecl ungetwc (wchar_t, FILE*); #ifdef __MSVCRT__ -wchar_t* fgetws (wchar_t*, int, FILE*); -int fputws (const wchar_t*, FILE*); -wint_t getwc (FILE*); -wint_t getwchar (void); -wint_t putwc (wint_t, FILE*); -wint_t putwchar (wint_t); +_CRTIMP wchar_t* __cdecl fgetws (wchar_t*, int, FILE*); +_CRTIMP int __cdecl fputws (const wchar_t*, FILE*); +_CRTIMP wint_t __cdecl getwc (FILE*); +_CRTIMP wint_t __cdecl getwchar (void); +_CRTIMP wint_t __cdecl putwc (wint_t, FILE*); +_CRTIMP wint_t __cdecl putwchar (wint_t); #endif __END_CSTD_NAMESPACE @@ -129,30 +129,35 @@ __BEGIN_CGLOBAL_NAMESPACE #ifdef __MSVCRT__ #ifndef __STRICT_ANSI__ -wchar_t* _getws (wchar_t*); -int _putws (const wchar_t*); -__CSTD FILE* _wfdopen(int, wchar_t *); -__CSTD FILE* _wfopen (const wchar_t*, const wchar_t*); -__CSTD FILE* _wfreopen (const wchar_t*, const wchar_t*, __CSTD FILE*); -__CSTD FILE* _wfsopen (const wchar_t*, const wchar_t*, int); -wchar_t* _wtmpnam (wchar_t*); -wchar_t* _wtempnam (const wchar_t*, const wchar_t*); -int _wrename (const wchar_t*, const wchar_t*); -int _wremove (const wchar_t*); -void _wperror (const wchar_t*); -__CSTD FILE* _wpopen (const wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl _getws (wchar_t*); +_CRTIMP int __cdecl _putws (const wchar_t*); +_CRTIMP __CSTD FILE* _wfdopen(int, wchar_t *); +_CRTIMP __CSTD FILE* _wfopen (const wchar_t*, const wchar_t*); +_CRTIMP __CSTD FILE* _wfreopen (const wchar_t*, const wchar_t*, __CSTD FILE*); +_CRTIMP __CSTD FILE* _wfsopen (const wchar_t*, const wchar_t*, int); +_CRTIMP wchar_t* __cdecl _wtmpnam (wchar_t*); +_CRTIMP wchar_t* __cdecl _wtempnam (const wchar_t*, const wchar_t*); +_CRTIMP int __cdecl _wrename (const wchar_t*, const wchar_t*); +_CRTIMP int __cdecl _wremove (const wchar_t*); +_CRTIMP void __cdecl _wperror (const wchar_t*); +_CRTIMP __CSTD FILE* __cdecl _wpopen (const wchar_t*, const wchar_t*); #endif /* Not __STRICT_ANSI__ */ #endif /* __MSVCRT__ */ /* C99 names, but non-standard behaviour */ -int _snwprintf (wchar_t*, __CSTD size_t, const wchar_t*, ...); -int _vsnwprintf (wchar_t*, __CSTD size_t, const wchar_t*, __VALIST); +int __cdecl _snwprintf (wchar_t*, __CSTD size_t, const wchar_t*, ...); +int __cdecl _vsnwprintf (wchar_t*, __CSTD size_t, const wchar_t*, __VALIST); #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ -int snwprintf(wchar_t* s, __CSTD size_t n, const wchar_t* format, ...); -extern __inline__ int +int __cdecl snwprintf(wchar_t* s, __CSTD size_t n, const wchar_t* format, ...); +extern __inline__ int __cdecl vsnwprintf (wchar_t* __s, __CSTD size_t __n, const wchar_t* __format, __VALIST __arg) { return _vsnwprintf ( __s, __n, __format, __arg);} +int __cdecl vwscanf (const wchar_t * __restrict__, __VALIST); +int __cdecl vfwscanf (__CSTD FILE * __restrict__, + const wchar_t * __restrict__, __VALIST); +int __cdecl vswscanf (const wchar_t * __restrict__, + const wchar_t * __restrict__, __VALIST); #endif __END_CGLOBAL_NAMESPACE @@ -165,23 +170,23 @@ __END_CGLOBAL_NAMESPACE * Also in string.h, since MSDN puts them in both headers. */ __BEGIN_CSTD_NAMESPACE -wchar_t* wcscat (wchar_t*, const wchar_t*); -wchar_t* wcschr (const wchar_t*, wchar_t); -int wcscmp (const wchar_t*, const wchar_t*); -int wcscoll (const wchar_t*, const wchar_t*); -wchar_t* wcscpy (wchar_t*, const wchar_t*); -size_t wcscspn (const wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl wcscat (wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl wcschr (const wchar_t*, wchar_t); +_CRTIMP int __cdecl wcscmp (const wchar_t*, const wchar_t*); +_CRTIMP int __cdecl wcscoll (const wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl wcscpy (wchar_t*, const wchar_t*); +_CRTIMP size_t __cdeclwcscspn (const wchar_t*, const wchar_t*); /* Note: No wcserror in CRTDLL. */ -size_t wcslen (const wchar_t*); -wchar_t* wcsncat (wchar_t*, const wchar_t*, size_t); -int wcsncmp(const wchar_t*, const wchar_t*, size_t); -wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t); -wchar_t* wcspbrk(const wchar_t*, const wchar_t*); -wchar_t* wcsrchr(const wchar_t*, wchar_t); -size_t wcsspn(const wchar_t*, const wchar_t*); -wchar_t* wcsstr(const wchar_t*, const wchar_t*); -wchar_t* wcstok(wchar_t*, const wchar_t*); -size_t wcsxfrm(wchar_t*, const wchar_t*, size_t); +_CRTIMP size_t __cdecl wcslen (const wchar_t*); +_CRTIMP wchar_t* __cdecl wcsncat (wchar_t*, const wchar_t*, size_t); +_CRTIMP int __cdecl wcsncmp(const wchar_t*, const wchar_t*, size_t); +_CRTIMP wchar_t* __cdecl wcsncpy(wchar_t*, const wchar_t*, size_t); +_CRTIMP wchar_t* __cdecl wcspbrk(const wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl wcsrchr(const wchar_t*, wchar_t); +_CRTIMP size_t __cdeclwcsspn(const wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl wcsstr(const wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl wcstok(wchar_t*, const wchar_t*); +_CRTIMP size_t __cdecl wcsxfrm(wchar_t*, const wchar_t*, size_t); __END_CSTD_NAMESPACE #ifndef __STRICT_ANSI__ @@ -191,35 +196,35 @@ __BEGIN_CGLOBAL_NAMESPACE */ /* NOTE: _wcscmpi not provided by CRTDLL, this define is for portability */ -#define _wcscmpi _wcsicmp - -wchar_t* _wcsdup (const wchar_t*); -int _wcsicmp (const wchar_t*, const wchar_t*); -int _wcsicoll (const wchar_t*, const wchar_t*); -wchar_t* _wcslwr (wchar_t*); -int _wcsnicmp (const wchar_t*, const wchar_t*, __CSTD size_t); -wchar_t* _wcsnset (wchar_t*, wchar_t, __CSTD size_t); -wchar_t* _wcsrev (wchar_t*); -wchar_t* _wcsset (wchar_t*, wchar_t); -wchar_t* _wcsupr (wchar_t*); +#define _wcscmpi _wcsicmp + +_CRTIMP wchar_t* __cdecl _wcsdup (const wchar_t*); +_CRTIMP int __cdecl _wcsicmp (const wchar_t*, const wchar_t*); +_CRTIMP int __cdecl _wcsicoll (const wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl _wcslwr (wchar_t*); +_CRTIMP int __cdecl _wcsnicmp (const wchar_t*, const wchar_t*, __CSTD size_t); +_CRTIMP wchar_t* __cdecl _wcsnset (wchar_t*, wchar_t, __CSTD size_t); +_CRTIMP wchar_t* __cdecl _wcsrev (wchar_t*); +_CRTIMP wchar_t* __cdecl _wcsset (wchar_t*, wchar_t); +_CRTIMP wchar_t* __cdecl _wcsupr (wchar_t*); #ifdef __MSVCRT__ -int _wcsncoll(const wchar_t*, const wchar_t*, __CSTD size_t); -int _wcsnicoll(const wchar_t*, const wchar_t*, __CSTD size_t); +_CRTIMP int _wcsncoll(const wchar_t*, const wchar_t*, __CSTD size_t); +_CRTIMP int _wcsnicoll(const wchar_t*, const wchar_t*, __CSTD size_t); #endif #ifndef __NO_OLDNAMES /* NOTE: There is no _wcscmpi, but this is for compatibility. */ -int wcscmpi (const wchar_t*, const wchar_t*); -wchar_t* wcsdup (wchar_t*); -int wcsicmp (const wchar_t*, const wchar_t*); -int wcsicoll (const wchar_t*, const wchar_t*); -wchar_t* wcslwr (wchar_t*); -int wcsnicmp (const wchar_t*, const wchar_t*, __CSTD size_t); -wchar_t* wcsnset (wchar_t*, wchar_t, __CSTD size_t); -wchar_t* wcsrev (wchar_t*); -wchar_t* wcsset (wchar_t*, wchar_t); -wchar_t* wcsupr (wchar_t*); +_CRTIMP int __cdecl wcscmpi (const wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl wcsdup (wchar_t*); +_CRTIMP int __cdecl wcsicmp (const wchar_t*, const wchar_t*); +_CRTIMP int __cdecl wcsicoll (const wchar_t*, const wchar_t*); +_CRTIMP wchar_t* __cdecl wcslwr (wchar_t*); +_CRTIMP int __cdecl wcsnicmp (const wchar_t*, const wchar_t*, __CSTD size_t); +_CRTIMP wchar_t* __cdecl wcsnset (wchar_t*, wchar_t, __CSTD size_t); +_CRTIMP wchar_t* __cdecl wcsrev (wchar_t*); +_CRTIMP wchar_t* __cdecl wcsset (wchar_t*, wchar_t); +_CRTIMP wchar_t* __cdecl wcsupr (wchar_t*); #endif /* Not _NO_OLDNAMES */ __END_CGLOBAL_NAMESPACE @@ -263,17 +268,17 @@ struct _wfinddatai64_t { #if !defined (_WIO_DEFINED) /* Wide character versions from io.h */ #if defined (__MSVCRT__) -int _waccess(const wchar_t*, int); -int _wchmod(const wchar_t*, int); -int _wcreat(const wchar_t*, int); -long _wfindfirst(const wchar_t*, struct _wfinddata_t*); -int _wfindnext(long, struct _wfinddata_t *); -int _wunlink(const wchar_t*); -int _wopen(const wchar_t*, int, ...); -int _wsopen(const wchar_t*, int, int, ...); -wchar_t * _wmktemp(wchar_t*); -long _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*); -int _wfindnexti64(long, struct _wfinddatai64_t*); +_CRTIMP int __cdecl _waccess(const wchar_t*, int); +_CRTIMP int __cdecl _wchmod(const wchar_t*, int); +_CRTIMP int __cdecl _wcreat(const wchar_t*, int); +_CRTIMP long __cdecl _wfindfirst(const wchar_t*, struct _wfinddata_t*); +_CRTIMP int __cdecl _wfindnext(long, struct _wfinddata_t *); +_CRTIMP int __cdecl _wunlink(const wchar_t*); +_CRTIMP int __cdecl _wopen(const wchar_t*, int, ...); +_CRTIMP int __cdecl _wsopen(const wchar_t*, int, int, ...); +_CRTIMP wchar_t * __cdecl _wmktemp(wchar_t*); +_CRTIMP long __cdecl _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*); +_CRTIMP int __cdecl _wfindnexti64(long, struct _wfinddatai64_t*); #ifndef __NO_OLDNAMES /* Where do these live? Not in libmoldname.a nor in libmsvcrt.a */ @@ -298,11 +303,11 @@ wchar_t * wmktemp(wchar_t *); #ifndef _WDIRECT_DEFINED /* Also in direct.h */ #ifdef __MSVCRT__ -int _wchdir (const wchar_t*); -wchar_t* _wgetcwd (wchar_t*, int); -wchar_t* _wgetdcwd (int, wchar_t*, int); -int _wmkdir (const wchar_t*); -int _wrmdir (const wchar_t*); +_CRTIMP int __cdecl _wchdir (const wchar_t*); +_CRTIMP wchar_t* __cdecl _wgetcwd (wchar_t*, int); +_CRTIMP wchar_t* __cdecl _wgetdcwd (int, wchar_t*, int); +_CRTIMP int __cdecl _wmkdir (const wchar_t*); +_CRTIMP int __cdecl _wrmdir (const wchar_t*); #endif /* __MSVCRT__ */ #define _WDIRECT_DEFINED #endif /* _WDIRECT_DEFINED */ @@ -368,14 +373,14 @@ struct _stati64 { #if !defined ( _WSTAT_DEFINED) /* also declared in sys/stat.h */ #if defined __MSVCRT__ -int _wstat (const wchar_t*, struct _stat*); -int _wstati64 (const wchar_t*, struct _stati64*); +_CRTIMP int __cdecl _wstat (const wchar_t*, struct _stat*); +_CRTIMP int __cdecl _wstati64 (const wchar_t*, struct _stati64*); #endif /* __MSVCRT__ */ #define _WSTAT_DEFINED #endif /* ! _WSTAT_DEFIND */ #ifndef _WLOCALE_DEFINED /* also declared in locale.h */ -wchar_t* _wsetlocale (int, const wchar_t*); +_CRTIMP wchar_t* __cdecl _wsetlocale (int, const wchar_t*); #define _WLOCALE_DEFINED #endif __END_CGLOBAL_NAMESPACE @@ -386,28 +391,28 @@ __BEGIN_CGLOBAL_NAMESPACE #ifdef __MSVCRT__ #ifndef __STRICT_ANSI__ /* wide function prototypes, also declared in time.h */ -wchar_t* _wasctime (const struct __CSTD tm*); -wchar_t* _wctime (const __CSTD time_t*); -wchar_t* _wstrdate (wchar_t*); -wchar_t* _wstrtime (wchar_t*); +_CRTIMP wchar_t* __cdecl _wasctime (const struct __CSTD tm*); +_CRTIMP wchar_t* __cdecl _wctime (const __CSTD time_t*); +_CRTIMP wchar_t* __cdecl _wstrdate (wchar_t*); +_CRTIMP wchar_t* __cdecl _wstrtime (wchar_t*); #endif /* __MSVCRT__ */ #endif /* __STRICT_ANSI__ */ __END_CGLOBAL_NAMESPACE __BEGIN_CSTD_NAMESPACE -size_t wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*); +_CRTIMP size_t __cdecl wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*); __END_CSTD_NAMESPACE #define _WTIME_DEFINED #endif /* _WTIME_DEFINED */ #ifndef _WSTDLIB_DEFINED /* also declared in stdlib.h */ __BEGIN_CSTD_NAMESPACE -long wcstol (const wchar_t*, wchar_t**, int); -unsigned long wcstoul (const wchar_t*, wchar_t**, int); -double wcstod (const wchar_t*, wchar_t**); +_CRTIMP long __cdecl wcstol (const wchar_t*, wchar_t**, int); +_CRTIMP unsigned long __cdecl wcstoul (const wchar_t*, wchar_t**, int); +_CRTIMP double __cdecl wcstod (const wchar_t*, wchar_t**); #if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */ -extern __inline__ float wcstof( const wchar_t *__nptr, wchar_t **__endptr) -{ return (wcstod(__nptr, __endptr)); } -long double wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__); +extern __inline__ float __cdecl wcstof( const wchar_t *__nptr, wchar_t **__endptr) + { return (wcstod(__nptr, __endptr)); } +long double __cdecl wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__); #endif /* __NO_ISOCEXT */ __END_CSTD_NAMESPACE #define _WSTDLIB_DEFINED @@ -425,30 +430,30 @@ typedef int mbstate_t; /* If you don't have msvcp60.dll in your windows system directory, you can easily obtain it with a search from your favorite search engine. */ -wint_t btowc(int); -size_t mbrlen(const char *, size_t, mbstate_t *); -size_t mbrtowc(wchar_t *, const char *, size_t, mbstate_t *); -size_t mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *); +wint_t __cdecl btowc(int); +size_t __cdecl mbrlen(const char *, size_t, mbstate_t *); +size_t __cdecl mbrtowc(wchar_t *, const char *, size_t, mbstate_t *); +size_t __cdecl mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *); -size_t wcrtomb(char *, wchar_t, mbstate_t *); -size_t wcsrtombs(char *, const wchar_t **, size_t, mbstate_t *); -int wctob(wint_t); +size_t __cdecl wcrtomb(char *, wchar_t, mbstate_t *); +size_t __cdecl wcsrtombs(char *, const wchar_t **, size_t, mbstate_t *); +int __cdecl wctob(wint_t); #ifndef __NO_ISOCEXT /* these need static lib libmingwex.a */ extern __inline__ int fwide(FILE* __stream, int __mode) {return -1;} /* limited to byte orientation */ extern __inline__ int mbsinit(const mbstate_t* __ps) {return 1;} -wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n); -wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n); -int wmemcmp(const wchar_t* s1, const wchar_t * s2, size_t n); -wchar_t* wmemcpy(wchar_t* __restrict__ s1, const wchar_t* __restrict__ s2, - size_t n); -wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n); -long long wcstoll(const wchar_t* __restrict__ nptr, - wchar_t** __restrict__ endptr, int base); -unsigned long long wcstoull(const wchar_t* __restrict__ nptr, - wchar_t ** __restrict__ endptr, int base); +wchar_t* __cdecl wmemset(wchar_t* s, wchar_t c, size_t n); +wchar_t* __cdecl wmemchr(const wchar_t* s, wchar_t c, size_t n); +int __cdecl wmemcmp(const wchar_t* s1, const wchar_t * s2, size_t n); +wchar_t* __cdecl wmemcpy(wchar_t* __restrict__ s1, const wchar_t* __restrict__ s2, + size_t n); +wchar_t* __cdecl wmemmove(wchar_t* s1, const wchar_t* s2, size_t n); +long long __cdecl wcstoll(const wchar_t* __restrict__ nptr, + wchar_t** __restrict__ endptr, int base); +unsigned long long __cdecl wcstoull(const wchar_t* __restrict__ nptr, + wchar_t ** __restrict__ endptr, int base); #endif /* __NO_ISOCEXT */ diff --git a/winsup/mingw/include/wctype.h b/winsup/mingw/include/wctype.h index 78168642567..f16360c7ad2 100644 --- a/winsup/mingw/include/wctype.h +++ b/winsup/mingw/include/wctype.h @@ -62,24 +62,24 @@ typedef wchar_t wctype_t; #endif /* Wide character equivalents - also in ctype.h */ -int iswalnum(wint_t); -int iswalpha(wint_t); -int iswascii(wint_t); -int iswcntrl(wint_t); -int iswctype(wint_t, wctype_t); -int iswdigit(wint_t); -int iswgraph(wint_t); -int iswlower(wint_t); -int iswprint(wint_t); -int iswpunct(wint_t); -int iswspace(wint_t); -int iswupper(wint_t); -int iswxdigit(wint_t); - -wchar_t towlower(wchar_t); -wchar_t towupper(wchar_t); - -int isleadbyte (int); +_CRTIMP int __cdecl iswalnum(wint_t); +_CRTIMP int __cdecl iswalpha(wint_t); +_CRTIMP int __cdecl iswascii(wint_t); +_CRTIMP int __cdecl iswcntrl(wint_t); +_CRTIMP int __cdecl iswctype(wint_t, wctype_t); +_CRTIMP int __cdecl iswdigit(wint_t); +_CRTIMP int __cdecl iswgraph(wint_t); +_CRTIMP int __cdecl iswlower(wint_t); +_CRTIMP int __cdecl iswprint(wint_t); +_CRTIMP int __cdecl iswpunct(wint_t); +_CRTIMP int __cdecl iswspace(wint_t); +_CRTIMP int __cdecl iswupper(wint_t); +_CRTIMP int __cdecl iswxdigit(wint_t); + +_CRTIMP wchar_t __cdecl towlower(wchar_t); +_CRTIMP wchar_t __cdecl towupper(wchar_t); + +_CRTIMP int __cdecl isleadbyte (int); /* Also in ctype.h */ @@ -104,34 +104,35 @@ extern unsigned short** _imp___ctype; # endif /* CRTDLL */ #endif /* __DECLSPEC_SUPPORTED */ -#if !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) +#if !(defined (__NO_INLINE__) || defined(__NO_CTYPE_INLINES) \ + || defined(__WCTYPE_INLINES_DEFINED)) #define __WCTYPE_INLINES_DEFINED -extern __inline__ int iswalnum(wint_t __wc) {return (iswctype(__wc,_ALPHA|_DIGIT));} -extern __inline__ int iswalpha(wint_t __wc) {return (iswctype(__wc,_ALPHA));} -extern __inline__ int iswascii(wint_t __wc) {return ((__wc & ~0x7F) == 0);} -extern __inline__ int iswcntrl(wint_t __wc) {return (iswctype(__wc,_CONTROL));} -extern __inline__ int iswdigit(wint_t __wc) {return (iswctype(__wc,_DIGIT));} -extern __inline__ int iswgraph(wint_t __wc) {return (iswctype(__wc,_PUNCT|_ALPHA|_DIGIT));} -extern __inline__ int iswlower(wint_t __wc) {return (iswctype(__wc,_LOWER));} -extern __inline__ int iswprint(wint_t __wc) {return (iswctype(__wc,_BLANK|_PUNCT|_ALPHA|_DIGIT));} -extern __inline__ int iswpunct(wint_t __wc) {return (iswctype(__wc,_PUNCT));} -extern __inline__ int iswspace(wint_t __wc) {return (iswctype(__wc,_SPACE));} -extern __inline__ int iswupper(wint_t __wc) {return (iswctype(__wc,_UPPER));} -extern __inline__ int iswxdigit(wint_t __wc) {return (iswctype(__wc,_HEX));} -extern __inline__ int isleadbyte(int __c) +extern __inline__ int __cdecl iswalnum(wint_t __wc) {return (iswctype(__wc,_ALPHA|_DIGIT));} +extern __inline__ int __cdecl iswalpha(wint_t __wc) {return (iswctype(__wc,_ALPHA));} +extern __inline__ int __cdecl iswascii(wint_t __wc) {return ((__wc & ~0x7F) == 0);} +extern __inline__ int __cdecl iswcntrl(wint_t __wc) {return (iswctype(__wc,_CONTROL));} +extern __inline__ int __cdecl iswdigit(wint_t __wc) {return (iswctype(__wc,_DIGIT));} +extern __inline__ int __cdecl iswgraph(wint_t __wc) {return (iswctype(__wc,_PUNCT|_ALPHA|_DIGIT));} +extern __inline__ int __cdecl iswlower(wint_t __wc) {return (iswctype(__wc,_LOWER));} +extern __inline__ int __cdecl iswprint(wint_t __wc) {return (iswctype(__wc,_BLANK|_PUNCT|_ALPHA|_DIGIT));} +extern __inline__ int __cdecl iswpunct(wint_t __wc) {return (iswctype(__wc,_PUNCT));} +extern __inline__ int __cdecl iswspace(wint_t __wc) {return (iswctype(__wc,_SPACE));} +extern __inline__ int __cdecl iswupper(wint_t __wc) {return (iswctype(__wc,_UPPER));} +extern __inline__ int __cdecl iswxdigit(wint_t __wc) {return (iswctype(__wc,_HEX));} +extern __inline__ int __cdecl isleadbyte(int __c) {return (_pctype[(unsigned char)(__c)] & _LEADBYTE);} #endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */ typedef wchar_t wctrans_t; -wint_t towctrans(wint_t, wctrans_t); -wctrans_t wctrans(const char*); -wctype_t wctype(const char*); +_CRTIMP wint_t __cdecl towctrans(wint_t, wctrans_t); +_CRTIMP wctrans_t __cdecl wctrans(const char*); +_CRTIMP wctype_t __cdecl wctype(const char*); __END_CSTD_NAMESPACE #ifndef __STRICT_ANSI__ __BEGIN_CGLOBAL_NAMESPACE -int is_wctype(__CSTD wint_t, __CSTD wctype_t); /* Obsolete! */ +_CRTIMP int __cdecl is_wctype(__CSTD wint_t, __CSTD wctype_t); /* Obsolete! */ __END_CGLOBAL_NAMESPACE #endif /* __STRICT_ANSI__ */ diff --git a/winsup/mingw/mingwex/Makefile.in b/winsup/mingw/mingwex/Makefile.in index bb96cac7173..f4164d6f85c 100644 --- a/winsup/mingw/mingwex/Makefile.in +++ b/winsup/mingw/mingwex/Makefile.in @@ -4,7 +4,7 @@ # This makefile requires GNU make. srcdir = @srcdir@ -VPATH = $(srcdir):$(srcdir)/math +VPATH = $(srcdir):$(srcdir)/math:$(srcdir)/stdio objdir = . target_alias = @target_alias@ @@ -29,12 +29,12 @@ DISTFILES = Makefile.in configure configure.in \ _Exit.c atoll.c dirent.c feclearexcept.c fegetenv.c \ fegetexceptflag.c fegetround.c feholdexcept.c feraiseexcept.c \ fesetenv.c fesetexceptflag.c fesetround.c fetestexcept.c \ - feupdateenv.c fwide.c imaxabs.c imaxdiv.c ldtoa.c lltoa.c lltow.c \ - mbsinit.c mingw-fseek.c sitest.c snprintf.c snwprintf.c \ - strtof.c strtoimax.c strtold.c strtoumax.c testwmem.c \ - ulltoa.c ulltow.c vsnprintf.c vsnwprintf.c wcstof.c \ - wcstoimax.c wcstold.c wcstoumax.c wdirent.c wmemchr.c \ + feupdateenv.c fwide.c getopt.c imaxabs.c imaxdiv.c ldtoa.c \ + lltoa.c lltow.c mbsinit.c mingw-fseek.c sitest.c strtof.c \ + strtoimax.c strtold.c strtoumax.c testwmem.c ulltoa.c ulltow.c \ + wcstof.c wcstoimax.c wcstold.c wcstoumax.c wdirent.c wmemchr.c \ wmemcmp.c wmemcpy.c wmemmove.c wmemset.c wtoll.c + MATH_DISTFILES = \ acosf.c acosl.c asinf.c asinl.c atan2f.c atan2l.c \ atanf.c atanl.c cbrt.c cbrtf.c cbrtl.c ceilf.S ceill.S \ @@ -61,6 +61,10 @@ MATH_DISTFILES = \ sqrtf.c sqrtl.c tanf.S tanhf.c tanhl.c tanl.S tgamma.c \ tgammaf.c tgammal.c trunc.c truncf.c truncl.c +STDIO_DISTFILES = \ + snprintf.c snwprintf.c vsnprintf.c vsnwprintf.c \ + vfscanf.c vfwscanf.c vscanf.c vsscanf.c vswscanf.c vwscanf.c + CC = @CC@ # FIXME: Which is it, CC or CC_FOR_TARGET? CC_FOR_TARGET = $(CC) @@ -104,8 +108,9 @@ STDLIB_STUB_OBJS = \ atoll.o wtoll.o \ strtof.o wcstof.o \ _Exit.o -STDIO_STUB_OBJS = \ - snprintf.o vsnprintf.o snwprintf.o vsnwprintf.o +STDIO_OBJS = \ + snprintf.o vsnprintf.o snwprintf.o vsnwprintf.o \ + vfscanf.o vfwscanf.o vscanf.o vsscanf.o vswscanf.o vwscanf.o MATH_OBJS = \ acosf.o acosl.o asinf.o asinl.o atan2f.o atan2l.o \ atanf.o atanl.o cbrt.o cbrtf.o cbrtl.o ceilf.o ceill.o \ @@ -136,13 +141,13 @@ FENV_OBJS = fesetround.o fegetround.o \ feclearexcept.o feholdexcept.o fegetexceptflag.o \ feraiseexcept.o fetestexcept.o fesetexceptflag.o POSIX_OBJS = \ - dirent.o wdirent.o + dirent.o wdirent.o getopt.o REPLACE_OBJS = \ mingw-fseek.o LIB_OBJS = $(Q8_OBJS) $(STDLIB_OBJS) $(STDLIB_STUB_OBJS) \ - $(STDIO_STUB_OBJS) $(MATH_OBJS) $(FENV_OBJS) $(POSIX_OBJS) \ - $(REPLACE_OBJS) + $(STDIO_OBJS) $(MATH_OBJS) $(FENV_OBJS) \ + $(POSIX_OBJS) $(REPLACE_OBJS) LIBS = $(LIBMINGWEX_A) DLLS = @@ -203,8 +208,12 @@ dist: cp -p $(srcdir)/$$i $(distdir)/mingwex/$$i ; \ done mkdir $(distdir)/mingwex/math - chmod 755 $(distdir)//mingwex/math + chmod 755 $(distdir)/mingwex/math @for i in $(MATH_DISTFILES); do\ cp -p $(srcdir)/math/$$i $(distdir)/mingwex/math/$$i ; \ done - + mkdir $(distdir)/mingwex/stdio + chmod 755 $(distdir)/mingwex/stdio + @for i in $(STDIO_DISTFILES); do\ + cp -p $(srcdir)/stdio/$$i $(distdir)/mingwex/stdio/$$i ; \ + done diff --git a/winsup/mingw/mingwex/dirent.c b/winsup/mingw/mingwex/dirent.c new file mode 100644 index 00000000000..cdca6de35bd --- /dev/null +++ b/winsup/mingw/mingwex/dirent.c @@ -0,0 +1,320 @@ +/* + * dirent.c + * + * Derived from DIRLIB.C by Matt J. Weinstein + * This note appears in the DIRLIB.H + * DIRLIB.H by M. J. Weinstein Released to public domain 1-Jan-89 + * + * Updated by Jeremy Bettis <jeremy@hksys.com> + * Significantly revised and rewinddir, seekdir and telldir added by Colin + * Peters <colin@fu.is.saga-u.ac.jp> + * + * $Revision$ + * $Author$ + * $Date$ + * + */ + +#include <stdlib.h> +#include <errno.h> +#include <string.h> +#include <io.h> +#include <direct.h> +#include <dirent.h> + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> /* for GetFileAttributes */ + +#include <tchar.h> +#define SUFFIX _T("*") +#define SLASH _T("\\") + +/* + * opendir + * + * Returns a pointer to a DIR structure appropriately filled in to begin + * searching a directory. + */ +_TDIR * +_topendir (const _TCHAR *szPath) +{ + _TDIR *nd; + unsigned int rc; + _TCHAR szFullPath[MAX_PATH]; + + errno = 0; + + if (!szPath) + { + errno = EFAULT; + return (_TDIR *) 0; + } + + if (szPath[0] == _T('\0')) + { + errno = ENOTDIR; + return (_TDIR *) 0; + } + + /* Attempt to determine if the given path really is a directory. */ + rc = GetFileAttributes (szPath); + if (rc == (unsigned int)-1) + { + /* call GetLastError for more error info */ + errno = ENOENT; + return (_TDIR *) 0; + } + if (!(rc & FILE_ATTRIBUTE_DIRECTORY)) + { + /* Error, entry exists but not a directory. */ + errno = ENOTDIR; + return (_TDIR *) 0; + } + + /* Make an absolute pathname. */ + _tfullpath (szFullPath, szPath, MAX_PATH); + + /* Allocate enough space to store DIR structure and the complete + * directory path given. */ + nd = (_TDIR *) malloc (sizeof (_TDIR) + _tcslen (szFullPath) + _tcslen (SLASH) + + _tcslen (SUFFIX)); + + if (!nd) + { + /* Error, out of memory. */ + errno = ENOMEM; + return (_TDIR *) 0; + } + + /* Create the search expression. */ + _tcscpy (nd->dd_name, szFullPath); + + /* Add on a slash if the path does not end with one. */ + if (nd->dd_name[0] != _T('\0') && + nd->dd_name[_tcslen (nd->dd_name) - 1] != _T('/') && + nd->dd_name[_tcslen (nd->dd_name) - 1] != _T('\\')) + { + _tcscat (nd->dd_name, SLASH); + } + + /* Add on the search pattern */ + _tcscat (nd->dd_name, SUFFIX); + + /* Initialize handle to -1 so that a premature closedir doesn't try + * to call _findclose on it. */ + nd->dd_handle = -1; + + /* Initialize the status. */ + nd->dd_stat = 0; + + /* Initialize the dirent structure. ino and reclen are invalid under + * Win32, and name simply points at the appropriate part of the + * findfirst_t structure. */ + nd->dd_dir.d_ino = 0; + nd->dd_dir.d_reclen = 0; + nd->dd_dir.d_namlen = 0; + nd->dd_dir.d_name = nd->dd_dta.name; + + return nd; +} + + +/* + * readdir + * + * Return a pointer to a dirent structure filled with the information on the + * next entry in the directory. + */ +struct _tdirent * +_treaddir (_TDIR * dirp) +{ + errno = 0; + + /* Check for valid DIR struct. */ + if (!dirp) + { + errno = EFAULT; + return (struct _tdirent *) 0; + } + + if (dirp->dd_dir.d_name != dirp->dd_dta.name) + { + /* The structure does not seem to be set up correctly. */ + errno = EINVAL; + return (struct _tdirent *) 0; + } + + if (dirp->dd_stat < 0) + { + /* We have already returned all files in the directory + * (or the structure has an invalid dd_stat). */ + return (struct _tdirent *) 0; + } + else if (dirp->dd_stat == 0) + { + /* We haven't started the search yet. */ + /* Start the search */ + dirp->dd_handle = _tfindfirst (dirp->dd_name, &(dirp->dd_dta)); + + if (dirp->dd_handle == -1) + { + /* Whoops! Seems there are no files in that + * directory. */ + dirp->dd_stat = -1; + } + else + { + dirp->dd_stat = 1; + } + } + else + { + /* Get the next search entry. */ + if (_tfindnext (dirp->dd_handle, &(dirp->dd_dta))) + { + /* We are off the end or otherwise error. */ + _findclose (dirp->dd_handle); + dirp->dd_handle = -1; + dirp->dd_stat = -1; + } + else + { + /* Update the status to indicate the correct + * number. */ + dirp->dd_stat++; + } + } + + if (dirp->dd_stat > 0) + { + /* Successfully got an entry. Everything about the file is + * already appropriately filled in except the length of the + * file name. */ + dirp->dd_dir.d_namlen = _tcslen (dirp->dd_dir.d_name); + return &dirp->dd_dir; + } + + return (struct _tdirent *) 0; +} + + +/* + * closedir + * + * Frees up resources allocated by opendir. + */ +int +_tclosedir (_TDIR * dirp) +{ + int rc; + + errno = 0; + rc = 0; + + if (!dirp) + { + errno = EFAULT; + return -1; + } + + if (dirp->dd_handle != -1) + { + rc = _findclose (dirp->dd_handle); + } + + /* Delete the dir structure. */ + free (dirp); + + return rc; +} + +/* + * rewinddir + * + * Return to the beginning of the directory "stream". We simply call findclose + * and then reset things like an opendir. + */ +void +_trewinddir (_TDIR * dirp) +{ + errno = 0; + + if (!dirp) + { + errno = EFAULT; + return; + } + + if (dirp->dd_handle != -1) + { + _findclose (dirp->dd_handle); + } + + dirp->dd_handle = -1; + dirp->dd_stat = 0; +} + +/* + * telldir + * + * Returns the "position" in the "directory stream" which can be used with + * seekdir to go back to an old entry. We simply return the value in stat. + */ +long +_ttelldir (_TDIR * dirp) +{ + errno = 0; + + if (!dirp) + { + errno = EFAULT; + return -1; + } + return dirp->dd_stat; +} + +/* + * seekdir + * + * Seek to an entry previously returned by telldir. We rewind the directory + * and call readdir repeatedly until either dd_stat is the position number + * or -1 (off the end). This is not perfect, in that the directory may + * have changed while we weren't looking. But that is probably the case with + * any such system. + */ +void +_tseekdir (_TDIR * dirp, long lPos) +{ + errno = 0; + + if (!dirp) + { + errno = EFAULT; + return; + } + + if (lPos < -1) + { + /* Seeking to an invalid position. */ + errno = EINVAL; + return; + } + else if (lPos == -1) + { + /* Seek past end. */ + if (dirp->dd_handle != -1) + { + _findclose (dirp->dd_handle); + } + dirp->dd_handle = -1; + dirp->dd_stat = -1; + } + else + { + /* Rewind and read forward to the appropriate index. */ + _trewinddir (dirp); + + while ((dirp->dd_stat < lPos) && _treaddir (dirp)) + ; + } +} diff --git a/winsup/mingw/mingwex/fesetenv.c b/winsup/mingw/mingwex/fesetenv.c new file mode 100644 index 00000000000..1e8090cc350 --- /dev/null +++ b/winsup/mingw/mingwex/fesetenv.c @@ -0,0 +1,42 @@ +#include <fenv.h> +#include <float.h> + +/* 7.6.4.3 + The fesetenv function establishes the floating-point environment + represented by the object pointed to by envp. The argument envp + points to an object set by a call to fegetenv or feholdexcept, or + equal the macro FE_DFL_ENV or an implementation-defined environment + macro. Note that fesetenv merely installs the state of the exception + flags represented through its argument, and does not raise these + exceptions. + */ + +extern void (*_imp___fpreset)( void ) ; + +int fesetenv (const fenv_t * envp) +{ + if (envp == FE_PC64_ENV) + /* + * fninit initializes the control register to 0x37f, + * the status register to zero and the tag word to 0FFFFh. + * The other registers are unaffected. + */ + __asm__ ("fninit"); + + else if (envp == FE_PC53_ENV) + /* + * MS _fpreset() does same *except* it sets control word + * to 0x27f (53-bit precison). + * We force calling _fpreset in msvcrt.dll + */ + + (*_imp___fpreset)(); + + else if (envp == FE_DFL_ENV) + /* Use the choice made at app startup */ + _fpreset(); + + else + __asm__ ("fldenv %0;" : : "m" (*envp)); + return 0; +} diff --git a/winsup/mingw/mingwex/getopt.c b/winsup/mingw/mingwex/getopt.c new file mode 100644 index 00000000000..b5d5a23b91d --- /dev/null +++ b/winsup/mingw/mingwex/getopt.c @@ -0,0 +1,503 @@ +/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ + +/*- + * Copyright (c) 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Dieter Baron and Thomas Klausner. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <assert.h> +#include <errno.h> +#include <stdlib.h> +#include <string.h> +#include <getopt.h> +#include <stdarg.h> +#include <stdio.h> + +#define REPLACE_GETOPT + +#define _DIAGASSERT(x) do {} while (0) + +#ifdef REPLACE_GETOPT +#ifdef __weak_alias +__weak_alias(getopt,_getopt) +#endif +int opterr = 1; /* if error message should be printed */ +int optind = 1; /* index into parent argv vector */ +int optopt = '?'; /* character checked for validity */ +int optreset; /* reset getopt */ +char *optarg; /* argument associated with option */ +#endif + +#ifdef __weak_alias +__weak_alias(getopt_long,_getopt_long) +#endif + +#ifndef __CYGWIN__ +#define __progname __argv[0] +#else +extern char __declspec(dllimport) *__progname; +#endif + +#define IGNORE_FIRST (*options == '-' || *options == '+') +#define PRINT_ERROR ((opterr) && ((*options != ':') \ + || (IGNORE_FIRST && options[1] != ':'))) + +#define IS_POSIXLY_CORRECT (getenv("POSIXLY_INCORRECT_GETOPT") == NULL) + +#define PERMUTE (!IS_POSIXLY_CORRECT && !IGNORE_FIRST) +/* XXX: GNU ignores PC if *options == '-' */ +#define IN_ORDER (!IS_POSIXLY_CORRECT && *options == '-') + +/* return values */ +#define BADCH (int)'?' +#define BADARG ((IGNORE_FIRST && options[1] == ':') \ + || (*options == ':') ? (int)':' : (int)'?') +#define INORDER (int)1 + +static char EMSG[1]; + +static int getopt_internal (int, char * const *, const char *); +static int gcd (int, int); +static void permute_args (int, int, int, char * const *); + +static char *place = EMSG; /* option letter processing */ + +/* XXX: set optreset to 1 rather than these two */ +static int nonopt_start = -1; /* first non option argument (for permute) */ +static int nonopt_end = -1; /* first option after non options (for permute) */ + +/* Error messages */ +static const char recargchar[] = "option requires an argument -- %c"; +static const char recargstring[] = "option requires an argument -- %s"; +static const char ambig[] = "ambiguous option -- %.*s"; +static const char noarg[] = "option doesn't take an argument -- %.*s"; +static const char illoptchar[] = "unknown option -- %c"; +static const char illoptstring[] = "unknown option -- %s"; + +static void +_vwarnx(const char *fmt, va_list ap) +{ + (void)fprintf(stderr, "%s: ", __progname); + if (fmt != NULL) + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, "\n"); +} + +static void +warnx(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + _vwarnx(fmt, ap); + va_end(ap); +} + +/* + * Compute the greatest common divisor of a and b. + */ +static int +gcd(a, b) + int a; + int b; +{ + int c; + + c = a % b; + while (c != 0) { + a = b; + b = c; + c = a % b; + } + + return b; +} + +/* + * Exchange the block from nonopt_start to nonopt_end with the block + * from nonopt_end to opt_end (keeping the same order of arguments + * in each block). + */ +static void +permute_args(panonopt_start, panonopt_end, opt_end, nargv) + int panonopt_start; + int panonopt_end; + int opt_end; + char * const *nargv; +{ + int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos; + char *swap; + + _DIAGASSERT(nargv != NULL); + + /* + * compute lengths of blocks and number and size of cycles + */ + nnonopts = panonopt_end - panonopt_start; + nopts = opt_end - panonopt_end; + ncycle = gcd(nnonopts, nopts); + cyclelen = (opt_end - panonopt_start) / ncycle; + + for (i = 0; i < ncycle; i++) { + cstart = panonopt_end+i; + pos = cstart; + for (j = 0; j < cyclelen; j++) { + if (pos >= panonopt_end) + pos -= nnonopts; + else + pos += nopts; + swap = nargv[pos]; + /* LINTED const cast */ + ((char **) nargv)[pos] = nargv[cstart]; + /* LINTED const cast */ + ((char **)nargv)[cstart] = swap; + } + } +} + +/* + * getopt_internal -- + * Parse argc/argv argument vector. Called by user level routines. + * Returns -2 if -- is found (can be long option or end of options marker). + */ +static int +getopt_internal(nargc, nargv, options) + int nargc; + char * const *nargv; + const char *options; +{ + char *oli; /* option letter list index */ + int optchar; + + _DIAGASSERT(nargv != NULL); + _DIAGASSERT(options != NULL); + + optarg = NULL; + + /* + * XXX Some programs (like rsyncd) expect to be able to + * XXX re-initialize optind to 0 and have getopt_long(3) + * XXX properly function again. Work around this braindamage. + */ + if (optind == 0) + optind = 1; + + if (optreset) + nonopt_start = nonopt_end = -1; +start: + if (optreset || !*place) { /* update scanning pointer */ + optreset = 0; + if (optind >= nargc) { /* end of argument vector */ + place = EMSG; + if (nonopt_end != -1) { + /* do permutation, if we have to */ + permute_args(nonopt_start, nonopt_end, + optind, nargv); + optind -= nonopt_end - nonopt_start; + } + else if (nonopt_start != -1) { + /* + * If we skipped non-options, set optind + * to the first of them. + */ + optind = nonopt_start; + } + nonopt_start = nonopt_end = -1; + return -1; + } + if ((*(place = nargv[optind]) != '-') + || (place[1] == '\0')) { /* found non-option */ + place = EMSG; + if (IN_ORDER) { + /* + * GNU extension: + * return non-option as argument to option 1 + */ + optarg = nargv[optind++]; + return INORDER; + } + if (!PERMUTE) { + /* + * if no permutation wanted, stop parsing + * at first non-option + */ + return -1; + } + /* do permutation */ + if (nonopt_start == -1) + nonopt_start = optind; + else if (nonopt_end != -1) { + permute_args(nonopt_start, nonopt_end, + optind, nargv); + nonopt_start = optind - + (nonopt_end - nonopt_start); + nonopt_end = -1; + } + optind++; + /* process next argument */ + goto start; + } + if (nonopt_start != -1 && nonopt_end == -1) + nonopt_end = optind; + if (place[1] && *++place == '-') { /* found "--" */ + place++; + return -2; + } + } + if ((optchar = (int)*place++) == (int)':' || + (oli = strchr(options + (IGNORE_FIRST ? 1 : 0), optchar)) == NULL) { + /* option letter unknown or ':' */ + if (!*place) + ++optind; + if (PRINT_ERROR) + warnx(illoptchar, optchar); + optopt = optchar; + return BADCH; + } + if (optchar == 'W' && oli[1] == ';') { /* -W long-option */ + /* XXX: what if no long options provided (called by getopt)? */ + if (*place) + return -2; + + if (++optind >= nargc) { /* no arg */ + place = EMSG; + if (PRINT_ERROR) + warnx(recargchar, optchar); + optopt = optchar; + return BADARG; + } else /* white space */ + place = nargv[optind]; + /* + * Handle -W arg the same as --arg (which causes getopt to + * stop parsing). + */ + return -2; + } + if (*++oli != ':') { /* doesn't take argument */ + if (!*place) + ++optind; + } else { /* takes (optional) argument */ + optarg = NULL; + if (*place) /* no white space */ + optarg = place; + /* XXX: disable test for :: if PC? (GNU doesn't) */ + else if (oli[1] != ':') { /* arg not optional */ + if (++optind >= nargc) { /* no arg */ + place = EMSG; + if (PRINT_ERROR) + warnx(recargchar, optchar); + optopt = optchar; + return BADARG; + } else + optarg = nargv[optind]; + } + place = EMSG; + ++optind; + } + /* dump back option letter */ + return optchar; +} + +#ifdef REPLACE_GETOPT +/* + * getopt -- + * Parse argc/argv argument vector. + * + * [eventually this will replace the real getopt] + */ +int +getopt(nargc, nargv, options) + int nargc; + char * const *nargv; + const char *options; +{ + int retval; + + _DIAGASSERT(nargv != NULL); + _DIAGASSERT(options != NULL); + + if ((retval = getopt_internal(nargc, nargv, options)) == -2) { + ++optind; + /* + * We found an option (--), so if we skipped non-options, + * we have to permute. + */ + if (nonopt_end != -1) { + permute_args(nonopt_start, nonopt_end, optind, + nargv); + optind -= nonopt_end - nonopt_start; + } + nonopt_start = nonopt_end = -1; + retval = -1; + } + return retval; +} +#endif + +/* + * getopt_long -- + * Parse argc/argv argument vector. + */ +int +getopt_long(nargc, nargv, options, long_options, idx) + int nargc; + char * const *nargv; + const char *options; + const struct option *long_options; + int *idx; +{ + int retval; + + _DIAGASSERT(nargv != NULL); + _DIAGASSERT(options != NULL); + _DIAGASSERT(long_options != NULL); + /* idx may be NULL */ + + if ((retval = getopt_internal(nargc, nargv, options)) == -2) { + char *current_argv, *has_equal; + size_t current_argv_len; + int i, match; + + current_argv = place; + match = -1; + + optind++; + place = EMSG; + + if (*current_argv == '\0') { /* found "--" */ + /* + * We found an option (--), so if we skipped + * non-options, we have to permute. + */ + if (nonopt_end != -1) { + permute_args(nonopt_start, nonopt_end, + optind, nargv); + optind -= nonopt_end - nonopt_start; + } + nonopt_start = nonopt_end = -1; + return -1; + } + if ((has_equal = strchr(current_argv, '=')) != NULL) { + /* argument found (--option=arg) */ + current_argv_len = has_equal - current_argv; + has_equal++; + } else + current_argv_len = strlen(current_argv); + + for (i = 0; long_options[i].name; i++) { + /* find matching long option */ + if (strncmp(current_argv, long_options[i].name, + current_argv_len)) + continue; + + if (strlen(long_options[i].name) == + (unsigned)current_argv_len) { + /* exact match */ + match = i; + break; + } + if (match == -1) /* partial match */ + match = i; + else { + /* ambiguous abbreviation */ + if (PRINT_ERROR) + warnx(ambig, (int)current_argv_len, + current_argv); + optopt = 0; + return BADCH; + } + } + if (match != -1) { /* option found */ + if (long_options[match].has_arg == no_argument + && has_equal) { + if (PRINT_ERROR) + warnx(noarg, (int)current_argv_len, + current_argv); + /* + * XXX: GNU sets optopt to val regardless of + * flag + */ + if (long_options[match].flag == NULL) + optopt = long_options[match].val; + else + optopt = 0; + return BADARG; + } + if (long_options[match].has_arg == required_argument || + long_options[match].has_arg == optional_argument) { + if (has_equal) + optarg = has_equal; + else if (long_options[match].has_arg == + required_argument) { + /* + * optional argument doesn't use + * next nargv + */ + optarg = nargv[optind++]; + } + } + if ((long_options[match].has_arg == required_argument) + && (optarg == NULL)) { + /* + * Missing argument; leading ':' + * indicates no error should be generated + */ + if (PRINT_ERROR) + warnx(recargstring, current_argv); + /* + * XXX: GNU sets optopt to val regardless + * of flag + */ + if (long_options[match].flag == NULL) + optopt = long_options[match].val; + else + optopt = 0; + --optind; + return BADARG; + } + } else { /* unknown option */ + if (PRINT_ERROR) + warnx(illoptstring, current_argv); + optopt = 0; + return BADCH; + } + if (long_options[match].flag) { + *long_options[match].flag = long_options[match].val; + retval = 0; + } else + retval = long_options[match].val; + if (idx) + *idx = match; + } + return retval; +} diff --git a/winsup/mingw/mingwex/math/cephes_emath.h b/winsup/mingw/mingwex/math/cephes_emath.h index d2f34d78cc1..c814acdd2b7 100644 --- a/winsup/mingw/mingwex/math/cephes_emath.h +++ b/winsup/mingw/mingwex/math/cephes_emath.h @@ -282,7 +282,6 @@ static __inline__ void __eshdn6(register short unsigned int *x); #define XPD 0, /* #define XPD */ #define NANS -#define INFINITY /* NaN's require infinity support. */ #ifdef NANS diff --git a/winsup/mingw/mingwex/math/powl.c b/winsup/mingw/mingwex/math/powl.c index f066eeaee60..2a09ae1e02b 100644 --- a/winsup/mingw/mingwex/math/powl.c +++ b/winsup/mingw/mingwex/math/powl.c @@ -269,8 +269,17 @@ static const unsigned short R[] = { #else #define MNEXP (-NXT*16384.0L) #endif -static const unsigned short L[] = {0xc2ef,0x705f,0xeca5,0xe2a8,0x3ffd, XPD}; -#define LOG2EA (*(long double *)(&L[0])) +static const +union +{ + unsigned short L[6]; + long double ld; +} log2ea = {{0xc2ef,0x705f,0xeca5,0xe2a8,0x3ffd, XPD}}; + +#define LOG2EA (log2ea.ld) +/* +#define LOG2EA 0.44269504088896340735992L +*/ #endif #ifdef MIEEE diff --git a/winsup/mingw/mingwex/math/tanhl.c b/winsup/mingw/mingwex/math/tanhl.c new file mode 100644 index 00000000000..d5d86d0ae39 --- /dev/null +++ b/winsup/mingw/mingwex/math/tanhl.c @@ -0,0 +1,151 @@ +/* tanhl.c + * + * Hyperbolic tangent, long double precision + * + * + * + * SYNOPSIS: + * + * long double x, y, tanhl(); + * + * y = tanhl( x ); + * + * + * + * DESCRIPTION: + * + * Returns hyperbolic tangent of argument in the range MINLOGL to + * MAXLOGL. + * + * A rational function is used for |x| < 0.625. The form + * x + x**3 P(x)/Q(x) of Cody _& Waite is employed. + * Otherwise, + * tanh(x) = sinh(x)/cosh(x) = 1 - 2/(exp(2x) + 1). + * + * + * + * ACCURACY: + * + * Relative error: + * arithmetic domain # trials peak rms + * IEEE -2,2 30000 1.3e-19 2.4e-20 + * + */ + +/* +Cephes Math Library Release 2.7: May, 1998 +Copyright 1984, 1987, 1989, 1998 by Stephen L. Moshier +*/ + +/* +Modified for mingw +2002-07-22 Danny Smith <dannysmith@users.sourceforge.net> +*/ + +#ifdef __MINGW32__ +#include "cephes_mconf.h" +#else +#include "mconf.h" +#endif + +#ifndef _SET_ERRNO +#define _SET_ERRNO(x) +#endif + +#ifdef UNK +static long double P[] = { +-6.8473739392677100872869E-5L, +-9.5658283111794641589011E-1L, +-8.4053568599672284488465E1L, +-1.3080425704712825945553E3L, +}; +static long double Q[] = { +/* 1.0000000000000000000000E0L,*/ + 9.6259501838840336946872E1L, + 1.8218117903645559060232E3L, + 3.9241277114138477845780E3L, +}; +#endif + +#ifdef IBMPC +static unsigned short P[] = { +0xd2a4,0x1b0c,0x8f15,0x8f99,0xbff1, XPD +0x5959,0x9111,0x9cc7,0xf4e2,0xbffe, XPD +0xb576,0xef5e,0x6d57,0xa81b,0xc005, XPD +0xe3be,0xbfbd,0x5cbc,0xa381,0xc009, XPD +}; +static unsigned short Q[] = { +/*0x0000,0x0000,0x0000,0x8000,0x3fff,*/ +0x687f,0xce24,0xdd6c,0xc084,0x4005, XPD +0x3793,0xc95f,0xfa2f,0xe3b9,0x4009, XPD +0xd5a2,0x1f9c,0x0b1b,0xf542,0x400a, XPD +}; +#endif + +#ifdef MIEEE +static long P[] = { +0xbff10000,0x8f998f15,0x1b0cd2a4, +0xbffe0000,0xf4e29cc7,0x91115959, +0xc0050000,0xa81b6d57,0xef5eb576, +0xc0090000,0xa3815cbc,0xbfbde3be, +}; +static long Q[] = { +/*0x3fff0000,0x80000000,0x00000000,*/ +0x40050000,0xc084dd6c,0xce24687f, +0x40090000,0xe3b9fa2f,0xc95f3793, +0x400a0000,0xf5420b1b,0x1f9cd5a2, +}; +#endif + +#ifndef __MINGW32__ +extern long double MAXLOGL; +#ifdef ANSIPROT +extern long double fabsl ( long double ); +extern long double expl ( long double ); +extern long double polevll ( long double, void *, int ); +extern long double p1evll ( long double, void *, int ); +#else +long double fabsl(), expl(), polevll(), p1evll(); +#endif +#endif /* __MINGW32__ */ + +long double tanhl(x) +long double x; +{ +long double s, z; + +#ifdef MINUSZERO +if( x == 0.0L ) + return(x); +#endif +if (isnanl(x)) + { + _SET_ERRNO (EDOM); + return x; + } + +z = fabsl(x); +if( z > 0.5L * MAXLOGL ) + { + _SET_ERRNO (ERANGE); + if( x > 0 ) + return( 1.0L ); + else + return( -1.0L ); + } +if( z >= 0.625L ) + { + s = expl(2.0*z); + z = 1.0L - 2.0/(s + 1.0L); + if( x < 0 ) + z = -z; + } +else + { + s = x * x; + z = polevll( s, P, 3 )/p1evll(s, Q, 3); + z = x * s * z; + z = x + z; + } +return( z ); +} diff --git a/winsup/mingw/mingwex/math/tgammal.c b/winsup/mingw/mingwex/math/tgammal.c index 682a12e8e4b..f3fcdd6d565 100644 --- a/winsup/mingw/mingwex/math/tgammal.c +++ b/winsup/mingw/mingwex/math/tgammal.c @@ -88,7 +88,7 @@ static const long double Q[9] = { }; #endif #if IBMPC -static const short P[] = { +static const unsigned short P[] = { 0x434a,0x3f22,0x2bda,0xb0b2,0x3ff0, XPD 0xf5aa,0xe82f,0x335b,0xee2e,0x3ff3, XPD 0xbe6c,0x3757,0xc717,0x861b,0x3ff7, XPD @@ -98,7 +98,7 @@ static const short P[] = { 0x29cf,0x19b3,0x16c8,0xd67a,0x3ffe, XPD 0x0000,0x0000,0x0000,0x8000,0x3fff, XPD }; -static const short Q[] = { +static const unsigned short Q[] = { 0x5473,0x2de8,0x1268,0xea67,0xbfee, XPD 0x334b,0xc2f0,0xa2dd,0xf60e,0x3ff2, XPD 0xbeed,0x1853,0xa691,0xa23d,0xbff5, XPD @@ -182,7 +182,7 @@ static const long double STIR[9] = { }; #endif #if IBMPC -static const short STIR[] = { +static const unsigned short STIR[] = { 0x6ede,0x69f7,0x54e3,0xbb5d,0x3ff4, XPD 0xc395,0x0295,0x4443,0xc64b,0xbfef, XPD 0xba6f,0x7c59,0x5e47,0x9bfb,0xbff4, XPD diff --git a/winsup/mingw/mingwex/stdio/snprintf.c b/winsup/mingw/mingwex/stdio/snprintf.c new file mode 100644 index 00000000000..c8d2a7b2008 --- /dev/null +++ b/winsup/mingw/mingwex/stdio/snprintf.c @@ -0,0 +1,13 @@ +#include <stdarg.h> +#include <stdio.h> + +int snprintf(char* buffer, size_t n, const char* format, ...) +{ + int retval; + va_list argptr; + + va_start( argptr, format ); + retval = _vsnprintf( buffer, n, format, argptr ); + va_end( argptr ); + return retval; +} diff --git a/winsup/mingw/mingwex/stdio/snwprintf.c b/winsup/mingw/mingwex/stdio/snwprintf.c new file mode 100644 index 00000000000..42b05b2928a --- /dev/null +++ b/winsup/mingw/mingwex/stdio/snwprintf.c @@ -0,0 +1,13 @@ +#include <stdarg.h> +#include <wchar.h> + +int snwprintf(wchar_t* buffer, size_t n, const wchar_t* format, ...) +{ + int retval; + va_list argptr; + + va_start( argptr, format ); + retval = _vsnwprintf( buffer, n, format, argptr ); + va_end( argptr ); + return retval; +} diff --git a/winsup/mingw/mingwex/stdio/vfscanf.c b/winsup/mingw/mingwex/stdio/vfscanf.c new file mode 100644 index 00000000000..41549f9e42f --- /dev/null +++ b/winsup/mingw/mingwex/stdio/vfscanf.c @@ -0,0 +1,40 @@ +// By aaronwl 2003-01-28 for mingw-msvcrt +// Public domain: all copyrights disclaimed, absolutely no warranties */ + +#include <stdarg.h> +#include <stdio.h> + +int vfscanf(FILE * __restrict__ stream, const char * __restrict__ format, va_list arg) { + int ret; + + __asm__( + + /* allocate stack (esp += frame - arg3 - (8[arg1,2] + 12)) */ + "movl %%esp, %%ebx\n\t" + "lea 0xFFFFFFEC(%%esp, %6), %%esp\n\t" + "subl %5, %%esp\n\t" + + // set up stack + "movl %1, 0xC(%%esp)\n\t" // stream + "movl %2, 0x10(%%esp)\n\t" // format + "lea 0x14(%%esp), %%edi\n\t" + "movl %%edi, (%%esp)\n\t" // memcpy dest + "movl %5, 0x4(%%esp)\n\t" // memcpy src + "movl %5, 0x8(%%esp)\n\t" + "subl %6, 0x8(%%esp)\n\t" // memcpy len + "call _memcpy\n\t" + "addl $12, %%esp\n\t" + + // call fscanf + "call _fscanf\n\t" + + // restore stack + "movl %%ebx, %%esp\n\t" + + : "=a"(ret), "=c"(stream), "=d"(format) + : "1"(stream), "2"(format), "S"(arg), + "a"(&ret) + : "ebx"); + + return ret; +} diff --git a/winsup/mingw/mingwex/stdio/vfwscanf.c b/winsup/mingw/mingwex/stdio/vfwscanf.c new file mode 100644 index 00000000000..8fa33376e48 --- /dev/null +++ b/winsup/mingw/mingwex/stdio/vfwscanf.c @@ -0,0 +1,42 @@ +// By aaronwl 2003-01-28 for mingw-msvcrt. +// Public domain: all copyrights disclaimed, absolutely no warranties. + +#include <stdarg.h> +#include <wchar.h> + +int vfwscanf(FILE * __restrict__ stream, const wchar_t * __restrict__ format, + va_list arg) { + + int ret; + + __asm__( + + // allocate stack (esp += frame - arg3 - (8[arg1,2] + 12)) + "movl %%esp, %%ebx\n\t" + "lea 0xFFFFFFEC(%%esp, %6), %%esp\n\t" + "subl %5, %%esp\n\t" + + // set up stack + "movl %1, 0xC(%%esp)\n\t" // stream + "movl %2, 0x10(%%esp)\n\t" // format + "lea 0x14(%%esp), %%edi\n\t" + "movl %%edi, (%%esp)\n\t" // memcpy dest + "movl %5, 0x4(%%esp)\n\t" // memcpy src + "movl %5, 0x8(%%esp)\n\t" + "subl %6, 0x8(%%esp)\n\t" // memcpy len + "call _memcpy\n\t" + "addl $12, %%esp\n\t" + + // call fscanf + "call _fwscanf\n\t" + + // restore stack + "movl %%ebx, %%esp\n\t" + + : "=a"(ret), "=c"(stream), "=d"(format) + : "1"(stream), "2"(format), "S"(arg), + "a"(&ret) + : "ebx"); + + return ret; +} diff --git a/winsup/mingw/mingwex/stdio/vscanf.c b/winsup/mingw/mingwex/stdio/vscanf.c new file mode 100644 index 00000000000..53f54344218 --- /dev/null +++ b/winsup/mingw/mingwex/stdio/vscanf.c @@ -0,0 +1,9 @@ +// By aaronwl 2003-01-28 for mingw-msvcrt +// Public domain: all copyrights disclaimed, absolutely no warranties + +#include <stdarg.h> +#include <stdio.h> + +int vscanf(const char * __restrict__ format, va_list arg) { + return vfscanf(stdin, format, arg); +} diff --git a/winsup/mingw/mingwex/stdio/vsnprintf.c b/winsup/mingw/mingwex/stdio/vsnprintf.c new file mode 100644 index 00000000000..f3dce5b6743 --- /dev/null +++ b/winsup/mingw/mingwex/stdio/vsnprintf.c @@ -0,0 +1,5 @@ +#include <stdarg.h> +#include <stdio.h> + +int vsnprintf (char* s, size_t n, const char* format, va_list arg) + { return _vsnprintf ( s, n, format, arg); } diff --git a/winsup/mingw/mingwex/stdio/vsnwprintf.c b/winsup/mingw/mingwex/stdio/vsnwprintf.c new file mode 100644 index 00000000000..1b59a078b16 --- /dev/null +++ b/winsup/mingw/mingwex/stdio/vsnwprintf.c @@ -0,0 +1,5 @@ +#include <stdarg.h> +#include <wchar.h> + +int vsnwprintf(wchar_t *buffer, size_t n, const wchar_t * format, va_list argptr) + { return _vsnwprintf( buffer, n, format, argptr );} diff --git a/winsup/mingw/mingwex/stdio/vsscanf.c b/winsup/mingw/mingwex/stdio/vsscanf.c new file mode 100644 index 00000000000..33fd333ae3e --- /dev/null +++ b/winsup/mingw/mingwex/stdio/vsscanf.c @@ -0,0 +1,41 @@ +// By aaronwl 2003-01-28 for mingw-msvcrt. +// Public domain: all copyrights disclaimed, absolutely no warranties. + +#include <stdarg.h> +#include <stdio.h> + + +int vsscanf(const char * __restrict__ s, const char * __restrict__ format, va_list arg) { + int ret; + + __asm__( + + // allocate stack (esp += frame - arg3 - (8[arg1,2] + 12)) + "movl %%esp, %%ebx\n\t" + "lea 0xFFFFFFEC(%%esp, %6), %%esp\n\t" + "subl %5, %%esp\n\t" + + // set up stack + "movl %1, 0xC(%%esp)\n\t" // s + "movl %2, 0x10(%%esp)\n\t" // format + "lea 0x14(%%esp), %%edi\n\t" + "movl %%edi, (%%esp)\n\t" // memcpy dest + "movl %5, 0x4(%%esp)\n\t" // memcpy src + "movl %5, 0x8(%%esp)\n\t" + "subl %6, 0x8(%%esp)\n\t" // memcpy len + "call _memcpy\n\t" + "addl $12, %%esp\n\t" + + // call sscanf + "call _sscanf\n\t" + + // restore stack + "movl %%ebx, %%esp\n\t" + + : "=a"(ret), "=c"(s), "=d"(format) + : "1"(s), "2"(format), "S"(arg), + "a"(&ret) + : "ebx"); + + return ret; +} diff --git a/winsup/mingw/mingwex/stdio/vswscanf.c b/winsup/mingw/mingwex/stdio/vswscanf.c new file mode 100644 index 00000000000..20a0f85f545 --- /dev/null +++ b/winsup/mingw/mingwex/stdio/vswscanf.c @@ -0,0 +1,43 @@ +// By aaronwl 2003-01-28 for mingw-msvcrt +// Public domain: all copyrights disclaimed, absolutely no warranties */ + +#include <stdarg.h> +#include <wchar.h> + + +int vswscanf(const wchar_t * __restrict__ s, const wchar_t * __restrict__ format, + va_list arg) { + + int ret; + + __asm__( + + // allocate stack (esp += frame - arg3 - (8[arg1,2] + 12)) + "movl %%esp, %%ebx\n\t" + "lea 0xFFFFFFEC(%%esp, %6), %%esp\n\t" + "subl %5, %%esp\n\t" + + // set up stack + "movl %1, 0xC(%%esp)\n\t" // s + "movl %2, 0x10(%%esp)\n\t" // format + "lea 0x14(%%esp), %%edi\n\t" + "movl %%edi, (%%esp)\n\t" // memcpy dest + "movl %5, 0x4(%%esp)\n\t" // memcpy src + "movl %5, 0x8(%%esp)\n\t" + "subl %6, 0x8(%%esp)\n\t" // memcpy len + "call _memcpy\n\t" + "addl $12, %%esp\n\t" + + // call sscanf + "call _swscanf\n\t" + + // restore stack + "movl %%ebx, %%esp\n\t" + + : "=a"(ret), "=c"(s), "=d"(format) + : "1"(s), "2"(format), "S"(arg), + "a"(&ret) + : "ebx"); + + return ret; +} diff --git a/winsup/mingw/mingwex/stdio/vwscanf.c b/winsup/mingw/mingwex/stdio/vwscanf.c new file mode 100644 index 00000000000..72349c3003b --- /dev/null +++ b/winsup/mingw/mingwex/stdio/vwscanf.c @@ -0,0 +1,10 @@ +// By aaronwl 2003-01-28 for mingw-msvcrt. +// Public domain: all copyrights disclaimed, absolutely no warranties. + +#include <stdarg.h> +#include <stdio.h> +#include <wchar.h> + +int vwscanf(const wchar_t * __restrict__ format, va_list arg) { + return vfwscanf(stdin, format, arg); +} diff --git a/winsup/mingw/mingwex/strtoimax.c b/winsup/mingw/mingwex/strtoimax.c new file mode 100644 index 00000000000..9072d4bbb13 --- /dev/null +++ b/winsup/mingw/mingwex/strtoimax.c @@ -0,0 +1,112 @@ +/* + This source code was extracted from the Q8 package created and + placed in the PUBLIC DOMAIN by Doug Gwyn <gwyn@arl.mil> + last edit: 1999/11/05 gwyn@arl.mil + + Implements subclause 7.8.2 of ISO/IEC 9899:1999 (E). + + This particular implementation requires the matching <inttypes.h>. + It also assumes that character codes for A..Z and a..z are in + contiguous ascending order; this is true for ASCII but not EBCDIC. +*/ +#include <stdlib.h> +#include <errno.h> +#include <ctype.h> +#include <inttypes.h> + +/* Helper macros */ + +/* convert digit character to number, in any base */ +#define ToNumber(c) (isdigit(c) ? (c) - '0' : \ + isupper(c) ? (c) - 'A' + 10 : \ + islower(c) ? (c) - 'a' + 10 : \ + -1 /* "invalid" flag */ \ + ) +/* validate converted digit character for specific base */ +#define valid(n, b) ((n) >= 0 && (n) < (b)) + +intmax_t +strtoimax(nptr, endptr, base) + register const char * __restrict__ nptr; + char ** __restrict__ endptr; + register int base; + { + register uintmax_t accum; /* accumulates converted value */ + register int n; /* numeral from digit character */ + int minus; /* set iff minus sign seen */ + int toobig; /* set iff value overflows */ + + if ( endptr != NULL ) + *endptr = (char *)nptr; /* in case no conversion's performed */ + + if ( base < 0 || base == 1 || base > 36 ) + { + errno = EDOM; + return 0; /* unspecified behavior */ + } + + /* skip initial, possibly empty sequence of white-space characters */ + + while ( isspace(*nptr) ) + ++nptr; + + /* process subject sequence: */ + + /* optional sign */ + if ( (minus = *nptr == '-') || *nptr == '+' ) + ++nptr; + + if ( base == 0 ) { + if ( *nptr == '0' ) { + if ( nptr[1] == 'X' || nptr[1] == 'x' ) + base = 16; + else + base = 8; + } + else + base = 10; + } + /* optional "0x" or "0X" for base 16 */ + + if ( base == 16 && *nptr == '0' && (nptr[1] == 'X' || nptr[1] == 'x') ) + nptr += 2; /* skip past this prefix */ + + /* check whether there is at least one valid digit */ + + n = ToNumber(*nptr); + ++nptr; + + if ( !valid(n, base) ) + return 0; /* subject seq. not of expected form */ + + accum = n; + + for ( toobig = 0; n = ToNumber(*nptr), valid(n, base); ++nptr ) + if ( accum > (uintmax_t)(INTMAX_MAX / base + 2) ) /* major wrap-around */ + toobig = 1; /* but keep scanning */ + else + accum = base * accum + n; + + if ( endptr != NULL ) + *endptr = (char *)nptr; /* points to first not-valid-digit */ + + if ( minus ) + { + if ( accum > (uintmax_t)INTMAX_MAX + 1 ) + toobig = 1; + } + else + if ( accum > (uintmax_t)INTMAX_MAX ) + toobig = 1; + + if ( toobig ) + { + errno = ERANGE; + return minus ? INTMAX_MIN : INTMAX_MAX; + } + else + return (intmax_t)(minus ? -accum : accum); + } + +long long __attribute__ ((alias ("strtoimax"))) +strtoll (const char* __restrict__ nptr, char ** __restrict__ endptr, int base); diff --git a/winsup/mingw/mingwex/wcstoimax.c b/winsup/mingw/mingwex/wcstoimax.c new file mode 100644 index 00000000000..99bacf4631d --- /dev/null +++ b/winsup/mingw/mingwex/wcstoimax.c @@ -0,0 +1,119 @@ +/* + This source code was extracted from the Q8 package created and + placed in the PUBLIC DOMAIN by Doug Gwyn <gwyn@arl.mil> + + last edit: 1999/11/05 gwyn@arl.mil + + Implements subclause 7.8.2 of ISO/IEC 9899:1999 (E). + + This particular implementation requires the matching <inttypes.h>. + It also assumes that character codes for A..Z and a..z are in + contiguous ascending order; this is true for ASCII but not EBCDIC. +*/ + +#include <wchar.h> +#include <errno.h> +#include <ctype.h> +#include <inttypes.h> + +/* convert digit wide character to number, in any base */ + +#define ToWNumber(c) (iswdigit(c) ? (c) - L'0' : \ + iswupper(c) ? (c) - L'A' + 10 : \ + iswlower(c) ? (c) - L'a' + 10 : \ + -1 /* "invalid" flag */ \ + ) + +/* validate converted digit character for specific base */ +#define valid(n, b) ((n) >= 0 && (n) < (b)) + +intmax_t +wcstoimax(nptr, endptr, base) + register const wchar_t * __restrict__ nptr; + wchar_t ** __restrict__ endptr; + register int base; + { + register uintmax_t accum; /* accumulates converted value */ + register int n; /* numeral from digit character */ + int minus; /* set iff minus sign seen */ + int toobig; /* set iff value overflows */ + + if ( endptr != NULL ) + *endptr = (wchar_t *)nptr; /* in case no conv performed */ + + if ( base < 0 || base == 1 || base > 36 ) + { + errno = EDOM; + return 0; /* unspecified behavior */ + } + + /* skip initial, possibly empty sequence of white-space w.characters */ + + while ( iswspace(*nptr) ) + ++nptr; + + /* process subject sequence: */ + + /* optional sign */ + + if ( (minus = *nptr == L'-') || *nptr == L'+' ) + ++nptr; + + if ( base == 0 ) + { + if ( *nptr == L'0' ) + { + if ( nptr[1] == L'X' || nptr[1] == L'x' ) + base = 16; + else + base = 8; + } + else + base = 10; + } + /* optional "0x" or "0X" for base 16 */ + + if ( base == 16 && *nptr == L'0' + && (nptr[1] == L'X' || nptr[1] == L'x') + ) + nptr += 2; /* skip past this prefix */ + + /* check whether there is at least one valid digit */ + + n = ToWNumber(*nptr); + ++nptr; + + if ( !valid(n, base) ) + return 0; /* subject seq. not of expected form */ + + accum = n; + + for ( toobig = 0; n = ToWNumber(*nptr), valid(n, base); ++nptr ) + if ( accum > (uintmax_t)(INTMAX_MAX / base + 2) ) /* major wrap-around */ + toobig = 1; /* but keep scanning */ + else + accum = base * accum + n; + + if ( endptr != NULL ) + *endptr = (wchar_t *)nptr; /* -> first not-valid-digit */ + + if ( minus ) + { + if ( accum > (uintmax_t)INTMAX_MAX + 1 ) + toobig = 1; + } + else + if ( accum > (uintmax_t)INTMAX_MAX ) + toobig = 1; + + if ( toobig ) + { + errno = ERANGE; + return minus ? INTMAX_MIN : INTMAX_MAX; + } + else + return (intmax_t)(minus ? -accum : accum); + } + +long long __attribute__ ((alias ("wcstoimax"))) +wcstoll (const wchar_t* __restrict__ nptr, wchar_t ** __restrict__ endptr, int base); diff --git a/winsup/mingw/mingwex/wtoll.c b/winsup/mingw/mingwex/wtoll.c new file mode 100644 index 00000000000..0bff278d106 --- /dev/null +++ b/winsup/mingw/mingwex/wtoll.c @@ -0,0 +1,3 @@ +#include <stdlib.h> +long long wtoll(const wchar_t * _w) + { return _wtoi64 (_w); } diff --git a/winsup/mingw/msvcrt.def.in b/winsup/mingw/msvcrt.def.in new file mode 100644 index 00000000000..a89b8131a3e --- /dev/null +++ b/winsup/mingw/msvcrt.def.in @@ -0,0 +1,738 @@ +; +; __FILENAME__ +; created from msvcrt.def.in +; +; Exports from msvcrt.dll. Msvcrt.dll appears to be distributed with +; Internet Explorer 4.0, and may be more common in the future, but +; right now it seems like a risky choice. There are differences, although +; they seem to be minor overall, between the exports from msvcrt and msvcrt20. +; However, for most purposes the two sets are interchangable. +; +; NOTE: All exports, except for what appeared to be C++ mangled names, +; are included. Not all functions have prototypes in the headers +; (and some are not functions at all). +; +; Contributors: +; Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp> +; +; THIS SOFTWARE IS NOT COPYRIGHTED +; +; This source code is offered for use in the public domain. You may +; use, modify or distribute it freely. +; +; This code is distributed in the hope that it will be useful but +; WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY +; DISCLAMED. This includes but is not limited to warrenties of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +; +; $Revision$ +; $Author$ +; $Date$ +; +EXPORTS +_CIacos +_CIasin +_CIatan +_CIatan2 +_CIcos +_CIcosh +_CIexp +_CIfmod +_CIlog +_CIlog10 +_CIpow +_CIsin +_CIsinh +_CIsqrt +_CItan +_CItanh +_CxxThrowException +_EH_prolog +_Getdays +_Getmonths +_Gettnames +_HUGE DATA +_Strftime +_XcptFilter +__CxxFrameHandler +__CxxLongjmpUnwind +__RTCastToVoid +__RTDynamicCast +__RTtypeid +__STRINGTOLD +__argc DATA +__argv DATA +__badioinfo +__crtCompareStringA +__crtGetLocaleInfoW +__crtLCMapStringA +__dllonexit +__doserrno +__fpecode +__getmainargs +__initenv DATA +__isascii +__iscsym +__iscsymf +__lc_codepage +__lc_handle +__lconv_init +__mb_cur_max DATA +__p___argc +__p___argv +__p___initenv +__p___mb_cur_max +__p___wargv +__p___winitenv +__p__acmdln +__p__amblksiz +__p__commode +__p__daylight +__p__dstbias +__p__environ +__p__fileinfo +__p__fmode +__p__iob +__p__mbctype +__p__osver +__p__pctype +__p__pgmptr +__p__pwctype +__p__timezone +__p__tzname +__p__wcmdln +__p__wenviron +__p__winmajor +__p__winminor +__p__winver +__p__wpgmptr +__pioinfo +__pxcptinfoptrs +__set_app_type +__setlc_active +__setusermatherr +__threadhandle +__threadid +__toascii +__unDName +__unguarded_readlc_active +__wargv DATA +__wgetmainargs +__winitenv DATA +_abnormal_termination +_access +_acmdln DATA +_adj_fdiv_m16i +_adj_fdiv_m32 +_adj_fdiv_m32i +_adj_fdiv_m64 +_adj_fdiv_r +_adj_fdivr_m16i +_adj_fdivr_m32 +_adj_fdivr_m32i +_adj_fdivr_m64 +_adj_fpatan +_adj_fprem +_adj_fprem1 +_adj_fptan +_adjust_fdiv DATA +_aexit_rtn DATA +_amsg_exit +_assert +_atodbl +_atoi64 +_atoldbl +_beep +_beginthread +_beginthreadex +_c_exit +_cabs +_callnewh +_cexit +_cgets +_chdir +_chdrive +_chgsign +_chmod +_chsize +_clearfp +_close +_commit +_commode DATA +_control87 +_controlfp +_copysign +_cprintf +_cputs +_creat +_cscanf +_ctype DATA +_cwait +_daylight DATA +_dstbias +_dup +_dup2 +_ecvt +_endthread +_endthreadex +_environ DATA +_eof +_errno +_except_handler2 +_except_handler3 +_execl +_execle +_execlp +_execlpe +_execv +_execve +_execvp +_execvpe +_exit +_expand +_fcloseall +_fcvt +_fdopen +_fgetchar +_fgetwchar +_filbuf +_fileinfo DATA +_filelength +_filelengthi64 +_fileno +_findclose +_findfirst +_findfirsti64 +_findnext +_findnexti64 +_finite +_flsbuf +_flushall +_fmode DATA +_fpclass +_fpieee_flt +_fpreset DATA +_fputchar +_fputwchar +_fsopen +_fstat +_fstati64 +_ftime +_ftol +_fullpath +_futime +_gcvt +_get_osfhandle +_get_sbh_threshold +_getch +_getche +_getcwd +_getdcwd +_getdiskfree +_getdllprocaddr +_getdrive +_getdrives +_getmaxstdio +_getmbcp +_getpid +_getsystime +_getw +_getws +_global_unwind2 +_heapadd +_heapchk +_heapmin +_heapset +_heapused +_heapwalk +_hypot +_i64toa +_i64tow +_initterm +_inp +_inpd +_inpw +_iob DATA +_isatty +_isctype +_ismbbalnum +_ismbbalpha +_ismbbgraph +_ismbbkalnum +_ismbbkana +_ismbbkprint +_ismbbkpunct +_ismbblead +_ismbbprint +_ismbbpunct +_ismbbtrail +_ismbcalnum +_ismbcalpha +_ismbcdigit +_ismbcgraph +_ismbchira +_ismbckata +_ismbcl0 +_ismbcl1 +_ismbcl2 +_ismbclegal +_ismbclower +_ismbcprint +_ismbcpunct +_ismbcspace +_ismbcsymbol +_ismbcupper +_ismbslead +_ismbstrail +_isnan +_itoa +_itow +_j0 +_j1 +_jn +_kbhit +_lfind +_loaddll +_local_unwind2 +_lock +_locking +_logb +_longjmpex +_lrotl +_lrotr +_lsearch +_lseek +_lseeki64 +_ltoa +_ltow +_makepath +_mbbtombc +_mbbtype +_mbccpy +_mbcjistojms +_mbcjmstojis +_mbclen +_mbctohira +_mbctokata +_mbctolower +_mbctombb +_mbctoupper +_mbctype DATA +_mbsbtype +_mbscat +_mbschr +_mbscmp +_mbscoll +_mbscpy +_mbscspn +_mbsdec +_mbsdup +_mbsicmp +_mbsicoll +_mbsinc +_mbslen +_mbslwr +_mbsnbcat +_mbsnbcmp +_mbsnbcnt +_mbsnbcoll +_mbsnbcpy +_mbsnbicmp +_mbsnbicoll +_mbsnbset +_mbsncat +_mbsnccnt +_mbsncmp +_mbsncoll +_mbsncpy +_mbsnextc +_mbsnicmp +_mbsnicoll +_mbsninc +_mbsnset +_mbspbrk +_mbsrchr +_mbsrev +_mbsset +_mbsspn +_mbsspnp +_mbsstr +_mbstok +_mbstrlen +_mbsupr +_memccpy +_memicmp +_mkdir +_mktemp +_msize +_nextafter +_onexit DATA +_open +_open_osfhandle +_osver DATA +_outp +_outpd +_outpw +_pclose +_pctype DATA +_pgmptr DATA +_pipe +_popen +_purecall +_putch +_putenv +_putw +_putws +_pwctype DATA +_read +_rmdir +_rmtmp +_rotl +_rotr +_safe_fdiv +_safe_fdivr +_safe_fprem +_safe_fprem1 +_scalb +_searchenv +_seh_longjmp_unwind +_set_error_mode +_set_sbh_threshold +_seterrormode +_setjmp +_setjmp3 +_setmaxstdio +_setmbcp +_setmode +_setsystime +_sleep +_snprintf +_snwprintf +_sopen +_spawnl +_spawnle +_spawnlp +_spawnlpe +_spawnv +_spawnve +_spawnvp +_spawnvpe +_splitpath +_stat +_stati64 +_statusfp +_strcmpi +_strdate +_strdup +_strerror +_stricmp +_stricoll +_strlwr +_strncoll +_strnicmp +_strnicoll +_strnset +_strrev +_strset +_strtime +_strupr +_swab +_sys_errlist DATA +_sys_nerr DATA +_tell +_telli64 +_tempnam +_timezone DATA +_tolower +_toupper +_tzname DATA +_tzset +_ui64toa +_ui64tow +_ultoa +_ultow +_umask +_ungetch +_unlink +_unloaddll +_unlock +_utime +_vsnprintf +_vsnwprintf +_waccess +_wasctime +_wchdir +_wchmod +_wcmdln DATA +_wcreat +_wcsdup +_wcsicmp +_wcsicoll +_wcslwr +_wcsncoll +_wcsnicmp +_wcsnicoll +_wcsnset +_wcsrev +_wcsset +_wcsupr +_wctime +_wenviron DATA +_wexecl +_wexecle +_wexeclp +_wexeclpe +_wexecv +_wexecve +_wexecvp +_wexecvpe +_wfdopen +_wfindfirst +_wfindfirsti64 +_wfindnext +_wfindnexti64 +_wfopen +_wfreopen +_wfsopen +_wfullpath +_wgetcwd +_wgetdcwd +_wgetenv +_winmajor DATA +_winminor DATA +_winver DATA +_wmakepath +_wmkdir +_wmktemp +_wopen +_wperror +_wpgmptr DATA +_wpopen +_wputenv +_wremove +_wrename +_write +_wrmdir +_wsearchenv +_wsetlocale +_wsopen +_wspawnl +_wspawnle +_wspawnlp +_wspawnlpe +_wspawnv +_wspawnve +_wspawnvp +_wspawnvpe +_wsplitpath +_wstat +_wstati64 +_wstrdate +_wstrtime +_wsystem +_wtempnam +_wtmpnam +_wtoi +_wtoi64 +_wtol +_wunlink +_wutime +_y0 +_y1 +_yn +abort +abs +acos +asctime +asin +atan +atan2 +atexit DATA +atof +atoi +atol +bsearch +calloc +ceil +clearerr +clock +cos +cosh +ctime +difftime +div +exit +exp +fabs +fclose +feof +ferror +fflush +fgetc +fgetpos +fgets +fgetwc +fgetws +floor +fmod +fopen +fprintf +fputc +fputs +fputwc +fputws +fread +free +freopen +frexp +fscanf +fseek +fsetpos +ftell +fwprintf +fwrite +fwscanf +getc +getchar +getenv +gets +getwc +getwchar +gmtime +is_wctype +isalnum +isalpha +iscntrl +isdigit +isgraph +isleadbyte +islower +isprint +ispunct +isspace +isupper +iswalnum +iswalpha +iswascii +iswcntrl +iswctype +iswdigit +iswgraph +iswlower +iswprint +iswpunct +iswspace +iswupper +iswxdigit +isxdigit +labs +ldexp +ldiv +localeconv +localtime +log +log10 +longjmp +malloc +mblen +mbstowcs +mbtowc +memchr +memcmp +memcpy +memmove +memset +mktime +modf +perror +pow +printf +putc +putchar +puts +putwc +putwchar +qsort +raise +rand +realloc +remove +rename +rewind +scanf +setbuf +setlocale +setvbuf +signal +sin +sinh +sprintf +sqrt +srand +sscanf +strcat +strchr +strcmp +strcoll +strcpy +strcspn +strerror +strftime +strlen +strncat +strncmp +strncpy +strpbrk +strrchr +strspn +strstr +strtod +strtok +strtol +strtoul +strxfrm +swprintf +swscanf +system +tan +tanh +time +tmpfile +tmpnam +tolower +toupper +towlower +towupper +ungetc +ungetwc +vfprintf +vfwprintf +vprintf +vsprintf +vswprintf +vwprintf +wcscat +wcschr +wcscmp +wcscoll +wcscpy +wcscspn +wcsftime +wcslen +wcsncat +wcsncmp +wcsncpy +wcspbrk +wcsrchr +wcsspn +wcsstr +wcstod +wcstok +wcstol +wcstombs +wcstoul +wcsxfrm +wctomb +wprintf +wscanf + diff --git a/winsup/mingw/profile/Makefile.in b/winsup/mingw/profile/Makefile.in new file mode 100644 index 00000000000..aca3a2950cd --- /dev/null +++ b/winsup/mingw/profile/Makefile.in @@ -0,0 +1,142 @@ +# +# mingw/profile/Makefile.in: This file is part of Mingw runtime. +# +# This makefile requires GNU make. + +VPATH = @srcdir@ +srcdir = @srcdir@ +objdir = . + +target_alias = @target_alias@ +prefix = @prefix@ + +program_transform_name = @program_transform_name@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) +datadir = @datadir@ +infodir = @infodir@ +includedir = @includedir@ + +SHELL = /bin/sh + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +mkinstalldirs = $(SHELL) $(srcdir)/../mkinstalldirs +DISTFILES = Makefile.in configure configure.in gcrt0.c gmon.c gmon.h mcount.c \ +profil.c profil.h profile.h + +CC = @CC@ +# FIXME: Which is it, CC or CC_FOR_TARGET? +CC_FOR_TARGET = $(CC) +AS_FOR_TARGET = $(AS) +CFLAGS = @CFLAGS@ +CXXFLAGS = @CXXFLAGS@ + +# compiling with Cygwin? +MNO_CYGWIN = @MNO_CYGWIN@ + +# Either crtdll (CRT_ID 1) or msvcrt (CRT_ID 2). +RUNTIME = @RUNTIME@ +CRT_ID = @CRT_ID@ + +# Needed for threading dll. +THREAD_DLL = @THREAD_DLL@ +THREAD_DLL_VERSION = 10 +THREAD_DLL_NAME = $(THREAD_DLL)$(THREAD_DLL_VERSION).dll + +INCLUDES = -I$(srcdir) -I$(srcdir)/../include \ + -I$(srcdir)/../../w32api/include \ + -nostdinc -nostdinc++ \ + -iwithprefixbefore include +ALL_CFLAGS = $(CFLAGS) $(INCLUDES) $(MNO_CYGWIN) +ALL_CXXFLAGS = $(CXXFLAGS) $(INCLUDES) $(MNO_CYGWIN) + +AS = @AS@ +AR = @AR@ +LD = @LD@ +AR_FLAGS = rcv +RANLIB = @RANLIB@ +DLLTOOL = @DLLTOOL@ +DLLTOOLFLAGS = +DLLTOOL_FOR_TARGET = $(DLLTOOL) +DLLTOOL_FLAGS = --as $(AS_FOR_TARGET) + +LIBGMON_A = @LIBGMON_A@ +LIBGMON_OBJS = gmon.o mcount.o profil.o +CRT0S = @CRT0S@ +ALL_CRT0S = gcrt0.o gcrt1.o gcrt2.o + +LIBS = $(LIBGMON_A) +DLLS = + +all: $(LIBGMON_A) + +$(LIBGMON_A): $(LIBGMON_OBJS) $(CRT0S) + $(AR) $(ARFLAGS) $@ $(LIBGMON_OBJS) + $(RANLIB) $@ + +# FIXME: These are really the same, but gcc specs want different names. +# The only CRT dependency is atexit. +gcrt0.o: gcrt0.c + $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $? + +gcrt1.o: gcrt0.c + $(CC) -U__MSVCRT__ -c -o $@ $(CPPFLAGS) $(CFLAGS) $? + +gcrt2.o: gcrt0.c + $(CC) -D__MSVCRT__ -c -o $@ $(CPPFLAGS) $(CFLAGS) $? + +# +# Dependancies +# +gmon.o: gmon.c gmon.h profile.h profil.h +mcount.o: mcount.c gmon.h profile.h +profil.o: profil.c profil.h + +Makefile: Makefile.in config.status configure + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck + +info: + +info-html: + +install-info: info + +install: all + $(mkinstalldirs) $(inst_libdir) + for i in $(LIBS); do \ + $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \ + done + for i in $(CRT0S); do \ + $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \ + done + for sub in . ; do \ + $(mkinstalldirs) $(inst_includedir)/$$sub ; \ + for i in $(srcdir)/$$sub/*.h ; do \ + $(INSTALL_DATA) $$i $(inst_includedir)/$$sub/`basename $$i` ; \ + done ; \ + done + +clean: + -rm -f $(LIBGMON_OBJS) $(ALL_CRT0S) $(LIBGMON_A) + +distclean: + -rm -f *.o *.a *~ core a.out + -rm -f config.cache config.status config.log + -rm -f Makefile +.c.o: + $(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) $< -o $@ + +dist: + mkdir $(distdir)/profile + chmod 755 $(distdir)/profile + @for i in $(DISTFILES); do\ + cp -p $(srcdir)/$$i $(distdir)/profile/$$i ; \ + done + diff --git a/winsup/mingw/profile/profile.h b/winsup/mingw/profile/profile.h new file mode 100644 index 00000000000..6c198d742f0 --- /dev/null +++ b/winsup/mingw/profile/profile.h @@ -0,0 +1,65 @@ +/* $NetBSD: profile.h,v 1.6 1995/03/28 18:17:08 jtc Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)profile.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * This file is taken from Cygwin distribution. Please keep it in sync. + * The differences should be within __MINGW32__ guard. + */ + +#define _MCOUNT_DECL static inline void _mcount + +#define MCOUNT \ +void \ +mcount() \ +{ \ + u_long selfpc, frompcindex; \ + /* \ + * find the return address for mcount, \ + * and the return address for mcount's caller. \ + * \ + * selfpc = pc pushed by mcount call \ + */ \ + /* __asm volatile ("movl 4(%%ebp),%0" : "=r" (selfpc)); */ \ + selfpc = (u_long) __builtin_return_address (0); \ + /* \ + * frompcindex = pc pushed by call into self. \ + */ \ + /* __asm ("movl (%%ebp),%0;movl 4(%0),%0" : "=r" (frompcindex)); */ \ + frompcindex = (u_long) __builtin_return_address (1); \ + _mcount(frompcindex, selfpc); \ +} + diff --git a/winsup/mingw/samples/dlltest/dll.def b/winsup/mingw/samples/dlltest/dll.def new file mode 100644 index 00000000000..8dd07fa65f9 --- /dev/null +++ b/winsup/mingw/samples/dlltest/dll.def @@ -0,0 +1,4 @@ +LIBRARY dll +EXPORTS +Add +Sub@16 diff --git a/winsup/mingw/samples/dlltest/expexe.def b/winsup/mingw/samples/dlltest/expexe.def new file mode 100644 index 00000000000..d069ce5d09d --- /dev/null +++ b/winsup/mingw/samples/dlltest/expexe.def @@ -0,0 +1,3 @@ +NAME exe.exe +EXPORTS +ExportedFromExe diff --git a/winsup/mingw/test_headers.c b/winsup/mingw/test_headers.c new file mode 100644 index 00000000000..d1186573678 --- /dev/null +++ b/winsup/mingw/test_headers.c @@ -0,0 +1,53 @@ +#include <_mingw.h> +#include <assert.h> +#include <conio.h> +#include <ctype.h> +#include <dir.h> +#include <direct.h> +#include <dirent.h> +#include <dos.h> +#include <errno.h> +#include <excpt.h> +#include <fcntl.h> +#include <fenv.h> +#include <float.h> +#include <inttypes.h> +#include <io.h> +#include <limits.h> +#include <locale.h> +#include <malloc.h> +#include <math.h> +#include <mbctype.h> +#include <mbstring.h> +#include <mem.h> +#include <memory.h> +#include <process.h> +#include <setjmp.h> +#include <share.h> +#include <signal.h> +#include <stdarg.h> +#include <stddef.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <strings.h> +#include <tchar.h> +#include <time.h> +#include <unistd.h> +#include <values.h> +#include <wctype.h> +#include <sys/fcntl.h> +#include <sys/file.h> +#include <sys/locking.h> +#include <sys/param.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <sys/timeb.h> +#include <sys/types.h> +#include <sys/unistd.h> +#include <sys/utime.h> +#include <wchar.h> + +int main() +{return 0;} |