From e8cbdde2a741b4e22411261e702ea6bcce5f5890 Mon Sep 17 00:00:00 2001 From: Boudewijn Dekker Date: Fri, 2 Apr 1999 21:44:11 +0000 Subject: [PATCH] moved some header files from top level to crtdll directory svn path=/trunk/; revision=365 --- reactos/include/crtdll/alloc.h | 74 ++ reactos/include/crtdll/assert.h | 18 +- reactos/include/crtdll/conio.h | 148 +-- reactos/include/crtdll/ctype.h | 25 +- reactos/include/crtdll/dir.h | 10 +- reactos/include/crtdll/dirent.h | 8 +- reactos/include/crtdll/dos.h | 2 +- reactos/include/crtdll/errno.h | 27 +- reactos/include/crtdll/excpt.h | 121 +++ reactos/include/crtdll/fcntl.h | 261 ++--- reactos/include/crtdll/float.h | 14 +- reactos/include/crtdll/internal/atexit.h | 33 + reactos/include/crtdll/internal/file.h | 62 ++ reactos/include/crtdll/io.h | 14 +- reactos/include/crtdll/malloc.h | 53 + reactos/include/crtdll/math.h | 10 +- reactos/include/crtdll/process.h | 51 +- reactos/include/crtdll/search.h | 35 + reactos/include/crtdll/stddef.h | 7 +- reactos/include/crtdll/stdio.h | 400 ++++++-- reactos/include/crtdll/stdlib.h | 27 +- reactos/include/crtdll/string.h | 922 ++++++++++++++++++ reactos/include/crtdll/sys/djtypes.h | 26 - reactos/include/crtdll/sys/fcntl.h | 8 + reactos/include/crtdll/sys/file.h | 9 + reactos/include/crtdll/sys/locking.h | 38 + reactos/include/crtdll/sys/stat.h | 204 ++-- reactos/include/crtdll/sys/time.h | 3 + reactos/include/crtdll/sys/timeb.h | 60 ++ reactos/include/crtdll/sys/types.h | 116 ++- reactos/include/crtdll/sys/unistd.h | 9 + reactos/include/crtdll/sys/utime.h | 75 ++ reactos/include/crtdll/tchar.h | 231 +++++ reactos/include/crtdll/time.h | 10 +- reactos/include/crtdll/wchar.h | 32 + reactos/lib/crtdll/assert/assert.c | 12 +- reactos/lib/crtdll/conio/cgets.c | 2 +- reactos/lib/crtdll/conio/cprintf.c | 4 +- reactos/lib/crtdll/conio/cputs.c | 6 +- reactos/lib/crtdll/conio/cscanf.c | 2 +- reactos/lib/crtdll/conio/getch.c | 6 +- reactos/lib/crtdll/conio/getche.c | 4 +- reactos/lib/crtdll/conio/putch.c | 2 +- reactos/lib/crtdll/conio/ungetch.c | 2 +- reactos/lib/crtdll/crtdll.def | 16 +- reactos/lib/crtdll/ctype/isalnum.c | 4 +- reactos/lib/crtdll/ctype/isalpha.c | 4 +- reactos/lib/crtdll/ctype/isascii.c | 4 +- reactos/lib/crtdll/ctype/iscntrl.c | 4 +- reactos/lib/crtdll/ctype/iscsym.c | 4 +- reactos/lib/crtdll/ctype/isctype.c | 143 ++- reactos/lib/crtdll/ctype/isdigit.c | 4 +- reactos/lib/crtdll/ctype/isgraph.c | 4 +- reactos/lib/crtdll/ctype/islower.c | 10 +- reactos/lib/crtdll/ctype/isprint.c | 8 +- reactos/lib/crtdll/ctype/ispunct.c | 4 +- reactos/lib/crtdll/ctype/isspace.c | 8 +- reactos/lib/crtdll/ctype/isupper.c | 4 +- reactos/lib/crtdll/ctype/isxdigit.c | 4 +- reactos/lib/crtdll/ctype/toascii.c | 2 +- reactos/lib/crtdll/ctype/tolower.c | 2 +- reactos/lib/crtdll/ctype/toupper.c | 4 +- reactos/lib/crtdll/direct/chdir.c | 4 +- reactos/lib/crtdll/direct/chdrive.c | 6 +- reactos/lib/crtdll/direct/getcwd.c | 4 +- reactos/lib/crtdll/direct/getdfree.c | 4 +- reactos/lib/crtdll/direct/getdrive.c | 4 +- reactos/lib/crtdll/direct/mkdir.c | 2 +- reactos/lib/crtdll/direct/rmdir.c | 2 +- reactos/lib/crtdll/dirent/dirent.c | 22 +- reactos/lib/crtdll/except/abnorter.c | 6 + reactos/lib/crtdll/float/chgsign.c | 8 + reactos/lib/crtdll/float/clearfp.c | 2 +- reactos/lib/crtdll/float/cntrlfp.c | 2 +- reactos/lib/crtdll/float/fpreset.c | 4 +- reactos/lib/crtdll/float/isnan.c | 12 + reactos/lib/crtdll/float/statfp.c | 4 +- reactos/lib/crtdll/io/access.c | 4 +- reactos/lib/crtdll/io/chmod.c | 2 +- reactos/lib/crtdll/io/chsize.c | 2 +- reactos/lib/crtdll/io/close.c | 4 +- reactos/lib/crtdll/io/commit.c | 8 +- reactos/lib/crtdll/io/create.c | 4 +- reactos/lib/crtdll/io/dup.c | 2 +- reactos/lib/crtdll/io/dup2.c | 10 +- reactos/lib/crtdll/io/eof.c | 2 +- reactos/lib/crtdll/io/filelen.c | 2 +- reactos/lib/crtdll/io/find.c | 221 +---- reactos/lib/crtdll/io/fmode.c | 4 +- reactos/lib/crtdll/io/isatty.c | 14 +- reactos/lib/crtdll/io/locking.c | 4 +- reactos/lib/crtdll/io/lseek.c | 12 +- reactos/lib/crtdll/io/mktemp.c | 6 +- reactos/lib/crtdll/io/open.c | 49 +- reactos/lib/crtdll/io/pipe.c | 4 +- reactos/lib/crtdll/io/read.c | 2 +- reactos/lib/crtdll/io/setmode.c | 6 +- reactos/lib/crtdll/io/sopen.c | 2 +- reactos/lib/crtdll/io/tell.c | 4 +- reactos/lib/crtdll/io/umask.c | 12 +- reactos/lib/crtdll/io/unlink.c | 2 +- reactos/lib/crtdll/io/write.c | 2 +- reactos/lib/crtdll/locale/locale.c | 172 ++++ reactos/lib/crtdll/makefile | 37 +- reactos/lib/crtdll/malloc/expand.c | 28 + reactos/lib/crtdll/malloc/heap.c | 31 + reactos/lib/crtdll/math/acos.c | 2 +- reactos/lib/crtdll/math/acosh.c | 2 +- reactos/lib/crtdll/math/asin.c | 2 +- reactos/lib/crtdll/math/asinh.c | 2 +- reactos/lib/crtdll/math/atanh.c | 2 +- reactos/lib/crtdll/math/cabs.c | 2 +- reactos/lib/crtdll/math/cosh.c | 2 +- reactos/lib/crtdll/math/frexp.c | 2 +- reactos/lib/crtdll/math/huge_val.c | 13 +- reactos/lib/crtdll/math/hypot.c | 28 +- reactos/lib/crtdll/math/j0_y0.c | 11 + reactos/lib/crtdll/math/j1_y1.c | 11 + reactos/lib/crtdll/math/jn_yn.c | 11 + reactos/lib/crtdll/math/modf.c | 2 +- reactos/lib/crtdll/math/sinh.c | 2 +- reactos/lib/crtdll/math/stubs.c | 84 ++ reactos/lib/crtdll/math/tanh.c | 2 +- reactos/lib/crtdll/misc/GetArgs.c | 32 +- reactos/lib/crtdll/misc/crt1.c | 29 +- reactos/lib/crtdll/misc/dllcrt1.c | 12 +- reactos/lib/crtdll/misc/gccmain.c | 8 +- reactos/lib/crtdll/misc/init.c | 6 +- reactos/lib/crtdll/misc/main.c | 10 +- reactos/lib/crtdll/misc/purecall.c | 5 + reactos/lib/crtdll/misc/setnew.cc | 28 + reactos/lib/crtdll/process/_cwait.c | 25 +- reactos/lib/crtdll/process/_system.c | 4 +- reactos/lib/crtdll/process/dll.c | 15 +- reactos/lib/crtdll/process/execl.c | 11 +- reactos/lib/crtdll/process/execle.c | 2 +- reactos/lib/crtdll/process/execlp.c | 4 +- reactos/lib/crtdll/process/execlpe.c | 2 +- reactos/lib/crtdll/process/execv.c | 8 +- reactos/lib/crtdll/process/execve.c | 6 +- reactos/lib/crtdll/process/execvp.c | 12 +- reactos/lib/crtdll/process/execvpe.c | 6 +- reactos/lib/crtdll/process/spawnl.c | 12 +- reactos/lib/crtdll/process/spawnle.c | 2 +- reactos/lib/crtdll/process/spawnlp.c | 11 +- reactos/lib/crtdll/process/spawnlpe.c | 2 +- reactos/lib/crtdll/process/spawnv.c | 9 +- reactos/lib/crtdll/process/spawnve.c | 27 +- reactos/lib/crtdll/process/spawnvp.c | 8 +- reactos/lib/crtdll/process/spawnvpe.c | 9 +- reactos/lib/crtdll/process/threadid.c | 12 + reactos/lib/crtdll/search/lfind.c | 17 + reactos/lib/crtdll/search/lsearch.c | 15 + reactos/lib/crtdll/signal/signal.c | 6 +- reactos/lib/crtdll/stdio/allocfil.c | 13 +- reactos/lib/crtdll/stdio/clearerr.c | 4 +- reactos/lib/crtdll/stdio/doprnt.c | 35 +- reactos/lib/crtdll/stdio/doscan.c | 27 +- reactos/lib/crtdll/stdio/fclose.c | 16 +- reactos/lib/crtdll/stdio/fdopen.c | 2 +- reactos/lib/crtdll/stdio/feof.c | 8 +- reactos/lib/crtdll/stdio/ferror.c | 9 +- reactos/lib/crtdll/stdio/fflush.c | 27 +- reactos/lib/crtdll/stdio/fgetc.c | 4 +- reactos/lib/crtdll/stdio/fgetchar.c | 6 +- reactos/lib/crtdll/stdio/fgetpos.c | 4 +- reactos/lib/crtdll/stdio/fgets.c | 4 +- reactos/lib/crtdll/stdio/filbuf.c | 17 +- reactos/lib/crtdll/stdio/fileno.c | 2 +- reactos/lib/crtdll/stdio/flsbuf.c | 16 +- reactos/lib/crtdll/stdio/fopen.c | 10 +- reactos/lib/crtdll/stdio/fprintf.c | 11 +- reactos/lib/crtdll/stdio/fputc.c | 6 +- reactos/lib/crtdll/stdio/fputchar.c | 6 +- reactos/lib/crtdll/stdio/fputs.c | 6 +- reactos/lib/crtdll/stdio/fread.c | 8 +- reactos/lib/crtdll/stdio/freopen.c | 10 +- reactos/lib/crtdll/stdio/frlist.c | 4 +- reactos/lib/crtdll/stdio/fscanf.c | 4 +- reactos/lib/crtdll/stdio/fseek.c | 8 +- reactos/lib/crtdll/stdio/fsetpos.c | 8 +- reactos/lib/crtdll/stdio/ftell.c | 12 +- reactos/lib/crtdll/stdio/fwalk.c | 7 +- reactos/lib/crtdll/stdio/fwrite.c | 8 +- reactos/lib/crtdll/stdio/getc.c | 18 +- reactos/lib/crtdll/stdio/getchar.c | 4 +- reactos/lib/crtdll/stdio/getenv.c | 2 +- reactos/lib/crtdll/stdio/gets.c | 2 +- reactos/lib/crtdll/stdio/getw.c | 4 +- reactos/lib/crtdll/stdio/perror.c | 6 +- reactos/lib/crtdll/stdio/popen.c | 12 +- reactos/lib/crtdll/stdio/printf.c | 12 +- reactos/lib/crtdll/stdio/putc.c | 4 +- reactos/lib/crtdll/stdio/putchar.c | 2 +- reactos/lib/crtdll/stdio/puts.c | 6 +- reactos/lib/crtdll/stdio/putw.c | 4 +- reactos/lib/crtdll/stdio/rename.c | 12 +- reactos/lib/crtdll/stdio/rewind.c | 6 +- reactos/lib/crtdll/stdio/scanf.c | 4 +- reactos/lib/crtdll/stdio/setbuf.c | 6 +- reactos/lib/crtdll/stdio/setbuffe.c | 6 +- reactos/lib/crtdll/stdio/setlineb.c | 2 +- reactos/lib/crtdll/stdio/setvbuf.c | 8 +- reactos/lib/crtdll/stdio/sprintf.c | 8 +- reactos/lib/crtdll/stdio/sscanf.c | 6 +- reactos/lib/crtdll/stdio/stdhnd.c | 8 +- reactos/lib/crtdll/stdio/stdiohk.c | 4 +- reactos/lib/crtdll/stdio/tempnam.c | 4 +- reactos/lib/crtdll/stdio/tmpfile.c | 20 +- reactos/lib/crtdll/stdio/tmpnam.c | 17 +- reactos/lib/crtdll/stdio/ungetc.c | 12 +- reactos/lib/crtdll/stdio/vfprintf.c | 4 +- reactos/lib/crtdll/stdio/vprintf.c | 4 +- reactos/lib/crtdll/stdio/vsprintf.c | 4 +- reactos/lib/crtdll/stdlib/{Exit.c => _exit.c} | 17 +- reactos/lib/crtdll/stdlib/abort.c | 6 +- reactos/lib/crtdll/stdlib/abs.c | 2 +- reactos/lib/crtdll/stdlib/atexit.c | 4 +- reactos/lib/crtdll/stdlib/atof.c | 2 +- reactos/lib/crtdll/stdlib/atoi.c | 2 +- reactos/lib/crtdll/stdlib/atol.c | 2 +- reactos/lib/crtdll/stdlib/atold.c | 2 +- reactos/lib/crtdll/stdlib/bsearch.c | 2 +- reactos/lib/crtdll/stdlib/calloc.c | 4 +- reactos/lib/crtdll/stdlib/div.c | 2 +- reactos/lib/crtdll/stdlib/ecvt.c | 4 +- reactos/lib/crtdll/stdlib/ecvtbuf.c | 10 +- reactos/lib/crtdll/stdlib/errno.c | 2 +- reactos/lib/crtdll/stdlib/fcvt.c | 4 +- reactos/lib/crtdll/stdlib/fcvtbuf.c | 10 +- reactos/lib/crtdll/stdlib/fullpath.c | 2 +- reactos/lib/crtdll/stdlib/gcvt.c | 6 +- reactos/lib/crtdll/stdlib/itoa.c | 4 +- reactos/lib/crtdll/stdlib/labs.c | 2 +- reactos/lib/crtdll/stdlib/ldiv.c | 2 +- reactos/lib/crtdll/stdlib/llabs.c | 2 +- reactos/lib/crtdll/stdlib/lldiv.c | 2 +- reactos/lib/crtdll/stdlib/makepath.c | 4 +- reactos/lib/crtdll/stdlib/malloc.c | 4 +- reactos/lib/crtdll/stdlib/mbstow.c | 2 +- reactos/lib/crtdll/stdlib/obsol.c | 10 +- reactos/lib/crtdll/stdlib/putenv.c | 4 +- reactos/lib/crtdll/stdlib/qsort.c | 2 +- reactos/lib/crtdll/stdlib/rand.c | 2 +- reactos/lib/crtdll/stdlib/senv.c | 4 +- reactos/lib/crtdll/stdlib/splitp.c | 4 +- reactos/lib/crtdll/stdlib/strtod.c | 4 +- reactos/lib/crtdll/stdlib/strtol.c | 8 +- reactos/lib/crtdll/stdlib/strtold.c | 6 +- reactos/lib/crtdll/stdlib/strtoll.c | 8 +- reactos/lib/crtdll/stdlib/strtoul.c | 8 +- reactos/lib/crtdll/stdlib/strtoull.c | 8 +- reactos/lib/crtdll/stdlib/swab.c | 18 + reactos/lib/crtdll/stdlib/wcstom.c | 2 +- reactos/lib/crtdll/string/memchr.c | 2 +- reactos/lib/crtdll/string/memcmp.c | 2 +- reactos/lib/crtdll/string/memcpy.c | 12 + reactos/lib/crtdll/string/memmove.c | 6 +- reactos/lib/crtdll/string/memset.c | 16 + reactos/lib/crtdll/string/str_old.c | 15 +- reactos/lib/crtdll/string/strcat.c | 2 +- reactos/lib/crtdll/string/strcmp.c | 2 +- reactos/lib/crtdll/string/strcoll.c | 2 +- reactos/lib/crtdll/string/strcspn.c | 2 +- reactos/lib/crtdll/string/strdup.c | 7 +- reactos/lib/crtdll/string/strerror.c | 17 +- reactos/lib/crtdll/string/stricmp.c | 12 +- reactos/lib/crtdll/string/strlen.c | 2 +- reactos/lib/crtdll/string/strlwr.c | 6 +- reactos/lib/crtdll/string/strncat.c | 2 +- reactos/lib/crtdll/string/strncmp.c | 2 +- reactos/lib/crtdll/string/strncpy.c | 2 +- reactos/lib/crtdll/string/strnicmp.c | 7 +- reactos/lib/crtdll/string/strnlen.c | 4 +- reactos/lib/crtdll/string/strpbrk.c | 2 +- reactos/lib/crtdll/string/strrchr.c | 4 +- reactos/lib/crtdll/string/strspn.c | 2 +- reactos/lib/crtdll/string/strstr.c | 4 +- reactos/lib/crtdll/string/strtok.c | 2 +- reactos/lib/crtdll/string/strtoul.c | 4 +- reactos/lib/crtdll/string/strupr.c | 4 +- reactos/lib/crtdll/string/strxfrm.c | 2 +- reactos/lib/crtdll/sys_stat/fstat.c | 14 +- reactos/lib/crtdll/sys_stat/stat.c | 13 +- reactos/lib/crtdll/tchar/strdec.c | 7 + reactos/lib/crtdll/tchar/strinc.c | 6 + reactos/lib/crtdll/tchar/strncnt.c | 8 + reactos/lib/crtdll/tchar/strnextc.c | 6 + reactos/lib/crtdll/tchar/strninc.c | 6 + reactos/lib/crtdll/tchar/strspnp.c | 7 + reactos/lib/crtdll/time/clock.c | 12 +- reactos/lib/crtdll/time/ctime.c | 16 +- reactos/lib/crtdll/time/difftime.c | 2 +- reactos/lib/crtdll/time/strftime.c | 4 +- reactos/lib/crtdll/time/time.c | 202 +++- reactos/lib/crtdll/wchar/wcscat.c | 2 +- reactos/lib/crtdll/wchar/wcschr.c | 2 +- reactos/lib/crtdll/wchar/wcscmp.c | 2 +- reactos/lib/crtdll/wchar/wcscoll.c | 4 +- reactos/lib/crtdll/wchar/wcscpy.c | 2 +- reactos/lib/crtdll/wchar/wcscspn.c | 2 +- reactos/lib/crtdll/wchar/wcsdup.c | 4 +- reactos/lib/crtdll/wchar/wcsftime.c | 6 + reactos/lib/crtdll/wchar/wcsicmp.c | 4 +- reactos/lib/crtdll/wchar/wcslen.c | 14 +- reactos/lib/crtdll/wchar/wcslwr.c | 4 +- reactos/lib/crtdll/wchar/wcsncat.c | 2 +- reactos/lib/crtdll/wchar/wcsncmp.c | 2 +- reactos/lib/crtdll/wchar/wcsncpy.c | 4 +- reactos/lib/crtdll/wchar/wcsnicmp.c | 4 +- reactos/lib/crtdll/wchar/wcsnlen.c | 4 +- reactos/lib/crtdll/wchar/wcsrchr.c | 2 + reactos/lib/crtdll/wchar/wcsrev.c | 4 +- reactos/lib/crtdll/wchar/wcsspn.c | 4 +- reactos/lib/crtdll/wchar/wcsstr.c | 2 + reactos/lib/crtdll/wchar/wcstok.c | 2 + reactos/lib/crtdll/wchar/wcstol.c | 35 + reactos/lib/crtdll/wchar/wcsupr.c | 4 +- reactos/lib/crtdll/wchar/wcsxfrm.c | 6 + 319 files changed, 4225 insertions(+), 1740 deletions(-) create mode 100644 reactos/include/crtdll/alloc.h create mode 100644 reactos/include/crtdll/excpt.h create mode 100644 reactos/include/crtdll/internal/atexit.h create mode 100644 reactos/include/crtdll/internal/file.h create mode 100644 reactos/include/crtdll/malloc.h create mode 100644 reactos/include/crtdll/search.h create mode 100644 reactos/include/crtdll/string.h delete mode 100644 reactos/include/crtdll/sys/djtypes.h create mode 100644 reactos/include/crtdll/sys/fcntl.h create mode 100644 reactos/include/crtdll/sys/file.h create mode 100644 reactos/include/crtdll/sys/locking.h create mode 100644 reactos/include/crtdll/sys/time.h create mode 100644 reactos/include/crtdll/sys/timeb.h create mode 100644 reactos/include/crtdll/sys/unistd.h create mode 100644 reactos/include/crtdll/sys/utime.h create mode 100644 reactos/include/crtdll/tchar.h create mode 100644 reactos/include/crtdll/wchar.h create mode 100644 reactos/lib/crtdll/except/abnorter.c create mode 100644 reactos/lib/crtdll/float/chgsign.c create mode 100644 reactos/lib/crtdll/float/isnan.c create mode 100644 reactos/lib/crtdll/locale/locale.c create mode 100644 reactos/lib/crtdll/malloc/expand.c create mode 100644 reactos/lib/crtdll/malloc/heap.c create mode 100644 reactos/lib/crtdll/math/j0_y0.c create mode 100644 reactos/lib/crtdll/math/j1_y1.c create mode 100644 reactos/lib/crtdll/math/jn_yn.c create mode 100644 reactos/lib/crtdll/math/stubs.c create mode 100644 reactos/lib/crtdll/misc/purecall.c create mode 100644 reactos/lib/crtdll/misc/setnew.cc create mode 100644 reactos/lib/crtdll/process/threadid.c create mode 100644 reactos/lib/crtdll/search/lfind.c create mode 100644 reactos/lib/crtdll/search/lsearch.c rename reactos/lib/crtdll/stdlib/{Exit.c => _exit.c} (76%) create mode 100644 reactos/lib/crtdll/stdlib/swab.c create mode 100644 reactos/lib/crtdll/tchar/strdec.c create mode 100644 reactos/lib/crtdll/tchar/strinc.c create mode 100644 reactos/lib/crtdll/tchar/strncnt.c create mode 100644 reactos/lib/crtdll/tchar/strnextc.c create mode 100644 reactos/lib/crtdll/tchar/strninc.c create mode 100644 reactos/lib/crtdll/tchar/strspnp.c create mode 100644 reactos/lib/crtdll/wchar/wcsftime.c create mode 100644 reactos/lib/crtdll/wchar/wcsxfrm.c diff --git a/reactos/include/crtdll/alloc.h b/reactos/include/crtdll/alloc.h new file mode 100644 index 00000000000..a4e0f0514b3 --- /dev/null +++ b/reactos/include/crtdll/alloc.h @@ -0,0 +1,74 @@ +/* + * alloc.h + * + * Memory management functions. Because most of these functions are + * actually declared in stdlib.h I have decided to simply include that + * header file. This file is included by malloc.h. My head hurts... + * + * NOTE: In the version of the Standard C++ Library from Cygnus there + * is also an alloc.h which needs to be on your include path. Most of + * the time I think the most sensible option would be to get rid of + * this file. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters + * + * 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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.1 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ + * + */ + +#ifndef __STRICT_ANSI__ + +#ifndef _ALLOC_H_ +#define _ALLOC_H_ + +#include + +#ifndef RC_INVOKED + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The structure used to walk through the heap with _heapwalk. + * TODO: This is a guess at the internals of this structure. + */ +typedef struct _heapinfo +{ + void* ptr; + unsigned int size; + int in_use; +} _HEAPINFO; + +int _heapwalk (_HEAPINFO* pHeapinfo); + + +#ifndef _NO_OLDNAMES +int heapwalk (_HEAPINFO* pHeapinfo); +#endif /* Not _NO_OLDNAMES */ + +#ifdef __cplusplus +} +#endif + +#endif /* Not RC_INVOKED */ + +#endif /* Not _ALLOC_H_ */ + +#endif /* Not __STRICT_ANSI__ */ + diff --git a/reactos/include/crtdll/assert.h b/reactos/include/crtdll/assert.h index f90a1242c61..2441bd4b22f 100644 --- a/reactos/include/crtdll/assert.h +++ b/reactos/include/crtdll/assert.h @@ -18,9 +18,9 @@ * DISCLAMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.2 $ - * $Author: rex $ - * $Date: 1999/03/19 05:55:07 $ + * $Revision: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ * */ @@ -44,11 +44,17 @@ extern "C" { * CRTDLL nicely supplies a function which does the actual output and * call to abort. */ -void _assert (const char* szExpression, const char* szFileName, int nLine) +#ifndef __ATTRIB_NORETURN #ifdef __GNUC__ - __attribute__ ((noreturn)) +#define _ATTRIB_NORETURN __attribute__ ((noreturn)) +#else /* Not __GNUC__ */ +#define _ATTRIB_NORETURN +#endif /* __GNUC__ */ #endif - ; + +void _assert (const char* szExpression, const char* szFileName, int nLine) +_ATTRIB_NORETURN +; /* * Definition of the assert macro. diff --git a/reactos/include/crtdll/conio.h b/reactos/include/crtdll/conio.h index 3c0b26be697..a0823278317 100644 --- a/reactos/include/crtdll/conio.h +++ b/reactos/include/crtdll/conio.h @@ -1,111 +1,67 @@ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#ifndef __dj_include_conio_h_ -#define __dj_include_conio_h_ +/* + * 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 + * + * 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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ + * + */ -#ifdef __cplusplus +#ifndef __STRICT_ANSI__ + +#ifndef _CONIO_H_ +#define _CONIO_H_ + +#ifdef __cplusplus extern "C" { #endif -#ifndef __dj_ENFORCE_ANSI_FREESTANDING -#ifndef __STRICT_ANSI__ +char* _cgets (char* szBuffer); +int _cprintf (const char* szFormat, ...); +int _cputs (const char* szString); +int _cscanf (char* szFormat, ...); -#ifndef _POSIX_SOURCE +int _getch (void); +int _getche (void); +int _kbhit (void); +int _putch (int cPut); +int _ungetch (int cUnget); -extern int directvideo; /* ignored by gppconio */ -extern int _wscroll; +#ifndef _NO_OLDNAMES -#define _NOCURSOR 0 -#define _SOLIDCURSOR 1 -#define _NORMALCURSOR 2 +#define getch _getch +#define getche _getche +#define kbhit _kbhit +#define putch (cPut) _putch(cPut) +#define ungetch (cUnget) _ungetch(cUnget) -struct text_info { - unsigned char winleft; - unsigned char wintop; - unsigned char winright; - unsigned char winbottom; - unsigned char attribute; - unsigned char normattr; - unsigned char currmode; - unsigned char screenheight; - unsigned char screenwidth; - unsigned char curx; - unsigned char cury; -}; +#endif /* Not _NO_OLDNAMES */ -enum text_modes { LASTMODE=-1, BW40=0, C40, BW80, C80, MONO=7, C4350=64 }; -enum COLORS { - /* dark colors */ - BLACK, - BLUE, - GREEN, - CYAN, - RED, - MAGENTA, - BROWN, - LIGHTGRAY, - /* light colors */ - DARKGRAY, - LIGHTBLUE, - LIGHTGREEN, - LIGHTCYAN, - LIGHTRED, - LIGHTMAGENTA, - YELLOW, - WHITE -}; - -#define BLINK 0x80 /* blink bit */ - -void blinkvideo(void); -char * cgets(char *_str); -void clreol(void); -void clrscr(void); -int _conio_kbhit(void); /* checks for ungetch char */ -//int cprintf(const char *_format, ...) __attribute__((format(printf,1,2))); -int cputs(const char *_str); -//int cscanf(const char *_format, ...) __attribute__((format(scanf,1,2))); -void delline(void); -int getch(void); -int getche(void); -int gettext(int _left, int _top, int _right, int _bottom, void *_destin); -void gettextinfo(struct text_info *_r); -void gotoxy(int _x, int _y); -void gppconio_init(void); -void highvideo(void); -void insline(void); -void intensevideo(void); -void lowvideo(void); -int movetext(int _left, int _top, int _right, int _bottom, int _destleft, int _desttop); -void normvideo(void); -int putch(int _c); -int puttext(int _left, int _top, int _right, int _bottom, void *_source); -void _setcursortype(int _type); -void _set_screen_lines(int _nlines); -void textattr(int _attr); -void textbackground(int _color); -void textcolor(int _color); -void textmode(int _mode); -int ungetch(int); -unsigned int wherex(void); -unsigned int wherey(void); -void window(int _left, int _top, int _right, int _bottom); - -#define kbhit _conio_kbhit /* Who ever includes gppconio.h probably - also wants _conio_kbhit and not kbhit - from libc */ - -#endif /* !_POSIX_SOURCE */ -#endif /* !__STRICT_ANSI__ */ -#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */ - -#ifndef __dj_ENFORCE_FUNCTION_CALLS -#endif /* !__dj_ENFORCE_FUNCTION_CALLS */ - -#ifdef __cplusplus +#ifdef __cplusplus } #endif -#endif /* !__dj_include_conio_h_ */ +#endif /* Not _CONIO_H_ */ + +#endif /* Not __STRICT_ANSI__ */ diff --git a/reactos/include/crtdll/ctype.h b/reactos/include/crtdll/ctype.h index b09105cb47b..3a98fe24fb1 100644 --- a/reactos/include/crtdll/ctype.h +++ b/reactos/include/crtdll/ctype.h @@ -18,9 +18,9 @@ * DISCLAMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.2 $ - * $Author: rex $ - * $Date: 1999/03/19 05:55:07 $ + * $Revision: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ * */ #ifndef _LINUX_CTYPE_H @@ -31,7 +31,7 @@ #define __need_wchar_t #define __need_wint_t -#include +#include /* @@ -46,22 +46,11 @@ #define _CONTROL 0x0020 #define _BLANK 0x0040 #define _HEX 0x0080 +#define _ALPHA 0x0103 +#define _GRAPH 0x0200 // added +#define _PRINT 0x0400 // added #define _LEADBYTE 0x8000 -#define _ALPHA 0x0103 - -/* from DJGPP, see appropriate licence */ -#define __dj_ISALNUM 0x0001 -#define __dj_ISALPHA 0x0002 -#define __dj_ISCNTRL 0x0004 -#define __dj_ISDIGIT 0x0008 -#define __dj_ISGRAPH 0x0010 -#define __dj_ISLOWER 0x0020 -#define __dj_ISPRINT 0x0040 -#define __dj_ISPUNCT 0x0080 -#define __dj_ISSPACE 0x0100 -#define __dj_ISUPPER 0x0200 -#define __dj_ISXDIGIT 0x0400 #ifdef __cplusplus extern "C" { diff --git a/reactos/include/crtdll/dir.h b/reactos/include/crtdll/dir.h index 6e873768a75..0e0266d8f0e 100644 --- a/reactos/include/crtdll/dir.h +++ b/reactos/include/crtdll/dir.h @@ -18,9 +18,9 @@ * DISCLAMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.2 $ - * $Author: rex $ - * $Date: 1999/03/19 05:55:07 $ + * $Revision: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ * */ @@ -29,8 +29,8 @@ #ifndef _DIR_H_ #define _DIR_H_ -#include /* To get FILENAME_MAX... ugly. */ -#include /* To get time_t. */ +#include /* To get FILENAME_MAX... ugly. */ +#include /* To get time_t. */ #ifdef __cplusplus extern "C" { diff --git a/reactos/include/crtdll/dirent.h b/reactos/include/crtdll/dirent.h index 93e541d6e11..e5c2948bd82 100644 --- a/reactos/include/crtdll/dirent.h +++ b/reactos/include/crtdll/dirent.h @@ -14,9 +14,9 @@ * DISCLAMED. This includeds but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.2 $ - * $Author: rex $ - * $Date: 1999/03/19 05:55:07 $ + * $Revision: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ * */ @@ -25,7 +25,7 @@ #ifndef _DIRENT_H_ #define _DIRENT_H_ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/reactos/include/crtdll/dos.h b/reactos/include/crtdll/dos.h index 92670be4de9..f31ecb1a964 100644 --- a/reactos/include/crtdll/dos.h +++ b/reactos/include/crtdll/dos.h @@ -139,7 +139,7 @@ void _setdrive(unsigned int _drive, unsigned int *_p_drives); int exterr(struct _DOSERROR *_p_error); #define dosexterr(_ep) exterr(_ep) -#include +#include #define int386(_i, _ir, _or) int86(_i, _ir, _or) #define int386x(_i, _ir, _or, _sr) int86x(_i, _ir, _or, _sr) diff --git a/reactos/include/crtdll/errno.h b/reactos/include/crtdll/errno.h index b68c1f85f12..14b10b74a17 100644 --- a/reactos/include/crtdll/errno.h +++ b/reactos/include/crtdll/errno.h @@ -18,9 +18,9 @@ * DISCLAMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.2 $ - * $Author: rex $ - * $Date: 1999/03/19 05:55:07 $ + * $Revision: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ * */ @@ -103,17 +103,28 @@ int* __doserrno(void); #if __MSVCRT__ /* One of the MSVCRTxx libraries */ + extern int* __imp__sys_nerr; #define sys_nerr (*__imp__sys_nerr) -#else -/* CRTDLL run time library */ -extern int* __imp__sys_nerr_dll; -#define sys_nerr (*__imp__sys_nerr_dll) -#endif extern char** __imp__sys_errlist; #define sys_errlist (__imp__sys_errlist) +#else +/* CRTDLL run time library */ + + +#define _sys_nerr (*_sys_nerr_dll) +extern int* _sys_nerr_dll; +#define sys_nerr (*_sys_nerr_dll) + +extern const char* __sys_errlist[]; +#define sys_errlist (__sys_errlist) + +#endif + + + #ifdef __cplusplus } #endif diff --git a/reactos/include/crtdll/excpt.h b/reactos/include/crtdll/excpt.h new file mode 100644 index 00000000000..582a594b891 --- /dev/null +++ b/reactos/include/crtdll/excpt.h @@ -0,0 +1,121 @@ +/* + * excpt.h + * + * Support for operating system level structured exception handling. + * + * NOTE: This is very preliminary stuff. I am also pretty sure it is + * completely Intel specific. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters + * Based on code by Mikey + * + * 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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.1 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ + * + */ + +#ifndef _EXCPT_H_ +#define _EXCPT_H_ + +#ifndef __STRICT_ANSI__ + +#include + +/* + * NOTE: The constants structs and typedefs below should be defined in the + * Win32 API headers. + */ +#define EH_NONCONTINUABLE 0x01 +#define EH_UNWINDING 0x02 +#define EH_EXIT_UNWIND 0x04 +#define EH_STACK_INVALID 0x08 +#define EH_NESTED_CALL 0x10 + +#ifndef RC_INVOKED + +typedef enum { + ExceptionContinueExecution, + ExceptionContinueSearch, + ExceptionNestedException, + ExceptionCollidedUnwind +} EXCEPTION_DISPOSITION; + + +/* + * End of stuff that should be in the Win32 API files. + */ + + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The type of function that is expected as an exception handler to be + * installed with _try1. + */ +typedef EXCEPTION_DISPOSITION (*PEXCEPTION_HANDLER) + (struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*); + +/* + * This is not entirely necessary, but it is the structure installed by + * the _try1 primitive below. + */ +typedef struct _EXCEPTION_REGISTRATION +{ + struct _EXCEPTION_REGISTRATION* prev; + PEXCEPTION_HANDLER handler; +} EXCEPTION_REGISTRATION, *PEXCEPTION_REGISTRATION; + +typedef EXCEPTION_REGISTRATION EXCEPTION_REGISTRATION_RECORD; +typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD; + +/* + * A macro which installs the supplied exception handler. + * Push the pointer to the new handler onto the stack, + * then push the pointer to the old registration structure (at fs:0) + * onto the stack, then put a pointer to the new registration + * structure (i.e. the current stack pointer) at fs:0. + */ +#define __try1(pHandler) \ + __asm__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : "g" (pHandler)); + + +/* + * A macro which (dispite its name) *removes* an installed + * exception handler. Should be used only in conjunction with the above + * install routine __try1. + * Move the pointer to the old reg. struct (at the current stack + * position) to fs:0, replacing the pointer we installed above, + * then add 8 to the stack pointer to get rid of the space we + * used when we pushed on our new reg. struct above. Notice that + * the stack must be in the exact state at this point that it was + * after we did _try1 or this will smash things. + */ +#define __except1 \ + __asm__ ("movl (%%esp),%%eax;movl %%eax,%%fs:0;addl $8,%%esp;" \ + : : : "%eax"); + +#ifdef __cplusplus +} +#endif + +#endif /* Not RC_INVOKED */ + +#endif /* Not strict ANSI */ + +#endif /* _EXCPT_H_ not defined */ diff --git a/reactos/include/crtdll/fcntl.h b/reactos/include/crtdll/fcntl.h index d6f772ab32e..6428af6ca7c 100644 --- a/reactos/include/crtdll/fcntl.h +++ b/reactos/include/crtdll/fcntl.h @@ -1,164 +1,115 @@ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#ifndef __dj_include_fcntl_h_ -#define __dj_include_fcntl_h_ +/* + * fcntl.h + * + * Access constants for _open. Note that the permissions constants are + * in sys/stat.h (ick). + * + * This code is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters + * + * 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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ + * + */ +/* Appropriated for Reactos Crtdll by Ariadne */ +/* added _O_RANDOM_O_SEQUENTIAL _O_SHORT_LIVED*/ +/* changed fmode_dll */ -#ifdef __cplusplus +#ifndef _FCNTL_H_ +#define _FCNTL_H_ + +/* + * It appears that fcntl.h should include io.h for compatibility... + */ +#include + +/* + * This variable determines the default file mode. + * TODO: Which flags work? + */ +#if __MSVCRT__ +extern unsigned int* __imp__fmode; +#define _fmode (*__imp__fmode) +#else +/* CRTDLL */ +extern unsigned int* _fmode_dll; +#define _fmode (*_fmode_dll) +#endif + +/* Specifiy one of these flags to define the access mode. */ +#define _O_RDONLY 0 +#define _O_WRONLY 1 +#define _O_RDWR 2 + +/* Mask for access mode bits in the _open flags. */ +#define _O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) + +#define _O_APPEND 0x0008 /* Writes will add to the end of the file. */ +#define _O_CREAT 0x0100 /* Create the file if it does not exist. */ +#define _O_TRUNC 0x0200 /* Truncate the file if it does exist. */ +#define _O_EXCL 0x0400 /* Open only if the file does not exist. */ + +/* NOTE: Text is the default even if the given _O_TEXT bit is not on. */ +#define _O_TEXT 0x4000 /* CR-LF in file becomes LF in memory. */ +#define _O_BINARY 0x8000 /* Input and output is not translated. */ +#define _O_RAW _O_BINARY + +#define _O_TEMPORARY 0x0040 /* Make the file dissappear after closing. + * WARNING: Even if not created by _open! */ + + +#define _O_RANDOM 0x0010 +#define _O_SEQUENTIAL _O_RANDOM +#define _O_SHORT_LIVED 0x1000 + +#ifndef __STRICT_ANSI__ +#ifndef _NO_OLDNAMES + +/* POSIX/Non-ANSI names for increased portability */ +#define O_RDONLY _O_RDONLY +#define O_WRONLY _O_WRONLY +#define O_RDWR _O_RDWR +#define O_ACCMODE _O_ACCMODE +#define O_APPEND _O_APPEND +#define O_CREAT _O_CREAT +#define O_TRUNC _O_TRUNC +#define O_EXCL _O_EXCL +#define O_TEXT _O_TEXT +#define O_BINARY _O_BINARY +#define O_TEMPORARY _O_TEMPORARY + +#define O_RANDOM _O_RANDOM +#define O_SEQUENTIAL _O_RANDOM +#define O_SHORT_LIVED _O_SHORT_LIVED + +#endif /* Not _NO_OLDNAMES */ + +#ifdef __cplusplus extern "C" { #endif -#define _IOREAD 000010 -#define _IOWRT 000020 -#define _IOMYBUF 000040 -#define _IOEOF 000100 -#define _IOERR 000200 -#define _IOSTRG 000400 -#define _IORW 001000 -#define _IOAPPEND 002000 -#define _IORMONCL 004000 /* remove on close, for temp files */ -/* if _flag & _IORMONCL, ._name_to_remove needs freeing */ -#define _IOUNGETC 010000 /* there is an ungetc'ed character in the buffer */ +int _setmode (int nHandle, int nAccessMode); +#ifndef _NO_OLDNAMES +int setmode (int nHandle, int nAccessMode); +#endif /* Not _NO_OLDNAMES */ -#ifndef __dj_ENFORCE_ANSI_FREESTANDING - -#ifndef __STRICT_ANSI__ - -#define FD_CLOEXEC 0x0001 - -#define F_DUPFD 1 -#define F_GETFD 2 -#define F_GETFL 3 -#define F_GETLK 4 -#define F_SETFD 5 -#define F_SETFL 6 -#define F_SETLK 7 -#define F_SETLKW 8 - -#define F_UNLCK 0 -#define F_RDLCK 1 -#define F_WRLCK 2 - -#define O_RDONLY 0x0000 -#define O_WRONLY 0x0001 -#define O_RDWR 0x0002 -#define O_ACCMODE 0x0003 - -#define O_BINARY 0x0004 /* must fit in char, reserved by dos */ -#define O_TEXT 0x0008 /* must fit in char, reserved by dos */ - -#define O_RANDOM 0x0010 -#define O_SEQUENTIAL 0x0020 - - -#define O_TEMPORARY 0x0040 - -/* temporary access hint */ - - - -/* sequential/random access hints */ - - - - -#define O_NOINHERIT 0x0080 /* DOS-specific */ - -#define O_CREAT 0x0100 /* second byte, away from DOS bits */ -#define O_EXCL 0x0200 -#define O_NOCTTY 0x0400 -#define O_TRUNC 0x0800 -#define O_APPEND 0x1000 -#define O_NONBLOCK 0x2000 - -#define O_SHORT_LIVED 0x1000 - -//#include -#include - -//typedef int dev_t; -//typedef int ino_t; -//typedef int mode_t; -//typedef int nlink_t; - -#include - - -struct flock { - off_t l_len; - pid_t l_pid; - off_t l_start; - short l_type; - short l_whence; -}; - -extern int _fmode; /* O_TEXT or O_BINARY */ - -//int open(const char *_path, int _oflag, ...); -//int creat(const char *_path, int _mode); -int fcntl(int _fildes, int _cmd, ...); - -#ifndef _POSIX_SOURCE - - -#define S_IREAD S_IRUSR -#define S_IWRITE S_IWUSR -#define S_IEXEC S_IXUSR - -/* - * For compatibility with other DOS C compilers. - */ - -#define _O_RDONLY O_RDONLY -#define _O_WRONLY O_WRONLY -#define _O_RDWR O_RDWR -#define _O_APPEND O_APPEND -#define _O_CREAT O_CREAT -#define _O_TRUNC O_TRUNC -#define _O_EXCL O_EXCL -#define _O_TEXT O_TEXT -#define _O_BINARY O_BINARY -#define _O_NOINHERIT O_NOINHERIT -#define _O_RANDOM O_RANDOM -#define _O_SEQUENTIAL O_RANDOM -#define _O_SHORT_LIVED O_SHORT_LIVED -#define _O_TEMPORARY O_TEMPORARY - -#define _S_IREAD S_IRUSR -#define _S_IWRITE S_IWUSR -#define _S_IEXEC S_IXUSR - -/* - * Support for advanced filesystems (Windows 9x VFAT, NTFS, LFN etc.) - */ - -#define _FILESYS_UNKNOWN 0x80000000U -#define _FILESYS_CASE_SENSITIVE 0x0001 -#define _FILESYS_CASE_PRESERVED 0x0002 -#define _FILESYS_UNICODE 0x0004 -#define _FILESYS_LFN_SUPPORTED 0x4000 -#define _FILESYS_VOL_COMPRESSED 0x8000 - -unsigned _get_volume_info (const char *_path, int *_max_file_len, int *_max_path_len, char *_filesystype); -char _use_lfn (const char *_path); -char *_lfn_gen_short_fname (const char *_long_fname, char *_short_fname); - -#define _LFN_CTIME 1 -#define _LFN_ATIME 2 - -unsigned _lfn_get_ftime (int _handle, int _which); - -char _preserve_fncase (void); -#define _USE_LFN _use_lfn(0) /* assume it's the same on ALL drives */ - -#endif /* !_POSIX_SOURCE */ -#endif /* !__STRICT_ANSI__ */ -#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */ - -#ifndef __dj_ENFORCE_FUNCTION_CALLS -#endif /* !__dj_ENFORCE_FUNCTION_CALLS */ - -#ifdef __cplusplus +#ifdef __cplusplus } #endif -#endif /* !__dj_include_fcntl_h_ */ +#endif /* Not __STRICT_ANSI__ */ +#endif /* Not _FCNTL_H_ */ diff --git a/reactos/include/crtdll/float.h b/reactos/include/crtdll/float.h index d919986c0be..6f11dc82653 100644 --- a/reactos/include/crtdll/float.h +++ b/reactos/include/crtdll/float.h @@ -27,9 +27,9 @@ * DISCLAMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.2 $ - * $Author: rex $ - * $Date: 1999/03/19 05:55:07 $ + * $Revision: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ * */ @@ -146,15 +146,15 @@ unsigned int _controlfp (unsigned int unNew, unsigned int unMask); unsigned int _control87 (unsigned int unNew, unsigned int unMask); -unsigned int _clearfp (); /* Clear the FPU status word */ -unsigned int _statusfp (); /* Report the FPU status word */ +unsigned int _clearfp (void); /* Clear the FPU status word */ +unsigned int _statusfp (void); /* Report the FPU status word */ #define _clear87 _clearfp #define _status87 _statusfp -void _fpreset (); /* Reset the FPU */ +void _fpreset (void); /* Reset the FPU */ /* Global 'variable' for the current floating point error code. */ -int * __fpecode(); +int * __fpecode(void); #define _fpecode (*(__fpecode())) /* diff --git a/reactos/include/crtdll/internal/atexit.h b/reactos/include/crtdll/internal/atexit.h new file mode 100644 index 00000000000..b3a9f0103ad --- /dev/null +++ b/reactos/include/crtdll/internal/atexit.h @@ -0,0 +1,33 @@ +/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ +#ifndef __dj_include_libc_atexit_h__ +#define __dj_include_libc_dosexec_h__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __dj_ENFORCE_ANSI_FREESTANDING + +#ifndef __STRICT_ANSI__ + +#ifndef _POSIX_SOURCE + +struct __atexit { + struct __atexit *__next; + void (*__function)(void); +}; + +extern struct __atexit *__atexit_ptr; + +#endif /* !_POSIX_SOURCE */ +#endif /* !__STRICT_ANSI__ */ +#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */ + +#ifndef __dj_ENFORCE_FUNCTION_CALLS +#endif /* !__dj_ENFORCE_FUNCTION_CALLS */ + +#ifdef __cplusplus +} +#endif + +#endif /* __dj_include_libc_dosexec_h__ */ diff --git a/reactos/include/crtdll/internal/file.h b/reactos/include/crtdll/internal/file.h new file mode 100644 index 00000000000..7df3a171a73 --- /dev/null +++ b/reactos/include/crtdll/internal/file.h @@ -0,0 +1,62 @@ +/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ + +#ifndef __dj_include_libc_file_h__ +#define __dj_include_libc_file_h__ + +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __dj_ENFORCE_ANSI_FREESTANDING + +#ifndef __STRICT_ANSI__ + +#ifndef _POSIX_SOURCE + +#ifndef _IORMONCL +#define _IORMONCL 004000 /* remove on close, for temp files */ +#endif +/* if _flag & _IORMONCL, ._name_to_remove needs freeing */ + +#ifndef _IOUNGETC +#define _IOUNGETC 010000 /* there is an ungetc'ed character in the buffer */ +#endif + +int __set_errno(int err); +void *filehnd(int fn); + +char __is_text_file(FILE *p); + +int __fileno_alloc(void *hFile, int mode); + +int _doprnt(const char *fmt, va_list args, FILE *f); +int _doscan(FILE *iop, const char *fmt, va_list argp); +int _dowscan(FILE *iop, const wchar_t *fmt, va_list argp); + + +int __fileno_dup2( int handle1, int handle2 ); +int __fileno_setmode(int _fd, int _newmode); +int __fileno_close(int _fd); + +#include + +void UnixTimeToFileTime( time_t unix_time, FILETIME *filetime, DWORD remainder ); +time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder ); + + +#endif /* !_POSIX_SOURCE */ +#endif /* !__STRICT_ANSI__ */ +#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */ + +#ifndef __dj_ENFORCE_FUNCTION_CALLS +#endif /* !__dj_ENFORCE_FUNCTION_CALLS */ + +#ifdef __cplusplus +} +#endif + +#endif /* __dj_include_libc_file_h__ */ diff --git a/reactos/include/crtdll/io.h b/reactos/include/crtdll/io.h index 3b35717e317..b0946bd7255 100644 --- a/reactos/include/crtdll/io.h +++ b/reactos/include/crtdll/io.h @@ -18,9 +18,9 @@ * DISCLAMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.2 $ - * $Author: rex $ - * $Date: 1999/03/19 05:55:07 $ + * $Revision: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ * */ /* Appropriated for Reactos Crtdll by Ariadne */ @@ -32,18 +32,18 @@ #ifndef __STRICT_ANSI__ -#include +#include -#include +#include /* We need the definition of FILE anyway... */ -#include +#include /* MSVC's io.h contains the stuff from dir.h, so I will too. * NOTE: This also defines off_t, the file offset type, through * and inclusion of sys/types.h */ -#include +#include /* TODO: Maximum number of open handles has not been tested, I just set * it the same as FOPEN_MAX. */ diff --git a/reactos/include/crtdll/malloc.h b/reactos/include/crtdll/malloc.h new file mode 100644 index 00000000000..3a21c18be09 --- /dev/null +++ b/reactos/include/crtdll/malloc.h @@ -0,0 +1,53 @@ +/* + * malloc.h + * + * Support for programs which want to use malloc.h to get memory management + * functions. Unless you absolutely need some of these functions and they are + * not in the ANSI headers you should use the ANSI standard header files + * instead. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters + * + * 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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.1 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ + * + */ + +#ifndef __STRICT_ANSI__ + +#ifndef _MALLOC_H_ +#define _MALLOC_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void * _expand( void *memblock, size_t size ); +int _heapchk (void); /* Verify heap integrety. */ +int _heapmin (void); /* Return unused heap to the OS. */ +int _heapset (unsigned int unFill); +size_t _msize (void* pBlock); + +#ifdef __cplusplus +} +#endif + +#endif /* Not _MALLOC_H_ */ + +#endif /* Not __STRICT_ANSI__ */ diff --git a/reactos/include/crtdll/math.h b/reactos/include/crtdll/math.h index c028ed8d6b5..3740e7f0d28 100644 --- a/reactos/include/crtdll/math.h +++ b/reactos/include/crtdll/math.h @@ -18,9 +18,9 @@ * DISCLAMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.2 $ - * $Author: rex $ - * $Date: 1999/03/19 05:55:07 $ + * $Revision: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ * */ @@ -46,8 +46,8 @@ extern double* __imp__HUGE; #define HUGE_VAL (*__imp__HUGE) #else /* CRTDLL */ -extern double* __imp__HUGE_dll; -#define HUGE_VAL (*__imp__HUGE_dll) +extern double* _HUGE_dll; +#define HUGE_VAL (*_HUGE_dll) #endif diff --git a/reactos/include/crtdll/process.h b/reactos/include/crtdll/process.h index 60760a11cfa..96da279ff3f 100644 --- a/reactos/include/crtdll/process.h +++ b/reactos/include/crtdll/process.h @@ -18,12 +18,13 @@ * DISCLAMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.2 $ - * $Author: rex $ - * $Date: 1999/03/19 05:55:09 $ + * $Revision: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ * */ /* Appropriated for Reactos Crtdll by Ariadne */ +/* changed second argument of cwait from nPID to hProc */ #ifndef _PROCESS_H_ #define _PROCESS_H_ @@ -49,21 +50,18 @@ void _c_exit(void); #define WAIT_GRANDCHILD _WAIT_GRANDCHILD #endif /* Not _NO_OLDNAMES */ -int _cwait (int* pnStatus, int nPID, int nAction); +int _cwait (int* pnStatus, int hProc, int nAction); int _getpid(void); -int _execl(const char *_path, const char *_argv0, ...); -int _execle(const char *_path, const char *_argv0, ... /*, char *const _envp[] */); -int _execlp(const char *_path, const char *_argv0, ...); -int _execlpe(const char *_path, const char *_argv0, ... /*, char *const _envp[] */); - -int _execv(const char *_path,const char *const _argv[]); -int _execve(const char *_path,const char *const _argv[],const char *const _envp[]); -int _execvp(const char *_path,const char *const _argv[]); -int _execvpe(const char *_path,const char *const _argv[],const char *const _envp[]); - - +int _execl (const char* szPath, const char* szArgv0, ...); +int _execle (const char* szPath, const char* szArgv0, ...); +int _execlp (const char* szPath, const char* szArgv0, ...); +int _execlpe (const char* szPath, const char* szArgv0, ...); +int _execv (const char* szPath, char* const* szaArgv); +int _execve (const char* szPath, char* const* szaArgv, char* const* szaEnv); +int _execvp (const char* szPath, char* const* szaArgv); +int _execvpe (const char* szPath, char* const* szaArgv, char* const* szaEnv); /* @@ -85,16 +83,14 @@ int _execvpe(const char *_path,const char *const _argv[],const char *const _envp #define P_DETACH _P_DETACH #endif /* Not _NO_OLDNAMES */ -int _spawnl(int _mode, const char *_path, const char *_argv0, ...); -int _spawnle(int _mode, const char *_path, const char *_argv0, ... /*, char *const _envp[] */); -int _spawnlp(int _mode, const char *_path, const char *_argv0, ...); -int _spawnlpe(int _mode, const char *_path, const char *_argv0, ... /*, char *const _envp[] */); - -int _spawnv(int _mode, const char *_path,const char *const _argv[]); -int _spawnve(int _mode, const char *_path,const char *const _argv[],const char *const _envp[]); -int _spawnvp(int _mode, const char *_path,const char *const _argv[]); -int _spawnvpe(int _mode, const char *_path,const char *const _argv[],const char *const _envp[]); - +int _spawnl (int nMode, const char* szPath, const char* szArgv0, ...); +int _spawnle (int nMode, const char* szPath, const char* szArgv0,...); +int _spawnlp (int nMode, const char* szPath, const char* szArgv0,...); +int _spawnlpe (int nMode, const char* szPath, const char* szArgv0,...); +int _spawnv (int nMode, const char* szPath, char* const* szaArgv); +int _spawnve (int nMode, const char* szPath, char* const* szaArgv, char* const* szaEnv); +int _spawnvp (int nMode, const char* szPath, char* const* szaArgv); +int _spawnvpe (int nMode, const char* szPath, char* const* szaArgv, char* const* szaEnv); /* * The functions _beginthreadex and _endthreadex are not provided by CRTDLL. * They are provided by MSVCRT. @@ -123,6 +119,11 @@ void _endthreadex (unsigned unExitCode); void *_loaddll (char *name); int _unloaddll(void *handle); +unsigned long __threadid(void); +#define _threadid __threadid() +void * __threadhandle(void); + + #ifndef _NO_OLDNAMES #define cwait _cwait diff --git a/reactos/include/crtdll/search.h b/reactos/include/crtdll/search.h new file mode 100644 index 00000000000..d4268dbfef9 --- /dev/null +++ b/reactos/include/crtdll/search.h @@ -0,0 +1,35 @@ + +#ifndef _SEARCH_H_ +#define _SEARCH_H_ + +//char *key +//void *data + +//enum { FIND, ENTER } ACTION; +//enum { preorder, postorder, endorder, leaf } VISIT; + +#include +#include + + +//The Single UNIX ® Specification, Version 2 Copyright © 1997 The Open Group + +//int hcreate(size_t); +//void hdestroy(void); +//ENTRY *hsearch(ENTRY, ACTION); +//void insque(void *, void *); +void *_lfind(const void *, const void *, size_t *, + size_t, int (*)(const void *, const void *)); +void *_lsearch(const void *, void *, size_t *, + size_t, int (*)(const void *, const void *)); +//void remque(void *); +//void *tdelete(const void *, void **, +// int(*)(const void *, const void *)); +//void *tfind(const void *, void *const *, +// int(*)(const void *, const void *)); +//void *tsearch(const void *, void **, +// int(*)(const void *, const void *)); +//void twalk(const void *, +// void (*)(const void *, VISIT, int )); + +#endif \ No newline at end of file diff --git a/reactos/include/crtdll/stddef.h b/reactos/include/crtdll/stddef.h index 602dde00f2f..d1d41a5b37d 100644 --- a/reactos/include/crtdll/stddef.h +++ b/reactos/include/crtdll/stddef.h @@ -28,9 +28,9 @@ * DISCLAMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.2 $ - * $Author: rex $ - * $Date: 1999/03/19 05:55:09 $ + * $Revision: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ * */ @@ -169,4 +169,5 @@ typedef __WINT_TYPE__ wint_t; #define offsetof(TYPE, MEMBER) ((size_t) &( ((TYPE *) 0)->MEMBER )) #endif /* _STDDEF_H_ */ + #endif /* not _STDDEF_H_ */ diff --git a/reactos/include/crtdll/stdio.h b/reactos/include/crtdll/stdio.h index 85f4ef8d75b..1f2bc692e2e 100644 --- a/reactos/include/crtdll/stdio.h +++ b/reactos/include/crtdll/stdio.h @@ -1,34 +1,51 @@ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ +/* + * stdio.h + * + * Definitions of types and prototypes of functions for standard input and + * output. + * + * NOTE: The file manipulation functions provided by Microsoft seem to + * work with either slash (/) or backslash (\) as the path separator. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters + * + * 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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ + * + */ +/* Appropriated for Reactos Crtdll by Ariadne */ +/* implemented clearerr feof ferror perror as macros */ +/* added _IOCOMMIT */ +/* added filbuf and flsbuf and fwalk */ -#ifndef __dj_include_stdio_h_ -#define __dj_include_stdio_h_ +#ifndef _STDIO_H_ +#define _STDIO_H_ #ifdef __cplusplus extern "C" { #endif -#ifndef __dj_ENFORCE_ANSI_FREESTANDING +#define __need_size_t +#define __need_NULL +#define __need_wchar_t +#include -#include - -#define _IOFBF 00001 -#define _IONBF 00002 -#define _IOLBF 00004 - -#define BUFSIZ 16384 -#define EOF (-1) -#define FILENAME_MAX 260 -#define FOPEN_MAX 20 -#define L_tmpnam 260 -#ifndef NULL -#define NULL 0 -#endif -#define TMP_MAX 999999 - -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 +/* Some flags for the iobuf structure provided by djgpp stdio.h */ #define _IOREAD 000010 #define _IOWRT 000020 #define _IOMYBUF 000040 @@ -40,14 +57,23 @@ extern "C" { #define _IORMONCL 004000 /* remove on close, for temp files */ /* if _flag & _IORMONCL, ._name_to_remove needs freeing */ #define _IOUNGETC 010000 /* there is an ungetc'ed character in the buffer */ +#define _IOCOMMIT 0x4000 -#include - -__DJ_va_list -#undef __DJ_va_list -#define __DJ_va_list +/* + * I used to include stdarg.h at this point, in order to allow for the + * functions later on in the file which use va_list. That conflicts with + * using stdio.h and varargs.h in the same file, so I do the typedef myself. + */ +#ifndef _VA_LIST +#define _VA_LIST +typedef char* va_list; +#endif +/* + * FILE should be used as a pointer to an opaque data type. Do not rely on + * anything else, especially the size or contents of this structure! + */ #ifndef _FILE_DEFINED typedef struct { char *_ptr; @@ -62,96 +88,260 @@ typedef struct { #define _FILE_DEFINED #endif -typedef unsigned long fpos_t; - -extern FILE _iob[]; +/* + * The three standard file pointers provided by the run time library. + * NOTE: These will go to the bit-bucket silently in GUI applications! + */ +extern FILE (*__imp__iob)[]; /* A pointer to an array of FILE */ +#define _iob (*__imp__iob) /* An array of FILE */ #define stdin (&_iob[0]) #define stdout (&_iob[1]) #define stderr (&_iob[2]) #define stdaux (&_iob[3]) #define stdprn (&_iob[4]) -void clearerr(FILE *_stream); -int fclose(FILE *_stream); -int feof(FILE *_stream); -int ferror(FILE *_stream); -int fflush(FILE *_stream); -int fgetc(FILE *_stream); -int fgetpos(FILE *_stream, fpos_t *_pos); -char * fgets(char *_s, int _n, FILE *_stream); -FILE * fopen(const char *_filename, const char *_mode); -int fprintf(FILE *_stream, const char *_format, ...); -int fputc(int _c, FILE *_stream); -int fputs(const char *_s, FILE *_stream); -size_t fread(void *_ptr, size_t _size, size_t _nelem, FILE *_stream); -FILE * freopen(const char *_filename, const char *_mode, FILE *_stream); -int fscanf(FILE *_stream, const char *_format, ...); -int fseek(FILE *_stream, long _offset, int _mode); -int fsetpos(FILE *_stream, const fpos_t *_pos); -long ftell(FILE *_stream); -size_t fwrite(const void *_ptr, size_t _size, size_t _nelem, FILE *_stream); -int getc(FILE *_stream); -int getchar(void); -char * gets(char *_s); -void perror(const char *_s); -int printf(const char *_format, ...); -int putc(int _c, FILE *_stream); -int putchar(int _c); -int puts(const char *_s); -int remove(const char *_filename); -int rename(const char *_old, const char *_new); -void rewind(FILE *_stream); -int scanf(const char *_format, ...); -void setbuf(FILE *_stream, char *_buf); -int setvbuf(FILE *_stream, char *_buf, int _mode, size_t _size); -int sprintf(char *_s, const char *_format, ...); -int sscanf(const char *_s, const char *_format, ...); -FILE * tmpfile(void); -char * tmpnam(char *_s); -char * _tmpnam(char *_s); -int ungetc(int _c, FILE *_stream); -int vfprintf(FILE *_stream, const char *_format, va_list _ap); -int vprintf(const char *_format, va_list _ap); -int vsprintf(char *_s, const char *_format, va_list _ap); +/* Returned by various functions on end of file condition or error. */ +#define EOF (-1) + + +/* + * The maximum length of a file name. You should use GetVolumeInformation + * instead of this constant. But hey, this works. + * + * NOTE: This is used in the structure _finddata_t (see dir.h) so changing it + * is probably not a good idea. + */ +#define FILENAME_MAX (260) + +/* + * The maximum number of files that may be open at once. I have set this to + * a conservative number. The actual value may be higher. + */ +#define FOPEN_MAX (20) + + +/* + * File Operations + */ + +FILE* fopen (const char* szFileName, const char* szMode); +FILE* freopen (const char* szNewFileName, const char* szNewMode, + FILE* fileChangeAssociation); +int fflush (FILE* fileFlush); +int fclose (FILE* fileClose); +#define fcloseall _fcloseall +int remove (const char* szFileName); +int rename (const char* szOldFileName, const char* szNewFileName); +FILE* tmpfile (void); + +int _filbuf(FILE *f); +int _flsbuf(int c, FILE *f); +void _fwalk(void (*func)(FILE *)); // not exported +int _fcloseall( void ); + + +/* + * The maximum size of name (including NUL) that will be put in the user + * supplied buffer caName. + * NOTE: This has not been determined by experiment, but based on the + * maximum file name length above it is probably reasonable. I could be + * wrong... + */ +#define L_tmpnam (260) + +char* tmpnam (char caName[]); +char* _tempnam (const char *szDir, const char *szPfx); + +#ifndef _NO_OLDNAMES +#define tempnam _tempnam +#endif /* Not _NO_OLDNAMES */ + +/* + * The three possible buffering mode (nMode) values for setvbuf. + * NOTE: _IOFBF works, but _IOLBF seems to work like unbuffered... + * maybe I'm testing it wrong? + */ +#define _IOFBF 0 /* fully buffered */ +#define _IOLBF 1 /* line buffered */ +#define _IONBF 2 /* unbuffered */ + +int setvbuf (FILE* fileSetBuffer, char* caBuffer, int nMode, + size_t sizeBuffer); + + +/* + * The buffer size as used by setbuf such that it is equivalent to + * (void) setvbuf(fileSetBuffer, caBuffer, _IOFBF, BUFSIZ). + */ +#define BUFSIZ 512 + +void setbuf (FILE* fileSetBuffer, char* caBuffer); + +/* + * Pipe Operations + */ + +int _pclose (FILE* pipeClose); +FILE* _popen (const char* szPipeName, const char* szMode); + +#define popen _popen +#define pclose _pclose + +/* Wide character version */ +FILE* _wpopen (const wchar_t* szPipeName, const wchar_t* szMode); + +/* + * Formatted Output + */ + +int fprintf (FILE* filePrintTo, const char* szFormat, ...); +int printf (const char* szFormat, ...); +int sprintf (char* caBuffer, const char* szFormat, ...); +int vfprintf (FILE* filePrintTo, const char* szFormat, va_list varg); +int vprintf (const char* szFormat, va_list varg); +int vsprintf (char* caBuffer, const char* szFormat, va_list varg); + +/* Wide character versions */ +int fwprintf (FILE* filePrintTo, const wchar_t* wsFormat, ...); +int wprintf (const wchar_t* wsFormat, ...); +int swprintf (wchar_t* wcaBuffer, const wchar_t* wsFormat, ...); +int vfwprintf (FILE* filePrintTo, const wchar_t* wsFormat, va_list varg); +int vwprintf (const wchar_t* wsFormat, va_list varg); +int vswprintf (wchar_t* wcaBuffer, const wchar_t* wsFormat, va_list varg); + +/* + * Formatted Input + */ + +int fscanf (FILE* fileReadFrom, const char* szFormat, ...); +int scanf (const char* szFormat, ...); +int sscanf (const char* szReadFrom, const char* szFormat, ...); + +/* Wide character versions */ +int fwscanf (FILE* fileReadFrom, const wchar_t* wsFormat, ...); +int wscanf (const wchar_t* wsFormat, ...); +int swscanf (const wchar_t* wsReadFrom, const wchar_t* wsFormat, ...); + +/* + * Character Input and Output Functions + */ + +int fgetc (FILE* fileRead); +char* fgets (char* caBuffer, int nBufferSize, FILE* fileRead); +int fputc (int c, FILE* fileWrite); +int fputs (const char* szOutput, FILE* fileWrite); +int getc (FILE* fileRead); +int getchar (void); +char* gets (char* caBuffer); /* Unsafe: how does gets know how long the + * buffer is? */ +int putc (int c, FILE* fileWrite); +int putchar (int c); +int puts (const char* szOutput); +int ungetc (int c, FILE* fileWasRead); + +/* Wide character versions */ +int fgetwc (FILE* fileRead); +int fputwc (wchar_t wc, FILE* fileWrite); +int ungetwc (wchar_t wc, FILE* fileWasRead); + +/* + * Not exported by CRTDLL.DLL included for reference purposes. + */ +#if 0 +wchar_t* fgetws (wchar_t* wcaBuffer, int nBufferSize, FILE* fileRead); +int fputws (const wchar_t* wsOutput, FILE* fileWrite); +int getwc (FILE* fileRead); +int getwchar (); +wchar_t* getws (wchar_t* wcaBuffer); +int putwc (wchar_t wc, FILE* fileWrite); +int putws (const wchar_t* wsOutput); +#endif /* 0 */ + +/* NOTE: putchar has no wide char equivalent even in tchar.h */ + + +/* + * Direct Input and Output Functions + */ + +size_t fread (void* pBuffer, size_t sizeObject, size_t sizeObjCount, + FILE* fileRead); +size_t fwrite (const void* pObjArray, size_t sizeObject, size_t sizeObjCount, + FILE* fileWrite); + + +/* + * File Positioning Functions + */ + +/* Constants for nOrigin indicating the position relative to which fseek + * sets the file position. Enclosed in ifdefs because io.h could also + * define them. (Though not anymore since io.h includes this file now.) */ +#ifndef SEEK_SET +#define SEEK_SET (0) +#endif + +#ifndef SEEK_CUR +#define SEEK_CUR (1) +#endif + +#ifndef SEEK_END +#define SEEK_END (2) +#endif + +int fseek (FILE* fileSetPosition, long lnOffset, int nOrigin); +long ftell (FILE* fileGetPosition); +void rewind (FILE* fileRewind); + +/* + * An opaque data type used for storing file positions... The contents of + * this type are unknown, but we (the compiler) need to know the size + * because the programmer using fgetpos and fsetpos will be setting aside + * storage for fpos_t structres. Actually I tested using a byte array and + * it is fairly evident that the fpos_t type is a long (in CRTDLL.DLL). + * Perhaps an unsigned long? TODO? + */ +typedef long fpos_t; + +int fgetpos (FILE* fileGetPosition, fpos_t* pfpos); +int fsetpos (FILE* fileSetPosition, const fpos_t* pfpos); + + +/* + * Error Functions + */ +#if 0 +void clearerr (FILE* fileClearErrors); +int feof (FILE* fileIsAtEnd); +int ferror (FILE* fileIsError); +void perror (const char* szErrorMessage); + +#endif + +#define clearerr(f) (((f)->_flag) &= ~(_IOERR|_IOEOF)) +#define feof(f) (((f)->_flag&_IOEOF)!=0) +#define ferror(f) (((f)->_flag&_IOERR)!=0) +#define perror(s) (fprintf(stderr, "%s: %s\n", (s), _strerror(NULL))) +/* + * Non ANSI functions + */ #ifndef __STRICT_ANSI__ +int _fgetchar (void); +int _fputchar (int c); +FILE* _fdopen (int nHandle, char* szMode); -#define L_ctermid -#define L_cusrid -/* #define STREAM_MAX 20 - DOS can change this */ +#ifndef _NO_OLDNAMES +#define fgetchar _fgetchar +#define fputchar _fputchar +#define fdopen _fdopen +#endif /* Not _NO_OLDNAMES */ -int fileno(FILE *_stream); -int _fileno(FILE *_stream); -FILE * fdopen(int _fildes, const char *_type); -int pclose(FILE *_pf); -FILE * popen(const char *_command, const char *_mode); - -#ifndef _POSIX_SOURCE - -void _djstat_describe_lossage(FILE *_to_where); -int _doprnt(const char *_fmt, va_list _args, FILE *_f); -int _doscan(FILE *_f, const char *_fmt, void **_argp); -int _doscan_low(FILE *, int (*)(FILE *_get), int (*_unget)(int, FILE *), const char *_fmt, void **_argp); -int fpurge(FILE *_f); -int getw(FILE *_f); -int mkstemp(char *_template); -char * mktemp(char *_template); -int putw(int _v, FILE *_f); -void setbuffer(FILE *_f, void *_buf, int _size); -void setlinebuf(FILE *_f); -char * tempnam(const char *_dir, const char *_prefix); -int _rename(const char *_old, const char *_new); /* Simple (no directory) */ - -#endif /* !_POSIX_SOURCE */ -#endif /* !__STRICT_ANSI__ */ -#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */ - -#ifndef __dj_ENFORCE_FUNCTION_CALLS -#endif /* !__dj_ENFORCE_FUNCTION_CALLS */ +#endif /* Not __STRICT_ANSI__ */ #ifdef __cplusplus } #endif -#endif /* !__dj_include_stdio_h_ */ +#endif /* _STDIO_H_ */ diff --git a/reactos/include/crtdll/stdlib.h b/reactos/include/crtdll/stdlib.h index 953255a18d2..f46138daad6 100644 --- a/reactos/include/crtdll/stdlib.h +++ b/reactos/include/crtdll/stdlib.h @@ -18,13 +18,15 @@ * DISCLAMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.2 $ - * $Author: rex $ - * $Date: 1999/03/19 05:55:09 $ + * $Revision: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ * */ /* Appropriated for Reactos Crtdll by Ariadne */ /* added splitpath */ +/* changed definition of environ and argc */ +/* moved prototype for swab from string.h to stdlib.h */ #ifndef _STDLIB_H_ #define _STDLIB_H_ @@ -38,21 +40,26 @@ extern "C" { * argc and argv. environ is a pointer to a table of environment variables. * NOTE: Strings in _argv and environ are ANSI strings. */ -extern int _argc; -extern char** _argv; -extern char** environ; +extern int* __argc_dll; +extern char*** __argv_dll; +extern char*** _environ_dll; +#define __argc (*__argc_dll) +#define __argv (*__argv_dll) +#define _environ (*_environ_dll) #define __need_size_t #define __need_wchar_t #define __need_NULL -#include +#include +#ifndef __ATTRIB_NORETURN #ifdef __GNUC__ #define _ATTRIB_NORETURN __attribute__ ((noreturn)) #else /* Not __GNUC__ */ #define _ATTRIB_NORETURN #endif /* __GNUC__ */ +#endif double atof (const char* szNumber); int atoi (const char* szNumber); @@ -97,7 +104,7 @@ void free (void* pObject); #define EXIT_SUCCESS 0 #define EXIT_FAILURE -1 -void abort (void) _ATTRIB_NORETURN; +void abort (void) _ATTRIB_NORETURN; void exit (int nStatus) _ATTRIB_NORETURN; int atexit (void (*pfuncExitProcessing)(void)); @@ -159,6 +166,8 @@ char* _gcvt (double dValue, int nDec, char* caBuf); char* _fullpath (char* caBuf, const char* szPath, size_t sizeMax); +void _swab (const char* caFrom, char* caTo, size_t sizeToCopy); + #ifndef _NO_OLDNAMES #define beep _beep #define seterrormode _seterrormode @@ -173,6 +182,8 @@ char* _fullpath (char* caBuf, const char* szPath, size_t sizeMax); #define ecvt _ecvt #define fcvt _fcvt #define gcvt _gcvt + +#define swab _swab #endif /* Not _NO_OLDNAMES */ #endif /* Not __STRICT_ANSI__ */ diff --git a/reactos/include/crtdll/string.h b/reactos/include/crtdll/string.h new file mode 100644 index 00000000000..7244484d64e --- /dev/null +++ b/reactos/include/crtdll/string.h @@ -0,0 +1,922 @@ +/* + * string.h + * + * Definitions for memory and string functions. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters + * + * 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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.1 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ + * + */ +/* Appropriated for Reactos Crtdll by Ariadne */ +/* changed prototype for _strerror */ +/* moved prototype for swab from string.h to stdlib.h */ +#ifndef _LINUX_WSTRING_H_ +#define _LINUX_WSTRING_H_ + +#ifndef _LINUX_STRING_H_ +#define _LINUX_STRING_H_ + +#ifndef _STRING_H_ +#define _STRING_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Define size_t, wchar_t and NULL + */ +#define __need_size_t +#define __need_wchar_t +#define __need_NULL +#include + +char * ___strtok; // removed extern specifier 02-06-98, BD + +/* + * Prototypes of the ANSI Standard C library string functions. + */ +void* memchr (const void* p, int cSearchFor, size_t sizeSearch); +int memcmp (const void* p1, const void* p2, size_t sizeSearch); +void* memcpy (void* pCopyTo, const void* pSource, size_t sizeSource); +void* memmove (void* pMoveTo, const void* pSource, size_t sizeSource); +void* memset (void* p, int cFill, size_t sizeRepeatCount); +char* strcat (char* szAddTo, const char* szAdd); +char* strchr (const char* szSearch, int cFor); +int strcmp (const char* sz1, const char* sz2); +int strcoll (const char* sz1, const char* sz2); /* Compare using locale */ +char* strcpy (char* szCopyTo, const char* szSource); +size_t strcspn (const char* szGetPrefix, const char* szNotIncluding); +char* strerror (int nError); /* NOTE: NOT an old name wrapper. */ +char * _strerror(const char *s); +size_t strlen (const char* sz); +char* strncat (char* szAddTo, const char* szAdd, size_t sizeMaxAdd); +int strncmp (const char* sz1, const char* sz2, size_t sizeMaxCompare); +char* strncpy (char* szCopyTo, const char* szSource, size_t sizeMaxCopy); +char* strpbrk (const char* szSearch, const char* szAnyOf); +char* strrchr (const char* szSearch, int cFor); +size_t strspn (const char* szGetPrefix, const char *szIncluding); +char* strstr (const char* szSearch, const char *szFor); +char* strtok (char* szTokenize, const char* szDelimiters); +size_t strxfrm (char* szTransformed, const char *szSource, + size_t sizeTransform); + +#ifndef __STRICT_ANSI__ +/* + * Extra non-ANSI functions provided by the CRTDLL library + */ +void* _memccpy (void* pCopyTo, const void* pSource, int cTerminator, + size_t sizeMaxCopy); +int _memicmp (const void* p1, const void* p2, size_t sizeSearch); +char* _strdup (const char *szDuplicate); +int _strcmpi (const char* sz1, const char* sz2); +int _stricmp (const char* sz1, const char* sz2); +int _stricoll (const char* sz1, const char* sz2); +char* _strlwr (char* szToConvert); +int _strnicmp (const char* sz1, const char* sz2, + size_t sizeMaxCompare); +char* _strnset (char* szToFill, int cFill, size_t sizeMaxFill); +char* _strrev (char* szToReverse); +char* _strset (char* szToFill, int cFill); +char* _strupr (char* szToConvert); + + +#endif /* Not __STRICT_ANSI__ */ + + +/* + * Unicode versions of the standard calls. + */ +wchar_t* wcscat (wchar_t* wsAddTo, const wchar_t* wsAdd); +wchar_t* wcschr (const wchar_t* wsSearch, wchar_t wcFor); +int wcscmp (const wchar_t* ws1, const wchar_t* ws2); +int wcscoll (const wchar_t* ws1, const wchar_t* ws2); +wchar_t* wcscpy (wchar_t* wsCopyTo, const wchar_t* wsSource); +size_t wcscspn (const wchar_t* wsGetPrefix, const wchar_t* wsNotIncluding); +/* Note: No wcserror in CRTDLL. */ +size_t wcslen (const wchar_t* ws); +wchar_t* wcsncat (wchar_t* wsAddTo, const wchar_t* wsAdd, size_t sizeMaxAdd); +int wcsncmp(const wchar_t* ws1, const wchar_t* ws2, size_t sizeMaxCompare); +wchar_t* wcsncpy(wchar_t* wsCopyTo, const wchar_t* wsSource, + size_t sizeMaxCopy); +wchar_t* wcspbrk(const wchar_t* wsSearch, const wchar_t* wsAnyOf); +wchar_t* wcsrchr(const wchar_t* wsSearch, wchar_t wcFor); +size_t wcsspn(const wchar_t* wsGetPrefix, const wchar_t* wsIncluding); +wchar_t* wcsstr(const wchar_t* wsSearch, const wchar_t* wsFor); +wchar_t* wcstok(wchar_t* wsTokenize, const wchar_t* wsDelimiters); +size_t wcsxfrm(wchar_t* wsTransformed, const wchar_t *wsSource, + size_t sizeTransform); + + +#ifndef __STRICT_ANSI__ +/* + * Unicode versions of non-ANSI functions provided by CRTDLL. + */ + +/* NOTE: _wcscmpi not provided by CRTDLL, this define is for portability */ +#define _wcscmpi _wcsicmp + +wchar_t* _wcsdup (const wchar_t* wsToDuplicate); +int _wcsicmp (const wchar_t* ws1, const wchar_t* ws2); +int _wcsicoll (const wchar_t* ws1, const wchar_t* ws2); +wchar_t* _wcslwr (wchar_t* wsToConvert); +int _wcsnicmp (const wchar_t* ws1, const wchar_t* ws2, + size_t sizeMaxCompare); +wchar_t* _wcsnset (wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill); +wchar_t* _wcsrev (wchar_t* wsToReverse); +wchar_t* _wcsset (wchar_t* wsToFill, wchar_t wcToFill); +wchar_t* _wcsupr (wchar_t* wsToConvert); + +#endif /* Not __STRICT_ANSI__ */ + + +#ifndef __STRICT_ANSI__ +#ifndef _NO_OLDNAMES + +/* + * Non-underscored versions of non-ANSI functions. They live in liboldnames.a + * and provide a little extra portability. Also a few extra UNIX-isms like + * strcasecmp. + */ + +void* memccpy (void* pCopyTo, const void* pSource, int cTerminator, + size_t sizeMaxCopy); +int memicmp (const void* p1, const void* p2, size_t sizeSearch); +#define strdup(szDuplicate) _strdup(szDuplicate) +int strcmpi (const char* sz1, const char* sz2); +int stricmp (const char* sz1, const char* sz2); +int strcasecmp (const char* sz1, const char* sz2); +int stricoll (const char* sz1, const char* sz2); +char* strlwr (char* szToConvert); +int strnicmp (const char* sz1, const char* sz2, size_t sizeMaxCompare); +int strncasecmp (const char* sz1, const char* sz2, size_t sizeMaxCompare); +char* strnset (char* szToFill, int cFill, size_t sizeMaxFill); +char* strrev (char* szToReverse); +char* strset (char* szToFill, int cFill); +char* strupr (char* szToConvert); + + +/* NOTE: There is no _wcscmpi, but this is for compatibility. */ +int wcscmpi (const wchar_t* ws1, const wchar_t* ws2); +wchar_t* wcsdup (const wchar_t* wsToDuplicate); +int wcsicmp (const wchar_t* ws1, const wchar_t* ws2); +int wcsicoll (const wchar_t* ws1, const wchar_t* ws2); +wchar_t* wcslwr (wchar_t* wsToConvert); +int wcsnicmp (const wchar_t* ws1, const wchar_t* ws2, + size_t sizeMaxCompare); +wchar_t* wcsnset (wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill); +wchar_t* wcsrev (wchar_t* wsToReverse); +wchar_t* wcsset (wchar_t* wsToFill, wchar_t wcToFill); +wchar_t* wcsupr (wchar_t* wsToConvert); + +#endif /* Not _NO_OLDNAMES */ +#endif /* Not strict ANSI */ + + + +/* + * Include machine specific inline routines + */ +#ifndef _I386_STRING_H_ +#define _I386_STRING_H_ + +/* + * On a 486 or Pentium, we are better off not using the + * byte string operations. But on a 386 or a PPro the + * byte string ops are faster than doing it by hand + * (MUCH faster on a Pentium). + * + * Also, the byte strings actually work correctly. Forget + * the i486 routines for now as they may be broken.. + */ +#if FIXED_486_STRING && (CPU == 486 || CPU == 586) + #include +#else + +/* + * This string-include defines all string functions as inline + * functions. Use gcc. It also assumes ds=es=data space, this should be + * normal. Most of the string-functions are rather heavily hand-optimized, + * see especially strtok,strstr,str[c]spn. They should work, but are not + * very easy to understand. Everything is done entirely within the register + * set, making the functions fast and clean. String instructions have been + * used through-out, making for "slightly" unclear code :-) + * + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#define __HAVE_ARCH_STRCPY +extern inline char * strcpy(char * dest,const char *src) +{ +__asm__ __volatile__( + "cld\n" + "1:\tlodsb\n\t" + "stosb\n\t" + "testb %%al,%%al\n\t" + "jne 1b" + : /* no output */ + :"S" (src),"D" (dest):"si","di","ax","memory"); +return dest; +} + +#define __HAVE_ARCH_STRNCPY +extern inline char * strncpy(char * dest,const char *src,size_t count) +{ +__asm__ __volatile__( + "cld\n" + "1:\tdecl %2\n\t" + "js 2f\n\t" + "lodsb\n\t" + "stosb\n\t" + "testb %%al,%%al\n\t" + "jne 1b\n\t" + "rep\n\t" + "stosb\n" + "2:" + : /* no output */ + :"S" (src),"D" (dest),"c" (count):"si","di","ax","cx","memory"); +return dest; +} + +#define __HAVE_ARCH_STRCAT +extern inline char * strcat(char * dest,const char * src) +{ +__asm__ __volatile__( + "cld\n\t" + "repne\n\t" + "scasb\n\t" + "decl %1\n" + "1:\tlodsb\n\t" + "stosb\n\t" + "testb %%al,%%al\n\t" + "jne 1b" + : /* no output */ + :"S" (src),"D" (dest),"a" (0),"c" (0xffffffff):"si","di","ax","cx"); +return dest; +} + +#define __HAVE_ARCH_STRNCAT +extern inline char * strncat(char * dest,const char * src,size_t count) +{ +__asm__ __volatile__( + "cld\n\t" + "repne\n\t" + "scasb\n\t" + "decl %1\n\t" + "movl %4,%3\n" + "1:\tdecl %3\n\t" + "js 2f\n\t" + "lodsb\n\t" + "stosb\n\t" + "testb %%al,%%al\n\t" + "jne 1b\n" + "2:\txorl %2,%2\n\t" + "stosb" + : /* no output */ + :"S" (src),"D" (dest),"a" (0),"c" (0xffffffff),"g" (count) + :"si","di","ax","cx","memory"); +return dest; +} + +#define __HAVE_ARCH_STRCMP +extern inline int strcmp(const char * cs,const char * ct) +{ +register int __res; +__asm__ __volatile__( + "cld\n" + "1:\tlodsb\n\t" + "scasb\n\t" + "jne 2f\n\t" + "testb %%al,%%al\n\t" + "jne 1b\n\t" + "xorl %%eax,%%eax\n\t" + "jmp 3f\n" + "2:\tsbbl %%eax,%%eax\n\t" + "orb $1,%%eax\n" + "3:" + :"=a" (__res):"S" (cs),"D" (ct):"si","di"); +return __res; +} + +#define __HAVE_ARCH_STRNCMP +extern inline int strncmp(const char * cs,const char * ct,size_t count) +{ +register int __res; +__asm__ __volatile__( + "cld\n" + "1:\tdecl %3\n\t" + "js 2f\n\t" + "lodsb\n\t" + "scasb\n\t" + "jne 3f\n\t" + "testb %%al,%%al\n\t" + "jne 1b\n" + "2:\txorl %%eax,%%eax\n\t" + "jmp 4f\n" + "3:\tsbbl %%eax,%%eax\n\t" + "orb $1,%%al\n" + "4:" + :"=a" (__res):"S" (cs),"D" (ct),"c" (count):"si","di","cx"); +return __res; +} + +#define __HAVE_ARCH_STRCHR +extern inline char * strchr(const char * s, int c) +{ +register char * __res; +__asm__ __volatile__( + "cld\n\t" + "movb %%al,%%ah\n" + "1:\tlodsb\n\t" + "cmpb %%ah,%%al\n\t" + "je 2f\n\t" + "testb %%al,%%al\n\t" + "jne 1b\n\t" + "movl $1,%1\n" + "2:\tmovl %1,%0\n\t" + "decl %0" + :"=a" (__res):"S" (s),"0" (c):"si"); +return __res; +} + +#define __HAVE_ARCH_STRRCHR +extern inline char * strrchr(const char * s, int c) +{ +register char * __res; +__asm__ __volatile__( + "cld\n\t" + "movb %%al,%%ah\n" + "1:\tlodsb\n\t" + "cmpb %%ah,%%al\n\t" + "jne 2f\n\t" + "leal -1(%%esi),%0\n" + "2:\ttestb %%al,%%al\n\t" + "jne 1b" + :"=d" (__res):"0" (0),"S" (s),"a" (c):"ax","si"); +return __res; +} + +#define __HAVE_ARCH_STRSPN +extern inline size_t strspn(const char * cs, const char * ct) +{ +register char * __res; +__asm__ __volatile__( + "cld\n\t" + "movl %4,%%edi\n\t" + "repne\n\t" + "scasb\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" + "movl %%ecx,%%edx\n" + "1:\tlodsb\n\t" + "testb %%al,%%al\n\t" + "je 2f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasb\n\t" + "je 1b\n" + "2:\tdecl %0" + :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct) + :"ax","cx","dx","di"); +return __res-cs; +} + +#define __HAVE_ARCH_STRCSPN +extern inline size_t strcspn(const char * cs, const char * ct) +{ +register char * __res; +__asm__ __volatile__( + "cld\n\t" + "movl %4,%%edi\n\t" + "repne\n\t" + "scasb\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" + "movl %%ecx,%%edx\n" + "1:\tlodsb\n\t" + "testb %%al,%%al\n\t" + "je 2f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasb\n\t" + "jne 1b\n" + "2:\tdecl %0" + :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct) + :"ax","cx","dx","di"); +return __res-cs; +} + +#define __HAVE_ARCH_STRPBRK +extern inline char * strpbrk(const char * cs,const char * ct) +{ +register char * __res; +__asm__ __volatile__( + "cld\n\t" + "movl %4,%%edi\n\t" + "repne\n\t" + "scasb\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" + "movl %%ecx,%%edx\n" + "1:\tlodsb\n\t" + "testb %%al,%%al\n\t" + "je 2f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasb\n\t" + "jne 1b\n\t" + "decl %0\n\t" + "jmp 3f\n" + "2:\txorl %0,%0\n" + "3:" + :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct) + :"ax","cx","dx","di"); +return __res; +} + +#define __HAVE_ARCH_STRSTR +extern inline char * strstr(const char * cs,const char * ct) +{ +register char * __res; +__asm__ __volatile__( + "cld\n\t" \ + "movl %4,%%edi\n\t" + "repne\n\t" + "scasb\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */ + "movl %%ecx,%%edx\n" + "1:\tmovl %4,%%edi\n\t" + "movl %%esi,%%eax\n\t" + "movl %%edx,%%ecx\n\t" + "repe\n\t" + "cmpsb\n\t" + "je 2f\n\t" /* also works for empty string, see above */ + "xchgl %%eax,%%esi\n\t" + "incl %%esi\n\t" + "cmpb $0,-1(%%eax)\n\t" + "jne 1b\n\t" + "xorl %%eax,%%eax\n\t" + "2:" + :"=a" (__res):"0" (0),"c" (0xffffffff),"S" (cs),"g" (ct) + :"cx","dx","di","si"); +return __res; +} + +#define __HAVE_ARCH_STRLEN +extern inline size_t strlen(const char * s) +{ +register int __res; +__asm__ __volatile__( + "cld\n\t" + "repne\n\t" + "scasb\n\t" + "notl %0\n\t" + "decl %0" + :"=c" (__res):"D" (s),"a" (0),"0" (0xffffffff):"di"); +return __res; +} + +#define __HAVE_ARCH_STRTOK +extern inline char * strtok(char * s,const char * ct) +{ +register char * __res; +__asm__ __volatile__( + "testl %1,%1\n\t" + "jne 1f\n\t" + "testl %0,%0\n\t" + "je 8f\n\t" + "movl %0,%1\n" + "1:\txorl %0,%0\n\t" + "movl $-1,%%ecx\n\t" + "xorl %%eax,%%eax\n\t" + "cld\n\t" + "movl %4,%%edi\n\t" + "repne\n\t" + "scasb\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" + "je 7f\n\t" /* empty delimiter-string */ + "movl %%ecx,%%edx\n" + "2:\tlodsb\n\t" + "testb %%al,%%al\n\t" + "je 7f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasb\n\t" + "je 2b\n\t" + "decl %1\n\t" + "cmpb $0,(%1)\n\t" + "je 7f\n\t" + "movl %1,%0\n" + "3:\tlodsb\n\t" + "testb %%al,%%al\n\t" + "je 5f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasb\n\t" + "jne 3b\n\t" + "decl %1\n\t" + "cmpb $0,(%1)\n\t" + "je 5f\n\t" + "movb $0,(%1)\n\t" + "incl %1\n\t" + "jmp 6f\n" + "5:\txorl %1,%1\n" + "6:\tcmpb $0,(%0)\n\t" + "jne 7f\n\t" + "xorl %0,%0\n" + "7:\ttestl %0,%0\n\t" + "jne 8f\n\t" + "movl %0,%1\n" + "8:" + :"=b" (__res),"=S" (___strtok) + :"0" (___strtok),"1" (s),"g" (ct) + :"ax","cx","dx","di","memory"); +return __res; +} + + +#define __HAVE_ARCH_STRICMP +extern inline int stricmp(const char* cs,const char * ct) +{ +register int __res; + + +__asm__ __volatile__( + "cld\n" + "1:\tmovb (%%esi), %%eax\n\t" + "movb (%%edi), %%dl \n\t" + "cmpb $0x5A, %%al\n\t" + "ja 2f\t\n" + "cmpb $0x40, %%al\t\n" + "jbe 2f\t\n" + "addb $0x20, %%al\t\n" + "2:\t cmpb $0x5A, %%dl\t\n" + "ja 3f\t\n" + "cmpb $0x40, %%dl\t\n" + "jbe 3f\t\n" + "addb $0x20, %%dl\t\n" + "3:\t inc %%esi\t\n" + "inc %%edi\t\n" + "cmpb %%al, %%dl\t\n" + "jne 4f\n\t" + "cmpb $00, %%al\n\t" + "jne 1b\n\t" + "xorl %%eax,%%eax\n\t" + "jmp 5f\n" + "4:\tsbbl %%eax,%%eax\n\t" + "orb $1,%%eax\n" + "5:" + :"=a" (__res):"S" (cs),"D" (ct):"si","di"); + +return __res; +} + + +#define __HAVE_ARCH_STRNICMP +extern inline int strnicmp(const char* cs,const char * ct, size_t count) +{ +register int __res; + + +__asm__ __volatile__( + "cld\n" + "1:\t decl %3\n\t" + "js 6f\n\t" + "movb (%%esi), %%al\n\t" + "movb (%%edi), %%dl \n\t" + "cmpb $0x5A, %%al\n\t" + "ja 2f\t\n" + "cmpb $0x40, %%al\t\n" + "jbe 2f\t\n" + "addb $0x20, %%al\t\n" + "2:\t cmpb $0x5A, %%dl\t\n" + "ja 3f\t\n" + "cmpb $0x40, %%dl\t\n" + "jbe 3f\t\n" + "addb $0x20, %%dl\t\n" + "3:\t inc %%esi\t\n" + "inc %%edi\t\n" + "cmpb %%al, %%dl\t\n" + "jne 4f\n\t" + "cmpb $00, %%al\n\t" + "jne 1b\n\t" + "6:xorl %%eax,%%eax\n\t" + "jmp 5f\n" + "4:\tsbbl %%eax,%%eax\n\t" + "orb $1,%%eax\n" + "5:" + :"=a" (__res):"S" (cs),"D" (ct), "c" (count):"si","di", "cx"); + + +return __res; +} + + + + + + +extern inline void * __memcpy(void * to, const void * from, size_t n) +{ +__asm__ __volatile__( + "cld\n\t" + "rep ; movsl\n\t" + "testb $2,%b1\n\t" + "je 1f\n\t" + "movsw\n" + "1:\ttestb $1,%b1\n\t" + "je 2f\n\t" + "movsb\n" + "2:" + : /* no output */ + :"c" (n/4), "q" (n),"D" ((long) to),"S" ((long) from) + : "cx","di","si","memory"); +return (to); +} + +/* + * This looks horribly ugly, but the compiler can optimize it totally, + * as the count is constant. + */ +extern inline void * __constant_memcpy(void * to, const void * from, size_t n) +{ + switch (n) { + case 0: + return to; + case 1: + *(unsigned char *)to = *(const unsigned char *)from; + return to; + case 2: + *(unsigned short *)to = *(const unsigned short *)from; + return to; + case 3: + *(unsigned short *)to = *(const unsigned short *)from; + *(2+(unsigned char *)to) = *(2+(const unsigned char *)from); + return to; + case 4: + *(unsigned long *)to = *(const unsigned long *)from; + return to; + case 8: + *(unsigned long *)to = *(const unsigned long *)from; + *(1+(unsigned long *)to) = *(1+(const unsigned long *)from); + return to; + case 12: + *(unsigned long *)to = *(const unsigned long *)from; + *(1+(unsigned long *)to) = *(1+(const unsigned long *)from); + *(2+(unsigned long *)to) = *(2+(const unsigned long *)from); + return to; + case 16: + *(unsigned long *)to = *(const unsigned long *)from; + *(1+(unsigned long *)to) = *(1+(const unsigned long *)from); + *(2+(unsigned long *)to) = *(2+(const unsigned long *)from); + *(3+(unsigned long *)to) = *(3+(const unsigned long *)from); + return to; + case 20: + *(unsigned long *)to = *(const unsigned long *)from; + *(1+(unsigned long *)to) = *(1+(const unsigned long *)from); + *(2+(unsigned long *)to) = *(2+(const unsigned long *)from); + *(3+(unsigned long *)to) = *(3+(const unsigned long *)from); + *(4+(unsigned long *)to) = *(4+(const unsigned long *)from); + return to; + } +#define COMMON(x) \ +__asm__("cld\n\t" \ + "rep ; movsl" \ + x \ + : /* no outputs */ \ + : "c" (n/4),"D" ((long) to),"S" ((long) from) \ + : "cx","di","si","memory"); + + switch (n % 4) { + case 0: COMMON(""); return to; + case 1: COMMON("\n\tmovsb"); return to; + case 2: COMMON("\n\tmovsw"); return to; + case 3: COMMON("\n\tmovsw\n\tmovsb"); return to; + } +#undef COMMON +} + +#define __HAVE_ARCH_MEMCPY +#define memcpy(t, f, n) \ +(__builtin_constant_p(n) ? \ + __constant_memcpy((t),(f),(n)) : \ + __memcpy((t),(f),(n))) + +#define __HAVE_ARCH_MEMMOVE +extern inline void * memmove(void * dest,const void * src, size_t n) +{ +if (dest= 8 && __GNUC__ == 2 ) || __GNUC__ >= 3 ) -/* wchar_t is now a keyword in C++ */ -#define __DJ_wchar_t -#else -/* but remains a typedef in C */ -#define __DJ_wchar_t typedef int wchar_t; -#endif - -#define __DJ_wint_t typedef int wint_t; - -#endif diff --git a/reactos/include/crtdll/sys/fcntl.h b/reactos/include/crtdll/sys/fcntl.h new file mode 100644 index 00000000000..b343f272f4a --- /dev/null +++ b/reactos/include/crtdll/sys/fcntl.h @@ -0,0 +1,8 @@ +/* + * This file is part of the Mingw32 package. + * + * This fcntl.h maps to the root fcntl.h + */ +#ifndef __STRICT_ANSI__ +#include +#endif diff --git a/reactos/include/crtdll/sys/file.h b/reactos/include/crtdll/sys/file.h new file mode 100644 index 00000000000..96c49e1174c --- /dev/null +++ b/reactos/include/crtdll/sys/file.h @@ -0,0 +1,9 @@ +/* + * This file is part of the Mingw32 package. + * + * This file.h maps to the root fcntl.h + * TODO? + */ +#ifndef __STRICT_ANSI__ +#include +#endif diff --git a/reactos/include/crtdll/sys/locking.h b/reactos/include/crtdll/sys/locking.h new file mode 100644 index 00000000000..89e6bfdb1b9 --- /dev/null +++ b/reactos/include/crtdll/sys/locking.h @@ -0,0 +1,38 @@ +/* + * locking.h + * + * Constants for the mode parameter of the locking function. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters + * + * 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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.1 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:07 $ + * + */ + +#ifndef __STRICT_ANSI__ + +#ifndef _LOCKING_H_ +#define _LOCKING_H_ + +/* + * TODO: Define LK_... constants. + */ + +#endif /* Not _LOCKING_H_ */ + +#endif /* Not __STRICT_ANSI__ */ diff --git a/reactos/include/crtdll/sys/stat.h b/reactos/include/crtdll/sys/stat.h index 134fd7c9c55..d27448c72a6 100644 --- a/reactos/include/crtdll/sys/stat.h +++ b/reactos/include/crtdll/sys/stat.h @@ -1,128 +1,114 @@ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#ifndef __dj_include_sys_stat_h_ -#define __dj_include_sys_stat_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __dj_ENFORCE_ANSI_FREESTANDING +/* + * stat.h + * + * Symbolic constants for opening and creating files, also stat, fstat and + * chmod functions. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters + * + * 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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:07 $ + * + */ #ifndef __STRICT_ANSI__ -#define S_ISBLK(m) (((m) & 0xf000) == 0x1000) -#define S_ISCHR(m) (((m) & 0xf000) == 0x2000) -#define S_ISDIR(m) (((m) & 0xf000) == 0x3000) -#define S_ISFIFO(m) (((m) & 0xf000) == 0x4000) -#define S_ISREG(m) (((m) & 0xf000) == 0x0000) +#ifndef _STAT_H_ +#define _STAT_H_ -#define S_ISUID 0x80000000 -#define S_ISGID 0x40000000 +#include -#define S_IRUSR 00400 -#define S_IRGRP 00040 -#define S_IROTH 00004 -#define S_IWUSR 00200 -#define S_IWGRP 00020 -#define S_IWOTH 00002 -#define S_IXUSR 00100 -#define S_IXGRP 00010 -#define S_IXOTH 00001 -#define S_IRWXU 00700 -#define S_IRWXG 00070 -#define S_IRWXO 00007 +#ifdef __cplusplus +extern "C" { +#endif -#include -#include -//#include -__DJ_time_t -#undef __DJ_time_t -#define __DJ_time_t +/* + * Constants for the stat st_mode member. + */ +#define S_IFIFO 0x1000 /* FIFO */ +#define S_IFCHR 0x2000 /* Character */ +#define S_IFBLK 0x3000 /* Block */ +#define S_IFDIR 0x4000 /* Directory */ +#define S_IFREG 0x8000 /* Regular */ -struct stat { - time_t st_atime; - time_t st_ctime; - dev_t st_dev; - gid_t st_gid; - ino_t st_ino; - mode_t st_mode; - time_t st_mtime; - nlink_t st_nlink; - off_t st_size; - off_t st_blksize; - uid_t st_uid; - dev_t st_rdev; /* unused */ +#define S_IFMT 0xF000 /* File type mask */ + +#define S_IEXEC 0x0040 +#define S_IWRITE 0x0080 +#define S_IREAD 0x0100 + +#define S_ISDIR(m) ((m) & S_IFDIR) +#define S_ISFIFO(m) ((m) & S_IFIFO) +#define S_ISCHR(m) ((m) & S_IFCHR) +#define S_ISBLK(m) ((m) & S_IFBLK) +#define S_ISREG(m) ((m) & S_IFREG) + +#define S_IRWXU (S_IREAD | S_IWRITE | S_IEXEC) +#define S_IXUSR S_IEXEC +#define S_IWUSR S_IWRITE +#define S_IRUSR S_IREAD + +#define _S_IEXEC S_IEXEC +#define _S_IREAD S_IREAD +#define _S_IWRITE S_IWRITE + +/* + * The structure manipulated and returned by stat and fstat. + * + * NOTE: If called on a directory the values in the time fields are not only + * invalid, they will cause localtime et. al. to return NULL. And calling + * asctime with a NULL pointer causes an Invalid Page Fault. So watch it! + */ +struct stat +{ + short st_dev; /* Equivalent to drive number 0=A 1=B ... */ + short st_ino; /* Always zero ? */ + short st_mode; /* See above constants */ + short st_nlink; /* Number of links. */ + int st_uid; /* User: Maybe significant on NT ? */ + short st_gid; /* Group: Ditto */ + short st_rdev; /* Seems useless (not even filled in) */ + long st_size; /* File size in bytes */ + time_t st_atime; /* Accessed date (always 00:00 hrs local + * on FAT) */ + time_t st_mtime; /* Modified time */ + time_t st_ctime; /* Creation time */ }; -int chmod(const char *_path, mode_t _mode); -int fstat(int _fildes, struct stat *_buf); -//int mkdir(const char *_path, mode_t _mode); -int mkfifo(const char *_path, mode_t _mode); -int stat(const char *_path, struct stat *_buf); -mode_t umask(mode_t _cmask); -#ifndef _POSIX_SOURCE +int _fstat (int nHandle, struct stat* pstat); +int _chmod (const char* szPath, int nMode); +int _stat (const char* szPath, struct stat* pstat); -/* POSIX.1 doesn't mention these at all */ -#define S_IFMT 0xf000 +#ifndef _NO_OLDNAMES -#define S_IFREG 0x0000 -#define S_IFBLK 0x1000 -#define S_IFCHR 0x2000 -#define S_IFDIR 0x3000 -#define S_IFIFO 0x4000 -#define S_IFFIFO S_IFIFO +/* These functions live in liboldnames.a. */ +int fstat (int nHandle, struct stat* pstat); +int chmod (const char* szPath, int nMode); +int stat (const char* szPath, struct stat* pstat); -#define S_IFLABEL 0x5000 -#define S_ISLABEL(m) (((m) & 0xf000) == 0x5000) +#endif /* Not _NO_OLDNAMES */ -void _fixpath(const char *, char *); -unsigned short _get_magic(const char *, int); -int _is_executable(const char *, int, const char *); -int mknod(const char *_path, mode_t _mode, dev_t _dev); -char * _truename(const char *, char *); -/* Bit-mapped variable _djstat_flags describes what expensive - f?stat() features our application needs. If you don't need a - feature, set its bit in the variable. By default, all the - bits are cleared (i.e., you get the most expensive code). */ -#define _STAT_INODE 1 /* should we bother getting inode numbers? */ -#define _STAT_EXEC_EXT 2 /* get execute bits from file extension? */ -#define _STAT_EXEC_MAGIC 4 /* get execute bits from magic signature? */ -#define _STAT_DIRSIZE 8 /* compute directory size? */ -#define _STAT_ROOT_TIME 0x10 /* try to get root dir time stamp? */ -#define _STAT_WRITEBIT 0x20 /* fstat() needs write bit? */ - -extern unsigned short _djstat_flags; - -/* Bit-mapped variable _djstat_fail_bits describes which individual - undocumented features f?stat() failed to use. To get a human- - readable description of the bits, call _djstat_describe_lossage(). */ -#define _STFAIL_SDA 1 /* Get SDA call failed */ -#define _STFAIL_OSVER 2 /* Unsupported DOS version */ -#define _STFAIL_BADSDA 4 /* Bad pointer to SDA */ -#define _STFAIL_TRUENAME 8 /* _truename() failed */ -#define _STFAIL_HASH 0x10 /* inode defaults to hashing */ -#define _STFAIL_LABEL 0x20 /* Root dir, but no volume label */ -#define _STFAIL_DCOUNT 0x40 /* dirent_count ridiculously large */ -#define _STFAIL_WRITEBIT 0x80 /* fstat() failed to get write access bit */ -#define _STFAIL_DEVNO 0x100 /* fstat() failed to get device number */ -#define _STFAIL_BADSFT 0x200 /* SFT entry found, but can't be trusted */ -#define _STFAIL_SFTIDX 0x400 /* bad SFT index in JFT */ -#define _STFAIL_SFTNF 0x800 /* file entry not found in SFT array */ - -extern unsigned short _djstat_fail_bits; - -#endif /* !_POSIX_SOURCE */ -#endif /* !__STRICT_ANSI__ */ -#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */ - -#ifndef __dj_ENFORCE_FUNCTION_CALLS -#endif /* !__dj_ENFORCE_FUNCTION_CALLS */ - -#ifdef __cplusplus +#ifdef __cplusplus } #endif -#endif /* !__dj_include_sys_stat_h_ */ +#endif /* Not _STAT_H_ */ + +#endif /* Not __STRICT_ANSI__ */ diff --git a/reactos/include/crtdll/sys/time.h b/reactos/include/crtdll/sys/time.h new file mode 100644 index 00000000000..39d85f67b5f --- /dev/null +++ b/reactos/include/crtdll/sys/time.h @@ -0,0 +1,3 @@ + +#include + diff --git a/reactos/include/crtdll/sys/timeb.h b/reactos/include/crtdll/sys/timeb.h new file mode 100644 index 00000000000..5970b07cbbc --- /dev/null +++ b/reactos/include/crtdll/sys/timeb.h @@ -0,0 +1,60 @@ +/* + * timeb.h + * + * Support for the UNIX System V ftime system call. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters + * + * 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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.1 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:07 $ + * + */ + +#ifndef __STRICT_ANSI__ + +#ifndef _TIMEB_H_ +#define _TIMEB_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * TODO: Structure not tested. + */ +struct timeb +{ + long time; + short millitm; + short _timezone; + short dstflag; +}; + +/* TODO: Not tested. */ +void _ftime (struct timeb* timebBuffer); + +#ifndef _NO_OLDNAMES +void ftime (struct timeb* timebBuffer); +#endif /* Not _NO_OLDNAMES */ + +#ifdef __cplusplus +} +#endif + +#endif /* Not _TIMEB_H_ */ + +#endif /* Not __STRICT_ANSI__ */ diff --git a/reactos/include/crtdll/sys/types.h b/reactos/include/crtdll/sys/types.h index 5c5df14b3ed..ed349b684c1 100644 --- a/reactos/include/crtdll/sys/types.h +++ b/reactos/include/crtdll/sys/types.h @@ -1,67 +1,77 @@ -/* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#ifndef __dj_include_sys_types_h_ -#define __dj_include_sys_types_h_ +/* + * types.h + * + * The definition of constants, data types and global variables. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters + * + * 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: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:07 $ + * + */ -#ifdef __cplusplus -extern "C" { +#ifndef _TYPES_H_ +#define _TYPES_H_ + +#ifndef _TIME_T_ +#define _TIME_T_ +typedef long time_t; #endif -#ifndef __dj_ENFORCE_ANSI_FREESTANDING -#ifndef __STRICT_ANSI__ +#ifndef __STRICT_ANSI__ -#include - -typedef int dev_t; -typedef int ino_t; -typedef int mode_t; -typedef int nlink_t; +#ifndef _OFF_T_DEFINED +typedef long _off_t; -__DJ_gid_t -#undef __DJ_gid_t -#define __DJ_gid_t -__DJ_off_t -#undef __DJ_off_t -#define __DJ_off_t -__DJ_pid_t -#undef __DJ_pid_t -#define __DJ_pid_t -//__DJ_size_t -#undef __DJ_size_t -#define __DJ_size_t -__DJ_ssize_t -#undef __DJ_ssize_t -#define __DJ_ssize_t -__DJ_uid_t -#undef __DJ_uid_t -#define __DJ_uid_t - -#ifndef _POSIX_SOURCE - -/* Allow including program to override. */ -#ifndef FD_SETSIZE -#define FD_SETSIZE 256 +#ifndef _NO_OLDNAMES +#define off_t _off_t #endif -typedef struct fd_set { - unsigned char fd_bits [((FD_SETSIZE) + 7) / 8]; -} fd_set; +#define _OFF_T_DEFINED -#define FD_SET(n, p) ((p)->fd_bits[(n) / 8] |= (1 << ((n) & 7))) -#define FD_CLR(n, p) ((p)->fd_bits[(n) / 8] &= ~(1 << ((n) & 7))) -#define FD_ISSET(n, p) ((p)->fd_bits[(n) / 8] & (1 << ((n) & 7))) -#define FD_ZERO(p) memset ((void *)(p), 0, sizeof (*(p))) +#endif /* Not _OFF_T_DEFINED */ -#endif /* !_POSIX_SOURCE */ -#endif /* !__STRICT_ANSI__ */ -#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */ -#ifndef __dj_ENFORCE_FUNCTION_CALLS -#endif /* !__dj_ENFORCE_FUNCTION_CALLS */ +#ifndef _DEV_T_DEFINED +typedef short _dev_t; -#ifdef __cplusplus -} +#ifndef _NO_OLDNAMES +#define dev_t _dev_t #endif -#endif /* !__dj_include_sys_types_h_ */ +#define _DEV_T_DEFINED + +#endif /* Not _DEV_T_DEFINED */ + + +#ifndef _INO_T_DEFINED +typedef short _ino_t; + +#ifndef _NO_OLDNAMES +#define ino_t _ino_t +#endif + +#define _INO_T_DEFINED + +#endif /* Not _INO_T_DEFINED */ + + +#endif /* Not __STRICT_ANSI__ */ + + +#endif /* Not _TYPES_H_ */ diff --git a/reactos/include/crtdll/sys/unistd.h b/reactos/include/crtdll/sys/unistd.h new file mode 100644 index 00000000000..ed122d9dd65 --- /dev/null +++ b/reactos/include/crtdll/sys/unistd.h @@ -0,0 +1,9 @@ +/* + * This file is part of the Mingw32 package. + * + * unistd.h maps (roughly) to io.h + */ +#ifndef __STRICT_ANSI__ +#include +#endif + diff --git a/reactos/include/crtdll/sys/utime.h b/reactos/include/crtdll/sys/utime.h new file mode 100644 index 00000000000..6d7f4e93dcc --- /dev/null +++ b/reactos/include/crtdll/sys/utime.h @@ -0,0 +1,75 @@ +/* + * utime.h + * + * Support for the utime function. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters + * + * 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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.1 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:07 $ + * + */ + +#ifndef __STRICT_ANSI__ + +#ifndef _UTIME_H_ +#define _UTIME_H_ + +#define __need_wchar_t +#define __need_size_t +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Structure used by _utime function. + */ +struct _utimbuf +{ + time_t actime; /* Access time */ + time_t modtime; /* Modification time */ +}; + +int _utime (const char* szFileName, struct _utimbuf* pTimes); +int _futime (int nHandle, struct _utimbuf *pTimes); + +/* Wide character version */ +int _wutime (const wchar_t *szFileName, struct _utimbuf *times); + +#ifndef _NO_OLDNAMES + +/* NOTE: Must be the same as _utimbuf above. */ +struct utimbuf +{ + time_t actime; + time_t modtime; +}; + +int utime (const char* szFileName, struct utimbuf* pTimes); + +#endif /* Not _NO_OLDNAMES */ + + +#ifdef __cplusplus +} +#endif + +#endif /* Not _UTIME_H_ */ +#endif /* Not __STRICT_ANSI__ */ diff --git a/reactos/include/crtdll/tchar.h b/reactos/include/crtdll/tchar.h new file mode 100644 index 00000000000..450d699dca2 --- /dev/null +++ b/reactos/include/crtdll/tchar.h @@ -0,0 +1,231 @@ +/* + * tchar.h + * + * Unicode mapping layer for the standard C library. By including this + * file and using the 't' names for string functions + * (eg. _tprintf) you can make code which can be easily adapted to both + * Unicode and non-unicode environments. In a unicode enabled compile define + * _UNICODE before including tchar.h, otherwise the standard non-unicode + * library functions will be used. + * + * Note that you still need to include string.h or stdlib.h etc. to define + * the appropriate functions. Also note that there are several defines + * included for non-ANSI functions which are commonly available (but using + * the convention of prepending an underscore to non-ANSI library function + * names). + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters + * + * 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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.1 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ + * + */ + +#ifndef _TCHAR_H_ +#define _TCHAR_H_ + +/* + * NOTE: This tests _UNICODE, which is different from the UNICODE define + * used to differentiate Win32 API calls. + */ +#ifdef _UNICODE + + +/* + * Use TCHAR instead of char or wchar_t. It will be appropriately translated + * if _UNICODE is correctly defined (or not). + */ +#ifndef _TCHAR_DEFINED +#ifndef RC_INVOKED +typedef wchar_t TCHAR; +#endif /* Not RC_INVOKED */ +#define _TCHAR_DEFINED +#endif + + +/* + * Enclose constant strings and literal characters in the _TEXT and _T macro to make + * them unicode constant strings when _UNICODE is defined. + */ +#define _TEXT(x) L ## x +#define _T(x) L ## x + +/* + * Unicode functions + */ + +#define _tprintf wprintf +#define _ftprintf fwprintf +#define _stprintf swprintf +#define _sntprintf _snwprintf +#define _vtprintf vwprintf +#define _vftprintf vfwprintf +#define _vstprintf vswprintf +#define _vsntprintf _vsnwprintf +#define _tscanf wscanf +#define _ftscanf fwscanf +#define _stscanf swscanf +#define _fgettc fgetwc +#define _fgettchar _fgetwchar +#define _fgetts fgetws +#define _fputtc fputwc +#define _fputtchar _fputwchar +#define _fputts fputws +#define _gettc getwc +#define _getts getws +#define _puttc putwc +#define _putts putws +#define _ungettc ungetwc +#define _tcstod wcstod +#define _tcstol wcstol +#define _tcstoul wcstoul +#define _tcscat wcscat +#define _tcschr wcschr +#define _tcscmp wcscmp +#define _tcscpy wcscpy +#define _tcscspn wcscspn +#define _tcslen wcslen +#define _tcsncat wcsncat +#define _tcsncmp wcsncmp +#define _tcsncpy wcsncpy +#define _tcspbrk wcspbrk +#define _tcsrchr wcsrchr +#define _tcsspn wcsspn +#define _tcsstr wcsstr +#define _tcstok wcstok +#define _tcsdup _wcsdup +#define _tcsicmp _wcsicmp +#define _tcsnicmp _wcsnicmp +#define _tcsnset _wcsnset +#define _tcsrev _wcsrev +#define _tcsset _wcsset +#define _tcslwr _wcslwr +#define _tcsupr _wcsupr +#define _tcsxfrm wcsxfrm +#define _tcscoll wcscoll +#define _tcsicoll _wcsicoll +#define _istalpha iswalpha +#define _istupper iswupper +#define _istlower iswlower +#define _istdigit iswdigit +#define _istxdigit iswxdigit +#define _istspace iswspace +#define _istpunct iswpunct +#define _istalnum iswalnum +#define _istprint iswprint +#define _istgraph iswgraph +#define _istcntrl iswcntrl +#define _istascii iswascii +#define _totupper towupper +#define _totlower towlower +#define _ttoi _wtoi +#define _tcsftime wcsftime + +#else /* Not _UNICODE */ + +/* + * TCHAR, the type you should use instead of char. + */ +#ifndef _TCHAR_DEFINED +#ifndef RC_INVOKED +typedef char TCHAR; +#endif +#define _TCHAR_DEFINED +#endif + +/* + * Enclose constant strings and characters in the _TEXT and _T macro. + */ +#define _TEXT(x) x +#define _T(x) x + + +/* + * Non-unicode (standard) functions + */ + +#define _tprintf printf +#define _ftprintf fprintf +#define _stprintf sprintf +#define _sntprintf _snprintf +#define _vtprintf vprintf +#define _vftprintf vfprintf +#define _vstprintf vsprintf +#define _vsntprintf _vsnprintf +#define _tscanf scanf +#define _ftscanf fscanf +#define _stscanf sscanf +#define _fgettc fgetc +#define _fgettchar _fgetchar +#define _fgetts fgets +#define _fputtc fputc +#define _fputtchar _fputchar +#define _fputts fputs +#define _gettc getc +#define _getts gets +#define _puttc putc +#define _putts puts +#define _ungettc ungetc +#define _tcstod strtod +#define _tcstol strtol +#define _tcstoul strtoul +#define _tcscat strcat +#define _tcschr strchr +#define _tcscmp strcmp +#define _tcscpy strcpy +#define _tcscspn strcspn +#define _tcslen strlen +#define _tcsncat strncat +#define _tcsncmp strncmp +#define _tcsncpy strncpy +#define _tcspbrk strpbrk +#define _tcsrchr strrchr +#define _tcsspn strspn +#define _tcsstr strstr +#define _tcstok strtok +#define _tcsdup _strdup +#define _tcsicmp _stricmp +#define _tcsnicmp _strnicmp +#define _tcsnset _strnset +#define _tcsrev _strrev +#define _tcsset _strset +#define _tcslwr _strlwr +#define _tcsupr _strupr +#define _tcsxfrm strxfrm +#define _tcscoll strcoll +#define _tcsicoll _stricoll +#define _istalpha isalpha +#define _istupper isupper +#define _istlower islower +#define _istdigit isdigit +#define _istxdigit isxdigit +#define _istspace isspace +#define _istpunct ispunct +#define _istalnum isalnum +#define _istprint isprint +#define _istgraph isgraph +#define _istcntrl iscntrl +#define _istascii isascii +#define _totupper toupper +#define _totlower tolower +#define _ttoi atoi +#define _tcsftime strftime + +#endif /* Not _UNICODE */ + +#endif /* Not _TCHAR_H_ */ + diff --git a/reactos/include/crtdll/time.h b/reactos/include/crtdll/time.h index e992db91fc5..6c7b9a35b2b 100644 --- a/reactos/include/crtdll/time.h +++ b/reactos/include/crtdll/time.h @@ -18,9 +18,9 @@ * DISCLAMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.2 $ - * $Author: rex $ - * $Date: 1999/03/19 05:55:10 $ + * $Revision: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ * */ /* Appropriated for Reactos Crtdll by Ariadne */ @@ -29,7 +29,7 @@ #define __need_wchar_t #define __need_size_t -#include +#include #ifdef __cplusplus extern "C" { @@ -53,7 +53,7 @@ typedef long clock_t; /* * Need a definition of time_t. */ -#include +#include /* * A type for storing the current time and date. This is the number of diff --git a/reactos/include/crtdll/wchar.h b/reactos/include/crtdll/wchar.h new file mode 100644 index 00000000000..5d0cdeb8d4d --- /dev/null +++ b/reactos/include/crtdll/wchar.h @@ -0,0 +1,32 @@ +/* + * wchar.h + * + * Defines of all functions for supporting wide characters. Actually it + * just includes all those headers, which is not a good thing to do from a + * processing time point of view, but it does mean that everything will be + * in sync. + * + * 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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.1 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:42:06 $ + * + */ + +#include +#include +#include +#include +#include + diff --git a/reactos/lib/crtdll/assert/assert.c b/reactos/lib/crtdll/assert/assert.c index 5e9f10f22c4..1d70882e48b 100644 --- a/reactos/lib/crtdll/assert/assert.c +++ b/reactos/lib/crtdll/assert/assert.c @@ -1,13 +1,13 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include +#include +#include +#include -void _assert(const char *msg, const char *file, int line) +void _assert(const char *msg, const char *file, int line) { /* Assertion failed at foo.c line 45: x +#include char * diff --git a/reactos/lib/crtdll/conio/cprintf.c b/reactos/lib/crtdll/conio/cprintf.c index 72411163751..27c87143f7f 100644 --- a/reactos/lib/crtdll/conio/cprintf.c +++ b/reactos/lib/crtdll/conio/cprintf.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include int cprintf(const char *fmt, ...) diff --git a/reactos/lib/crtdll/conio/cputs.c b/reactos/lib/crtdll/conio/cputs.c index 01c62795d02..91c97b3f845 100644 --- a/reactos/lib/crtdll/conio/cputs.c +++ b/reactos/lib/crtdll/conio/cputs.c @@ -8,10 +8,10 @@ * 28/12/98: Created */ #include -#include -#include +#include +#include -int cputs(const char *_str) +int _cputs(const char *_str) { int len = strlen(_str); int written = 0; diff --git a/reactos/lib/crtdll/conio/cscanf.c b/reactos/lib/crtdll/conio/cscanf.c index 3fa931c035a..9950519a28d 100644 --- a/reactos/lib/crtdll/conio/cscanf.c +++ b/reactos/lib/crtdll/conio/cscanf.c @@ -1,4 +1,4 @@ -#include +#include /* diff --git a/reactos/lib/crtdll/conio/getch.c b/reactos/lib/crtdll/conio/getch.c index 5a1b4cc8913..6830ac5988c 100644 --- a/reactos/lib/crtdll/conio/getch.c +++ b/reactos/lib/crtdll/conio/getch.c @@ -7,10 +7,10 @@ * UPDATE HISTORY: * 28/12/98: Created */ -#include -#include #include -#include +#include +#include +#include extern int char_avail; extern int ungot_char; diff --git a/reactos/lib/crtdll/conio/getche.c b/reactos/lib/crtdll/conio/getche.c index e35002334f5..247634b1cf7 100644 --- a/reactos/lib/crtdll/conio/getche.c +++ b/reactos/lib/crtdll/conio/getche.c @@ -10,8 +10,8 @@ * 28/12/98: Created */ -#include -#include +#include +#include extern int char_avail; diff --git a/reactos/lib/crtdll/conio/putch.c b/reactos/lib/crtdll/conio/putch.c index cbeaa078c9c..b207680f508 100644 --- a/reactos/lib/crtdll/conio/putch.c +++ b/reactos/lib/crtdll/conio/putch.c @@ -7,7 +7,7 @@ * UPDATE HISTORY: * 28/12/98: Created */ -#include +#include #include int _putch( int c ) diff --git a/reactos/lib/crtdll/conio/ungetch.c b/reactos/lib/crtdll/conio/ungetch.c index 17c28fb3b0f..adda3010d6e 100644 --- a/reactos/lib/crtdll/conio/ungetch.c +++ b/reactos/lib/crtdll/conio/ungetch.c @@ -10,7 +10,7 @@ * 28/12/98: Created */ -#include +#include #define EOF -1 int char_avail = 0; diff --git a/reactos/lib/crtdll/crtdll.def b/reactos/lib/crtdll/crtdll.def index c839b50fbc0..2aff25c53dd 100644 --- a/reactos/lib/crtdll/crtdll.def +++ b/reactos/lib/crtdll/crtdll.def @@ -17,9 +17,9 @@ ; DISCLAMED. This includes but is not limited to warrenties of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ; -; $Revision: 1.3 $ -; $Author: dwelch $ -; $Date: 1999/01/17 17:27:24 $ +; $Revision: 1.4 $ +; $Author: ariadne $ +; $Date: 1999/04/02 21:43:45 $ ; ; These three functions appear to be name mangled in some way, so GCC is ; probably not going to be able to use them in any case. @@ -28,6 +28,13 @@ ; ??3@YAXPAX@Z ; ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z ; +; Added functionallt equivalent placeholders: +; +; __builtin_new +; __builtin_delete +; _set_new_handler__FPFUi_i +; +; ; These are functions for which I have not yet written prototypes or ; otherwise set up (they are still included below though unlike those ; first three). @@ -193,6 +200,9 @@ ; _wtol ; EXPORTS +__builtin_new +__builtin_delete +_set_new_handler__FPFUi_i _CIacos _CIasin _CIatan diff --git a/reactos/lib/crtdll/ctype/isalnum.c b/reactos/lib/crtdll/ctype/isalnum.c index c95795e69f7..66a591b2c46 100644 --- a/reactos/lib/crtdll/ctype/isalnum.c +++ b/reactos/lib/crtdll/ctype/isalnum.c @@ -7,7 +7,7 @@ * UPDATE HISTORY: * 28/12/98: Created */ -#include +#include #undef isalnum @@ -17,7 +17,7 @@ int isalnum(int c) } #undef iswalnum -int iswalnum(int c) +int iswalnum(wint_t c) { return iswctype(c,_ALPHA | _DIGIT); } diff --git a/reactos/lib/crtdll/ctype/isalpha.c b/reactos/lib/crtdll/ctype/isalpha.c index 2e8a2982105..3e0c4968c20 100644 --- a/reactos/lib/crtdll/ctype/isalpha.c +++ b/reactos/lib/crtdll/ctype/isalpha.c @@ -8,7 +8,7 @@ * 28/12/98: Created */ -#include +#include #undef isalpha int isalpha(int c) @@ -17,7 +17,7 @@ int isalpha(int c) } #undef iswalpha -int iswalpha(int c) +int iswalpha(wint_t c) { return iswctype(c,_ALPHA); } diff --git a/reactos/lib/crtdll/ctype/isascii.c b/reactos/lib/crtdll/ctype/isascii.c index 3aefae82222..4ef4daf9ff8 100644 --- a/reactos/lib/crtdll/ctype/isascii.c +++ b/reactos/lib/crtdll/ctype/isascii.c @@ -8,14 +8,14 @@ * 28/12/98: Created */ -#include +#include int __isascii(int c) { return (!((c)&(~0x7f))) ; } -int iswascii(int c) +int iswascii(wint_t c) { return __isascii(c); } diff --git a/reactos/lib/crtdll/ctype/iscntrl.c b/reactos/lib/crtdll/ctype/iscntrl.c index e44f34c88e9..4eef7f83cd0 100644 --- a/reactos/lib/crtdll/ctype/iscntrl.c +++ b/reactos/lib/crtdll/ctype/iscntrl.c @@ -1,5 +1,5 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include +#include #undef iscntrl int iscntrl(int c) @@ -8,7 +8,7 @@ int iscntrl(int c) } #undef iswcntrl -int iswcntrl(int c) +int iswcntrl(wint_t c) { return iswctype(c,_CONTROL); } diff --git a/reactos/lib/crtdll/ctype/iscsym.c b/reactos/lib/crtdll/ctype/iscsym.c index 702b4fa8728..4f1c1d60bd2 100644 --- a/reactos/lib/crtdll/ctype/iscsym.c +++ b/reactos/lib/crtdll/ctype/iscsym.c @@ -8,7 +8,7 @@ * 28/12/98: Created */ -#include +#include int __iscsymf(int c) { @@ -18,4 +18,4 @@ int __iscsymf(int c) int __iscsym(int c) { return (isalnum(c) || ( c == '_' )) ; -} \ No newline at end of file +} diff --git a/reactos/lib/crtdll/ctype/isctype.c b/reactos/lib/crtdll/ctype/isctype.c index 90de53c2d59..4bc7110df0b 100644 --- a/reactos/lib/crtdll/ctype/isctype.c +++ b/reactos/lib/crtdll/ctype/isctype.c @@ -1,5 +1,5 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include +#include #define __dj_ISUPPER _UPPER @@ -12,11 +12,8 @@ #define __dj_ISXDIGIT _HEX #define __dj_ISALPHA _ALPHA #define __dj_ISPRINT _PRINT -#define __dj_ISALNUM ( _ALPHA | _DIGIT ) #define __dj_ISGRAPH _GRAPH -int __mb_cur_max = 2; - // removed the first value unsigned short _pctype_dll[] = { @@ -68,16 +65,16 @@ unsigned short _pctype_dll[] = { __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `-', 0x2d */ __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `.', 0x2e */ __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `/', 0x2f */ - __dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `0', 0x30 */ - __dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `1', 0x31 */ - __dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `2', 0x32 */ - __dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `3', 0x33 */ - __dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `4', 0x34 */ - __dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `5', 0x35 */ - __dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `6', 0x36 */ - __dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `7', 0x37 */ - __dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `8', 0x38 */ - __dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `9', 0x39 */ + __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `0', 0x30 */ + __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `1', 0x31 */ + __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `2', 0x32 */ + __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `3', 0x33 */ + __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `4', 0x34 */ + __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `5', 0x35 */ + __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `6', 0x36 */ + __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `7', 0x37 */ + __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `8', 0x38 */ + __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `9', 0x39 */ __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `:', 0x3a */ __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `;', 0x3b */ __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `<', 0x3c */ @@ -85,64 +82,64 @@ unsigned short _pctype_dll[] = { __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `>', 0x3e */ __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `?', 0x3f */ __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `@', 0x40 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `A', 0x41 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `B', 0x42 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `C', 0x43 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `D', 0x44 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `E', 0x45 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `F', 0x46 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `G', 0x47 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `H', 0x48 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `I', 0x49 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `J', 0x4a */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `K', 0x4b */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `L', 0x4c */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `M', 0x4d */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `N', 0x4e */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `O', 0x4f */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `P', 0x50 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `Q', 0x51 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `R', 0x52 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `S', 0x53 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `T', 0x54 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `U', 0x55 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `V', 0x56 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `W', 0x57 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `X', 0x58 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `Y', 0x59 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `Z', 0x5a */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `A', 0x41 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `B', 0x42 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `C', 0x43 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `D', 0x44 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `E', 0x45 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `F', 0x46 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `G', 0x47 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `H', 0x48 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `I', 0x49 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `J', 0x4a */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `K', 0x4b */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `L', 0x4c */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `M', 0x4d */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `N', 0x4e */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `O', 0x4f */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `P', 0x50 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `Q', 0x51 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `R', 0x52 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `S', 0x53 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `T', 0x54 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `U', 0x55 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `V', 0x56 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `W', 0x57 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `X', 0x58 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `Y', 0x59 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `Z', 0x5a */ __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `[', 0x5b */ __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* 0x5c */ __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `]', 0x5d */ __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `^', 0x5e */ __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `_', 0x5f */ __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* 0x60 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `a', 0x61 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `b', 0x62 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `c', 0x63 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `d', 0x64 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `e', 0x65 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `f', 0x66 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `g', 0x67 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `h', 0x68 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `i', 0x69 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `j', 0x6a */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `k', 0x6b */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `l', 0x6c */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `m', 0x6d */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `n', 0x6e */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `o', 0x6f */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `p', 0x70 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `q', 0x71 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `r', 0x72 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `s', 0x73 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `t', 0x74 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `u', 0x75 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `v', 0x76 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `w', 0x77 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `x', 0x78 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `y', 0x79 */ - __dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `z', 0x7a */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `a', 0x61 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `b', 0x62 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `c', 0x63 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `d', 0x64 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `e', 0x65 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `f', 0x66 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `g', 0x67 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `h', 0x68 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `i', 0x69 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `j', 0x6a */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `k', 0x6b */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `l', 0x6c */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `m', 0x6d */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `n', 0x6e */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `o', 0x6f */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `p', 0x70 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `q', 0x71 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `r', 0x72 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `s', 0x73 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `t', 0x74 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `u', 0x75 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `v', 0x76 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `w', 0x77 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `x', 0x78 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `y', 0x79 */ + __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `z', 0x7a */ __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `{', 0x7b */ __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `|', 0x7c */ __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `}', 0x7d */ @@ -281,23 +278,23 @@ unsigned short _pctype_dll[] = { unsigned short *_ctype = _pctype_dll -1; // unused unsigned short *_pwctype_dll = _pctype_dll; - -int _isctype(unsigned char c, int t) +int _isctype (unsigned int c, int ctypeFlags) { - return ((_pctype_dll[(c & 0xFF)]&t) == t ); + return ((_pctype_dll[(unsigned char)(c & 0xFF)]&ctypeFlags) == ctypeFlags ); } -int iswctype(unsigned short c, int t) + +int iswctype(wint_t wc, wctype_t wctypeFlags) { - return ((_pwctype_dll[(c & 0xFF)]&t) == t ); + return ((_pwctype_dll[(unsigned char)(wc & 0xFF)]&wctypeFlags) == wctypeFlags ); } // obsolete -int is_wctype(unsigned short c, int t) +int is_wctype(wint_t wc, wctype_t wctypeFlags) { - return ((_pctype_dll[(c & 0xFF)]&t) == t ); + return ((_pwctype_dll[(unsigned char)(wc & 0xFF)]&wctypeFlags) == wctypeFlags ); } diff --git a/reactos/lib/crtdll/ctype/isdigit.c b/reactos/lib/crtdll/ctype/isdigit.c index b0ad5a085dc..93afd37f38d 100644 --- a/reactos/lib/crtdll/ctype/isdigit.c +++ b/reactos/lib/crtdll/ctype/isdigit.c @@ -1,5 +1,5 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include +#include #undef isdigit int isdigit(int c) @@ -8,7 +8,7 @@ int isdigit(int c) } #undef iswdigit -int iswdigit(int c) +int iswdigit(wint_t c) { return iswctype(c,_DIGIT); } diff --git a/reactos/lib/crtdll/ctype/isgraph.c b/reactos/lib/crtdll/ctype/isgraph.c index ade3e1bee6d..3a4d5dabd22 100644 --- a/reactos/lib/crtdll/ctype/isgraph.c +++ b/reactos/lib/crtdll/ctype/isgraph.c @@ -1,5 +1,5 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include +#include #undef isgraph int isgraph(int c) @@ -8,7 +8,7 @@ int isgraph(int c) } #undef iswgraph -int iswgraph(int c) +int iswgraph(wint_t c) { return iswctype(c,_GRAPH); } diff --git a/reactos/lib/crtdll/ctype/islower.c b/reactos/lib/crtdll/ctype/islower.c index 122e7d09e16..4ce38e1fc94 100644 --- a/reactos/lib/crtdll/ctype/islower.c +++ b/reactos/lib/crtdll/ctype/islower.c @@ -1,13 +1,13 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include +#include #undef islower int islower(int c) { - return _isctype((unsigned char)c,_LOWER); + return _isctype(c,_LOWER); } -int iswlower(int c) +int iswlower(wint_t c) { - return iswctype((unsigned short)c,_LOWER); -} \ No newline at end of file + return iswctype(c,_LOWER); +} diff --git a/reactos/lib/crtdll/ctype/isprint.c b/reactos/lib/crtdll/ctype/isprint.c index 1f7b467852f..b71b307234a 100644 --- a/reactos/lib/crtdll/ctype/isprint.c +++ b/reactos/lib/crtdll/ctype/isprint.c @@ -1,13 +1,13 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include +#include #undef isprint int isprint(int c) { - return _isctype((unsigned char)c,_PRINT); + return _isctype(c,_PRINT); } -int iswprint(int c) +int iswprint(wint_t c) { return iswctype((unsigned short)c,_PRINT); -} \ No newline at end of file +} diff --git a/reactos/lib/crtdll/ctype/ispunct.c b/reactos/lib/crtdll/ctype/ispunct.c index 152cb52f5fe..57f0ab1244a 100644 --- a/reactos/lib/crtdll/ctype/ispunct.c +++ b/reactos/lib/crtdll/ctype/ispunct.c @@ -1,5 +1,5 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include +#include #undef ispunct int ispunct(int c) @@ -8,7 +8,7 @@ int ispunct(int c) } #undef iswpunct -int iswpunct(int c) +int iswpunct(wint_t c) { return iswctype(c,_PUNCT); } diff --git a/reactos/lib/crtdll/ctype/isspace.c b/reactos/lib/crtdll/ctype/isspace.c index b884c2c0f90..0e90ae78cb2 100644 --- a/reactos/lib/crtdll/ctype/isspace.c +++ b/reactos/lib/crtdll/ctype/isspace.c @@ -7,16 +7,16 @@ * UPDATE HISTORY: * 28/12/98: Created */ -#include +#include #undef isspace int isspace(int c) { - return _isctype((unsigned char)c,_SPACE); + return _isctype(c,_SPACE); } #undef iswspace -int iswspace(int c) +int iswspace(wint_t c) { - return iswctype((unsigned short)c,_SPACE); + return iswctype(c,_SPACE); } diff --git a/reactos/lib/crtdll/ctype/isupper.c b/reactos/lib/crtdll/ctype/isupper.c index a6a5db8509a..d0d95e02c1d 100644 --- a/reactos/lib/crtdll/ctype/isupper.c +++ b/reactos/lib/crtdll/ctype/isupper.c @@ -1,5 +1,5 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include +#include #undef isupper int isupper(int c) @@ -7,7 +7,7 @@ int isupper(int c) return _isctype(c,_UPPER); } -int iswupper(int c) +int iswupper(wint_t c) { return iswctype(c,_UPPER); } diff --git a/reactos/lib/crtdll/ctype/isxdigit.c b/reactos/lib/crtdll/ctype/isxdigit.c index 8c4c3090d3b..02c8c63bdec 100644 --- a/reactos/lib/crtdll/ctype/isxdigit.c +++ b/reactos/lib/crtdll/ctype/isxdigit.c @@ -1,5 +1,5 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include +#include #undef isxdigit int isxdigit(int c) @@ -8,7 +8,7 @@ int isxdigit(int c) } #undef iswxdigit -int iswxdigit(int c) +int iswxdigit(wint_t c) { return iswctype(c,_HEX); } diff --git a/reactos/lib/crtdll/ctype/toascii.c b/reactos/lib/crtdll/ctype/toascii.c index b19b799f854..86d8ff36874 100644 --- a/reactos/lib/crtdll/ctype/toascii.c +++ b/reactos/lib/crtdll/ctype/toascii.c @@ -1,6 +1,6 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include +#include int __toascii(int c) diff --git a/reactos/lib/crtdll/ctype/tolower.c b/reactos/lib/crtdll/ctype/tolower.c index 80d8cd0506d..f2cb4ddad20 100644 --- a/reactos/lib/crtdll/ctype/tolower.c +++ b/reactos/lib/crtdll/ctype/tolower.c @@ -1,5 +1,5 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include +#include #undef tolower int tolower(int c) { diff --git a/reactos/lib/crtdll/ctype/toupper.c b/reactos/lib/crtdll/ctype/toupper.c index 096af42e76e..00d65506c4c 100644 --- a/reactos/lib/crtdll/ctype/toupper.c +++ b/reactos/lib/crtdll/ctype/toupper.c @@ -1,6 +1,6 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include #undef toupper int toupper(int c) diff --git a/reactos/lib/crtdll/direct/chdir.c b/reactos/lib/crtdll/direct/chdir.c index 39e651a5c3e..d3898bcff66 100644 --- a/reactos/lib/crtdll/direct/chdir.c +++ b/reactos/lib/crtdll/direct/chdir.c @@ -1,6 +1,6 @@ -#include +#include #include -#include +#include char _SetCurrentDirectory(char *dir); int _GetCurrentDirectory(int count,char *buffer); diff --git a/reactos/lib/crtdll/direct/chdrive.c b/reactos/lib/crtdll/direct/chdrive.c index a03eadb9966..62ba41e0811 100644 --- a/reactos/lib/crtdll/direct/chdrive.c +++ b/reactos/lib/crtdll/direct/chdrive.c @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #include int cur_drive = 0; diff --git a/reactos/lib/crtdll/direct/getcwd.c b/reactos/lib/crtdll/direct/getcwd.c index 6012f7a4414..b81446c550d 100644 --- a/reactos/lib/crtdll/direct/getcwd.c +++ b/reactos/lib/crtdll/direct/getcwd.c @@ -1,6 +1,6 @@ #include -#include -#include +#include +#include diff --git a/reactos/lib/crtdll/direct/getdfree.c b/reactos/lib/crtdll/direct/getdfree.c index e86f76117ec..766362b07e3 100644 --- a/reactos/lib/crtdll/direct/getdfree.c +++ b/reactos/lib/crtdll/direct/getdfree.c @@ -1,6 +1,6 @@ -#include +#include #include -#include +#include unsigned int _getdiskfree(unsigned int _drive, struct _diskfree_t *_diskspace) diff --git a/reactos/lib/crtdll/direct/getdrive.c b/reactos/lib/crtdll/direct/getdrive.c index da2c25d91b8..6165ef85549 100644 --- a/reactos/lib/crtdll/direct/getdrive.c +++ b/reactos/lib/crtdll/direct/getdrive.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include extern int cur_drive; diff --git a/reactos/lib/crtdll/direct/mkdir.c b/reactos/lib/crtdll/direct/mkdir.c index 4d359f65068..b814ee02bf8 100644 --- a/reactos/lib/crtdll/direct/mkdir.c +++ b/reactos/lib/crtdll/direct/mkdir.c @@ -1,4 +1,4 @@ -#include +#include #include #undef mkdir diff --git a/reactos/lib/crtdll/direct/rmdir.c b/reactos/lib/crtdll/direct/rmdir.c index 2027994558f..c9979a9f45a 100644 --- a/reactos/lib/crtdll/direct/rmdir.c +++ b/reactos/lib/crtdll/direct/rmdir.c @@ -1,4 +1,4 @@ -#include +#include #include #undef rmdir diff --git a/reactos/lib/crtdll/dirent/dirent.c b/reactos/lib/crtdll/dirent/dirent.c index 54104d449d3..9a346abb8fe 100644 --- a/reactos/lib/crtdll/dirent/dirent.c +++ b/reactos/lib/crtdll/dirent/dirent.c @@ -9,21 +9,21 @@ * Significantly revised and rewinddir, seekdir and telldir added by Colin * Peters * - * $Revision: 1.1 $ - * $Author: rex $ - * $Date: 1999/01/16 02:11:43 $ + * $Revision: 1.2 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:43:47 $ * */ -#include -/* #include */ -#include -#include -#include -#include -#include +#include +/* #include */ +#include +#include +#include +#include +#include -#include +#include #define SUFFIX "*" #define SLASH "\\" diff --git a/reactos/lib/crtdll/except/abnorter.c b/reactos/lib/crtdll/except/abnorter.c new file mode 100644 index 00000000000..3a974007aca --- /dev/null +++ b/reactos/lib/crtdll/except/abnorter.c @@ -0,0 +1,6 @@ +#include + +int _abnormal_termination(void) +{ + return AbnormalTermination(); +} \ No newline at end of file diff --git a/reactos/lib/crtdll/float/chgsign.c b/reactos/lib/crtdll/float/chgsign.c new file mode 100644 index 00000000000..42132a4b1e8 --- /dev/null +++ b/reactos/lib/crtdll/float/chgsign.c @@ -0,0 +1,8 @@ +#include + +//Obvious fixme + +double _chgsign( double x ) +{ + return -1.0*x; +} diff --git a/reactos/lib/crtdll/float/clearfp.c b/reactos/lib/crtdll/float/clearfp.c index 5b490f208eb..e824752e4c6 100644 --- a/reactos/lib/crtdll/float/clearfp.c +++ b/reactos/lib/crtdll/float/clearfp.c @@ -1,4 +1,4 @@ -#include +#include unsigned int _clearfp (void) { diff --git a/reactos/lib/crtdll/float/cntrlfp.c b/reactos/lib/crtdll/float/cntrlfp.c index 6167bed9aa5..5f2c385afec 100644 --- a/reactos/lib/crtdll/float/cntrlfp.c +++ b/reactos/lib/crtdll/float/cntrlfp.c @@ -1,6 +1,6 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include +#include unsigned int _controlfp (unsigned int unNew, unsigned int unMask) { diff --git a/reactos/lib/crtdll/float/fpreset.c b/reactos/lib/crtdll/float/fpreset.c index 76acba8b841..df0ccc98193 100644 --- a/reactos/lib/crtdll/float/fpreset.c +++ b/reactos/lib/crtdll/float/fpreset.c @@ -1,7 +1,7 @@ -#include +#include void _fpreset (void) { __asm__ __volatile__("fninit\n\t"); return; -} \ No newline at end of file +} diff --git a/reactos/lib/crtdll/float/isnan.c b/reactos/lib/crtdll/float/isnan.c new file mode 100644 index 00000000000..30e2e7ec11d --- /dev/null +++ b/reactos/lib/crtdll/float/isnan.c @@ -0,0 +1,12 @@ +#include +#include + +int isnan(double x) +{ + if ( x>= 0.0 && x < HUGE_VAL ) + return FALSE; + else if ( x <= 0.0 && x > HUGE_VAL ) + return FALSE; + + return TRUE; +} \ No newline at end of file diff --git a/reactos/lib/crtdll/float/statfp.c b/reactos/lib/crtdll/float/statfp.c index 0786a7e0dc2..5cfeabfe51c 100644 --- a/reactos/lib/crtdll/float/statfp.c +++ b/reactos/lib/crtdll/float/statfp.c @@ -1,4 +1,4 @@ -#include +#include unsigned int _statusfp (void) { @@ -11,4 +11,4 @@ __asm__ __volatile__ ( :"=a" (__res) ); return __res; -} \ No newline at end of file +} diff --git a/reactos/lib/crtdll/io/access.c b/reactos/lib/crtdll/io/access.c index 8395761e999..47f66cd404c 100644 --- a/reactos/lib/crtdll/io/access.c +++ b/reactos/lib/crtdll/io/access.c @@ -1,4 +1,4 @@ -#include +#include #include #ifndef F_OK @@ -24,7 +24,7 @@ int _access( const char *_path, int _amode ) if ( Attributes == -1 ) return -1; - if ( _amode & W_OK == W_OK ) { + if ( (_amode & W_OK) == W_OK ) { if ( (Attributes & FILE_ATTRIBUTE_READONLY) == FILE_ATTRIBUTE_READONLY ) return -1; } diff --git a/reactos/lib/crtdll/io/chmod.c b/reactos/lib/crtdll/io/chmod.c index ff5d6966db2..264b9b59526 100644 --- a/reactos/lib/crtdll/io/chmod.c +++ b/reactos/lib/crtdll/io/chmod.c @@ -1,5 +1,5 @@ #include -#include +#include int _chmod(const char *filename, int func) diff --git a/reactos/lib/crtdll/io/chsize.c b/reactos/lib/crtdll/io/chsize.c index 37f4242eca0..f69ad442590 100644 --- a/reactos/lib/crtdll/io/chsize.c +++ b/reactos/lib/crtdll/io/chsize.c @@ -1,5 +1,5 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ -#include +#include int chsize(int _fd, long size) diff --git a/reactos/lib/crtdll/io/close.c b/reactos/lib/crtdll/io/close.c index 2865179c3ed..a5f229cb837 100644 --- a/reactos/lib/crtdll/io/close.c +++ b/reactos/lib/crtdll/io/close.c @@ -1,6 +1,6 @@ -#include +#include #include -#include +#include int _close(int _fd) diff --git a/reactos/lib/crtdll/io/commit.c b/reactos/lib/crtdll/io/commit.c index 3afcc14c1a5..8c9d787a146 100644 --- a/reactos/lib/crtdll/io/commit.c +++ b/reactos/lib/crtdll/io/commit.c @@ -1,7 +1,9 @@ #include -#include -#include -#include +#include +#include +#include + +int _commode_dll = _IOCOMMIT; int _commit(int _fd) { diff --git a/reactos/lib/crtdll/io/create.c b/reactos/lib/crtdll/io/create.c index bd382e9218b..46175a39c93 100644 --- a/reactos/lib/crtdll/io/create.c +++ b/reactos/lib/crtdll/io/create.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include #undef creat int creat(const char *filename, int mode) diff --git a/reactos/lib/crtdll/io/dup.c b/reactos/lib/crtdll/io/dup.c index 19c91632ad6..7ddf8436315 100644 --- a/reactos/lib/crtdll/io/dup.c +++ b/reactos/lib/crtdll/io/dup.c @@ -1,5 +1,5 @@ #include -#include +#include int _dup( int handle ) diff --git a/reactos/lib/crtdll/io/dup2.c b/reactos/lib/crtdll/io/dup2.c index bafe19a5198..98ea3682a01 100644 --- a/reactos/lib/crtdll/io/dup2.c +++ b/reactos/lib/crtdll/io/dup2.c @@ -1,12 +1,6 @@ #include -#include - -#undef dup2 -int dup2( int handle1, int handle2 ) -{ - return _dup2(handle1,handle2); -} - +#include +#include int _dup2( int handle1, int handle2 ) { diff --git a/reactos/lib/crtdll/io/eof.c b/reactos/lib/crtdll/io/eof.c index 385f5eda2bb..baf39528c82 100644 --- a/reactos/lib/crtdll/io/eof.c +++ b/reactos/lib/crtdll/io/eof.c @@ -1,5 +1,5 @@ #include -#include +#include int _eof( int _fd ) { diff --git a/reactos/lib/crtdll/io/filelen.c b/reactos/lib/crtdll/io/filelen.c index 67073134655..b234bf4ce1d 100644 --- a/reactos/lib/crtdll/io/filelen.c +++ b/reactos/lib/crtdll/io/filelen.c @@ -1,5 +1,5 @@ #include -#include +#include long _filelength(int _fd) diff --git a/reactos/lib/crtdll/io/find.c b/reactos/lib/crtdll/io/find.c index 2015fef82fe..58a2e7e8edd 100644 --- a/reactos/lib/crtdll/io/find.c +++ b/reactos/lib/crtdll/io/find.c @@ -1,24 +1,11 @@ #include -#include -#include - -#if 0 - -//UnixTimeToFileTime -//FileTimeToUnixTime -/* - * DOS file system functions - * - * Copyright 1993 Erik Bos - * Copyright 1996 Alexandre Julliard - */ +#include +#include +#include -void UnixTimeToFileTime( time_t unix_time, FILETIME *filetime, DWORD remainder ); -time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder ); - -long _findfirst(char *_name, struct _finddata_t *result) +int _findfirst(const char *_name, struct _finddata_t *result) { WIN32_FIND_DATA FindFileData; char dir[MAX_PATH]; @@ -32,7 +19,7 @@ long _findfirst(char *_name, struct _finddata_t *result) } else strcpy(dir,_name); - hFindFile = FindFirstFile( dir, &FindFileData ); + hFindFile = (long)FindFirstFileA( dir, &FindFileData ); result->attrib = FindFileData.dwFileAttributes; @@ -40,17 +27,17 @@ long _findfirst(char *_name, struct _finddata_t *result) result->time_access = FileTimeToUnixTime( &FindFileData.ftLastAccessTime,NULL); result->time_write = FileTimeToUnixTime( &FindFileData.ftLastWriteTime,NULL); result->size = FindFileData.nFileSizeLow; - strncpy(result->name,&FindFileData.cFileName,260); + strncpy(result->name,FindFileData.cFileName,260); return hFindFile; } -int _findnext(long handle, struct _finddata_t *result) +int _findnext(int handle, struct _finddata_t *result) { WIN32_FIND_DATA FindFileData; if (handle == -1 ) return -1; - if ( !FindNextFile(handle, &FindFileData ) ) + if ( !FindNextFile((void *)handle, &FindFileData ) ) return -1; result->attrib = FindFileData.dwFileAttributes; @@ -58,198 +45,12 @@ int _findnext(long handle, struct _finddata_t *result) result->time_access = FileTimeToUnixTime( &FindFileData.ftLastAccessTime,NULL); result->time_write = FileTimeToUnixTime( &FindFileData.ftLastWriteTime,NULL); result->size = FindFileData.nFileSizeLow; - strncpy(result->name,&FindFileData.cFileName,260); + strncpy(result->name,FindFileData.cFileName,260); return 0; } -int _findclose(long handle) +int _findclose(int handle) { - return FindClose(handle); + return FindClose((void *)handle); } -/*********************************************************************** - * DOSFS_UnixTimeToFileTime - * - * Convert a Unix time to FILETIME format. - * The FILETIME structure is a 64-bit value representing the number of - * 100-nanosecond intervals since January 1, 1601, 0:00. - * 'remainder' is the nonnegative number of 100-ns intervals - * corresponding to the time fraction smaller than 1 second that - * couldn't be stored in the time_t value. - */ -void UnixTimeToFileTime( time_t unix_time, FILETIME *filetime, - DWORD remainder ) -{ - /* NOTES: - - CONSTANTS: - The time difference between 1 January 1601, 00:00:00 and - 1 January 1970, 00:00:00 is 369 years, plus the leap years - from 1604 to 1968, excluding 1700, 1800, 1900. - This makes (1968 - 1600) / 4 - 3 = 89 leap days, and a total - of 134774 days. - - Any day in that period had 24 * 60 * 60 = 86400 seconds. - - The time difference is 134774 * 86400 * 10000000, which can be written - 116444736000000000 - 27111902 * 2^32 + 3577643008 - 413 * 2^48 + 45534 * 2^32 + 54590 * 2^16 + 32768 - - If you find that these constants are buggy, please change them in all - instances in both conversion functions. - - VERSIONS: - There are two versions, one of them uses long long variables and - is presumably faster but not ISO C. The other one uses standard C - data types and operations but relies on the assumption that negative - numbers are stored as 2's complement (-1 is 0xffff....). If this - assumption is violated, dates before 1970 will not convert correctly. - This should however work on any reasonable architecture where WINE - will run. - - DETAILS: - - Take care not to remove the casts. I have tested these functions - (in both versions) for a lot of numbers. I would be interested in - results on other compilers than GCC. - - The operations have been designed to account for the possibility - of 64-bit time_t in future UNICES. Even the versions without - internal long long numbers will work if time_t only is 64 bit. - A 32-bit shift, which was necessary for that operation, turned out - not to work correctly in GCC, besides giving the warning. So I - used a double 16-bit shift instead. Numbers are in the ISO version - represented by three limbs, the most significant with 32 bit, the - other two with 16 bit each. - - As the modulo-operator % is not well-defined for negative numbers, - negative divisors have been avoided in DOSFS_FileTimeToUnixTime. - - There might be quicker ways to do this in C. Certainly so in - assembler. - - Claus Fischer, fischer@iue.tuwien.ac.at - */ - - - - - unsigned long a0; /* 16 bit, low bits */ - unsigned long a1; /* 16 bit, medium bits */ - unsigned long a2; /* 32 bit, high bits */ - - /* Copy the unix time to a2/a1/a0 */ - a0 = unix_time & 0xffff; - a1 = (unix_time >> 16) & 0xffff; - /* This is obsolete if unix_time is only 32 bits, but it does not hurt. - Do not replace this by >> 32, it gives a compiler warning and it does - not work. */ - a2 = (unix_time >= 0 ? (unix_time >> 16) >> 16 : - ~((~unix_time >> 16) >> 16)); - - /* Multiply a by 10000000 (a = a2/a1/a0) - Split the factor into 10000 * 1000 which are both less than 0xffff. */ - a0 *= 10000; - a1 = a1 * 10000 + (a0 >> 16); - a2 = a2 * 10000 + (a1 >> 16); - a0 &= 0xffff; - a1 &= 0xffff; - - a0 *= 1000; - a1 = a1 * 1000 + (a0 >> 16); - a2 = a2 * 1000 + (a1 >> 16); - a0 &= 0xffff; - a1 &= 0xffff; - - /* Add the time difference and the remainder */ - a0 += 32768 + (remainder & 0xffff); - a1 += 54590 + (remainder >> 16 ) + (a0 >> 16); - a2 += 27111902 + (a1 >> 16); - a0 &= 0xffff; - a1 &= 0xffff; - - /* Set filetime */ - filetime->dwLowDateTime = (a1 << 16) + a0; - filetime->dwHighDateTime = a2; -} - - -/*********************************************************************** - * DOSFS_FileTimeToUnixTime - * - * Convert a FILETIME format to Unix time. - * If not NULL, 'remainder' contains the fractional part of the filetime, - * in the range of [0..9999999] (even if time_t is negative). - */ -time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder ) -{ - /* Read the comment in the function DOSFS_UnixTimeToFileTime. */ - - unsigned long a0; /* 16 bit, low bits */ - unsigned long a1; /* 16 bit, medium bits */ - unsigned long a2; /* 32 bit, high bits */ - unsigned long r; /* remainder of division */ - unsigned int carry; /* carry bit for subtraction */ - int negative; /* whether a represents a negative value */ - - /* Copy the time values to a2/a1/a0 */ - a2 = (unsigned long)filetime->dwHighDateTime; - a1 = ((unsigned long)filetime->dwLowDateTime ) >> 16; - a0 = ((unsigned long)filetime->dwLowDateTime ) & 0xffff; - - /* Subtract the time difference */ - if (a0 >= 32768 ) a0 -= 32768 , carry = 0; - else a0 += (1 << 16) - 32768 , carry = 1; - - if (a1 >= 54590 + carry) a1 -= 54590 + carry, carry = 0; - else a1 += (1 << 16) - 54590 - carry, carry = 1; - - a2 -= 27111902 + carry; - - /* If a is negative, replace a by (-1-a) */ - negative = (a2 >= ((unsigned long)1) << 31); - if (negative) - { - /* Set a to -a - 1 (a is a2/a1/a0) */ - a0 = 0xffff - a0; - a1 = 0xffff - a1; - a2 = ~a2; - } - - /* Divide a by 10000000 (a = a2/a1/a0), put the rest into r. - Split the divisor into 10000 * 1000 which are both less than 0xffff. */ - a1 += (a2 % 10000) << 16; - a2 /= 10000; - a0 += (a1 % 10000) << 16; - a1 /= 10000; - r = a0 % 10000; - a0 /= 10000; - - a1 += (a2 % 1000) << 16; - a2 /= 1000; - a0 += (a1 % 1000) << 16; - a1 /= 1000; - r += (a0 % 1000) * 10000; - a0 /= 1000; - - /* If a was negative, replace a by (-1-a) and r by (9999999 - r) */ - if (negative) - { - /* Set a to -a - 1 (a is a2/a1/a0) */ - a0 = 0xffff - a0; - a1 = 0xffff - a1; - a2 = ~a2; - - r = 9999999 - r; - } - - if (remainder) *remainder = r; - - /* Do not replace this by << 32, it gives a compiler warning and it does - not work. */ - return ((((time_t)a2) << 16) << 16) + (a1 << 16) + a0; - -} - -#endif diff --git a/reactos/lib/crtdll/io/fmode.c b/reactos/lib/crtdll/io/fmode.c index 6fd48c8d2bf..fc89be40a53 100644 --- a/reactos/lib/crtdll/io/fmode.c +++ b/reactos/lib/crtdll/io/fmode.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include #undef _fmode unsigned int _fmode = O_TEXT; diff --git a/reactos/lib/crtdll/io/isatty.c b/reactos/lib/crtdll/io/isatty.c index a8a74e631a2..a7eb65b8907 100644 --- a/reactos/lib/crtdll/io/isatty.c +++ b/reactos/lib/crtdll/io/isatty.c @@ -1,8 +1,14 @@ -#include +#include +#include -#undef isatty -int isatty( int handle ) +int _isatty( int fd ) { - return (handle & 3); + struct stat buf; + + if (fstat (fd, &buf) < 0) + return 0; + if (S_ISCHR (buf.st_mode)) + return 1; + return 0; } diff --git a/reactos/lib/crtdll/io/locking.c b/reactos/lib/crtdll/io/locking.c index 48472303d92..b846ef57e64 100644 --- a/reactos/lib/crtdll/io/locking.c +++ b/reactos/lib/crtdll/io/locking.c @@ -1,5 +1,5 @@ #include -#include +#include int _locking( int _fd, int mode, long nbytes ) { @@ -8,4 +8,4 @@ int _locking( int _fd, int mode, long nbytes ) return -1; return 0; -} \ No newline at end of file +} diff --git a/reactos/lib/crtdll/io/lseek.c b/reactos/lib/crtdll/io/lseek.c index cba29e64f4d..a0e92465bc7 100644 --- a/reactos/lib/crtdll/io/lseek.c +++ b/reactos/lib/crtdll/io/lseek.c @@ -1,16 +1,10 @@ #include -#include -//#include - -#undef lseek -long lseek(int _fildes, long _offset, int _whence) -{ - return _lseek(_fildes,_offset,_whence); -} +#include +#include long _lseek(int _fildes, long _offset, int _whence) { - //return _llseek(filehnd(_fildes),_offset,_whence); + return _llseek((HFILE)filehnd(_fildes),_offset,_whence); } diff --git a/reactos/lib/crtdll/io/mktemp.c b/reactos/lib/crtdll/io/mktemp.c index d0531d9f80e..be394db016f 100644 --- a/reactos/lib/crtdll/io/mktemp.c +++ b/reactos/lib/crtdll/io/mktemp.c @@ -13,9 +13,9 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include +#include +#include +#include char * diff --git a/reactos/lib/crtdll/io/open.c b/reactos/lib/crtdll/io/open.c index eb68528ca32..08a44704cef 100644 --- a/reactos/lib/crtdll/io/open.c +++ b/reactos/lib/crtdll/io/open.c @@ -7,14 +7,14 @@ * UPDATE HISTORY: * 28/12/98: Created */ -#include +#include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include typedef struct _fileno_modes_type { @@ -39,12 +39,6 @@ char __is_text_file(FILE *p) { int __fileno_alloc(HANDLE hFile, int mode); -// fixme -#undef open -int open(const char *_path, int _oflag,...) -{ - return _open(_path,_oflag); -} int _open(const char *_path, int _oflag,...) { @@ -55,9 +49,9 @@ int _open(const char *_path, int _oflag,...) DWORD dwCreationDistribution = 0; DWORD dwFlagsAndAttributes = 0; - if (( _oflag & _S_IREAD ) == _S_IREAD) + if (( _oflag & S_IREAD ) == S_IREAD) dwShareMode = FILE_SHARE_READ; - else if ( ( _oflag & _S_IWRITE) == _S_IWRITE ) { + else if ( ( _oflag & S_IWRITE) == S_IWRITE ) { dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; } @@ -74,18 +68,21 @@ _O_TEXT Opens file in text (translated) mode. (For more information, see Text else if (( _oflag & _O_WRONLY ) == _O_WRONLY ) dwDesiredAccess |= GENERIC_WRITE; - if (( _oflag & _S_IREAD ) == _S_IREAD ) + if (( _oflag & S_IREAD ) == S_IREAD ) dwShareMode |= FILE_SHARE_READ; - if (( _oflag & _S_IWRITE ) == _S_IWRITE ) + if (( _oflag & S_IWRITE ) == S_IWRITE ) dwShareMode |= FILE_SHARE_WRITE; if (( _oflag & (_O_CREAT | _O_EXCL ) ) == (_O_CREAT | _O_EXCL) ) dwCreationDistribution |= CREATE_NEW; - else if (( _oflag & (O_TRUNC | O_CREAT ) ) == (O_TRUNC | O_CREAT) ) - dwCreationDistribution |= CREATE_ALWAYS; - + else if (( _oflag & O_TRUNC ) == O_TRUNC ) { + if (( _oflag & O_CREAT ) == O_CREAT ) + dwCreationDistribution |= CREATE_ALWAYS; + else if (( _oflag & O_RDONLY ) != O_RDONLY ) + dwCreationDistribution |= TRUNCATE_EXISTING; + } else if (( _oflag & _O_APPEND ) == _O_APPEND ) dwCreationDistribution |= OPEN_EXISTING; else if (( _oflag & _O_CREAT ) == _O_CREAT ) @@ -93,8 +90,7 @@ _O_TEXT Opens file in text (translated) mode. (For more information, see Text else dwCreationDistribution |= OPEN_EXISTING; -// if (( _oflag & _O_TRUNC ) == _O_TRUNC ) -// dwCreationDistribution |= TRUNCATE_EXISTING; + if (( _oflag & _O_RANDOM ) == _O_RANDOM ) dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS; @@ -224,7 +220,7 @@ int __fileno_dup2( int handle1, int handle2 ) int __fileno_setmode(int _fd, int _newmode) { int m; - if ( _fd < 0 ) + if ( _fd < minfno ) return -1; if ( _fd >= maxfno ) @@ -245,10 +241,15 @@ int __fileno_close(int _fd) fileno_modes[_fd].fd = -1; fileno_modes[_fd].hFile = (HANDLE)-1; - + return 0; } int _open_osfhandle (void *osfhandle, int flags ) { return __fileno_alloc((HANDLE)osfhandle, flags); } + +void *_get_osfhandle( int fileno ) +{ + return filehnd(fileno); +} \ No newline at end of file diff --git a/reactos/lib/crtdll/io/pipe.c b/reactos/lib/crtdll/io/pipe.c index 959d0e1ff83..8c67f7a08ed 100644 --- a/reactos/lib/crtdll/io/pipe.c +++ b/reactos/lib/crtdll/io/pipe.c @@ -8,8 +8,8 @@ * 28/12/98: Appropriated for Reactos */ #include -#include -#include +#include +#include int _pipe(int _fildes[2], unsigned int size, int mode ) diff --git a/reactos/lib/crtdll/io/read.c b/reactos/lib/crtdll/io/read.c index 5dc92ed1f5c..965f4e1b2c2 100644 --- a/reactos/lib/crtdll/io/read.c +++ b/reactos/lib/crtdll/io/read.c @@ -7,7 +7,7 @@ * UPDATE HISTORY: * 28/12/98: Created */ -#include +#include #include size_t _read(int _fd, void *_buf, size_t _nbyte) diff --git a/reactos/lib/crtdll/io/setmode.c b/reactos/lib/crtdll/io/setmode.c index 8510f56e77f..6ccbc2f4eb3 100644 --- a/reactos/lib/crtdll/io/setmode.c +++ b/reactos/lib/crtdll/io/setmode.c @@ -8,9 +8,9 @@ * 28/12/98: Created */ -#include -#include -#include +#include +#include +#include #undef setmode int setmode(int _fd, int _newmode) diff --git a/reactos/lib/crtdll/io/sopen.c b/reactos/lib/crtdll/io/sopen.c index 680227e30a2..5282f14b506 100644 --- a/reactos/lib/crtdll/io/sopen.c +++ b/reactos/lib/crtdll/io/sopen.c @@ -1,4 +1,4 @@ -#include +#include int _sopen(char *path,int access,int shflag,int mode) diff --git a/reactos/lib/crtdll/io/tell.c b/reactos/lib/crtdll/io/tell.c index f96a453d098..ce53df0f09c 100644 --- a/reactos/lib/crtdll/io/tell.c +++ b/reactos/lib/crtdll/io/tell.c @@ -1,6 +1,6 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include off_t diff --git a/reactos/lib/crtdll/io/umask.c b/reactos/lib/crtdll/io/umask.c index e21a33f17ac..7a8323b66a7 100644 --- a/reactos/lib/crtdll/io/umask.c +++ b/reactos/lib/crtdll/io/umask.c @@ -1,11 +1,11 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include -mode_t -_umask(mode_t newmask) +unsigned _unMode_dll = 022; + +unsigned _umask (unsigned unMode) { - static mode_t the_mask = 022; - mode_t old_mask = the_mask; - the_mask = newmask; + unsigned old_mask = _unMode_dll; + _unMode_dll = unMode; return old_mask; } diff --git a/reactos/lib/crtdll/io/unlink.c b/reactos/lib/crtdll/io/unlink.c index de50275a28a..65ef9d40c92 100644 --- a/reactos/lib/crtdll/io/unlink.c +++ b/reactos/lib/crtdll/io/unlink.c @@ -8,7 +8,7 @@ * 28/12/98: Created */ #include -#include +#include diff --git a/reactos/lib/crtdll/io/write.c b/reactos/lib/crtdll/io/write.c index df9b11eda45..86822b5a65d 100644 --- a/reactos/lib/crtdll/io/write.c +++ b/reactos/lib/crtdll/io/write.c @@ -7,7 +7,7 @@ * UPDATE HISTORY: * 28/12/98: Created */ -#include +#include #include diff --git a/reactos/lib/crtdll/locale/locale.c b/reactos/lib/crtdll/locale/locale.c new file mode 100644 index 00000000000..6db5bf2ba14 --- /dev/null +++ b/reactos/lib/crtdll/locale/locale.c @@ -0,0 +1,172 @@ +/* +FUNCTION +<>, <>---select or query locale + +INDEX + setlocale +INDEX + localeconv +INDEX + _setlocale_r +INDEX + _localeconv_r + +ANSI_SYNOPSIS + #include + char *setlocale(int <[category]>, const char *<[locale]>); + lconv *localeconv(void); + + char *_setlocale_r(void *<[reent]>, + int <[category]>, const char *<[locale]>); + lconv *_localeconv_r(void *<[reent]>); + +TRAD_SYNOPSIS + #include + char *setlocale(<[category]>, <[locale]>) + int <[category]>; + char *<[locale]>; + + lconv *localeconv(); + + char *_setlocale_r(<[reent]>, <[category]>, <[locale]>) + char *<[reent]>; + int <[category]>; + char *<[locale]>; + + lconv *_localeconv_r(<[reent]>); + char *<[reent]>; + +DESCRIPTION +<> is the facility defined by ANSI C to condition the +execution environment for international collating and formatting +information; <> reports on the settings of the current +locale. + +This is a minimal implementation, supporting only the required <<``C''>> +value for <[locale]>; strings representing other locales are not +honored unless MB_CAPABLE is defined in which case three new +extensions are allowed for LC_CTYPE only: <<''C-JIS''>>, <<''C-EUCJP''>>, +and <<''C-SJIS''>>. (<<``''>> is also accepted; it represents the default locale +for an implementation, here equivalent to <<``C''>>.) + +If you use <> as the <[locale]> argument, <> returns +a pointer to the string representing the current locale (always +<<``C''>> in this implementation). The acceptable values for +<[category]> are defined in `<>' as macros beginning with +<<"LC_">>, but this implementation does not check the values you pass +in the <[category]> argument. + +<> returns a pointer to a structure (also defined in +`<>') describing the locale-specific conventions currently +in effect. + +<<_localeconv_r>> and <<_setlocale_r>> are reentrant versions of +<> and <> respectively. The extra argument +<[reent]> is a pointer to a reentrancy structure. + +RETURNS +<> returns either a pointer to a string naming the locale +currently in effect (always <<``C''>> for this implementation, or, if +the locale request cannot be honored, <>. + +<> returns a pointer to a structure of type <>, +which describes the formatting and collating conventions in effect (in +this implementation, always those of the C locale). + +PORTABILITY +ANSI C requires <>, but the only locale required across all +implementations is the C locale. + +No supporting OS subroutines are required. +*/ + +/* + * setlocale, localeconv : internationalize your locale. + * (Only "C" or null supported). + */ + +#include +#include +#include + + +int _current_category; /* used by setlocale */ +const char *_current_locale; +int __mb_cur_max_dll = 1; + +static const struct lconv lconv = +{ + ".", "", "", "", "", "", "", "", "", "", + CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX, + CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX, +}; + + +char * setlocale(int category ,const char *locale) +{ + static char lc_ctype[8] = "C"; + static char last_lc_ctype[8] = "C"; + +#ifndef MB_CAPABLE + if (locale) + { + if (strcmp (locale, "C") && strcmp (locale, "")) + return 0; + _current_category = category; + _current_locale = locale; + } + return "C"; +#else + if (locale) + { + if (category != LC_CTYPE) + { + if (strcmp (locale, "C") && strcmp (locale, "")) + return 0; + if (category == LC_ALL) + { + strcpy (last_lc_ctype, lc_ctype); + strcpy (lc_ctype, locale); + __mb_cur_max_dll = 1; + } + } + else + { + if (strcmp (locale, "C") && strcmp (locale, "") && + strcmp (locale, "C") && strcmp (locale, "C-JIS") && + strcmp (locale, "C-EUCJP") && strcmp (locale, "C-SJIS")) + return 0; + + strcpy (last_lc_ctype, lc_ctype); + strcpy (lc_ctype, locale); + + if (!strcmp (locale, "C-JIS")) + __mb_cur_max_dll = 8; + else if (strlen (locale) > 1) + __mb_cur_max_dll = 2; + else + __mb_cur_max_dll = 1; + } + _current_category = category; + _current_locale = locale; + + if (category == LC_CTYPE) + return last_lc_ctype; + } + else + { + if (category == LC_CTYPE) + return lc_ctype; + } + + return "C"; +#endif + +} + + +struct lconv *localeconv(void) +{ + return (struct lconv *) &lconv; +} + diff --git a/reactos/lib/crtdll/makefile b/reactos/lib/crtdll/makefile index 653aa27935a..bf763276618 100644 --- a/reactos/lib/crtdll/makefile +++ b/reactos/lib/crtdll/makefile @@ -25,8 +25,9 @@ CONIO_OBJECTS = conio/cputs.o conio/getch.o conio/getche.o conio/putch.o conio/u DIRECT_OBJECTS = direct/chdir.o direct/chdrive.o direct/getcwd.o direct/getdrive.o \ direct/rmdir.o direct/mkdir.o direct/getdfree.o +MALLOC_OBJECTS = malloc/expand.o malloc/heap.o -MISC_OBJECTS = misc/sleep.o misc/GetArgs.o misc/CRTfmode.o misc/CRTglob.o +MISC_OBJECTS = misc/GetArgs.o misc/setnew.o misc/purecall.o STRING_OBJECTS = string/memchr.o string/memcmp.o string/strcat.o \ string/strchr.o string/strcmp.o string/strcoll.o \ @@ -36,13 +37,14 @@ STRING_OBJECTS = string/memchr.o string/memcmp.o string/strcat.o \ string/strspn.o string/strstr.o string/strtok.o \ string/strxfrm.o string/memmove.o string/memset.o \ string/strdup.o string/strlwr.o string/strupr.o \ - string/str_old.o string/strerror.o + string/str_old.o string/strerror.o string/stricmp.o\ + string/strnlen.o WCHAR_OBJECTS = wchar/wcscat.o wchar/wcschr.o wchar/wcscmp.o \ wchar/wcscoll.o wchar/wcscpy.o wchar/wcscspn.o \ wchar/wcsdup.o wchar/wcsicmp.o wchar/wcslen.o \ wchar/wcslwr.o wchar/wcsncat.o wchar/wcsncmp.o \ - wchar/wcsncpy.o + wchar/wcsncpy.o STDIO_OBJECTS = stdio/getenv.o stdio/doprnt.o stdio/doscan.o stdio/filbuf.o \ stdio/fclose.o stdio/feof.o stdio/ferror.o stdio/fileno.o\ @@ -53,7 +55,7 @@ STDIO_OBJECTS = stdio/getenv.o stdio/doprnt.o stdio/doscan.o stdio/filbuf.o \ stdio/getchar.o stdio/gets.o stdio/getw.o stdio/perror.o stdio/printf.o \ stdio/putc.o stdio/putchar.o stdio/puts.o stdio/putw.o \ stdio/remove.o stdio/rename.o stdio/rewind.o stdio/allocfil.o\ - stdio/scanf.o stdio/setbuf.o stdio/setbuffe.o \ + stdio/scanf.o stdio/setbuf.o stdio/setbuffe.o stdlib/obsol.o\ stdio/setlineb.o stdio/setvbuf.o stdio/sprintf.o stdio/sscanf.o \ stdio/stdiohk.o stdio/stdhnd.o stdio/tempnam.o stdio/tmpfile.o stdio/tmpnam.o \ stdio/ungetc.o stdio/vfprintf.o stdio/vprintf.o stdio/vsprintf.o @@ -64,24 +66,30 @@ IO_OBJECTS = io/access.o io/close.o io/create.o io/dup.o io/dup2.o io/find.o io/ io/chmod.o io/chsize.o io/commit.o io/locking.o io/pipe.o io/sopen.o io/filelen.o\ io/umask.o io/tell.o io/eof.o +SEARCH_OBJECTS = search/lsearch.o search/lfind.o + STDLIB_OBJECTS = stdlib/abort.o stdlib/abs.o stdlib/atexit.o stdlib/atof.o stdlib/atoi.o \ - stdlib/bsearch.o stdlib/div.o stdlib/errno.o stdlib/Exit.o \ - stdlib/fullpath.o stdlib/labs.o stdlib/ldiv.o stdlib/llabs.o stdlib/lldiv.o \ + stdlib/bsearch.o stdlib/div.o stdlib/errno.o stdlib/_exit.o \ + stdlib/fullpath.o stdlib/labs.o stdlib/ldiv.o \ stdlib/makepath.o stdlib/malloc.o stdlib/putenv.o stdlib/qsort.o \ stdlib/rand.o stdlib/senv.o stdlib/splitp.o stdlib/strtod.o stdlib/strtol.o \ - stdlib/strtoul.o + stdlib/strtoul.o stdlib/swab.o stdlib/atol.o SIGNAL_OBJECTS = signal/signal.o PROCESS_OBJECTS = process/_cwait.o process/dll.o process/spawnl.o process/spawnlp.o process/spawnlpe.o process/spawnvpe.o process/spawnvp.o \ process/spawnv.o process/spawnve.o process/spawnle.o process/execl.o process/execlp.o process/execlpe.o \ - process/execvpe.o process/execvp.o process/execv.o process/execle.o process/_system.o + process/execvpe.o process/execvp.o process/execv.o process/execle.o process/_system.o\ + process/threadid.o process/thread.o + +TCHAR_OBJECTS = tchar/strdec.o tchar/strinc.o tchar/strninc.o tchar/strncnt.o tchar/strnextc.o tchar/strspnp.o TIME_OBJECTS = time/ctime.o time/difftime.o time/strftime.o time/time.o time/clock.o -FLOAT_OBJECTS = float/fpreset.o float/clearfp.o float/cntrlfp.o float/statfp.o float/logb.o +FLOAT_OBJECTS = float/fpreset.o float/clearfp.o float/cntrlfp.o float/statfp.o float/logb.o\ + float/chgsign.o -SYS_STAT_OBJECTS = sys_stat/fstat.o sys_stat/stat.o +SYS_STAT_OBJECTS = sys_stat/fstat.o sys_stat/stat.o sys_stat/futime.o MATH_OBJECTS = math/acos.o math/acosh.o math/asin.o math/asinh.o math/atan.o math/atan2.o\ @@ -89,17 +97,18 @@ MATH_OBJECTS = math/acos.o math/acosh.o math/asin.o math/asinh.o math/atan.o mat math/floor.o math/fmod.o math/frexp.o math/huge_val.o math/hypot.o\ math/ldexp.o math/log.o math/log10.o math/modf.o math/pow.o\ math/sin.o math/sinh.o math/sqrt.o math/tan.o\ - math/tanh.o + math/tanh.o math/stubs.o math/j0_y0.o math/j1_y1.o math/jn_yn.o OBJECTS = $(ASSERT_OBJECTS) $(CTYPE_OBJECTS) $(CONIO_OBJECTS) $(DIRECT_OBJECTS)\ $(MISC_OBJECTS) $(STRING_OBJECTS) $(STDIO_OBJECTS) $(STDLIB_OBJECTS) \ - $(IO_OBJECTS) $(PROCESS_OBJECTS) $(TIME_OBJECTS) \ - $(SYS_STAT_OBJECTS) $(SIGNAL_OBJECTS) $(MATH_OBJECTS) $(FLOAT_OBJECTS) + $(IO_OBJECTS) $(PROCESS_OBJECTS) $(TIME_OBJECTS) $(MALLOC_OBJECTS)\ + $(SYS_STAT_OBJECTS) $(SIGNAL_OBJECTS) $(MATH_OBJECTS) $(FLOAT_OBJECTS)\ + $(SEARCH_OBJECTS) crtdll.a: $(OBJECTS) - $(LD) -r $(OBJECTS) -o crtdll.a + $(LD) -r $(OBJECTS) -o crtdll.a crtdll.dll: $(DLLMAIN) $(OBJECTS) crtdll.def $(LD) -r $(OBJECTS) -o crtdll.o diff --git a/reactos/lib/crtdll/malloc/expand.c b/reactos/lib/crtdll/malloc/expand.c new file mode 100644 index 00000000000..dec9d9376a7 --- /dev/null +++ b/reactos/lib/crtdll/malloc/expand.c @@ -0,0 +1,28 @@ +#include +#include +#include +#include + +void *_expand( void *pold, size_t size ) +{ + PHEAP_BUCKET pbucket; + PHEAP_SUBALLOC psub; + PHEAP_FRAGMENT pfrag=(PHEAP_FRAGMENT)((LPVOID)pold-HEAP_FRAG_ADMIN_SIZE); + + /* sanity checks */ + if(pfrag->Magic!=HEAP_FRAG_MAGIC) + return NULL; + + /* get bucket size */ + psub=pfrag->Sub; + pbucket=psub->Bucket; + if(size<=pbucket->Size) + { + pfrag->Size=size; + return pold; + } + else + return NULL; + + return NULL; +} diff --git a/reactos/lib/crtdll/malloc/heap.c b/reactos/lib/crtdll/malloc/heap.c new file mode 100644 index 00000000000..8f9a6ed5305 --- /dev/null +++ b/reactos/lib/crtdll/malloc/heap.c @@ -0,0 +1,31 @@ + +#include +#include +#include +#include + +int _heapchk (void) +{ + if (!HeapValidate(GetProcessHeap(), 0, NULL)) + return -1; + return 0; +} +int _heapmin (void) +{ + if ( !HeapCompact( GetProcessHeap(), 0 )) + return -1; + return 0; +} +int _heapset (unsigned int unFill) +{ + if ( _heapchk() == -1 ) + return -1; + return 0; + +} + + +int _heapwalk ( struct _heapinfo *entry) +{ + return 0; +} \ No newline at end of file diff --git a/reactos/lib/crtdll/math/acos.c b/reactos/lib/crtdll/math/acos.c index 5c3a0d18707..34707822aaf 100644 --- a/reactos/lib/crtdll/math/acos.c +++ b/reactos/lib/crtdll/math/acos.c @@ -18,7 +18,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include double acos (double __x) { diff --git a/reactos/lib/crtdll/math/acosh.c b/reactos/lib/crtdll/math/acosh.c index 6e13bbe6ec6..15f556cbc96 100644 --- a/reactos/lib/crtdll/math/acosh.c +++ b/reactos/lib/crtdll/math/acosh.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include double acosh(double x) diff --git a/reactos/lib/crtdll/math/asin.c b/reactos/lib/crtdll/math/asin.c index aef4b42ee99..6aeba7d9e26 100644 --- a/reactos/lib/crtdll/math/asin.c +++ b/reactos/lib/crtdll/math/asin.c @@ -18,7 +18,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include double asin (double __x) { diff --git a/reactos/lib/crtdll/math/asinh.c b/reactos/lib/crtdll/math/asinh.c index e27e20da7ed..7089ebcf64a 100644 --- a/reactos/lib/crtdll/math/asinh.c +++ b/reactos/lib/crtdll/math/asinh.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include double asinh(double x) diff --git a/reactos/lib/crtdll/math/atanh.c b/reactos/lib/crtdll/math/atanh.c index 8335dc78b3a..fdfb3194cf9 100644 --- a/reactos/lib/crtdll/math/atanh.c +++ b/reactos/lib/crtdll/math/atanh.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include double atanh(double x) diff --git a/reactos/lib/crtdll/math/cabs.c b/reactos/lib/crtdll/math/cabs.c index efee29385a5..015219c8fee 100644 --- a/reactos/lib/crtdll/math/cabs.c +++ b/reactos/lib/crtdll/math/cabs.c @@ -1,4 +1,4 @@ -#include +#include double _cabs( struct _complex z ) { diff --git a/reactos/lib/crtdll/math/cosh.c b/reactos/lib/crtdll/math/cosh.c index c2cca978ace..85e95f088ac 100644 --- a/reactos/lib/crtdll/math/cosh.c +++ b/reactos/lib/crtdll/math/cosh.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include double cosh(double x) { diff --git a/reactos/lib/crtdll/math/frexp.c b/reactos/lib/crtdll/math/frexp.c index 913f16f06bd..2e951f46607 100644 --- a/reactos/lib/crtdll/math/frexp.c +++ b/reactos/lib/crtdll/math/frexp.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include double frexp(double x, int *exptr) diff --git a/reactos/lib/crtdll/math/huge_val.c b/reactos/lib/crtdll/math/huge_val.c index 2fb55f2d7f7..b01e71969ae 100644 --- a/reactos/lib/crtdll/math/huge_val.c +++ b/reactos/lib/crtdll/math/huge_val.c @@ -1,4 +1,13 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -double_t _HUGE_dll = { 0x00000, 0x00000, 0x7ff, 0x0 }; +typedef struct { + unsigned mantissal:32; + unsigned mantissah:20; + unsigned exponent:11; + unsigned sign:1; +} double_t; + + +#undef _HUGE +double_t _HUGE = { 0x00000, 0x00000, 0x7ff, 0x0 }; +double *_HUGE_dll = (double *)&_HUGE; diff --git a/reactos/lib/crtdll/math/hypot.c b/reactos/lib/crtdll/math/hypot.c index 9d0de607ca4..08e34923f04 100644 --- a/reactos/lib/crtdll/math/hypot.c +++ b/reactos/lib/crtdll/math/hypot.c @@ -16,9 +16,9 @@ * */ -#include -#include -#include +#include +#include +#include /* Approximate square roots of DBL_MAX and DBL_MIN. Numbers between these two shouldn't neither overflow nor underflow @@ -27,7 +27,7 @@ #define __SQRT_DBL_MIN 2.3e-162 double -hypot(double x, double y) +_hypot(double x, double y) { double abig = fabs(x), asmall = fabs(y); double ratio; @@ -78,21 +78,19 @@ hypot(double x, double y) #ifdef TEST -#include +#include int main(void) { - printf("hypot(3, 4) =\t\t\t %25.17e\n", hypot(3., 4.)); - printf("hypot(3*10^150, 4*10^150) =\t %25.17g\n", hypot(3.e+150, 4.e+150)); - printf("hypot(3*10^306, 4*10^306) =\t %25.17g\n", hypot(3.e+306, 4.e+306)); - printf("hypot(3*10^-320, 4*10^-320) =\t %25.17g\n", - hypot(3.e-320, 4.e-320)); - printf("hypot(0.7*DBL_MAX, 0.7*DBL_MAX) =%25.17g\n", - hypot(0.7*DBL_MAX, 0.7*DBL_MAX)); - printf("hypot(DBL_MAX, 1.0) =\t\t %25.17g\n", hypot(DBL_MAX, 1.0)); - printf("hypot(1.0, DBL_MAX) =\t\t %25.17g\n", hypot(1.0, DBL_MAX)); - printf("hypot(0.0, DBL_MAX) =\t\t %25.17g\n", hypot(0.0, DBL_MAX)); + printf("hypot(3, 4) =\t\t\t %25.17e\n", _hypot(3., 4.)); + printf("hypot(3*10^150, 4*10^150) =\t %25.17g\n", _hypot(3.e+150, 4.e+150)); + printf("hypot(3*10^306, 4*10^306) =\t %25.17g\n", _hypot(3.e+306, 4.e+306)); + printf("hypot(3*10^-320, 4*10^-320) =\t %25.17g\n",_hypot(3.e-320, 4.e-320)); + printf("hypot(0.7*DBL_MAX, 0.7*DBL_MAX) =%25.17g\n",_hypot(0.7*DBL_MAX, 0.7*DBL_MAX)); + printf("hypot(DBL_MAX, 1.0) =\t\t %25.17g\n", _hypot(DBL_MAX, 1.0)); + printf("hypot(1.0, DBL_MAX) =\t\t %25.17g\n", _hypot(1.0, DBL_MAX)); + printf("hypot(0.0, DBL_MAX) =\t\t %25.17g\n", _hypot(0.0, DBL_MAX)); return 0; } diff --git a/reactos/lib/crtdll/math/j0_y0.c b/reactos/lib/crtdll/math/j0_y0.c new file mode 100644 index 00000000000..fe3c422f3bc --- /dev/null +++ b/reactos/lib/crtdll/math/j0_y0.c @@ -0,0 +1,11 @@ +#include + +double _j0(double x) +{ + return x; +} + +double _y0(double x) +{ + return x; +} \ No newline at end of file diff --git a/reactos/lib/crtdll/math/j1_y1.c b/reactos/lib/crtdll/math/j1_y1.c new file mode 100644 index 00000000000..76432b9f67b --- /dev/null +++ b/reactos/lib/crtdll/math/j1_y1.c @@ -0,0 +1,11 @@ +#include + +double _j1(double x) +{ + return x; +} + +double _y1(double x) +{ + return x; +} \ No newline at end of file diff --git a/reactos/lib/crtdll/math/jn_yn.c b/reactos/lib/crtdll/math/jn_yn.c new file mode 100644 index 00000000000..b3a718163d4 --- /dev/null +++ b/reactos/lib/crtdll/math/jn_yn.c @@ -0,0 +1,11 @@ +#include + +double _jn(int n, double x) +{ + return x; +} + +double _yn(int n, double x) +{ + return x; +} \ No newline at end of file diff --git a/reactos/lib/crtdll/math/modf.c b/reactos/lib/crtdll/math/modf.c index 40da2157f10..9912564b379 100644 --- a/reactos/lib/crtdll/math/modf.c +++ b/reactos/lib/crtdll/math/modf.c @@ -1,6 +1,6 @@ // from linux libc -#include +#include /* Slooow version. */ diff --git a/reactos/lib/crtdll/math/sinh.c b/reactos/lib/crtdll/math/sinh.c index d00e2803e17..7acb21f05d4 100644 --- a/reactos/lib/crtdll/math/sinh.c +++ b/reactos/lib/crtdll/math/sinh.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include double sinh(double x) { diff --git a/reactos/lib/crtdll/math/stubs.c b/reactos/lib/crtdll/math/stubs.c new file mode 100644 index 00000000000..5c7686d2693 --- /dev/null +++ b/reactos/lib/crtdll/math/stubs.c @@ -0,0 +1,84 @@ +#include + +double _CIsin (double x); +double _CIcos (double x); +double _CItan (double x); +double _CIsinh (double x); +double _CIcosh (double x); +double _CItanh (double x); +double _CIasin (double x); +double _CIacos (double x); +double _CIatan (double x); +double _CIatan2 (double y, double x); +double _CIexp (double x); +double _CIlog (double x); +double _CIlog10 (double x); +double _CIpow (double x, double y); +double _CIsqrt (double x); +double _CIfmod (double x, double y); + + +double _CIsin (double x) +{ + return sin(x); +} +double _CIcos (double x) +{ + return cos(x); +} +double _CItan (double x) +{ + return tan(x); +} +double _CIsinh (double x) +{ + return sinh(x); +} +double _CIcosh (double x) +{ + return cosh(x); +} +double _CItanh (double x) +{ + return tanh(x); +} +double _CIasin (double x) +{ + return asin(x); +} +double _CIacos (double x) +{ + return acos(x); +} +double _CIatan (double x) +{ + return atan(x); +} +double _CIatan2 (double y, double x) +{ + return atan2(y,x); +} +double _CIexp (double x) +{ + return exp(x); +} +double _CIlog (double x) +{ + return log(x); +} +double _CIlog10 (double x) +{ + return log10(x); +} +double _CIpow (double x, double y) +{ + return pow(x,y); +} +double _CIsqrt (double x) +{ + return sqrt(x); +} +double _CIfmod (double x, double y) +{ + return fmod(x,y); +} \ No newline at end of file diff --git a/reactos/lib/crtdll/math/tanh.c b/reactos/lib/crtdll/math/tanh.c index c2eb9663199..12b00128104 100644 --- a/reactos/lib/crtdll/math/tanh.c +++ b/reactos/lib/crtdll/math/tanh.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include double tanh(double x) { diff --git a/reactos/lib/crtdll/misc/GetArgs.c b/reactos/lib/crtdll/misc/GetArgs.c index 6e2ed31031a..84e79987d64 100644 --- a/reactos/lib/crtdll/misc/GetArgs.c +++ b/reactos/lib/crtdll/misc/GetArgs.c @@ -1,20 +1,21 @@ #include -#include -#include +#include +#include -#undef _acmdln_dll + +char *_pgmptr_dll; char *_acmdln_dll; -#undef _commode_dll unsigned int _commode_dll; - -#undef _winmajor_dll unsigned int _winmajor_dll; -#undef _winminor_dll unsigned int _winminor_dll; -#undef _winver_dll unsigned int _winver_dll; -#undef _osver_dll -unsigned int _osver_dll; + + +unsigned int _osmajor_dll; +unsigned int _osminor_dll; +unsigned int _osmode_dll; +unsigned int _osver_dll; +unsigned int _osversion_dll; #undef __argv #undef __argc @@ -33,8 +34,7 @@ char **_environ; char *** _environ_dll = &_environ; - -int __GetMainArgs(int *argc,char ***argv,char **env,int flag) +int __GetMainArgs(int *argc,char ***argv,char ***env,int flag) { int i,afterlastspace; DWORD version; @@ -80,10 +80,12 @@ int __GetMainArgs(int *argc,char ***argv,char **env,int flag) _environ = (char **)GetEnvironmentStringsA();; _environ_dll = &_environ; - argc = __argc_dll; - argv = __argv_dll; - env = _environ_dll; + *argc = __argc; + *argv = __argv; + *env = _environ; + _pgmptr_dll = strdup((char *)argv[0]); + return 0; } diff --git a/reactos/lib/crtdll/misc/crt1.c b/reactos/lib/crtdll/misc/crt1.c index 222a40b094f..9d72650e31a 100644 --- a/reactos/lib/crtdll/misc/crt1.c +++ b/reactos/lib/crtdll/misc/crt1.c @@ -19,18 +19,18 @@ * DISCLAMED. This includes but is not limited to warrenties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.1 $ - * $Author: rex $ - * $Date: 1999/01/16 02:11:43 $ + * $Revision: 1.2 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:43:55 $ * */ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include /* NOTE: The code for initializing the _argv, _argc, and environ variables @@ -95,11 +95,7 @@ mainCRTStartup () * UnhandledExceptionFilter, which is prototyped just above * (see Functions.h). */ - SetUnhandledExceptionFilter (NULL); - /* - * Initialize errno. - */ - errno = 0; + //SetUnhandledExceptionFilter (NULL); /* * Initialize floating point unit. @@ -111,7 +107,6 @@ mainCRTStartup () */ _mingw32_init_mainargs(); - /* * Sets the default file mode for stdin, stdout and stderr, as well * as files later opened by the user, to _CRT_fmode. @@ -125,8 +120,7 @@ mainCRTStartup () * that one calls WinMain. See main.c in the 'lib' dir * for more details. */ - - nRet = cmdmain(_argc, _argv, environ); + nRet = main(_argc, _argv, _environ); /* * Perform exit processing for the C library. This means @@ -163,4 +157,3 @@ asm (".section .idata$3\n" ".long 0,0,0,0,0,0,0,0"); #endif #endif - diff --git a/reactos/lib/crtdll/misc/dllcrt1.c b/reactos/lib/crtdll/misc/dllcrt1.c index de7ea379536..02c2b91fd78 100644 --- a/reactos/lib/crtdll/misc/dllcrt1.c +++ b/reactos/lib/crtdll/misc/dllcrt1.c @@ -20,15 +20,15 @@ * DISCLAMED. This includes but is not limited to warrenties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.1 $ - * $Author: rex $ - * $Date: 1999/01/16 02:11:43 $ + * $Revision: 1.2 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:43:56 $ * */ -#include -#include -#include +#include +#include +#include #include /* See note in crt0.c */ diff --git a/reactos/lib/crtdll/misc/gccmain.c b/reactos/lib/crtdll/misc/gccmain.c index 8cc03aa8878..49bb6db858f 100644 --- a/reactos/lib/crtdll/misc/gccmain.c +++ b/reactos/lib/crtdll/misc/gccmain.c @@ -11,14 +11,14 @@ * Contributors: * Code supplied by Stan Cox * - * $Revision: 1.1 $ - * $Author: rex $ - * $Date: 1999/01/16 02:11:43 $ + * $Revision: 1.2 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:43:56 $ * */ /* Needed for the atexit prototype. */ -#include +#include typedef void (*func_ptr) (void); extern func_ptr __CTOR_LIST__[]; diff --git a/reactos/lib/crtdll/misc/init.c b/reactos/lib/crtdll/misc/init.c index 1945d258b7e..6bd8a626f99 100644 --- a/reactos/lib/crtdll/misc/init.c +++ b/reactos/lib/crtdll/misc/init.c @@ -19,9 +19,9 @@ * DISCLAMED. This includes but is not limited to warrenties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.1 $ - * $Author: rex $ - * $Date: 1999/01/16 02:11:43 $ + * $Revision: 1.2 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:43:56 $ * */ diff --git a/reactos/lib/crtdll/misc/main.c b/reactos/lib/crtdll/misc/main.c index 989c7fb6979..a539f7edfc8 100644 --- a/reactos/lib/crtdll/misc/main.c +++ b/reactos/lib/crtdll/misc/main.c @@ -20,14 +20,14 @@ * DISCLAMED. This includes but is not limited to warrenties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.1 $ - * $Author: rex $ - * $Date: 1999/01/16 02:11:43 $ + * $Revision: 1.2 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:43:56 $ * */ -#include -#include +#include +#include #include #define ISSPACE(a) (a == ' ' || a == '\t') diff --git a/reactos/lib/crtdll/misc/purecall.c b/reactos/lib/crtdll/misc/purecall.c new file mode 100644 index 00000000000..f522dee7589 --- /dev/null +++ b/reactos/lib/crtdll/misc/purecall.c @@ -0,0 +1,5 @@ + +int _purecall(void) +{ + return 0; +} \ No newline at end of file diff --git a/reactos/lib/crtdll/misc/setnew.cc b/reactos/lib/crtdll/misc/setnew.cc new file mode 100644 index 00000000000..1d37123bdb5 --- /dev/null +++ b/reactos/lib/crtdll/misc/setnew.cc @@ -0,0 +1,28 @@ +#include + + +typedef int (* new_handler_t)( size_t ); + +new_handler_t new_handler; + +new_handler_t _set_new_handler(new_handler_t hnd) +{ + new_handler_t old = new_handler; + + new_handler = hnd; + + return old; +} + +void operator delete(void* m) +{ + if ( m != NULL ) + free( m ); +} + +void * operator new( unsigned int s ) +{ + if ( s == 0 ) + s = 1; + return malloc( s ); +} diff --git a/reactos/lib/crtdll/process/_cwait.c b/reactos/lib/crtdll/process/_cwait.c index e7fdb2268a3..a437c756a2e 100644 --- a/reactos/lib/crtdll/process/_cwait.c +++ b/reactos/lib/crtdll/process/_cwait.c @@ -1,20 +1,17 @@ -#include #include +#include +#include +#include -int _cwait( int *termstat, int procHandle, int action ) +int _cwait (int* pnStatus, int hProc, int nAction) { - DWORD RetVal; - RetVal = WaitForSingleObject((HANDLE)procHandle, INFINITE); - if (RetVal == WAIT_FAILED || RetVal == WAIT_ABANDONED) { - //errno = ECHILD; + nAction = 0; + if ( WaitForSingleObject((void *)hProc,INFINITE) != WAIT_OBJECT_0 ) { + __set_errno(ECHILD); return -1; } - if ( RetVal == WAIT_OBJECT_0 ) { - GetExitCodeProcess((HANDLE)procHandle, termstat); - return procHandle; - } - - return -1; - // WAIT_TIMEOUT -} + if ( !GetExitCodeProcess((void *)hProc,pnStatus) ) + return -1; + return *pnStatus; +} \ No newline at end of file diff --git a/reactos/lib/crtdll/process/_system.c b/reactos/lib/crtdll/process/_system.c index f8c9bada2fa..64f6af59d68 100644 --- a/reactos/lib/crtdll/process/_system.c +++ b/reactos/lib/crtdll/process/_system.c @@ -1,5 +1,7 @@ -#include +#include #include +#include +#include int system(const char *command) { diff --git a/reactos/lib/crtdll/process/dll.c b/reactos/lib/crtdll/process/dll.c index 1dbaca1a8d2..64e7938a396 100644 --- a/reactos/lib/crtdll/process/dll.c +++ b/reactos/lib/crtdll/process/dll.c @@ -1,5 +1,5 @@ #include -#include +#include void *_loaddll (char *name) { @@ -9,4 +9,15 @@ void *_loaddll (char *name) int _unloaddll(void *handle) { return FreeLibrary(handle); -} \ No newline at end of file +} + +FARPROC _getdllprocaddr(void *hModule,char * lpProcName, int iOrdinal) +{ + + + if ( lpProcName != NULL ) + return GetProcAddress(hModule, lpProcName); + else + return GetProcAddress(hModule, (LPSTR)iOrdinal); + return (NULL); +} diff --git a/reactos/lib/crtdll/process/execl.c b/reactos/lib/crtdll/process/execl.c index 779d8e3e944..1769cd2009f 100644 --- a/reactos/lib/crtdll/process/execl.c +++ b/reactos/lib/crtdll/process/execl.c @@ -1,9 +1,12 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include +#include -int _execl(const char *path, const char *argv0, ...) +int _execl(const char* szPath, const char* szArgv0, ...) { - return _spawnve(P_OVERLAY, path, (char *const*)&argv0, _environ); + va_list a = 0; + va_start(a,szArgv0); + return _spawnve(P_OVERLAY, szPath, (char *const*)a, _environ); } diff --git a/reactos/lib/crtdll/process/execle.c b/reactos/lib/crtdll/process/execle.c index 485c758f776..0f5d5adca4b 100644 --- a/reactos/lib/crtdll/process/execle.c +++ b/reactos/lib/crtdll/process/execle.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include #define scan_ptr() \ const char **ptr; \ diff --git a/reactos/lib/crtdll/process/execlp.c b/reactos/lib/crtdll/process/execlp.c index b25fe9d38fc..bb79013b971 100644 --- a/reactos/lib/crtdll/process/execlp.c +++ b/reactos/lib/crtdll/process/execlp.c @@ -1,7 +1,7 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include int _execlp(const char *path, const char *argv0, ...) { diff --git a/reactos/lib/crtdll/process/execlpe.c b/reactos/lib/crtdll/process/execlpe.c index da5f70848e5..b4d514eae2b 100644 --- a/reactos/lib/crtdll/process/execlpe.c +++ b/reactos/lib/crtdll/process/execlpe.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include #define scan_ptr() \ diff --git a/reactos/lib/crtdll/process/execv.c b/reactos/lib/crtdll/process/execv.c index 123b69f699d..d1d2bb862ba 100644 --- a/reactos/lib/crtdll/process/execv.c +++ b/reactos/lib/crtdll/process/execv.c @@ -1,9 +1,9 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include -int _execv(const char *path, const char * const *argv) +int _execv(const char* szPath, char* const* szaArgv) { - return _spawnve(P_OVERLAY, path, argv, _environ); + return _spawnve(P_OVERLAY, szPath, szaArgv, _environ); } diff --git a/reactos/lib/crtdll/process/execve.c b/reactos/lib/crtdll/process/execve.c index 38b4a96b7c2..707a1de512f 100644 --- a/reactos/lib/crtdll/process/execve.c +++ b/reactos/lib/crtdll/process/execve.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -//#include -//#include -#include +//#include +//#include +#include int execve(const char *path,const char * const argv[], char * const envp[]) { diff --git a/reactos/lib/crtdll/process/execvp.c b/reactos/lib/crtdll/process/execvp.c index b1f15d8090d..7dd5a22e93e 100644 --- a/reactos/lib/crtdll/process/execvp.c +++ b/reactos/lib/crtdll/process/execvp.c @@ -1,9 +1,9 @@ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details *///#include -//#include -#include -#include +/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details *///#include +//#include +#include +#include -int _execvp(const char *path,const char * const argv[]) +int _execvp(const char* szPath, char* const* szaArgv) { - return _spawnvpe(P_OVERLAY, path, argv, _environ); + return _spawnvpe(P_OVERLAY, szPath, szaArgv, _environ); } diff --git a/reactos/lib/crtdll/process/execvpe.c b/reactos/lib/crtdll/process/execvpe.c index df000454262..b7393ebcb43 100644 --- a/reactos/lib/crtdll/process/execvpe.c +++ b/reactos/lib/crtdll/process/execvpe.c @@ -1,11 +1,11 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include -int _execvpe(const char *path,const char * const argv[],const char * const envp[]) +int _execvpe(const char* szPath, char* const* szaArgv, char* const* szaEnv) { - return _spawnvpe(P_OVERLAY, path, argv, envp); + return _spawnvpe(P_OVERLAY, szPath, szaArgv, szaEnv); } diff --git a/reactos/lib/crtdll/process/spawnl.c b/reactos/lib/crtdll/process/spawnl.c index b0ecf0b248b..499509ee22a 100644 --- a/reactos/lib/crtdll/process/spawnl.c +++ b/reactos/lib/crtdll/process/spawnl.c @@ -1,10 +1,12 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include +#include +#include +#include -extern char **_environ; - -int _spawnl(int mode, const char *path, const char *argv0, ...) +int _spawnl(int nMode, const char* szPath, const char* szArgv0,...) { - return spawnve(mode, path, (char * const *)&argv0, _environ); + va_list a = 0; + va_start(a,szArgv0); + return _spawnve(nMode, szPath, (char * const *)a, _environ); } diff --git a/reactos/lib/crtdll/process/spawnle.c b/reactos/lib/crtdll/process/spawnle.c index ff582a81304..0f1573f8d5e 100644 --- a/reactos/lib/crtdll/process/spawnle.c +++ b/reactos/lib/crtdll/process/spawnle.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include #define scan_ptr() \ const char **ptr; \ diff --git a/reactos/lib/crtdll/process/spawnlp.c b/reactos/lib/crtdll/process/spawnlp.c index 568cf8784fe..3e5c55b3e3a 100644 --- a/reactos/lib/crtdll/process/spawnlp.c +++ b/reactos/lib/crtdll/process/spawnlp.c @@ -1,9 +1,12 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include +#include -int _spawnlp(int mode, const char *path, const char *argv0, ...) +int _spawnlp(int nMode, const char* szPath, const char* szArgv0, ...) { - return _spawnvpe(mode, path, (char * const *)&argv0, (char * const *)_environ); + va_list a = 0; + va_start(a,szArgv0); + return _spawnvpe(nMode, szPath, (char * const *)a, _environ); } diff --git a/reactos/lib/crtdll/process/spawnlpe.c b/reactos/lib/crtdll/process/spawnlpe.c index a4eb9167b44..4ca400ac128 100644 --- a/reactos/lib/crtdll/process/spawnlpe.c +++ b/reactos/lib/crtdll/process/spawnlpe.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include #define scan_ptr() \ const char **ptr; \ union { const char **ccpp; const char *ccp; } u; \ diff --git a/reactos/lib/crtdll/process/spawnv.c b/reactos/lib/crtdll/process/spawnv.c index 71d7403a202..1ebb2cc0ba0 100644 --- a/reactos/lib/crtdll/process/spawnv.c +++ b/reactos/lib/crtdll/process/spawnv.c @@ -1,10 +1,9 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include - -int _spawnv(int mode, const char *path,const char *const argv[]) +int _spawnv (int nMode, const char* szPath, char* const* szaArgv) { - return _spawnve(mode, path, (char * const *)argv, _environ); + return _spawnve(nMode, szPath, (char * const *)szaArgv, _environ); } diff --git a/reactos/lib/crtdll/process/spawnve.c b/reactos/lib/crtdll/process/spawnve.c index 86c83d573b9..00aec7fbd7c 100644 --- a/reactos/lib/crtdll/process/spawnve.c +++ b/reactos/lib/crtdll/process/spawnve.c @@ -1,12 +1,12 @@ -#include -#include +#include +#include #include -#include +#include int _p_overlay = 2; -int _spawnve(int mode, const char *path,const char *const argv[],const char *const envp[]) +int _spawnve(int nMode, const char* szPath, char* const* szaArgv, char* const* szaEnv) { char ApplicationName[MAX_PATH]; @@ -16,12 +16,12 @@ int _spawnve(int mode, const char *path,const char *const argv[],const char *con int i = 0; CommandLine[0] = 0; - while(argv[i] != NULL ) { - strcat(CommandLine,argv[i]); + while(szaArgv[i] != NULL ) { + strcat(CommandLine,szaArgv[i]); strcat(CommandLine," "); i++; } - strcpy(ApplicationName,argv[0]); + strcpy(ApplicationName,szaArgv[0]); fflush(stdout); /* just in case */ StartupInfo.cb = sizeof(STARTUPINFO); @@ -29,15 +29,14 @@ int _spawnve(int mode, const char *path,const char *const argv[],const char *con StartupInfo.dwFlags = 0; -// if ( CreateProcessA(ApplicationName,CommandLine,NULL,NULL,TRUE,CREATE_NEW_CONSOLE|NORMAL_PRIORITY_CLASS,NULL,*envp,&StartupInfo,&ProcessInformation) ) { -// errno = GetLastError(); -// return -1; -// } + if ( CreateProcessA(ApplicationName,CommandLine,NULL,NULL,TRUE,CREATE_NEW_CONSOLE|NORMAL_PRIORITY_CLASS,NULL,*szaEnv,&StartupInfo,&ProcessInformation) ) { + return -1; + } - if (mode == P_OVERLAY) - _exit(i); + // if (nMode == P_OVERLAY) + // _exit(i); // _P_NOWAIT or _P_NOWAITO - return ProcessInformation.hProcess; + return (int )ProcessInformation.hProcess; } diff --git a/reactos/lib/crtdll/process/spawnvp.c b/reactos/lib/crtdll/process/spawnvp.c index 98f0625a1e7..aecd80e2239 100644 --- a/reactos/lib/crtdll/process/spawnvp.c +++ b/reactos/lib/crtdll/process/spawnvp.c @@ -1,9 +1,9 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include -int spawnvp(int mode, const char *path,const char *const argv[]) +int _spawnvp(int nMode, const char* szPath, char* const* szaArgv) { - return spawnvpe(mode, path, (char * const *)argv, _environ); + return spawnvpe(nMode, szPath, (char * const *)szaArgv, _environ); } diff --git a/reactos/lib/crtdll/process/spawnvpe.c b/reactos/lib/crtdll/process/spawnvpe.c index 7620543870d..bdad981f5ab 100644 --- a/reactos/lib/crtdll/process/spawnvpe.c +++ b/reactos/lib/crtdll/process/spawnvpe.c @@ -1,13 +1,12 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include -int _spawnvpe(int mode, const char *path,const char *const argv[],const char *const envp[]) +int _spawnvpe(int nMode, const char* szPath, char* const* szaArgv, char* const* szaEnv) { - char rpath[300]; - return spawnve(mode, rpath, argv, envp); + return spawnve(nMode, szPath, szaArgv, szaEnv); } diff --git a/reactos/lib/crtdll/process/threadid.c b/reactos/lib/crtdll/process/threadid.c new file mode 100644 index 00000000000..404ac06081f --- /dev/null +++ b/reactos/lib/crtdll/process/threadid.c @@ -0,0 +1,12 @@ +#include +#include + +unsigned long __threadid (void) +{ + return GetCurrentThreadId(); +} + +void *__threadhandle(void) +{ + return GetCurrentThread(); +} \ No newline at end of file diff --git a/reactos/lib/crtdll/search/lfind.c b/reactos/lib/crtdll/search/lfind.c new file mode 100644 index 00000000000..b1e76345a85 --- /dev/null +++ b/reactos/lib/crtdll/search/lfind.c @@ -0,0 +1,17 @@ +#include +#include + + +void *_lfind(const void *key, const void *base, size_t *nelp, + size_t width, int (*compar)(const void *, const void *)) +{ + char *char_base = (char *)base; + int i; + for(i=0;i<*nelp;i++) { + if ( compar(key,char_base) == 0) + return char_base; + char_base += width; + } + return NULL; +} + \ No newline at end of file diff --git a/reactos/lib/crtdll/search/lsearch.c b/reactos/lib/crtdll/search/lsearch.c new file mode 100644 index 00000000000..392cf92af27 --- /dev/null +++ b/reactos/lib/crtdll/search/lsearch.c @@ -0,0 +1,15 @@ +#include +#include +#include + +void *_lsearch(const void *key, void *base, size_t *nelp, size_t width, + int (*compar)(const void *, const void *)) +{ + void *ret_find = _lfind(key,base,nelp,width,compar); + if ( ret_find != NULL ) + return ret_find; + + memcpy( base + (*nelp*width), key, width ); + (*nelp)++; + return base ; +} \ No newline at end of file diff --git a/reactos/lib/crtdll/signal/signal.c b/reactos/lib/crtdll/signal/signal.c index 8980aa82521..9283dff4958 100644 --- a/reactos/lib/crtdll/signal/signal.c +++ b/reactos/lib/crtdll/signal/signal.c @@ -2,8 +2,8 @@ Exception handling and basis for signal support for DJGPP V2.0 This software may be freely distributed, no warranty. */ -#include -#include +#include +#include extern unsigned end __asm__ ("end"); @@ -53,4 +53,4 @@ raise(int sig) void __djgpp_traceback_exit(int sig) { _exit(3); -} \ No newline at end of file +} diff --git a/reactos/lib/crtdll/stdio/allocfil.c b/reactos/lib/crtdll/stdio/allocfil.c index e438eb816a3..34aafa66c6e 100644 --- a/reactos/lib/crtdll/stdio/allocfil.c +++ b/reactos/lib/crtdll/stdio/allocfil.c @@ -1,10 +1,9 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include -//#include -//#include +#include +#include +#include +#include + FILE * __alloc_file(void); @@ -68,7 +67,7 @@ int _fcloseall( void ) __file_rec *fr = __file_rec_list; __file_rec **last_fr = &__file_rec_list; - int total_closed; + int total_closed = 0; int i = 0; /* Try to find an empty slot */ diff --git a/reactos/lib/crtdll/stdio/clearerr.c b/reactos/lib/crtdll/stdio/clearerr.c index 9742967e751..5244620031b 100644 --- a/reactos/lib/crtdll/stdio/clearerr.c +++ b/reactos/lib/crtdll/stdio/clearerr.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include #ifdef clearerr #undef clearerr diff --git a/reactos/lib/crtdll/stdio/doprnt.c b/reactos/lib/crtdll/stdio/doprnt.c index ad4a15a9436..a359e1ab35a 100644 --- a/reactos/lib/crtdll/stdio/doprnt.c +++ b/reactos/lib/crtdll/stdio/doprnt.c @@ -19,16 +19,11 @@ #include -//#include -#include -#include -#include -#include - -//#undef isdigit - -size_t strnlen( const char *string, size_t count ); - +//#include +#include +#include +#include +#include static int skip_atoi(const char **s) { @@ -95,7 +90,7 @@ static char * number(FILE * f, long num, int base, int size, int precision if (num == 0) tmp[i++]='0'; else while (num != 0) - tmp[i++] = digits[do_div(&num,base)]; + tmp[i++] = digits[do_div((int *)&num,base)]; if (i > precision) precision = i; size -= precision; @@ -104,16 +99,19 @@ static char * number(FILE * f, long num, int base, int size, int precision putc( ' ',f); if (sign) putc( sign,f); - if (type & SPECIAL) - if (base==8) + if (type & SPECIAL) { + if (base==8) { putc( '0',f); + } else if (base==16) { putc( '0', f); putc( digits[33],f); } - if (!(type & LEFT)) + } + if (!(type & LEFT)) { while (size-- > 0) putc( c,f); + } while (i < precision--) putc( '0', f); while (i-- > 0) @@ -260,10 +258,12 @@ int _doprnt(const char *fmt, va_list args, FILE *f) case 'n': if (qualifier == 'l') { - long * ip = va_arg(args, long *); + long * ip; + ip = va_arg(args, long *); //*ip = (str - buf); } else { - int * ip = va_arg(args, int *); + int * ip; + ip = va_arg(args, int *); //*ip = (str - buf); } continue; @@ -300,11 +300,12 @@ int _doprnt(const char *fmt, va_list args, FILE *f) } if (qualifier == 'l') num = va_arg(args, unsigned long); - else if (qualifier == 'h') + else if (qualifier == 'h') { if (flags & SIGN) num = va_arg(args, short); else num = va_arg(args, unsigned short); + } else if (flags & SIGN) num = va_arg(args, int); else diff --git a/reactos/lib/crtdll/stdio/doscan.c b/reactos/lib/crtdll/stdio/doscan.c index 503d2544a14..a14f773f24e 100644 --- a/reactos/lib/crtdll/stdio/doscan.c +++ b/reactos/lib/crtdll/stdio/doscan.c @@ -1,13 +1,12 @@ /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include +#include +#include +#include +#include + -//long double -//atold(const char *ascii); #define atold atof // dubious variable @@ -15,9 +14,9 @@ int _doscan_low(FILE *iop, int (*scan_getc)(FILE *), int (*scan_ungetc)(int, FILE *), - const char *fmt, void **argp); + const char *fmt, va_list argp); -//#include +//#include #define SPC 01 #define STP 02 @@ -53,20 +52,20 @@ static char _sctab[256] = { static int nchars = 0; int -_doscan(FILE *iop, const char *fmt, void **argp) +_doscan(FILE *iop, const char *fmt, va_list argp) { return(_doscan_low(iop, fgetc, ungetc, fmt, argp)); } int -_dowscan(FILE *iop, const wchar_t *fmt, void **argp) +_dowscan(FILE *iop, const wchar_t *fmt, va_list argp) { - return(_doscan_low(iop, fgetwc, ungetwc, fmt, argp)); + return(_doscan_low(iop, fgetwc, ((void *)ungetwc), ((void *)fmt), argp)); } int _doscan_low(FILE *iop, int (*scan_getc)(FILE *), int (*scan_ungetc)(int, FILE *), - const char *fmt, void **argp) + const char *fmt, va_list argp) { register int ch; int nmatch, len, ch1; @@ -83,7 +82,7 @@ _doscan_low(FILE *iop, int (*scan_getc)(FILE *), int (*scan_ungetc)(int, FILE *) goto def; ptr = 0; if (ch != '*') - ptr = (int **)argp++; + ptr = va_arg(argp, int **); else ch = *fmt++; len = 0; @@ -210,7 +209,7 @@ _innum(int **ptr, int type, int len, int size, FILE *iop, np = numbuf; expseen = 0; negflg = 0; - while (((nchars++, c = scan_getc(iop)) != EOF) && (_sctab[c] & SPC)) + while (((nchars++, c = scan_getc(iop)) != EOF) && (_sctab[c] & SPC) ) ; if (c == EOF) nchars--; if (c=='-') { diff --git a/reactos/lib/crtdll/stdio/fclose.c b/reactos/lib/crtdll/stdio/fclose.c index dc6b79f4a88..98caf7621e8 100644 --- a/reactos/lib/crtdll/stdio/fclose.c +++ b/reactos/lib/crtdll/stdio/fclose.c @@ -1,12 +1,12 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -//#include -#include -#include -#include -#include -#include -//#include -#include +//#include +#include +#include +#include +#include +#include +//#include +#include #if 0 #ifndef __dj_include_stdio_h_ diff --git a/reactos/lib/crtdll/stdio/fdopen.c b/reactos/lib/crtdll/stdio/fdopen.c index a5055c93de2..04c661d176c 100644 --- a/reactos/lib/crtdll/stdio/fdopen.c +++ b/reactos/lib/crtdll/stdio/fdopen.c @@ -1,4 +1,4 @@ -#include +#include FILE *_fdopen(int handle, char *mode) { diff --git a/reactos/lib/crtdll/stdio/feof.c b/reactos/lib/crtdll/stdio/feof.c index ed17212e2db..6de4573e92b 100644 --- a/reactos/lib/crtdll/stdio/feof.c +++ b/reactos/lib/crtdll/stdio/feof.c @@ -1,13 +1,13 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include #ifdef feof #undef feof -feof(FILE *stream); +int feof(FILE *stream); #endif -feof(FILE *stream) +int feof(FILE *stream) { return stream->_flag & _IOEOF; } diff --git a/reactos/lib/crtdll/stdio/ferror.c b/reactos/lib/crtdll/stdio/ferror.c index 8fe3416b46a..06d77c132cd 100644 --- a/reactos/lib/crtdll/stdio/ferror.c +++ b/reactos/lib/crtdll/stdio/ferror.c @@ -1,14 +1,13 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include #ifdef ferror #undef ferror -ferror(FILE *stream); +int ferror(FILE *stream); #endif -int -ferror(FILE *stream) +int ferror(FILE *stream) { return stream->_flag & _IOERR; } diff --git a/reactos/lib/crtdll/stdio/fflush.c b/reactos/lib/crtdll/stdio/fflush.c index d51077a9c6e..9cf40b3d0bb 100644 --- a/reactos/lib/crtdll/stdio/fflush.c +++ b/reactos/lib/crtdll/stdio/fflush.c @@ -1,14 +1,15 @@ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -//#include -#include -#include -#include -#include -#include -#include -#include + +#include +#include +#include +#include +#include +#include +#include + int fflush(FILE *f) @@ -18,13 +19,13 @@ fflush(FILE *f) if (f == NULL) { -// int e = errno; + int e = errno; -// errno = 0; + __set_errno(0); _fwalk((void (*)(FILE *))fflush); -// if (errno) -// return EOF; -// errno = e; + if (_errno) + return EOF; + __set_errno(e); return 0; } diff --git a/reactos/lib/crtdll/stdio/fgetc.c b/reactos/lib/crtdll/stdio/fgetc.c index 97f5fa319b7..2c123c76030 100644 --- a/reactos/lib/crtdll/stdio/fgetc.c +++ b/reactos/lib/crtdll/stdio/fgetc.c @@ -9,8 +9,8 @@ 25/02/99: Added fgetwc */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include int fgetc(FILE *f) diff --git a/reactos/lib/crtdll/stdio/fgetchar.c b/reactos/lib/crtdll/stdio/fgetchar.c index 2d8e452b1b9..c098b05e12e 100644 --- a/reactos/lib/crtdll/stdio/fgetchar.c +++ b/reactos/lib/crtdll/stdio/fgetchar.c @@ -1,7 +1,7 @@ -#include -#include +#include +#include int _fgetchar (void) { return _getch(); -} \ No newline at end of file +} diff --git a/reactos/lib/crtdll/stdio/fgetpos.c b/reactos/lib/crtdll/stdio/fgetpos.c index 0214cf671a9..e063164dae4 100644 --- a/reactos/lib/crtdll/stdio/fgetpos.c +++ b/reactos/lib/crtdll/stdio/fgetpos.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include int fgetpos(FILE *stream, fpos_t *pos) diff --git a/reactos/lib/crtdll/stdio/fgets.c b/reactos/lib/crtdll/stdio/fgets.c index 05ddd9565f6..df78963c78c 100644 --- a/reactos/lib/crtdll/stdio/fgets.c +++ b/reactos/lib/crtdll/stdio/fgets.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include char * fgets(char *s, int n, FILE *f) diff --git a/reactos/lib/crtdll/stdio/filbuf.c b/reactos/lib/crtdll/stdio/filbuf.c index 66f9b5813e8..0060e258911 100644 --- a/reactos/lib/crtdll/stdio/filbuf.c +++ b/reactos/lib/crtdll/stdio/filbuf.c @@ -1,16 +1,13 @@ /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -//#include -#include -#include -#include -//#include -#include -//#include -#include -//#include -#include + +#include +#include +#include +#include +#include +#include /* Note: We set _fillsize to 512, and use that for reading instead of _bufsize, for performance reasons. We double _fillsize each time diff --git a/reactos/lib/crtdll/stdio/fileno.c b/reactos/lib/crtdll/stdio/fileno.c index a9e07e2caa0..f895187bafb 100644 --- a/reactos/lib/crtdll/stdio/fileno.c +++ b/reactos/lib/crtdll/stdio/fileno.c @@ -1,4 +1,4 @@ -#include +#include #undef fileno int fileno(FILE *f) diff --git a/reactos/lib/crtdll/stdio/flsbuf.c b/reactos/lib/crtdll/stdio/flsbuf.c index 1cbfedc4669..b667a40c9be 100644 --- a/reactos/lib/crtdll/stdio/flsbuf.c +++ b/reactos/lib/crtdll/stdio/flsbuf.c @@ -1,13 +1,13 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -//#include -#include -#include -#include -//#include -//#include -#include -#include +//#include +#include +#include +#include +//#include +//#include +#include +#include int _flsbuf(int c, FILE *f) diff --git a/reactos/lib/crtdll/stdio/fopen.c b/reactos/lib/crtdll/stdio/fopen.c index 40ee5b7d24d..e742d8ea5c5 100644 --- a/reactos/lib/crtdll/stdio/fopen.c +++ b/reactos/lib/crtdll/stdio/fopen.c @@ -1,10 +1,10 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include FILE * __alloc_file(void); diff --git a/reactos/lib/crtdll/stdio/fprintf.c b/reactos/lib/crtdll/stdio/fprintf.c index fbca105d4ed..13be50e5d8c 100644 --- a/reactos/lib/crtdll/stdio/fprintf.c +++ b/reactos/lib/crtdll/stdio/fprintf.c @@ -1,19 +1,22 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include int fprintf(register FILE *iop, const char *fmt, ...) { int len; char localbuf[BUFSIZ]; + va_list a=0; + + va_start( a, fmt ); if (iop->_flag & _IONBF) { iop->_flag &= ~_IONBF; iop->_ptr = iop->_base = localbuf; iop->_bufsiz = BUFSIZ; - len = _doprnt(fmt, (&fmt)+1, iop); + len = _doprnt(fmt,a, iop); fflush(iop); iop->_flag |= _IONBF; iop->_base = NULL; @@ -21,6 +24,6 @@ fprintf(register FILE *iop, const char *fmt, ...) iop->_cnt = 0; } else - len = _doprnt(fmt, (&fmt)+1, iop); + len = _doprnt(fmt, a, iop); return ferror(iop) ? EOF : len; } diff --git a/reactos/lib/crtdll/stdio/fputc.c b/reactos/lib/crtdll/stdio/fputc.c index 82315c44267..715469cd954 100644 --- a/reactos/lib/crtdll/stdio/fputc.c +++ b/reactos/lib/crtdll/stdio/fputc.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include +#include +#include +#include int fputc(int c, FILE *fp) diff --git a/reactos/lib/crtdll/stdio/fputchar.c b/reactos/lib/crtdll/stdio/fputchar.c index 2b761144b2e..a9c5c8eff79 100644 --- a/reactos/lib/crtdll/stdio/fputchar.c +++ b/reactos/lib/crtdll/stdio/fputchar.c @@ -1,7 +1,7 @@ -#include -#include +#include +#include int _fputchar (int c) { return _putch(c); -} \ No newline at end of file +} diff --git a/reactos/lib/crtdll/stdio/fputs.c b/reactos/lib/crtdll/stdio/fputs.c index 8bb3d7ab5d6..1f096dde736 100644 --- a/reactos/lib/crtdll/stdio/fputs.c +++ b/reactos/lib/crtdll/stdio/fputs.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include +#include +#include +#include #include int diff --git a/reactos/lib/crtdll/stdio/fread.c b/reactos/lib/crtdll/stdio/fread.c index 5bf9163ccb8..fc44146d612 100644 --- a/reactos/lib/crtdll/stdio/fread.c +++ b/reactos/lib/crtdll/stdio/fread.c @@ -1,10 +1,10 @@ /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include +#include +#include +#include +#include #define _fillsize _bufsiz diff --git a/reactos/lib/crtdll/stdio/freopen.c b/reactos/lib/crtdll/stdio/freopen.c index 2eb39b2d82b..681b429c5c4 100644 --- a/reactos/lib/crtdll/stdio/freopen.c +++ b/reactos/lib/crtdll/stdio/freopen.c @@ -1,10 +1,10 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include diff --git a/reactos/lib/crtdll/stdio/frlist.c b/reactos/lib/crtdll/stdio/frlist.c index 2eaacbd75e3..e85b6e8c05c 100644 --- a/reactos/lib/crtdll/stdio/frlist.c +++ b/reactos/lib/crtdll/stdio/frlist.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -//#include +#include +//#include static __file_rec __initial_file_rec = { 0, diff --git a/reactos/lib/crtdll/stdio/fscanf.c b/reactos/lib/crtdll/stdio/fscanf.c index 2b134834565..bf278be839f 100644 --- a/reactos/lib/crtdll/stdio/fscanf.c +++ b/reactos/lib/crtdll/stdio/fscanf.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include #include -#include +#include int fscanf(FILE *f, const char *fmt, ...) diff --git a/reactos/lib/crtdll/stdio/fseek.c b/reactos/lib/crtdll/stdio/fseek.c index 939718b36e7..c3cd360f13d 100644 --- a/reactos/lib/crtdll/stdio/fseek.c +++ b/reactos/lib/crtdll/stdio/fseek.c @@ -2,10 +2,10 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include +#include +#include +#include +#include #define _fillsize _bufsiz diff --git a/reactos/lib/crtdll/stdio/fsetpos.c b/reactos/lib/crtdll/stdio/fsetpos.c index 491b9ad46c3..718bb6e0557 100644 --- a/reactos/lib/crtdll/stdio/fsetpos.c +++ b/reactos/lib/crtdll/stdio/fsetpos.c @@ -1,10 +1,10 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include +#include +#include +#include int -fsetpos(FILE *stream, fpos_t *pos) +fsetpos(FILE *stream,const fpos_t *pos) { if (stream && pos) { diff --git a/reactos/lib/crtdll/stdio/ftell.c b/reactos/lib/crtdll/stdio/ftell.c index d597bc5acfb..f2b76fb0365 100644 --- a/reactos/lib/crtdll/stdio/ftell.c +++ b/reactos/lib/crtdll/stdio/ftell.c @@ -1,11 +1,11 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -//#include -#include -//#include -#include -#include -#include +//#include +#include +//#include +#include +#include +#include long diff --git a/reactos/lib/crtdll/stdio/fwalk.c b/reactos/lib/crtdll/stdio/fwalk.c index 4d4a8622942..ec2c4845550 100644 --- a/reactos/lib/crtdll/stdio/fwalk.c +++ b/reactos/lib/crtdll/stdio/fwalk.c @@ -1,7 +1,8 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -//#include +#include +#include + +// not exported by crtdll #define __FILE_REC_MAX 20 typedef struct __file_rec { diff --git a/reactos/lib/crtdll/stdio/fwrite.c b/reactos/lib/crtdll/stdio/fwrite.c index 350dff692a0..137fd30568f 100644 --- a/reactos/lib/crtdll/stdio/fwrite.c +++ b/reactos/lib/crtdll/stdio/fwrite.c @@ -1,9 +1,9 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include +#include +#include +#include +#include size_t fwrite(const void *vptr, size_t size, size_t count, FILE *f) diff --git a/reactos/lib/crtdll/stdio/getc.c b/reactos/lib/crtdll/stdio/getc.c index c283ff684f6..5fcae046820 100644 --- a/reactos/lib/crtdll/stdio/getc.c +++ b/reactos/lib/crtdll/stdio/getc.c @@ -1,17 +1,27 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include #include -#include +#include int getc(FILE *f) { int c; - DWORD NumberOfBytesRead; + DWORD NumberOfBytesRead =0; + if (f->_cnt > 0) { + f->_cnt--; + f->_flag &= ~_IOUNGETC; + return *f->_ptr; + } + + if ( !ReadFile(_get_osfhandle(f->_file),&c, 1, &NumberOfBytesRead, NULL) ) return -1; if ( NumberOfBytesRead == 0 ) return -1; - return c; + putchar(c&0xFF); + return c&0xFF; + + } diff --git a/reactos/lib/crtdll/stdio/getchar.c b/reactos/lib/crtdll/stdio/getchar.c index e087c430f02..fe0f036d2f7 100644 --- a/reactos/lib/crtdll/stdio/getchar.c +++ b/reactos/lib/crtdll/stdio/getchar.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include #undef getchar int diff --git a/reactos/lib/crtdll/stdio/getenv.c b/reactos/lib/crtdll/stdio/getenv.c index 9ee76ca5e43..9188ddbaa40 100644 --- a/reactos/lib/crtdll/stdio/getenv.c +++ b/reactos/lib/crtdll/stdio/getenv.c @@ -1,5 +1,5 @@ #include -#include +#include void *malloc(size_t size); diff --git a/reactos/lib/crtdll/stdio/gets.c b/reactos/lib/crtdll/stdio/gets.c index 7c84f13026c..6673b052698 100644 --- a/reactos/lib/crtdll/stdio/gets.c +++ b/reactos/lib/crtdll/stdio/gets.c @@ -8,7 +8,7 @@ * 28/12/98: Appropriated for Reactos */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include char * gets(char *s) diff --git a/reactos/lib/crtdll/stdio/getw.c b/reactos/lib/crtdll/stdio/getw.c index a8dd3818150..c47e11fa465 100644 --- a/reactos/lib/crtdll/stdio/getw.c +++ b/reactos/lib/crtdll/stdio/getw.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include int getw(FILE *f) diff --git a/reactos/lib/crtdll/stdio/perror.c b/reactos/lib/crtdll/stdio/perror.c index 119ea13d828..fdde0bb823a 100644 --- a/reactos/lib/crtdll/stdio/perror.c +++ b/reactos/lib/crtdll/stdio/perror.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include +#include +#include +#include #ifdef perror diff --git a/reactos/lib/crtdll/stdio/popen.c b/reactos/lib/crtdll/stdio/popen.c index e2bfbd5a4e4..8ab3562ebd2 100644 --- a/reactos/lib/crtdll/stdio/popen.c +++ b/reactos/lib/crtdll/stdio/popen.c @@ -1,10 +1,10 @@ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include FILE * _popen (const char *cm, const char *md) /* program name, pipe mode */ diff --git a/reactos/lib/crtdll/stdio/printf.c b/reactos/lib/crtdll/stdio/printf.c index 0666bfb2e10..a5a999263d1 100644 --- a/reactos/lib/crtdll/stdio/printf.c +++ b/reactos/lib/crtdll/stdio/printf.c @@ -1,14 +1,16 @@ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include +#include +#include + + int printf(const char *fmt, ...) { int len; - - len = _doprnt(fmt, (&fmt)+1, stdout); + va_list a = 0; + va_start( a, fmt ); + len = _doprnt(fmt, a, stdout); /* People were confused when printf() didn't flush stdout, so we'll do it to reduce confusion */ diff --git a/reactos/lib/crtdll/stdio/putc.c b/reactos/lib/crtdll/stdio/putc.c index 78317a766e9..6ed3e953d88 100644 --- a/reactos/lib/crtdll/stdio/putc.c +++ b/reactos/lib/crtdll/stdio/putc.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include #include -#include +#include int putc(int c, FILE *fp) { diff --git a/reactos/lib/crtdll/stdio/putchar.c b/reactos/lib/crtdll/stdio/putchar.c index d2a2fab8c2c..ff6840d8e38 100644 --- a/reactos/lib/crtdll/stdio/putchar.c +++ b/reactos/lib/crtdll/stdio/putchar.c @@ -8,7 +8,7 @@ * UPDATE HISTORY: * 28/12/98: Created */ -#include +#include #undef putc #undef putchar diff --git a/reactos/lib/crtdll/stdio/puts.c b/reactos/lib/crtdll/stdio/puts.c index 6bc80111502..61c2b9dd192 100644 --- a/reactos/lib/crtdll/stdio/puts.c +++ b/reactos/lib/crtdll/stdio/puts.c @@ -1,8 +1,8 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include #include -#include +#include #undef putchar int diff --git a/reactos/lib/crtdll/stdio/putw.c b/reactos/lib/crtdll/stdio/putw.c index 6d6f0966698..10aab3fa835 100644 --- a/reactos/lib/crtdll/stdio/putw.c +++ b/reactos/lib/crtdll/stdio/putw.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include int putw(int w, FILE *f) diff --git a/reactos/lib/crtdll/stdio/rename.c b/reactos/lib/crtdll/stdio/rename.c index d4b1ecbcbe1..3d5f0d28f4b 100644 --- a/reactos/lib/crtdll/stdio/rename.c +++ b/reactos/lib/crtdll/stdio/rename.c @@ -1,15 +1,11 @@ #include -#include -#include +#include +#include -int rename(const char *old, const char *new) -{ - return _rename(old,new); -} -int _rename(const char *old, const char *new) +int rename(const char *old_, const char *new_) { - if ( !MoveFile(old,new) ) + if ( !MoveFile(old_,new_) ) return -1; return 0; diff --git a/reactos/lib/crtdll/stdio/rewind.c b/reactos/lib/crtdll/stdio/rewind.c index 9a9a6817fe3..ddeacbfe95a 100644 --- a/reactos/lib/crtdll/stdio/rewind.c +++ b/reactos/lib/crtdll/stdio/rewind.c @@ -1,8 +1,8 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include +#include +#include +#include void rewind(FILE *f) diff --git a/reactos/lib/crtdll/stdio/scanf.c b/reactos/lib/crtdll/stdio/scanf.c index d3c5cb77fdd..ab74a588117 100644 --- a/reactos/lib/crtdll/stdio/scanf.c +++ b/reactos/lib/crtdll/stdio/scanf.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include #include -#include +#include int scanf(const char *fmt, ...) diff --git a/reactos/lib/crtdll/stdio/setbuf.c b/reactos/lib/crtdll/stdio/setbuf.c index 1fc7117193a..f8a6e1d5df5 100644 --- a/reactos/lib/crtdll/stdio/setbuf.c +++ b/reactos/lib/crtdll/stdio/setbuf.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include +#include +#include +#include void setbuf(FILE *f, char *buf) diff --git a/reactos/lib/crtdll/stdio/setbuffe.c b/reactos/lib/crtdll/stdio/setbuffe.c index b69622908d3..5fb09f2bd06 100644 --- a/reactos/lib/crtdll/stdio/setbuffe.c +++ b/reactos/lib/crtdll/stdio/setbuffe.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -//#include -#include -#include +//#include +#include +#include void setbuffer(FILE *f, void *buf, int size) { diff --git a/reactos/lib/crtdll/stdio/setlineb.c b/reactos/lib/crtdll/stdio/setlineb.c index c75ef4dd20d..c51097a1245 100644 --- a/reactos/lib/crtdll/stdio/setlineb.c +++ b/reactos/lib/crtdll/stdio/setlineb.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include void setlinebuf(FILE *f) { diff --git a/reactos/lib/crtdll/stdio/setvbuf.c b/reactos/lib/crtdll/stdio/setvbuf.c index 78dd0fc6888..dee56849052 100644 --- a/reactos/lib/crtdll/stdio/setvbuf.c +++ b/reactos/lib/crtdll/stdio/setvbuf.c @@ -1,10 +1,10 @@ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include +#include +#include +#include +#include #define _fillsize _bufsiz diff --git a/reactos/lib/crtdll/stdio/sprintf.c b/reactos/lib/crtdll/stdio/sprintf.c index 87039b9a91e..45de8f43495 100644 --- a/reactos/lib/crtdll/stdio/sprintf.c +++ b/reactos/lib/crtdll/stdio/sprintf.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include #include -#include +#include int @@ -9,11 +9,13 @@ sprintf(char *str, const char *fmt, ...) { FILE _strbuf; int len; + va_list a = 0; + va_start( a, fmt ); _strbuf._flag = _IOWRT|_IOSTRG; _strbuf._ptr = str; _strbuf._cnt = INT_MAX; - len = _doprnt(fmt, &(fmt)+1, &_strbuf); + len = _doprnt(fmt, a, &_strbuf); *_strbuf._ptr = 0; return len; } diff --git a/reactos/lib/crtdll/stdio/sscanf.c b/reactos/lib/crtdll/stdio/sscanf.c index 6b0d5832498..782cff28af5 100644 --- a/reactos/lib/crtdll/stdio/sscanf.c +++ b/reactos/lib/crtdll/stdio/sscanf.c @@ -1,8 +1,8 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include #include -#include -//#include +#include +//#include int sscanf(const char *str, const char *fmt, ...) diff --git a/reactos/lib/crtdll/stdio/stdhnd.c b/reactos/lib/crtdll/stdio/stdhnd.c index 2cfcd121522..2f1aff5f371 100644 --- a/reactos/lib/crtdll/stdio/stdhnd.c +++ b/reactos/lib/crtdll/stdio/stdhnd.c @@ -1,7 +1,7 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include -//#include +#include +#include +//#include @@ -16,7 +16,7 @@ FILE _crtdll_iob[] = // stdout { NULL, 0, NULL, - _IOWRT | _IOFBF |_IOSTRG, + _IOWRT | _IOLBF |_IOSTRG, 1,0,0, NULL }, // stderr diff --git a/reactos/lib/crtdll/stdio/stdiohk.c b/reactos/lib/crtdll/stdio/stdiohk.c index cccdea817ce..83092aaa1f8 100644 --- a/reactos/lib/crtdll/stdio/stdiohk.c +++ b/reactos/lib/crtdll/stdio/stdiohk.c @@ -1,6 +1,6 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include static void fcloseall_helper(FILE *f) diff --git a/reactos/lib/crtdll/stdio/tempnam.c b/reactos/lib/crtdll/stdio/tempnam.c index 9c510d7f2e3..b4de5241fd5 100644 --- a/reactos/lib/crtdll/stdio/tempnam.c +++ b/reactos/lib/crtdll/stdio/tempnam.c @@ -1,6 +1,6 @@ -#include #include - +#include +#include char *_tempnam(const char *dir,const char *prefix ) diff --git a/reactos/lib/crtdll/stdio/tmpfile.c b/reactos/lib/crtdll/stdio/tmpfile.c index 9329fca80db..236f4d8af44 100644 --- a/reactos/lib/crtdll/stdio/tmpfile.c +++ b/reactos/lib/crtdll/stdio/tmpfile.c @@ -2,16 +2,16 @@ /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -//#include -#include -#include -#include -#include -#include -//#include -#include -#include -#include +//#include +#include +#include +#include +#include +#include +//#include +#include +#include +#include #if 0 #ifndef __dj_include_stdio_h_ diff --git a/reactos/lib/crtdll/stdio/tmpnam.c b/reactos/lib/crtdll/stdio/tmpnam.c index 3da55c6f888..a3ce21d16b9 100644 --- a/reactos/lib/crtdll/stdio/tmpnam.c +++ b/reactos/lib/crtdll/stdio/tmpnam.c @@ -1,19 +1,10 @@ #include -#include -#include - -char * -_tmpnam(char *s); - -char * -tmpnam(char *s) -{ - return _tmpnam(s); -} +#include +#include -char * -_tmpnam(char *s) + +char * tmpnam(char *s) { char PathName[MAX_PATH]; static char static_buf[MAX_PATH]; diff --git a/reactos/lib/crtdll/stdio/ungetc.c b/reactos/lib/crtdll/stdio/ungetc.c index b38f9dc6253..5f3d0ef96fb 100644 --- a/reactos/lib/crtdll/stdio/ungetc.c +++ b/reactos/lib/crtdll/stdio/ungetc.c @@ -1,7 +1,8 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include +#include int ungetc(int c, FILE *f) @@ -30,3 +31,10 @@ ungetc(int c, FILE *f) return c; } + + +int +ungetwc(wchar_t c, FILE *f) +{ + return ungetc(c,f); +} \ No newline at end of file diff --git a/reactos/lib/crtdll/stdio/vfprintf.c b/reactos/lib/crtdll/stdio/vfprintf.c index 8b4f5e690f8..c7494bc9d37 100644 --- a/reactos/lib/crtdll/stdio/vfprintf.c +++ b/reactos/lib/crtdll/stdio/vfprintf.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include #include -#include +#include int vfprintf(FILE *f, const char *fmt, va_list ap) diff --git a/reactos/lib/crtdll/stdio/vprintf.c b/reactos/lib/crtdll/stdio/vprintf.c index c9e71d9bb31..dba04f44db1 100644 --- a/reactos/lib/crtdll/stdio/vprintf.c +++ b/reactos/lib/crtdll/stdio/vprintf.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include #include -#include +#include int vprintf(const char *fmt, va_list ap) diff --git a/reactos/lib/crtdll/stdio/vsprintf.c b/reactos/lib/crtdll/stdio/vsprintf.c index 425725acade..5f2edc4af49 100644 --- a/reactos/lib/crtdll/stdio/vsprintf.c +++ b/reactos/lib/crtdll/stdio/vsprintf.c @@ -1,8 +1,8 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include #include #include -#include +#include int vsprintf(char *str, const char *fmt, va_list ap) diff --git a/reactos/lib/crtdll/stdlib/Exit.c b/reactos/lib/crtdll/stdlib/_exit.c similarity index 76% rename from reactos/lib/crtdll/stdlib/Exit.c rename to reactos/lib/crtdll/stdlib/_exit.c index ee3e979f1bf..ee2684c2fb4 100644 --- a/reactos/lib/crtdll/stdlib/Exit.c +++ b/reactos/lib/crtdll/stdlib/_exit.c @@ -1,15 +1,12 @@ #include -#include -#include -#include -#include - -void _exit(int _status); +#include +#include +#include +#include struct __atexit *__atexit_ptr = 0; -void -exit(int status) +void exit(int status) { //int i; struct __atexit *a = __atexit_ptr; @@ -28,13 +25,15 @@ exit(int status) /* in case the program set it this way */ setmode(0, O_TEXT); _exit(status); + for(;;); } void _exit(int _status) { - //ExitProcess(_status); + ExitProcess(_status); + for(;;); } void _cexit( void ) diff --git a/reactos/lib/crtdll/stdlib/abort.c b/reactos/lib/crtdll/stdlib/abort.c index 29ecabdc184..a7840b5a451 100644 --- a/reactos/lib/crtdll/stdlib/abort.c +++ b/reactos/lib/crtdll/stdlib/abort.c @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include static char msg[] = "Abort!\r\n"; diff --git a/reactos/lib/crtdll/stdlib/abs.c b/reactos/lib/crtdll/stdlib/abs.c index 3bd28bd8339..286388803de 100644 --- a/reactos/lib/crtdll/stdlib/abs.c +++ b/reactos/lib/crtdll/stdlib/abs.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include int abs(int j) diff --git a/reactos/lib/crtdll/stdlib/atexit.c b/reactos/lib/crtdll/stdlib/atexit.c index d9d4ba5561e..462fa07fdb5 100644 --- a/reactos/lib/crtdll/stdlib/atexit.c +++ b/reactos/lib/crtdll/stdlib/atexit.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include int atexit(void (*a)(void)) diff --git a/reactos/lib/crtdll/stdlib/atof.c b/reactos/lib/crtdll/stdlib/atof.c index f9f7f98a911..2b93d8cc512 100644 --- a/reactos/lib/crtdll/stdlib/atof.c +++ b/reactos/lib/crtdll/stdlib/atof.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include double atof(const char *ascii) diff --git a/reactos/lib/crtdll/stdlib/atoi.c b/reactos/lib/crtdll/stdlib/atoi.c index ba4e2dfb6ff..1d19cf0c61a 100644 --- a/reactos/lib/crtdll/stdlib/atoi.c +++ b/reactos/lib/crtdll/stdlib/atoi.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include int atoi(const char *str) diff --git a/reactos/lib/crtdll/stdlib/atol.c b/reactos/lib/crtdll/stdlib/atol.c index 2680abd0a8d..0360505b605 100644 --- a/reactos/lib/crtdll/stdlib/atol.c +++ b/reactos/lib/crtdll/stdlib/atol.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include long atol(const char *str) diff --git a/reactos/lib/crtdll/stdlib/atold.c b/reactos/lib/crtdll/stdlib/atold.c index ce3f33ac434..1bcaeeb6dc7 100644 --- a/reactos/lib/crtdll/stdlib/atold.c +++ b/reactos/lib/crtdll/stdlib/atold.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include long double _atold(const char *ascii) diff --git a/reactos/lib/crtdll/stdlib/bsearch.c b/reactos/lib/crtdll/stdlib/bsearch.c index d6a5bac6108..a36e43f5418 100644 --- a/reactos/lib/crtdll/stdlib/bsearch.c +++ b/reactos/lib/crtdll/stdlib/bsearch.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include void * bsearch(const void *key, const void *base0, size_t nelem, diff --git a/reactos/lib/crtdll/stdlib/calloc.c b/reactos/lib/crtdll/stdlib/calloc.c index 1bb68c1a241..7325ed635f8 100644 --- a/reactos/lib/crtdll/stdlib/calloc.c +++ b/reactos/lib/crtdll/stdlib/calloc.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include void * calloc(size_t size, size_t nelem) diff --git a/reactos/lib/crtdll/stdlib/div.c b/reactos/lib/crtdll/stdlib/div.c index db56aef7169..be64654d168 100644 --- a/reactos/lib/crtdll/stdlib/div.c +++ b/reactos/lib/crtdll/stdlib/div.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include div_t div(int num, int denom) diff --git a/reactos/lib/crtdll/stdlib/ecvt.c b/reactos/lib/crtdll/stdlib/ecvt.c index f3a7fd1e1fc..6ef49cd5a24 100644 --- a/reactos/lib/crtdll/stdlib/ecvt.c +++ b/reactos/lib/crtdll/stdlib/ecvt.c @@ -1,6 +1,6 @@ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include char * _ecvt (double value, int ndigits, int *decpt, int *sign) diff --git a/reactos/lib/crtdll/stdlib/ecvtbuf.c b/reactos/lib/crtdll/stdlib/ecvtbuf.c index 6b978fc2862..85520ebf0b1 100644 --- a/reactos/lib/crtdll/stdlib/ecvtbuf.c +++ b/reactos/lib/crtdll/stdlib/ecvtbuf.c @@ -1,9 +1,9 @@ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include void __ecvround (char *, char *, const char *, int *); diff --git a/reactos/lib/crtdll/stdlib/errno.c b/reactos/lib/crtdll/stdlib/errno.c index 0463b943b81..b2bfaa65b06 100644 --- a/reactos/lib/crtdll/stdlib/errno.c +++ b/reactos/lib/crtdll/stdlib/errno.c @@ -1,5 +1,5 @@ #include -#include +#include #undef errno int errno; diff --git a/reactos/lib/crtdll/stdlib/fcvt.c b/reactos/lib/crtdll/stdlib/fcvt.c index 40a7dcc9191..e9cf5ee737b 100644 --- a/reactos/lib/crtdll/stdlib/fcvt.c +++ b/reactos/lib/crtdll/stdlib/fcvt.c @@ -1,6 +1,6 @@ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include char * _fcvt (double value, int ndigits, int *decpt, int *sign) diff --git a/reactos/lib/crtdll/stdlib/fcvtbuf.c b/reactos/lib/crtdll/stdlib/fcvtbuf.c index f34526fe805..df12c71cac9 100644 --- a/reactos/lib/crtdll/stdlib/fcvtbuf.c +++ b/reactos/lib/crtdll/stdlib/fcvtbuf.c @@ -1,9 +1,9 @@ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include void __ecvround (char *, char *, const char *, int *); diff --git a/reactos/lib/crtdll/stdlib/fullpath.c b/reactos/lib/crtdll/stdlib/fullpath.c index 35a68e7439e..cf43e3e0928 100644 --- a/reactos/lib/crtdll/stdlib/fullpath.c +++ b/reactos/lib/crtdll/stdlib/fullpath.c @@ -7,7 +7,7 @@ * UPDATE HISTORY: * 28/12/98: Created */ -#include +#include #include #undef fullpath diff --git a/reactos/lib/crtdll/stdlib/gcvt.c b/reactos/lib/crtdll/stdlib/gcvt.c index 6ce9adf44df..f32157ada2f 100644 --- a/reactos/lib/crtdll/stdlib/gcvt.c +++ b/reactos/lib/crtdll/stdlib/gcvt.c @@ -1,7 +1,7 @@ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include +#include +#include +#include char * _gcvt (double value, int ndigits, char *buf) diff --git a/reactos/lib/crtdll/stdlib/itoa.c b/reactos/lib/crtdll/stdlib/itoa.c index 9cf210965f7..f4f1acb92fd 100644 --- a/reactos/lib/crtdll/stdlib/itoa.c +++ b/reactos/lib/crtdll/stdlib/itoa.c @@ -9,8 +9,8 @@ * 1998: Added ltoa Boudewijn Dekker */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include char * itoa(int value, char *string, int radix) diff --git a/reactos/lib/crtdll/stdlib/labs.c b/reactos/lib/crtdll/stdlib/labs.c index eb2fb7167b0..b1c4fa255e6 100644 --- a/reactos/lib/crtdll/stdlib/labs.c +++ b/reactos/lib/crtdll/stdlib/labs.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include long labs(long j) diff --git a/reactos/lib/crtdll/stdlib/ldiv.c b/reactos/lib/crtdll/stdlib/ldiv.c index 43cfc32ba95..26cbfbb58e6 100644 --- a/reactos/lib/crtdll/stdlib/ldiv.c +++ b/reactos/lib/crtdll/stdlib/ldiv.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include ldiv_t ldiv(long num, long denom) diff --git a/reactos/lib/crtdll/stdlib/llabs.c b/reactos/lib/crtdll/stdlib/llabs.c index 034a6f6cdd5..fc6580adaf6 100644 --- a/reactos/lib/crtdll/stdlib/llabs.c +++ b/reactos/lib/crtdll/stdlib/llabs.c @@ -1,6 +1,6 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include long long llabs(long long j) diff --git a/reactos/lib/crtdll/stdlib/lldiv.c b/reactos/lib/crtdll/stdlib/lldiv.c index 3c92ad537e7..2a0e3f593fd 100644 --- a/reactos/lib/crtdll/stdlib/lldiv.c +++ b/reactos/lib/crtdll/stdlib/lldiv.c @@ -1,6 +1,6 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include lldiv_t lldiv(long long num, long long denom) diff --git a/reactos/lib/crtdll/stdlib/makepath.c b/reactos/lib/crtdll/stdlib/makepath.c index f851b672482..e389412829f 100644 --- a/reactos/lib/crtdll/stdlib/makepath.c +++ b/reactos/lib/crtdll/stdlib/makepath.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include void _makepath( char *path, const char *drive, const char *dir, const char *fname, const char *ext ) { diff --git a/reactos/lib/crtdll/stdlib/malloc.c b/reactos/lib/crtdll/stdlib/malloc.c index bfc854715bb..f1792be6902 100644 --- a/reactos/lib/crtdll/stdlib/malloc.c +++ b/reactos/lib/crtdll/stdlib/malloc.c @@ -1,6 +1,6 @@ #include -#include -//#include +#include +//#include #include void* malloc(size_t _size) diff --git a/reactos/lib/crtdll/stdlib/mbstow.c b/reactos/lib/crtdll/stdlib/mbstow.c index 15160593543..f97c19e3718 100644 --- a/reactos/lib/crtdll/stdlib/mbstow.c +++ b/reactos/lib/crtdll/stdlib/mbstow.c @@ -1,4 +1,4 @@ -#include +#include int mblen (const char* mbs, size_t sizeString) diff --git a/reactos/lib/crtdll/stdlib/obsol.c b/reactos/lib/crtdll/stdlib/obsol.c index ddb0f063c6a..c5aec4e1297 100644 --- a/reactos/lib/crtdll/stdlib/obsol.c +++ b/reactos/lib/crtdll/stdlib/obsol.c @@ -1,5 +1,9 @@ #include -#include +#include + +#undef _cpumode +unsigned char _cpumode = 0; +unsigned char *_cpumode_dll = &_cpumode; void _seterrormode(int nMode) { @@ -7,7 +11,7 @@ void _seterrormode(int nMode) return; } -void _beep(unsigned nFreq, unsigned dur) +void _beep(unsigned nFreq, unsigned nDur) { Beep(nFreq,nDur); return; @@ -17,4 +21,4 @@ void _sleep(unsigned long ulTime) { Sleep(ulTime); return; -} \ No newline at end of file +} diff --git a/reactos/lib/crtdll/stdlib/putenv.c b/reactos/lib/crtdll/stdlib/putenv.c index 0dc3b747d26..cc91ccc22a4 100644 --- a/reactos/lib/crtdll/stdlib/putenv.c +++ b/reactos/lib/crtdll/stdlib/putenv.c @@ -1,6 +1,6 @@ #include -#include -#include +#include +#include diff --git a/reactos/lib/crtdll/stdlib/qsort.c b/reactos/lib/crtdll/stdlib/qsort.c index a65c6b58a4a..f2be7c51680 100644 --- a/reactos/lib/crtdll/stdlib/qsort.c +++ b/reactos/lib/crtdll/stdlib/qsort.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include /*- * Copyright (c) 1980, 1983 The Regents of the University of California. diff --git a/reactos/lib/crtdll/stdlib/rand.c b/reactos/lib/crtdll/stdlib/rand.c index 3628947bd6c..78912a29667 100644 --- a/reactos/lib/crtdll/stdlib/rand.c +++ b/reactos/lib/crtdll/stdlib/rand.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include static unsigned long long next = 0; diff --git a/reactos/lib/crtdll/stdlib/senv.c b/reactos/lib/crtdll/stdlib/senv.c index 9bc467f7523..66bf91e6394 100644 --- a/reactos/lib/crtdll/stdlib/senv.c +++ b/reactos/lib/crtdll/stdlib/senv.c @@ -1,6 +1,6 @@ -#include +#include #include -#include +#include void _searchenv(const char *file,const char *var,char *path ) { diff --git a/reactos/lib/crtdll/stdlib/splitp.c b/reactos/lib/crtdll/stdlib/splitp.c index 8dbe18b20cc..86f157efc39 100644 --- a/reactos/lib/crtdll/stdlib/splitp.c +++ b/reactos/lib/crtdll/stdlib/splitp.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include void _splitpath( const char *path, char *drive, char *dir, char *fname, char *ext ) { diff --git a/reactos/lib/crtdll/stdlib/strtod.c b/reactos/lib/crtdll/stdlib/strtod.c index 832cb2efc12..289752b4156 100644 --- a/reactos/lib/crtdll/stdlib/strtod.c +++ b/reactos/lib/crtdll/stdlib/strtod.c @@ -1,7 +1,7 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include double diff --git a/reactos/lib/crtdll/stdlib/strtol.c b/reactos/lib/crtdll/stdlib/strtol.c index 51a25222d96..cbe7e184e48 100644 --- a/reactos/lib/crtdll/stdlib/strtol.c +++ b/reactos/lib/crtdll/stdlib/strtol.c @@ -1,9 +1,9 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ #include -#include -#include -#include -#include +#include +#include +#include +#include long strtol(const char *nptr, char **endptr, int base) diff --git a/reactos/lib/crtdll/stdlib/strtold.c b/reactos/lib/crtdll/stdlib/strtold.c index cbcce231d51..6c5aec6001f 100644 --- a/reactos/lib/crtdll/stdlib/strtold.c +++ b/reactos/lib/crtdll/stdlib/strtold.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -//#include +#include +#include +//#include static double powten[] = { diff --git a/reactos/lib/crtdll/stdlib/strtoll.c b/reactos/lib/crtdll/stdlib/strtoll.c index 26b4944acf3..237aeacb2a6 100644 --- a/reactos/lib/crtdll/stdlib/strtoll.c +++ b/reactos/lib/crtdll/stdlib/strtoll.c @@ -1,10 +1,10 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ #include -#include -#include -#include -//#include +#include +#include +#include +//#include /* constants used in Solaris */ #define LLONG_MIN -9223372036854775807L-1L diff --git a/reactos/lib/crtdll/stdlib/strtoul.c b/reactos/lib/crtdll/stdlib/strtoul.c index d076d07f35d..ce4b432fb9b 100644 --- a/reactos/lib/crtdll/stdlib/strtoul.c +++ b/reactos/lib/crtdll/stdlib/strtoul.c @@ -1,9 +1,9 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ #include -#include -#include -#include -#include +#include +#include +#include +#include /* diff --git a/reactos/lib/crtdll/stdlib/strtoull.c b/reactos/lib/crtdll/stdlib/strtoull.c index 020d539c04d..d94845e2b39 100644 --- a/reactos/lib/crtdll/stdlib/strtoull.c +++ b/reactos/lib/crtdll/stdlib/strtoull.c @@ -1,10 +1,10 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ #include -#include -#include -#include -//#include +#include +#include +#include +//#include /* * Convert a string to an unsigned long integer. diff --git a/reactos/lib/crtdll/stdlib/swab.c b/reactos/lib/crtdll/stdlib/swab.c new file mode 100644 index 00000000000..0126c598f91 --- /dev/null +++ b/reactos/lib/crtdll/stdlib/swab.c @@ -0,0 +1,18 @@ +/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ +#include + +void _swab (const char* caFrom, char* caTo, size_t sizeToCopy) +{ + unsigned long temp; + + sizeToCopy >>= 1; sizeToCopy++; +#define STEP temp = *((const char *)caFrom)++,*((char *)caTo)++ = *((const char *)caFrom)++,*((char *)caTo)++ = temp + /* round to multiple of 8 */ + while ((--sizeToCopy) & 07) + STEP; + sizeToCopy >>= 3; + while (--sizeToCopy >= 0) { + STEP; STEP; STEP; STEP; + STEP; STEP; STEP; STEP; + } +} diff --git a/reactos/lib/crtdll/stdlib/wcstom.c b/reactos/lib/crtdll/stdlib/wcstom.c index cdd11106509..3d04153c3c2 100644 --- a/reactos/lib/crtdll/stdlib/wcstom.c +++ b/reactos/lib/crtdll/stdlib/wcstom.c @@ -1,4 +1,4 @@ -#include +#include size_t wcstombs (char* mbsDest, const wchar_t* wsConvert, size_t size) { diff --git a/reactos/lib/crtdll/string/memchr.c b/reactos/lib/crtdll/string/memchr.c index cd8b19cbd6d..cb0589fe24b 100644 --- a/reactos/lib/crtdll/string/memchr.c +++ b/reactos/lib/crtdll/string/memchr.c @@ -1,7 +1,7 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include void * memchr(const void *s, int c, size_t n) diff --git a/reactos/lib/crtdll/string/memcmp.c b/reactos/lib/crtdll/string/memcmp.c index 1c361a33074..ed5b9ae3773 100644 --- a/reactos/lib/crtdll/string/memcmp.c +++ b/reactos/lib/crtdll/string/memcmp.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include int memcmp(const void *s1, const void *s2, size_t n) diff --git a/reactos/lib/crtdll/string/memcpy.c b/reactos/lib/crtdll/string/memcpy.c index 0e117013f2b..609afd4b5df 100644 --- a/reactos/lib/crtdll/string/memcpy.c +++ b/reactos/lib/crtdll/string/memcpy.c @@ -17,3 +17,15 @@ memcpy (char *to, char *from, size_t count) return to; } + +void *__constant_memcpy(char *to, char *from, size_t count) +{ + return memcpy(to,from,count); +} + +void *__memcpy(char *to, char *from, size_t count) +{ + return memcpy(to,from,count); +} + + diff --git a/reactos/lib/crtdll/string/memmove.c b/reactos/lib/crtdll/string/memmove.c index 6d8940adf7e..d8af46e554b 100644 --- a/reactos/lib/crtdll/string/memmove.c +++ b/reactos/lib/crtdll/string/memmove.c @@ -1,10 +1,10 @@ -#include +#include void * memmove(void *dest,const void *src,size_t count) { - char *char_dest = dest; - char *char_src = src; + char *char_dest = (char *)dest; + char *char_src = (char *)src; while(count > 0 ) { diff --git a/reactos/lib/crtdll/string/memset.c b/reactos/lib/crtdll/string/memset.c index 24ec583dfc9..ef1069df3ae 100644 --- a/reactos/lib/crtdll/string/memset.c +++ b/reactos/lib/crtdll/string/memset.c @@ -11,3 +11,19 @@ void * memset(void *src,int val,size_t count) } return src; } + +void *__memset_generic(void *src,int val,size_t count) +{ + return memset(src,val,count); +} + +void * __constant_c_and_count_memset(void * s, unsigned long pattern, size_t count) +{ + return memset(s,pattern,count); +} + + +void * __constant_c_memset(void *src,int val,size_t count) +{ + return memset(src,val,count); +} diff --git a/reactos/lib/crtdll/string/str_old.c b/reactos/lib/crtdll/string/str_old.c index bc5ec329cae..a84ebb5728e 100644 --- a/reactos/lib/crtdll/string/str_old.c +++ b/reactos/lib/crtdll/string/str_old.c @@ -19,19 +19,19 @@ * DISCLAMED. This includes but is not limited to warrenties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.1 $ - * $Author: rex $ - * $Date: 1999/01/16 02:11:44 $ + * $Revision: 1.2 $ + * $Author: ariadne $ + * $Date: 1999/04/02 21:44:05 $ * */ -#include -#include +#include +#include int strcasecmp (const char* sz1, const char* sz2) { - return stricmp (sz1, sz2); + return _stricmp (sz1, sz2); } int @@ -43,6 +43,7 @@ strncasecmp (const char* sz1, const char* sz2, size_t sizeMaxCompare) int wcscmpi (const wchar_t* ws1, const wchar_t* ws2) { - return wcsicmp (ws1, ws2); + //return wcsicmp (ws1, ws2); + return 0; } diff --git a/reactos/lib/crtdll/string/strcat.c b/reactos/lib/crtdll/string/strcat.c index 33050472650..fd0954736b9 100644 --- a/reactos/lib/crtdll/string/strcat.c +++ b/reactos/lib/crtdll/string/strcat.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include char * strcat(char *s, const char *append) diff --git a/reactos/lib/crtdll/string/strcmp.c b/reactos/lib/crtdll/string/strcmp.c index 7b82a6e6d70..3f8c76e829b 100644 --- a/reactos/lib/crtdll/string/strcmp.c +++ b/reactos/lib/crtdll/string/strcmp.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include int strcmp(const char *s1, const char *s2) diff --git a/reactos/lib/crtdll/string/strcoll.c b/reactos/lib/crtdll/string/strcoll.c index ada803c259f..1d08be51ce6 100644 --- a/reactos/lib/crtdll/string/strcoll.c +++ b/reactos/lib/crtdll/string/strcoll.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include int strcoll(const char *s1, const char *s2) diff --git a/reactos/lib/crtdll/string/strcspn.c b/reactos/lib/crtdll/string/strcspn.c index 7e17b21976a..430182d454f 100644 --- a/reactos/lib/crtdll/string/strcspn.c +++ b/reactos/lib/crtdll/string/strcspn.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include size_t strcspn(const char *s1, const char *s2) diff --git a/reactos/lib/crtdll/string/strdup.c b/reactos/lib/crtdll/string/strdup.c index 695d89eba3d..3214e4e92d3 100644 --- a/reactos/lib/crtdll/string/strdup.c +++ b/reactos/lib/crtdll/string/strdup.c @@ -1,10 +1,9 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include -char * -strdup(const char *_s) +char *_strdup(const char *_s) { char *rv; if (_s == 0) diff --git a/reactos/lib/crtdll/string/strerror.c b/reactos/lib/crtdll/string/strerror.c index bd28973826a..0f9f9eb0395 100644 --- a/reactos/lib/crtdll/string/strerror.c +++ b/reactos/lib/crtdll/string/strerror.c @@ -1,9 +1,8 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include -//#include +#include +#include +#include +#include char __syserr00[] = "No Error"; @@ -59,8 +58,9 @@ __syserr35, __syserr36, __syserr37, __syserr38 int __sys_nerr = sizeof(__sys_errlist) / sizeof(__sys_errlist[0]); -char * -strerror(int errnum) +int* _sys_nerr_dll = &__sys_nerr; + +char *strerror(int errnum) { static char ebuf[40]; /* 64-bit number + slop */ char *cp; @@ -91,8 +91,7 @@ strerror(int errnum) return ebuf; } -#undef errno -extern int errno; + char *_strerror(const char *s) { if ( s == NULL ) diff --git a/reactos/lib/crtdll/string/stricmp.c b/reactos/lib/crtdll/string/stricmp.c index 377414e972f..22b2eb44c3e 100644 --- a/reactos/lib/crtdll/string/stricmp.c +++ b/reactos/lib/crtdll/string/stricmp.c @@ -1,9 +1,9 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include int -stricmp(const char *s1, const char *s2) +_stricmp(const char *s1, const char *s2) { while (toupper(*s1) == toupper(*s2)) { @@ -14,3 +14,9 @@ stricmp(const char *s1, const char *s2) } return toupper(*(unsigned const char *)s1) - toupper(*(unsigned const char *)(s2)); } + +int +_strcmpi(const char *s1, const char *s2) +{ + return stricmp(s1,s2); +} diff --git a/reactos/lib/crtdll/string/strlen.c b/reactos/lib/crtdll/string/strlen.c index d5b8d681ffb..c68a3dd712b 100644 --- a/reactos/lib/crtdll/string/strlen.c +++ b/reactos/lib/crtdll/string/strlen.c @@ -1,5 +1,5 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include +#include size_t strlen(const char *str) diff --git a/reactos/lib/crtdll/string/strlwr.c b/reactos/lib/crtdll/string/strlwr.c index cb0d28f506f..9a11967f622 100644 --- a/reactos/lib/crtdll/string/strlwr.c +++ b/reactos/lib/crtdll/string/strlwr.c @@ -8,10 +8,10 @@ * Copyright 1997 Uwe Bonnes */ -#include -#include +#include +#include -char * strlwr(char *x) +char * _strlwr(char *x) { char *y=x; diff --git a/reactos/lib/crtdll/string/strncat.c b/reactos/lib/crtdll/string/strncat.c index 75fc9ee41eb..d3803fee99a 100644 --- a/reactos/lib/crtdll/string/strncat.c +++ b/reactos/lib/crtdll/string/strncat.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include char * strncat(char *dst, const char *src, size_t n) diff --git a/reactos/lib/crtdll/string/strncmp.c b/reactos/lib/crtdll/string/strncmp.c index f90eb5b2e44..0f2950e2b45 100644 --- a/reactos/lib/crtdll/string/strncmp.c +++ b/reactos/lib/crtdll/string/strncmp.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include int diff --git a/reactos/lib/crtdll/string/strncpy.c b/reactos/lib/crtdll/string/strncpy.c index fdf7bd6c333..428a2350eed 100644 --- a/reactos/lib/crtdll/string/strncpy.c +++ b/reactos/lib/crtdll/string/strncpy.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include char * strncpy(char *dst, const char *src, size_t n) diff --git a/reactos/lib/crtdll/string/strnicmp.c b/reactos/lib/crtdll/string/strnicmp.c index 3469c98963c..30563e9be11 100644 --- a/reactos/lib/crtdll/string/strnicmp.c +++ b/reactos/lib/crtdll/string/strnicmp.c @@ -1,9 +1,8 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include +#include +#include -int -strnicmp(const char *s1, const char *s2, size_t n) +int _strnicmp(const char *s1, const char *s2, size_t n) { if (n == 0) diff --git a/reactos/lib/crtdll/string/strnlen.c b/reactos/lib/crtdll/string/strnlen.c index 3027497f79a..6b92fb3b38e 100644 --- a/reactos/lib/crtdll/string/strnlen.c +++ b/reactos/lib/crtdll/string/strnlen.c @@ -1,8 +1,8 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include +#include size_t -strnlen(const char *str, int count) +strnlen(const char *str, size_t count) { const char *s; diff --git a/reactos/lib/crtdll/string/strpbrk.c b/reactos/lib/crtdll/string/strpbrk.c index 5f642c4c1bf..c2968ae86ca 100644 --- a/reactos/lib/crtdll/string/strpbrk.c +++ b/reactos/lib/crtdll/string/strpbrk.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include char * diff --git a/reactos/lib/crtdll/string/strrchr.c b/reactos/lib/crtdll/string/strrchr.c index e6f3399494f..688d6bfbb7f 100644 --- a/reactos/lib/crtdll/string/strrchr.c +++ b/reactos/lib/crtdll/string/strrchr.c @@ -1,7 +1,7 @@ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -//#include +#include +//#include char * strrchr(const char *s, int c) diff --git a/reactos/lib/crtdll/string/strspn.c b/reactos/lib/crtdll/string/strspn.c index 1532db001db..d6e234df329 100644 --- a/reactos/lib/crtdll/string/strspn.c +++ b/reactos/lib/crtdll/string/strspn.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include size_t strspn(const char *s1, const char *s2) diff --git a/reactos/lib/crtdll/string/strstr.c b/reactos/lib/crtdll/string/strstr.c index 7a102a1827f..e62eeb0f092 100644 --- a/reactos/lib/crtdll/string/strstr.c +++ b/reactos/lib/crtdll/string/strstr.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -//#include +#include +//#include char * strstr(const char *s, const char *find) diff --git a/reactos/lib/crtdll/string/strtok.c b/reactos/lib/crtdll/string/strtok.c index c5c6d8c9fd1..62b0fdc7ad8 100644 --- a/reactos/lib/crtdll/string/strtok.c +++ b/reactos/lib/crtdll/string/strtok.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include char * strtok(char *s, const char *delim) diff --git a/reactos/lib/crtdll/string/strtoul.c b/reactos/lib/crtdll/string/strtoul.c index 320c653f300..5a007e44f4e 100644 --- a/reactos/lib/crtdll/string/strtoul.c +++ b/reactos/lib/crtdll/string/strtoul.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include unsigned long strtoul(const char *cp,char **endp,unsigned int base) { diff --git a/reactos/lib/crtdll/string/strupr.c b/reactos/lib/crtdll/string/strupr.c index f0bf755ea0b..0cd73b83204 100644 --- a/reactos/lib/crtdll/string/strupr.c +++ b/reactos/lib/crtdll/string/strupr.c @@ -9,8 +9,8 @@ */ -#include -#include +#include +#include char *strupr(char *x) { diff --git a/reactos/lib/crtdll/string/strxfrm.c b/reactos/lib/crtdll/string/strxfrm.c index 389b6f5c575..2c2495c4744 100644 --- a/reactos/lib/crtdll/string/strxfrm.c +++ b/reactos/lib/crtdll/string/strxfrm.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include size_t strxfrm(char *dst,const char *src, size_t n) diff --git a/reactos/lib/crtdll/sys_stat/fstat.c b/reactos/lib/crtdll/sys_stat/fstat.c index d8deb06828c..e75454f9d7b 100644 --- a/reactos/lib/crtdll/sys_stat/fstat.c +++ b/reactos/lib/crtdll/sys_stat/fstat.c @@ -1,15 +1,13 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include -//#include +#include -void UnixTimeToFileTime( time_t unix_time, FILETIME *filetime, DWORD remainder ); -time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder ); int -fstat(int handle, struct stat *statbuf) +_fstat(int handle, struct stat *statbuf) { BY_HANDLE_FILE_INFORMATION FileInformation; diff --git a/reactos/lib/crtdll/sys_stat/stat.c b/reactos/lib/crtdll/sys_stat/stat.c index f10455f5a35..f8e409f1f4e 100644 --- a/reactos/lib/crtdll/sys_stat/stat.c +++ b/reactos/lib/crtdll/sys_stat/stat.c @@ -1,13 +1,8 @@ -#include -#include -#include -#include +#include +#include +#include +#include -#undef stat -int stat( const char *path, struct stat *buffer ) -{ - return _stat(path,buffer); -} int _stat( const char *path, struct stat *buffer ) { diff --git a/reactos/lib/crtdll/tchar/strdec.c b/reactos/lib/crtdll/tchar/strdec.c new file mode 100644 index 00000000000..05cbf98cd38 --- /dev/null +++ b/reactos/lib/crtdll/tchar/strdec.c @@ -0,0 +1,7 @@ +#include + +char * _strdec(const char *str1, const char *str2) +{ + return (char *) (( str1 >= str2 ) ? ( str1 ) : --str2); +} + diff --git a/reactos/lib/crtdll/tchar/strinc.c b/reactos/lib/crtdll/tchar/strinc.c new file mode 100644 index 00000000000..bb1b49fe772 --- /dev/null +++ b/reactos/lib/crtdll/tchar/strinc.c @@ -0,0 +1,6 @@ +#include + +char * _strinc(const char *str) +{ + return (char *)(++str); +} diff --git a/reactos/lib/crtdll/tchar/strncnt.c b/reactos/lib/crtdll/tchar/strncnt.c new file mode 100644 index 00000000000..b47cc208268 --- /dev/null +++ b/reactos/lib/crtdll/tchar/strncnt.c @@ -0,0 +1,8 @@ +#include +#include +#include + +size_t _strncnt( const char *str, size_t max) +{ + return strnlen(str,max); +} diff --git a/reactos/lib/crtdll/tchar/strnextc.c b/reactos/lib/crtdll/tchar/strnextc.c new file mode 100644 index 00000000000..b1c05853f83 --- /dev/null +++ b/reactos/lib/crtdll/tchar/strnextc.c @@ -0,0 +1,6 @@ +#include + +int _strnextc(const char *str) +{ + return *(++str); +} diff --git a/reactos/lib/crtdll/tchar/strninc.c b/reactos/lib/crtdll/tchar/strninc.c new file mode 100644 index 00000000000..72169a51ffb --- /dev/null +++ b/reactos/lib/crtdll/tchar/strninc.c @@ -0,0 +1,6 @@ +#include + +char * _strninc(const char *str, size_t inc) +{ + return (char *)(str + inc); +} diff --git a/reactos/lib/crtdll/tchar/strspnp.c b/reactos/lib/crtdll/tchar/strspnp.c new file mode 100644 index 00000000000..1a56476a798 --- /dev/null +++ b/reactos/lib/crtdll/tchar/strspnp.c @@ -0,0 +1,7 @@ +#include + + +char * _strspnp( const char * str1, const char * str2) +{ + return NULL; +} \ No newline at end of file diff --git a/reactos/lib/crtdll/time/clock.c b/reactos/lib/crtdll/time/clock.c index 3814ebcee95..404aadff133 100644 --- a/reactos/lib/crtdll/time/clock.c +++ b/reactos/lib/crtdll/time/clock.c @@ -9,10 +9,10 @@ */ #include -#include +#include +#include -// should be replace by a call to RtltimeToSecondsSince70 -time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder ); +VOID STDCALL GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime ); clock_t clock ( void ) { @@ -24,11 +24,11 @@ clock_t clock ( void ) FILETIME SystemTime; DWORD Remainder; - if ( !GetProcessTimes(-1,&CreationTime,&ExitTime,&KernelTime,&UserTime ) ) + if ( !GetProcessTimes(GetCurrentProcess(),&CreationTime,&ExitTime,&KernelTime,&UserTime ) ) return -1; - if ( !GetSystemTimeAsFileTime(&SystemTime) ) - return -1; + GetSystemTimeAsFileTime(&SystemTime); + return FileTimeToUnixTime( &SystemTime,&Remainder ) - FileTimeToUnixTime( &CreationTime,&Remainder ); } \ No newline at end of file diff --git a/reactos/lib/crtdll/time/ctime.c b/reactos/lib/crtdll/time/ctime.c index b00098f4d95..0eee0f9dc89 100644 --- a/reactos/lib/crtdll/time/ctime.c +++ b/reactos/lib/crtdll/time/ctime.c @@ -39,17 +39,17 @@ static char sccsid[] = "@(#)ctime.c 5.23 (Berkeley) 6/22/90"; -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include "tzfile.h" -#include +#include #include "posixrul.h" @@ -81,6 +81,8 @@ static char sccsid[] = "@(#)ctime.c 5.23 (Berkeley) 6/22/90"; ** manual page of what this "time zone abbreviation" means (doing this so ** that tzname[0] has the "normal" length of three characters). */ +int _daylight_dll; + static char WILDABBR[] = " "; #ifndef TRUE diff --git a/reactos/lib/crtdll/time/difftime.c b/reactos/lib/crtdll/time/difftime.c index 7f1846078d7..97d6b59b503 100644 --- a/reactos/lib/crtdll/time/difftime.c +++ b/reactos/lib/crtdll/time/difftime.c @@ -1,5 +1,5 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include double difftime(time_t time1, time_t time0) diff --git a/reactos/lib/crtdll/time/strftime.c b/reactos/lib/crtdll/time/strftime.c index 252448e0984..cc6f0e9dcda 100644 --- a/reactos/lib/crtdll/time/strftime.c +++ b/reactos/lib/crtdll/time/strftime.c @@ -1,8 +1,8 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include -#include +#include #define TM_YEAR_BASE 1900 diff --git a/reactos/lib/crtdll/time/time.c b/reactos/lib/crtdll/time/time.c index f682a7c0caa..3a49372b2c2 100644 --- a/reactos/lib/crtdll/time/time.c +++ b/reactos/lib/crtdll/time/time.c @@ -8,13 +8,18 @@ * 28/12/98: Created */ +/* + * DOS file system functions + * + * Copyright 1993 Erik Bos + * Copyright 1996 Alexandre Julliard + */ + #include -#include +#include +#include -// should be replace by a call to RtltimeToSecondsSince70 -// and moved to a header - -time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder ); +VOID STDCALL GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime ); time_t time(time_t *t) @@ -25,3 +30,190 @@ time(time_t *t) return FileTimeToUnixTime( &SystemTime,&Remainder ); } +/*********************************************************************** + * DOSFS_UnixTimeToFileTime + * + * Convert a Unix time to FILETIME format. + * The FILETIME structure is a 64-bit value representing the number of + * 100-nanosecond intervals since January 1, 1601, 0:00. + * 'remainder' is the nonnegative number of 100-ns intervals + * corresponding to the time fraction smaller than 1 second that + * couldn't be stored in the time_t value. + */ +void UnixTimeToFileTime( time_t unix_time, FILETIME *filetime, + DWORD remainder ) +{ + /* NOTES: + + CONSTANTS: + The time difference between 1 January 1601, 00:00:00 and + 1 January 1970, 00:00:00 is 369 years, plus the leap years + from 1604 to 1968, excluding 1700, 1800, 1900. + This makes (1968 - 1600) / 4 - 3 = 89 leap days, and a total + of 134774 days. + + Any day in that period had 24 * 60 * 60 = 86400 seconds. + + The time difference is 134774 * 86400 * 10000000, which can be written + 116444736000000000 + 27111902 * 2^32 + 3577643008 + 413 * 2^48 + 45534 * 2^32 + 54590 * 2^16 + 32768 + + If you find that these constants are buggy, please change them in all + instances in both conversion functions. + + VERSIONS: + There are two versions, one of them uses long long variables and + is presumably faster but not ISO C. The other one uses standard C + data types and operations but relies on the assumption that negative + numbers are stored as 2's complement (-1 is 0xffff....). If this + assumption is violated, dates before 1970 will not convert correctly. + This should however work on any reasonable architecture where WINE + will run. + + DETAILS: + + Take care not to remove the casts. I have tested these functions + (in both versions) for a lot of numbers. I would be interested in + results on other compilers than GCC. + + The operations have been designed to account for the possibility + of 64-bit time_t in future UNICES. Even the versions without + internal long long numbers will work if time_t only is 64 bit. + A 32-bit shift, which was necessary for that operation, turned out + not to work correctly in GCC, besides giving the warning. So I + used a double 16-bit shift instead. Numbers are in the ISO version + represented by three limbs, the most significant with 32 bit, the + other two with 16 bit each. + + As the modulo-operator % is not well-defined for negative numbers, + negative divisors have been avoided in DOSFS_FileTimeToUnixTime. + + There might be quicker ways to do this in C. Certainly so in + assembler. + + Claus Fischer, fischer@iue.tuwien.ac.at + */ + + + + + unsigned long a0; /* 16 bit, low bits */ + unsigned long a1; /* 16 bit, medium bits */ + unsigned long a2; /* 32 bit, high bits */ + + /* Copy the unix time to a2/a1/a0 */ + a0 = unix_time & 0xffff; + a1 = (unix_time >> 16) & 0xffff; + /* This is obsolete if unix_time is only 32 bits, but it does not hurt. + Do not replace this by >> 32, it gives a compiler warning and it does + not work. */ + a2 = (unix_time >= 0 ? (unix_time >> 16) >> 16 : + ~((~unix_time >> 16) >> 16)); + + /* Multiply a by 10000000 (a = a2/a1/a0) + Split the factor into 10000 * 1000 which are both less than 0xffff. */ + a0 *= 10000; + a1 = a1 * 10000 + (a0 >> 16); + a2 = a2 * 10000 + (a1 >> 16); + a0 &= 0xffff; + a1 &= 0xffff; + + a0 *= 1000; + a1 = a1 * 1000 + (a0 >> 16); + a2 = a2 * 1000 + (a1 >> 16); + a0 &= 0xffff; + a1 &= 0xffff; + + /* Add the time difference and the remainder */ + a0 += 32768 + (remainder & 0xffff); + a1 += 54590 + (remainder >> 16 ) + (a0 >> 16); + a2 += 27111902 + (a1 >> 16); + a0 &= 0xffff; + a1 &= 0xffff; + + /* Set filetime */ + filetime->dwLowDateTime = (a1 << 16) + a0; + filetime->dwHighDateTime = a2; +} + + +/*********************************************************************** + * DOSFS_FileTimeToUnixTime + * + * Convert a FILETIME format to Unix time. + * If not NULL, 'remainder' contains the fractional part of the filetime, + * in the range of [0..9999999] (even if time_t is negative). + */ +time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder ) +{ + /* Read the comment in the function DOSFS_UnixTimeToFileTime. */ + + unsigned long a0; /* 16 bit, low bits */ + unsigned long a1; /* 16 bit, medium bits */ + unsigned long a2; /* 32 bit, high bits */ + unsigned long r; /* remainder of division */ + unsigned int carry; /* carry bit for subtraction */ + int negative; /* whether a represents a negative value */ + + /* Copy the time values to a2/a1/a0 */ + a2 = (unsigned long)filetime->dwHighDateTime; + a1 = ((unsigned long)filetime->dwLowDateTime ) >> 16; + a0 = ((unsigned long)filetime->dwLowDateTime ) & 0xffff; + + /* Subtract the time difference */ + if (a0 >= 32768 ) a0 -= 32768 , carry = 0; + else a0 += (1 << 16) - 32768 , carry = 1; + + if (a1 >= 54590 + carry) a1 -= 54590 + carry, carry = 0; + else a1 += (1 << 16) - 54590 - carry, carry = 1; + + a2 -= 27111902 + carry; + + /* If a is negative, replace a by (-1-a) */ + negative = (a2 >= ((unsigned long)1) << 31); + if (negative) + { + /* Set a to -a - 1 (a is a2/a1/a0) */ + a0 = 0xffff - a0; + a1 = 0xffff - a1; + a2 = ~a2; + } + + /* Divide a by 10000000 (a = a2/a1/a0), put the rest into r. + Split the divisor into 10000 * 1000 which are both less than 0xffff. */ + a1 += (a2 % 10000) << 16; + a2 /= 10000; + a0 += (a1 % 10000) << 16; + a1 /= 10000; + r = a0 % 10000; + a0 /= 10000; + + a1 += (a2 % 1000) << 16; + a2 /= 1000; + a0 += (a1 % 1000) << 16; + a1 /= 1000; + r += (a0 % 1000) * 10000; + a0 /= 1000; + + /* If a was negative, replace a by (-1-a) and r by (9999999 - r) */ + if (negative) + { + /* Set a to -a - 1 (a is a2/a1/a0) */ + a0 = 0xffff - a0; + a1 = 0xffff - a1; + a2 = ~a2; + + r = 9999999 - r; + } + + if (remainder) *remainder = r; + + /* Do not replace this by << 32, it gives a compiler warning and it does + not work. */ + return ((((time_t)a2) << 16) << 16) + (a1 << 16) + a0; + +} + + + diff --git a/reactos/lib/crtdll/wchar/wcscat.c b/reactos/lib/crtdll/wchar/wcscat.c index fcc36038a99..e2787a8a2b5 100644 --- a/reactos/lib/crtdll/wchar/wcscat.c +++ b/reactos/lib/crtdll/wchar/wcscat.c @@ -1,6 +1,6 @@ -#include +#include wchar_t * wcscat(wchar_t * dest,const wchar_t * src) { diff --git a/reactos/lib/crtdll/wchar/wcschr.c b/reactos/lib/crtdll/wchar/wcschr.c index 1fb1540856b..5bbd9591753 100644 --- a/reactos/lib/crtdll/wchar/wcschr.c +++ b/reactos/lib/crtdll/wchar/wcschr.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include wchar_t* wcschr(const wchar_t* str, wchar_t ch) { diff --git a/reactos/lib/crtdll/wchar/wcscmp.c b/reactos/lib/crtdll/wchar/wcscmp.c index 997bfb88f50..ab25af4d401 100644 --- a/reactos/lib/crtdll/wchar/wcscmp.c +++ b/reactos/lib/crtdll/wchar/wcscmp.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include int wcscmp(const wchar_t* cs,const wchar_t * ct) { diff --git a/reactos/lib/crtdll/wchar/wcscoll.c b/reactos/lib/crtdll/wchar/wcscoll.c index 712733e74e8..5dac0268621 100644 --- a/reactos/lib/crtdll/wchar/wcscoll.c +++ b/reactos/lib/crtdll/wchar/wcscoll.c @@ -8,9 +8,9 @@ * Copyright 1997 Uwe Bonnes */ -#include +#include -size_t wcscoll(wchar_t *a1,wchar_t *a2) +int wcscoll(const wchar_t *a1,const wchar_t *a2) { /* FIXME: handle collates */ return wcscmp(a1,a2); diff --git a/reactos/lib/crtdll/wchar/wcscpy.c b/reactos/lib/crtdll/wchar/wcscpy.c index 4e122f52e8a..44f71f0aba3 100644 --- a/reactos/lib/crtdll/wchar/wcscpy.c +++ b/reactos/lib/crtdll/wchar/wcscpy.c @@ -1,6 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include wchar_t * wcscpy(wchar_t * str1,const wchar_t * str2) { diff --git a/reactos/lib/crtdll/wchar/wcscspn.c b/reactos/lib/crtdll/wchar/wcscspn.c index 64d84751aa7..2c3f2d21e90 100644 --- a/reactos/lib/crtdll/wchar/wcscspn.c +++ b/reactos/lib/crtdll/wchar/wcscspn.c @@ -1,4 +1,4 @@ -#include +#include size_t wcscspn(const wchar_t *str,const wchar_t *reject) { diff --git a/reactos/lib/crtdll/wchar/wcsdup.c b/reactos/lib/crtdll/wchar/wcsdup.c index ee21a9b49f2..c6db721bec4 100644 --- a/reactos/lib/crtdll/wchar/wcsdup.c +++ b/reactos/lib/crtdll/wchar/wcsdup.c @@ -1,7 +1,7 @@ -#include +#include -wchar_t *wcsdup(const wchar_t *ptr) +wchar_t *_wcsdup(const wchar_t *ptr) { wchar_t *dup; dup = malloc((wcslen(ptr) + 1)*sizeof(wchar_t)); diff --git a/reactos/lib/crtdll/wchar/wcsftime.c b/reactos/lib/crtdll/wchar/wcsftime.c new file mode 100644 index 00000000000..4e402b5a21b --- /dev/null +++ b/reactos/lib/crtdll/wchar/wcsftime.c @@ -0,0 +1,6 @@ +#include + +size_t wcsftime(wchar_t *str, size_t len, const wchar_t *fmt, const struct tm *tp ) +{ + return 0; +} \ No newline at end of file diff --git a/reactos/lib/crtdll/wchar/wcsicmp.c b/reactos/lib/crtdll/wchar/wcsicmp.c index 658e2d1aec1..1cfaf8ea24b 100644 --- a/reactos/lib/crtdll/wchar/wcsicmp.c +++ b/reactos/lib/crtdll/wchar/wcsicmp.c @@ -1,8 +1,8 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include +#include -int wcsicmp(const wchar_t* cs,const wchar_t * ct) +int _wcsicmp(const wchar_t* cs,const wchar_t * ct) { while (towlower(*cs) == towlower(*ct)) { diff --git a/reactos/lib/crtdll/wchar/wcslen.c b/reactos/lib/crtdll/wchar/wcslen.c index 31e81fa7806..6c400818529 100644 --- a/reactos/lib/crtdll/wchar/wcslen.c +++ b/reactos/lib/crtdll/wchar/wcslen.c @@ -1,11 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include - -size_t wstrlen(const wchar_t *s) -{ - return wcslen(s); -} +#include size_t wcslen(const wchar_t * s) @@ -17,3 +12,10 @@ size_t wcslen(const wchar_t * s) for (save = s; *save; ++save); return save-s; } + +size_t wstrlen(const wchar_t *s) +{ + return wcslen(s); +} + + diff --git a/reactos/lib/crtdll/wchar/wcslwr.c b/reactos/lib/crtdll/wchar/wcslwr.c index a4dc2eead66..0dcf2da005e 100644 --- a/reactos/lib/crtdll/wchar/wcslwr.c +++ b/reactos/lib/crtdll/wchar/wcslwr.c @@ -8,9 +8,9 @@ * Copyright 1997 Uwe Bonnes */ -#include +#include -wchar_t * wcslwr(wchar_t *x) +wchar_t * _wcslwr(wchar_t *x) { wchar_t *y=x; diff --git a/reactos/lib/crtdll/wchar/wcsncat.c b/reactos/lib/crtdll/wchar/wcsncat.c index c4bfc7d4843..a76fb0f9481 100644 --- a/reactos/lib/crtdll/wchar/wcsncat.c +++ b/reactos/lib/crtdll/wchar/wcsncat.c @@ -1,4 +1,4 @@ -#include +#include wchar_t * wcsncat(wchar_t * dest,const wchar_t * src,size_t count) { diff --git a/reactos/lib/crtdll/wchar/wcsncmp.c b/reactos/lib/crtdll/wchar/wcsncmp.c index ad8d23892fa..6341f462c61 100644 --- a/reactos/lib/crtdll/wchar/wcsncmp.c +++ b/reactos/lib/crtdll/wchar/wcsncmp.c @@ -1,4 +1,4 @@ -#include +#include int wcsncmp(const wchar_t * cs,const wchar_t * ct,size_t count) { diff --git a/reactos/lib/crtdll/wchar/wcsncpy.c b/reactos/lib/crtdll/wchar/wcsncpy.c index 7c8a1a1e28d..5ae1f414c70 100644 --- a/reactos/lib/crtdll/wchar/wcsncpy.c +++ b/reactos/lib/crtdll/wchar/wcsncpy.c @@ -1,6 +1,6 @@ -#include +#include -wchar_t * wcsncpy(wchar_t * dest,const wchar_t *src,size_t count) +wchar_t * _wcsncpy(wchar_t * dest,const wchar_t *src,size_t count) { int i; diff --git a/reactos/lib/crtdll/wchar/wcsnicmp.c b/reactos/lib/crtdll/wchar/wcsnicmp.c index 8d4621bf28f..b39ce446678 100644 --- a/reactos/lib/crtdll/wchar/wcsnicmp.c +++ b/reactos/lib/crtdll/wchar/wcsnicmp.c @@ -1,6 +1,6 @@ -#include +#include -int wcsnicmp(const wchar_t * cs,const wchar_t * ct,size_t count) +int _wcsnicmp(const wchar_t * cs,const wchar_t * ct,size_t count) { wchar_t *save = cs; while (towlower(*cs) == towlower(*ct) && (int)(cs - save) < count) diff --git a/reactos/lib/crtdll/wchar/wcsnlen.c b/reactos/lib/crtdll/wchar/wcsnlen.c index b91b9d11e46..dc5796c6376 100644 --- a/reactos/lib/crtdll/wchar/wcsnlen.c +++ b/reactos/lib/crtdll/wchar/wcsnlen.c @@ -1,4 +1,6 @@ -size_t wcsnlen(const wchar_t * s, size_t count) +#include + +size_t _wcsnlen(const wchar_t * s, size_t count) { unsigned int len=0; diff --git a/reactos/lib/crtdll/wchar/wcsrchr.c b/reactos/lib/crtdll/wchar/wcsrchr.c index 29067768a81..8568d9623a7 100644 --- a/reactos/lib/crtdll/wchar/wcsrchr.c +++ b/reactos/lib/crtdll/wchar/wcsrchr.c @@ -1,3 +1,5 @@ +#include + wchar_t* wcsrchr(const wchar_t* str, wchar_t ch) { diff --git a/reactos/lib/crtdll/wchar/wcsrev.c b/reactos/lib/crtdll/wchar/wcsrev.c index feaa2704a55..695f0deefdd 100644 --- a/reactos/lib/crtdll/wchar/wcsrev.c +++ b/reactos/lib/crtdll/wchar/wcsrev.c @@ -1,4 +1,6 @@ -wchar_t * wcsrev(wchar_t *s) +#include + +wchar_t * _wcsrev(wchar_t *s) { wchar_t *e; wchar_t a; diff --git a/reactos/lib/crtdll/wchar/wcsspn.c b/reactos/lib/crtdll/wchar/wcsspn.c index a125b034ea9..89d420aa3b3 100644 --- a/reactos/lib/crtdll/wchar/wcsspn.c +++ b/reactos/lib/crtdll/wchar/wcsspn.c @@ -1,4 +1,6 @@ -size_t wcsspn(const wchar_t *str,const wchar_t *accept) +#include + +size_t _wcsspn(const wchar_t *str,const wchar_t *accept) { wchar_t *s; wchar_t *t; diff --git a/reactos/lib/crtdll/wchar/wcsstr.c b/reactos/lib/crtdll/wchar/wcsstr.c index 6bab79315ab..ebe638f4dd0 100644 --- a/reactos/lib/crtdll/wchar/wcsstr.c +++ b/reactos/lib/crtdll/wchar/wcsstr.c @@ -1,3 +1,5 @@ +#include + wchar_t *wcsstr(const wchar_t *s,const wchar_t *b) { wchar_t *x; diff --git a/reactos/lib/crtdll/wchar/wcstok.c b/reactos/lib/crtdll/wchar/wcstok.c index ed49ad48ab3..3afd7174d03 100644 --- a/reactos/lib/crtdll/wchar/wcstok.c +++ b/reactos/lib/crtdll/wchar/wcstok.c @@ -1,3 +1,5 @@ +#include + wchar_t *wcstok(wchar_t *s, const wchar_t *ct) { const wchar_t *spanp; diff --git a/reactos/lib/crtdll/wchar/wcstol.c b/reactos/lib/crtdll/wchar/wcstol.c index 00241360606..1c399763a62 100644 --- a/reactos/lib/crtdll/wchar/wcstol.c +++ b/reactos/lib/crtdll/wchar/wcstol.c @@ -1,3 +1,38 @@ +#include + + +long wcstol(const wchar_t *cp,wchar_t **endp,unsigned int base) +{ + long result = 0,value; + int sign = 1; + + if ( *cp == L'-' ) { + sign = -1; + *cp++; + } + + if (!base) { + base = 10; + if (*cp == L'0') { + base = 8; + cp++; + if ((*cp == L'x') && iswxdigit(cp[1])) { + cp++; + base = 16; + } + } + } + while (iswxdigit(*cp) && (value = iswdigit(*cp) ? *cp-L'0' : (iswlower(*cp) + ? towupper(*cp) : *cp)-L'A'+10) < base) { + result = result*base + value; + cp++; + } + if (endp) + *endp = (wchar_t *)cp; + return result * sign; +} + + unsigned long wcstoul(const wchar_t *cp,wchar_t **endp,unsigned int base) { unsigned long result = 0,value; diff --git a/reactos/lib/crtdll/wchar/wcsupr.c b/reactos/lib/crtdll/wchar/wcsupr.c index bb19f26ff82..438b5a96320 100644 --- a/reactos/lib/crtdll/wchar/wcsupr.c +++ b/reactos/lib/crtdll/wchar/wcsupr.c @@ -1,4 +1,6 @@ -wchar_t *wcsupr(wchar_t *x) +#include + +wchar_t *_wcsupr(wchar_t *x) { wchar_t *y=x; diff --git a/reactos/lib/crtdll/wchar/wcsxfrm.c b/reactos/lib/crtdll/wchar/wcsxfrm.c new file mode 100644 index 00000000000..f86a2b8712d --- /dev/null +++ b/reactos/lib/crtdll/wchar/wcsxfrm.c @@ -0,0 +1,6 @@ +#include + +size_t wcsxfrm( wchar_t *str1, const wchar_t *str2, size_t len ) +{ + return 0; +} \ No newline at end of file