From 5514f345a394ecfbe93e93b42e5babe856d66091 Mon Sep 17 00:00:00 2001 From: "KJK::Hyperion" Date: Sun, 6 Jul 2003 23:04:19 +0000 Subject: [PATCH] - apps/utils/tickcount/tickcount.c: corrected assertion - include/funcs.h: declared GetScrollBarInfo - include/napi/teb.h: removed misleading comment about NtCurrentTeb; preparing TEB for Windows 2003-compatible FLS support - include/tchar.h: added _tcslen - include/tgetopt.h: type-generic getopt (see lib/tgetopt) - include/win32k/ntuser.h, subsys/win32k/ntuser/window.c, subsys/win32k/ntuser/timer.c, lib/user32/misc/timer.c, lib/user32/windows/paint.c: corrected declarations of NtUserSetTimer, NtUserKillTimer and NtUserRedrawWindow (Win32K doesn't follow the NT calling convention) - lib/crtdll/crtdll.def: exported ::operator new and ::operator delete - lib/kernel32/thread/fls.c: FLS support almost done - lib/ntdll/*: implemented _chkstk/_alloca_probe - some more Visual C++ programs should run now; exported NtCurrentTeb for compatibility with Windows NT 3.51 and some non-i386 architectures; removed the CRT from the linker libraries - lib/string/*: type-generic string functions (single, shared implementation for single-byte and Unicode variants using _t macros); corrected a bug in the i386 wcsncmp; merged strspn/strcspn; corrected non-portable code in strspn/strcspn; implemented strnlen/tcsnlen for the i386 architecture; all changes were regression-tested and compared against the Microsoft CRT - tools/helper.mk: libraries, dlls and drivers now depend from their DEF/EDF files svn path=/trunk/; revision=5010 --- reactos/apps/utils/tickcount/tickcount.c | 4 +- reactos/include/funcs.h | 7 +- reactos/include/napi/teb.h | 6 +- reactos/include/tchar.h | 6 +- reactos/include/tgetopt.h | 90 ++++++++++ reactos/include/win32k/ntuser.h | 36 ++-- reactos/lib/crtdll/crtdll.def | 8 +- reactos/lib/kernel32/thread/fls.c | 64 ++++++- reactos/lib/ntdll/def/ntdll.def | 3 +- reactos/lib/ntdll/def/ntdll.edf | 5 +- reactos/lib/ntdll/makefile | 6 +- reactos/lib/ntdll/rtl/i386/chkstk.s | 58 ++++++- reactos/lib/ntdll/rtl/teb.c | 14 ++ reactos/lib/string/Makefile.i386 | 4 +- reactos/lib/string/i386/strcat.s | 33 +--- reactos/lib/string/i386/strchr.s | 32 +--- reactos/lib/string/i386/strcmp.s | 36 +--- reactos/lib/string/i386/strcpy.s | 29 +--- reactos/lib/string/i386/strlen.s | 26 +-- reactos/lib/string/i386/strncat.s | 41 +---- reactos/lib/string/i386/strncmp.s | 40 +---- reactos/lib/string/i386/strncpy.s | 35 +--- reactos/lib/string/i386/strnlen.s | 6 + reactos/lib/string/i386/strrchr.s | 33 +--- reactos/lib/string/i386/tchar.h | 59 +++++++ reactos/lib/string/i386/tcscat.h | 32 ++++ reactos/lib/string/i386/tcschr.h | 30 ++++ reactos/lib/string/i386/tcscmp.h | 34 ++++ reactos/lib/string/i386/tcscpy.h | 27 +++ reactos/lib/string/i386/tcslen.h | 24 +++ reactos/lib/string/i386/tcsncat.h | 42 +++++ reactos/lib/string/i386/tcsncmp.h | 40 +++++ reactos/lib/string/i386/tcsncpy.h | 34 ++++ reactos/lib/string/i386/tcsnlen.h | 30 ++++ reactos/lib/string/i386/tcsrchr.h | 31 ++++ reactos/lib/string/i386/wcscat.s | 34 +--- reactos/lib/string/i386/wcschr.s | 35 +--- reactos/lib/string/i386/wcscmp.s | 37 +--- reactos/lib/string/i386/wcscpy.s | 31 +--- reactos/lib/string/i386/wcslen.s | 29 +--- reactos/lib/string/i386/wcsncat.s | 42 +---- reactos/lib/string/i386/wcsncmp.s | 41 +---- reactos/lib/string/i386/wcsncpy.s | 36 +--- reactos/lib/string/i386/wcsnlen.s | 7 + reactos/lib/string/i386/wcsrchr.s | 36 +--- reactos/lib/string/strcat.c | 13 +- reactos/lib/string/strchr.c | 20 +-- reactos/lib/string/strcmp.c | 16 +- reactos/lib/string/strcpy.c | 12 +- reactos/lib/string/strcspn.c | 27 +-- reactos/lib/string/strlen.c | 24 +-- reactos/lib/string/strncat.c | 24 +-- reactos/lib/string/strncmp.c | 19 +-- reactos/lib/string/strncpy.c | 26 +-- reactos/lib/string/strnlen.c | 15 +- reactos/lib/string/strrchr.c | 22 +-- reactos/lib/string/strspn.c | 26 +-- reactos/lib/string/strxspn.h | 24 +++ reactos/lib/string/tcscat.h | 17 ++ reactos/lib/string/tcschr.h | 22 +++ reactos/lib/string/tcscmp.h | 19 +++ reactos/lib/string/tcscpy.h | 13 ++ reactos/lib/string/tcslen.h | 18 ++ reactos/lib/string/tcsncat.h | 30 ++++ reactos/lib/string/tcsncmp.h | 21 +++ reactos/lib/string/tcsncpy.h | 28 ++++ reactos/lib/string/tcsnlen.h | 18 ++ reactos/lib/string/tcsrchr.h | 22 +++ reactos/lib/string/wcscat.c | 16 +- reactos/lib/string/wcschr.c | 23 +-- reactos/lib/string/wcscmp.c | 19 +-- reactos/lib/string/wcscpy.c | 15 +- reactos/lib/string/wcslen.c | 18 +- reactos/lib/string/wcsncat.c | 27 +-- reactos/lib/string/wcsncmp.c | 22 +-- reactos/lib/string/wcsncpy.c | 26 +-- reactos/lib/string/wcsnlen.c | 18 +- reactos/lib/string/wcsrchr.c | 25 +-- reactos/lib/user32/misc/timer.c | 31 +--- reactos/lib/user32/windows/paint.c | 12 +- reactos/subsys/win32k/ntuser/timer.c | 205 ++++++++++++----------- reactos/subsys/win32k/ntuser/window.c | 54 ++++-- reactos/tools/helper.mk | 16 +- 83 files changed, 1211 insertions(+), 1125 deletions(-) create mode 100644 reactos/include/tgetopt.h create mode 100644 reactos/lib/ntdll/rtl/teb.c create mode 100644 reactos/lib/string/i386/strnlen.s create mode 100644 reactos/lib/string/i386/tchar.h create mode 100644 reactos/lib/string/i386/tcscat.h create mode 100644 reactos/lib/string/i386/tcschr.h create mode 100644 reactos/lib/string/i386/tcscmp.h create mode 100644 reactos/lib/string/i386/tcscpy.h create mode 100644 reactos/lib/string/i386/tcslen.h create mode 100644 reactos/lib/string/i386/tcsncat.h create mode 100644 reactos/lib/string/i386/tcsncmp.h create mode 100644 reactos/lib/string/i386/tcsncpy.h create mode 100644 reactos/lib/string/i386/tcsnlen.h create mode 100644 reactos/lib/string/i386/tcsrchr.h create mode 100644 reactos/lib/string/i386/wcsnlen.s create mode 100644 reactos/lib/string/strxspn.h create mode 100644 reactos/lib/string/tcscat.h create mode 100644 reactos/lib/string/tcschr.h create mode 100644 reactos/lib/string/tcscmp.h create mode 100644 reactos/lib/string/tcscpy.h create mode 100644 reactos/lib/string/tcslen.h create mode 100644 reactos/lib/string/tcsncat.h create mode 100644 reactos/lib/string/tcsncmp.h create mode 100644 reactos/lib/string/tcsncpy.h create mode 100644 reactos/lib/string/tcsnlen.h create mode 100644 reactos/lib/string/tcsrchr.h diff --git a/reactos/apps/utils/tickcount/tickcount.c b/reactos/apps/utils/tickcount/tickcount.c index 2cf4940d231..e0011fb3b47 100644 --- a/reactos/apps/utils/tickcount/tickcount.c +++ b/reactos/apps/utils/tickcount/tickcount.c @@ -1,4 +1,4 @@ -/* $Id: tickcount.c,v 1.1 2003/02/09 21:17:21 hyperion Exp $ +/* $Id: tickcount.c,v 1.2 2003/07/06 23:04:18 hyperion Exp $ */ /* tickcount -- Display the kernel tick count in human-readable format @@ -71,7 +71,7 @@ void print_uptime uint64_t tick_cur = tickcount / ticks_per_slice[curslice]; uint64_t tick_residual = tickcount % ticks_per_slice[curslice]; - assert(tick_cur <= (~((unsigned)0))); + assert(tick_cur <= (~((uint64_t)0))); if(tick_residual == 0) { diff --git a/reactos/include/funcs.h b/reactos/include/funcs.h index 1149410b286..6485a31c42e 100644 --- a/reactos/include/funcs.h +++ b/reactos/include/funcs.h @@ -4935,7 +4935,12 @@ EnableScrollBar( UINT wSBflags, UINT wArrows); - +BOOL STDCALL GetScrollBarInfo( + HWND hwnd, + LONG idObject, + PSCROLLBARINFO psbi +); + WINBOOL STDCALL GetClientRect( diff --git a/reactos/include/napi/teb.h b/reactos/include/napi/teb.h index fa062d21687..71bffb3cc3f 100644 --- a/reactos/include/napi/teb.h +++ b/reactos/include/napi/teb.h @@ -227,6 +227,8 @@ typedef struct _TEB ULONG Spare5; // F7Ch PVOID ReservedForOle; // F80h ULONG WaitingOnLoaderLock; // F84h + ULONG Unknown[11]; // F88h + PVOID FlsSlots; // FB4h PVOID WineDebugInfo; // Needed for WINE DLL's } TEB, *PTEB; @@ -236,10 +238,6 @@ typedef struct _TEB #if defined(_M_IX86) /* on the x86, the TEB is contained in the FS segment */ -/* - FIXME: GCC should allow defining a variable that directly maps to a register. - It could make for even faster code -*/ static inline struct _TEB * NtCurrentTeb(void) { struct _TEB * pTeb; diff --git a/reactos/include/tchar.h b/reactos/include/tchar.h index c765cc52605..c2c90ec3499 100644 --- a/reactos/include/tchar.h +++ b/reactos/include/tchar.h @@ -29,9 +29,9 @@ * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * $Author: hyperion $ - * $Date: 2003/04/22 03:20:25 $ + * $Date: 2003/07/06 23:04:18 $ * */ @@ -114,6 +114,7 @@ typedef wchar_t TCHAR; #define _tcsncat wcsncat #define _tcsncmp wcsncmp #define _tcsncpy wcsncpy +#define _tcsnlen wcsnlen #define _tcspbrk wcspbrk #define _tcsrchr wcsrchr #define _tcsspn wcsspn @@ -218,6 +219,7 @@ typedef char TCHAR; #define _tcsncat strncat #define _tcsncmp strncmp #define _tcsncpy strncpy +#define _tcsnlen strnlen #define _tcspbrk strpbrk #define _tcsrchr strrchr #define _tcsspn strspn diff --git a/reactos/include/tgetopt.h b/reactos/include/tgetopt.h new file mode 100644 index 00000000000..3b829a7cda0 --- /dev/null +++ b/reactos/include/tgetopt.h @@ -0,0 +1,90 @@ +#ifndef _GETOPT_H +#define _GETOPT_H 1 + +#include + +#ifdef _UNICODE +#define _toption _woption +#define _toptarg _woptarg +#define _toptind _woptind +#define _topterr _wopterr +#define _toptopt _woptopt +#define _tgetopt _wgetopt +#define _tgetopt_long _wgetopt_long +#define _tgetopt_long_only _wgetopt_long_only +#define _tgetopt_internal _wgetopt_internal +#else +#define _toption option +#define _toptarg optarg +#define _toptind optind +#define _topterr opterr +#define _toptopt optopt +#define _tgetopt getopt +#define _tgetopt_long getopt_long +#define _tgetopt_long_only getopt_long_only +#define _tgetopt_internal _getopt_internal +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif + +extern char *optarg; +extern int optind; + extern int opterr; +extern int optopt; + +extern wchar_t *_woptarg; + extern int _woptind; +extern int _wopterr; +extern int _woptopt; + +struct option +{ + const char *name; + int has_arg; + int *flag; + int val; +}; + +struct _woption +{ + const wchar_t *name; + int has_arg; + int *flag; + int val; +}; + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +extern int getopt (int argc, char *const *argv, const char *shortopts); +extern int getopt_long (int argc, char *const *argv, const char *shortopts, + const struct option *longopts, int *longind); +extern int getopt_long_only (int argc, char *const *argv, + const char *shortopts, const struct option *longopts, int *longind); + +extern int _wgetopt (int argc, wchar_t *const *argv, const wchar_t *shortopts); +extern int _wgetopt_long (int argc, wchar_t *const *argv, const wchar_t *shortopts, + const struct _woption *longopts, int *longind); +extern int _wgetopt_long_only (int argc, wchar_t *const *argv, + const wchar_t *shortopts, + const struct _woption *longopts, int *longind); + +extern int _getopt_internal (int argc, char *const *argv, + const char *shortopts, const struct option *longopts, int *longind, + int long_only); + +extern int _wgetopt_internal (int argc, wchar_t *const *argv, + const wchar_t *shortopts, + const struct _woption *longopts, int *longind, + int long_only); + +#ifdef __cplusplus + } +#endif + +#endif /* _GETOPT_H */ + diff --git a/reactos/include/win32k/ntuser.h b/reactos/include/win32k/ntuser.h index 5b44e5e66f2..f048b5ecb31 100644 --- a/reactos/include/win32k/ntuser.h +++ b/reactos/include/win32k/ntuser.h @@ -906,11 +906,13 @@ STDCALL NtUserIsClipboardFormatAvailable( DWORD Unknown0); -NTSTATUS +BOOL STDCALL -NtUserKillTimer( - HWND hWnd, - UINT_PTR IDEvent); +NtUserKillTimer +( + HWND hWnd, + UINT_PTR uIDEvent +); DWORD STDCALL @@ -1095,9 +1097,15 @@ NtUserRealChildWindowFromPoint( DWORD Unknown1, DWORD Unknown2); -NTSTATUS STDCALL -NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags); - +BOOL +STDCALL +NtUserRedrawWindow +( + HWND hWnd, + CONST RECT *lprcUpdate, + HRGN hrgnUpdate, + UINT flags +); RTL_ATOM STDCALL @@ -1422,13 +1430,15 @@ NtUserSetThreadState( DWORD Unknown0, DWORD Unknown1); -NTSTATUS +UINT_PTR STDCALL -NtUserSetTimer( - HWND hWnd, - UINT_PTR * IDEvent, - UINT Period, - TIMERPROC TimerFunc); +NtUserSetTimer +( + HWND hWnd, + UINT_PTR nIDEvent, + UINT uElapse, + TIMERPROC lpTimerFunc +); DWORD STDCALL diff --git a/reactos/lib/crtdll/crtdll.def b/reactos/lib/crtdll/crtdll.def index 8f678397e93..937bca25bf9 100644 --- a/reactos/lib/crtdll/crtdll.def +++ b/reactos/lib/crtdll/crtdll.def @@ -19,9 +19,9 @@ ; DISCLAMED. This includes but is not limited to warrenties of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ; -; $Revision: 1.15 $ -; $Author: gvg $ -; $Date: 2003/04/24 22:21:13 $ +; $Revision: 1.16 $ +; $Author: hyperion $ +; $Date: 2003/07/06 23:04:19 $ ; ; 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. @@ -41,6 +41,8 @@ LIBRARY CRTDLL.DLL EXPORTS __builtin_new __builtin_delete +??2@YAPAXI@Z=malloc +??3@YAXPAX@Z=free _set_new_handler__FPFUi_i _CIacos _CIasin diff --git a/reactos/lib/kernel32/thread/fls.c b/reactos/lib/kernel32/thread/fls.c index bc2ee10ce2b..7d1911e7c54 100644 --- a/reactos/lib/kernel32/thread/fls.c +++ b/reactos/lib/kernel32/thread/fls.c @@ -1,4 +1,4 @@ -/* $Id: fls.c,v 1.1 2003/05/29 00:36:41 hyperion Exp $ +/* $Id: fls.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -35,20 +35,68 @@ BOOL WINAPI FlsFree(DWORD dwFlsIndex) PVOID WINAPI FlsGetValue(DWORD dwFlsIndex) { - (void)dwFlsIndex; + PVOID * ppFlsSlots; + PVOID pRetVal; + + if(dwFlsIndex >= 128) goto l_InvalidParam; - UNIMPLEMENTED; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + ppFlsSlots = NtCurrentTeb()->FlsSlots; + + if(ppFlsSlots == NULL) goto l_InvalidParam; + + SetLastError(0); + pRetVal = ppFlsSlots[dwFlsIndex + 2]; + + return pRetVal; + +l_InvalidParam: + SetLastError(ERROR_INVALID_PARAMETER); return NULL; } BOOL WINAPI FlsSetValue(DWORD dwFlsIndex, PVOID lpFlsData) { - (void)dwFlsIndex; - (void)lpFlsData; + PVOID * ppFlsSlots; + TEB * pTeb = NtCurrentTeb(); - UNIMPLEMENTED; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + if(dwFlsIndex >= 128) goto l_InvalidParam; + + ppFlsSlots = pTeb->FlsSlots; + + if(ppFlsSlots == NULL) + { + PEB * pPeb = pTeb->Peb; + + ppFlsSlots = RtlAllocateHeap + ( + pPeb->ProcessHeap, + HEAP_ZERO_MEMORY, + (128 + 2) * sizeof(PVOID) + ); + + if(ppFlsSlots == NULL) goto l_OutOfMemory; + + pTeb->FlsSlots = ppFlsSlots; + + RtlAcquirePebLock(); + + /* TODO: initialization */ + + RtlReleasePebLock(); + } + + ppFlsSlots[dwFlsIndex + 2] = lpFlsData; + + return TRUE; + +l_OutOfMemory: + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + goto l_Fail; + +l_InvalidParam: + SetLastError(ERROR_INVALID_PARAMETER); + +l_Fail: return FALSE; } diff --git a/reactos/lib/ntdll/def/ntdll.def b/reactos/lib/ntdll/def/ntdll.def index 2223ff621e2..bb531a01a75 100644 --- a/reactos/lib/ntdll/def/ntdll.def +++ b/reactos/lib/ntdll/def/ntdll.def @@ -1,4 +1,4 @@ -; $Id: ntdll.def,v 1.103 2003/06/11 15:38:36 ekohl Exp $ +; $Id: ntdll.def,v 1.104 2003/07/06 23:04:19 hyperion Exp $ ; ; ReactOS Operating System ; @@ -950,4 +950,5 @@ InterlockedIncrement@4 InterlockedDecrement@4 InterlockedExchange@8 InterlockedCompareExchange@12 +_NtCurrentTeb@0 ;EOF diff --git a/reactos/lib/ntdll/def/ntdll.edf b/reactos/lib/ntdll/def/ntdll.edf index 5fe0f5e2082..1bd2a61b2bb 100644 --- a/reactos/lib/ntdll/def/ntdll.edf +++ b/reactos/lib/ntdll/def/ntdll.edf @@ -1,4 +1,4 @@ -; $Id: ntdll.edf,v 1.92 2003/06/11 15:38:36 ekohl Exp $ +; $Id: ntdll.edf,v 1.93 2003/07/06 23:04:19 hyperion Exp $ ; ; ReactOS Operating System ; @@ -830,7 +830,7 @@ __iscsymf __toascii _alldiv _allmul -_alloca_probe = _chkstk +_alloca_probe _allrem _allshl _allshr @@ -943,6 +943,7 @@ wcsstr wcstol wcstombs wcstoul +NtCurrentTeb=_NtCurrentTeb@0 ;wine_dbgstr_an ;wine_dbgstr_wn ;wine_dbgstr_guid diff --git a/reactos/lib/ntdll/makefile b/reactos/lib/ntdll/makefile index bdae5ae4d65..b9d26246e41 100644 --- a/reactos/lib/ntdll/makefile +++ b/reactos/lib/ntdll/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.87 2003/06/11 15:42:31 ekohl Exp $ +# $Id: makefile,v 1.88 2003/07/06 23:04:19 hyperion Exp $ PATH_TO_TOP = ../.. @@ -14,7 +14,7 @@ TARGET_ASFLAGS = -I $(PATH_TO_TOP)/include TARGET_LFLAGS = -Wl,--file-alignment,0x1000 \ -Wl,--section-alignment,0x1000 \ - -nostartfiles + -nostartfiles -nostdlib TARGET_SDKLIBS = string.a rosrtl.a @@ -59,7 +59,7 @@ RTL_OBJECTS = rtl/critical.o rtl/error.o rtl/heap.o rtl/largeint.o \ rtl/registry.o rtl/exception.o rtl/intrlck.o rtl/resource.o \ rtl/handle.o rtl/atom.o rtl/message.o rtl/timezone.o \ rtl/propvar.o rtl/security.o rtl/dos8dot3.o rtl/compress.o \ - rtl/encode.o rtl/random.o + rtl/encode.o rtl/random.o rtl/teb.o STDIO_OBJECTS = stdio/sprintf.o stdio/swprintf.o diff --git a/reactos/lib/ntdll/rtl/i386/chkstk.s b/reactos/lib/ntdll/rtl/i386/chkstk.s index 5d0781aef03..a71995496e5 100644 --- a/reactos/lib/ntdll/rtl/i386/chkstk.s +++ b/reactos/lib/ntdll/rtl/i386/chkstk.s @@ -1,16 +1,66 @@ -/* $Id: chkstk.s,v 1.1 2003/06/11 15:37:15 ekohl Exp $ +/* $Id: chkstk.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * PURPOSE: Stack checker * FILE: lib/ntdll/rtl/i386/chkstk.s - * PROGRAMER: Eric Kohl (ekohl@rz-online.de) + * PROGRAMER: KJK::Hyperion */ +.globl __chkstk +.globl __alloca_probe + /* + _chkstk() is called by all stack allocations of more than 4 KB. It grows the + stack in areas of 4 KB each, trying to access each area. This ensures that the + guard page for the stack is hit, and the stack growing triggered */ -.globl __chkstk __chkstk: - ret +__alloca_probe: + +/* EAX = size to be allocated */ +/* save the ECX register */ + pushl %ecx + +/* ECX = top of the previous stack frame */ + leal 8(%esp), %ecx + +/* probe the desired memory, page by page */ + cmpl $0x1000, %eax + jge .l_MoreThanAPage + jmp .l_LessThanAPage + +.l_MoreThanAPage: + +/* raise the top of the stack by a page and probe */ + subl $0x1000, %ecx + testl %eax, 0(%ecx) + +/* loop if still more than a page must be probed */ + subl $0x1000, %eax + cmpl $0x1000, %eax + jge .l_MoreThanAPage + +.l_LessThanAPage: + +/* raise the top of the stack by EAX bytes (size % 4096) and probe */ + subl %eax, %ecx + testl %eax, 0(%ecx) + +/* EAX = top of the stack */ + movl %esp, %eax + +/* allocate the memory */ + movl %ecx, %esp + +/* restore ECX */ + movl 0(%eax), %ecx + +/* restore the return address */ + movl 4(%eax), %eax + pushl %eax + +/* return */ + ret /* EOF */ diff --git a/reactos/lib/ntdll/rtl/teb.c b/reactos/lib/ntdll/rtl/teb.c new file mode 100644 index 00000000000..94f8bad0751 --- /dev/null +++ b/reactos/lib/ntdll/rtl/teb.c @@ -0,0 +1,14 @@ +/* $Id: teb.c,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: lib/ntdll/csr/teb.c + * PURPOSE: + */ + +#include +#include + +PTEB STDCALL _NtCurrentTeb() { return NtCurrentTeb(); } + +/* EOF */ diff --git a/reactos/lib/string/Makefile.i386 b/reactos/lib/string/Makefile.i386 index cc07036105b..e95934bd28b 100644 --- a/reactos/lib/string/Makefile.i386 +++ b/reactos/lib/string/Makefile.i386 @@ -1,4 +1,4 @@ -# $Id: Makefile.i386,v 1.2 2003/06/04 18:14:46 hbirr Exp $ +# $Id: Makefile.i386,v 1.3 2003/07/06 23:04:19 hyperion Exp $ EXCLUDE_FILTER = \ @@ -15,6 +15,7 @@ EXCLUDE_FILTER = \ strncmp.o \ strncpy.o \ strrchr.o \ + strnlen.o \ wcscat.o \ wcschr.o \ wcscmp.o \ @@ -23,6 +24,7 @@ EXCLUDE_FILTER = \ wcsncat.o \ wcsncmp.o \ wcsncpy.o \ + wcsnlen.o \ wcsrchr.o diff --git a/reactos/lib/string/i386/strcat.s b/reactos/lib/string/i386/strcat.s index 3aca226fe95..bc203f99014 100644 --- a/reactos/lib/string/i386/strcat.s +++ b/reactos/lib/string/i386/strcat.s @@ -1,33 +1,6 @@ -/* - * $Id: strcat.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ +/* $Id: strcat.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -/* - * char *strcat (char *s, const char *append) - */ - -.globl _strcat - -_strcat: - push %ebp - mov %esp,%ebp - push %esi - push %edi - mov 0x8(%ebp),%edi - mov 0xc(%ebp),%esi - xor %eax,%eax - mov $-1,%ecx - cld - repne scasb - dec %edi -.L1: - lodsb - stosb - test %al,%al - jne .L1 - mov 0x8(%ebp),%eax - pop %edi - pop %esi - leave - ret +#include "tcscat.h" +/* EOF */ diff --git a/reactos/lib/string/i386/strchr.s b/reactos/lib/string/i386/strchr.s index 5c1a45d3e44..57a9282efe5 100644 --- a/reactos/lib/string/i386/strchr.s +++ b/reactos/lib/string/i386/strchr.s @@ -1,32 +1,6 @@ -/* - * $Id: strchr.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ +/* $Id: strchr.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -/* - * char* strchr (const char* s, int c) - */ - -.globl _strchr - -_strchr: - push %ebp - mov %esp,%ebp - push %esi - mov 0x8(%ebp),%esi - mov 0xc(%ebp),%eax - mov %al,%ah - cld -.L1: - lodsb - cmp %al,%ah - je .L2 - test %al,%al - jne .L1 - mov $1,%esi -.L2: - mov %esi,%eax - dec %eax - pop %esi - leave - ret +#include "tcschr.h" +/* EOF */ diff --git a/reactos/lib/string/i386/strcmp.s b/reactos/lib/string/i386/strcmp.s index 6facffbd9be..b97f5e7c606 100644 --- a/reactos/lib/string/i386/strcmp.s +++ b/reactos/lib/string/i386/strcmp.s @@ -1,36 +1,6 @@ -/* - * $Id: strcmp.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ +/* $Id: strcmp.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -/* - * int *strcmp (const char* s1, const char* s2) - */ - -.globl _strcmp - -_strcmp: - push %ebp - mov %esp,%ebp - push %esi - push %edi - mov 0x8(%ebp),%esi - mov 0xc(%ebp),%edi - xor %eax,%eax - cld -.L1: - lodsb - scasb - jne .L2 - test %eax,%eax // bit 8..31 are set to 0 - jne .L1 - xor %eax,%eax - jmp .L3 -.L2: - sbb %eax,%eax - or $1,%al -.L3: - pop %edi - pop %esi - leave - ret +#include "tcscmp.h" +/* EOF */ diff --git a/reactos/lib/string/i386/strcpy.s b/reactos/lib/string/i386/strcpy.s index 768990bff63..ea7f570d7af 100644 --- a/reactos/lib/string/i386/strcpy.s +++ b/reactos/lib/string/i386/strcpy.s @@ -1,29 +1,6 @@ -/* - * $Id: strcpy.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ +/* $Id: strcpy.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -/* - * char *strcpy (char *to, const char *from) - */ - -.globl _strcpy - -_strcpy: - push %ebp - mov %esp,%ebp - push %esi - push %edi - mov 0x8(%ebp),%edi - mov 0xc(%ebp),%esi - cld -.L1: - lodsb - stosb - test %al,%al - jne .L1 - mov 0x8(%ebp),%eax - pop %edi - pop %esi - leave - ret +#include "tcscpy.h" +/* EOF */ diff --git a/reactos/lib/string/i386/strlen.s b/reactos/lib/string/i386/strlen.s index 2351b3533f0..4fbbf621e51 100644 --- a/reactos/lib/string/i386/strlen.s +++ b/reactos/lib/string/i386/strlen.s @@ -1,26 +1,6 @@ -/* - * $Id: strlen.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ +/* $Id: strlen.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -/* - * size_t strlen (const char* s) - */ - -.globl _strlen - -_strlen: - push %ebp - mov %esp,%ebp - push %edi - mov 0x8(%ebp),%edi - xor %eax,%eax - mov $-1,%ecx - cld - repne scasb - not %ecx - dec %ecx - mov %ecx,%eax - pop %edi - leave - ret +#include "tcslen.h" +/* EOF */ diff --git a/reactos/lib/string/i386/strncat.s b/reactos/lib/string/i386/strncat.s index e68ac30a324..eeef75744f6 100644 --- a/reactos/lib/string/i386/strncat.s +++ b/reactos/lib/string/i386/strncat.s @@ -1,41 +1,6 @@ -/* - * $Id: strncat.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ +/* $Id: strncat.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -/* - * char *strncat (char *s, const char *append, size_t n) - */ - -.globl _strncat - -_strncat: - push %ebp - mov %esp,%ebp - push %esi - push %edi - mov 0x8(%ebp),%edi - mov 0xc(%ebp),%esi - xor %eax,%eax - mov $-1,%ecx - cld - repne scasb - dec %edi - mov 0x10(%ebp),%ecx -.L1: - dec %ecx - js .L2 - lodsb - stosb - test %al,%al - jne .L1 - jmp .L3 -.L2: - xor %eax,%eax - stosb -.L3: - mov 0x8(%ebp),%eax - pop %edi - pop %esi - leave - ret +#include "tcsncat.h" +/* EOF */ diff --git a/reactos/lib/string/i386/strncmp.s b/reactos/lib/string/i386/strncmp.s index 5d332f02d0a..9b32dd25608 100644 --- a/reactos/lib/string/i386/strncmp.s +++ b/reactos/lib/string/i386/strncmp.s @@ -1,40 +1,6 @@ -/* - * $Id: strncmp.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ +/* $Id: strncmp.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -/* - * int *strncmp (const char* s1, const char* s2, size_t n) - */ - -.globl _strncmp - -_strncmp: - push %ebp - mov %esp,%ebp - push %esi - push %edi - mov 0x8(%ebp),%esi // s1 - mov 0xc(%ebp),%edi // s2 - mov 0x10(%ebp),%ecx // n - xor %eax,%eax - cld -.L1: - dec %ecx - js .L2 - lodsb - scasb - jne .L3 - test %eax,%eax // bit 8..31 are set to 0 - jne .L1 -.L2: - xor %eax,%eax - jmp .L4 -.L3: - sbb %eax,%eax - or $1,%al -.L4: - pop %edi - pop %esi - leave - ret +#include "tcsncmp.h" +/* EOF */ diff --git a/reactos/lib/string/i386/strncpy.s b/reactos/lib/string/i386/strncpy.s index e221cc5f59b..772b6d0a7a3 100644 --- a/reactos/lib/string/i386/strncpy.s +++ b/reactos/lib/string/i386/strncpy.s @@ -1,35 +1,6 @@ -/* - * $Id: strncpy.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ +/* $Id: strncpy.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -/* - * char *strncpy (char *to, const char *from, size_t n) - */ - -.globl _strncpy - -_strncpy: - push %ebp - mov %esp,%ebp - push %esi - push %edi - mov 0x8(%ebp),%edi - mov 0xc(%ebp),%esi - mov 0x10(%ebp),%ecx - xor %eax,%eax - cld -.L1: - dec %ecx - js .L2 - lodsb - stosb - test %al,%al - jne .L1 - rep stosb -.L2: - mov 0x8(%ebp),%eax - pop %edi - pop %esi - leave - ret +#include "tcsncpy.h" +/* EOF */ diff --git a/reactos/lib/string/i386/strnlen.s b/reactos/lib/string/i386/strnlen.s new file mode 100644 index 00000000000..913bc6d5b7d --- /dev/null +++ b/reactos/lib/string/i386/strnlen.s @@ -0,0 +1,6 @@ +/* $Id: strnlen.s,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include "tcsnlen.h" + +/* EOF */ diff --git a/reactos/lib/string/i386/strrchr.s b/reactos/lib/string/i386/strrchr.s index 9d445ddb5cc..eea4cd3835a 100644 --- a/reactos/lib/string/i386/strrchr.s +++ b/reactos/lib/string/i386/strrchr.s @@ -1,33 +1,6 @@ -/* - * $Id: strrchr.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ +/* $Id: strrchr.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -/* - * char* strrchr (const char* s, int c) - */ - -.globl _strrchr - -_strrchr: - push %ebp - mov %esp,%ebp - push %esi - mov 0x8(%ebp),%esi - mov 0xc(%ebp),%eax - mov $1,%ecx - mov %al,%ah - cld -.L1: - lodsb - cmp %al,%ah - jne .L2 - mov %esi,%ecx -.L2: - test %al,%al - jne .L1 - mov %ecx,%eax - dec %eax - pop %esi - leave - ret +#include "tcsrchr.h" +/* EOF */ diff --git a/reactos/lib/string/i386/tchar.h b/reactos/lib/string/i386/tchar.h new file mode 100644 index 00000000000..9074b84522d --- /dev/null +++ b/reactos/lib/string/i386/tchar.h @@ -0,0 +1,59 @@ +/* $Id: tchar.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#ifndef __TCHAR_INC_S__ +#define __TCHAR_INC_S__ + +#ifdef _UNICODE + +#define _tcscat _wcscat +#define _tcschr _wcschr +#define _tcscmp _wcscmp +#define _tcscpy _wcscpy +#define _tcslen _wcslen +#define _tcsncat _wcsncat +#define _tcsncmp _wcsncmp +#define _tcsncpy _wcsncpy +#define _tcsnlen _wcsnlen +#define _tcsrchr _wcsrchr + +#define _tscas scasw +#define _tlods lodsw +#define _tstos stosw + +#define _tsize $2 + +#define _treg(_O_) _O_ ## x + +#define _tdec(_O_) sub $2, _O_ +#define _tinc(_O_) add $2, _O_ + +#else + +#define _tcscat _strcat +#define _tcschr _strchr +#define _tcscmp _strcmp +#define _tcscpy _strcpy +#define _tcslen _strlen +#define _tcsncat _strncat +#define _tcsncmp _strncmp +#define _tcsncpy _strncpy +#define _tcsnlen _strnlen +#define _tcsrchr _strrchr + +#define _tscas scasb +#define _tlods lodsb +#define _tstos stosb + +#define _tsize $1 + +#define _treg(_O_) _O_ ## l + +#define _tdec(_O_) dec _O_ +#define _tinc(_O_) inc _O_ + +#endif + +#endif + +/* EOF */ diff --git a/reactos/lib/string/i386/tcscat.h b/reactos/lib/string/i386/tcscat.h new file mode 100644 index 00000000000..b68d576fb6b --- /dev/null +++ b/reactos/lib/string/i386/tcscat.h @@ -0,0 +1,32 @@ +/* $Id: tcscat.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include "tchar.h" + +.globl _tcscat + +_tcscat: + push %esi + push %edi + mov 0x0C(%esp), %edi + mov 0x10(%esp), %esi + + xor %eax, %eax + mov $-1, %ecx + cld + + repne _tscas + _tdec(%edi) + +.L1: + _tlods + _tstos + test %_treg(a), %_treg(a) + jnz .L1 + + mov 0x0C(%esp), %eax + pop %edi + pop %esi + ret + +/* EOF */ diff --git a/reactos/lib/string/i386/tcschr.h b/reactos/lib/string/i386/tcschr.h new file mode 100644 index 00000000000..66105f340a6 --- /dev/null +++ b/reactos/lib/string/i386/tcschr.h @@ -0,0 +1,30 @@ +/* $Id: tcschr.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include "tchar.h" + +.globl _tcschr + +_tcschr: + push %esi + mov 0x8(%esp), %esi + mov 0xC(%esp), %edx + + cld + +.L1: + _tlods + cmp %_treg(a), %_treg(d) + je .L2 + test %_treg(a), %_treg(a) + jnz .L1 + mov _tsize, %esi + +.L2: + mov %esi, %eax + _tdec(%eax) + + pop %esi + ret + +/* EOF */ diff --git a/reactos/lib/string/i386/tcscmp.h b/reactos/lib/string/i386/tcscmp.h new file mode 100644 index 00000000000..f0d9552574e --- /dev/null +++ b/reactos/lib/string/i386/tcscmp.h @@ -0,0 +1,34 @@ +/* $Id: tcscmp.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include "tchar.h" + +.globl _tcscmp + +_tcscmp: + push %esi + push %edi + mov 0x0C(%esp), %esi + mov 0x10(%esp), %edi + xor %eax, %eax + cld + +.L1: + _tlods + _tscas + jne .L2 + test %eax, %eax + jne .L1 + xor %eax, %eax + jmp .L3 + +.L2: + sbb %eax, %eax + or $1, %al + +.L3: + pop %edi + pop %esi + ret + +/* EOF */ diff --git a/reactos/lib/string/i386/tcscpy.h b/reactos/lib/string/i386/tcscpy.h new file mode 100644 index 00000000000..8319bf41957 --- /dev/null +++ b/reactos/lib/string/i386/tcscpy.h @@ -0,0 +1,27 @@ +/* $Id: tcscpy.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include "tchar.h" + +.globl _tcscpy + +_tcscpy: + push %esi + push %edi + mov 0x0C(%esp), %edi + mov 0x10(%esp), %esi + cld + +.L1: + _tlods + _tstos + test %_treg(a), %_treg(a) + jnz .L1 + + mov 0x0C(%esp), %eax + + pop %edi + pop %esi + ret + +/* EOF */ diff --git a/reactos/lib/string/i386/tcslen.h b/reactos/lib/string/i386/tcslen.h new file mode 100644 index 00000000000..7f4d73fcff8 --- /dev/null +++ b/reactos/lib/string/i386/tcslen.h @@ -0,0 +1,24 @@ +/* $Id: tcslen.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ +*/ + +#include "tchar.h" + +.globl _tcslen + +_tcslen: + push %edi + mov 0x8(%esp), %edi + xor %eax, %eax + mov $-1, %ecx + cld + + repne _tscas + + not %ecx + dec %ecx + + mov %ecx, %eax + pop %edi + ret + +/* EOF */ diff --git a/reactos/lib/string/i386/tcsncat.h b/reactos/lib/string/i386/tcsncat.h new file mode 100644 index 00000000000..b82fad2ba90 --- /dev/null +++ b/reactos/lib/string/i386/tcsncat.h @@ -0,0 +1,42 @@ +/* $Id: tcsncat.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include "tchar.h" + +.globl _tcsncat + +_tcsncat: + push %esi + push %edi + mov 0x0C(%esp), %edi + mov 0x10(%esp), %esi + cld + + xor %eax, %eax + mov $-1, %ecx + repne _tscas + _tdec(%edi) + + mov 0x14(%esp),%ecx + +.L1: + dec %ecx + js .L2 + _tlods + _tstos + test %_treg(a), %_treg(a) + jne .L1 + jmp .L3 + +.L2: + xor %eax, %eax + _tstos + +.L3: + mov 0x0C(%esp), %eax + pop %edi + pop %esi + + ret + +/* EOF */ diff --git a/reactos/lib/string/i386/tcsncmp.h b/reactos/lib/string/i386/tcsncmp.h new file mode 100644 index 00000000000..0ca1404c4c6 --- /dev/null +++ b/reactos/lib/string/i386/tcsncmp.h @@ -0,0 +1,40 @@ +/* $Id: tcsncmp.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include "tchar.h" + +.globl _tcsncmp + +_tcsncmp: + push %esi + push %edi + mov 0x0C(%esp), %esi /* s1 */ + mov 0x10(%esp), %edi /* s2 */ + mov 0x14(%esp), %ecx /* n */ + + xor %eax,%eax + cld + +.L1: + dec %ecx + js .L2 + _tlods + _tscas + jne .L3 + test %eax, %eax + jne .L1 + +.L2: + xor %eax, %eax + jmp .L4 + +.L3: + sbb %eax, %eax + or $1, %al + +.L4: + pop %edi + pop %esi + ret + +/* EOF */ diff --git a/reactos/lib/string/i386/tcsncpy.h b/reactos/lib/string/i386/tcsncpy.h new file mode 100644 index 00000000000..e5d1d59e4ec --- /dev/null +++ b/reactos/lib/string/i386/tcsncpy.h @@ -0,0 +1,34 @@ +/* $Id: tcsncpy.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include "tchar.h" + +.globl _tcsncpy + +_tcsncpy: + push %esi + push %edi + mov 0x0C(%esp), %edi /* s1 */ + mov 0x10(%esp), %esi /* s2 */ + mov 0x14(%esp), %ecx /* n */ + + xor %eax, %eax + cld + +.L1: + dec %ecx + js .L2 + _tlods + _tstos + test %_treg(a), %_treg(a) + jnz .L1 + rep _tstos + +.L2: + mov 0x0C(%esp), %eax + + pop %edi + pop %esi + ret + +/* EOF */ diff --git a/reactos/lib/string/i386/tcsnlen.h b/reactos/lib/string/i386/tcsnlen.h new file mode 100644 index 00000000000..3c3a4f9ed56 --- /dev/null +++ b/reactos/lib/string/i386/tcsnlen.h @@ -0,0 +1,30 @@ +/* $Id: tcsnlen.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ +*/ + +#include "tchar.h" + +.globl _tcsnlen + +_tcsnlen: + push %edi + mov 0x8(%esp), %edi + mov 0xC(%esp), %ecx + xor %eax, %eax + test %ecx, %ecx + jz .L1 + mov %ecx, %edx + + cld + + repne _tscas + + sete %al + sub %ecx, %edx + sub %eax, %edx + mov %edx, %eax + +.L1: + pop %edi + ret + +/* EOF */ diff --git a/reactos/lib/string/i386/tcsrchr.h b/reactos/lib/string/i386/tcsrchr.h new file mode 100644 index 00000000000..158a1a0050d --- /dev/null +++ b/reactos/lib/string/i386/tcsrchr.h @@ -0,0 +1,31 @@ +/* $Id: tcsrchr.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include "tchar.h" + +.globl _tcsrchr + +_tcsrchr: + push %esi + mov 0x8(%esp), %esi + mov 0xC(%esp), %edx + + cld + mov _tsize, %ecx + +.L1: + _tlods + cmp %_treg(a), %_treg(d) + jne .L2 + mov %esi, %ecx + +.L2: + test %_treg(a), %_treg(a) + jnz .L1 + + mov %ecx, %eax + _tdec(%eax) + pop %esi + ret + +/* EOF */ diff --git a/reactos/lib/string/i386/wcscat.s b/reactos/lib/string/i386/wcscat.s index 86387915956..0b1945531df 100644 --- a/reactos/lib/string/i386/wcscat.s +++ b/reactos/lib/string/i386/wcscat.s @@ -1,33 +1,7 @@ -/* - * $Id: wcscat.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ +/* $Id: wcscat.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -/* - * wchar_t *wcscat (wchar_t *dest, const wchar_t *append) - */ - -.globl _wcscat - -_wcscat: - push %ebp - mov %esp,%ebp - push %esi - push %edi - mov 0x8(%ebp),%edi - mov 0xc(%ebp),%esi - cld - xor %eax,%eax - mov $-1,%ecx - repne scasw - sub $2,%edi -.L1: - lodsw - stosw - test %ax,%ax - jne .L1 - mov 0x8(%ebp),%eax - pop %edi - pop %esi - leave - ret +#define _UNICODE +#include "tcscat.h" +/* EOF */ diff --git a/reactos/lib/string/i386/wcschr.s b/reactos/lib/string/i386/wcschr.s index 20f1d7298f5..9bb9af1e6f1 100644 --- a/reactos/lib/string/i386/wcschr.s +++ b/reactos/lib/string/i386/wcschr.s @@ -1,34 +1,7 @@ -/* - * $Id: wcschr.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ +/* $Id: wcschr.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -/* - * wchar_t *wcschr (const wchar_t* str, wchar_t ch) - */ - -.globl _wcschr - -_wcschr: - push %ebp - mov %esp,%ebp - push %esi - push %edx - mov 0x8(%ebp),%esi - mov 0xc(%ebp),%edx - cld -.L1: - lodsw - cmp %ax,%dx - je .L2 - test %ax,%ax - jne .L1 - mov $2,%esi -.L2: - mov %esi,%eax - sub $2,%eax - pop %edx - pop %esi - leave - ret - +#define _UNICODE +#include "tcschr.h" +/* EOF */ diff --git a/reactos/lib/string/i386/wcscmp.s b/reactos/lib/string/i386/wcscmp.s index 6b3845c57c6..1fce427874c 100644 --- a/reactos/lib/string/i386/wcscmp.s +++ b/reactos/lib/string/i386/wcscmp.s @@ -1,36 +1,7 @@ -/* - * $Id: wcscmp.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ +/* $Id: wcscmp.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -/* - * int wcscmp (const wchar_t* s1, const wchar_t* s2) - */ - -.globl _wcscmp - -_wcscmp: - push %ebp - mov %esp,%ebp - push %esi - push %edi - mov 0x8(%ebp),%esi - mov 0xc(%ebp),%edi - cld -.L1: - lodsw - scasw - jne .L2 - test %ax,%ax - jne .L1 - xor %eax,%eax - jmp .L3 -.L2: - sbb %eax,%eax - or $1,%al -.L3: - pop %edi - pop %esi - leave - ret - +#define _UNICODE +#include "tcscmp.h" +/* EOF */ diff --git a/reactos/lib/string/i386/wcscpy.s b/reactos/lib/string/i386/wcscpy.s index b691588a0c7..191cd717b12 100644 --- a/reactos/lib/string/i386/wcscpy.s +++ b/reactos/lib/string/i386/wcscpy.s @@ -1,30 +1,7 @@ -/* - * $Id: wcscpy.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ +/* $Id: wcscpy.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -/* - * wchar_t* wcscpy (wchar_t* to, const wchar_t* from) - */ - -.globl _wcscpy - -_wcscpy: - push %ebp - mov %esp,%ebp - push %esi - push %edi - mov 0x8(%ebp),%edi - mov 0xc(%ebp),%esi - cld -.L1: - lodsw - stosw - test %ax,%ax - jne .L1 - mov 0x8(%ebp),%eax - pop %edi - pop %esi - leave - ret - +#define _UNICODE +#include "tcscpy.h" +/* EOF */ diff --git a/reactos/lib/string/i386/wcslen.s b/reactos/lib/string/i386/wcslen.s index 03f8703ae94..b940b9b3380 100644 --- a/reactos/lib/string/i386/wcslen.s +++ b/reactos/lib/string/i386/wcslen.s @@ -1,28 +1,7 @@ -/* - * $Id: wcslen.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ +/* $Id: wcslen.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -/* - * size_t wcslen (const wchar_t* str) - */ - -.globl _wcslen - -_wcslen: - push %ebp - mov %esp,%ebp - push %edi - mov 0x8(%ebp),%edi - xor %eax,%eax - mov $-1,%ecx - cld - repne scasw - not %ecx - dec %ecx - mov %ecx,%eax - pop %edi - leave - ret - - +#define _UNICODE +#include "tcslen.h" +/* EOF */ diff --git a/reactos/lib/string/i386/wcsncat.s b/reactos/lib/string/i386/wcsncat.s index e20ddaf43bf..6522a565283 100644 --- a/reactos/lib/string/i386/wcsncat.s +++ b/reactos/lib/string/i386/wcsncat.s @@ -1,41 +1,7 @@ -/* - * $Id: wcsncat.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ +/* $Id: wcsncat.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -/* - * wchar_t *wcsncat (wchar_t *dest, const wchar_t *append, size_t n) - */ - -.globl _wcsncat - -_wcsncat: - push %ebp - mov %esp,%ebp - push %esi - push %edi - mov 0x8(%ebp),%edi - mov 0xc(%ebp),%esi - cld - xor %eax,%eax - mov $-1,%ecx - repne scasw - sub $2,%edi - mov 0x10(%ebp),%ecx -.L1: - dec %ecx - js .L2 - lodsw - stosw - test %ax,%ax - jne .L1 - jmp .L3 -.L2: - xor %eax,%eax - stosw -.L3: - mov 0x8(%ebp),%eax - pop %edi - pop %esi - leave - ret +#define _UNICODE +#include "tcsncat.h" +/* EOF */ diff --git a/reactos/lib/string/i386/wcsncmp.s b/reactos/lib/string/i386/wcsncmp.s index 3bf7f8e43a8..c348cd41a4e 100644 --- a/reactos/lib/string/i386/wcsncmp.s +++ b/reactos/lib/string/i386/wcsncmp.s @@ -1,40 +1,7 @@ -/* - * $Id: wcsncmp.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ +/* $Id: wcsncmp.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -/* - * int wcsncmp (const wchar_t* s1, const wchar_t* s2, size_t n) - */ - -.globl _wcsncmp - -_wcsncmp: - push %ebp - mov %esp,%ebp - push %esi - push %edi - mov 0x8(%ebp),%esi - mov 0xc(%ebp),%edi - mov 0xc(%ebp),%ecx - cld -.L1: - dec %ecx - js .L2 - lodsw - scasw - jne .L3 - test %ax,%ax - jne .L1 -.L2: - xor %eax,%eax - jmp .L4 -.L3: - sbb %eax,%eax - or $1,%al -.L4: - pop %edi - pop %esi - leave - ret - +#define _UNICODE +#include "tcsncmp.h" +/* EOF */ diff --git a/reactos/lib/string/i386/wcsncpy.s b/reactos/lib/string/i386/wcsncpy.s index 834516ffc83..b8326e52a8b 100644 --- a/reactos/lib/string/i386/wcsncpy.s +++ b/reactos/lib/string/i386/wcsncpy.s @@ -1,35 +1,7 @@ -/* - * $Id: wcsncpy.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ +/* $Id: wcsncpy.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -/* - * wchar_t* wcsncpy (wchar_t* to, const wchar_t* from) - */ - -.globl _wcsncpy - -_wcsncpy: - push %ebp - mov %esp,%ebp - push %esi - push %edi - mov 0x8(%ebp),%edi - mov 0xc(%ebp),%esi - mov 0x10(%ebp),%ecx - cld -.L1: - dec %ecx - js .L2 - lodsw - stosw - test %ax,%ax - jne .L1 - rep stosw -.L2: - mov 0x8(%ebp),%eax - pop %edi - pop %esi - leave - ret - +#define _UNICODE +#include "tcsncpy.h" +/* EOF */ diff --git a/reactos/lib/string/i386/wcsnlen.s b/reactos/lib/string/i386/wcsnlen.s new file mode 100644 index 00000000000..1c7fbf6120e --- /dev/null +++ b/reactos/lib/string/i386/wcsnlen.s @@ -0,0 +1,7 @@ +/* $Id: wcsnlen.s,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#define _UNICODE +#include "tcsnlen.h" + +/* EOF */ diff --git a/reactos/lib/string/i386/wcsrchr.s b/reactos/lib/string/i386/wcsrchr.s index dda597f95a7..c0f32f5e1ce 100644 --- a/reactos/lib/string/i386/wcsrchr.s +++ b/reactos/lib/string/i386/wcsrchr.s @@ -1,35 +1,7 @@ -/* - * $Id: wcsrchr.s,v 1.1 2003/05/27 18:58:15 hbirr Exp $ +/* $Id: wcsrchr.s,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -/* - * wchar_t *wcsrchr (const wchar_t* str, wchar_t ch) - */ - -.globl _wcsrchr - -_wcsrchr: - push %ebp - mov %esp,%ebp - push %esi - push %edx - mov 0x8(%ebp),%esi - mov 0xc(%ebp),%edx - mov $2,%ecx - cld -.L1: - lodsw - cmp %ax,%dx - jne .L2 - mov %esi,%ecx -.L2: - test %ax,%ax - jne .L1 - mov %ecx,%eax - sub $2,%eax - pop %edx - pop %esi - leave - ret - +#define _UNICODE +#include "tcsrchr.h" +/* EOF */ diff --git a/reactos/lib/string/strcat.c b/reactos/lib/string/strcat.c index f47841e30f3..48bd06ca48e 100644 --- a/reactos/lib/string/strcat.c +++ b/reactos/lib/string/strcat.c @@ -1,14 +1,7 @@ -/* - * $Id: strcat.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: strcat.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ #include +#include "tcscat.h" -char* strcat(char* s, const char* append) -{ - char* save = s; - - for (; *s; ++s); - while ((*s++ = *append++)); - return save; -} +/* EOF */ diff --git a/reactos/lib/string/strchr.c b/reactos/lib/string/strchr.c index c4d446465d0..f00a06719d6 100644 --- a/reactos/lib/string/strchr.c +++ b/reactos/lib/string/strchr.c @@ -1,20 +1,8 @@ -/* - * $Id: strchr.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: strchr.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ +#define _XINT int #include +#include "tcschr.h" -char *strchr(const char *s, int c) -{ - char cc = c; - while (*s) - { - if (*s == cc) - return (char *)s; - s++; - } - if (cc == 0) - return (char *)s; - return 0; -} - +/* EOF */ diff --git a/reactos/lib/string/strcmp.c b/reactos/lib/string/strcmp.c index e6f566aeb82..01d14599af4 100644 --- a/reactos/lib/string/strcmp.c +++ b/reactos/lib/string/strcmp.c @@ -1,17 +1,7 @@ -/* - * $Id: strcmp.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: strcmp.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ #include +#include "tcscmp.h" -int strcmp(const char* s1, const char* s2) -{ - while (*s1 == *s2) - { - if (*s1 == 0) - return 0; - s1++; - s2++; - } - return *(unsigned const char*)s1 - *(unsigned const char*)(s2); -} +/* EOF */ diff --git a/reactos/lib/string/strcpy.c b/reactos/lib/string/strcpy.c index d3009cd584f..72920a6edc3 100644 --- a/reactos/lib/string/strcpy.c +++ b/reactos/lib/string/strcpy.c @@ -1,13 +1,7 @@ -/* - * $Id: strcpy.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: strcpy.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ #include +#include "tcscpy.h" -char* strcpy(char *to, const char *from) -{ - char *save = to; - - for (; (*to = *from); ++from, ++to); - return save; -} +/* EOF */ diff --git a/reactos/lib/string/strcspn.c b/reactos/lib/string/strcspn.c index d8592d08ca8..6907661c2d7 100644 --- a/reactos/lib/string/strcspn.c +++ b/reactos/lib/string/strcspn.c @@ -1,26 +1,9 @@ -/* - * $Id: strcspn.c,v 1.1 2003/06/09 20:23:06 hbirr Exp $ +/* $Id: strcspn.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ +#define _x(_X_) (_X_) +#define _strxspn strcspn #include +#include "strxspn.h" -size_t strcspn(const char *s1, const char *s2) -{ - unsigned long char_map[8] = {0, 0, 0, 0, 0, 0, 0, 0}; - register unsigned char* str = (unsigned char*)s1; - - while (*s2) - { - char_map[*(unsigned char*)s2 / 32] |= (1 << (*(unsigned char*)s2 % 32)); - s2++; - } - - while (*str) - { - if (char_map[*str / 32] & (1 << (*str % 32))) - break; - str++; - } - - return str - (unsigned char*)s1; -} +/* EOF */ diff --git a/reactos/lib/string/strlen.c b/reactos/lib/string/strlen.c index ace550ccd9e..7b53bf307ca 100644 --- a/reactos/lib/string/strlen.c +++ b/reactos/lib/string/strlen.c @@ -1,25 +1,7 @@ -/* - * $Id: strlen.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: strlen.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ #include -#include -#define NTOS_MODE_USER -#include - -int strlen(const char* str) -{ - const char* s; - -// DPRINT1("strlen(%x)\n", str); -// DPRINT1("%x\n", __builtin_return_address(0)); -// if (str == (char*)0x6418c4) -// { -// DPRINT1("%s\n", str); -// } - if (str == 0) - return 0; - for (s = str; *s; ++s); - return s-str; -} +#include "tcslen.h" +/* EOF */ diff --git a/reactos/lib/string/strncat.c b/reactos/lib/string/strncat.c index 01630322ff6..4be770c8c5d 100644 --- a/reactos/lib/string/strncat.c +++ b/reactos/lib/string/strncat.c @@ -1,25 +1,7 @@ -/* - * $Id: strncat.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: strncat.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ #include +#include "tcsncat.h" -char * -strncat(char *dst, const char *src, size_t n) -{ - if (n != 0) - { - char *d = dst; - const char *s = src; - - while (*d != 0) - d++; - do { - if ((*d = *s++) == 0) - break; - d++; - } while (--n != 0); - *d = 0; - } - return dst; -} +/* EOF */ diff --git a/reactos/lib/string/strncmp.c b/reactos/lib/string/strncmp.c index e741a32cd6a..61fca84c4a0 100644 --- a/reactos/lib/string/strncmp.c +++ b/reactos/lib/string/strncmp.c @@ -1,20 +1,7 @@ -/* - * $Id: strncmp.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: strncmp.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ #include +#include "tcsncmp.h" -int -strncmp(const char *s1, const char *s2, size_t n) -{ - - if (n == 0) - return 0; - do { - if (*s1 != *s2++) - return *(unsigned const char *)s1 - *(unsigned const char *)--s2; - if (*s1++ == 0) - break; - } while (--n != 0); - return 0; -} +/* EOF */ diff --git a/reactos/lib/string/strncpy.c b/reactos/lib/string/strncpy.c index 6e0d650d5b5..17eef818596 100644 --- a/reactos/lib/string/strncpy.c +++ b/reactos/lib/string/strncpy.c @@ -1,24 +1,6 @@ -/* - * $Id: strncpy.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: strncpy.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ + #include +#include "tcsncpy.h" -#include - -char * -strncpy(char *dst, const char *src, size_t n) -{ - if (n != 0) { - char *d = dst; - const char *s = src; - - do { - if ((*d++ = *s++) == 0) - { - while (--n != 0) - *d++ = 0; - break; - } - } while (--n != 0); - } - return dst; -} +/* EOF */ diff --git a/reactos/lib/string/strnlen.c b/reactos/lib/string/strnlen.c index 8c52d9baeb7..d87414439a7 100644 --- a/reactos/lib/string/strnlen.c +++ b/reactos/lib/string/strnlen.c @@ -1,16 +1,7 @@ -/* - * $Id: strnlen.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: strnlen.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ #include +#include "tcsnlen.h" -int strnlen(const char *str, size_t count) -{ - const char *s; - - if (str == 0) - return 0; - for (s = str; *s && count; ++s, count--); - return s-str; -} - +/* EOF */ diff --git a/reactos/lib/string/strrchr.c b/reactos/lib/string/strrchr.c index 395fc8d229b..e53b0e8042f 100644 --- a/reactos/lib/string/strrchr.c +++ b/reactos/lib/string/strrchr.c @@ -1,22 +1,8 @@ -/* - * $Id: strrchr.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: strrchr.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ +#define _XINT int #include +#include "tcsrchr.h" -char * -strrchr(const char *s, int c) -{ - char cc = c; - const char *sp=(char *)0; - while (*s) - { - if (*s == cc) - sp = s; - s++; - } - if (cc == 0) - sp = s; - return (char *)sp; -} - +/* EOF */ diff --git a/reactos/lib/string/strspn.c b/reactos/lib/string/strspn.c index 6f4f237f39c..a0cef608ba7 100644 --- a/reactos/lib/string/strspn.c +++ b/reactos/lib/string/strspn.c @@ -1,25 +1,9 @@ -/* - * $Id: strspn.c,v 1.1 2003/06/09 20:23:06 hbirr Exp $ +/* $Id: strspn.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ +#define _x(_X_) (!(_X_)) +#define _strxspn strspn #include +#include "strxspn.h" -size_t strspn(const char *s1, const char *s2) -{ - unsigned long char_map[8] = {0, 0, 0, 0, 0, 0, 0, 0}; - register unsigned char* str = (unsigned char*)s1; - - while (*s2) - { - char_map[*(unsigned char*)s2 / 32] |= (1 << (*(unsigned char*)s2 % 32)); - s2++; - } - - while (*str) - { - if (!(char_map[*str / 32] & (1 << (*str % 32)))) - break; - str++; - } - return str - (unsigned char*)s1; -} +/* EOF */ diff --git a/reactos/lib/string/strxspn.h b/reactos/lib/string/strxspn.h new file mode 100644 index 00000000000..490f56a3df2 --- /dev/null +++ b/reactos/lib/string/strxspn.h @@ -0,0 +1,24 @@ +/* $Id: strxspn.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include +#include + +size_t _strxspn(const char *s1, const char *s2) +{ + unsigned char char_map[1 << CHAR_BIT * sizeof(char)]; + register unsigned char * us2 = (unsigned char *)s2; + register unsigned char * str = (unsigned char *)s1; + + memset(char_map, 0, sizeof(char_map)); + + for(; *us2; ++ us2) + char_map[*us2 / CHAR_BIT] |= (1 << (*us2 % CHAR_BIT)); + + for(; *str; ++ str) + if(_x(char_map[*str / CHAR_BIT] & (1 << (*str % CHAR_BIT)))) break; + + return str - (unsigned char*)s1; +} + +/* EOF */ diff --git a/reactos/lib/string/tcscat.h b/reactos/lib/string/tcscat.h new file mode 100644 index 00000000000..afc16cfdc40 --- /dev/null +++ b/reactos/lib/string/tcscat.h @@ -0,0 +1,17 @@ +/* $Id: tcscat.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include + +_TCHAR * _tcscat(_TCHAR * s, const _TCHAR * append) +{ + _TCHAR * save = s; + + for(; *s; ++s); + + while((*s++ = *append++)); + + return save; +} + +/* EOF */ diff --git a/reactos/lib/string/tcschr.h b/reactos/lib/string/tcschr.h new file mode 100644 index 00000000000..2c7098226a3 --- /dev/null +++ b/reactos/lib/string/tcschr.h @@ -0,0 +1,22 @@ +/* $Id: tcschr.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include + +_TCHAR * _tcschr(const _TCHAR * s, _XINT c) +{ + _TCHAR cc = c; + + while(*s) + { + if(*s == cc) return (_TCHAR *)s; + + s++; + } + + if(cc == 0) return (_TCHAR *)s; + + return 0; +} + +/* EOF */ diff --git a/reactos/lib/string/tcscmp.h b/reactos/lib/string/tcscmp.h new file mode 100644 index 00000000000..2a7f21db9aa --- /dev/null +++ b/reactos/lib/string/tcscmp.h @@ -0,0 +1,19 @@ +/* $Id: tcscmp.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include + +int _tcscmp(const _TCHAR* s1, const _TCHAR* s2) +{ + while(*s1 == *s2) + { + if(*s1 == 0) return 0; + + s1 ++; + s2 ++; + } + + return *s1 - *s2; +} + +/* EOF */ diff --git a/reactos/lib/string/tcscpy.h b/reactos/lib/string/tcscpy.h new file mode 100644 index 00000000000..532efbd9c01 --- /dev/null +++ b/reactos/lib/string/tcscpy.h @@ -0,0 +1,13 @@ +/* $Id: tcscpy.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include + +_TCHAR * _tcscpy(_TCHAR * to, const _TCHAR * from) +{ + _TCHAR *save = to; + + for (; (*to = *from); ++from, ++to); + + return save; +} diff --git a/reactos/lib/string/tcslen.h b/reactos/lib/string/tcslen.h new file mode 100644 index 00000000000..ae2d5438e3a --- /dev/null +++ b/reactos/lib/string/tcslen.h @@ -0,0 +1,18 @@ +/* $Id: tcslen.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include +#include + +size_t _tcslen(const _TCHAR * str) +{ + const _TCHAR * s; + + if(str == 0) return 0; + + for(s = str; *s; ++ s); + + return s - str; +} + +/* EOF */ diff --git a/reactos/lib/string/tcsncat.h b/reactos/lib/string/tcsncat.h new file mode 100644 index 00000000000..3a3c83988c4 --- /dev/null +++ b/reactos/lib/string/tcsncat.h @@ -0,0 +1,30 @@ +/* $Id: tcsncat.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include +#include + +_TCHAR * _tcsncat(_TCHAR * dst, const _TCHAR * src, size_t n) +{ + if(n != 0) + { + _TCHAR * d = dst; + const _TCHAR * s = src; + + while(*d != 0) ++ d; + + do + { + if((*d = *s++) == 0) break; + + ++ d; + } + while (--n != 0); + + *d = 0; + } + + return dst; +} + +/* EOF */ diff --git a/reactos/lib/string/tcsncmp.h b/reactos/lib/string/tcsncmp.h new file mode 100644 index 00000000000..1385f74aa30 --- /dev/null +++ b/reactos/lib/string/tcsncmp.h @@ -0,0 +1,21 @@ +/* $Id: tcsncmp.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include +#include + +int _tcsncmp(const _TCHAR * s1, const _TCHAR * s2, size_t n) +{ + if(n == 0) return 0; + + do + { + if(*s1 != *s2 ++) return *s1 - *-- s2; + if(*s1 ++ == 0) break; + } + while (-- n != 0); + + return 0; +} + +/* EOF */ diff --git a/reactos/lib/string/tcsncpy.h b/reactos/lib/string/tcsncpy.h new file mode 100644 index 00000000000..e543cdd64c9 --- /dev/null +++ b/reactos/lib/string/tcsncpy.h @@ -0,0 +1,28 @@ +/* $Id: tcsncpy.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include +#include + +_TCHAR * _tcsncpy(_TCHAR * dst, const _TCHAR * src, size_t n) +{ + if(n != 0) + { + _TCHAR * d = dst; + const _TCHAR * s = src; + + do + { + if((*d ++ = *s ++) == 0) + { + while (-- n != 0) *d ++ = 0; + break; + } + } + while(-- n != 0); + } + + return dst; +} + +/* EOF */ diff --git a/reactos/lib/string/tcsnlen.h b/reactos/lib/string/tcsnlen.h new file mode 100644 index 00000000000..cf0f77a9a22 --- /dev/null +++ b/reactos/lib/string/tcsnlen.h @@ -0,0 +1,18 @@ +/* $Id: tcsnlen.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include +#include + +int _tcsnlen(const _TCHAR * str, size_t count) +{ + const _TCHAR * s; + + if(str == 0) return 0; + + for(s = str; *s && count; ++ s, -- count); + + return s - str; +} + +/* EOF */ diff --git a/reactos/lib/string/tcsrchr.h b/reactos/lib/string/tcsrchr.h new file mode 100644 index 00000000000..d8e2d799e9c --- /dev/null +++ b/reactos/lib/string/tcsrchr.h @@ -0,0 +1,22 @@ +/* $Id: tcsrchr.h,v 1.1 2003/07/06 23:04:19 hyperion Exp $ + */ + +#include + +_TCHAR * _tcsrchr(const _TCHAR * s, _XINT c) +{ + _TCHAR cc = c; + const _TCHAR * sp = (_TCHAR *)0; + + while(*s) + { + if(*s == cc) sp = s; + s ++; + } + + if(cc == 0) sp = s; + + return (_TCHAR *)sp; +} + +/* EOF */ diff --git a/reactos/lib/string/wcscat.c b/reactos/lib/string/wcscat.c index 23fba19cd0d..d106b3671dd 100644 --- a/reactos/lib/string/wcscat.c +++ b/reactos/lib/string/wcscat.c @@ -1,14 +1,8 @@ -/* - * $Id: wcscat.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: wcscat.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -#include +#define _UNICODE +#include +#include "tcscat.h" -wchar_t* wcscat(wchar_t* s, const wchar_t* append) -{ - wchar_t* save = s; - - for (; *s; ++s); - while ((*s++ = *append++)); - return save; -} +/* EOF */ diff --git a/reactos/lib/string/wcschr.c b/reactos/lib/string/wcschr.c index 78e18d9b574..ecfc9228e2a 100644 --- a/reactos/lib/string/wcschr.c +++ b/reactos/lib/string/wcschr.c @@ -1,20 +1,9 @@ -/* - * $Id: wcschr.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: wcschr.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -#include - -wchar_t *wcschr(const wchar_t *s, wchar_t c) -{ - wchar_t cc = c; - while (*s) - { - if (*s == cc) - return (wchar_t *)s; - s++; - } - if (cc == 0) - return (wchar_t *)s; - return 0; -} +#define _UNICODE +#define _XINT wchar_t +#include +#include "tcschr.h" +/* EOF */ diff --git a/reactos/lib/string/wcscmp.c b/reactos/lib/string/wcscmp.c index c6f35844cc1..0a0c0ddb6f9 100644 --- a/reactos/lib/string/wcscmp.c +++ b/reactos/lib/string/wcscmp.c @@ -1,17 +1,8 @@ -/* - * $Id: wcscmp.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: wcscmp.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -#include +#define _UNICODE +#include +#include "tcscmp.h" -int wcscmp(const wchar_t* s1, const wchar_t* s2) -{ - while (*s1 == *s2) - { - if (*s1 == 0) - return 0; - s1++; - s2++; - } - return *s1 - *s2; -} +/* EOF */ diff --git a/reactos/lib/string/wcscpy.c b/reactos/lib/string/wcscpy.c index 7e0d81db9f2..2713fa1045a 100644 --- a/reactos/lib/string/wcscpy.c +++ b/reactos/lib/string/wcscpy.c @@ -1,13 +1,8 @@ -/* - * $Id: wcscpy.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: wcscpy.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -#include +#define _UNICODE +#include +#include "tcscpy.h" -wchar_t* wcscpy(wchar_t *to, const wchar_t *from) -{ - wchar_t *save = to; - - for (; (*to = *from); ++from, ++to); - return save; -} +/* EOF */ diff --git a/reactos/lib/string/wcslen.c b/reactos/lib/string/wcslen.c index 40c4876feee..e34581788ad 100644 --- a/reactos/lib/string/wcslen.c +++ b/reactos/lib/string/wcslen.c @@ -1,16 +1,8 @@ -/* - * $Id: wcslen.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: wcslen.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -#include - -size_t wcslen(const wchar_t* str) -{ - const wchar_t* s; - - if (str == 0) - return 0; - for (s = str; *s; ++s); - return s-str; -} +#define _UNICODE +#include +#include "tcslen.h" +/* EOF */ diff --git a/reactos/lib/string/wcsncat.c b/reactos/lib/string/wcsncat.c index 0b3b2e424cf..6004f5de83e 100644 --- a/reactos/lib/string/wcsncat.c +++ b/reactos/lib/string/wcsncat.c @@ -1,25 +1,8 @@ -/* - * $Id: wcsncat.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: wcsncat.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -#include +#define _UNICODE +#include +#include "tcsncat.h" -wchar_t * -wcsncat(wchar_t *dst, const wchar_t *src, size_t n) -{ - if (n != 0) - { - wchar_t *d = dst; - const wchar_t *s = src; - - while (*d != 0) - d++; - do { - if ((*d = *s++) == 0) - break; - d++; - } while (--n != 0); - *d = 0; - } - return dst; -} +/* EOF */ diff --git a/reactos/lib/string/wcsncmp.c b/reactos/lib/string/wcsncmp.c index a113d4ea355..40cdd9a5a9d 100644 --- a/reactos/lib/string/wcsncmp.c +++ b/reactos/lib/string/wcsncmp.c @@ -1,20 +1,8 @@ -/* - * $Id: wcsncmp.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: wcsncmp.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -#include +#define _UNICODE +#include +#include "tcsncmp.h" -int -wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n) -{ - - if (n == 0) - return 0; - do { - if (*s1 != *s2++) - return *s1 - *--s2; - if (*s1++ == 0) - break; - } while (--n != 0); - return 0; -} +/* EOF */ diff --git a/reactos/lib/string/wcsncpy.c b/reactos/lib/string/wcsncpy.c index 2a47c700976..d29a1483de2 100644 --- a/reactos/lib/string/wcsncpy.c +++ b/reactos/lib/string/wcsncpy.c @@ -1,24 +1,8 @@ -/* - * $Id: wcsncpy.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: wcsncpy.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -#include +#define _UNICODE +#include +#include "tcsncpy.h" -wchar_t * -wcsncpy(wchar_t *dst, const wchar_t *src, size_t n) -{ - if (n != 0) { - wchar_t *d = dst; - const wchar_t *s = src; - - do { - if ((*d++ = *s++) == 0) - { - while (--n != 0) - *d++ = 0; - break; - } - } while (--n != 0); - } - return dst; -} +/* EOF */ diff --git a/reactos/lib/string/wcsnlen.c b/reactos/lib/string/wcsnlen.c index 2537d4079be..2a33fb35e7b 100644 --- a/reactos/lib/string/wcsnlen.c +++ b/reactos/lib/string/wcsnlen.c @@ -1,16 +1,8 @@ -/* - * $Id: wcsnlen.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: wcsnlen.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -#include - -int wcsnlen(const wchar_t *str, size_t count) -{ - const wchar_t *s; - - if (str == 0) - return 0; - for (s = str; *s && count; ++s, count--); - return s-str; -} +#define _UNICODE +#include +#include "tcsnlen.h" +/* EOF */ diff --git a/reactos/lib/string/wcsrchr.c b/reactos/lib/string/wcsrchr.c index 6ed5c1147c0..cdf26888ed3 100644 --- a/reactos/lib/string/wcsrchr.c +++ b/reactos/lib/string/wcsrchr.c @@ -1,22 +1,9 @@ -/* - * $Id: wcsrchr.c,v 1.1 2003/05/27 18:56:15 hbirr Exp $ +/* $Id: wcsrchr.c,v 1.2 2003/07/06 23:04:19 hyperion Exp $ */ -#include - -wchar_t * -wcsrchr(const wchar_t *s, wchar_t c) -{ - wchar_t cc = c; - const wchar_t *sp=(wchar_t *)0; - while (*s) - { - if (*s == cc) - sp = s; - s++; - } - if (cc == 0) - sp = s; - return (wchar_t *)sp; -} +#define _UNICODE +#define _XINT wchar_t +#include +#include "tcsrchr.h" +/* EOF */ diff --git a/reactos/lib/user32/misc/timer.c b/reactos/lib/user32/misc/timer.c index 348ad518fef..5b1c775c885 100644 --- a/reactos/lib/user32/misc/timer.c +++ b/reactos/lib/user32/misc/timer.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: timer.c,v 1.6 2003/04/26 01:19:31 sedwards Exp $ +/* $Id: timer.c,v 1.7 2003/07/06 23:04:19 hyperion Exp $ * * PROJECT: ReactOS user32.dll * FILE: lib/user32/misc/dde.c @@ -41,19 +41,7 @@ KillTimer( HWND hWnd, UINT_PTR IDEvent) { - - NTSTATUS Status; - - Status = NtUserKillTimer(hWnd, IDEvent); - - if (!NT_SUCCESS(Status)) - { - RtlNtStatusToDosError(Status); - return FALSE; - } - - return TRUE; - + return NtUserKillTimer(hWnd, IDEvent); } UINT_PTR @@ -64,19 +52,6 @@ SetTimer( UINT Period, TIMERPROC TimerFunc) { - NTSTATUS Status; - - Status = NtUserSetTimer(hWnd, &IDEvent, Period, TimerFunc); - - if (!NT_SUCCESS(Status)) - { - RtlNtStatusToDosError(Status); - return FALSE; - } - - if (hWnd == NULL) - return IDEvent; - - return TRUE; + return NtUserSetTimer(hWnd, IDEvent, Period, TimerFunc); } diff --git a/reactos/lib/user32/windows/paint.c b/reactos/lib/user32/windows/paint.c index 2ef6748d96f..bb092ff6f17 100644 --- a/reactos/lib/user32/windows/paint.c +++ b/reactos/lib/user32/windows/paint.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: paint.c,v 1.14 2003/05/26 18:52:37 gvg Exp $ +/* $Id: paint.c,v 1.15 2003/07/06 23:04:19 hyperion Exp $ * * PROJECT: ReactOS user32.dll * FILE: lib/user32/windows/input.c @@ -109,15 +109,7 @@ RedrawWindow( HRGN hrgnUpdate, UINT flags) { - NTSTATUS Status; - - Status = NtUserRedrawWindow(hWnd, lprcUpdate, hrgnUpdate, flags); - if (! NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - } - - return NT_SUCCESS(Status); + return NtUserRedrawWindow(hWnd, lprcUpdate, hrgnUpdate, flags); } WINBOOL diff --git a/reactos/subsys/win32k/ntuser/timer.c b/reactos/subsys/win32k/ntuser/timer.c index d9219518ff8..e481fd301f8 100644 --- a/reactos/subsys/win32k/ntuser/timer.c +++ b/reactos/subsys/win32k/ntuser/timer.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: timer.c,v 1.4 2003/06/05 22:47:47 gdalsnes Exp $ +/* $Id: timer.c,v 1.5 2003/07/06 23:04:19 hyperion Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -166,129 +166,134 @@ RemoveTimersThread(HANDLE ThreadID) -NTSTATUS +UINT_PTR STDCALL -NtUserSetTimer( - HWND hWnd, - UINT_PTR * IDEvent, - UINT Period, - TIMERPROC TimerFunc - ) +NtUserSetTimer +( + HWND hWnd, + UINT_PTR nIDEvent, + UINT uElapse, + TIMERPROC lpTimerFunc +) { - ULONG Index; - PMSG_TIMER_ENTRY MsgTimer = NULL; - PMSG_TIMER_ENTRY NewTimer; - LARGE_INTEGER CurrentTime; - HANDLE ThreadID; + ULONG Index; + PMSG_TIMER_ENTRY MsgTimer = NULL; + PMSG_TIMER_ENTRY NewTimer; + LARGE_INTEGER CurrentTime; + HANDLE ThreadID; - //FIXME: WINE: window must be owned by the calling thread + //FIXME: WINE: window must be owned by the calling thread #if 0 - if (hWnd && !(hWnd = WIN_IsCurrentThread(hWnd)) - { - return STATUS_UNSUCCESSFUL; - } - + if(hWnd && !(hWnd = WIN_IsCurrentThread(hWnd)) + { + return STATUS_UNSUCCESSFUL; + } #endif - ThreadID = PsGetCurrentThreadId(); - KeQuerySystemTime(&CurrentTime); - ExAcquireFastMutex(&Mutex); + ThreadID = PsGetCurrentThreadId(); + KeQuerySystemTime(&CurrentTime); + ExAcquireFastMutex(&Mutex); - if (hWnd == NULL) - { - //find a free, handle-less timer id - Index = RtlFindClearBitsAndSet(&HandleLessTimersBitMap, 1, HintIndex); - if (Index == -1) - { - ExReleaseFastMutex(&Mutex); - return STATUS_UNSUCCESSFUL; - } - - *IDEvent = HintIndex = Index + 1; - } - else - { - //remove timer if allready in the queue - MsgTimer = RemoveTimer(hWnd, *IDEvent, ThreadID); - } - - if (MsgTimer) - { - //modify existing (removed) timer - NewTimer = MsgTimer; - - NewTimer->Period = Period; - NewTimer->Timeout.QuadPart = CurrentTime.QuadPart + (Period * 10000); - NewTimer->Msg.lParam = (LPARAM)TimerFunc; - } - else - { - //FIXME: use lookaside? - NewTimer = ExAllocatePool(PagedPool, sizeof(MSG_TIMER_ENTRY)); - - NewTimer->Msg.hwnd = hWnd; - NewTimer->Msg.message = WM_TIMER; - NewTimer->Msg.wParam = (WPARAM)*IDEvent; - NewTimer->Msg.lParam = (LPARAM)TimerFunc; - NewTimer->Period = Period; - NewTimer->Timeout.QuadPart = CurrentTime.QuadPart + (Period * 10000); - NewTimer->ThreadID = ThreadID; - } - - if (InsertTimerAscendingOrder(NewTimer)) - { - //new timer is first in queue and expires first - KeSetTimer(&Timer, NewTimer->Timeout, NULL); - } + if(hWnd == NULL) + { + /* find a free, handle-less timer id */ + Index = RtlFindClearBitsAndSet(&HandleLessTimersBitMap, 1, HintIndex); + if(Index == -1) + { + /* FIXME: set the last error */ ExReleaseFastMutex(&Mutex); + return 0; + } - return STATUS_SUCCESS; + ++ Index; + HintIndex = Index; + return Index; + } + else + { + /* remove timer if already in the queue */ + MsgTimer = RemoveTimer(hWnd, nIDEvent, ThreadID); + } + + if(MsgTimer) + { + /* modify existing (removed) timer */ + NewTimer = MsgTimer; + + NewTimer->Period = uElapse; + NewTimer->Timeout.QuadPart = CurrentTime.QuadPart + (uElapse * 10000); + NewTimer->Msg.lParam = (LPARAM)lpTimerFunc; + } + else + { + /* FIXME: use lookaside? */ + NewTimer = ExAllocatePool(PagedPool, sizeof(MSG_TIMER_ENTRY)); + + NewTimer->Msg.hwnd = hWnd; + NewTimer->Msg.message = WM_TIMER; + NewTimer->Msg.wParam = (WPARAM)nIDEvent; + NewTimer->Msg.lParam = (LPARAM)lpTimerFunc; + NewTimer->Period = uElapse; + NewTimer->Timeout.QuadPart = CurrentTime.QuadPart + (uElapse * 10000); + NewTimer->ThreadID = ThreadID; + } + + if(InsertTimerAscendingOrder(NewTimer)) + { + /* new timer is first in queue and expires first */ + KeSetTimer(&Timer, NewTimer->Timeout, NULL); + } + + ExReleaseFastMutex(&Mutex); + + return 1; } -NTSTATUS +BOOL STDCALL -NtUserKillTimer( - HWND hWnd, - UINT_PTR IDEvent) +NtUserKillTimer +( + HWND hWnd, + UINT_PTR uIDEvent +) { - PMSG_TIMER_ENTRY MsgTimer; - - ExAcquireFastMutex(&Mutex); + PMSG_TIMER_ENTRY MsgTimer; + + ExAcquireFastMutex(&Mutex); - //handle-less timer? - if (hWnd == NULL) - { - if (!RtlAreBitsSet(&HandleLessTimersBitMap, IDEvent - 1, 1)) - { - //bit was not set - ExReleaseFastMutex(&Mutex); - return STATUS_UNSUCCESSFUL; - } + /* handle-less timer? */ + if(hWnd == NULL) + { + if(!RtlAreBitsSet(&HandleLessTimersBitMap, uIDEvent - 1, 1)) + { + /* bit was not set */ + /* FIXME: set the last error */ + ExReleaseFastMutex(&Mutex); + return FALSE; + } - RtlClearBits(&HandleLessTimersBitMap, IDEvent - 1, 1); - } + RtlClearBits(&HandleLessTimersBitMap, uIDEvent - 1, 1); + } - MsgTimer = RemoveTimer(hWnd, IDEvent, PsGetCurrentThreadId()); + MsgTimer = RemoveTimer(hWnd, uIDEvent, PsGetCurrentThreadId()); - ExReleaseFastMutex(&Mutex); + ExReleaseFastMutex(&Mutex); - if (MsgTimer == NULL) - { - //didn't find timer - return STATUS_UNSUCCESSFUL; - } + if(MsgTimer == NULL) + { + /* didn't find timer */ + /* FIXME: set the last error */ + return FALSE; + } - //FIXME: use lookaside? - ExFreePool(MsgTimer); + /* FIXME: use lookaside? */ + ExFreePool(MsgTimer); - return STATUS_SUCCESS; + return TRUE; } - - - DWORD STDCALL NtUserSetSystemTimer( diff --git a/reactos/subsys/win32k/ntuser/window.c b/reactos/subsys/win32k/ntuser/window.c index 1cc921c3477..cac24516176 100644 --- a/reactos/subsys/win32k/ntuser/window.c +++ b/reactos/subsys/win32k/ntuser/window.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: window.c,v 1.59 2003/07/05 16:04:01 chorns Exp $ +/* $Id: window.c,v 1.60 2003/07/06 23:04:19 hyperion Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -1438,24 +1438,46 @@ NtUserRealChildWindowFromPoint(DWORD Unknown0, return 0; } -NTSTATUS STDCALL -NtUserRedrawWindow(HWND hWnd, CONST RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags) +BOOL +STDCALL +NtUserRedrawWindow +( + HWND hWnd, + CONST RECT *lprcUpdate, + HRGN hrgnUpdate, + UINT flags +) { - RECT SafeUpdateRect; - NTSTATUS Status; + RECT SafeUpdateRect; + NTSTATUS Status; - if (NULL != lprcUpdate) - { - Status = MmCopyFromCaller(&SafeUpdateRect, (PRECT) lprcUpdate, sizeof(RECT)); - if (! NT_SUCCESS(Status)) - { - return Status; - } - } + if(NULL != lprcUpdate) + { + Status = MmCopyFromCaller(&SafeUpdateRect, (PRECT)lprcUpdate, sizeof(RECT)); - return PaintRedrawWindow(hWnd, NULL == lprcUpdate ? NULL : &SafeUpdateRect, hrgnUpdate, - flags, 0) ? STATUS_SUCCESS : STATUS_INVALID_PARAMETER; -; + if(!NT_SUCCESS(Status)) + { + /* FIXME: set last error */ + return FALSE; + } + } + + Status = PaintRedrawWindow + ( + hWnd, + NULL == lprcUpdate ? NULL : &SafeUpdateRect, + hrgnUpdate, + flags, + 0 + ); + + if(!NT_SUCCESS(Status)) + { + /* FIXME: set last error */ + return FALSE; + } + + return TRUE; } UINT STDCALL diff --git a/reactos/tools/helper.mk b/reactos/tools/helper.mk index 78f4cfa7e22..31eb2e078de 100644 --- a/reactos/tools/helper.mk +++ b/reactos/tools/helper.mk @@ -1,4 +1,4 @@ -# $Id: helper.mk,v 1.38 2003/06/17 19:40:07 hbirr Exp $ +# $Id: helper.mk,v 1.39 2003/07/06 23:04:19 hyperion Exp $ # # Helper makefile for ReactOS modules # Variables this makefile accepts: @@ -530,7 +530,7 @@ TARGET_CLEAN += $(MK_IMPLIBPATH)/$(MK_IMPLIB_FULLNAME) all: $(MK_IMPLIBPATH)/$(MK_IMPLIB_FULLNAME) -$(MK_IMPLIBPATH)/$(MK_IMPLIB_FULLNAME): $(TARGET_OBJECTS) +$(MK_IMPLIBPATH)/$(MK_IMPLIB_FULLNAME): $(TARGET_OBJECTS) $(MK_DEFNAME) $(DLLTOOL) \ --dllname $(MK_FULLNAME) \ --def $(MK_DEFNAME) \ @@ -554,12 +554,14 @@ ifeq ($(MK_MODE),user) ifeq ($(MK_EXETYPE),dll) TARGET_LFLAGS += -mdll -Wl,--image-base,$(TARGET_BASE) + MK_EXTRADEP := $(MK_EDFNAME) MK_EXTRACMD2 := -Wl,temp.exp else + MK_EXTRADEP := MK_EXTRACMD2 := endif -$(MK_NOSTRIPNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_LIBS) +$(MK_NOSTRIPNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_EXTRADEP) $(MK_LIBS) ifeq ($(MK_EXETYPE),dll) $(CC) -Wl,--base-file,base.tmp \ -Wl,--entry,$(TARGET_ENTRY) \ @@ -584,7 +586,7 @@ else $(NM) --numeric-sort $(MK_NOSTRIPNAME) > $(MK_BASENAME).map endif -$(MK_FULLNAME): $(MK_NOSTRIPNAME) +$(MK_FULLNAME): $(MK_NOSTRIPNAME) $(MK_EXTRADEP) ifeq ($(MK_EXETYPE),dll) $(CC) -Wl,--base-file,base.tmp \ -Wl,--entry,$(TARGET_ENTRY) \ @@ -611,11 +613,13 @@ ifeq ($(MK_MODE),kernel) ifeq ($(MK_IMPLIB),yes) MK_EXTRACMD := --def $(MK_EDFNAME) + MK_EXTRADEP := $(MK_EDFNAME) else MK_EXTRACMD := + MK_EXTRADEP := endif -$(MK_NOSTRIPNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_LIBS) +$(MK_NOSTRIPNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_EXTRADEP) $(MK_LIBS) $(CC) -Wl,--base-file,base.tmp \ -Wl,--entry,$(TARGET_ENTRY) \ $(TARGET_LFLAGS) \ @@ -645,7 +649,7 @@ else $(NM) --numeric-sort $(MK_NOSTRIPNAME) > $(MK_BASENAME).map endif -$(MK_FULLNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_LIBS) $(MK_NOSTRIPNAME) +$(MK_FULLNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_EXTRADEP) $(MK_LIBS) $(MK_NOSTRIPNAME) $(LD) -r -o $(MK_STRIPPED_OBJECT) $(MK_OBJECTS) $(STRIP) --strip-debug $(MK_STRIPPED_OBJECT) $(CC) -Wl,--base-file,base.tmp \