| 1 | /* $Id: crtdll.cpp,v 1.19 1999-12-24 18:40:41 sandervl Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | * The C RunTime DLL
|
|---|
| 5 | *
|
|---|
| 6 | * Implements C run-time functionality as known from UNIX.
|
|---|
| 7 | *
|
|---|
| 8 | * TODO: Check setjmp(3)
|
|---|
| 9 | *
|
|---|
| 10 | * Partialy based on Wine and ReactOS
|
|---|
| 11 | *
|
|---|
| 12 | * Copyright 1996,1998 Marcus Meissner
|
|---|
| 13 | * Copyright 1996 Jukka Iivonen
|
|---|
| 14 | * Copyright 1997 Uwe Bonnes
|
|---|
| 15 | * Copyright 1999 Jens Wiessner
|
|---|
| 16 | */
|
|---|
| 17 |
|
|---|
| 18 | #include <os2win.h>
|
|---|
| 19 | #include <stdio.h>
|
|---|
| 20 | #include <stdlib.h>
|
|---|
| 21 | #include <string.h>
|
|---|
| 22 | #include <odinwrap.h>
|
|---|
| 23 | #include <misc.h>
|
|---|
| 24 | #include <unicode.h>
|
|---|
| 25 | #include <heapstring.h>
|
|---|
| 26 | #include <ctype.h>
|
|---|
| 27 | #include <setjmp.h>
|
|---|
| 28 | #include <ntddk.h>
|
|---|
| 29 | #include <debugtools.h>
|
|---|
| 30 |
|
|---|
| 31 | #include <wchar.h>
|
|---|
| 32 | #include <wctype.h>
|
|---|
| 33 | #include <math.h>
|
|---|
| 34 | #include <libc\locale.h>
|
|---|
| 35 | #include <signal.h>
|
|---|
| 36 | #include <io.h>
|
|---|
| 37 | #include <assert.h>
|
|---|
| 38 | #include <process.h>
|
|---|
| 39 | #include <float.h>
|
|---|
| 40 | #include <conio.h>
|
|---|
| 41 | #include <direct.h>
|
|---|
| 42 | #include <malloc.h>
|
|---|
| 43 | #include <drive.h>
|
|---|
| 44 | #include <fcntl.h>
|
|---|
| 45 | #include <search.h>
|
|---|
| 46 | #include <heap.h>
|
|---|
| 47 | #include <errno.h>
|
|---|
| 48 | #include <sys\utime.h>
|
|---|
| 49 | #include <sys\stat.h>
|
|---|
| 50 |
|
|---|
| 51 | #include <crtdll.h>
|
|---|
| 52 | #include "crtinc.h"
|
|---|
| 53 | #include "ieee.h"
|
|---|
| 54 |
|
|---|
| 55 | DEFAULT_DEBUG_CHANNEL(crtdll)
|
|---|
| 56 |
|
|---|
| 57 | //SvL: per process heap for CRTDLL
|
|---|
| 58 | HANDLE CRTDLL_hHeap = 0;
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 | /*********************************************************************
|
|---|
| 62 | * CRTDLL_MainInit (CRTDLL.init)
|
|---|
| 63 | */
|
|---|
| 64 | BOOL WINAPI CRTDLL_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|---|
| 65 | {
|
|---|
| 66 | if (fdwReason == DLL_PROCESS_ATTACH) {
|
|---|
| 67 | CRTDLL__fdopen(0,"r");
|
|---|
| 68 | CRTDLL__fdopen(1,"w");
|
|---|
| 69 | CRTDLL__fdopen(2,"w");
|
|---|
| 70 | CRTDLL_hHeap = HeapCreate(0, 0x10000, 0);
|
|---|
| 71 | }
|
|---|
| 72 | else
|
|---|
| 73 | if (fdwReason == DLL_PROCESS_DETACH) {
|
|---|
| 74 | HeapDestroy(CRTDLL_hHeap);
|
|---|
| 75 | CRTDLL_hHeap = 0;
|
|---|
| 76 | }
|
|---|
| 77 | return TRUE;
|
|---|
| 78 | }
|
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 | /*********************************************************************
|
|---|
| 82 | * new (CRTDLL.001)
|
|---|
| 83 | */
|
|---|
| 84 | VOID* CDECL CRTDLL_new(DWORD size)
|
|---|
| 85 | {
|
|---|
| 86 | dprintf2(("CRTDLL: ??2@YAPAXI@Z\n"));
|
|---|
| 87 | VOID* result;
|
|---|
| 88 | if(!(result = Heap_Alloc(size)) && new_handler)
|
|---|
| 89 | (*new_handler)();
|
|---|
| 90 | return result;
|
|---|
| 91 | }
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 | /*********************************************************************
|
|---|
| 95 | * delete (CRTDLL.002)
|
|---|
| 96 | */
|
|---|
| 97 | VOID CDECL CRTDLL_delete(VOID* ptr)
|
|---|
| 98 | {
|
|---|
| 99 | dprintf2(("CRTDLL: ??3@YAXPAX@Z\n"));
|
|---|
| 100 | Heap_Free(ptr);
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 | /*********************************************************************
|
|---|
| 105 | * set_new_handler(CRTDLL.003)
|
|---|
| 106 | */
|
|---|
| 107 | new_handler_type CDECL CRTDLL_set_new_handler(new_handler_type func)
|
|---|
| 108 | {
|
|---|
| 109 | dprintf2(("CRTDLL: ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z\n"));
|
|---|
| 110 | new_handler_type old_handler = new_handler;
|
|---|
| 111 | new_handler = func;
|
|---|
| 112 | return old_handler;
|
|---|
| 113 | }
|
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 | /*********************************************************************
|
|---|
| 117 | * _CIacos (CRTDLL.004)
|
|---|
| 118 | */
|
|---|
| 119 | double CDECL CRTDLL__CIacos(double x)
|
|---|
| 120 | {
|
|---|
| 121 | dprintf2(("CRTDLL: _CIacos\n"));
|
|---|
| 122 | dprintf2(("should be register function\n"));
|
|---|
| 123 | return acos(x);
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|
| 126 |
|
|---|
| 127 | /*********************************************************************
|
|---|
| 128 | * _CIasin (CRTDLL.005)
|
|---|
| 129 | */
|
|---|
| 130 | double CDECL CRTDLL__CIasin( double x )
|
|---|
| 131 | {
|
|---|
| 132 | dprintf2(("CRTDLL: _CIasin\n"));
|
|---|
| 133 | dprintf2(("should be register function\n"));
|
|---|
| 134 | return asin(x);
|
|---|
| 135 | }
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 | /*********************************************************************
|
|---|
| 139 | * _CIatan (CRTDLL.006)
|
|---|
| 140 | */
|
|---|
| 141 | double CDECL CRTDLL__CIatan( double x )
|
|---|
| 142 | {
|
|---|
| 143 | dprintf2(("CRTDLL: _CIatan\n"));
|
|---|
| 144 | dprintf2(("should be register function\n"));
|
|---|
| 145 | return atan(x);
|
|---|
| 146 | }
|
|---|
| 147 |
|
|---|
| 148 |
|
|---|
| 149 | /*********************************************************************
|
|---|
| 150 | * _CIatan2 (CRTDLL.007)
|
|---|
| 151 | */
|
|---|
| 152 | double CDECL CRTDLL__CIatan2( double x, double y )
|
|---|
| 153 | {
|
|---|
| 154 | dprintf2(("CRTDLL: _CIatan2\n"));
|
|---|
| 155 | dprintf2(("should be register function\n"));
|
|---|
| 156 | return atan2(x,y);
|
|---|
| 157 | }
|
|---|
| 158 |
|
|---|
| 159 |
|
|---|
| 160 | /*********************************************************************
|
|---|
| 161 | * _CIcos (CRTDLL.008)
|
|---|
| 162 | */
|
|---|
| 163 | double CDECL CRTDLL__CIcos( double x )
|
|---|
| 164 | {
|
|---|
| 165 | dprintf2(("CRTDLL: _CIcos\n"));
|
|---|
| 166 | dprintf2(("should be register function\n"));
|
|---|
| 167 | return cos(x);
|
|---|
| 168 | }
|
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 | /*********************************************************************
|
|---|
| 172 | * _CIcosh (CRTDLL.009)
|
|---|
| 173 | */
|
|---|
| 174 | double CDECL CRTDLL__CIcosh( double x )
|
|---|
| 175 | {
|
|---|
| 176 | dprintf2(("CRTDLL: _CIcosh\n"));
|
|---|
| 177 | dprintf2(("should be register function\n"));
|
|---|
| 178 | return cosh(x);
|
|---|
| 179 | }
|
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 | /*********************************************************************
|
|---|
| 183 | * _CIexp (CRTDLL.010)
|
|---|
| 184 | */
|
|---|
| 185 | double CDECL CRTDLL__CIexp( double x )
|
|---|
| 186 | {
|
|---|
| 187 | dprintf2(("CRTDLL: _CIexp\n"));
|
|---|
| 188 | dprintf2(("should be register function\n"));
|
|---|
| 189 | return exp(x);
|
|---|
| 190 | }
|
|---|
| 191 |
|
|---|
| 192 |
|
|---|
| 193 | /*********************************************************************
|
|---|
| 194 | * _CIfmod (CRTDLL.011)
|
|---|
| 195 | */
|
|---|
| 196 | double CDECL CRTDLL__CIfmod( double x, double y )
|
|---|
| 197 | {
|
|---|
| 198 | dprintf2(("CRTDLL: _CIfmod\n"));
|
|---|
| 199 | dprintf2(("should be register function\n"));
|
|---|
| 200 | return fmod(x,y);
|
|---|
| 201 | }
|
|---|
| 202 |
|
|---|
| 203 |
|
|---|
| 204 | /*********************************************************************
|
|---|
| 205 | * _CIlog (CRTDLL.012)
|
|---|
| 206 | */
|
|---|
| 207 | double CDECL CRTDLL__CIlog( double x )
|
|---|
| 208 | {
|
|---|
| 209 | dprintf2(("CRTDLL: _CIlog\n"));
|
|---|
| 210 | dprintf2(("should be register function\n"));
|
|---|
| 211 | return log(x);
|
|---|
| 212 | }
|
|---|
| 213 |
|
|---|
| 214 |
|
|---|
| 215 | /*********************************************************************
|
|---|
| 216 | * _CIlog10 (CRTDLL.013)
|
|---|
| 217 | */
|
|---|
| 218 | double CDECL CRTDLL__CIlog10( double x )
|
|---|
| 219 | {
|
|---|
| 220 | dprintf2(("CRTDLL: _CIlog10\n"));
|
|---|
| 221 | dprintf2(("should be register function\n"));
|
|---|
| 222 | return log10(x);
|
|---|
| 223 | }
|
|---|
| 224 |
|
|---|
| 225 |
|
|---|
| 226 | /*********************************************************************
|
|---|
| 227 | * _CIsin (CRTDLL.015)
|
|---|
| 228 | */
|
|---|
| 229 | double CDECL CRTDLL__CIsin( double x )
|
|---|
| 230 | {
|
|---|
| 231 | dprintf2(("CRTDLL: _CIsin\n"));
|
|---|
| 232 | dprintf2(("should be register function\n"));
|
|---|
| 233 | return sin(x);
|
|---|
| 234 | }
|
|---|
| 235 |
|
|---|
| 236 |
|
|---|
| 237 | /*********************************************************************
|
|---|
| 238 | * _CIsinh (CRTDLL.016)
|
|---|
| 239 | */
|
|---|
| 240 | double CDECL CRTDLL__CIsinh( double x )
|
|---|
| 241 | {
|
|---|
| 242 | dprintf2(("CRTDLL: _CIsinh\n"));
|
|---|
| 243 | dprintf2(("should be register function\n"));
|
|---|
| 244 | return sinh(x);
|
|---|
| 245 | }
|
|---|
| 246 |
|
|---|
| 247 |
|
|---|
| 248 | /*********************************************************************
|
|---|
| 249 | * _CIsqrt (CRTDLL.017)
|
|---|
| 250 | */
|
|---|
| 251 | double CDECL CRTDLL__CIsqrt( double x )
|
|---|
| 252 | {
|
|---|
| 253 | dprintf2(("CRTDLL: _CIsqrt\n"));
|
|---|
| 254 | dprintf2(("should be register function\n"));
|
|---|
| 255 | return acos(x);
|
|---|
| 256 | }
|
|---|
| 257 |
|
|---|
| 258 |
|
|---|
| 259 | /*********************************************************************
|
|---|
| 260 | * _CItan (CRTDLL.018)
|
|---|
| 261 | */
|
|---|
| 262 | double CDECL CRTDLL__CItan( double x )
|
|---|
| 263 | {
|
|---|
| 264 | dprintf2(("CRTDLL: _CItan\n"));
|
|---|
| 265 | dprintf2(("should be register function\n"));
|
|---|
| 266 | return tan(x);
|
|---|
| 267 | }
|
|---|
| 268 |
|
|---|
| 269 |
|
|---|
| 270 | /*********************************************************************
|
|---|
| 271 | * _CItanh (CRTDLL.019)
|
|---|
| 272 | */
|
|---|
| 273 | double CDECL CRTDLL__CItanh( double x )
|
|---|
| 274 | {
|
|---|
| 275 | dprintf2(("CRTDLL: _CItanh\n"));
|
|---|
| 276 | dprintf2(("should be register function\n"));
|
|---|
| 277 | return tanh(x);
|
|---|
| 278 | }
|
|---|
| 279 |
|
|---|
| 280 |
|
|---|
| 281 | /*********************************************************************
|
|---|
| 282 | * _XcptFilter (CRTDLL.21)
|
|---|
| 283 | */
|
|---|
| 284 | INT CDECL CRTDLL__XcptFilter(DWORD ret, struct _EXCEPTION_POINTERS * ExceptionInfo )
|
|---|
| 285 | {
|
|---|
| 286 | dprintf2(("CRTDLL: _XcptFilter\n"));
|
|---|
| 287 | return UnhandledExceptionFilter(ExceptionInfo);
|
|---|
| 288 | }
|
|---|
| 289 |
|
|---|
| 290 |
|
|---|
| 291 | /*********************************************************************
|
|---|
| 292 | * _GetMainArgs (CRTDLL.22)
|
|---|
| 293 | */
|
|---|
| 294 | DWORD CDECL CRTDLL__GetMainArgs(LPDWORD argc,LPSTR **argv,
|
|---|
| 295 | LPSTR *environ,DWORD flag)
|
|---|
| 296 | {
|
|---|
| 297 | char *cmdline;
|
|---|
| 298 | char **xargv;
|
|---|
| 299 | int xargc,i,afterlastspace;
|
|---|
| 300 | DWORD version;
|
|---|
| 301 |
|
|---|
| 302 | dprintf2(("CRTDLL: GetMainArgs\n"));
|
|---|
| 303 |
|
|---|
| 304 | CRTDLL_acmdln_dll = cmdline = HEAP_strdupA( GetProcessHeap(), 0,
|
|---|
| 305 | GetCommandLineA() );
|
|---|
| 306 |
|
|---|
| 307 | version = GetVersion();
|
|---|
| 308 | CRTDLL_osver_dll = version >> 16;
|
|---|
| 309 | CRTDLL_winminor_dll = version & 0xFF;
|
|---|
| 310 | CRTDLL_winmajor_dll = (version>>8) & 0xFF;
|
|---|
| 311 | CRTDLL_baseversion_dll = version >> 16;
|
|---|
| 312 | CRTDLL_winver_dll = ((version >> 8) & 0xFF) + ((version & 0xFF) << 8);
|
|---|
| 313 | CRTDLL_baseminor_dll = (version >> 16) & 0xFF;
|
|---|
| 314 | CRTDLL_basemajor_dll = (version >> 24) & 0xFF;
|
|---|
| 315 | CRTDLL_osversion_dll = version & 0xFFFF;
|
|---|
| 316 | CRTDLL_osminor_dll = version & 0xFF;
|
|---|
| 317 | CRTDLL_osmajor_dll = (version>>8) & 0xFF;
|
|---|
| 318 |
|
|---|
| 319 | /* missing threading init */
|
|---|
| 320 |
|
|---|
| 321 | i=0;xargv=NULL;xargc=0;afterlastspace=0;
|
|---|
| 322 | /*
|
|---|
| 323 | while (cmdline[i]) {
|
|---|
| 324 | if (cmdline[i]==' ') {
|
|---|
| 325 | xargv=(char**)HeapReAlloc( GetProcessHeap(), 0, xargv,
|
|---|
| 326 | sizeof(char*)*(++xargc));
|
|---|
| 327 | cmdline[i]='\0';
|
|---|
| 328 | xargv[xargc-1] = HEAP_strdupA( GetProcessHeap(), 0,
|
|---|
| 329 | cmdline+afterlastspace);
|
|---|
| 330 | i++;
|
|---|
| 331 | while (cmdline[i]==' ')
|
|---|
| 332 | i++;
|
|---|
| 333 | if (cmdline[i])
|
|---|
| 334 | afterlastspace=i;
|
|---|
| 335 |
|
|---|
| 336 | } else
|
|---|
| 337 | i++;
|
|---|
| 338 |
|
|---|
| 339 | }
|
|---|
| 340 |
|
|---|
| 341 | xargv=(char**)HeapReAlloc( GetProcessHeap(), 0, xargv,
|
|---|
| 342 | sizeof(char*)*(++xargc));
|
|---|
| 343 | cmdline[i]='\0';
|
|---|
| 344 | xargv[xargc-1] = HEAP_strdupA( GetProcessHeap(), 0,
|
|---|
| 345 | cmdline+afterlastspace);
|
|---|
| 346 | */
|
|---|
| 347 | CRTDLL_argc_dll = xargc;
|
|---|
| 348 | *argc = xargc;
|
|---|
| 349 | CRTDLL_argv_dll = xargv;
|
|---|
| 350 | *argv = xargv;
|
|---|
| 351 | CRTDLL_environ_dll = *environ = GetEnvironmentStringsA();
|
|---|
| 352 | dprintf2(("CRTDLL: GetMainArgs end\n"));
|
|---|
| 353 | return 0;
|
|---|
| 354 | }
|
|---|
| 355 |
|
|---|
| 356 |
|
|---|
| 357 | /*********************************************************************
|
|---|
| 358 | * __dllonexit (CRTDLL.25)
|
|---|
| 359 | */
|
|---|
| 360 | VOID CDECL CRTDLL___dllonexit ()
|
|---|
| 361 | {
|
|---|
| 362 | dprintf(("__dllonexit not implemented.\n"));
|
|---|
| 363 | }
|
|---|
| 364 |
|
|---|
| 365 |
|
|---|
| 366 | /*********************************************************************
|
|---|
| 367 | * __doserrno (CRTDLL.26)
|
|---|
| 368 | */
|
|---|
| 369 | int * CDECL CRTDLL___doserrno()
|
|---|
| 370 | {
|
|---|
| 371 | dprintf2(("__doserrno\n"));
|
|---|
| 372 | _doserrno = GetLastError();
|
|---|
| 373 | return &_doserrno;
|
|---|
| 374 | }
|
|---|
| 375 |
|
|---|
| 376 |
|
|---|
| 377 | /*********************************************************************
|
|---|
| 378 | * __fpecode (CRTDLL.27)
|
|---|
| 379 | */
|
|---|
| 380 | int fpecode = 0;
|
|---|
| 381 |
|
|---|
| 382 | int * CDECL CRTDLL___fpecode ( void )
|
|---|
| 383 | {
|
|---|
| 384 | dprintf2(("__fpecode\n"));
|
|---|
| 385 | return &fpecode;
|
|---|
| 386 | }
|
|---|
| 387 |
|
|---|
| 388 |
|
|---|
| 389 | /*********************************************************************
|
|---|
| 390 | * CRTDLL___isascii (CRTDLL.28)
|
|---|
| 391 | */
|
|---|
| 392 | int CDECL CRTDLL___isascii(int i)
|
|---|
| 393 | {
|
|---|
| 394 | dprintf2(("CRTDLL: __isascii\n"));
|
|---|
| 395 | return (!((i)&(~0x7f)));
|
|---|
| 396 | }
|
|---|
| 397 |
|
|---|
| 398 |
|
|---|
| 399 | /*********************************************************************
|
|---|
| 400 | * CRTDLL___iscsym (CRTDLL.29)
|
|---|
| 401 | */
|
|---|
| 402 | int CDECL CRTDLL___iscsym(int c)
|
|---|
| 403 | {
|
|---|
| 404 | dprintf2(("CRTDLL: __iscsym\n"));
|
|---|
| 405 | return (CRTDLL_isalnum(c) || ( c == '_' )) ;
|
|---|
| 406 | }
|
|---|
| 407 |
|
|---|
| 408 |
|
|---|
| 409 | /*********************************************************************
|
|---|
| 410 | * CRTDLL___iscsymf (CRTDLL.30)
|
|---|
| 411 | */
|
|---|
| 412 | int CDECL CRTDLL___iscsymf(int c)
|
|---|
| 413 | {
|
|---|
| 414 | dprintf2(("CRTDLL: __iscsymf\n"));
|
|---|
| 415 | return (isalpha(c) || ( c == '_' )) ;
|
|---|
| 416 | }
|
|---|
| 417 |
|
|---|
| 418 |
|
|---|
| 419 | /*********************************************************************
|
|---|
| 420 | * CRTDLL___pxcptinfoptrs (CRTDLL.32)
|
|---|
| 421 | */
|
|---|
| 422 | void ** CDECL CRTDLL___pxcptinfoptrs (void)
|
|---|
| 423 | {
|
|---|
| 424 | dprintf(("CRTDLL: __pxcptinfoptrs not implemented.\n"));
|
|---|
| 425 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 426 | return NULL;
|
|---|
| 427 | }
|
|---|
| 428 |
|
|---|
| 429 |
|
|---|
| 430 | /*********************************************************************
|
|---|
| 431 | * CRTDLL___threadhandle (CRTDLL.33)
|
|---|
| 432 | */
|
|---|
| 433 | unsigned long CDECL CRTDLL___threadhandle( void )
|
|---|
| 434 | {
|
|---|
| 435 | dprintf2(("CRTDLL: __threadhandle\n"));
|
|---|
| 436 | return GetCurrentThread();
|
|---|
| 437 | }
|
|---|
| 438 |
|
|---|
| 439 |
|
|---|
| 440 | /*********************************************************************
|
|---|
| 441 | * CRTDLL___threadid (CRTDLL.34)
|
|---|
| 442 | */
|
|---|
| 443 | unsigned long CDECL CRTDLL___threadid(void)
|
|---|
| 444 | {
|
|---|
| 445 | dprintf2(("CRTDLL: __threadid\n"));
|
|---|
| 446 | return GetCurrentThreadId();
|
|---|
| 447 | }
|
|---|
| 448 |
|
|---|
| 449 |
|
|---|
| 450 | /*********************************************************************
|
|---|
| 451 | * CRTDLL__abnormal_termination (CRTDLL.36)
|
|---|
| 452 | */
|
|---|
| 453 | int CDECL CRTDLL__abnormal_termination(void)
|
|---|
| 454 | {
|
|---|
| 455 | dprintf(("CRTDLL: _abnormal_termination not implemented.\n"));
|
|---|
| 456 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 457 | return FALSE;
|
|---|
| 458 | }
|
|---|
| 459 |
|
|---|
| 460 |
|
|---|
| 461 | /*********************************************************************
|
|---|
| 462 | * CRTDLL__access (CRTDLL.37)
|
|---|
| 463 | */
|
|---|
| 464 | int CDECL CRTDLL__access(const char *path,int mode)
|
|---|
| 465 | {
|
|---|
| 466 | dprintf2(("CRTDLL: _access\n"));
|
|---|
| 467 | return (_access(path, mode));
|
|---|
| 468 | }
|
|---|
| 469 |
|
|---|
| 470 |
|
|---|
| 471 | /*********************************************************************
|
|---|
| 472 | * CRTDLL___toascii (CRTDLL.38)
|
|---|
| 473 | */
|
|---|
| 474 | int CDECL CRTDLL___toascii(int c)
|
|---|
| 475 | {
|
|---|
| 476 | dprintf2(("CRTDLL: __toascii\n"));
|
|---|
| 477 | return ((unsigned)(c) & 0x7F );
|
|---|
| 478 | }
|
|---|
| 479 |
|
|---|
| 480 |
|
|---|
| 481 | /*********************************************************************
|
|---|
| 482 | * _aexit_rtn_dll (CRTDLL.39)
|
|---|
| 483 | */
|
|---|
| 484 | VOID CDECL CRTDLL__aexit_rtn_dll(int exitcode)
|
|---|
| 485 | {
|
|---|
| 486 | dprintf2(("CRTDLL: _aexit_rtn_dll\n"));
|
|---|
| 487 | ExitProcess(exitcode);
|
|---|
| 488 | }
|
|---|
| 489 |
|
|---|
| 490 |
|
|---|
| 491 | /*********************************************************************
|
|---|
| 492 | * _amsg_exit (CRTDLL.40)
|
|---|
| 493 | */
|
|---|
| 494 | VOID CDECL CRTDLL__amsg_exit(int errnum)
|
|---|
| 495 | {
|
|---|
| 496 | dprintf2(("CRTDLL: _amsg_exit\n"));
|
|---|
| 497 | fprintf(stderr,strerror(errnum));
|
|---|
| 498 | ExitProcess(-1);
|
|---|
| 499 | }
|
|---|
| 500 |
|
|---|
| 501 |
|
|---|
| 502 | /*********************************************************************
|
|---|
| 503 | * CRTDLL__assert (CRTDLL.41)
|
|---|
| 504 | */
|
|---|
| 505 | void CDECL CRTDLL__assert( char *s1, char *s2, int i)
|
|---|
| 506 | {
|
|---|
| 507 | dprintf2(("CRTDLL: _assert\n"));
|
|---|
| 508 | _assert(s1, s2, i);
|
|---|
| 509 | }
|
|---|
| 510 |
|
|---|
| 511 |
|
|---|
| 512 | /*********************************************************************
|
|---|
| 513 | * CRTDLL__beep (CRTDLL.45)
|
|---|
| 514 | */
|
|---|
| 515 | void CDECL CRTDLL__beep(unsigned nFreq, unsigned nDur)
|
|---|
| 516 | {
|
|---|
| 517 | dprintf2(("_beep\n"));
|
|---|
| 518 | Beep(nFreq,nDur);
|
|---|
| 519 | }
|
|---|
| 520 |
|
|---|
| 521 |
|
|---|
| 522 | /*********************************************************************
|
|---|
| 523 | * CRTDLL__beginthread (CRTDLL.46)
|
|---|
| 524 | */
|
|---|
| 525 | unsigned long CDECL CRTDLL__beginthread(void (*pfuncStart)(void *),
|
|---|
| 526 | unsigned unStackSize, void* pArgList)
|
|---|
| 527 | {
|
|---|
| 528 | DWORD ThreadId;
|
|---|
| 529 | HANDLE hThread;
|
|---|
| 530 | if ( pfuncStart == NULL )
|
|---|
| 531 | __set_errno(EINVAL);
|
|---|
| 532 |
|
|---|
| 533 | hThread = CreateThread( NULL,unStackSize,(LPTHREAD_START_ROUTINE)pfuncStart,pArgList,0, &ThreadId);
|
|---|
| 534 | if (hThread == NULL ) {
|
|---|
| 535 | __set_errno(EAGAIN);
|
|---|
| 536 | return -1;
|
|---|
| 537 | }
|
|---|
| 538 | return (unsigned long)hThread;
|
|---|
| 539 | }
|
|---|
| 540 |
|
|---|
| 541 |
|
|---|
| 542 | /*********************************************************************
|
|---|
| 543 | * _c_exit (CRTDLL.47)
|
|---|
| 544 | *
|
|---|
| 545 | */
|
|---|
| 546 | void CDECL CRTDLL__c_exit(INT ret)
|
|---|
| 547 | {
|
|---|
| 548 | dprintf2(("_c_exit(%d)\n",ret));
|
|---|
| 549 | ExitProcess(ret);
|
|---|
| 550 | }
|
|---|
| 551 |
|
|---|
| 552 |
|
|---|
| 553 | /*********************************************************************
|
|---|
| 554 | * CRTDLL__cabs (CRTDLL.48)
|
|---|
| 555 | */
|
|---|
| 556 | double CDECL CRTDLL__cabs(struct _complex z)
|
|---|
| 557 | {
|
|---|
| 558 | dprintf2(("CRTDLL: _cabs\n"));
|
|---|
| 559 | return sqrt( z.x*z.x + z.y*z.y );
|
|---|
| 560 | }
|
|---|
| 561 |
|
|---|
| 562 |
|
|---|
| 563 | /*********************************************************************
|
|---|
| 564 | * _cexit (CRTDLL.49)
|
|---|
| 565 | */
|
|---|
| 566 | void CDECL CRTDLL__cexit(INT ret)
|
|---|
| 567 | {
|
|---|
| 568 | dprintf2(("_cexit(%d)\n",ret));
|
|---|
| 569 | ExitProcess(ret);
|
|---|
| 570 | }
|
|---|
| 571 |
|
|---|
| 572 |
|
|---|
| 573 | /*********************************************************************
|
|---|
| 574 | * CRTDLL__cgets (CRTDLL.50)
|
|---|
| 575 | */
|
|---|
| 576 | char * CDECL CRTDLL__cgets( char *s )
|
|---|
| 577 | {
|
|---|
| 578 | dprintf2(("CRTDLL: _cgets\n"));
|
|---|
| 579 | return (_cgets(s));
|
|---|
| 580 | }
|
|---|
| 581 |
|
|---|
| 582 |
|
|---|
| 583 | /*********************************************************************
|
|---|
| 584 | * _chdir (CRTDLL.51)
|
|---|
| 585 | */
|
|---|
| 586 | INT CDECL CRTDLL__chdir(LPCSTR newdir)
|
|---|
| 587 | {
|
|---|
| 588 | dprintf2(("CRTDLL: chdir\n"));
|
|---|
| 589 | if (!SetCurrentDirectoryA(newdir))
|
|---|
| 590 | return 1;
|
|---|
| 591 | return 0;
|
|---|
| 592 | }
|
|---|
| 593 |
|
|---|
| 594 |
|
|---|
| 595 | /*********************************************************************
|
|---|
| 596 | * _chdrive (CRTDLL.52)
|
|---|
| 597 | *
|
|---|
| 598 | * newdir [I] drive to change to, A=1
|
|---|
| 599 | *
|
|---|
| 600 | */
|
|---|
| 601 | BOOL CDECL CRTDLL__chdrive(INT newdrive)
|
|---|
| 602 | {
|
|---|
| 603 | /* FIXME: generates errnos */
|
|---|
| 604 | dprintf2(("CRTDLL: _chdrive\n"));
|
|---|
| 605 | return DRIVE_SetCurrentDrive(newdrive-1);
|
|---|
| 606 | }
|
|---|
| 607 |
|
|---|
| 608 |
|
|---|
| 609 | /*********************************************************************
|
|---|
| 610 | * CRTDLL__chgsign (CRTDLL.53)
|
|---|
| 611 | */
|
|---|
| 612 | double CDECL CRTDLL__chgsign(double __x)
|
|---|
| 613 | {
|
|---|
| 614 | dprintf2(("CRTDLL: _chgsign\n"));
|
|---|
| 615 | double_t *x = (double_t *)&x;
|
|---|
| 616 | if ( x->sign == 1 )
|
|---|
| 617 | x->sign = 0;
|
|---|
| 618 | else
|
|---|
| 619 | x->sign = 1;
|
|---|
| 620 |
|
|---|
| 621 | return __x;
|
|---|
| 622 | }
|
|---|
| 623 |
|
|---|
| 624 |
|
|---|
| 625 | /*********************************************************************
|
|---|
| 626 | * CRTDLL__chmod (CRTDLL.54)
|
|---|
| 627 | */
|
|---|
| 628 | int CDECL CRTDLL__chmod( const char *s, int i)
|
|---|
| 629 | {
|
|---|
| 630 | dprintf2(("CRTDLL: _chmod\n"));
|
|---|
| 631 | return (_chmod(s, i));
|
|---|
| 632 | }
|
|---|
| 633 |
|
|---|
| 634 |
|
|---|
| 635 | /*********************************************************************
|
|---|
| 636 | * CRTDLL__chsize (CRTDLL.55)
|
|---|
| 637 | */
|
|---|
| 638 | int CDECL CRTDLL__chsize( int i, long l )
|
|---|
| 639 | {
|
|---|
| 640 | dprintf2(("CRTDLL: _chsize\n"));
|
|---|
| 641 | return (_chsize(i, l));
|
|---|
| 642 | }
|
|---|
| 643 |
|
|---|
| 644 |
|
|---|
| 645 | /*********************************************************************
|
|---|
| 646 | * CRTDLL__clearfp (CRTDLL.56)
|
|---|
| 647 | */
|
|---|
| 648 | unsigned int CDECL CRTDLL__clearfp( void )
|
|---|
| 649 | {
|
|---|
| 650 | dprintf2(("CRTDLL: _clearfp\n"));
|
|---|
| 651 | return (_clear87());
|
|---|
| 652 | }
|
|---|
| 653 |
|
|---|
| 654 |
|
|---|
| 655 | /*********************************************************************
|
|---|
| 656 | * CRTDLL__close (CRTDLL.57)
|
|---|
| 657 | */
|
|---|
| 658 | int CDECL CRTDLL__close(int handle)
|
|---|
| 659 | {
|
|---|
| 660 | dprintf2(("CRTDLL: _close\n"));
|
|---|
| 661 | return (_close(handle));
|
|---|
| 662 | }
|
|---|
| 663 |
|
|---|
| 664 |
|
|---|
| 665 | /*********************************************************************
|
|---|
| 666 | * CRTDLL__commit (CRTDLL.58)
|
|---|
| 667 | */
|
|---|
| 668 | int CDECL CRTDLL__commit( int _fd )
|
|---|
| 669 | {
|
|---|
| 670 | dprintf2(("CRTDLL: _commit\n"));
|
|---|
| 671 | if (! FlushFileBuffers((HFILE)CRTDLL__get_osfhandle(_fd)) ) {
|
|---|
| 672 | __set_errno(EBADF);
|
|---|
| 673 | return -1;
|
|---|
| 674 | }
|
|---|
| 675 | return 0;
|
|---|
| 676 | }
|
|---|
| 677 |
|
|---|
| 678 |
|
|---|
| 679 | /*********************************************************************
|
|---|
| 680 | * CRTDLL__control87 (CRTDLL.60)
|
|---|
| 681 | */
|
|---|
| 682 | unsigned CDECL CRTDLL__control87(unsigned i1,unsigned i2)
|
|---|
| 683 | {
|
|---|
| 684 | dprintf2(("CRTDLL: _control87\n"));
|
|---|
| 685 | return (_control87(i1, i2));
|
|---|
| 686 | }
|
|---|
| 687 |
|
|---|
| 688 |
|
|---|
| 689 | /*********************************************************************
|
|---|
| 690 | * CRTDLL__controlfp (CRTDLL.61)
|
|---|
| 691 | */
|
|---|
| 692 | unsigned CDECL CRTDLL__controlfp(unsigned i1,unsigned i2)
|
|---|
| 693 | {
|
|---|
| 694 | dprintf2(("CRTDLL: _controlfp\n"));
|
|---|
| 695 | return (_control87(i1, i2));
|
|---|
| 696 | }
|
|---|
| 697 |
|
|---|
| 698 |
|
|---|
| 699 | /*********************************************************************
|
|---|
| 700 | * CRTDLL__copysign (CRTDLL.62)
|
|---|
| 701 | */
|
|---|
| 702 | double CDECL CRTDLL__copysign( double __d, double __s )
|
|---|
| 703 | {
|
|---|
| 704 | dprintf2(("CRTDLL: _copysign\n"));
|
|---|
| 705 | double_t *d = (double_t *)&__d;
|
|---|
| 706 | double_t *s = (double_t *)&__s;
|
|---|
| 707 |
|
|---|
| 708 | d->sign = s->sign;
|
|---|
| 709 |
|
|---|
| 710 | return __d;
|
|---|
| 711 | }
|
|---|
| 712 |
|
|---|
| 713 |
|
|---|
| 714 | /*********************************************************************
|
|---|
| 715 | * _cprintf (CRTDLL.63)
|
|---|
| 716 | */
|
|---|
| 717 | INT CDECL CRTDLL__cprintf( char *fmt, ... )
|
|---|
| 718 | {
|
|---|
| 719 | dprintf2(("CRTDLL: _cprintf.\n"));
|
|---|
| 720 |
|
|---|
| 721 | int cnt;
|
|---|
| 722 | char buf[ 2048 ]; /* this is buggy, because buffer might be too small. */
|
|---|
| 723 | va_list ap;
|
|---|
| 724 |
|
|---|
| 725 | va_start(ap, fmt);
|
|---|
| 726 | cnt = vsprintf(buf, fmt, ap);
|
|---|
| 727 | va_end(ap);
|
|---|
| 728 |
|
|---|
| 729 | _cputs(buf);
|
|---|
| 730 | return cnt;
|
|---|
| 731 | }
|
|---|
| 732 |
|
|---|
| 733 |
|
|---|
| 734 | /*********************************************************************
|
|---|
| 735 | * CRTDLL__cputs (CRTDLL.65)
|
|---|
| 736 | */
|
|---|
| 737 | INT CDECL CRTDLL__cputs( char * s )
|
|---|
| 738 | {
|
|---|
| 739 | dprintf2(("CRTDLL: _cputs\n"));
|
|---|
| 740 | return (_cputs(s));
|
|---|
| 741 | }
|
|---|
| 742 |
|
|---|
| 743 |
|
|---|
| 744 | /*********************************************************************
|
|---|
| 745 | * CRTDLL__creat (CRTDLL.66)
|
|---|
| 746 | */
|
|---|
| 747 | INT CDECL CRTDLL__creat( const char *s, int i )
|
|---|
| 748 | {
|
|---|
| 749 | dprintf2(("CRTDLL: _creat\n"));
|
|---|
| 750 | return (_creat(s, i));
|
|---|
| 751 | }
|
|---|
| 752 |
|
|---|
| 753 |
|
|---|
| 754 | /*********************************************************************
|
|---|
| 755 | * CRTDLL__cscanf (CRTDLL.67)
|
|---|
| 756 | */
|
|---|
| 757 | INT CDECL CRTDLL__cscanf( char *s, ... )
|
|---|
| 758 | {
|
|---|
| 759 | dprintf(("CRTDLL: _cscanf not implemented.\n"));
|
|---|
| 760 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 761 | return FALSE;
|
|---|
| 762 | }
|
|---|
| 763 |
|
|---|
| 764 |
|
|---|
| 765 | /*********************************************************************
|
|---|
| 766 | * CRTDLL__cwait (CRTDLL.69)
|
|---|
| 767 | */
|
|---|
| 768 | int CDECL CRTDLL__cwait( int *status, int process_id, int action_code )
|
|---|
| 769 | {
|
|---|
| 770 | dprintf2(("CRTDLL: _cwait\n"));
|
|---|
| 771 | return (_cwait(status, process_id, action_code));
|
|---|
| 772 | }
|
|---|
| 773 |
|
|---|
| 774 |
|
|---|
| 775 | /*********************************************************************
|
|---|
| 776 | * CRTDLL__dup (CRTDLL.71)
|
|---|
| 777 | */
|
|---|
| 778 | int CDECL CRTDLL__dup(int handle)
|
|---|
| 779 | {
|
|---|
| 780 | dprintf2(("CRTDLL: _dup\n"));
|
|---|
| 781 | return (_dup(handle));
|
|---|
| 782 | }
|
|---|
| 783 |
|
|---|
| 784 |
|
|---|
| 785 | /*********************************************************************
|
|---|
| 786 | * CRTDLL__dup2 (CRTDLL.72)
|
|---|
| 787 | */
|
|---|
| 788 | int CDECL CRTDLL__dup2(int handle1,int handle2)
|
|---|
| 789 | {
|
|---|
| 790 | dprintf2(("CRTDLL: _dup2\n"));
|
|---|
| 791 | return (_dup2(handle1, handle2));
|
|---|
| 792 | }
|
|---|
| 793 |
|
|---|
| 794 |
|
|---|
| 795 | /*********************************************************************
|
|---|
| 796 | * CRTDLL__ecvt (CRTDLL.73)
|
|---|
| 797 | */
|
|---|
| 798 | char * CDECL CRTDLL__ecvt( double val, int ndig, int *dec, int *sign )
|
|---|
| 799 | {
|
|---|
| 800 | dprintf2(("CRTDLL: _ecvt\n"));
|
|---|
| 801 | return (_ecvt(val, ndig, dec, sign));
|
|---|
| 802 | }
|
|---|
| 803 |
|
|---|
| 804 |
|
|---|
| 805 | /*********************************************************************
|
|---|
| 806 | * CRTDLL__endthread (CRTDLL.74)
|
|---|
| 807 | */
|
|---|
| 808 | void CDECL CRTDLL__endthread(void)
|
|---|
| 809 | {
|
|---|
| 810 | dprintf2(("CRTDLL: _endthread\n"));
|
|---|
| 811 | _endthread ();
|
|---|
| 812 | }
|
|---|
| 813 |
|
|---|
| 814 |
|
|---|
| 815 | /*********************************************************************
|
|---|
| 816 | * CRTDLL___eof (CRTDLL.76)
|
|---|
| 817 | */
|
|---|
| 818 | int CDECL CRTDLL__eof( int _fd )
|
|---|
| 819 | {
|
|---|
| 820 | dprintf2(("CRTDLL: _eof\n"));
|
|---|
| 821 | int cur_pos = CRTDLL__lseek(_fd, 0, SEEK_CUR);
|
|---|
| 822 | int end_pos = CRTDLL__filelength( _fd );
|
|---|
| 823 | if ( cur_pos == -1 || end_pos == -1)
|
|---|
| 824 | return -1;
|
|---|
| 825 |
|
|---|
| 826 | if ( cur_pos == end_pos )
|
|---|
| 827 | return 1;
|
|---|
| 828 |
|
|---|
| 829 | return 0;
|
|---|
| 830 | }
|
|---|
| 831 |
|
|---|
| 832 |
|
|---|
| 833 | /*********************************************************************
|
|---|
| 834 | * CRTDLL__errno (CRTDLL.77)
|
|---|
| 835 | */
|
|---|
| 836 | int * CDECL CRTDLL__errno(void)
|
|---|
| 837 | {
|
|---|
| 838 | dprintf2(("CRTDLL: _errno\n"));
|
|---|
| 839 | return (_errno());
|
|---|
| 840 | }
|
|---|
| 841 |
|
|---|
| 842 |
|
|---|
| 843 | /*********************************************************************
|
|---|
| 844 | * _except_handler2 (CRTDLL.78)
|
|---|
| 845 | */
|
|---|
| 846 | INT CDECL CRTDLL__except_handler2 ( PEXCEPTION_RECORD rec,
|
|---|
| 847 | PEXCEPTION_FRAME frame, PCONTEXT context,
|
|---|
| 848 | PEXCEPTION_FRAME *dispatcher)
|
|---|
| 849 | {
|
|---|
| 850 | dprintf2(("CRTDLL: _except_handler2\n"));
|
|---|
| 851 | return 1;
|
|---|
| 852 | }
|
|---|
| 853 |
|
|---|
| 854 |
|
|---|
| 855 | /*********************************************************************
|
|---|
| 856 | * _execl (CRTDLL.79)
|
|---|
| 857 | */
|
|---|
| 858 | int CDECL CRTDLL__execl(const char* szPath, const char* szArgv0, ...)
|
|---|
| 859 | {
|
|---|
| 860 | dprintf2(("CRTDLL: _execl\n"));
|
|---|
| 861 |
|
|---|
| 862 | char *szArg[100];
|
|---|
| 863 | const char *a;
|
|---|
| 864 | int i = 0;
|
|---|
| 865 | va_list l = 0;
|
|---|
| 866 | va_start(l,szArgv0);
|
|---|
| 867 | do {
|
|---|
| 868 | a = va_arg(l,const char *);
|
|---|
| 869 | szArg[i++] = (char *)a;
|
|---|
| 870 | } while ( a != NULL && i < 100 );
|
|---|
| 871 |
|
|---|
| 872 | return _spawnve(P_OVERLAY, (char*)szPath, szArg, _environ);
|
|---|
| 873 | }
|
|---|
| 874 |
|
|---|
| 875 |
|
|---|
| 876 | /*********************************************************************
|
|---|
| 877 | * CRTDLL__execle (CRTDLL.80)
|
|---|
| 878 | */
|
|---|
| 879 | int CDECL CRTDLL__execle(char *path, char *szArgv0, ...)
|
|---|
| 880 | {
|
|---|
| 881 | dprintf2(("CRTDLL: _execle not correct implemented.\n"));
|
|---|
| 882 | char *szArg[100];
|
|---|
| 883 | const char *a;
|
|---|
| 884 | char *ptr;
|
|---|
| 885 | int i = 0;
|
|---|
| 886 | va_list l = 0;
|
|---|
| 887 | va_start(l,szArgv0);
|
|---|
| 888 | do {
|
|---|
| 889 | a = (const char *)va_arg(l,const char *);
|
|---|
| 890 | szArg[i++] = (char *)a;
|
|---|
| 891 | } while ( a != NULL && i < 100 );
|
|---|
| 892 |
|
|---|
| 893 |
|
|---|
| 894 | // szArg0 is passed and not environment if there is only one parameter;
|
|---|
| 895 |
|
|---|
| 896 | if ( i >=2 ) {
|
|---|
| 897 | ptr = szArg[i-2];
|
|---|
| 898 | szArg[i-2] = NULL;
|
|---|
| 899 | }
|
|---|
| 900 | else
|
|---|
| 901 | ptr = NULL;
|
|---|
| 902 |
|
|---|
| 903 | return _spawnve(P_OVERLAY, path, szArg, (char**)ptr);
|
|---|
| 904 | }
|
|---|
| 905 |
|
|---|
| 906 |
|
|---|
| 907 | /*********************************************************************
|
|---|
| 908 | * CRTDLL__execlp (CRTDLL.81)
|
|---|
| 909 | */
|
|---|
| 910 | int CDECL CRTDLL__execlp( char *szPath, char *szArgv0, ...)
|
|---|
| 911 | {
|
|---|
| 912 | dprintf2(("CRTDLL: _execlp\n"));
|
|---|
| 913 | char *szArg[100];
|
|---|
| 914 | const char *a;
|
|---|
| 915 | int i = 0;
|
|---|
| 916 | va_list l = 0;
|
|---|
| 917 | va_start(l,szArgv0);
|
|---|
| 918 | do {
|
|---|
| 919 | a = (const char *)va_arg(l,const char *);
|
|---|
| 920 | szArg[i++] = (char *)a;
|
|---|
| 921 | } while ( a != NULL && i < 100 );
|
|---|
| 922 | return _spawnvpe(P_OVERLAY, szPath,szArg, _environ);
|
|---|
| 923 | }
|
|---|
| 924 |
|
|---|
| 925 |
|
|---|
| 926 | /*********************************************************************
|
|---|
| 927 | * CRTDLL__execlpe (CRTDLL.82)
|
|---|
| 928 | */
|
|---|
| 929 | int CDECL CRTDLL__execlpe( char *path, char *szArgv0, ...)
|
|---|
| 930 | {
|
|---|
| 931 | dprintf2(("CRTDLL: _execlpe not correct implemented.\n"));
|
|---|
| 932 | char *szArg[100];
|
|---|
| 933 | const char *a;
|
|---|
| 934 | char *ptr;
|
|---|
| 935 | int i = 0;
|
|---|
| 936 | va_list l = 0;
|
|---|
| 937 | va_start(l,szArgv0);
|
|---|
| 938 | do {
|
|---|
| 939 | a = (const char *)va_arg(l,const char *);
|
|---|
| 940 | szArg[i++] = (char *)a;
|
|---|
| 941 | } while ( a != NULL && i < 100 );
|
|---|
| 942 |
|
|---|
| 943 |
|
|---|
| 944 | // szArg0 is passed and not environment if there is only one parameter;
|
|---|
| 945 |
|
|---|
| 946 | if ( i >=2 ) {
|
|---|
| 947 | ptr = szArg[i-2];
|
|---|
| 948 | szArg[i-2] = NULL;
|
|---|
| 949 | }
|
|---|
| 950 | else
|
|---|
| 951 | ptr = NULL;
|
|---|
| 952 | return spawnvpe(P_OVERLAY, path, szArg, (char**)ptr);
|
|---|
| 953 | }
|
|---|
| 954 |
|
|---|
| 955 |
|
|---|
| 956 | /*********************************************************************
|
|---|
| 957 | * CRTDLL__execv (CRTDLL.83)
|
|---|
| 958 | */
|
|---|
| 959 | int CDECL CRTDLL__execv( char *s1, char **s2)
|
|---|
| 960 | {
|
|---|
| 961 | dprintf2(("CRTDLL: _execv\n"));
|
|---|
| 962 | return (_execv(s1, s2));
|
|---|
| 963 | }
|
|---|
| 964 |
|
|---|
| 965 |
|
|---|
| 966 | /*********************************************************************
|
|---|
| 967 | * CRTDLL__execve (CRTDLL.84)
|
|---|
| 968 | */
|
|---|
| 969 | int CDECL CRTDLL__execve( char *s1, char **s2, char **s3)
|
|---|
| 970 | {
|
|---|
| 971 | dprintf2(("CRTDLL: _execve\n"));
|
|---|
| 972 | return (_execve(s1, s2, s3));
|
|---|
| 973 | }
|
|---|
| 974 |
|
|---|
| 975 |
|
|---|
| 976 | /*********************************************************************
|
|---|
| 977 | * CRTDLL__execvp (CRTDLL.85)
|
|---|
| 978 | */
|
|---|
| 979 | int CDECL CRTDLL__execvp( char *s1, char **s2)
|
|---|
| 980 | {
|
|---|
| 981 | dprintf2(("CRTDLL: _execvp\n"));
|
|---|
| 982 | return (_execvp(s1, s2));
|
|---|
| 983 | }
|
|---|
| 984 |
|
|---|
| 985 |
|
|---|
| 986 | /*********************************************************************
|
|---|
| 987 | * CRTDLL__execvpe (CRTDLL.86)
|
|---|
| 988 | */
|
|---|
| 989 | int CDECL CRTDLL__execvpe( char *s1, char **s2, char **s3)
|
|---|
| 990 | {
|
|---|
| 991 | dprintf2(("CRTDLL: _execvpe\n"));
|
|---|
| 992 | return (_execvpe(s1, s2, s3));
|
|---|
| 993 | }
|
|---|
| 994 |
|
|---|
| 995 |
|
|---|
| 996 | /*********************************************************************
|
|---|
| 997 | * _exit (CRTDLL.87)
|
|---|
| 998 | */
|
|---|
| 999 | VOID CDECL CRTDLL__exit(DWORD ret)
|
|---|
| 1000 | {
|
|---|
| 1001 | dprintf2(("CRTDLL: _exit\n"));
|
|---|
| 1002 | ExitProcess(ret);
|
|---|
| 1003 | }
|
|---|
| 1004 |
|
|---|
| 1005 |
|
|---|
| 1006 | /*********************************************************************
|
|---|
| 1007 | * _expand (CRTDLL.88)
|
|---|
| 1008 | */
|
|---|
| 1009 | void * CDECL CRTDLL__expand( void *ptr, size_t size )
|
|---|
| 1010 | {
|
|---|
| 1011 | dprintf(("CRTDLL: _expand not implemented.\n"));
|
|---|
| 1012 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1013 | return FALSE;
|
|---|
| 1014 | }
|
|---|
| 1015 |
|
|---|
| 1016 |
|
|---|
| 1017 | /*********************************************************************
|
|---|
| 1018 | * _fcloseall (CRTDLL.89)
|
|---|
| 1019 | */
|
|---|
| 1020 | int CDECL CRTDLL__fcloseall( void )
|
|---|
| 1021 | {
|
|---|
| 1022 | dprintf2(("CRTDLL: _fcloseall\n"));
|
|---|
| 1023 | return (_fcloseall());
|
|---|
| 1024 | }
|
|---|
| 1025 |
|
|---|
| 1026 |
|
|---|
| 1027 | /*********************************************************************
|
|---|
| 1028 | * _fcvt (CRTDLL.90)
|
|---|
| 1029 | */
|
|---|
| 1030 | char * CDECL CRTDLL__fcvt( double val, int ndig, int *dec, int *sign )
|
|---|
| 1031 | {
|
|---|
| 1032 | dprintf2(("CRTDLL: _fcvt\n"));
|
|---|
| 1033 | return (_fcvt(val, ndig, dec, sign));
|
|---|
| 1034 | }
|
|---|
| 1035 |
|
|---|
| 1036 |
|
|---|
| 1037 | /*********************************************************************
|
|---|
| 1038 | * _fdopen (CRTDLL.91)
|
|---|
| 1039 | */
|
|---|
| 1040 | CRTDLL_FILE * CDECL CRTDLL__fdopen(INT handle, LPCSTR mode)
|
|---|
| 1041 | {
|
|---|
| 1042 | dprintf2(("CRTDLL: fdopen\n"));
|
|---|
| 1043 | CRTDLL_FILE *file;
|
|---|
| 1044 |
|
|---|
| 1045 | switch (handle)
|
|---|
| 1046 | {
|
|---|
| 1047 | case 0:
|
|---|
| 1048 | file = CRTDLL_stdin;
|
|---|
| 1049 | if (!file->handle) file->handle = GetStdHandle( STD_INPUT_HANDLE );
|
|---|
| 1050 | break;
|
|---|
| 1051 | case 1:
|
|---|
| 1052 | file = CRTDLL_stdout;
|
|---|
| 1053 | if (!file->handle) file->handle = GetStdHandle( STD_OUTPUT_HANDLE );
|
|---|
| 1054 | break;
|
|---|
| 1055 | case 2:
|
|---|
| 1056 | file=CRTDLL_stderr;
|
|---|
| 1057 | if (!file->handle) file->handle = GetStdHandle( STD_ERROR_HANDLE );
|
|---|
| 1058 | break;
|
|---|
| 1059 | default:
|
|---|
| 1060 | file = (PCRTDLL_FILE)Heap_Alloc(sizeof(*file) );
|
|---|
| 1061 | file->handle = handle;
|
|---|
| 1062 | break;
|
|---|
| 1063 | }
|
|---|
| 1064 | return file;
|
|---|
| 1065 | }
|
|---|
| 1066 |
|
|---|
| 1067 |
|
|---|
| 1068 | /*********************************************************************
|
|---|
| 1069 | * _fgetchar (CRTDLL.92)
|
|---|
| 1070 | */
|
|---|
| 1071 | int CDECL CRTDLL__fgetchar( void )
|
|---|
| 1072 | {
|
|---|
| 1073 | dprintf2(("CRTDLL: _fgetchar\n"));
|
|---|
| 1074 | return (_fgetchar());
|
|---|
| 1075 | }
|
|---|
| 1076 |
|
|---|
| 1077 |
|
|---|
| 1078 | /*********************************************************************
|
|---|
| 1079 | * _fgetwchar (CRTDLL.93)
|
|---|
| 1080 | */
|
|---|
| 1081 | wint_t CDECL CRTDLL__fgetwchar( void *i )
|
|---|
| 1082 | {
|
|---|
| 1083 | dprintf2(("CRTDLL: _fgetwchar\n"));
|
|---|
| 1084 | return CRTDLL__getch();
|
|---|
| 1085 | }
|
|---|
| 1086 |
|
|---|
| 1087 |
|
|---|
| 1088 | /*********************************************************************
|
|---|
| 1089 | * _filbuf (CRTDLL.94)
|
|---|
| 1090 | */
|
|---|
| 1091 | int CDECL CRTDLL__filbuf(FILE * f)
|
|---|
| 1092 | {
|
|---|
| 1093 | dprintf(("CRTDLL: _filbuf not implemented.\n"));
|
|---|
| 1094 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1095 | return FALSE;
|
|---|
| 1096 | }
|
|---|
| 1097 |
|
|---|
| 1098 |
|
|---|
| 1099 | /*********************************************************************
|
|---|
| 1100 | * CRTDLL__filelength (CRTDLL.96)
|
|---|
| 1101 | */
|
|---|
| 1102 | long CDECL CRTDLL__filelength( int i )
|
|---|
| 1103 | {
|
|---|
| 1104 | dprintf2(("CRTDLL: _filelength\n"));
|
|---|
| 1105 | return (_filelength(i));
|
|---|
| 1106 | }
|
|---|
| 1107 |
|
|---|
| 1108 |
|
|---|
| 1109 | /*********************************************************************
|
|---|
| 1110 | * _fileno (CRTDLL.97)
|
|---|
| 1111 | */
|
|---|
| 1112 | int CDECL CRTDLL__fileno(FILE * f)
|
|---|
| 1113 | {
|
|---|
| 1114 | dprintf2(("CRTDLL: _fileno\n"));
|
|---|
| 1115 | return (_fileno(f));
|
|---|
| 1116 | }
|
|---|
| 1117 |
|
|---|
| 1118 |
|
|---|
| 1119 | /*********************************************************************
|
|---|
| 1120 | * _findclose (CRTDLL.098)
|
|---|
| 1121 | */
|
|---|
| 1122 | int CDECL CRTDLL__findclose( long handle )
|
|---|
| 1123 | {
|
|---|
| 1124 | dprintf2(("CRTDLL: _findclose\n"));
|
|---|
| 1125 | // check no wildcards or invalid handle
|
|---|
| 1126 | if ( handle == 0 || handle == -1)
|
|---|
| 1127 | return 0;
|
|---|
| 1128 | return FindClose(handle);
|
|---|
| 1129 | }
|
|---|
| 1130 |
|
|---|
| 1131 |
|
|---|
| 1132 | /*********************************************************************
|
|---|
| 1133 | * _findfirst (CRTDLL.099)
|
|---|
| 1134 | */
|
|---|
| 1135 | DWORD CDECL CRTDLL__findfirst(LPCSTR fname, struct find_t * x2)
|
|---|
| 1136 | {
|
|---|
| 1137 | dprintf(("CRTDLL: _findfirst not implemented.\n"));
|
|---|
| 1138 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1139 | return FALSE;
|
|---|
| 1140 | }
|
|---|
| 1141 |
|
|---|
| 1142 |
|
|---|
| 1143 | /*********************************************************************
|
|---|
| 1144 | * _findnext (CRTDLL.100)
|
|---|
| 1145 | */
|
|---|
| 1146 | INT CDECL CRTDLL__findnext(DWORD hand, struct find_t * x2)
|
|---|
| 1147 | {
|
|---|
| 1148 | dprintf(("CRTDLL: _findnext not implemented.\n"));
|
|---|
| 1149 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1150 | return FALSE;
|
|---|
| 1151 | }
|
|---|
| 1152 |
|
|---|
| 1153 |
|
|---|
| 1154 | /*********************************************************************
|
|---|
| 1155 | * _finite (CRTDLL.101)
|
|---|
| 1156 | */
|
|---|
| 1157 | INT CDECL CRTDLL__finite(double x)
|
|---|
| 1158 | {
|
|---|
| 1159 | dprintf2(("CRTDLL: _finite\n"));
|
|---|
| 1160 | return !_isinf(x);
|
|---|
| 1161 | }
|
|---|
| 1162 |
|
|---|
| 1163 |
|
|---|
| 1164 | /*********************************************************************
|
|---|
| 1165 | * _flsbuf (CRTDLL.102)
|
|---|
| 1166 | */
|
|---|
| 1167 | INT CDECL CRTDLL__flsbuf(int i, FILE * f)
|
|---|
| 1168 | {
|
|---|
| 1169 | dprintf(("CRTDLL: _flsbuf not implemented.\n"));
|
|---|
| 1170 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1171 | return FALSE;
|
|---|
| 1172 | }
|
|---|
| 1173 |
|
|---|
| 1174 |
|
|---|
| 1175 | /*********************************************************************
|
|---|
| 1176 | * _flushall (CRTDLL.103)
|
|---|
| 1177 | */
|
|---|
| 1178 | INT CDECL CRTDLL__flushall(void)
|
|---|
| 1179 | {
|
|---|
| 1180 | dprintf2(("CRTDLL: _flushall\n"));
|
|---|
| 1181 | return (_flushall());
|
|---|
| 1182 | }
|
|---|
| 1183 |
|
|---|
| 1184 |
|
|---|
| 1185 | /*********************************************************************
|
|---|
| 1186 | * _fpclass (CRTDLL.105)
|
|---|
| 1187 | */
|
|---|
| 1188 | INT CDECL CRTDLL__fpclass( double __d )
|
|---|
| 1189 | {
|
|---|
| 1190 | dprintf2(("CRTDLL: _fpclass\n"));
|
|---|
| 1191 | double_t *d = (double_t *)&__d;
|
|---|
| 1192 |
|
|---|
| 1193 | if ( d->exponent == 0 ) {
|
|---|
| 1194 | if ( d->mantissah == 0 && d->mantissal == 0 ) {
|
|---|
| 1195 | if ( d->sign ==0 )
|
|---|
| 1196 | return FP_NZERO;
|
|---|
| 1197 | else
|
|---|
| 1198 | return FP_PZERO;
|
|---|
| 1199 | } else {
|
|---|
| 1200 | if ( d->sign ==0 )
|
|---|
| 1201 | return FP_NDENORM;
|
|---|
| 1202 | else
|
|---|
| 1203 | return FP_PDENORM;
|
|---|
| 1204 | }
|
|---|
| 1205 | }
|
|---|
| 1206 | if (d->exponent == 0x7ff ) {
|
|---|
| 1207 | if ( d->mantissah == 0 && d->mantissal == 0 ) {
|
|---|
| 1208 | if ( d->sign ==0 )
|
|---|
| 1209 | return FP_NINF;
|
|---|
| 1210 | else
|
|---|
| 1211 | return FP_PINF;
|
|---|
| 1212 | }
|
|---|
| 1213 | else if ( d->mantissah == 0 && d->mantissal != 0 ) {
|
|---|
| 1214 | return FP_QNAN;
|
|---|
| 1215 | }
|
|---|
| 1216 | else if ( d->mantissah == 0 && d->mantissal != 0 ) {
|
|---|
| 1217 | return FP_SNAN;
|
|---|
| 1218 | }
|
|---|
| 1219 |
|
|---|
| 1220 | }
|
|---|
| 1221 |
|
|---|
| 1222 | return 0;
|
|---|
| 1223 | }
|
|---|
| 1224 |
|
|---|
| 1225 |
|
|---|
| 1226 | /*********************************************************************
|
|---|
| 1227 | * _fpieee_flt (CRTDLL.106)
|
|---|
| 1228 | */
|
|---|
| 1229 | INT CDECL CRTDLL__fpieee_flt( unsigned long exc_code, struct _EXCEPTION_POINTERS *exc_info, int handler)
|
|---|
| 1230 | {
|
|---|
| 1231 | dprintf(("CRTDLL: _fpieee_flt not implemented.\n"));
|
|---|
| 1232 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1233 | return 0;
|
|---|
| 1234 | }
|
|---|
| 1235 |
|
|---|
| 1236 |
|
|---|
| 1237 |
|
|---|
| 1238 | /*********************************************************************
|
|---|
| 1239 | * _fpreset (CRTDLL.107)
|
|---|
| 1240 | */
|
|---|
| 1241 | void CDECL CRTDLL__fpreset(void)
|
|---|
| 1242 | {
|
|---|
| 1243 | dprintf(("CRTDLL: _fpreset not implemented.\n"));
|
|---|
| 1244 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1245 | }
|
|---|
| 1246 |
|
|---|
| 1247 |
|
|---|
| 1248 | /*********************************************************************
|
|---|
| 1249 | * _fputchar (CRTDLL.108)
|
|---|
| 1250 | */
|
|---|
| 1251 | INT CDECL CRTDLL__fputchar( int c )
|
|---|
| 1252 | {
|
|---|
| 1253 | dprintf2(("CRTDLL: _fputchar\n"));
|
|---|
| 1254 | return(_fputchar(c));
|
|---|
| 1255 | }
|
|---|
| 1256 |
|
|---|
| 1257 |
|
|---|
| 1258 | /*********************************************************************
|
|---|
| 1259 | * _fputwchar (CRTDLL.109)
|
|---|
| 1260 | */
|
|---|
| 1261 | wint_t CDECL CRTDLL__fputwchar( wint_t )
|
|---|
| 1262 | {
|
|---|
| 1263 | dprintf(("CRTDLL: _fputwchar not implemented.\n"));
|
|---|
| 1264 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1265 | return FALSE;
|
|---|
| 1266 | }
|
|---|
| 1267 |
|
|---|
| 1268 |
|
|---|
| 1269 | /*********************************************************************
|
|---|
| 1270 | * _fsopen (CRTDLL.110)
|
|---|
| 1271 | */
|
|---|
| 1272 | FILE * CDECL CRTDLL__fsopen( const char *file, const char *mode, int shflag )
|
|---|
| 1273 | {
|
|---|
| 1274 | dprintf(("CRTDLL: _fsopen not implemented.\n"));
|
|---|
| 1275 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1276 | return FALSE;
|
|---|
| 1277 | }
|
|---|
| 1278 |
|
|---|
| 1279 |
|
|---|
| 1280 | /*********************************************************************
|
|---|
| 1281 | * _fstat (CRTDLL.111)
|
|---|
| 1282 | */
|
|---|
| 1283 | int CDECL CRTDLL__fstat(int file, struct stat* buf)
|
|---|
| 1284 | {
|
|---|
| 1285 | dprintf(("CRTDLL: _fstat not implemented.\n"));
|
|---|
| 1286 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1287 | return FALSE;
|
|---|
| 1288 | }
|
|---|
| 1289 |
|
|---|
| 1290 |
|
|---|
| 1291 | /*********************************************************************
|
|---|
| 1292 | * _ftime (CRTDLL.112)
|
|---|
| 1293 | */
|
|---|
| 1294 | int CDECL CRTDLL__ftime( struct timeb *timebuf )
|
|---|
| 1295 | {
|
|---|
| 1296 | dprintf(("CRTDLL: _ftime not implemented.\n"));
|
|---|
| 1297 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1298 | return FALSE;
|
|---|
| 1299 | }
|
|---|
| 1300 |
|
|---|
| 1301 |
|
|---|
| 1302 | /*********************************************************************
|
|---|
| 1303 | * _fullpath (CRTDLL.114)
|
|---|
| 1304 | */
|
|---|
| 1305 | char * CDECL CRTDLL__fullpath( char *buf, char *path, size_t size )
|
|---|
| 1306 | {
|
|---|
| 1307 | dprintf2(("CRTDLL: _fullpath\n"));
|
|---|
| 1308 | return (_fullpath(buf, path, size));
|
|---|
| 1309 | }
|
|---|
| 1310 |
|
|---|
| 1311 |
|
|---|
| 1312 | /*********************************************************************
|
|---|
| 1313 | * _futime (CRTDLL.115)
|
|---|
| 1314 | */
|
|---|
| 1315 | int CDECL CRTDLL__futime( int handle, struct _utimbuf *filetime )
|
|---|
| 1316 | {
|
|---|
| 1317 | dprintf(("CRTDLL: _futime not implemented.\n"));
|
|---|
| 1318 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1319 | return FALSE;
|
|---|
| 1320 | }
|
|---|
| 1321 |
|
|---|
| 1322 |
|
|---|
| 1323 | /*********************************************************************
|
|---|
| 1324 | * _gcvt (CRTDLL.116)
|
|---|
| 1325 | */
|
|---|
| 1326 | char * CDECL CRTDLL__gcvt( double val, int ndig, char *buf )
|
|---|
| 1327 | {
|
|---|
| 1328 | dprintf2(("CRTDLL: _gcvt\n"));
|
|---|
| 1329 | return (_gcvt(val, ndig, buf));
|
|---|
| 1330 | }
|
|---|
| 1331 |
|
|---|
| 1332 |
|
|---|
| 1333 | /*********************************************************************
|
|---|
| 1334 | * _get_osfhandle (CRTDLL.117)
|
|---|
| 1335 | */
|
|---|
| 1336 | void* CDECL CRTDLL__get_osfhandle( int fileno )
|
|---|
| 1337 | {
|
|---|
| 1338 | dprintf2(("CRTDLL: _get_osfhandle\n"));
|
|---|
| 1339 | return filehnd(fileno);
|
|---|
| 1340 | }
|
|---|
| 1341 |
|
|---|
| 1342 |
|
|---|
| 1343 | /*********************************************************************
|
|---|
| 1344 | * _getch (CRTDLL.118)
|
|---|
| 1345 | */
|
|---|
| 1346 | int CDECL CRTDLL__getch(void)
|
|---|
| 1347 | {
|
|---|
| 1348 | dprintf2(("CRTDLL: _getch\n"));
|
|---|
| 1349 | return (_getch());
|
|---|
| 1350 | }
|
|---|
| 1351 |
|
|---|
| 1352 |
|
|---|
| 1353 | /*********************************************************************
|
|---|
| 1354 | * _getche (CRTDLL.119)
|
|---|
| 1355 | */
|
|---|
| 1356 | int CDECL CRTDLL__getche(void)
|
|---|
| 1357 | {
|
|---|
| 1358 | dprintf2(("CRTDLL: _getche\n"));
|
|---|
| 1359 | return (_getche());
|
|---|
| 1360 | }
|
|---|
| 1361 |
|
|---|
| 1362 |
|
|---|
| 1363 | /*********************************************************************
|
|---|
| 1364 | * _getcwd (CRTDLL.120)
|
|---|
| 1365 | */
|
|---|
| 1366 | char * CDECL CRTDLL__getcwd( char *buf, size_t size )
|
|---|
| 1367 | {
|
|---|
| 1368 | dprintf2(("CRTDLL: _getcwd\n"));
|
|---|
| 1369 | return (_getcwd(buf, size));
|
|---|
| 1370 | }
|
|---|
| 1371 |
|
|---|
| 1372 |
|
|---|
| 1373 | /*********************************************************************
|
|---|
| 1374 | * _getdcwd (CRTDLL.121)
|
|---|
| 1375 | */
|
|---|
| 1376 | char * CDECL CRTDLL__getdcwd( int drive, char *buffer, size_t maxlen )
|
|---|
| 1377 | {
|
|---|
| 1378 | dprintf2(("CRTDLL: _getdcwd\n"));
|
|---|
| 1379 | return (_getdcwd(drive, buffer, maxlen));
|
|---|
| 1380 | }
|
|---|
| 1381 |
|
|---|
| 1382 |
|
|---|
| 1383 | /*********************************************************************
|
|---|
| 1384 | * _getdiskfree (CRTDLL.122)
|
|---|
| 1385 | */
|
|---|
| 1386 | unsigned int CDECL CRTDLL__getdiskfree( unsigned int drive, struct _diskfree_t *diskspace)
|
|---|
| 1387 | {
|
|---|
| 1388 | dprintf2(("CRTDLL: _getdiskfree\n"));
|
|---|
| 1389 | char RootPathName[10];
|
|---|
| 1390 | RootPathName[0] = toupper(drive +'@');
|
|---|
| 1391 | RootPathName[1] = ':';
|
|---|
| 1392 | RootPathName[2] = '\\';
|
|---|
| 1393 | RootPathName[3] = 0;
|
|---|
| 1394 | if ( diskspace == NULL )
|
|---|
| 1395 | return 0;
|
|---|
| 1396 |
|
|---|
| 1397 | if ( !GetDiskFreeSpaceA(RootPathName,(LPDWORD)&diskspace->sectors_per_cluster,(LPDWORD)&diskspace->bytes_per_sector,
|
|---|
| 1398 | (LPDWORD )&diskspace->avail_clusters,(LPDWORD )&diskspace->total_clusters ) )
|
|---|
| 1399 | return 0;
|
|---|
| 1400 | return diskspace->avail_clusters;
|
|---|
| 1401 | }
|
|---|
| 1402 |
|
|---|
| 1403 |
|
|---|
| 1404 | /*********************************************************************
|
|---|
| 1405 | * _getdllprocaddr (CRTDLL.123)
|
|---|
| 1406 | */
|
|---|
| 1407 | FARPROC CDECL CRTDLL__getdllprocaddr(HMODULE hModule,char * lpProcName, int iOrdinal)
|
|---|
| 1408 | {
|
|---|
| 1409 | dprintf2(("CRTDLL: _getdllprocaddr\n"));
|
|---|
| 1410 | if ( lpProcName != NULL )
|
|---|
| 1411 | return GetProcAddress(hModule, lpProcName);
|
|---|
| 1412 | else
|
|---|
| 1413 | return GetProcAddress(hModule, (LPSTR)iOrdinal);
|
|---|
| 1414 | return (NULL);
|
|---|
| 1415 | }
|
|---|
| 1416 |
|
|---|
| 1417 |
|
|---|
| 1418 | /*********************************************************************
|
|---|
| 1419 | * _getdrive (CRTDLL.124)
|
|---|
| 1420 | */
|
|---|
| 1421 | unsigned CDECL CRTDLL__getdrive( void )
|
|---|
| 1422 | {
|
|---|
| 1423 | dprintf2(("CRTDLL: _getdrive\n"));
|
|---|
| 1424 | return DRIVE_GetCurrentDrive() + 1;
|
|---|
| 1425 | }
|
|---|
| 1426 |
|
|---|
| 1427 |
|
|---|
| 1428 | /*********************************************************************
|
|---|
| 1429 | * _getdrives (CRTDLL.125)
|
|---|
| 1430 | */
|
|---|
| 1431 | unsigned long CDECL CRTDLL__getdrives(void)
|
|---|
| 1432 | {
|
|---|
| 1433 | dprintf2(("CRTDLL: _getdrives\n"));
|
|---|
| 1434 | return GetLogicalDrives();
|
|---|
| 1435 | }
|
|---|
| 1436 |
|
|---|
| 1437 |
|
|---|
| 1438 | /*********************************************************************
|
|---|
| 1439 | * _getpid (CRTDLL.126)
|
|---|
| 1440 | */
|
|---|
| 1441 | int CDECL CRTDLL__getpid( void )
|
|---|
| 1442 | {
|
|---|
| 1443 | dprintf2(("CRTDLL: _getpid\n"));
|
|---|
| 1444 | return (_getpid());
|
|---|
| 1445 | }
|
|---|
| 1446 |
|
|---|
| 1447 |
|
|---|
| 1448 | /*********************************************************************
|
|---|
| 1449 | * _getsystime (CRTDLL.127)
|
|---|
| 1450 | */
|
|---|
| 1451 | unsigned int CDECL CRTDLL__getsystime(struct tm *tp)
|
|---|
| 1452 | {
|
|---|
| 1453 | dprintf(("CRTDLL: _getsystime not implemented.\n"));
|
|---|
| 1454 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1455 | return FALSE;
|
|---|
| 1456 | }
|
|---|
| 1457 |
|
|---|
| 1458 |
|
|---|
| 1459 | /*********************************************************************
|
|---|
| 1460 | * _getw (CRTDLL.128)
|
|---|
| 1461 | */
|
|---|
| 1462 | int CDECL CRTDLL__getw( FILE *stream )
|
|---|
| 1463 | {
|
|---|
| 1464 | dprintf2(("CRTDLL: _getw\n"));
|
|---|
| 1465 | int w;
|
|---|
| 1466 |
|
|---|
| 1467 | /* Is there a better way? */
|
|---|
| 1468 | if (CRTDLL_fread( &w, sizeof(w), 1, stream) != 1)
|
|---|
| 1469 | return(EOF);
|
|---|
| 1470 | return(w);
|
|---|
| 1471 | }
|
|---|
| 1472 |
|
|---|
| 1473 |
|
|---|
| 1474 | /*******************************************************************
|
|---|
| 1475 | * _global_unwind2 (CRTDLL.129)
|
|---|
| 1476 | */
|
|---|
| 1477 | void CDECL CRTDLL__global_unwind2( PEXCEPTION_FRAME frame )
|
|---|
| 1478 | {
|
|---|
| 1479 | dprintf2(("CRTDLL: global_undwind2\n"));
|
|---|
| 1480 | RtlUnwind( frame, 0, NULL, 0 );
|
|---|
| 1481 | }
|
|---|
| 1482 |
|
|---|
| 1483 |
|
|---|
| 1484 | /*********************************************************************
|
|---|
| 1485 | * _heapchk (CRTDLL.130)
|
|---|
| 1486 | */
|
|---|
| 1487 | int CDECL CRTDLL__heapchk( void )
|
|---|
| 1488 | {
|
|---|
| 1489 | dprintf2(("CRTDLL: _heapchk\n"));
|
|---|
| 1490 | return (_heapchk());
|
|---|
| 1491 | }
|
|---|
| 1492 |
|
|---|
| 1493 |
|
|---|
| 1494 | /*********************************************************************
|
|---|
| 1495 | * _heapmin (CRTDLL.131)
|
|---|
| 1496 | */
|
|---|
| 1497 | int CDECL CRTDLL__heapmin( void )
|
|---|
| 1498 | {
|
|---|
| 1499 | dprintf2(("CRTDLL: _heapmin\n"));
|
|---|
| 1500 | return (_heapmin());
|
|---|
| 1501 | }
|
|---|
| 1502 |
|
|---|
| 1503 |
|
|---|
| 1504 | /*********************************************************************
|
|---|
| 1505 | * _heapset (CRTDLL.132)
|
|---|
| 1506 | */
|
|---|
| 1507 | int CDECL CRTDLL__heapset( unsigned int fill )
|
|---|
| 1508 | {
|
|---|
| 1509 | dprintf2(("CRTDLL: _heapset\n"));
|
|---|
| 1510 | return (_heapset(fill));
|
|---|
| 1511 | }
|
|---|
| 1512 |
|
|---|
| 1513 |
|
|---|
| 1514 | /*********************************************************************
|
|---|
| 1515 | * _heapwalk (CRTDLL.133)
|
|---|
| 1516 | */
|
|---|
| 1517 | int CDECL CRTDLL__heapwalk( struct _heapinfo *entry )
|
|---|
| 1518 | {
|
|---|
| 1519 | dprintf(("CRTDLL: _heapwalk not implemented.\n"));
|
|---|
| 1520 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1521 | return 0;
|
|---|
| 1522 | }
|
|---|
| 1523 |
|
|---|
| 1524 |
|
|---|
| 1525 | /*********************************************************************
|
|---|
| 1526 | * _hypot (CRTDLL.134)
|
|---|
| 1527 | */
|
|---|
| 1528 | double CDECL CRTDLL__hypot(double x1, double x2)
|
|---|
| 1529 | {
|
|---|
| 1530 | dprintf2(("CRTDLL: _hypot\n"));
|
|---|
| 1531 | return (_hypot(x1, x2));
|
|---|
| 1532 | }
|
|---|
| 1533 |
|
|---|
| 1534 |
|
|---|
| 1535 | /*********************************************************************
|
|---|
| 1536 | * _initterm (CRTDLL.135)
|
|---|
| 1537 | */
|
|---|
| 1538 | DWORD CDECL CRTDLL__initterm(_INITTERMFUN *start,_INITTERMFUN *end)
|
|---|
| 1539 | {
|
|---|
| 1540 | dprintf2(("CRTDLL: initterm\n"));
|
|---|
| 1541 | _INITTERMFUN *current;
|
|---|
| 1542 |
|
|---|
| 1543 | current=start;
|
|---|
| 1544 | while (current<end) {
|
|---|
| 1545 | if (*current) (*current)();
|
|---|
| 1546 | current++;
|
|---|
| 1547 | }
|
|---|
| 1548 | return 0;
|
|---|
| 1549 | }
|
|---|
| 1550 |
|
|---|
| 1551 |
|
|---|
| 1552 | /*********************************************************************
|
|---|
| 1553 | * _isatty (CRTDLL.137)
|
|---|
| 1554 | */
|
|---|
| 1555 | BOOL CDECL CRTDLL__isatty(DWORD x)
|
|---|
| 1556 | {
|
|---|
| 1557 | dprintf2(("(%ld)\n",x));
|
|---|
| 1558 | return TRUE;
|
|---|
| 1559 | }
|
|---|
| 1560 |
|
|---|
| 1561 |
|
|---|
| 1562 | /*********************************************************************
|
|---|
| 1563 | * _isctype (CRTDLL.138)
|
|---|
| 1564 | */
|
|---|
| 1565 | BOOL CDECL CRTDLL__isctype(CHAR x,CHAR type)
|
|---|
| 1566 | {
|
|---|
| 1567 | dprintf2(("CRTDLL: isctype\n"));
|
|---|
| 1568 | if ((type & CRTDLL_SPACE) && isspace(x))
|
|---|
| 1569 | return TRUE;
|
|---|
| 1570 | if ((type & CRTDLL_PUNCT) && ispunct(x))
|
|---|
| 1571 | return TRUE;
|
|---|
| 1572 | if ((type & CRTDLL_LOWER) && islower(x))
|
|---|
| 1573 | return TRUE;
|
|---|
| 1574 | if ((type & CRTDLL_UPPER) && isupper(x))
|
|---|
| 1575 | return TRUE;
|
|---|
| 1576 | if ((type & CRTDLL_ALPHA) && isalpha(x))
|
|---|
| 1577 | return TRUE;
|
|---|
| 1578 | if ((type & CRTDLL_DIGIT) && isdigit(x))
|
|---|
| 1579 | return TRUE;
|
|---|
| 1580 | if ((type & CRTDLL_CONTROL) && iscntrl(x))
|
|---|
| 1581 | return TRUE;
|
|---|
| 1582 | /* check CRTDLL_LEADBYTE */
|
|---|
| 1583 | return FALSE;
|
|---|
| 1584 | }
|
|---|
| 1585 |
|
|---|
| 1586 |
|
|---|
| 1587 | /*********************************************************************
|
|---|
| 1588 | * _ismbbalnum (CRTDLL.139)
|
|---|
| 1589 | */
|
|---|
| 1590 | int CDECL CRTDLL__ismbbalnum( unsigned int c )
|
|---|
| 1591 | {
|
|---|
| 1592 | dprintf2(("CRTDLL: _ismbbalnum\n"));
|
|---|
| 1593 | return (CRTDLL_isalnum(c) || CRTDLL__ismbbkalnum(c));
|
|---|
| 1594 | }
|
|---|
| 1595 |
|
|---|
| 1596 |
|
|---|
| 1597 | /*********************************************************************
|
|---|
| 1598 | * _ismbbalpha (CRTDLL.140)
|
|---|
| 1599 | */
|
|---|
| 1600 | int CDECL CRTDLL__ismbbalpha( unsigned int c )
|
|---|
| 1601 | {
|
|---|
| 1602 | dprintf2(("CRTDLL: _ismbbalpha\n"));
|
|---|
| 1603 | return (isalpha(c) || CRTDLL__ismbbkalnum(c));
|
|---|
| 1604 | }
|
|---|
| 1605 |
|
|---|
| 1606 |
|
|---|
| 1607 | /*********************************************************************
|
|---|
| 1608 | * _ismbbgraph (CRTDLL.141)
|
|---|
| 1609 | */
|
|---|
| 1610 | int CDECL CRTDLL__ismbbgraph( unsigned int c )
|
|---|
| 1611 | {
|
|---|
| 1612 | dprintf2(("CRTDLL: _ismbbgraph\n"));
|
|---|
| 1613 | return (CRTDLL_isgraph(c) || CRTDLL__ismbbkana(c));
|
|---|
| 1614 | }
|
|---|
| 1615 |
|
|---|
| 1616 |
|
|---|
| 1617 | /*********************************************************************
|
|---|
| 1618 | * _ismbbkalnum (CRTDLL.142)
|
|---|
| 1619 | */
|
|---|
| 1620 | int CDECL CRTDLL__ismbbkalnum( unsigned int c )
|
|---|
| 1621 | {
|
|---|
| 1622 | dprintf2(("CRTDLL: _ismbbkalnum\n"));
|
|---|
| 1623 | return ((_jctype+1)[(unsigned char)(c)] & (_KNJ_P));
|
|---|
| 1624 | }
|
|---|
| 1625 |
|
|---|
| 1626 |
|
|---|
| 1627 | /*********************************************************************
|
|---|
| 1628 | * _ismbbkana (CRTDLL.143)
|
|---|
| 1629 | */
|
|---|
| 1630 | int CDECL CRTDLL__ismbbkana( unsigned int c )
|
|---|
| 1631 | {
|
|---|
| 1632 | dprintf2(("CRTDLL: _ismbbkana\n"));
|
|---|
| 1633 | return ((_jctype+1)[(unsigned char)(c)] & (_KNJ_M|_KNJ_P));
|
|---|
| 1634 | }
|
|---|
| 1635 |
|
|---|
| 1636 |
|
|---|
| 1637 | /*********************************************************************
|
|---|
| 1638 | * _ismbbkpunct (CRTDLL.144)
|
|---|
| 1639 | */
|
|---|
| 1640 | int CDECL CRTDLL__ismbbkpunct( unsigned int c )
|
|---|
| 1641 | {
|
|---|
| 1642 | dprintf2(("CRTDLL: _ismbbkpunct\n"));
|
|---|
| 1643 | return ((_jctype+1)[(unsigned char)(c)] & (_KNJ_P));
|
|---|
| 1644 | }
|
|---|
| 1645 |
|
|---|
| 1646 |
|
|---|
| 1647 | /*********************************************************************
|
|---|
| 1648 | * _ismbblead (CRTDLL.145)
|
|---|
| 1649 | */
|
|---|
| 1650 | int CDECL CRTDLL__ismbblead( unsigned int c )
|
|---|
| 1651 | {
|
|---|
| 1652 | dprintf2(("CRTDLL: _ismbblead\n"));
|
|---|
| 1653 | return ((_jctype+1)[(unsigned char)(c)] & _KNJ_1);
|
|---|
| 1654 | }
|
|---|
| 1655 |
|
|---|
| 1656 |
|
|---|
| 1657 | /*********************************************************************
|
|---|
| 1658 | * _ismbbprint (CRTDLL.146)
|
|---|
| 1659 | */
|
|---|
| 1660 | int CDECL CRTDLL__ismbbprint( unsigned int c )
|
|---|
| 1661 | {
|
|---|
| 1662 | dprintf2(("CRTDLL: _ismbbprint\n"));
|
|---|
| 1663 | return (isprint(c) || CRTDLL__ismbbkana(c));
|
|---|
| 1664 | }
|
|---|
| 1665 |
|
|---|
| 1666 |
|
|---|
| 1667 | /*********************************************************************
|
|---|
| 1668 | * _ismbbpunct (CRTDLL.147)
|
|---|
| 1669 | */
|
|---|
| 1670 | int CDECL CRTDLL__ismbbpunct( unsigned int c )
|
|---|
| 1671 | {
|
|---|
| 1672 | dprintf2(("CRTDLL: _ismbbpunct\n"));
|
|---|
| 1673 | return (ispunct(c) || CRTDLL__ismbbkana(c));
|
|---|
| 1674 | }
|
|---|
| 1675 |
|
|---|
| 1676 |
|
|---|
| 1677 | /*********************************************************************
|
|---|
| 1678 | * _ismbbtrail (CRTDLL.148)
|
|---|
| 1679 | */
|
|---|
| 1680 | int CDECL CRTDLL__ismbbtrail( unsigned int c )
|
|---|
| 1681 | {
|
|---|
| 1682 | dprintf2(("CRTDLL: _ismbbtrail\n"));
|
|---|
| 1683 | return ((_jctype+1)[(unsigned char)(c)] & _KNJ_2);
|
|---|
| 1684 | }
|
|---|
| 1685 |
|
|---|
| 1686 |
|
|---|
| 1687 | /*********************************************************************
|
|---|
| 1688 | * _ismbcalpha (CRTDLL.149)
|
|---|
| 1689 | */
|
|---|
| 1690 | int CDECL CRTDLL__ismbcalpha( unsigned int c )
|
|---|
| 1691 | {
|
|---|
| 1692 | dprintf2(("CRTDLL: _ismbcalpha\n"));
|
|---|
| 1693 | if ((c & 0xFF00) != 0) {
|
|---|
| 1694 | // true multibyte character
|
|---|
| 1695 | return 0;
|
|---|
| 1696 | }
|
|---|
| 1697 | else
|
|---|
| 1698 | return CRTDLL__ismbbalpha(c);
|
|---|
| 1699 |
|
|---|
| 1700 | return 0;
|
|---|
| 1701 | }
|
|---|
| 1702 |
|
|---|
| 1703 |
|
|---|
| 1704 | /*********************************************************************
|
|---|
| 1705 | * _ismbcdigit (CRTDLL.150)
|
|---|
| 1706 | */
|
|---|
| 1707 | int CDECL CRTDLL__ismbcdigit( unsigned int c )
|
|---|
| 1708 | {
|
|---|
| 1709 | dprintf2(("CRTDLL: _ismbcdigit\n"));
|
|---|
| 1710 | if ((c & 0xFF00) != 0) {
|
|---|
| 1711 | // true multibyte character
|
|---|
| 1712 | return 0;
|
|---|
| 1713 | }
|
|---|
| 1714 | else
|
|---|
| 1715 | return 0;
|
|---|
| 1716 | // return _ismbbdigit(c);
|
|---|
| 1717 |
|
|---|
| 1718 | return 0;
|
|---|
| 1719 | }
|
|---|
| 1720 |
|
|---|
| 1721 |
|
|---|
| 1722 | /*********************************************************************
|
|---|
| 1723 | * _ismbchira (CRTDLL.151)
|
|---|
| 1724 | */
|
|---|
| 1725 | int CDECL CRTDLL__ismbchira( unsigned int c )
|
|---|
| 1726 | {
|
|---|
| 1727 | dprintf2(("CRTDLL: _ismbchira\n"));
|
|---|
| 1728 | return ((c>=0x829F) && (c<=0x82F1));
|
|---|
| 1729 | }
|
|---|
| 1730 |
|
|---|
| 1731 |
|
|---|
| 1732 | /*********************************************************************
|
|---|
| 1733 | * _ismbckata (CRTDLL.152)
|
|---|
| 1734 | */
|
|---|
| 1735 | int CDECL CRTDLL__ismbckata( unsigned int c )
|
|---|
| 1736 | {
|
|---|
| 1737 | dprintf2(("CRTDLL: _ismbckata\n"));
|
|---|
| 1738 | return ((c>=0x8340) && (c<=0x8396));
|
|---|
| 1739 | }
|
|---|
| 1740 |
|
|---|
| 1741 | /*********************************************************************
|
|---|
| 1742 | * _ismbcl0 (CRTDLL.153)
|
|---|
| 1743 | */
|
|---|
| 1744 | int CDECL CRTDLL__ismbcl0( unsigned int ch )
|
|---|
| 1745 | {
|
|---|
| 1746 | dprintf(("CRTDLL: _ismbcl0 not implemented.\n"));
|
|---|
| 1747 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1748 | return 0;
|
|---|
| 1749 | }
|
|---|
| 1750 |
|
|---|
| 1751 |
|
|---|
| 1752 | /*********************************************************************
|
|---|
| 1753 | * _ismbcl1 (CRTDLL.154)
|
|---|
| 1754 | */
|
|---|
| 1755 | int CDECL CRTDLL__ismbcl1( unsigned int ch )
|
|---|
| 1756 | {
|
|---|
| 1757 | dprintf(("CRTDLL: _ismbcl1 not implemented.\n"));
|
|---|
| 1758 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1759 | return 0;
|
|---|
| 1760 | }
|
|---|
| 1761 |
|
|---|
| 1762 |
|
|---|
| 1763 | /*********************************************************************
|
|---|
| 1764 | * _ismbcl2 (CRTDLL.155)
|
|---|
| 1765 | */
|
|---|
| 1766 | int CDECL CRTDLL__ismbcl2( unsigned int ch )
|
|---|
| 1767 | {
|
|---|
| 1768 | dprintf(("CRTDLL: _ismbcl2 not implemented.\n"));
|
|---|
| 1769 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1770 | return 0;
|
|---|
| 1771 | }
|
|---|
| 1772 |
|
|---|
| 1773 |
|
|---|
| 1774 | /*********************************************************************
|
|---|
| 1775 | * _ismbclegal (CRTDLL.156)
|
|---|
| 1776 | */
|
|---|
| 1777 | int CDECL CRTDLL__ismbclegal( unsigned int c )
|
|---|
| 1778 | {
|
|---|
| 1779 | dprintf2(("CRTDLL: _ismbclegal\n"));
|
|---|
| 1780 | if ((c & 0xFF00) != 0) {
|
|---|
| 1781 | return CRTDLL__ismbblead(c>>8) && CRTDLL__ismbbtrail(c&0xFF);
|
|---|
| 1782 | }
|
|---|
| 1783 | else
|
|---|
| 1784 | return CRTDLL__ismbbtrail(c&0xFF);
|
|---|
| 1785 |
|
|---|
| 1786 | return 0;
|
|---|
| 1787 | }
|
|---|
| 1788 |
|
|---|
| 1789 |
|
|---|
| 1790 | /*********************************************************************
|
|---|
| 1791 | * _ismbclower (CRTDLL.157)
|
|---|
| 1792 | */
|
|---|
| 1793 | int CDECL CRTDLL__ismbclower( unsigned int c )
|
|---|
| 1794 | {
|
|---|
| 1795 | dprintf2(("CRTDLL: _ismbclower\n"));
|
|---|
| 1796 | if ((c & 0xFF00) != 0) {
|
|---|
| 1797 | if ( c >= 0x829A && c<= 0x829A )
|
|---|
| 1798 | return 1;
|
|---|
| 1799 | }
|
|---|
| 1800 | else
|
|---|
| 1801 | return isupper(c);
|
|---|
| 1802 | }
|
|---|
| 1803 |
|
|---|
| 1804 |
|
|---|
| 1805 | /*********************************************************************
|
|---|
| 1806 | * _ismbcprint (CRTDLL.158)
|
|---|
| 1807 | */
|
|---|
| 1808 | int CDECL CRTDLL__ismbcprint( unsigned int c )
|
|---|
| 1809 | {
|
|---|
| 1810 | dprintf2(("CRTDLL: _ismbcprint\n"));
|
|---|
| 1811 | if ((c & 0xFF00) != 0) {
|
|---|
| 1812 | // true multibyte character
|
|---|
| 1813 | return 0;
|
|---|
| 1814 | }
|
|---|
| 1815 | else
|
|---|
| 1816 | return 0;
|
|---|
| 1817 | // return _ismbbdigit(c);
|
|---|
| 1818 |
|
|---|
| 1819 | return 0;
|
|---|
| 1820 | }
|
|---|
| 1821 |
|
|---|
| 1822 |
|
|---|
| 1823 | /*********************************************************************
|
|---|
| 1824 | * _ismbcspace (CRTDLL.159)
|
|---|
| 1825 | */
|
|---|
| 1826 | int CDECL CRTDLL__ismbcspace( unsigned int c )
|
|---|
| 1827 | {
|
|---|
| 1828 | dprintf(("CRTDLL: _ismbcspace not implemented.\n"));
|
|---|
| 1829 | if ((c & 0xFF00) != 0) {
|
|---|
| 1830 | // true multibyte character
|
|---|
| 1831 | return 0;
|
|---|
| 1832 | }
|
|---|
| 1833 | else
|
|---|
| 1834 | return 0;
|
|---|
| 1835 | // return _ismbbdigit(c);
|
|---|
| 1836 |
|
|---|
| 1837 | return 0;
|
|---|
| 1838 | }
|
|---|
| 1839 |
|
|---|
| 1840 |
|
|---|
| 1841 | /*********************************************************************
|
|---|
| 1842 | * _ismbcsymbol (CRTDLL.160)
|
|---|
| 1843 | */
|
|---|
| 1844 | int CDECL CRTDLL__ismbcsymbol( unsigned int c )
|
|---|
| 1845 | {
|
|---|
| 1846 | dprintf(("CRTDLL: _ismbcsymbol not implemented.\n"));
|
|---|
| 1847 | if ((c & 0xFF00) != 0) {
|
|---|
| 1848 | // true multibyte character
|
|---|
| 1849 | return 0;
|
|---|
| 1850 | }
|
|---|
| 1851 | else
|
|---|
| 1852 | return 0;
|
|---|
| 1853 | // return _ismbbdigit(c);
|
|---|
| 1854 |
|
|---|
| 1855 | return 0;
|
|---|
| 1856 | }
|
|---|
| 1857 |
|
|---|
| 1858 |
|
|---|
| 1859 | /*********************************************************************
|
|---|
| 1860 | * _ismbcupper (CRTDLL.161)
|
|---|
| 1861 | */
|
|---|
| 1862 | int CDECL CRTDLL__ismbcupper( unsigned int c )
|
|---|
| 1863 | {
|
|---|
| 1864 | dprintf2(("CRTDLL: _ismbcupper\n"));
|
|---|
| 1865 | if ((c & 0xFF00) != 0) {
|
|---|
| 1866 | if ( c >= 0x8260 && c<= 0x8279 )
|
|---|
| 1867 | return 1;
|
|---|
| 1868 | }
|
|---|
| 1869 | else
|
|---|
| 1870 | return isupper(c);
|
|---|
| 1871 | }
|
|---|
| 1872 |
|
|---|
| 1873 |
|
|---|
| 1874 | /*********************************************************************
|
|---|
| 1875 | * _ismbslead (CRTDLL.162)
|
|---|
| 1876 | */
|
|---|
| 1877 | int CDECL CRTDLL__ismbslead(const unsigned char *str, const unsigned char *t)
|
|---|
| 1878 | {
|
|---|
| 1879 | dprintf2(("CRTDLL: _ismbslead\n"));
|
|---|
| 1880 | unsigned char *s = (unsigned char *)str;
|
|---|
| 1881 | while(*s != 0 && s != t)
|
|---|
| 1882 | {
|
|---|
| 1883 | s+= _mbclen2(*s);
|
|---|
| 1884 | }
|
|---|
| 1885 | return CRTDLL__ismbblead( *s);
|
|---|
| 1886 | }
|
|---|
| 1887 |
|
|---|
| 1888 |
|
|---|
| 1889 | /*********************************************************************
|
|---|
| 1890 | * _ismbstrail (CRTDLL.163)
|
|---|
| 1891 | */
|
|---|
| 1892 | int CDECL CRTDLL__ismbstrail(const unsigned char *str, const unsigned char *t)
|
|---|
| 1893 | {
|
|---|
| 1894 | dprintf2(("CRTDLL: _ismbstrail\n"));
|
|---|
| 1895 | unsigned char *s = (unsigned char *)str;
|
|---|
| 1896 | while(*s != 0 && s != t)
|
|---|
| 1897 | {
|
|---|
| 1898 |
|
|---|
| 1899 | s+= _mbclen2(*s);
|
|---|
| 1900 | }
|
|---|
| 1901 |
|
|---|
| 1902 | return CRTDLL__ismbbtrail(*s);
|
|---|
| 1903 | }
|
|---|
| 1904 |
|
|---|
| 1905 |
|
|---|
| 1906 | /*********************************************************************
|
|---|
| 1907 | * _isnan (CRTDLL.164)
|
|---|
| 1908 | */
|
|---|
| 1909 | int CDECL CRTDLL__isnan( double __x )
|
|---|
| 1910 | {
|
|---|
| 1911 | dprintf2(("CRTDLL: _isnan\n"));
|
|---|
| 1912 | double_t * x = (double_t *)&__x;
|
|---|
| 1913 | return ( x->exponent == 0x7ff && ( x->mantissah != 0 || x->mantissal != 0 ));
|
|---|
| 1914 | }
|
|---|
| 1915 |
|
|---|
| 1916 |
|
|---|
| 1917 | /*********************************************************************
|
|---|
| 1918 | * _j0 (CRTDLL.166)
|
|---|
| 1919 | */
|
|---|
| 1920 | double CDECL CRTDLL__j0(double x)
|
|---|
| 1921 | {
|
|---|
| 1922 | dprintf2(("CRTDLL: _j0\n"));
|
|---|
| 1923 | return (_j0(x));
|
|---|
| 1924 | }
|
|---|
| 1925 |
|
|---|
| 1926 |
|
|---|
| 1927 | /*********************************************************************
|
|---|
| 1928 | * _j1 (CRTDLL.167)
|
|---|
| 1929 | */
|
|---|
| 1930 | double CDECL CRTDLL__j1(double x)
|
|---|
| 1931 | {
|
|---|
| 1932 | dprintf2(("CRTDLL: _j1\n"));
|
|---|
| 1933 | return (_j1(x));}
|
|---|
| 1934 |
|
|---|
| 1935 |
|
|---|
| 1936 | /*********************************************************************
|
|---|
| 1937 | * _jn (CRTDLL.168)
|
|---|
| 1938 | */
|
|---|
| 1939 | double CDECL CRTDLL__jn(int i, double x)
|
|---|
| 1940 | {
|
|---|
| 1941 | dprintf2(("CRTDLL: _jn\n"));
|
|---|
| 1942 | return (_jn(i, x));
|
|---|
| 1943 | }
|
|---|
| 1944 |
|
|---|
| 1945 |
|
|---|
| 1946 | /*********************************************************************
|
|---|
| 1947 | * _kbhit (CRTDLL.169)
|
|---|
| 1948 | */
|
|---|
| 1949 | int CDECL CRTDLL__kbhit( void )
|
|---|
| 1950 | {
|
|---|
| 1951 | dprintf2(("CRTDLL: _kbhit\n"));
|
|---|
| 1952 | return (_kbhit());
|
|---|
| 1953 | }
|
|---|
| 1954 |
|
|---|
| 1955 |
|
|---|
| 1956 | /*********************************************************************
|
|---|
| 1957 | * _lfind (CRTDLL.170)
|
|---|
| 1958 | */
|
|---|
| 1959 | void * CDECL CRTDLL__lfind(const void *key, const void *base, size_t *nelp,
|
|---|
| 1960 | size_t width, int (*compar)(const void *, const void *))
|
|---|
| 1961 | {
|
|---|
| 1962 | dprintf2(("CRTDLL: _lfind\n"));
|
|---|
| 1963 | char *char_base = (char *)base;
|
|---|
| 1964 | int i;
|
|---|
| 1965 | for(i=0;i<*nelp;i++) {
|
|---|
| 1966 | if ( compar(key,char_base) == 0)
|
|---|
| 1967 | return char_base;
|
|---|
| 1968 | char_base += width;
|
|---|
| 1969 | }
|
|---|
| 1970 | return NULL;
|
|---|
| 1971 | }
|
|---|
| 1972 |
|
|---|
| 1973 |
|
|---|
| 1974 | /*********************************************************************
|
|---|
| 1975 | * _loaddll (CRTDLL.171)
|
|---|
| 1976 | */
|
|---|
| 1977 | void * CDECL CRTDLL__loaddll (char *name)
|
|---|
| 1978 | {
|
|---|
| 1979 | dprintf2(("CRTDLL: _loaddll\n"));
|
|---|
| 1980 | return (void*)LoadLibraryA(name);
|
|---|
| 1981 | }
|
|---|
| 1982 |
|
|---|
| 1983 |
|
|---|
| 1984 | /*******************************************************************
|
|---|
| 1985 | * _local_unwind2 (CRTDLL.172)
|
|---|
| 1986 | */
|
|---|
| 1987 | void CDECL CRTDLL__local_unwind2( PEXCEPTION_FRAME endframe, DWORD nr )
|
|---|
| 1988 | {
|
|---|
| 1989 | dprintf2(("CRTDLL: local_undwind2\n"));
|
|---|
| 1990 | }
|
|---|
| 1991 |
|
|---|
| 1992 |
|
|---|
| 1993 | /*********************************************************************
|
|---|
| 1994 | * _locking (CRTDLL.173)
|
|---|
| 1995 | */
|
|---|
| 1996 | int CDECL CRTDLL__locking(int handle,int mode,unsigned long nbyte)
|
|---|
| 1997 | {
|
|---|
| 1998 | dprintf(("CRTDLL: _locking not implemented.\n"));
|
|---|
| 1999 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 2000 | return FALSE;
|
|---|
| 2001 | }
|
|---|
| 2002 |
|
|---|
| 2003 |
|
|---|
| 2004 | /*********************************************************************
|
|---|
| 2005 | * _logb (CRTDLL.174)
|
|---|
| 2006 | */
|
|---|
| 2007 | double CDECL CRTDLL__logb( double x )
|
|---|
| 2008 | {
|
|---|
| 2009 | dprintf(("CRTDLL: _logb not implemented.\n"));
|
|---|
| 2010 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 2011 | return FALSE;
|
|---|
| 2012 | }
|
|---|
| 2013 |
|
|---|
| 2014 |
|
|---|
| 2015 | /*********************************************************************
|
|---|
| 2016 | * _lrotl (CRTDLL.175)
|
|---|
| 2017 | */
|
|---|
| 2018 | unsigned long CDECL CRTDLL__lrotl( unsigned long value, unsigned int shift )
|
|---|
| 2019 | {
|
|---|
| 2020 | dprintf2(("CRTDLL: _lrotl\n"));
|
|---|
| 2021 | return (_lrotl(value, shift));
|
|---|
| 2022 | }
|
|---|
| 2023 |
|
|---|
| 2024 |
|
|---|
| 2025 | /*********************************************************************
|
|---|
| 2026 | * _lrotr (CRTDLL.176)
|
|---|
| 2027 | */
|
|---|
| 2028 | unsigned long CDECL CRTDLL__lrotr( unsigned long value, unsigned int shift )
|
|---|
| 2029 | {
|
|---|
| 2030 | dprintf2(("CRTDLL: _lrotr\n"));
|
|---|
| 2031 | return (_lrotr(value, shift));
|
|---|
| 2032 | }
|
|---|
| 2033 |
|
|---|
| 2034 |
|
|---|
| 2035 | /*********************************************************************
|
|---|
| 2036 | * _lsearch (CRTDLL.177)
|
|---|
| 2037 | */
|
|---|
| 2038 | void * CDECL CRTDLL__lsearch(const void *key, void *base, size_t *nelp, size_t width,
|
|---|
| 2039 | int (*compar)(const void *, const void *))
|
|---|
| 2040 | {
|
|---|
| 2041 | dprintf(("CRTDLL: _lsearch not implemented.\n"));
|
|---|
| 2042 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 2043 | return FALSE;
|
|---|
| 2044 | }
|
|---|
| 2045 |
|
|---|
| 2046 |
|
|---|
| 2047 | /*********************************************************************
|
|---|
| 2048 | * _lseek (CRTDLL.178)
|
|---|
| 2049 | */
|
|---|
| 2050 | long CDECL CRTDLL__lseek(int handle,long offset,int origin)
|
|---|
| 2051 | {
|
|---|
| 2052 | dprintf2(("CRTDLL: _lssek\n"));
|
|---|
| 2053 | return (_lseek(handle, offset, origin));
|
|---|
| 2054 | }
|
|---|
| 2055 |
|
|---|
| 2056 |
|
|---|
| 2057 | /*********************************************************************
|
|---|
| 2058 | * _makepath (CRTDLL.180)
|
|---|
| 2059 | */
|
|---|
| 2060 | void CDECL CRTDLL__makepath( char *path, char *drive,
|
|---|
| 2061 | char *dir, char *fname, char *ext )
|
|---|
| 2062 | {
|
|---|
| 2063 | dprintf2(("CRTDLL: _makepath\n"));
|
|---|
| 2064 | _makepath(path, drive, dir, fname, ext);
|
|---|
| 2065 | }
|
|---|
| 2066 |
|
|---|
| 2067 |
|
|---|
| 2068 | /*********************************************************************
|
|---|
| 2069 | * _matherr (CRTDLL.181)
|
|---|
| 2070 | */
|
|---|
| 2071 | double CDECL CRTDLL__matherr( struct exception * excep )
|
|---|
| 2072 | {
|
|---|
| 2073 | dprintf2(("CRTDLL: _matherr\n"));
|
|---|
| 2074 | return (_matherr(excep));
|
|---|
| 2075 | }
|
|---|
| 2076 |
|
|---|
| 2077 |
|
|---|
| 2078 | /*********************************************************************
|
|---|
| 2079 | * _mbbtombc (CRTDLL.182)
|
|---|
| 2080 | */
|
|---|
| 2081 | unsigned int CDECL CRTDLL__mbbtombc( unsigned int c )
|
|---|
| 2082 | {
|
|---|
| 2083 | dprintf2(("CRTDLL: _mbbtombc\n"));
|
|---|
| 2084 | if (c >= 0x20 && c <= 0x7e) {
|
|---|
| 2085 | return han_to_zen_ascii_table[c - 0x20];
|
|---|
| 2086 | } else if (ISKANA(c)) {
|
|---|
| 2087 | return han_to_zen_kana_table[c - 0xa0];
|
|---|
| 2088 | }
|
|---|
| 2089 | return c;
|
|---|
| 2090 | }
|
|---|
| 2091 |
|
|---|
| 2092 |
|
|---|
| 2093 | /*********************************************************************
|
|---|
| 2094 | * _mbbtype (CRTDLL.183)
|
|---|
| 2095 | */
|
|---|
| 2096 | int CDECL CRTDLL__mbbtype( unsigned char c, int type )
|
|---|
| 2097 | {
|
|---|
| 2098 | dprintf2(("CRTDLL: _mbbtype\n"));
|
|---|
| 2099 | if ( type == 1 ) {
|
|---|
| 2100 | if ((c >= 0x40 && c <= 0x7e ) || (c >= 0x80 && c <= 0xfc ) )
|
|---|
| 2101 | {
|
|---|
| 2102 | return _MBC_TRAIL;
|
|---|
| 2103 | }
|
|---|
| 2104 | else if (( c >= 0x20 && c >= 0x7E ) || ( c >= 0xA1 && c <= 0xDF ) ||
|
|---|
| 2105 | ( c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC ) )
|
|---|
| 2106 | return _MBC_ILLEGAL;
|
|---|
| 2107 | else
|
|---|
| 2108 | return 0;
|
|---|
| 2109 |
|
|---|
| 2110 | }
|
|---|
| 2111 | else {
|
|---|
| 2112 | if (( c >= 0x20 && c <= 0x7E ) || ( c >= 0xA1 && c <= 0xDF )) {
|
|---|
| 2113 | return _MBC_SINGLE;
|
|---|
| 2114 | }
|
|---|
| 2115 | else if ( (c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC) )
|
|---|
| 2116 | return _MBC_LEAD;
|
|---|
| 2117 | else if (( c >= 0x20 && c >= 0x7E ) || ( c >= 0xA1 && c <= 0xDF ) ||
|
|---|
| 2118 | ( c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC ) )
|
|---|
| 2119 | return _MBC_ILLEGAL;
|
|---|
| 2120 | else
|
|---|
| 2121 | return 0;
|
|---|
| 2122 |
|
|---|
| 2123 | }
|
|---|
| 2124 |
|
|---|
| 2125 |
|
|---|
| 2126 | return 0;
|
|---|
| 2127 | }
|
|---|
| 2128 |
|
|---|
| 2129 |
|
|---|
| 2130 | /*********************************************************************
|
|---|
| 2131 | * _mbccpy (CRTDLL.184)
|
|---|
| 2132 | */
|
|---|
| 2133 | void CDECL CRTDLL__mbccpy( unsigned char *dst, const unsigned char *src )
|
|---|
| 2134 | {
|
|---|
| 2135 | dprintf2(("CRTDLL: _mbccpy\n"));
|
|---|
| 2136 |
|
|---|
| 2137 | if (!CRTDLL__ismbblead(*src) )
|
|---|
| 2138 | return;
|
|---|
| 2139 |
|
|---|
| 2140 | memcpy(dst,src,_mbclen2(*src));
|
|---|
| 2141 | }
|
|---|
| 2142 |
|
|---|
| 2143 |
|
|---|
| 2144 | /*********************************************************************
|
|---|
| 2145 | * _mbcjistojms (CRTDLL.185)
|
|---|
| 2146 | */
|
|---|
| 2147 | int CDECL CRTDLL__mbcjistojms( unsigned int c )
|
|---|
| 2148 | {
|
|---|
| 2149 | dprintf2(("CRTDLL: _mbcjistojms\n"));
|
|---|
| 2150 | int c1, c2;
|
|---|
| 2151 |
|
|---|
| 2152 | c2 = (unsigned char)c;
|
|---|
| 2153 | c1 = c >> 8;
|
|---|
| 2154 | if (c1 >= 0x21 && c1 <= 0x7e && c2 >= 0x21 && c2 <= 0x7e) {
|
|---|
| 2155 | if (c1 & 0x01) {
|
|---|
| 2156 | c2 += 0x1f;
|
|---|
| 2157 | if (c2 >= 0x7f)
|
|---|
| 2158 | c2 ++;
|
|---|
| 2159 | } else {
|
|---|
| 2160 | c2 += 0x7e;
|
|---|
| 2161 | }
|
|---|
| 2162 | c1 += 0xe1;
|
|---|
| 2163 | c1 >>= 1;
|
|---|
| 2164 | if (c1 >= 0xa0)
|
|---|
| 2165 | c1 += 0x40;
|
|---|
| 2166 | return ((c1 << 8) | c2);
|
|---|
| 2167 | }
|
|---|
| 2168 | return 0;
|
|---|
| 2169 | }
|
|---|
| 2170 |
|
|---|
| 2171 |
|
|---|
| 2172 | /*********************************************************************
|
|---|
| 2173 | * _mbcjmstojis (CRTDLL.186)
|
|---|
| 2174 | */
|
|---|
| 2175 | int CDECL CRTDLL__mbcjmstojis( unsigned int c )
|
|---|
| 2176 | {
|
|---|
| 2177 | dprintf2(("CRTDLL: _mbcjmstojis\n"));
|
|---|
| 2178 | int c1, c2;
|
|---|
| 2179 |
|
|---|
| 2180 | c2 = (unsigned char)c;
|
|---|
| 2181 | c1 = c >> 8;
|
|---|
| 2182 | if (c1 < 0xf0 && CRTDLL__ismbblead(c1) && CRTDLL__ismbbtrail(c2)) {
|
|---|
| 2183 | if (c1 >= 0xe0)
|
|---|
| 2184 | c1 -= 0x40;
|
|---|
| 2185 | c1 -= 0x70;
|
|---|
| 2186 | c1 <<= 1;
|
|---|
| 2187 | if (c2 < 0x9f) {
|
|---|
| 2188 | c1 --;
|
|---|
| 2189 | c2 -= 0x1f;
|
|---|
| 2190 | if (c2 >= (0x80-0x1f))
|
|---|
| 2191 | c2 --;
|
|---|
| 2192 | } else {
|
|---|
| 2193 | c2 -= 0x7e;
|
|---|
| 2194 | }
|
|---|
| 2195 | return ((c1 << 8) | c2);
|
|---|
| 2196 | }
|
|---|
| 2197 | return 0;
|
|---|
| 2198 | }
|
|---|
| 2199 |
|
|---|
| 2200 |
|
|---|
| 2201 | /*********************************************************************
|
|---|
| 2202 | * _mbclen (CRTDLL.187)
|
|---|
| 2203 | */
|
|---|
| 2204 | size_t CDECL CRTDLL__mbclen( const unsigned char *s )
|
|---|
| 2205 | {
|
|---|
| 2206 | dprintf2(("CRTDLL: _mbclen\n"));
|
|---|
| 2207 | return (CRTDLL__ismbblead(*s>>8) && CRTDLL__ismbbtrail(*s&0x00FF)) ? 2 : 1;
|
|---|
| 2208 | }
|
|---|
| 2209 |
|
|---|
| 2210 |
|
|---|
| 2211 | /*********************************************************************
|
|---|
| 2212 | * _mbctohira (CRTDLL.188)
|
|---|
| 2213 | */
|
|---|
| 2214 | int CDECL CRTDLL__mbctohira( unsigned int c )
|
|---|
| 2215 | {
|
|---|
| 2216 | dprintf2(("CRTDLL: _mbctohira\n"));
|
|---|
| 2217 | return c;
|
|---|
| 2218 | }
|
|---|
| 2219 |
|
|---|
| 2220 |
|
|---|
| 2221 | /*********************************************************************
|
|---|
| 2222 | * _mbctokata (CRTDLL.189)
|
|---|
| 2223 | */
|
|---|
| 2224 | int CDECL CRTDLL__mbctokata( unsigned int c )
|
|---|
| 2225 | {
|
|---|
| 2226 | dprintf2(("CRTDLL: _mbctokata\n"));
|
|---|
| 2227 | return c;
|
|---|
| 2228 | }
|
|---|
| 2229 |
|
|---|
| 2230 |
|
|---|
| 2231 | /*********************************************************************
|
|---|
| 2232 | * _mbctolower (CRTDLL.190)
|
|---|
| 2233 | */
|
|---|
| 2234 | unsigned int CDECL CRTDLL__mbctolower( unsigned int c )
|
|---|
| 2235 | {
|
|---|
| 2236 | dprintf2(("CRTDLL: _mbctolower\n"));
|
|---|
| 2237 | if ((c & 0xFF00) != 0) {
|
|---|
| 2238 | // true multibyte case conversion needed
|
|---|
| 2239 | if ( CRTDLL__ismbclower(c) )
|
|---|
| 2240 | return c + CASE_DIFF;
|
|---|
| 2241 |
|
|---|
| 2242 | } else
|
|---|
| 2243 | return _mbbtolower(c);
|
|---|
| 2244 |
|
|---|
| 2245 | return 0;
|
|---|
| 2246 | }
|
|---|
| 2247 |
|
|---|
| 2248 |
|
|---|
| 2249 | /*********************************************************************
|
|---|
| 2250 | * _mbctombb (CRTDLL.191)
|
|---|
| 2251 | */
|
|---|
| 2252 | unsigned int CDECL CRTDLL__mbctombb( unsigned int c )
|
|---|
| 2253 | {
|
|---|
| 2254 | dprintf2(("CRTDLL: _mbctombb\n"));
|
|---|
| 2255 | int i;
|
|---|
| 2256 | unsigned short *p;
|
|---|
| 2257 |
|
|---|
| 2258 | if (JISKANA(c)) {
|
|---|
| 2259 | return zen_to_han_kana_table[c - 0x8340];
|
|---|
| 2260 | } else if (JISHIRA(c)) {
|
|---|
| 2261 | c = JTOKANA(c);
|
|---|
| 2262 | return zen_to_han_kana_table[c - 0x8340];
|
|---|
| 2263 | } else if (c <= 0x8396) {
|
|---|
| 2264 | for (i = 0x20, p = han_to_zen_ascii_table; i <= 0x7e; i++, p++) {
|
|---|
| 2265 | if (*p == c) {
|
|---|
| 2266 | return i;
|
|---|
| 2267 | }
|
|---|
| 2268 | }
|
|---|
| 2269 | for (i = 0; i < ZTOH_SYMBOLS; i++) {
|
|---|
| 2270 | if (zen_to_han_symbol_table_1[i] == c) {
|
|---|
| 2271 | return zen_to_han_symbol_table_2[i];
|
|---|
| 2272 | }
|
|---|
| 2273 | }
|
|---|
| 2274 | }
|
|---|
| 2275 | return c;
|
|---|
| 2276 | }
|
|---|
| 2277 |
|
|---|
| 2278 |
|
|---|
| 2279 | /*********************************************************************
|
|---|
| 2280 | * _mbctoupper (CRTDLL.192)
|
|---|
| 2281 | */
|
|---|
| 2282 | unsigned int CDECL CRTDLL__mbctoupper( unsigned int c )
|
|---|
| 2283 | {
|
|---|
| 2284 | dprintf2(("CRTDLL: _mbctoupper\n"));
|
|---|
| 2285 | if ((c & 0xFF00) != 0) {
|
|---|
| 2286 | // true multibyte case conversion needed
|
|---|
| 2287 | if ( CRTDLL__ismbcupper(c) )
|
|---|
| 2288 | return c + CASE_DIFF;
|
|---|
| 2289 |
|
|---|
| 2290 | } else
|
|---|
| 2291 | return _mbbtoupper(c);
|
|---|
| 2292 |
|
|---|
| 2293 | return 0;
|
|---|
| 2294 | }
|
|---|
| 2295 |
|
|---|
| 2296 |
|
|---|
| 2297 | /*********************************************************************
|
|---|
| 2298 | * _mbsbtype (CRTDLL.194)
|
|---|
| 2299 | */
|
|---|
| 2300 | int CDECL CRTDLL__mbsbtype( const unsigned char *str, int n )
|
|---|
| 2301 | {
|
|---|
| 2302 | dprintf2(("CRTDLL: _mbsbtype\n"));
|
|---|
| 2303 | if ( str == NULL )
|
|---|
| 2304 | return -1;
|
|---|
| 2305 | return CRTDLL__mbbtype(*(str+n),1);
|
|---|
| 2306 | }
|
|---|
| 2307 |
|
|---|
| 2308 |
|
|---|
| 2309 | /*********************************************************************
|
|---|
| 2310 | * _mbscat (CRTDLL.195)
|
|---|
| 2311 | */
|
|---|
| 2312 | unsigned char * CDECL CRTDLL__mbscat( unsigned char *dst, const unsigned char *src )
|
|---|
| 2313 | {
|
|---|
| 2314 | dprintf2(("CRTDLL: _mbscat\n"));
|
|---|
| 2315 | return (unsigned char*)strcat((char*)dst,(char*)src);
|
|---|
| 2316 | }
|
|---|
| 2317 |
|
|---|
| 2318 |
|
|---|
| 2319 | /*********************************************************************
|
|---|
| 2320 | * _mbschr (CRTDLL.196)
|
|---|
| 2321 | */
|
|---|
| 2322 | unsigned char * CDECL CRTDLL__mbschr( const unsigned char *str, unsigned int c )
|
|---|
| 2323 | {
|
|---|
| 2324 | dprintf2(("CRTDLL: _mbschr\n"));
|
|---|
| 2325 | return (unsigned char*)strchr((char*)str,c);
|
|---|
| 2326 | }
|
|---|
| 2327 |
|
|---|
| 2328 |
|
|---|
| 2329 | /*********************************************************************
|
|---|
| 2330 | * _mbscmp (CRTDLL.197)
|
|---|
| 2331 | */
|
|---|
| 2332 | int CDECL CRTDLL__mbscmp( const unsigned char *s1, const unsigned char *s2 )
|
|---|
| 2333 | {
|
|---|
| 2334 | dprintf2(("CRTDLL: _mbscmp\n"));
|
|---|
| 2335 | return strcmp((char*)s1,(char*)s2);
|
|---|
| 2336 | }
|
|---|
| 2337 |
|
|---|
| 2338 |
|
|---|
| 2339 | /*********************************************************************
|
|---|
| 2340 | * _mbscpy (CRTDLL.198)
|
|---|
| 2341 | */
|
|---|
| 2342 | unsigned char * CDECL CRTDLL__mbscpy( unsigned char *s1, const unsigned char *s2 )
|
|---|
| 2343 | {
|
|---|
| 2344 | dprintf2(("CRTDLL: _mbscpy\n"));
|
|---|
| 2345 | return (unsigned char*)strcpy((char*)s1,(char*)s2);
|
|---|
| 2346 | }
|
|---|
| 2347 |
|
|---|
| 2348 |
|
|---|
| 2349 | /*********************************************************************
|
|---|
| 2350 | * _mbscspn (CRTDLL.199)
|
|---|
| 2351 | */
|
|---|
| 2352 | size_t CDECL CRTDLL__mbscspn( const unsigned char *s1, const unsigned char *s2 )
|
|---|
| 2353 | {
|
|---|
| 2354 | dprintf2(("CRTDLL: _mbscspn\n"));
|
|---|
| 2355 | const char *p, *spanp;
|
|---|
| 2356 | char c, sc;
|
|---|
| 2357 |
|
|---|
| 2358 | for (p = (const char*)s1;;)
|
|---|
| 2359 | {
|
|---|
| 2360 | c = *p++;
|
|---|
| 2361 | spanp = (const char*)s2;
|
|---|
| 2362 | do {
|
|---|
| 2363 | if ((sc = *spanp++) == c)
|
|---|
| 2364 | return (size_t)(p - 1) - (size_t)s1;
|
|---|
| 2365 | } while (sc != 0);
|
|---|
| 2366 | }
|
|---|
| 2367 | /* NOTREACHED */
|
|---|
| 2368 | }
|
|---|
| 2369 |
|
|---|
| 2370 |
|
|---|
| 2371 | /*********************************************************************
|
|---|
| 2372 | * _mbsdec (CRTDLL.200)
|
|---|
| 2373 | */
|
|---|
| 2374 | unsigned char * CDECL CRTDLL__mbsdec( const unsigned char *str, const unsigned char *cur )
|
|---|
| 2375 | {
|
|---|
| 2376 | dprintf2(("CRTDLL: _mbsdec\n"));
|
|---|
| 2377 | unsigned char *s = (unsigned char *)cur;
|
|---|
| 2378 | if ( str >= cur )
|
|---|
| 2379 | return NULL;
|
|---|
| 2380 | s--;
|
|---|
| 2381 | if (CRTDLL__ismbblead(*(s-1)) )
|
|---|
| 2382 | s--;
|
|---|
| 2383 |
|
|---|
| 2384 | return s;
|
|---|
| 2385 | }
|
|---|
| 2386 |
|
|---|
| 2387 |
|
|---|
| 2388 | /*********************************************************************
|
|---|
| 2389 | * _mbsdup (CRTDLL.201)
|
|---|
| 2390 | */
|
|---|
| 2391 | unsigned char * CDECL CRTDLL__mbsdup( unsigned char *_s )
|
|---|
| 2392 | {
|
|---|
| 2393 | dprintf2(("CRTDLL: _mbsdup\n"));
|
|---|
| 2394 | char *rv;
|
|---|
| 2395 | if (_s == 0)
|
|---|
| 2396 | return 0;
|
|---|
| 2397 | rv = (char *)malloc(CRTDLL__mbslen((LPCSTR)_s) + 1);
|
|---|
| 2398 | if (rv == 0)
|
|---|
| 2399 | return 0;
|
|---|
| 2400 | CRTDLL__mbscpy((unsigned char*)rv, _s);
|
|---|
| 2401 | return (unsigned char*)rv;
|
|---|
| 2402 | }
|
|---|
| 2403 |
|
|---|
| 2404 |
|
|---|
| 2405 | /*********************************************************************
|
|---|
| 2406 | * CRTDLL__mbsicmp (CRTDLL.202)
|
|---|
| 2407 | */
|
|---|
| 2408 | int CDECL CRTDLL__mbsicmp( const unsigned char *x, const unsigned char *y )
|
|---|
| 2409 | {
|
|---|
| 2410 | dprintf2(("CRTDLL: _mbsicmp\n"));
|
|---|
| 2411 | do {
|
|---|
| 2412 | if (!*x)
|
|---|
| 2413 | return !!*y;
|
|---|
| 2414 | if (!*y)
|
|---|
| 2415 | return !!*x;
|
|---|
| 2416 | /* FIXME: MBCS handling... */
|
|---|
| 2417 | if (*x!=*y)
|
|---|
| 2418 | return 1;
|
|---|
| 2419 | x++;
|
|---|
| 2420 | y++;
|
|---|
| 2421 | } while (1);
|
|---|
| 2422 | }
|
|---|
| 2423 |
|
|---|
| 2424 |
|
|---|
| 2425 | /*********************************************************************
|
|---|
| 2426 | * CRTDLL__mbsinc (CRTDLL.203)
|
|---|
| 2427 | */
|
|---|
| 2428 | LPSTR CDECL CRTDLL__mbsinc( LPCSTR str )
|
|---|
| 2429 | {
|
|---|
| 2430 | dprintf2(("CRTDLL: _mbsinc\n"));
|
|---|
| 2431 | int len = mblen( str, MB_LEN_MAX );
|
|---|
| 2432 | if (len < 1) len = 1;
|
|---|
| 2433 | return (LPSTR)(str + len);
|
|---|
| 2434 | }
|
|---|
| 2435 |
|
|---|
| 2436 |
|
|---|
| 2437 | /*********************************************************************
|
|---|
| 2438 | * CRTDLL__mbslen (CRTDLL.204)
|
|---|
| 2439 | */
|
|---|
| 2440 | INT CDECL CRTDLL__mbslen( LPCSTR str )
|
|---|
| 2441 | {
|
|---|
| 2442 | dprintf2(("CRTDLL: _mbslen\n"));
|
|---|
| 2443 | INT len, total = 0;
|
|---|
| 2444 | while ((len = mblen( str, MB_LEN_MAX )) > 0)
|
|---|
| 2445 | {
|
|---|
| 2446 | str += len;
|
|---|
| 2447 | total++;
|
|---|
| 2448 | }
|
|---|
| 2449 | return total;
|
|---|
| 2450 | }
|
|---|
| 2451 |
|
|---|
| 2452 |
|
|---|
| 2453 | /*********************************************************************
|
|---|
| 2454 | * _mbslwr (CRTDLL.205)
|
|---|
| 2455 | */
|
|---|
| 2456 | unsigned char * CDECL CRTDLL__mbslwr( unsigned char *x )
|
|---|
| 2457 | {
|
|---|
| 2458 | dprintf2(("CRTDLL: _mbslwr\n"));
|
|---|
| 2459 | unsigned char *y=x;
|
|---|
| 2460 |
|
|---|
| 2461 | while (*y) {
|
|---|
| 2462 | if (!CRTDLL__ismbblead(*y) )
|
|---|
| 2463 | *y = tolower(*y);
|
|---|
| 2464 | else {
|
|---|
| 2465 | *y=CRTDLL__mbctolower(*(unsigned short *)y);
|
|---|
| 2466 | y++;
|
|---|
| 2467 | }
|
|---|
| 2468 | }
|
|---|
| 2469 | return x;
|
|---|
| 2470 | }
|
|---|
| 2471 |
|
|---|
| 2472 |
|
|---|
| 2473 | /*********************************************************************
|
|---|
| 2474 | * _mbsnbcat (CRTDLL.206)
|
|---|
| 2475 | */
|
|---|
| 2476 | unsigned char * CDECL CRTDLL__mbsnbcat( unsigned char *dst, const unsigned char *src, size_t n )
|
|---|
| 2477 | {
|
|---|
| 2478 | dprintf2(("CRTDLL: _mbsnbcat\n"));
|
|---|
| 2479 | char *d;
|
|---|
| 2480 | char *s = (char *)src;
|
|---|
| 2481 | if (n != 0) {
|
|---|
| 2482 | d = (char*)dst + strlen((char*)dst); // get the end of string
|
|---|
| 2483 | d += _mbclen2(*d); // move 1 or 2 up
|
|---|
| 2484 |
|
|---|
| 2485 | do {
|
|---|
| 2486 | if ((*d++ = *s++) == 0)
|
|---|
| 2487 | {
|
|---|
| 2488 | while (--n != 0)
|
|---|
| 2489 | *d++ = 0;
|
|---|
| 2490 | break;
|
|---|
| 2491 | }
|
|---|
| 2492 | if ( !(n==1 && CRTDLL__ismbblead(*s)) )
|
|---|
| 2493 | n--;
|
|---|
| 2494 | } while (n > 0);
|
|---|
| 2495 | }
|
|---|
| 2496 | return dst;
|
|---|
| 2497 | }
|
|---|
| 2498 |
|
|---|
| 2499 |
|
|---|
| 2500 | /*********************************************************************
|
|---|
| 2501 | * _mbsnbcmp (CRTDLL.207)
|
|---|
| 2502 | */
|
|---|
| 2503 | int CDECL CRTDLL__mbsnbcmp( const unsigned char *str1, const unsigned char *str2, size_t n )
|
|---|
| 2504 | {
|
|---|
| 2505 | dprintf2(("CRTDLL: _mbsnbcmp\n"));
|
|---|
| 2506 | unsigned char *s1 = (unsigned char *)str1;
|
|---|
| 2507 | unsigned char *s2 = (unsigned char *)str2;
|
|---|
| 2508 |
|
|---|
| 2509 | unsigned short *short_s1, *short_s2;
|
|---|
| 2510 |
|
|---|
| 2511 | int l1, l2;
|
|---|
| 2512 |
|
|---|
| 2513 | if (n == 0)
|
|---|
| 2514 | return 0;
|
|---|
| 2515 | do {
|
|---|
| 2516 |
|
|---|
| 2517 | if (*s1 == 0)
|
|---|
| 2518 | break;
|
|---|
| 2519 |
|
|---|
| 2520 | l1 = CRTDLL__ismbblead(*s1);
|
|---|
| 2521 | l2 = CRTDLL__ismbblead(*s2);
|
|---|
| 2522 | if ( !l1 && !l2 ) {
|
|---|
| 2523 |
|
|---|
| 2524 | if (*s1 != *s2)
|
|---|
| 2525 | return *s1 - *s2;
|
|---|
| 2526 | else {
|
|---|
| 2527 | s1 += 1;
|
|---|
| 2528 | s2 += 1;
|
|---|
| 2529 | n--;
|
|---|
| 2530 | }
|
|---|
| 2531 | }
|
|---|
| 2532 | else if ( l1 && l2 ){
|
|---|
| 2533 | short_s1 = (unsigned short *)s1;
|
|---|
| 2534 | short_s2 = (unsigned short *)s2;
|
|---|
| 2535 | if ( *short_s1 != *short_s2 )
|
|---|
| 2536 | return *short_s1 - *short_s2;
|
|---|
| 2537 | else {
|
|---|
| 2538 | s1 += 2;
|
|---|
| 2539 | s2 += 2;
|
|---|
| 2540 | n-=2;
|
|---|
| 2541 |
|
|---|
| 2542 | }
|
|---|
| 2543 | }
|
|---|
| 2544 | else
|
|---|
| 2545 | return *s1 - *s2;
|
|---|
| 2546 | } while (n > 0);
|
|---|
| 2547 | return 0;
|
|---|
| 2548 | }
|
|---|
| 2549 |
|
|---|
| 2550 |
|
|---|
| 2551 | /*********************************************************************
|
|---|
| 2552 | * _mbsnbcnt (CRTDLL.208)
|
|---|
| 2553 | */
|
|---|
| 2554 | size_t CDECL CRTDLL__mbsnbcnt( const unsigned char *str, size_t n )
|
|---|
| 2555 | {
|
|---|
| 2556 | dprintf2(("CRTDLL: _mbsnbcnt\n"));
|
|---|
| 2557 | unsigned char *s = (unsigned char *)str;
|
|---|
| 2558 | while(*s != 0 && n > 0) {
|
|---|
| 2559 | if (!CRTDLL__ismbblead(*s) )
|
|---|
| 2560 | n--;
|
|---|
| 2561 | s++;
|
|---|
| 2562 | }
|
|---|
| 2563 |
|
|---|
| 2564 | return (size_t)(s - str);
|
|---|
| 2565 | }
|
|---|
| 2566 |
|
|---|
| 2567 |
|
|---|
| 2568 | /*********************************************************************
|
|---|
| 2569 | * _mbsnbcpy (CRTDLL.209)
|
|---|
| 2570 | */
|
|---|
| 2571 | unsigned char * CDECL CRTDLL__mbsnbcpy( unsigned char *str1, const unsigned char *str2, size_t n )
|
|---|
| 2572 | {
|
|---|
| 2573 | dprintf2(("CRTDLL: _mbsnbcpy\n"));
|
|---|
| 2574 | unsigned char *s1 = (unsigned char *)str1;
|
|---|
| 2575 | unsigned char *s2 = (unsigned char *)str2;
|
|---|
| 2576 |
|
|---|
| 2577 | unsigned short *short_s1, *short_s2;
|
|---|
| 2578 |
|
|---|
| 2579 | if (n == 0)
|
|---|
| 2580 | return 0;
|
|---|
| 2581 | do {
|
|---|
| 2582 |
|
|---|
| 2583 | if (*s2 == 0)
|
|---|
| 2584 | break;
|
|---|
| 2585 |
|
|---|
| 2586 | if ( !CRTDLL__ismbblead(*s2) ) {
|
|---|
| 2587 |
|
|---|
| 2588 | *s1 = *s2;
|
|---|
| 2589 | s1 += 1;
|
|---|
| 2590 | s2 += 1;
|
|---|
| 2591 | n--;
|
|---|
| 2592 | }
|
|---|
| 2593 | else {
|
|---|
| 2594 | short_s1 = (unsigned short *)s1;
|
|---|
| 2595 | short_s2 = (unsigned short *)s2;
|
|---|
| 2596 | *short_s1 = *short_s2;
|
|---|
| 2597 | s1 += 2;
|
|---|
| 2598 | s2 += 2;
|
|---|
| 2599 | n-=2;
|
|---|
| 2600 | }
|
|---|
| 2601 | } while (n > 0);
|
|---|
| 2602 | return str1;
|
|---|
| 2603 | }
|
|---|
| 2604 |
|
|---|
| 2605 |
|
|---|
| 2606 | /*********************************************************************
|
|---|
| 2607 | * _mbsnbicmp (CRTDLL.210)
|
|---|
| 2608 | */
|
|---|
| 2609 | int CDECL CRTDLL__mbsnbicmp( const unsigned char *s1, const unsigned char *s2, size_t n )
|
|---|
| 2610 | {
|
|---|
| 2611 | dprintf2(("CRTDLL: _mbsnbicmp\n"));
|
|---|
| 2612 | if (n == 0)
|
|---|
| 2613 | return 0;
|
|---|
| 2614 | do {
|
|---|
| 2615 | if (_mbbtoupper(*s1) != _mbbtoupper(*s2))
|
|---|
| 2616 | return _mbbtoupper(*(unsigned const char *)s1) - _mbbtoupper(*(unsigned const char *)s2);
|
|---|
| 2617 | s1 += _mbclen2(*s1);
|
|---|
| 2618 | s2 += _mbclen2(*s2);
|
|---|
| 2619 |
|
|---|
| 2620 |
|
|---|
| 2621 | if (*s1 == 0)
|
|---|
| 2622 | break;
|
|---|
| 2623 | n--;
|
|---|
| 2624 | } while (n > 0);
|
|---|
| 2625 | return 0;
|
|---|
| 2626 | }
|
|---|
| 2627 |
|
|---|
| 2628 |
|
|---|
| 2629 | /*********************************************************************
|
|---|
| 2630 | * _mbsnbset (CRTDLL.211)
|
|---|
| 2631 | */
|
|---|
| 2632 | unsigned char * CDECL CRTDLL__mbsnbset( unsigned char *src, unsigned int val, size_t count )
|
|---|
| 2633 | {
|
|---|
| 2634 | dprintf2(("CRTDLL: _mbsnbset\n"));
|
|---|
| 2635 | unsigned char *char_src = (unsigned char *)src;
|
|---|
| 2636 | unsigned short *short_src = (unsigned short *)src;
|
|---|
| 2637 |
|
|---|
| 2638 | if ( _mbclen2(val) == 1 ) {
|
|---|
| 2639 |
|
|---|
| 2640 | while(count > 0) {
|
|---|
| 2641 | *char_src = val;
|
|---|
| 2642 | char_src++;
|
|---|
| 2643 | count--;
|
|---|
| 2644 | }
|
|---|
| 2645 | *char_src = 0;
|
|---|
| 2646 | }
|
|---|
| 2647 | else {
|
|---|
| 2648 | while(count > 0) {
|
|---|
| 2649 | *short_src = val;
|
|---|
| 2650 | short_src++;
|
|---|
| 2651 | count-=2;
|
|---|
| 2652 | }
|
|---|
| 2653 | *short_src = 0;
|
|---|
| 2654 | }
|
|---|
| 2655 |
|
|---|
| 2656 | return src;
|
|---|
| 2657 | }
|
|---|
| 2658 |
|
|---|
| 2659 |
|
|---|
| 2660 | /*********************************************************************
|
|---|
| 2661 | * _mbsncat (CRTDLL.212)
|
|---|
| 2662 | */
|
|---|
| 2663 | unsigned char * CDECL CRTDLL__mbsncat( unsigned char *dst, const unsigned char *src, size_t n )
|
|---|
| 2664 | {
|
|---|
| 2665 | dprintf2(("CRTDLL: _mbsncat\n"));
|
|---|
| 2666 | char *d = (char *)dst;
|
|---|
| 2667 | char *s = (char *)src;
|
|---|
| 2668 | if (n != 0) {
|
|---|
| 2669 | d = (char*)dst + strlen((char*)dst); // get the end of string
|
|---|
| 2670 | d += _mbclen2(*d); // move 1 or 2 up
|
|---|
| 2671 |
|
|---|
| 2672 | do {
|
|---|
| 2673 | if ((*d++ = *s++) == 0)
|
|---|
| 2674 | {
|
|---|
| 2675 | while (--n != 0)
|
|---|
| 2676 | *d++ = 0;
|
|---|
| 2677 | break;
|
|---|
| 2678 | }
|
|---|
| 2679 | if (!CRTDLL__ismbblead(*s) )
|
|---|
| 2680 | n--;
|
|---|
| 2681 | } while (n > 0);
|
|---|
| 2682 | }
|
|---|
| 2683 | return dst;
|
|---|
| 2684 | }
|
|---|
| 2685 |
|
|---|
| 2686 |
|
|---|
| 2687 | /*********************************************************************
|
|---|
| 2688 | * _mbsnccnt (CRTDLL.213)
|
|---|
| 2689 | */
|
|---|
| 2690 | size_t CDECL CRTDLL__mbsnccnt( const unsigned char *str, size_t n )
|
|---|
| 2691 | {
|
|---|
| 2692 | dprintf2(("CRTDLL: _mbsnccnt\n"));
|
|---|
| 2693 | unsigned char *s = (unsigned char *)str;
|
|---|
| 2694 | size_t cnt = 0;
|
|---|
| 2695 | while(*s != 0 && n > 0) {
|
|---|
| 2696 | if (CRTDLL__ismbblead(*s) )
|
|---|
| 2697 | s++;
|
|---|
| 2698 | else
|
|---|
| 2699 | n--;
|
|---|
| 2700 | s++;
|
|---|
| 2701 | cnt++;
|
|---|
| 2702 | }
|
|---|
| 2703 |
|
|---|
| 2704 | return cnt;
|
|---|
| 2705 | }
|
|---|
| 2706 |
|
|---|
| 2707 |
|
|---|
| 2708 | /*********************************************************************
|
|---|
| 2709 | * _mbsncmp (CRTDLL.214)
|
|---|
| 2710 | */
|
|---|
| 2711 | int CDECL CRTDLL__mbsncmp( const unsigned char *str1, const unsigned char *str2, size_t n )
|
|---|
| 2712 | {
|
|---|
| 2713 | dprintf2(("CRTDLL: _mbsncmp\n"));
|
|---|
| 2714 | unsigned char *s1 = (unsigned char *)str1;
|
|---|
| 2715 | unsigned char *s2 = (unsigned char *)str2;
|
|---|
| 2716 |
|
|---|
| 2717 | unsigned short *short_s1, *short_s2;
|
|---|
| 2718 |
|
|---|
| 2719 | int l1, l2;
|
|---|
| 2720 |
|
|---|
| 2721 | if (n == 0)
|
|---|
| 2722 | return 0;
|
|---|
| 2723 | do {
|
|---|
| 2724 |
|
|---|
| 2725 | if (*s1 == 0)
|
|---|
| 2726 | break;
|
|---|
| 2727 |
|
|---|
| 2728 | l1 = CRTDLL__ismbblead(*s1);
|
|---|
| 2729 | l2 = CRTDLL__ismbblead(*s2);
|
|---|
| 2730 | if ( !l1 && !l2 ) {
|
|---|
| 2731 |
|
|---|
| 2732 | if (*s1 != *s2)
|
|---|
| 2733 | return *s1 - *s2;
|
|---|
| 2734 | else {
|
|---|
| 2735 | s1 += 1;
|
|---|
| 2736 | s2 += 1;
|
|---|
| 2737 | n--;
|
|---|
| 2738 | }
|
|---|
| 2739 | }
|
|---|
| 2740 | else if ( l1 && l2 ){
|
|---|
| 2741 | short_s1 = (unsigned short *)s1;
|
|---|
| 2742 | short_s2 = (unsigned short *)s2;
|
|---|
| 2743 | if ( *short_s1 != *short_s2 )
|
|---|
| 2744 | return *short_s1 - *short_s2;
|
|---|
| 2745 | else {
|
|---|
| 2746 | s1 += 2;
|
|---|
| 2747 | s2 += 2;
|
|---|
| 2748 | n--;
|
|---|
| 2749 |
|
|---|
| 2750 | }
|
|---|
| 2751 | }
|
|---|
| 2752 | else
|
|---|
| 2753 | return *s1 - *s2;
|
|---|
| 2754 | } while (n > 0);
|
|---|
| 2755 | return 0;
|
|---|
| 2756 | }
|
|---|
| 2757 |
|
|---|
| 2758 |
|
|---|
| 2759 | /*********************************************************************
|
|---|
| 2760 | * _mbsncpy (CRTDLL.215)
|
|---|
| 2761 | */
|
|---|
| 2762 | unsigned char * CDECL CRTDLL__mbsncpy( unsigned char *str1, const unsigned char *str2, size_t n )
|
|---|
| 2763 | {
|
|---|
| 2764 | dprintf2(("CRTDLL: _mbsncpy\n"));
|
|---|
| 2765 | unsigned char *s1 = (unsigned char *)str1;
|
|---|
| 2766 | unsigned char *s2 = (unsigned char *)str2;
|
|---|
| 2767 |
|
|---|
| 2768 | unsigned short *short_s1, *short_s2;
|
|---|
| 2769 |
|
|---|
| 2770 | if (n == 0)
|
|---|
| 2771 | return 0;
|
|---|
| 2772 | do {
|
|---|
| 2773 |
|
|---|
| 2774 | if (*s2 == 0)
|
|---|
| 2775 | break;
|
|---|
| 2776 |
|
|---|
| 2777 | if ( !CRTDLL__ismbblead(*s2) ) {
|
|---|
| 2778 |
|
|---|
| 2779 | *s1 = *s2;
|
|---|
| 2780 | s1 += 1;
|
|---|
| 2781 | s2 += 1;
|
|---|
| 2782 | n--;
|
|---|
| 2783 | }
|
|---|
| 2784 | else {
|
|---|
| 2785 | short_s1 = (unsigned short *)s1;
|
|---|
| 2786 | short_s2 = (unsigned short *)s2;
|
|---|
| 2787 | *short_s1 = *short_s2;
|
|---|
| 2788 | s1 += 2;
|
|---|
| 2789 | s2 += 2;
|
|---|
| 2790 | n--;
|
|---|
| 2791 | }
|
|---|
| 2792 | } while (n > 0);
|
|---|
| 2793 | return str1;
|
|---|
| 2794 | }
|
|---|
| 2795 |
|
|---|
| 2796 |
|
|---|
| 2797 | /*********************************************************************
|
|---|
| 2798 | * _mbsnextc (CRTDLL.216)
|
|---|
| 2799 | */
|
|---|
| 2800 | unsigned int CDECL CRTDLL__mbsnextc( const unsigned char *src )
|
|---|
| 2801 | {
|
|---|
| 2802 | dprintf2(("CRTDLL: _mbsnextc\n"));
|
|---|
| 2803 | unsigned char *char_src = (unsigned char *)src;
|
|---|
| 2804 | unsigned short *short_src = (unsigned short *)src;
|
|---|
| 2805 |
|
|---|
| 2806 | if ( src == NULL )
|
|---|
| 2807 | return 0;
|
|---|
| 2808 |
|
|---|
| 2809 | if ( !CRTDLL__ismbblead(*src) )
|
|---|
| 2810 | return *char_src;
|
|---|
| 2811 | else
|
|---|
| 2812 | return *short_src;
|
|---|
| 2813 | return 0;
|
|---|
| 2814 |
|
|---|
| 2815 | }
|
|---|
| 2816 |
|
|---|
| 2817 |
|
|---|
| 2818 | /*********************************************************************
|
|---|
| 2819 | * _mbsnicmp (CRTDLL.217)
|
|---|
| 2820 | */
|
|---|
| 2821 | int CDECL CRTDLL__mbsnicmp( const unsigned char *s1, const unsigned char *s2, size_t n )
|
|---|
| 2822 | {
|
|---|
| 2823 | dprintf2(("CRTDLL: _mbsnicmp\n"));
|
|---|
| 2824 | if (n == 0)
|
|---|
| 2825 | return 0;
|
|---|
| 2826 | do {
|
|---|
| 2827 | if (_mbbtoupper(*s1) != _mbbtoupper(*s2))
|
|---|
| 2828 | return _mbbtoupper(*(unsigned const char *)s1) - _mbbtoupper(*(unsigned const char *)s2);
|
|---|
| 2829 |
|
|---|
| 2830 | // Next 2 lines won't compile
|
|---|
| 2831 | // *s1 += _mbclen2(*s1);
|
|---|
| 2832 | // *s2 += _mbclen2(*s2);
|
|---|
| 2833 |
|
|---|
| 2834 |
|
|---|
| 2835 | if (*s1 == 0)
|
|---|
| 2836 | break;
|
|---|
| 2837 | if (!CRTDLL__ismbblead(*s1) )
|
|---|
| 2838 | n--;
|
|---|
| 2839 | } while (n > 0);
|
|---|
| 2840 | return 0;
|
|---|
| 2841 | }
|
|---|
| 2842 |
|
|---|
| 2843 |
|
|---|
| 2844 | /*********************************************************************
|
|---|
| 2845 | * _mbsninc (CRTDLL.218)
|
|---|
| 2846 | */
|
|---|
| 2847 | unsigned char * CDECL CRTDLL__mbsninc( const unsigned char *str, size_t n )
|
|---|
| 2848 | {
|
|---|
| 2849 | dprintf2(("CRTDLL: _mbsninc\n"));
|
|---|
| 2850 | unsigned char *s = (unsigned char *)str;
|
|---|
| 2851 | while(*s != 0 && n > 0) {
|
|---|
| 2852 | if (!CRTDLL__ismbblead(*s) )
|
|---|
| 2853 | n--;
|
|---|
| 2854 | s++;
|
|---|
| 2855 | }
|
|---|
| 2856 |
|
|---|
| 2857 | return s;
|
|---|
| 2858 | }
|
|---|
| 2859 |
|
|---|
| 2860 |
|
|---|
| 2861 | /*********************************************************************
|
|---|
| 2862 | * _mbsnset (CRTDLL.219)
|
|---|
| 2863 | */
|
|---|
| 2864 | unsigned char * CDECL CRTDLL__mbsnset( unsigned char *src, unsigned int val, size_t count )
|
|---|
| 2865 | {
|
|---|
| 2866 | dprintf2(("CRTDLL: _mbsnset\n"));
|
|---|
| 2867 | unsigned char *char_src = (unsigned char *)src;
|
|---|
| 2868 | unsigned short *short_src = (unsigned short *)src;
|
|---|
| 2869 |
|
|---|
| 2870 | if ( _mbclen2(val) == 1 ) {
|
|---|
| 2871 |
|
|---|
| 2872 | while(count > 0) {
|
|---|
| 2873 | *char_src = val;
|
|---|
| 2874 | char_src++;
|
|---|
| 2875 | count--;
|
|---|
| 2876 | }
|
|---|
| 2877 | *char_src = 0;
|
|---|
| 2878 | }
|
|---|
| 2879 | else {
|
|---|
| 2880 | while(count > 0) {
|
|---|
| 2881 | *short_src = val;
|
|---|
| 2882 | short_src++;
|
|---|
| 2883 | count-=2;
|
|---|
| 2884 | }
|
|---|
| 2885 | *short_src = 0;
|
|---|
| 2886 | }
|
|---|
| 2887 |
|
|---|
| 2888 | return src;
|
|---|
| 2889 |
|
|---|
| 2890 | }
|
|---|
| 2891 |
|
|---|
| 2892 |
|
|---|
| 2893 | /*********************************************************************
|
|---|
| 2894 | * _mbspbrk (CRTDLL.220)
|
|---|
| 2895 | */
|
|---|
| 2896 | unsigned char * CDECL CRTDLL__mbspbrk( const unsigned char *s1, const unsigned char *s2 )
|
|---|
| 2897 | {
|
|---|
| 2898 | dprintf2(("CRTDLL: _mbspbrk\n"));
|
|---|
| 2899 | const char *scanp;
|
|---|
| 2900 | int c, sc;
|
|---|
| 2901 |
|
|---|
| 2902 | while ((c = *s1++) != 0)
|
|---|
| 2903 | {
|
|---|
| 2904 | for (scanp = (char*)s2; (sc = *scanp++) != 0;)
|
|---|
| 2905 | if (sc == c)
|
|---|
| 2906 | return (unsigned char *)((char *)s1 - (char *)1);
|
|---|
| 2907 | }
|
|---|
| 2908 | return 0;
|
|---|
| 2909 | }
|
|---|
| 2910 |
|
|---|
| 2911 |
|
|---|
| 2912 | /*********************************************************************
|
|---|
| 2913 | * CRTDLL__mbsrchr (CRTDLL.221)
|
|---|
| 2914 | */
|
|---|
| 2915 | LPSTR CDECL CRTDLL__mbsrchr(LPSTR s,CHAR x)
|
|---|
| 2916 | {
|
|---|
| 2917 | dprintf2(("CRTDLL: _mbsrchr\n"));
|
|---|
| 2918 | /* FIXME: handle multibyte strings */
|
|---|
| 2919 | return strrchr(s,x);
|
|---|
| 2920 | }
|
|---|
| 2921 |
|
|---|
| 2922 |
|
|---|
| 2923 | /*********************************************************************
|
|---|
| 2924 | * _mbsrev (CRTDLL.222)
|
|---|
| 2925 | */
|
|---|
| 2926 | unsigned char * CDECL CRTDLL__mbsrev( unsigned char *s )
|
|---|
| 2927 | {
|
|---|
| 2928 | dprintf2(("CRTDLL: _mbsrev\n"));
|
|---|
| 2929 | unsigned char *e;
|
|---|
| 2930 | unsigned char a;
|
|---|
| 2931 | e=s;
|
|---|
| 2932 | while (*e) {
|
|---|
| 2933 | if ( CRTDLL__ismbblead(*e) ) {
|
|---|
| 2934 | a = *e;
|
|---|
| 2935 | *e = *++e;
|
|---|
| 2936 | if ( *e == 0 )
|
|---|
| 2937 | break;
|
|---|
| 2938 | *e = a;
|
|---|
| 2939 | }
|
|---|
| 2940 | e++;
|
|---|
| 2941 | }
|
|---|
| 2942 | while (s<e) {
|
|---|
| 2943 | a=*s;
|
|---|
| 2944 | *s=*e;
|
|---|
| 2945 | *e=a;
|
|---|
| 2946 | s++;
|
|---|
| 2947 | e--;
|
|---|
| 2948 | }
|
|---|
| 2949 |
|
|---|
| 2950 |
|
|---|
| 2951 | return s;
|
|---|
| 2952 | }
|
|---|
| 2953 |
|
|---|
| 2954 |
|
|---|
| 2955 | /*********************************************************************
|
|---|
| 2956 | * _mbsset (CRTDLL.223)
|
|---|
| 2957 | */
|
|---|
| 2958 | unsigned char * CDECL CRTDLL__mbsset( unsigned char *src, unsigned int c )
|
|---|
| 2959 | {
|
|---|
| 2960 | dprintf2(("CRTDLL: _mbsset\n"));
|
|---|
| 2961 | unsigned char *char_src = src;
|
|---|
| 2962 | unsigned short *short_src = (unsigned short*)src;
|
|---|
| 2963 |
|
|---|
| 2964 | if ( _mbclen2(c) == 1 ) {
|
|---|
| 2965 |
|
|---|
| 2966 | while(*char_src != 0) {
|
|---|
| 2967 | *char_src = c;
|
|---|
| 2968 | char_src++;
|
|---|
| 2969 | }
|
|---|
| 2970 | *char_src = 0;
|
|---|
| 2971 | }
|
|---|
| 2972 | else {
|
|---|
| 2973 | while(*short_src != 0) {
|
|---|
| 2974 | *short_src = c;
|
|---|
| 2975 | short_src++;
|
|---|
| 2976 | }
|
|---|
| 2977 | *short_src = 0;
|
|---|
| 2978 | }
|
|---|
| 2979 |
|
|---|
| 2980 | return src;
|
|---|
| 2981 | }
|
|---|
| 2982 |
|
|---|
| 2983 |
|
|---|
| 2984 | /*********************************************************************
|
|---|
| 2985 | * _mbsspn (CRTDLL.224)
|
|---|
| 2986 | */
|
|---|
| 2987 | size_t CDECL CRTDLL__mbsspn( const unsigned char *s1, const unsigned char *s2 )
|
|---|
| 2988 | {
|
|---|
| 2989 | dprintf2(("CRTDLL: _mbsspn\n"));
|
|---|
| 2990 | const char *p = (char*)s1, *spanp;
|
|---|
| 2991 | char c, sc;
|
|---|
| 2992 |
|
|---|
| 2993 | cont:
|
|---|
| 2994 | c = *p++;
|
|---|
| 2995 | for (spanp = (char*)s2; (sc = *spanp++) != 0;)
|
|---|
| 2996 | if (sc == c)
|
|---|
| 2997 | goto cont;
|
|---|
| 2998 | return (size_t)(p - 1) - (size_t)s1;
|
|---|
| 2999 | }
|
|---|
| 3000 |
|
|---|
| 3001 |
|
|---|
| 3002 | /*********************************************************************
|
|---|
| 3003 | * _mbsspnp (CRTDLL.225)
|
|---|
| 3004 | */
|
|---|
| 3005 | unsigned char * CDECL CRTDLL__mbsspnp( const unsigned char *s1, const unsigned char *s2 )
|
|---|
| 3006 | {
|
|---|
| 3007 | dprintf2(("CRTDLL: _mbsspnp\n"));
|
|---|
| 3008 | const char *p = (char*)s1, *spanp;
|
|---|
| 3009 | char c, sc;
|
|---|
| 3010 |
|
|---|
| 3011 | cont:
|
|---|
| 3012 | c = *p++;
|
|---|
| 3013 | for (spanp = (char*)s2; (sc = *spanp++) != 0;)
|
|---|
| 3014 | if (sc == c)
|
|---|
| 3015 | goto cont;
|
|---|
| 3016 | return (unsigned char*)p;
|
|---|
| 3017 | }
|
|---|
| 3018 |
|
|---|
| 3019 |
|
|---|
| 3020 | /*********************************************************************
|
|---|
| 3021 | * _mbsstr (CRTDLL.226)
|
|---|
| 3022 | */
|
|---|
| 3023 | unsigned char * CDECL CRTDLL__mbsstr( const unsigned char *s1, const unsigned char *s2 )
|
|---|
| 3024 | {
|
|---|
| 3025 | dprintf2(("CRTDLL: _mbsstr\n"));
|
|---|
| 3026 | return (unsigned char*)strstr((const char*)s1,(const char*)s2);
|
|---|
| 3027 | }
|
|---|
| 3028 |
|
|---|
| 3029 |
|
|---|
| 3030 | /*********************************************************************
|
|---|
| 3031 | * _mbstok (CRTDLL.227)
|
|---|
| 3032 | */
|
|---|
| 3033 | unsigned char * CDECL CRTDLL__mbstok( unsigned char *s, const unsigned char *delim )
|
|---|
| 3034 | {
|
|---|
| 3035 | dprintf2(("CRTDLL: _mbstok\n"));
|
|---|
| 3036 | const char *spanp;
|
|---|
| 3037 | int c, sc;
|
|---|
| 3038 | char *tok;
|
|---|
| 3039 | static char *last;
|
|---|
| 3040 |
|
|---|
| 3041 |
|
|---|
| 3042 | if (s == NULL && (s = (unsigned char*)last) == NULL)
|
|---|
| 3043 | return (NULL);
|
|---|
| 3044 |
|
|---|
| 3045 | /*
|
|---|
| 3046 | * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
|
|---|
| 3047 | */
|
|---|
| 3048 | cont:
|
|---|
| 3049 | c = *s;
|
|---|
| 3050 | s = (unsigned char*)CRTDLL__mbsinc((LPCSTR)s);
|
|---|
| 3051 |
|
|---|
| 3052 | for (spanp = (const char*)delim; (sc = *spanp) != 0; spanp = CRTDLL__mbsinc(spanp)) {
|
|---|
| 3053 | if (c == sc)
|
|---|
| 3054 | goto cont;
|
|---|
| 3055 | }
|
|---|
| 3056 |
|
|---|
| 3057 | if (c == 0) { /* no non-delimiter characters */
|
|---|
| 3058 | last = NULL;
|
|---|
| 3059 | return (NULL);
|
|---|
| 3060 | }
|
|---|
| 3061 | tok = (char*)s - 1;
|
|---|
| 3062 |
|
|---|
| 3063 | /*
|
|---|
| 3064 | * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
|
|---|
| 3065 | * Note that delim must have one NUL; we stop if we see that, too.
|
|---|
| 3066 | */
|
|---|
| 3067 | for (;;) {
|
|---|
| 3068 | c = *s;
|
|---|
| 3069 | s = (unsigned char*)CRTDLL__mbsinc((LPCSTR)s);
|
|---|
| 3070 | spanp = (const char*)delim;
|
|---|
| 3071 | do {
|
|---|
| 3072 | if ((sc = *spanp) == c) {
|
|---|
| 3073 | if (c == 0)
|
|---|
| 3074 | s = NULL;
|
|---|
| 3075 | else
|
|---|
| 3076 | s[-1] = 0;
|
|---|
| 3077 | last = (char*)s;
|
|---|
| 3078 | return ((unsigned char*)tok);
|
|---|
| 3079 | }
|
|---|
| 3080 | spanp = CRTDLL__mbsinc(spanp);
|
|---|
| 3081 | } while (sc != 0);
|
|---|
| 3082 | }
|
|---|
| 3083 | /* NOTREACHED */
|
|---|
| 3084 | }
|
|---|
| 3085 |
|
|---|
| 3086 |
|
|---|
| 3087 | /*********************************************************************
|
|---|
| 3088 | * _mbstrlen (CRTDLL.228)
|
|---|
| 3089 | */
|
|---|
| 3090 | size_t CDECL CRTDLL__mbstrlen(const char *string)
|
|---|
| 3091 | {
|
|---|
| 3092 | dprintf2(("CRTDLL: _mbstrlen\n"));
|
|---|
| 3093 | char *s = (char *)string;
|
|---|
| 3094 | size_t i;
|
|---|
| 3095 | while ( *s != 0 ) {
|
|---|
| 3096 | if ( CRTDLL__ismbblead(*s) )
|
|---|
| 3097 | s++;
|
|---|
| 3098 | s++;
|
|---|
| 3099 | i++;
|
|---|
| 3100 | }
|
|---|
| 3101 | return i;
|
|---|
| 3102 | }
|
|---|
| 3103 |
|
|---|
| 3104 |
|
|---|
| 3105 | /*********************************************************************
|
|---|
| 3106 | * _mbsupr (CRTDLL.229)
|
|---|
| 3107 | */
|
|---|
| 3108 | unsigned char * CDECL CRTDLL__mbsupr( unsigned char *x )
|
|---|
| 3109 | {
|
|---|
| 3110 | dprintf2(("CRTDLL: _mbsupr\n"));
|
|---|
| 3111 | unsigned char *y=x;
|
|---|
| 3112 | while (*y) {
|
|---|
| 3113 | if (!CRTDLL__ismbblead(*y) )
|
|---|
| 3114 | *y = toupper(*y);
|
|---|
| 3115 | else {
|
|---|
| 3116 | *y=CRTDLL__mbctoupper(*(unsigned short *)y);
|
|---|
| 3117 | y++;
|
|---|
| 3118 | }
|
|---|
| 3119 | }
|
|---|
| 3120 | return x;
|
|---|
| 3121 | }
|
|---|
| 3122 |
|
|---|
| 3123 |
|
|---|
| 3124 | /*********************************************************************
|
|---|
| 3125 | * CRTDLL__memccpy (CRTDLL.230)
|
|---|
| 3126 | */
|
|---|
| 3127 | void * CDECL CRTDLL__memccpy(void *to, const void *from,int c,size_t count)
|
|---|
| 3128 | {
|
|---|
| 3129 | dprintf2(("CRTDLL: _memccpy\n"));
|
|---|
| 3130 | memcpy(to,from,count);
|
|---|
| 3131 | return memchr(to,c,count);
|
|---|
| 3132 | }
|
|---|
| 3133 |
|
|---|
| 3134 |
|
|---|
| 3135 | /*********************************************************************
|
|---|
| 3136 | * _mkdir (CRTDLL.232)
|
|---|
| 3137 | */
|
|---|
| 3138 | INT CDECL CRTDLL__mkdir(LPCSTR newdir)
|
|---|
| 3139 | {
|
|---|
| 3140 | dprintf2(("CRTDLL: mkdir\n"));
|
|---|
| 3141 | if (!CreateDirectoryA(newdir,NULL))
|
|---|
| 3142 | return -1;
|
|---|
| 3143 | return 0;
|
|---|
| 3144 | }
|
|---|
| 3145 |
|
|---|
| 3146 |
|
|---|
| 3147 | /*********************************************************************
|
|---|
| 3148 | * _mktemp (CRTDLL.233)
|
|---|
| 3149 | */
|
|---|
| 3150 | char * CDECL CRTDLL__mktemp( char * _template )
|
|---|
| 3151 | {
|
|---|
| 3152 | dprintf2(("CRTDLL: _mktemp\n"));
|
|---|
| 3153 | static int count = 0;
|
|---|
| 3154 | char *cp, *dp;
|
|---|
| 3155 | int i, len, xcount, loopcnt;
|
|---|
| 3156 |
|
|---|
| 3157 |
|
|---|
| 3158 |
|
|---|
| 3159 | len = strlen (_template);
|
|---|
| 3160 | cp = _template + len;
|
|---|
| 3161 |
|
|---|
| 3162 | xcount = 0;
|
|---|
| 3163 | while (xcount < 6 && cp > _template && cp[-1] == 'X')
|
|---|
| 3164 | xcount++, cp--;
|
|---|
| 3165 |
|
|---|
| 3166 | if (xcount) {
|
|---|
| 3167 | dp = cp;
|
|---|
| 3168 | while (dp > _template && dp[-1] != '/' && dp[-1] != '\\' && dp[-1] != ':')
|
|---|
| 3169 | dp--;
|
|---|
| 3170 |
|
|---|
| 3171 | /* Keep the first characters of the template, but turn the rest into
|
|---|
| 3172 | Xs. */
|
|---|
| 3173 | while (cp > dp + 8 - xcount) {
|
|---|
| 3174 | *--cp = 'X';
|
|---|
| 3175 | xcount = (xcount >= 6) ? 6 : 1 + xcount;
|
|---|
| 3176 | }
|
|---|
| 3177 |
|
|---|
| 3178 | /* If dots occur too early -- squash them. */
|
|---|
| 3179 | while (dp < cp) {
|
|---|
| 3180 | if (*dp == '.') *dp = 'a';
|
|---|
| 3181 | dp++;
|
|---|
| 3182 | }
|
|---|
| 3183 |
|
|---|
| 3184 | /* Try to add ".tmp" to the filename. Truncate unused Xs. */
|
|---|
| 3185 | if (cp + xcount + 3 < _template + len)
|
|---|
| 3186 | strcpy (cp + xcount, ".tmp");
|
|---|
| 3187 | else
|
|---|
| 3188 | cp[xcount] = 0;
|
|---|
| 3189 |
|
|---|
| 3190 | for (loopcnt = 0; loopcnt < (1 << (5 * xcount)); loopcnt++) {
|
|---|
| 3191 | int c = count++;
|
|---|
| 3192 | for (i = 0; i < xcount; i++, c >>= 5)
|
|---|
| 3193 | cp[i] = "abcdefghijklmnopqrstuvwxyz012345"[c & 0x1f];
|
|---|
| 3194 | if (CRTDLL__access(_template,0) == -1)
|
|---|
| 3195 | return _template;
|
|---|
| 3196 | }
|
|---|
| 3197 | }
|
|---|
| 3198 | /* Failure: truncate the template and return NULL. */
|
|---|
| 3199 | *_template = 0;
|
|---|
| 3200 | return 0;
|
|---|
| 3201 | }
|
|---|
| 3202 |
|
|---|
| 3203 |
|
|---|
| 3204 | /*********************************************************************
|
|---|
| 3205 | * _msize (CRTDLL.234)
|
|---|
| 3206 | */
|
|---|
| 3207 | size_t CDECL CRTDLL__msize( void *ptr )
|
|---|
| 3208 | {
|
|---|
| 3209 | dprintf2(("CRTDLL: _msize\n"));
|
|---|
| 3210 | return (_msize(ptr));
|
|---|
| 3211 | }
|
|---|
| 3212 |
|
|---|
| 3213 |
|
|---|
| 3214 | /*********************************************************************
|
|---|
| 3215 | * _nextafter (CRTDLL.235)
|
|---|
| 3216 | */
|
|---|
| 3217 | double CDECL CRTDLL__nextafter( double x, double y )
|
|---|
| 3218 | {
|
|---|
| 3219 | dprintf2(("CRTDLL: _nextafter\n"));
|
|---|
| 3220 | if ( x == y)
|
|---|
| 3221 | return x;
|
|---|
| 3222 | if ( CRTDLL__isnan(x) || CRTDLL__isnan(y) )
|
|---|
| 3223 | return x;
|
|---|
| 3224 |
|
|---|
| 3225 | return x;
|
|---|
| 3226 | }
|
|---|
| 3227 |
|
|---|
| 3228 |
|
|---|
| 3229 | /*********************************************************************
|
|---|
| 3230 | * _onexit (CRTDLL.236)
|
|---|
| 3231 | */
|
|---|
| 3232 | onexit_t CDECL CRTDLL__onexit(onexit_t t)
|
|---|
| 3233 | {
|
|---|
| 3234 | dprintf2(("CRTDLL: _onexit\n"));
|
|---|
| 3235 | return (_onexit(t));
|
|---|
| 3236 | }
|
|---|
| 3237 |
|
|---|
| 3238 |
|
|---|
| 3239 | /*********************************************************************
|
|---|
| 3240 | * _open (CRTDLL.237)
|
|---|
| 3241 | */
|
|---|
| 3242 | HFILE CDECL CRTDLL__open(LPCSTR path,INT flags)
|
|---|
| 3243 | {
|
|---|
| 3244 | dprintf2(("CRTDLL: _open\n"));
|
|---|
| 3245 | DWORD access = 0, creation = 0;
|
|---|
| 3246 | HFILE ret;
|
|---|
| 3247 |
|
|---|
| 3248 | switch(flags & 3)
|
|---|
| 3249 | {
|
|---|
| 3250 | case O_RDONLY: access |= GENERIC_READ; break;
|
|---|
| 3251 | case O_WRONLY: access |= GENERIC_WRITE; break;
|
|---|
| 3252 | case O_RDWR: access |= GENERIC_WRITE | GENERIC_READ; break;
|
|---|
| 3253 | }
|
|---|
| 3254 |
|
|---|
| 3255 | if (flags & 0x0100) /* O_CREAT */
|
|---|
| 3256 | {
|
|---|
| 3257 | if (flags & 0x0400) /* O_EXCL */
|
|---|
| 3258 | creation = CREATE_NEW;
|
|---|
| 3259 | else if (flags & 0x0200) /* O_TRUNC */
|
|---|
| 3260 | creation = CREATE_ALWAYS;
|
|---|
| 3261 | else
|
|---|
| 3262 | creation = OPEN_ALWAYS;
|
|---|
| 3263 | }
|
|---|
| 3264 | else /* no O_CREAT */
|
|---|
| 3265 | {
|
|---|
| 3266 | if (flags & 0x0200) /* O_TRUNC */
|
|---|
| 3267 | creation = TRUNCATE_EXISTING;
|
|---|
| 3268 | else
|
|---|
| 3269 | creation = OPEN_EXISTING;
|
|---|
| 3270 | }
|
|---|
| 3271 | if (flags & 0x0008) /* O_APPEND */
|
|---|
| 3272 | dprintf2(("O_APPEND not supported\n" ));
|
|---|
| 3273 | if (flags & 0xf0f4)
|
|---|
| 3274 | dprintf2(("CRTDLL_open file unsupported flags 0x%04x\n",flags));
|
|---|
| 3275 | /* End Fixme */
|
|---|
| 3276 |
|
|---|
| 3277 | ret = CreateFileA( path, access, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
|---|
| 3278 | NULL, creation, FILE_ATTRIBUTE_NORMAL, -1 );
|
|---|
| 3279 | dprintf2(("CRTDLL_open file %s mode 0x%04x got handle %d\n", path,flags,ret));
|
|---|
| 3280 | return ret;
|
|---|
| 3281 | }
|
|---|
| 3282 |
|
|---|
| 3283 |
|
|---|
| 3284 | /*********************************************************************
|
|---|
| 3285 | * _open_osfhandle (CRTDLL.238)
|
|---|
| 3286 | */
|
|---|
| 3287 | INT CDECL CRTDLL__open_osfhandle( long osfhandle, int flags )
|
|---|
| 3288 | {
|
|---|
| 3289 | dprintf2(("CRTDLL: _open_osfhandle\n"));
|
|---|
| 3290 | HFILE handle;
|
|---|
| 3291 |
|
|---|
| 3292 | switch (osfhandle) {
|
|---|
| 3293 | case STD_INPUT_HANDLE :
|
|---|
| 3294 | case 0 :
|
|---|
| 3295 | handle=0;
|
|---|
| 3296 | break;
|
|---|
| 3297 | case STD_OUTPUT_HANDLE:
|
|---|
| 3298 | case 1:
|
|---|
| 3299 | handle=1;
|
|---|
| 3300 | break;
|
|---|
| 3301 | case STD_ERROR_HANDLE:
|
|---|
| 3302 | case 2:
|
|---|
| 3303 | handle=2;
|
|---|
| 3304 | break;
|
|---|
| 3305 | default:
|
|---|
| 3306 | return (-1);
|
|---|
| 3307 | }
|
|---|
| 3308 | dprintf2(("(handle %08lx,flags %d) return %d\n",
|
|---|
| 3309 | osfhandle,flags,handle));
|
|---|
| 3310 | return handle;
|
|---|
| 3311 | }
|
|---|
| 3312 |
|
|---|
| 3313 |
|
|---|
| 3314 | /*********************************************************************
|
|---|
| 3315 | * _pclose (CRTDLL.244)
|
|---|
| 3316 | */
|
|---|
| 3317 | INT CDECL CRTDLL__pclose( FILE *fp )
|
|---|
| 3318 | {
|
|---|
| 3319 | dprintf(("CRTDLL: _pclose not implemented.\n"));
|
|---|
| 3320 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 3321 | return FALSE;
|
|---|
| 3322 | }
|
|---|
| 3323 |
|
|---|
| 3324 |
|
|---|
| 3325 | /*********************************************************************
|
|---|
| 3326 | * _pipe (CRTDLL.247)
|
|---|
| 3327 | */
|
|---|
| 3328 | INT CDECL CRTDLL__pipe( int *phandles, unsigned psize, int textmode )
|
|---|
| 3329 | {
|
|---|
| 3330 | dprintf(("CRTDLL: _pipe not implemented.\n"));
|
|---|
| 3331 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 3332 | return FALSE;
|
|---|
| 3333 | }
|
|---|
| 3334 |
|
|---|
| 3335 |
|
|---|
| 3336 | /*********************************************************************
|
|---|
| 3337 | * _popen (CRTDLL.248)
|
|---|
| 3338 | */
|
|---|
| 3339 | FILE * CDECL CRTDLL__popen( const char *command, const char *mode )
|
|---|
| 3340 | {
|
|---|
| 3341 | dprintf(("CRTDLL: _popen not implemented.\n"));
|
|---|
| 3342 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 3343 | return FALSE;
|
|---|
| 3344 | }
|
|---|
| 3345 |
|
|---|
| 3346 |
|
|---|
| 3347 | /*********************************************************************
|
|---|
| 3348 | * _purecall (CRTDLL.249)
|
|---|
| 3349 | */
|
|---|
| 3350 | void CDECL CRTDLL__purecall(void)
|
|---|
| 3351 | {
|
|---|
| 3352 | dprintf2(("CRTDLL: _purecall\n"));
|
|---|
| 3353 | }
|
|---|
| 3354 |
|
|---|
| 3355 |
|
|---|
| 3356 | /*********************************************************************
|
|---|
| 3357 | * _putch (CRTDLL.250)
|
|---|
| 3358 | */
|
|---|
| 3359 | INT CDECL CRTDLL__putch( int i )
|
|---|
| 3360 | {
|
|---|
| 3361 | dprintf2(("CRTDLL: _putch\n"));
|
|---|
| 3362 | return (_putch(i));
|
|---|
| 3363 | }
|
|---|
| 3364 |
|
|---|
| 3365 |
|
|---|
| 3366 | /*********************************************************************
|
|---|
| 3367 | * _putenv (CRTDLL.251)
|
|---|
| 3368 | */
|
|---|
| 3369 | INT CDECL CRTDLL__putenv(const char *s)
|
|---|
| 3370 | {
|
|---|
| 3371 | dprintf2(("CRTDLL: _putenv\n"));
|
|---|
| 3372 | return (_putenv(s));
|
|---|
| 3373 | }
|
|---|
| 3374 |
|
|---|
| 3375 |
|
|---|
| 3376 | /*********************************************************************
|
|---|
| 3377 | * _putw (CRTDLL.252)
|
|---|
| 3378 | */
|
|---|
| 3379 | INT CDECL CRTDLL__putw( int w, FILE *stream )
|
|---|
| 3380 | {
|
|---|
| 3381 | dprintf2(("CRTDLL: _putw\n"));
|
|---|
| 3382 | if (fwrite( &w, sizeof(w), 1, stream) < 1)
|
|---|
| 3383 | return(EOF);
|
|---|
| 3384 | return(0);
|
|---|
| 3385 | }
|
|---|
| 3386 |
|
|---|
| 3387 |
|
|---|
| 3388 | /*********************************************************************
|
|---|
| 3389 | * _read (CRTDLL.254)
|
|---|
| 3390 | */
|
|---|
| 3391 | INT CDECL CRTDLL__read(INT fd, LPVOID buf, UINT count)
|
|---|
| 3392 | {
|
|---|
| 3393 | dprintf(("CRTDLL: _read not implemented.\n"));
|
|---|
| 3394 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 3395 | return FALSE;
|
|---|
| 3396 | }
|
|---|
| 3397 |
|
|---|
| 3398 |
|
|---|
| 3399 | /*********************************************************************
|
|---|
| 3400 | * _rmdir (CRTDLL.255)
|
|---|
| 3401 | */
|
|---|
| 3402 | INT CDECL CRTDLL__rmdir(const char *path)
|
|---|
| 3403 | {
|
|---|
| 3404 | dprintf2(("CRTDLL: _rmdir\n"));
|
|---|
| 3405 | if (!RemoveDirectoryA(path))
|
|---|
| 3406 | return -1;
|
|---|
| 3407 | return 0;
|
|---|
| 3408 | }
|
|---|
| 3409 |
|
|---|
| 3410 |
|
|---|
| 3411 | /*********************************************************************
|
|---|
| 3412 | * _rmtmp (CRTDLL.256)
|
|---|
| 3413 | */
|
|---|
| 3414 | INT CDECL CRTDLL__rmtmp(void)
|
|---|
| 3415 | {
|
|---|
| 3416 | dprintf2(("CRTDLL: _rmtmp\n"));
|
|---|
| 3417 | return(_rmtmp());
|
|---|
| 3418 | }
|
|---|
| 3419 |
|
|---|
| 3420 |
|
|---|
| 3421 | /*********************************************************************
|
|---|
| 3422 | * CRTDLL__rotl (CRTDLL.257)
|
|---|
| 3423 | */
|
|---|
| 3424 | unsigned int CDECL CRTDLL__rotl( unsigned int value, unsigned int shift )
|
|---|
| 3425 | {
|
|---|
| 3426 | dprintf2(("CRTDLL: _rotl\n"));
|
|---|
| 3427 | return (_rotl(value, shift));
|
|---|
| 3428 | }
|
|---|
| 3429 |
|
|---|
| 3430 |
|
|---|
| 3431 | /*********************************************************************
|
|---|
| 3432 | * CRTDLL__rotr (CRTDLL.258)
|
|---|
| 3433 | */
|
|---|
| 3434 | unsigned int CDECL CRTDLL__rotr( unsigned int value, unsigned int shift )
|
|---|
| 3435 | {
|
|---|
| 3436 | dprintf2(("CRTDLL: _rotr\n"));
|
|---|
| 3437 | return (_rotr(value, shift));
|
|---|
| 3438 | }
|
|---|
| 3439 |
|
|---|
| 3440 |
|
|---|
| 3441 | /*********************************************************************
|
|---|
| 3442 | * _scalb (CRTDLL.259)
|
|---|
| 3443 | */
|
|---|
| 3444 | double CDECL CRTDLL__scalb( double __x, long e )
|
|---|
| 3445 | {
|
|---|
| 3446 | dprintf2(("CRTDLL: _scalb\n"));
|
|---|
| 3447 | double_t *x = (double_t *)&__x;
|
|---|
| 3448 |
|
|---|
| 3449 | x->exponent += e;
|
|---|
| 3450 |
|
|---|
| 3451 | return __x;
|
|---|
| 3452 | }
|
|---|
| 3453 |
|
|---|
| 3454 |
|
|---|
| 3455 | /*********************************************************************
|
|---|
| 3456 | * CRTDLL__searchenv (CRTDLL.260)
|
|---|
| 3457 | */
|
|---|
| 3458 | void CDECL CRTDLL__searchenv(const char *file,const char *var,char *path )
|
|---|
| 3459 | {
|
|---|
| 3460 | dprintf2(("CRTDLL: _searchenv\n"));
|
|---|
| 3461 | char *env = CRTDLL_getenv(var);
|
|---|
| 3462 |
|
|---|
| 3463 | char *x;
|
|---|
| 3464 | char *y;
|
|---|
| 3465 | char *FilePart;
|
|---|
| 3466 | x = strchr(env,'=');
|
|---|
| 3467 | if ( x != NULL ) {
|
|---|
| 3468 | *x = 0;
|
|---|
| 3469 | x++;
|
|---|
| 3470 | }
|
|---|
| 3471 | y = strchr(env,';');
|
|---|
| 3472 | while ( y != NULL ) {
|
|---|
| 3473 | *y = 0;
|
|---|
| 3474 | if ( SearchPathA(x,file,NULL,MAX_PATH,path,&FilePart) > 0 ) {
|
|---|
| 3475 | return;
|
|---|
| 3476 | }
|
|---|
| 3477 | x = y+1;
|
|---|
| 3478 | y = strchr(env,';');
|
|---|
| 3479 | }
|
|---|
| 3480 | return;
|
|---|
| 3481 | }
|
|---|
| 3482 |
|
|---|
| 3483 |
|
|---|
| 3484 | /*********************************************************************
|
|---|
| 3485 | * CRTDLL__seterrormode (CRTDLL.261)
|
|---|
| 3486 | */
|
|---|
| 3487 | void CDECL CRTDLL__seterrormode(int i)
|
|---|
| 3488 | {
|
|---|
| 3489 | dprintf2(("CRTDLL: _seterrormode\n"));
|
|---|
| 3490 | SetErrorMode(i);
|
|---|
| 3491 | return;
|
|---|
| 3492 | }
|
|---|
| 3493 |
|
|---|
| 3494 |
|
|---|
| 3495 | /*********************************************************************
|
|---|
| 3496 | * CRTDLL__setjmp (CRTDLL.262)
|
|---|
| 3497 | */
|
|---|
| 3498 | int CDECL CRTDLL__setjmp( jmp_buf env )
|
|---|
| 3499 | {
|
|---|
| 3500 | //TODO:
|
|---|
| 3501 | dprintf2(("CRTDLL: _setjmp -> setjmp (NOT IDENTICAL!!!)\n"));
|
|---|
| 3502 | return(setjmp( env));
|
|---|
| 3503 | }
|
|---|
| 3504 |
|
|---|
| 3505 | /*********************************************************************
|
|---|
| 3506 | * CRTDLL__setjmp3 (CRTDLL.262)
|
|---|
| 3507 | */
|
|---|
| 3508 | int CDECL CRTDLL__setjmp3( jmp_buf env )
|
|---|
| 3509 | {
|
|---|
| 3510 | //TODO:
|
|---|
| 3511 | dprintf2(("CRTDLL: _setjmp3 -> setjmp (NOT IDENTICAL!!!)\n"));
|
|---|
| 3512 | return(setjmp( env));
|
|---|
| 3513 | }
|
|---|
| 3514 |
|
|---|
| 3515 |
|
|---|
| 3516 | /*********************************************************************
|
|---|
| 3517 | * _setmode (CRTDLL.263)
|
|---|
| 3518 | */
|
|---|
| 3519 | INT CDECL CRTDLL__setmode( INT fh,INT mode)
|
|---|
| 3520 | {
|
|---|
| 3521 | dprintf2(("CRTDLL: _setmode\n"));
|
|---|
| 3522 | return (_setmode(fh, mode));
|
|---|
| 3523 | }
|
|---|
| 3524 |
|
|---|
| 3525 |
|
|---|
| 3526 | /*********************************************************************
|
|---|
| 3527 | * _setsystime (CRTDLL.264)
|
|---|
| 3528 | */
|
|---|
| 3529 | unsigned int CDECL CRTDLL__setsystime(struct tm *tp, unsigned int ms)
|
|---|
| 3530 | {
|
|---|
| 3531 | dprintf(("CRTDLL: _setsystime not implemented.\n"));
|
|---|
| 3532 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 3533 | return FALSE;
|
|---|
| 3534 | }
|
|---|
| 3535 |
|
|---|
| 3536 |
|
|---|
| 3537 | /*********************************************************************
|
|---|
| 3538 | * _sleep (CRTDLL.265)
|
|---|
| 3539 | */
|
|---|
| 3540 | VOID CDECL CRTDLL__sleep(unsigned long timeout)
|
|---|
| 3541 | {
|
|---|
| 3542 | dprintf2(("CRTDLL__sleep for %ld milliseconds\n",timeout));
|
|---|
| 3543 | Sleep((timeout)?timeout:1);
|
|---|
| 3544 | }
|
|---|
| 3545 |
|
|---|
| 3546 |
|
|---|
| 3547 | /*********************************************************************
|
|---|
| 3548 | * _sopen (CRTDLL.268)
|
|---|
| 3549 | */
|
|---|
| 3550 | int CDECL CRTDLL__sopen( const char *s, int i1, int i2, ... )
|
|---|
| 3551 | {
|
|---|
| 3552 | dprintf(("CRTDLL: _sopen not implemented.\n"));
|
|---|
| 3553 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 3554 | return FALSE;
|
|---|
| 3555 | }
|
|---|
| 3556 |
|
|---|
| 3557 |
|
|---|
| 3558 | /*********************************************************************
|
|---|
| 3559 | * CRTDLL__spawnl (CRTDLL.269)
|
|---|
| 3560 | */
|
|---|
| 3561 | int CDECL CRTDLL__spawnl(int nMode, const char* szPath, const char* szArgv0,...)
|
|---|
| 3562 | {
|
|---|
| 3563 | dprintf2(("CRTDLL: _spawnl\n"));
|
|---|
| 3564 | char *szArg[100];
|
|---|
| 3565 | const char *a;
|
|---|
| 3566 | int i = 0;
|
|---|
| 3567 | va_list l = 0;
|
|---|
| 3568 | va_start(l,szArgv0);
|
|---|
| 3569 | do {
|
|---|
| 3570 | a = va_arg(l,const char *);
|
|---|
| 3571 | szArg[i++] = (char *)a;
|
|---|
| 3572 | } while ( a != NULL && i < 100 );
|
|---|
| 3573 |
|
|---|
| 3574 | return _spawnve(nMode, (char*)szPath, szArg, _environ);
|
|---|
| 3575 | }
|
|---|
| 3576 |
|
|---|
| 3577 |
|
|---|
| 3578 | /*********************************************************************
|
|---|
| 3579 | * CRTDLL__spawnle (CRTDLL.270)
|
|---|
| 3580 | */
|
|---|
| 3581 | int CDECL CRTDLL__spawnle( int mode, char *path, char **szArgv0, ... )
|
|---|
| 3582 | {
|
|---|
| 3583 | dprintf2(("CRTDLL: _spawnle not correct implemented.\n"));
|
|---|
| 3584 | char *szArg[100];
|
|---|
| 3585 | char *a;
|
|---|
| 3586 | char *ptr;
|
|---|
| 3587 | int i = 0;
|
|---|
| 3588 | va_list l = 0;
|
|---|
| 3589 | va_start(l,szArgv0);
|
|---|
| 3590 | do {
|
|---|
| 3591 | a = (char*)va_arg(l,const char *);
|
|---|
| 3592 | szArg[i++] = (char *)a;
|
|---|
| 3593 | } while ( a != NULL && i < 100 );
|
|---|
| 3594 |
|
|---|
| 3595 |
|
|---|
| 3596 | // szArg0 is passed and not environment if there is only one parameter;
|
|---|
| 3597 |
|
|---|
| 3598 | if ( i >=2 ) {
|
|---|
| 3599 | ptr = szArg[i-2];
|
|---|
| 3600 | szArg[i-2] = NULL;
|
|---|
| 3601 | }
|
|---|
| 3602 | else
|
|---|
| 3603 | ptr = NULL;
|
|---|
| 3604 |
|
|---|
| 3605 | return _spawnve(mode, path, szArg, (char**)ptr);
|
|---|
| 3606 | }
|
|---|
| 3607 |
|
|---|
| 3608 |
|
|---|
| 3609 | /*********************************************************************
|
|---|
| 3610 | * CRTDLL__spawnlp (CRTDLL.271)
|
|---|
| 3611 | */
|
|---|
| 3612 | int CDECL CRTDLL__spawnlp(int nMode, const char* szPath, const char* szArgv0, ...)
|
|---|
| 3613 | {
|
|---|
| 3614 | dprintf2(("CRTDLL: _spawnlp\n"));
|
|---|
| 3615 | char *szArg[100];
|
|---|
| 3616 | const char *a;
|
|---|
| 3617 | int i = 0;
|
|---|
| 3618 | va_list l = 0;
|
|---|
| 3619 | va_start(l,szArgv0);
|
|---|
| 3620 | do {
|
|---|
| 3621 | a = (const char *)va_arg(l,const char *);
|
|---|
| 3622 | szArg[i++] = (char *)a;
|
|---|
| 3623 | } while ( a != NULL && i < 100 );
|
|---|
| 3624 | return _spawnvpe(nMode, (char*)szPath,szArg, _environ);
|
|---|
| 3625 | }
|
|---|
| 3626 |
|
|---|
| 3627 |
|
|---|
| 3628 | /*********************************************************************
|
|---|
| 3629 | * CRTDLL__spawnlpe (CRTDLL.272)
|
|---|
| 3630 | */
|
|---|
| 3631 | int CDECL CRTDLL__spawnlpe( int mode, char *path, char *szArgv0, ... )
|
|---|
| 3632 | {
|
|---|
| 3633 | dprintf2(("CRTDLL: _spawnlpe not correct implemented.\n"));
|
|---|
| 3634 | char *szArg[100];
|
|---|
| 3635 | const char *a;
|
|---|
| 3636 | char *ptr;
|
|---|
| 3637 | int i = 0;
|
|---|
| 3638 | va_list l = 0;
|
|---|
| 3639 | va_start(l,szArgv0);
|
|---|
| 3640 | do {
|
|---|
| 3641 | a = (char *)va_arg(l,const char *);
|
|---|
| 3642 | szArg[i++] = (char *)a;
|
|---|
| 3643 | } while ( a != NULL && i < 100 );
|
|---|
| 3644 |
|
|---|
| 3645 |
|
|---|
| 3646 | // szArg0 is passed and not environment if there is only one parameter;
|
|---|
| 3647 |
|
|---|
| 3648 | if ( i >=2 ) {
|
|---|
| 3649 | ptr = szArg[i-2];
|
|---|
| 3650 | szArg[i-2] = NULL;
|
|---|
| 3651 | }
|
|---|
| 3652 | else
|
|---|
| 3653 | ptr = NULL;
|
|---|
| 3654 |
|
|---|
| 3655 | return _spawnvpe(mode, path, szArg, (char**)ptr);
|
|---|
| 3656 | }
|
|---|
| 3657 |
|
|---|
| 3658 |
|
|---|
| 3659 | /*********************************************************************
|
|---|
| 3660 | * CRTDLL__spawnv (CRTDLL.273)
|
|---|
| 3661 | */
|
|---|
| 3662 | int CDECL CRTDLL__spawnv( int i, char *s1, char ** s2 )
|
|---|
| 3663 | {
|
|---|
| 3664 | dprintf2(("CRTDLL: _spawnv\n"));
|
|---|
| 3665 | return (_spawnv(i, s1, s2));
|
|---|
| 3666 | }
|
|---|
| 3667 |
|
|---|
| 3668 |
|
|---|
| 3669 | /*********************************************************************
|
|---|
| 3670 | * CRTDLL__spawnve (CRTDLL.274)
|
|---|
| 3671 | */
|
|---|
| 3672 | int CDECL CRTDLL__spawnve( int i, char *s1, char ** s2, char ** s3 )
|
|---|
| 3673 | {
|
|---|
| 3674 | dprintf2(("CRTDLL: _spawnve\n"));
|
|---|
| 3675 | return (_spawnve(i, s1, s2, s3));
|
|---|
| 3676 | }
|
|---|
| 3677 |
|
|---|
| 3678 |
|
|---|
| 3679 | /*********************************************************************
|
|---|
| 3680 | * CRTDLL__spawnvp (CRTDLL.275)
|
|---|
| 3681 | */
|
|---|
| 3682 | int CDECL CRTDLL__spawnvp( int i, char *s1, char ** s2 )
|
|---|
| 3683 | {
|
|---|
| 3684 | dprintf2(("CRTDLL: _spawnvp\n"));
|
|---|
| 3685 | return (_spawnvp(i, s1, s2));
|
|---|
| 3686 | }
|
|---|
| 3687 |
|
|---|
| 3688 | /*********************************************************************
|
|---|
| 3689 | * CRTDLL__spawnv (CRTDLL.276)
|
|---|
| 3690 | */
|
|---|
| 3691 | int CDECL CRTDLL__spawnvpe( int i, char *s1, char ** s2, char ** s3 )
|
|---|
| 3692 | {
|
|---|
| 3693 | dprintf2(("CRTDLL: _spawnvpe\n"));
|
|---|
| 3694 | return (_spawnvpe(i, s1, s2, s3));
|
|---|
| 3695 | }
|
|---|
| 3696 |
|
|---|
| 3697 |
|
|---|
| 3698 | /*********************************************************************
|
|---|
| 3699 | * CRTDLL__stat (CRTDLL.278)
|
|---|
| 3700 | */
|
|---|
| 3701 | int CDECL CRTDLL__stat( const char *s1, struct stat * n )
|
|---|
| 3702 | {
|
|---|
| 3703 | dprintf2(("CRTDLL: _stat\n"));
|
|---|
| 3704 | return(_stat(s1, n));
|
|---|
| 3705 | }
|
|---|
| 3706 |
|
|---|
| 3707 |
|
|---|
| 3708 | /*********************************************************************
|
|---|
| 3709 | * CRTDLL__statusfp (CRTDLL.279)
|
|---|
| 3710 | */
|
|---|
| 3711 | unsigned int CDECL CRTDLL__statusfp( void )
|
|---|
| 3712 | {
|
|---|
| 3713 | dprintf2(("CRTDLL: _statusfp\n"));
|
|---|
| 3714 | return (_status87());
|
|---|
| 3715 | }
|
|---|
| 3716 |
|
|---|
| 3717 |
|
|---|
| 3718 | /*********************************************************************
|
|---|
| 3719 | * CRTDLL__strdate (CRTDLL.281)
|
|---|
| 3720 | */
|
|---|
| 3721 | char * CDECL CRTDLL__strdate( char *buf )
|
|---|
| 3722 | {
|
|---|
| 3723 | dprintf2(("CRTDLL: _strdate\n"));
|
|---|
| 3724 | return(_strdate(buf));
|
|---|
| 3725 | }
|
|---|
| 3726 |
|
|---|
| 3727 |
|
|---|
| 3728 | /*********************************************************************
|
|---|
| 3729 | * CRTDLL__strdec (CRTDLL.282)
|
|---|
| 3730 | */
|
|---|
| 3731 | char * CDECL CRTDLL__strdec( const char *, const char *p )
|
|---|
| 3732 | {
|
|---|
| 3733 | dprintf2(("CRTDLL: _strdec\n"));
|
|---|
| 3734 | return( (char *)(p-1) );
|
|---|
| 3735 | }
|
|---|
| 3736 |
|
|---|
| 3737 |
|
|---|
| 3738 | /*********************************************************************
|
|---|
| 3739 | * CRTDLL__strdup (CRTDLL.283)
|
|---|
| 3740 | */
|
|---|
| 3741 | LPSTR CDECL CRTDLL__strdup(LPCSTR ptr)
|
|---|
| 3742 | {
|
|---|
| 3743 | dprintf2(("CRTDLL: _strdup\n"));
|
|---|
| 3744 | return HEAP_strdupA(GetProcessHeap(),0,ptr);
|
|---|
| 3745 | }
|
|---|
| 3746 |
|
|---|
| 3747 |
|
|---|
| 3748 | /*********************************************************************
|
|---|
| 3749 | * _strerror (CRTDLL.284)
|
|---|
| 3750 | */
|
|---|
| 3751 | char * CDECL CRTDLL__strerror(const char *s)
|
|---|
| 3752 | {
|
|---|
| 3753 | dprintf(("CRTDLL: _strerror not implemented\n"));
|
|---|
| 3754 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 3755 | return FALSE;
|
|---|
| 3756 | // return (_strerror(s));
|
|---|
| 3757 | }
|
|---|
| 3758 |
|
|---|
| 3759 |
|
|---|
| 3760 | /*********************************************************************
|
|---|
| 3761 | * CRTDLL__stricoll (CRTDLL.286)
|
|---|
| 3762 | */
|
|---|
| 3763 | int CDECL CRTDLL__stricoll( const char *s1, const char *s2 )
|
|---|
| 3764 | {
|
|---|
| 3765 | dprintf2(("CRTDLL: _stricoll\n"));
|
|---|
| 3766 | return stricmp(s1,s2);
|
|---|
| 3767 | }
|
|---|
| 3768 |
|
|---|
| 3769 |
|
|---|
| 3770 | /*********************************************************************
|
|---|
| 3771 | * CRTDLL__strinc (CRTDLL.287)
|
|---|
| 3772 | */
|
|---|
| 3773 | char * CDECL CRTDLL__strinc( const char *p )
|
|---|
| 3774 | {
|
|---|
| 3775 | dprintf2(("CRTDLL: _strinc\n"));
|
|---|
| 3776 | return( (char *)(p+1) );
|
|---|
| 3777 | }
|
|---|
| 3778 |
|
|---|
| 3779 |
|
|---|
| 3780 | /*********************************************************************
|
|---|
| 3781 | * CRTDLL__strncnt (CRTDLL.289)
|
|---|
| 3782 | */
|
|---|
| 3783 | size_t CDECL CRTDLL__strncnt( const char *p, size_t l )
|
|---|
| 3784 | {
|
|---|
| 3785 | dprintf2(("CRTDLL: _strncnt\n"));
|
|---|
| 3786 | size_t i;
|
|---|
| 3787 | i = strlen(p);
|
|---|
| 3788 | return( (i>l) ? l : i );
|
|---|
| 3789 | }
|
|---|
| 3790 |
|
|---|
| 3791 | /*********************************************************************
|
|---|
| 3792 | * CRTDLL__strnextc (CRTDLL.290)
|
|---|
| 3793 | */
|
|---|
| 3794 | unsigned int CDECL CRTDLL__strnextc( const char *p )
|
|---|
| 3795 | {
|
|---|
| 3796 | dprintf2(("CRTDLL: _strnextc\n"));
|
|---|
| 3797 | return( (unsigned int)*p );
|
|---|
| 3798 | }
|
|---|
| 3799 |
|
|---|
| 3800 |
|
|---|
| 3801 | /*********************************************************************
|
|---|
| 3802 | * CRTDLL__strninc (CRTDLL.292)
|
|---|
| 3803 | */
|
|---|
| 3804 | char * CDECL CRTDLL__strninc( const char *p, size_t l )
|
|---|
| 3805 | {
|
|---|
| 3806 | dprintf2(("CRTDLL: _strninc\n"));
|
|---|
| 3807 | return( (char *)(p+l) );
|
|---|
| 3808 | }
|
|---|
| 3809 |
|
|---|
| 3810 |
|
|---|
| 3811 | /*********************************************************************
|
|---|
| 3812 | * CRTDLL__strnset (CRTDLL.293)
|
|---|
| 3813 | */
|
|---|
| 3814 | char * CDECL CRTDLL__strnset(char* szToFill, int szFill, size_t sizeMaxFill)
|
|---|
| 3815 | {
|
|---|
| 3816 | dprintf2(("CRTDLL: _strnset\n"));
|
|---|
| 3817 | char *t = szToFill;
|
|---|
| 3818 | int i = 0;
|
|---|
| 3819 | while( *szToFill != 0 && i < sizeMaxFill)
|
|---|
| 3820 | {
|
|---|
| 3821 | *szToFill = szFill;
|
|---|
| 3822 | szToFill++;
|
|---|
| 3823 | i++;
|
|---|
| 3824 | }
|
|---|
| 3825 | return t;
|
|---|
| 3826 | }
|
|---|
| 3827 |
|
|---|
| 3828 |
|
|---|
| 3829 | /*********************************************************************
|
|---|
| 3830 | * CRTDLL__strrev (CRTDLL.294)
|
|---|
| 3831 | */
|
|---|
| 3832 | char * CDECL CRTDLL__strrev( char *s )
|
|---|
| 3833 | {
|
|---|
| 3834 | dprintf2(("CRTDLL: _strrev\n"));
|
|---|
| 3835 | char *e;
|
|---|
| 3836 | char a;
|
|---|
| 3837 | e=s;
|
|---|
| 3838 | while (*e)
|
|---|
| 3839 | e++;
|
|---|
| 3840 | while (s<e) {
|
|---|
| 3841 | a=*s;
|
|---|
| 3842 | *s=*e;
|
|---|
| 3843 | *e=a;
|
|---|
| 3844 | s++;
|
|---|
| 3845 | e--;
|
|---|
| 3846 | }
|
|---|
| 3847 | return s;
|
|---|
| 3848 | }
|
|---|
| 3849 |
|
|---|
| 3850 |
|
|---|
| 3851 | /*********************************************************************
|
|---|
| 3852 | * CRTDLL__strset (CRTDLL.295)
|
|---|
| 3853 | */
|
|---|
| 3854 | char * CDECL CRTDLL__strset(char* szToFill, int szFill)
|
|---|
| 3855 | {
|
|---|
| 3856 | dprintf2(("CRTDLL: _strset\n"));
|
|---|
| 3857 | char *t = szToFill;
|
|---|
| 3858 | while( *szToFill != 0 )
|
|---|
| 3859 | {
|
|---|
| 3860 | *szToFill = szFill;
|
|---|
| 3861 | szToFill++;
|
|---|
| 3862 | }
|
|---|
| 3863 | return t;
|
|---|
| 3864 | }
|
|---|
| 3865 |
|
|---|
| 3866 |
|
|---|
| 3867 | /*********************************************************************
|
|---|
| 3868 | * CRTDLL__strspnp (CRTDLL.296)
|
|---|
| 3869 | */
|
|---|
| 3870 | char * CDECL CRTDLL__strspnp( const char *p1, const char *p2 )
|
|---|
| 3871 | {
|
|---|
| 3872 | dprintf2(("CRTDLL: _strspnp\n"));
|
|---|
| 3873 | return( (*(p1 += strspn(p1,p2))!='\0') ? (char*)p1 : NULL );
|
|---|
| 3874 | }
|
|---|
| 3875 |
|
|---|
| 3876 |
|
|---|
| 3877 | /*********************************************************************
|
|---|
| 3878 | * CRTDLL__strtime (CRTDLL.297)
|
|---|
| 3879 | */
|
|---|
| 3880 | char * CDECL CRTDLL__strtime( char *buf )
|
|---|
| 3881 | {
|
|---|
| 3882 | dprintf2(("CRTDLL: _strtime\n"));
|
|---|
| 3883 | return (_strtime(buf));
|
|---|
| 3884 | }
|
|---|
| 3885 |
|
|---|
| 3886 |
|
|---|
| 3887 | /*********************************************************************
|
|---|
| 3888 | * CRTDLL__swab (CRTDLL.299)
|
|---|
| 3889 | */
|
|---|
| 3890 | void CDECL CRTDLL__swab(char *s1, char *s2, int i)
|
|---|
| 3891 | {
|
|---|
| 3892 | dprintf2(("CRTDLL: _swab\n"));
|
|---|
| 3893 | _swab(s1, s2, i);
|
|---|
| 3894 | }
|
|---|
| 3895 |
|
|---|
| 3896 |
|
|---|
| 3897 | /*********************************************************************
|
|---|
| 3898 | * CRTDLL__tell (CRTDLL.302)
|
|---|
| 3899 | */
|
|---|
| 3900 | long CDECL CRTDLL__tell( int i )
|
|---|
| 3901 | {
|
|---|
| 3902 | dprintf2(("CRTDLL: _tell\n"));
|
|---|
| 3903 | return (_tell(i));
|
|---|
| 3904 | }
|
|---|
| 3905 |
|
|---|
| 3906 |
|
|---|
| 3907 | /*********************************************************************
|
|---|
| 3908 | * CRTDLL__tempnam (CRTDLL.303)
|
|---|
| 3909 | */
|
|---|
| 3910 | char * CDECL CRTDLL__tempnam( char *dir, char *prefix )
|
|---|
| 3911 | {
|
|---|
| 3912 | dprintf2(("CRTDLL: _tempnam\n"));
|
|---|
| 3913 | return (_tempnam(dir, prefix));
|
|---|
| 3914 | }
|
|---|
| 3915 |
|
|---|
| 3916 |
|
|---|
| 3917 | /*********************************************************************
|
|---|
| 3918 | * CRTDLL__tolower (CRTDLL.305)
|
|---|
| 3919 | */
|
|---|
| 3920 | int CDECL CRTDLL__tolower(int n)
|
|---|
| 3921 | {
|
|---|
| 3922 | dprintf2(("CRTDLL: _tolower\n"));
|
|---|
| 3923 | return (_tolower(n));
|
|---|
| 3924 | }
|
|---|
| 3925 |
|
|---|
| 3926 |
|
|---|
| 3927 | /*********************************************************************
|
|---|
| 3928 | * CRTDLL__toupper (CRTDLL.306)
|
|---|
| 3929 | */
|
|---|
| 3930 | int CDECL CRTDLL__toupper(int n)
|
|---|
| 3931 | {
|
|---|
| 3932 | dprintf2(("CRTDLL: _toupper\n"));
|
|---|
| 3933 | return (_toupper(n));
|
|---|
| 3934 | }
|
|---|
| 3935 |
|
|---|
| 3936 |
|
|---|
| 3937 | /*********************************************************************
|
|---|
| 3938 | * _tzset (CRTDLL.308)
|
|---|
| 3939 | */
|
|---|
| 3940 | void CDECL CRTDLL__tzset( void )
|
|---|
| 3941 | {
|
|---|
| 3942 | dprintf(("CRTDLL: _tzset not implemented.\n"));
|
|---|
| 3943 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 3944 | }
|
|---|
| 3945 |
|
|---|
| 3946 |
|
|---|
| 3947 | /*********************************************************************
|
|---|
| 3948 | * CRTDLL__umask (CRTDLL.310)
|
|---|
| 3949 | */
|
|---|
| 3950 | int CDECL CRTDLL__umask( int i )
|
|---|
| 3951 | {
|
|---|
| 3952 | dprintf2(("CRTDLL: _umask\n"));
|
|---|
| 3953 | return (_umask(i));
|
|---|
| 3954 | }
|
|---|
| 3955 |
|
|---|
| 3956 |
|
|---|
| 3957 | /*********************************************************************
|
|---|
| 3958 | * CRTDLL__ungetch (CRTDLL.311)
|
|---|
| 3959 | */
|
|---|
| 3960 | int CDECL CRTDLL__ungetch( int i )
|
|---|
| 3961 | {
|
|---|
| 3962 | dprintf2(("CRTDLL: _ungetch\n"));
|
|---|
| 3963 | return (_ungetch(i));
|
|---|
| 3964 | }
|
|---|
| 3965 |
|
|---|
| 3966 |
|
|---|
| 3967 | /*********************************************************************
|
|---|
| 3968 | * _unlink (CRTDLL.312)
|
|---|
| 3969 | */
|
|---|
| 3970 | INT CDECL CRTDLL__unlink(LPCSTR pathname)
|
|---|
| 3971 | {
|
|---|
| 3972 | dprintf2(("CRTDLL: _unlink\n"));
|
|---|
| 3973 | int ret=0;
|
|---|
| 3974 | DOS_FULL_NAME full_name;
|
|---|
| 3975 |
|
|---|
| 3976 | if (!DOSFS_GetFullName( pathname, FALSE, (CHAR*)&full_name )) {
|
|---|
| 3977 | dprintf2(("CRTDLL_unlink file %s bad name\n",pathname));
|
|---|
| 3978 | return EOF;
|
|---|
| 3979 | }
|
|---|
| 3980 |
|
|---|
| 3981 | ret=unlink(full_name.long_name);
|
|---|
| 3982 | dprintf2(("(%s unix %s)\n",
|
|---|
| 3983 | pathname,full_name.long_name));
|
|---|
| 3984 | if(ret)
|
|---|
| 3985 | dprintf2((" Failed!\n"));
|
|---|
| 3986 |
|
|---|
| 3987 | return ret;
|
|---|
| 3988 | }
|
|---|
| 3989 |
|
|---|
| 3990 |
|
|---|
| 3991 | /*********************************************************************
|
|---|
| 3992 | * CRTDLL__unloaddll (CRTDLL.313)
|
|---|
| 3993 | */
|
|---|
| 3994 | int CDECL CRTDLL__unloaddll(void *handle)
|
|---|
| 3995 | {
|
|---|
| 3996 | dprintf2(("CRTDLL: _unloaddll\n"));
|
|---|
| 3997 | return FreeLibrary((HMODULE)handle);
|
|---|
| 3998 | }
|
|---|
| 3999 |
|
|---|
| 4000 |
|
|---|
| 4001 | /*********************************************************************
|
|---|
| 4002 | * CRTDLL__utime (CRTDLL.314)
|
|---|
| 4003 | */
|
|---|
| 4004 | int CDECL CRTDLL__utime( char *path, struct utimbuf * times )
|
|---|
| 4005 | {
|
|---|
| 4006 | dprintf2(("CRTDLL: _utime\n"));
|
|---|
| 4007 | return (_utime(path, times));
|
|---|
| 4008 | }
|
|---|
| 4009 |
|
|---|
| 4010 |
|
|---|
| 4011 | /*********************************************************************
|
|---|
| 4012 | * CRTDLL__vsnwprintf (CRTDLL.316)
|
|---|
| 4013 | */
|
|---|
| 4014 | int CDECL CRTDLL__vsnwprintf( wchar_t *s1, size_t n, const wchar_t *s2, va_list arg )
|
|---|
| 4015 | {
|
|---|
| 4016 | dprintf(("CRTDLL: _vsnwprintf not implemented.\n"));
|
|---|
| 4017 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 4018 | return FALSE;
|
|---|
| 4019 | }
|
|---|
| 4020 |
|
|---|
| 4021 |
|
|---|
| 4022 | /*********************************************************************
|
|---|
| 4023 | * CRTDLL__wcsdup (CRTDLL.317)
|
|---|
| 4024 | */
|
|---|
| 4025 | LPWSTR CDECL CRTDLL__wcsdup( LPCWSTR str )
|
|---|
| 4026 | {
|
|---|
| 4027 | dprintf2(("CRTDLL: _wcsdup\n"));
|
|---|
| 4028 | LPWSTR ret = NULL;
|
|---|
| 4029 | if (str)
|
|---|
| 4030 | {
|
|---|
| 4031 | int size = (wcslen((const wchar_t*)str) + 1) * sizeof(WCHAR);
|
|---|
| 4032 | // FIXME ret = CRTDLL_malloc( size );
|
|---|
| 4033 | if (ret) memcpy( ret, str, size );
|
|---|
| 4034 | }
|
|---|
| 4035 | return ret;
|
|---|
| 4036 | }
|
|---|
| 4037 |
|
|---|
| 4038 |
|
|---|
| 4039 | /*********************************************************************
|
|---|
| 4040 | * CRTDLL__wcsicoll (CRTDLL.319)
|
|---|
| 4041 | */
|
|---|
| 4042 | int CDECL CRTDLL__wcsicoll( LPCWSTR str1, LPCWSTR str2 )
|
|---|
| 4043 | {
|
|---|
| 4044 | dprintf2(("CRTDLL: _wcsicoll\n"));
|
|---|
| 4045 | return CRTDLL__wcsicmp( str1, str2 );
|
|---|
| 4046 | }
|
|---|
| 4047 |
|
|---|
| 4048 |
|
|---|
| 4049 | /*********************************************************************
|
|---|
| 4050 | * CRTDLL__wcsnset (CRTDLL.322)
|
|---|
| 4051 | */
|
|---|
| 4052 | LPWSTR CDECL CRTDLL__wcsnset( LPWSTR str, WCHAR c, INT n )
|
|---|
| 4053 | {
|
|---|
| 4054 | dprintf2(("CRTDLL: _wcsnset\n"));
|
|---|
| 4055 | LPWSTR ret = str;
|
|---|
| 4056 | while ((n-- > 0) && *str) *str++ = c;
|
|---|
| 4057 | return ret;
|
|---|
| 4058 | }
|
|---|
| 4059 |
|
|---|
| 4060 |
|
|---|
| 4061 | /*********************************************************************
|
|---|
| 4062 | * CRTDLL__wcsrev (CRTDLL.323)
|
|---|
| 4063 | */
|
|---|
| 4064 | LPWSTR CDECL CRTDLL__wcsrev( LPWSTR str )
|
|---|
| 4065 | {
|
|---|
| 4066 | dprintf2(("CRTDLL: _wcsrev\n"));
|
|---|
| 4067 | LPWSTR ret = str;
|
|---|
| 4068 | LPWSTR end = str + wcslen((const wchar_t*)str) - 1;
|
|---|
| 4069 | while (end > str)
|
|---|
| 4070 | {
|
|---|
| 4071 | WCHAR t = *end;
|
|---|
| 4072 | *end-- = *str;
|
|---|
| 4073 | *str++ = t;
|
|---|
| 4074 | }
|
|---|
| 4075 | return ret;
|
|---|
| 4076 | }
|
|---|
| 4077 |
|
|---|
| 4078 |
|
|---|
| 4079 | /*********************************************************************
|
|---|
| 4080 | * CRTDLL__wcsset (CRTDLL.324)
|
|---|
| 4081 | */
|
|---|
| 4082 | LPWSTR CDECL CRTDLL__wcsset( LPWSTR str, WCHAR c )
|
|---|
| 4083 | {
|
|---|
| 4084 | dprintf2(("CRTDLL: _wcsset\n"));
|
|---|
| 4085 | LPWSTR ret = str;
|
|---|
| 4086 | while (*str) *str++ = c;
|
|---|
| 4087 | return ret;
|
|---|
| 4088 | }
|
|---|
| 4089 |
|
|---|
| 4090 |
|
|---|
| 4091 | /*********************************************************************
|
|---|
| 4092 | * _write (CRTDLL.329)
|
|---|
| 4093 | */
|
|---|
| 4094 | INT CDECL CRTDLL__write(INT fd,LPCVOID buf,UINT count)
|
|---|
| 4095 | {
|
|---|
| 4096 | dprintf2(("CRTDLL: _write\n"));
|
|---|
| 4097 | INT len=0;
|
|---|
| 4098 |
|
|---|
| 4099 | if (fd == -1)
|
|---|
| 4100 | len = -1;
|
|---|
| 4101 | else if (fd<=2)
|
|---|
| 4102 | len = (UINT)write(fd,buf,(LONG)count);
|
|---|
| 4103 | else
|
|---|
| 4104 | len = _lwrite(fd,(LPCSTR)buf,count);
|
|---|
| 4105 | dprintf2(("%d/%d byte to dfh %d from %p,\n",
|
|---|
| 4106 | len,count,fd,buf));
|
|---|
| 4107 | return len;
|
|---|
| 4108 | }
|
|---|
| 4109 |
|
|---|
| 4110 |
|
|---|
| 4111 | /*********************************************************************
|
|---|
| 4112 | * _y0 (CRTDLL.332)
|
|---|
| 4113 | */
|
|---|
| 4114 | double CDECL CRTDLL__y0(double x)
|
|---|
| 4115 | {
|
|---|
| 4116 | dprintf2(("CRTDLL: _y0\n"));
|
|---|
| 4117 | return (_y0(x));
|
|---|
| 4118 | }
|
|---|
| 4119 |
|
|---|
| 4120 |
|
|---|
| 4121 | /*********************************************************************
|
|---|
| 4122 | * _y1 (CRTDLL.333)
|
|---|
| 4123 | */
|
|---|
| 4124 | double CDECL CRTDLL__y1(double x)
|
|---|
| 4125 | {
|
|---|
| 4126 | dprintf2(("CRTDLL: _y1\n"));
|
|---|
| 4127 | return (_y1(x));
|
|---|
| 4128 | }
|
|---|
| 4129 |
|
|---|
| 4130 |
|
|---|
| 4131 | /*********************************************************************
|
|---|
| 4132 | * _yn (CRTDLL.334)
|
|---|
| 4133 | */
|
|---|
| 4134 | double CDECL CRTDLL__yn(int i, double x)
|
|---|
| 4135 | {
|
|---|
| 4136 | dprintf2(("CRTDLL: _yn\n"));
|
|---|
| 4137 | return (_yn(i, x));
|
|---|
| 4138 | }
|
|---|
| 4139 |
|
|---|
| 4140 |
|
|---|
| 4141 | /*********************************************************************
|
|---|
| 4142 | * isleadbyte (CRTDLL.335)
|
|---|
| 4143 | */
|
|---|
| 4144 | void CDECL CRTDLL_abort( void )
|
|---|
| 4145 | {
|
|---|
| 4146 | dprintf2(("CRTDLL: abort\n"));
|
|---|
| 4147 | abort();
|
|---|
| 4148 | }
|
|---|
| 4149 |
|
|---|
| 4150 |
|
|---|
| 4151 | /*********************************************************************
|
|---|
| 4152 | * acos (CRTDLL.336)
|
|---|
| 4153 | */
|
|---|
| 4154 | double CDECL CRTDLL_acos( double x )
|
|---|
| 4155 | {
|
|---|
| 4156 | dprintf2(("CRTDLL: acos\n"));
|
|---|
| 4157 | return (acos(x));
|
|---|
| 4158 | }
|
|---|
| 4159 |
|
|---|
| 4160 |
|
|---|
| 4161 | /*********************************************************************
|
|---|
| 4162 | * asctime (CRTDLL.338)
|
|---|
| 4163 | */
|
|---|
| 4164 | char * CDECL CRTDLL_asctime( const struct tm *timeptr )
|
|---|
| 4165 | {
|
|---|
| 4166 | dprintf2(("CRTDLL: asctime\n"));
|
|---|
| 4167 | return (asctime(timeptr));
|
|---|
| 4168 | }
|
|---|
| 4169 |
|
|---|
| 4170 |
|
|---|
| 4171 | /*********************************************************************
|
|---|
| 4172 | * asin (CRTDLL.339)
|
|---|
| 4173 | */
|
|---|
| 4174 | double CDECL CRTDLL_asin( double x )
|
|---|
| 4175 | {
|
|---|
| 4176 | dprintf2(("CRTDLL: asin\n"));
|
|---|
| 4177 | return (asin(x));
|
|---|
| 4178 | }
|
|---|
| 4179 |
|
|---|
| 4180 |
|
|---|
| 4181 | /*********************************************************************
|
|---|
| 4182 | * atan2 (CRTDLL.341)
|
|---|
| 4183 | */
|
|---|
| 4184 | double CDECL CRTDLL_atan2( double y, double x )
|
|---|
| 4185 | {
|
|---|
| 4186 | dprintf2(("CRTDLL: atan2\n"));
|
|---|
| 4187 | return (atan2(y, x));
|
|---|
| 4188 | }
|
|---|
| 4189 |
|
|---|
| 4190 |
|
|---|
| 4191 | /*********************************************************************
|
|---|
| 4192 | * atexit (CRTDLL.342)
|
|---|
| 4193 | */
|
|---|
| 4194 | int CDECL CRTDLL_atexit( register void ( *func )( void ) )
|
|---|
| 4195 | {
|
|---|
| 4196 | dprintf(("CRTDLL: atexit not implemented.\n"));
|
|---|
| 4197 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 4198 | return FALSE;
|
|---|
| 4199 | }
|
|---|
| 4200 |
|
|---|
| 4201 |
|
|---|
| 4202 | /*********************************************************************
|
|---|
| 4203 | * atof (CRTDLL.343)
|
|---|
| 4204 | */
|
|---|
| 4205 | double CDECL CRTDLL_atof( const char *nptr )
|
|---|
| 4206 | {
|
|---|
| 4207 | dprintf2(("CRTDLL: atof\n"));
|
|---|
| 4208 | return (atof(nptr));
|
|---|
| 4209 | }
|
|---|
| 4210 |
|
|---|
| 4211 | /*********************************************************************
|
|---|
| 4212 | * calloc (CRTDLL.347)
|
|---|
| 4213 | */
|
|---|
| 4214 | void * CDECL CRTDLL_calloc( size_t n, size_t size )
|
|---|
| 4215 | {
|
|---|
| 4216 | // dprintf2(("CRTDLL: calloc\n"));
|
|---|
| 4217 | return Heap_Alloc(size*n);
|
|---|
| 4218 | }
|
|---|
| 4219 |
|
|---|
| 4220 |
|
|---|
| 4221 | /*********************************************************************
|
|---|
| 4222 | * clearerr (CRTDLL.349)
|
|---|
| 4223 | */
|
|---|
| 4224 | void CDECL CRTDLL_clearerr( FILE *fp )
|
|---|
| 4225 | {
|
|---|
| 4226 | dprintf2(("CRTDLL: clearerr\n"));
|
|---|
| 4227 | clearerr(fp);
|
|---|
| 4228 | }
|
|---|
| 4229 |
|
|---|
| 4230 |
|
|---|
| 4231 | /*********************************************************************
|
|---|
| 4232 | * clock (CRTDLL.350)
|
|---|
| 4233 | */
|
|---|
| 4234 | clock_t CDECL CRTDLL_clock( void )
|
|---|
| 4235 | {
|
|---|
| 4236 | dprintf2(("CRTDLL: clock\n"));
|
|---|
| 4237 | return (clock());
|
|---|
| 4238 | }
|
|---|
| 4239 |
|
|---|
| 4240 |
|
|---|
| 4241 | /*********************************************************************
|
|---|
| 4242 | * cosh (CRTDLL.352)
|
|---|
| 4243 | */
|
|---|
| 4244 | double CDECL CRTDLL_cosh( double x )
|
|---|
| 4245 | {
|
|---|
| 4246 | dprintf2(("CRTDLL: cosh\n"));
|
|---|
| 4247 | return (cosh(x));
|
|---|
| 4248 | }
|
|---|
| 4249 |
|
|---|
| 4250 |
|
|---|
| 4251 | /*********************************************************************
|
|---|
| 4252 | * ctime (CRTDLL.353)
|
|---|
| 4253 | */
|
|---|
| 4254 | char * CDECL CRTDLL_ctime( const time_t *timer )
|
|---|
| 4255 | {
|
|---|
| 4256 | dprintf2(("CRTDLL: ctime\n"));
|
|---|
| 4257 | return (ctime(timer));
|
|---|
| 4258 | }
|
|---|
| 4259 |
|
|---|
| 4260 |
|
|---|
| 4261 | /*********************************************************************
|
|---|
| 4262 | * difftime (CRTDLL.354)
|
|---|
| 4263 | */
|
|---|
| 4264 | double CDECL CRTDLL_difftime( time_t t1, time_t t0 )
|
|---|
| 4265 | {
|
|---|
| 4266 | dprintf2(("CRTDLL: difftime\n"));
|
|---|
| 4267 | return (difftime(t1, t0));
|
|---|
| 4268 | }
|
|---|
| 4269 |
|
|---|
| 4270 |
|
|---|
| 4271 | /*********************************************************************
|
|---|
| 4272 | * div (CRTDLL.355)
|
|---|
| 4273 | */
|
|---|
| 4274 | div_t CDECL CRTDLL_div( int numer, int denom )
|
|---|
| 4275 | {
|
|---|
| 4276 | dprintf2(("CRTDLL: div\n"));
|
|---|
| 4277 | return (div(numer, denom));
|
|---|
| 4278 | }
|
|---|
| 4279 |
|
|---|
| 4280 |
|
|---|
| 4281 | /*********************************************************************
|
|---|
| 4282 | * exit (CRTDLL.356)
|
|---|
| 4283 | */
|
|---|
| 4284 | void CDECL CRTDLL_exit(DWORD ret)
|
|---|
| 4285 | {
|
|---|
| 4286 | dprintf2(("CRTDLL: exit\n"));
|
|---|
| 4287 | ExitProcess(ret);
|
|---|
| 4288 | }
|
|---|
| 4289 |
|
|---|
| 4290 |
|
|---|
| 4291 | /*********************************************************************
|
|---|
| 4292 | * exp (CRTDLL.357)
|
|---|
| 4293 | */
|
|---|
| 4294 | double CDECL CRTDLL_exp( double x )
|
|---|
| 4295 | {
|
|---|
| 4296 | dprintf2(("CRTDLL: exp\n"));
|
|---|
| 4297 | return (exp(x));
|
|---|
| 4298 | }
|
|---|
| 4299 |
|
|---|
| 4300 |
|
|---|
| 4301 | /*********************************************************************
|
|---|
| 4302 | * fclose (CRTDLL.359)
|
|---|
| 4303 | */
|
|---|
| 4304 | int CDECL CRTDLL_fclose( FILE *fp )
|
|---|
| 4305 | {
|
|---|
| 4306 | dprintf2(("CRTDLL: fclose\n"));
|
|---|
| 4307 | return (fclose(fp));
|
|---|
| 4308 | }
|
|---|
| 4309 |
|
|---|
| 4310 |
|
|---|
| 4311 | /*********************************************************************
|
|---|
| 4312 | * feof (CRTDLL.360)
|
|---|
| 4313 | */
|
|---|
| 4314 | int CDECL CRTDLL_feof( FILE *fp )
|
|---|
| 4315 | {
|
|---|
| 4316 | dprintf2(("CRTDLL: feof\n"));
|
|---|
| 4317 | return (feof(fp));
|
|---|
| 4318 | }
|
|---|
| 4319 |
|
|---|
| 4320 |
|
|---|
| 4321 | /*********************************************************************
|
|---|
| 4322 | * ferror (CRTDLL.361)
|
|---|
| 4323 | */
|
|---|
| 4324 | int CDECL CRTDLL_ferror( FILE *fp )
|
|---|
| 4325 | {
|
|---|
| 4326 | dprintf2(("CRTDLL: ferror\n"));
|
|---|
| 4327 | return (ferror(fp));
|
|---|
| 4328 | }
|
|---|
| 4329 |
|
|---|
| 4330 |
|
|---|
| 4331 | /*********************************************************************
|
|---|
| 4332 | * fflush (CRTDLL.362)
|
|---|
| 4333 | */
|
|---|
| 4334 | int CDECL CRTDLL_fflush( FILE *fp )
|
|---|
| 4335 | {
|
|---|
| 4336 | dprintf2(("CRTDLL: fflush\n"));
|
|---|
| 4337 | return (fflush(fp));
|
|---|
| 4338 | }
|
|---|
| 4339 |
|
|---|
| 4340 |
|
|---|
| 4341 | /*********************************************************************
|
|---|
| 4342 | * fgetc (CRTDLL.363)
|
|---|
| 4343 | */
|
|---|
| 4344 | int CDECL CRTDLL_fgetc( FILE *fp )
|
|---|
| 4345 | {
|
|---|
| 4346 | dprintf2(("CRTDLL: fgetc\n"));
|
|---|
| 4347 | return (fgetc(fp));
|
|---|
| 4348 | }
|
|---|
| 4349 |
|
|---|
| 4350 |
|
|---|
| 4351 | /*********************************************************************
|
|---|
| 4352 | * fgetpos (CRTDLL.364)
|
|---|
| 4353 | */
|
|---|
| 4354 | int CDECL CRTDLL_fgetpos( FILE *fp, fpos_t *pos )
|
|---|
| 4355 | {
|
|---|
| 4356 | dprintf2(("CRTDLL: fgetpos\n"));
|
|---|
| 4357 | return (fgetpos(fp, pos));
|
|---|
| 4358 | }
|
|---|
| 4359 |
|
|---|
| 4360 |
|
|---|
| 4361 | /*********************************************************************
|
|---|
| 4362 | * fgets (CRTDLL.365)
|
|---|
| 4363 | */
|
|---|
| 4364 | char * CDECL CRTDLL_fgets( char *s, int n, FILE *fp )
|
|---|
| 4365 | {
|
|---|
| 4366 | dprintf2(("CRTDLL: fgets\n"));
|
|---|
| 4367 | return (fgets(s, n, fp));
|
|---|
| 4368 | }
|
|---|
| 4369 |
|
|---|
| 4370 |
|
|---|
| 4371 | /*********************************************************************
|
|---|
| 4372 | * fgetwc (CRTDLL.366)
|
|---|
| 4373 | */
|
|---|
| 4374 | wint_t CDECL CRTDLL_fgetwc( FILE *f )
|
|---|
| 4375 | {
|
|---|
| 4376 | dprintf2(("CRTDLL: fgetwc\n"));
|
|---|
| 4377 | return (fgetwc(f));
|
|---|
| 4378 | }
|
|---|
| 4379 |
|
|---|
| 4380 |
|
|---|
| 4381 | /*********************************************************************
|
|---|
| 4382 | * fmod (CRTDLL.368)
|
|---|
| 4383 | */
|
|---|
| 4384 | double CDECL CRTDLL_fmod(double x, double y )
|
|---|
| 4385 | {
|
|---|
| 4386 | dprintf2(("CRTDLL: fmod\n"));
|
|---|
| 4387 | return (fmod(x,y));
|
|---|
| 4388 | }
|
|---|
| 4389 |
|
|---|
| 4390 |
|
|---|
| 4391 | /*********************************************************************
|
|---|
| 4392 | * fopen (CRTDLL.369)
|
|---|
| 4393 | */
|
|---|
| 4394 | FILE * CDECL CRTDLL_fopen( const char *filename, const char *mode )
|
|---|
| 4395 | {
|
|---|
| 4396 | dprintf2(("CRTDLL: fopen\n"));
|
|---|
| 4397 | return (fopen( filename, mode));
|
|---|
| 4398 | }
|
|---|
| 4399 |
|
|---|
| 4400 |
|
|---|
| 4401 | /*********************************************************************
|
|---|
| 4402 | * fprintf (CRTDLL.370)
|
|---|
| 4403 | */
|
|---|
| 4404 | INT CDECL CRTDLL_fprintf( CRTDLL_FILE *file, LPSTR format, ... )
|
|---|
| 4405 | {
|
|---|
| 4406 | dprintf2(("CRTDLL: fprintf\n"));
|
|---|
| 4407 | va_list valist;
|
|---|
| 4408 | INT res;
|
|---|
| 4409 |
|
|---|
| 4410 | va_start( valist, format );
|
|---|
| 4411 | res = CRTDLL_vfprintf( file, format, valist );
|
|---|
| 4412 | va_end( valist );
|
|---|
| 4413 | return res;
|
|---|
| 4414 | }
|
|---|
| 4415 |
|
|---|
| 4416 |
|
|---|
| 4417 | /*********************************************************************
|
|---|
| 4418 | * fputc (CRTDLL.371)
|
|---|
| 4419 | */
|
|---|
| 4420 | int CDECL CRTDLL_fputc( int c, FILE *fp )
|
|---|
| 4421 | {
|
|---|
| 4422 | dprintf2(("CRTDLL: fputc\n"));
|
|---|
| 4423 | return (fputc(c, fp));
|
|---|
| 4424 | }
|
|---|
| 4425 |
|
|---|
| 4426 |
|
|---|
| 4427 | /*********************************************************************
|
|---|
| 4428 | * fputs (CRTDLL.372)
|
|---|
| 4429 | */
|
|---|
| 4430 | int CDECL CRTDLL_fputs( const char *s, FILE *fp )
|
|---|
| 4431 | {
|
|---|
| 4432 | dprintf2(("CRTDLL: fputs\n"));
|
|---|
| 4433 | return (fputs(s, fp));
|
|---|
| 4434 | }
|
|---|
| 4435 |
|
|---|
| 4436 |
|
|---|
| 4437 | /*********************************************************************
|
|---|
| 4438 | * fputwc (CRTDLL.373)
|
|---|
| 4439 | */
|
|---|
| 4440 | wint_t CDECL CRTDLL_fputwc( wint_t wc, FILE *strm )
|
|---|
| 4441 | {
|
|---|
| 4442 | dprintf2(("CRTDLL: fputwc\n"));
|
|---|
| 4443 | return (fputwc(wc, strm));
|
|---|
| 4444 | }
|
|---|
| 4445 |
|
|---|
| 4446 |
|
|---|
| 4447 | /*********************************************************************
|
|---|
| 4448 | * fread (CRTDLL.374)
|
|---|
| 4449 | */
|
|---|
| 4450 | size_t CDECL CRTDLL_fread( void *ptr, size_t size, size_t n, FILE *fp )
|
|---|
| 4451 | {
|
|---|
| 4452 | // dprintf2(("CRTDLL: fread\n"));
|
|---|
| 4453 | return (fread(ptr, size, n, fp));
|
|---|
| 4454 | }
|
|---|
| 4455 |
|
|---|
| 4456 |
|
|---|
| 4457 | /*********************************************************************
|
|---|
| 4458 | * free (CRTDLL.375)
|
|---|
| 4459 | */
|
|---|
| 4460 | VOID CDECL CRTDLL_free(LPVOID ptr)
|
|---|
| 4461 | {
|
|---|
| 4462 | // dprintf2(("CRTDLL: free\n"));
|
|---|
| 4463 | Heap_Free(ptr);
|
|---|
| 4464 | }
|
|---|
| 4465 |
|
|---|
| 4466 |
|
|---|
| 4467 | /*********************************************************************
|
|---|
| 4468 | * freopen (CRTDLL.376)
|
|---|
| 4469 | */
|
|---|
| 4470 | FILE * CDECL CRTDLL_freopen( const char *filename, const char *mode, FILE *fp )
|
|---|
| 4471 | {
|
|---|
| 4472 | dprintf2(("CRTDLL: freopen\n"));
|
|---|
| 4473 | return (freopen(filename, mode, fp));
|
|---|
| 4474 | }
|
|---|
| 4475 |
|
|---|
| 4476 |
|
|---|
| 4477 | /*********************************************************************
|
|---|
| 4478 | * frexp (CRTDLL.377)
|
|---|
| 4479 | */
|
|---|
| 4480 | double CDECL CRTDLL_frexp( double value, int *exp )
|
|---|
| 4481 | {
|
|---|
| 4482 | dprintf2(("CRTDLL: frexp\n"));
|
|---|
| 4483 | return (frexp(value, exp));
|
|---|
| 4484 | }
|
|---|
| 4485 |
|
|---|
| 4486 |
|
|---|
| 4487 | /*********************************************************************
|
|---|
| 4488 | * fscanf (CRTDLL.378)
|
|---|
| 4489 | */
|
|---|
| 4490 | int CDECL CRTDLL_fscanf( FILE*fp, const char *format, ... )
|
|---|
| 4491 | {
|
|---|
| 4492 | dprintf2(("CRTDLL: fscanf\n"));
|
|---|
| 4493 | #if 0
|
|---|
| 4494 | va_list valist;
|
|---|
| 4495 | INT res;
|
|---|
| 4496 |
|
|---|
| 4497 | va_start( valist, format );
|
|---|
| 4498 | #ifdef HAVE_VFSCANF
|
|---|
| 4499 | res = vfscanf( xlat_file_ptr(stream), format, valist );
|
|---|
| 4500 | #endif
|
|---|
| 4501 | va_end( valist );
|
|---|
| 4502 | return res;
|
|---|
| 4503 | #endif
|
|---|
| 4504 | dprintf2(("broken\n"));
|
|---|
| 4505 | return 0;
|
|---|
| 4506 | }
|
|---|
| 4507 |
|
|---|
| 4508 |
|
|---|
| 4509 | /*********************************************************************
|
|---|
| 4510 | * fseek (CRTDLL.379)
|
|---|
| 4511 | */
|
|---|
| 4512 | int CDECL CRTDLL_fseek( FILE *file, long int offset, int whence )
|
|---|
| 4513 | {
|
|---|
| 4514 | dprintf2(("CRTDLL: fseek\n"));
|
|---|
| 4515 | dprintf2(("file %p to 0x%08lx pos %s\n",
|
|---|
| 4516 | file,offset,(whence==SEEK_SET)?"SEEK_SET":
|
|---|
| 4517 | (whence==SEEK_CUR)?"SEEK_CUR":
|
|---|
| 4518 | (whence==SEEK_END)?"SEEK_END":"UNKNOWN"));
|
|---|
| 4519 | // FIXME if (SetFilePointer( file->handle, offset, NULL, whence ) != 0xffffffff)
|
|---|
| 4520 | // FIXME return 0;
|
|---|
| 4521 | dprintf2((" failed!\n"));
|
|---|
| 4522 | return -1;
|
|---|
| 4523 | }
|
|---|
| 4524 |
|
|---|
| 4525 |
|
|---|
| 4526 | /*********************************************************************
|
|---|
| 4527 | * fsetpos (CRTDLL.380)
|
|---|
| 4528 | */
|
|---|
| 4529 | int CDECL CRTDLL_fsetpos( FILE *fp, const fpos_t *pos )
|
|---|
| 4530 | {
|
|---|
| 4531 | dprintf2(("CRTDLL: fsetpos\n"));
|
|---|
| 4532 | return (fsetpos(fp, pos));
|
|---|
| 4533 | }
|
|---|
| 4534 |
|
|---|
| 4535 |
|
|---|
| 4536 | /*********************************************************************
|
|---|
| 4537 | * ftell (CRTDLL.381)
|
|---|
| 4538 | */
|
|---|
| 4539 | long int CDECL CRTDLL_ftell( FILE *fp )
|
|---|
| 4540 | {
|
|---|
| 4541 | dprintf2(("CRTDLL: ftell\n"));
|
|---|
| 4542 | return (ftell(fp));
|
|---|
| 4543 | }
|
|---|
| 4544 |
|
|---|
| 4545 |
|
|---|
| 4546 | /*********************************************************************
|
|---|
| 4547 | * fwprintf (CRTDLL.382)
|
|---|
| 4548 | */
|
|---|
| 4549 | int CDECL CRTDLL_fwprintf( FILE *iop, const wchar_t *fmt, ... )
|
|---|
| 4550 | {
|
|---|
| 4551 | dprintf(("CRTDLL: fwprintf not implemented.\n"));
|
|---|
| 4552 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 4553 | return FALSE;
|
|---|
| 4554 | }
|
|---|
| 4555 |
|
|---|
| 4556 |
|
|---|
| 4557 | /*********************************************************************
|
|---|
| 4558 | * fwrite (CRTDLL.383)
|
|---|
| 4559 | */
|
|---|
| 4560 | DWORD CDECL CRTDLL_fwrite( LPVOID ptr, INT size, INT nmemb, CRTDLL_FILE *file )
|
|---|
| 4561 | {
|
|---|
| 4562 | DWORD ret;
|
|---|
| 4563 |
|
|---|
| 4564 | dprintf2(("CRTDLL: fwrite\n"));
|
|---|
| 4565 | if (!WriteFile( file->handle, ptr, size * nmemb, &ret, NULL ))
|
|---|
| 4566 | dprintf2((" failed!\n"));
|
|---|
| 4567 |
|
|---|
| 4568 | return ret / size;
|
|---|
| 4569 | }
|
|---|
| 4570 |
|
|---|
| 4571 |
|
|---|
| 4572 | /*********************************************************************
|
|---|
| 4573 | * fwscanf (CRTDLL.384)
|
|---|
| 4574 | */
|
|---|
| 4575 | int CDECL CRTDLL_fwscanf( FILE *strm, const wchar_t *format, ... )
|
|---|
| 4576 | {
|
|---|
| 4577 | dprintf(("CRTDLL: fwscanf not implemented.\n"));
|
|---|
| 4578 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 4579 | return FALSE;
|
|---|
| 4580 | }
|
|---|
| 4581 |
|
|---|
| 4582 |
|
|---|
| 4583 | /*********************************************************************
|
|---|
| 4584 | * getc (CRTDLL.385)
|
|---|
| 4585 | */
|
|---|
| 4586 | int CDECL CRTDLL_getc( FILE *fp )
|
|---|
| 4587 | {
|
|---|
| 4588 | dprintf2(("CRTDLL: getc\n"));
|
|---|
| 4589 | return (getc(fp));
|
|---|
| 4590 | }
|
|---|
| 4591 |
|
|---|
| 4592 |
|
|---|
| 4593 | /*********************************************************************
|
|---|
| 4594 | * getchar (CRTDLL.386)
|
|---|
| 4595 | */
|
|---|
| 4596 | int CDECL CRTDLL_getchar( void )
|
|---|
| 4597 | {
|
|---|
| 4598 | dprintf2(("CRTDLL: getchar\n"));
|
|---|
| 4599 | return (getchar());
|
|---|
| 4600 | }
|
|---|
| 4601 |
|
|---|
| 4602 |
|
|---|
| 4603 | /*********************************************************************
|
|---|
| 4604 | * getenv (CRTDLL.387)
|
|---|
| 4605 | */
|
|---|
| 4606 | char * CDECL CRTDLL_getenv( const char *name )
|
|---|
| 4607 | {
|
|---|
| 4608 | dprintf2(("CRTDLL: getenv\n"));
|
|---|
| 4609 | return (getenv(name));
|
|---|
| 4610 | }
|
|---|
| 4611 |
|
|---|
| 4612 |
|
|---|
| 4613 | /*********************************************************************
|
|---|
| 4614 | * gets (CRTDLL.388)
|
|---|
| 4615 | */
|
|---|
| 4616 | char * CDECL CRTDLL_gets( char *s )
|
|---|
| 4617 | {
|
|---|
| 4618 | dprintf2(("CRTDLL: gets\n"));
|
|---|
| 4619 | return (gets(s));
|
|---|
| 4620 | }
|
|---|
| 4621 |
|
|---|
| 4622 |
|
|---|
| 4623 | /*********************************************************************
|
|---|
| 4624 | * gmtime (CRTDLL.389)
|
|---|
| 4625 | */
|
|---|
| 4626 | struct tm * CDECL CRTDLL_gmtime( const time_t *timer )
|
|---|
| 4627 | {
|
|---|
| 4628 | dprintf2(("CRTDLL: gmtime\n"));
|
|---|
| 4629 | return (gmtime(timer));
|
|---|
| 4630 | }
|
|---|
| 4631 |
|
|---|
| 4632 |
|
|---|
| 4633 | /*********************************************************************
|
|---|
| 4634 | * is_wctype (CRTDLL.390)
|
|---|
| 4635 | */
|
|---|
| 4636 | INT CDECL CRTDLL_is_wctype(wint_t wc, wctype_t wctypeFlags)
|
|---|
| 4637 | {
|
|---|
| 4638 | dprintf2(("CRTDLL: is_wctype\n"));
|
|---|
| 4639 | return ((CRTDLL_pwctype_dll[(unsigned char)(wc & 0xFF)]&wctypeFlags) == wctypeFlags );
|
|---|
| 4640 | }
|
|---|
| 4641 |
|
|---|
| 4642 |
|
|---|
| 4643 | /*********************************************************************
|
|---|
| 4644 | * isalnum (CRTDLL.391)
|
|---|
| 4645 | */
|
|---|
| 4646 | int CDECL CRTDLL_isalnum(int i)
|
|---|
| 4647 | {
|
|---|
| 4648 | dprintf2(("CRTDLL: isalnum(%08xh)\n", i));
|
|---|
| 4649 | return (isalnum(i));
|
|---|
| 4650 | }
|
|---|
| 4651 |
|
|---|
| 4652 |
|
|---|
| 4653 | /*********************************************************************
|
|---|
| 4654 | * iscntrl (CRTDLL.393)
|
|---|
| 4655 | */
|
|---|
| 4656 | int CDECL CRTDLL_iscntrl(int i)
|
|---|
| 4657 | {
|
|---|
| 4658 | dprintf2(("CRTDLL: iscntrl(%08xh)\n", i));
|
|---|
| 4659 | return (iscntrl(i));
|
|---|
| 4660 | }
|
|---|
| 4661 |
|
|---|
| 4662 |
|
|---|
| 4663 | /*********************************************************************
|
|---|
| 4664 | * isgraph (CRTDLL.395)
|
|---|
| 4665 | */
|
|---|
| 4666 | int CDECL CRTDLL_isgraph(int i)
|
|---|
| 4667 | {
|
|---|
| 4668 | dprintf2(("CRTDLL: isgraph(%08xh)\n", i));
|
|---|
| 4669 | return (isgraph(i));
|
|---|
| 4670 | }
|
|---|
| 4671 |
|
|---|
| 4672 |
|
|---|
| 4673 | /*********************************************************************
|
|---|
| 4674 | * isleadbyte (CRTDLL.396)
|
|---|
| 4675 | */
|
|---|
| 4676 | int CDECL CRTDLL_isleadbyte(int i)
|
|---|
| 4677 | {
|
|---|
| 4678 | dprintf(("CRTDLL: isleadbyte(%08xh) not implemented.\n", i));
|
|---|
| 4679 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 4680 | return FALSE;
|
|---|
| 4681 | }
|
|---|
| 4682 |
|
|---|
| 4683 |
|
|---|
| 4684 | /*********************************************************************
|
|---|
| 4685 | * ispunct (CRTDLL.399)
|
|---|
| 4686 | */
|
|---|
| 4687 | int CDECL CRTDLL_ispunct(int i)
|
|---|
| 4688 | {
|
|---|
| 4689 | dprintf2(("CRTDLL: ispunct(%08xh)\n", i));
|
|---|
| 4690 | return (ispunct(i));
|
|---|
| 4691 | }
|
|---|
| 4692 |
|
|---|
| 4693 |
|
|---|
| 4694 | /*********************************************************************
|
|---|
| 4695 | * iswalnum (CRTDLL.402)
|
|---|
| 4696 | */
|
|---|
| 4697 | int CDECL CRTDLL_iswalnum(wint_t i)
|
|---|
| 4698 | {
|
|---|
| 4699 | dprintf2(("CRTDLL: iswalnum(%08xh)\n", i));
|
|---|
| 4700 | return (iswalnum(i));
|
|---|
| 4701 | }
|
|---|
| 4702 |
|
|---|
| 4703 |
|
|---|
| 4704 | /*********************************************************************
|
|---|
| 4705 | * iswascii (CRTDLL.404)
|
|---|
| 4706 | */
|
|---|
| 4707 | int CDECL CRTDLL_iswascii(wint_t c)
|
|---|
| 4708 | {
|
|---|
| 4709 | dprintf2(("CRTDLL: iswascii\n", c));
|
|---|
| 4710 | return (!((c)&(~0x7f)));
|
|---|
| 4711 | }
|
|---|
| 4712 |
|
|---|
| 4713 |
|
|---|
| 4714 | /*********************************************************************
|
|---|
| 4715 | * iswcntrl (CRTDLL.405)
|
|---|
| 4716 | */
|
|---|
| 4717 | int CDECL CRTDLL_iswcntrl(wint_t i)
|
|---|
| 4718 | {
|
|---|
| 4719 | dprintf2(("CRTDLL: iswcntrl(%08xh)\n", i));
|
|---|
| 4720 | return (iswcntrl(i));
|
|---|
| 4721 | }
|
|---|
| 4722 |
|
|---|
| 4723 |
|
|---|
| 4724 | /*********************************************************************
|
|---|
| 4725 | * iswdigit (CRTDLL.407)
|
|---|
| 4726 | */
|
|---|
| 4727 | int CDECL CRTDLL_iswdigit(wint_t i)
|
|---|
| 4728 | {
|
|---|
| 4729 | dprintf2(("CRTDLL: iswdigit(%08xh)\n", i));
|
|---|
| 4730 | return (iswdigit(i));
|
|---|
| 4731 | }
|
|---|
| 4732 |
|
|---|
| 4733 |
|
|---|
| 4734 | /*********************************************************************
|
|---|
| 4735 | * iswgraph (CRTDLL.408)
|
|---|
| 4736 | */
|
|---|
| 4737 | int CDECL CRTDLL_iswgraph(wint_t i)
|
|---|
| 4738 | {
|
|---|
| 4739 | dprintf2(("CRTDLL: iswgraph(%08xh)\n", i));
|
|---|
| 4740 | return (iswgraph(i));
|
|---|
| 4741 | }
|
|---|
| 4742 |
|
|---|
| 4743 |
|
|---|
| 4744 | /*********************************************************************
|
|---|
| 4745 | * iswlower (CRTDLL.409)
|
|---|
| 4746 | */
|
|---|
| 4747 | int CDECL CRTDLL_iswlower(wint_t i)
|
|---|
| 4748 | {
|
|---|
| 4749 | dprintf2(("CRTDLL: iswlower(%08xh)\n", i));
|
|---|
| 4750 | return (iswlower(i));
|
|---|
| 4751 | }
|
|---|
| 4752 |
|
|---|
| 4753 |
|
|---|
| 4754 | /*********************************************************************
|
|---|
| 4755 | * iswprint (CRTDLL.410)
|
|---|
| 4756 | */
|
|---|
| 4757 | int CDECL CRTDLL_iswprint(wint_t i)
|
|---|
| 4758 | {
|
|---|
| 4759 | dprintf2(("CRTDLL: iswprint(%08xh)\n", i));
|
|---|
| 4760 | return (iswprint(i));
|
|---|
| 4761 | }
|
|---|
| 4762 |
|
|---|
| 4763 |
|
|---|
| 4764 | /*********************************************************************
|
|---|
| 4765 | * iswpunct (CRTDLL.411)
|
|---|
| 4766 | */
|
|---|
| 4767 | int CDECL CRTDLL_iswpunct(wint_t i)
|
|---|
| 4768 | {
|
|---|
| 4769 | dprintf2(("CRTDLL: iswpunct(%08xh)\n", i));
|
|---|
| 4770 | return (iswpunct(i));
|
|---|
| 4771 | }
|
|---|
| 4772 |
|
|---|
| 4773 |
|
|---|
| 4774 | /*********************************************************************
|
|---|
| 4775 | * iswspace (CRTDLL.412)
|
|---|
| 4776 | */
|
|---|
| 4777 | int CDECL CRTDLL_iswspace(wint_t i)
|
|---|
| 4778 | {
|
|---|
| 4779 | dprintf2(("CRTDLL: iswspace(%08xh)\n", i));
|
|---|
| 4780 | return (iswspace(i));
|
|---|
| 4781 | }
|
|---|
| 4782 |
|
|---|
| 4783 |
|
|---|
| 4784 | /*********************************************************************
|
|---|
| 4785 | * iswupper (CRTDLL.413)
|
|---|
| 4786 | */
|
|---|
| 4787 | int CDECL CRTDLL_iswupper(wint_t i)
|
|---|
| 4788 | {
|
|---|
| 4789 | dprintf2(("CRTDLL: iswupper(%08xh)\n", i));
|
|---|
| 4790 | return (iswupper(i));
|
|---|
| 4791 | }
|
|---|
| 4792 |
|
|---|
| 4793 |
|
|---|
| 4794 | /*********************************************************************
|
|---|
| 4795 | * iswxdigit (CRTDLL.414)
|
|---|
| 4796 | */
|
|---|
| 4797 | int CDECL CRTDLL_iswxdigit(wint_t i)
|
|---|
| 4798 | {
|
|---|
| 4799 | dprintf2(("CRTDLL: iswxdigit(%08xh)\n", i));
|
|---|
| 4800 | return (iswxdigit(i));
|
|---|
| 4801 | }
|
|---|
| 4802 |
|
|---|
| 4803 |
|
|---|
| 4804 | /*********************************************************************
|
|---|
| 4805 | * ldexp (CRTDLL.417)
|
|---|
| 4806 | */
|
|---|
| 4807 | double CDECL CRTDLL_ldexp( double x, int exp )
|
|---|
| 4808 | {
|
|---|
| 4809 | dprintf2(("CRTDLL: ldexp\n"));
|
|---|
| 4810 | return (ldexp(x, exp));
|
|---|
| 4811 | }
|
|---|
| 4812 |
|
|---|
| 4813 |
|
|---|
| 4814 | /*********************************************************************
|
|---|
| 4815 | * ldiv (CRTDLL.418)
|
|---|
| 4816 | */
|
|---|
| 4817 | ldiv_t CDECL CRTDLL_ldiv( long int numer, long int denom )
|
|---|
| 4818 | {
|
|---|
| 4819 | dprintf2(("CRTDLL: ldiv\n"));
|
|---|
| 4820 | return (ldiv(numer, denom));
|
|---|
| 4821 | }
|
|---|
| 4822 |
|
|---|
| 4823 |
|
|---|
| 4824 | /*********************************************************************
|
|---|
| 4825 | * localeconv (CRTDLL.419)
|
|---|
| 4826 | */
|
|---|
| 4827 | struct lconv * CDECL CRTDLL_localeconv(void)
|
|---|
| 4828 | {
|
|---|
| 4829 | dprintf2(("CRTDLL: localeconv\n"));
|
|---|
| 4830 | return (localeconv());
|
|---|
| 4831 | }
|
|---|
| 4832 |
|
|---|
| 4833 |
|
|---|
| 4834 | /*********************************************************************
|
|---|
| 4835 | * localtime (CRTDLL.420)
|
|---|
| 4836 | */
|
|---|
| 4837 | struct tm * CDECL CRTDLL_localtime( const time_t *timer )
|
|---|
| 4838 | {
|
|---|
| 4839 | dprintf2(("CRTDLL: localtime\n"));
|
|---|
| 4840 | return (localtime(timer));
|
|---|
| 4841 | }
|
|---|
| 4842 |
|
|---|
| 4843 |
|
|---|
| 4844 | /*********************************************************************
|
|---|
| 4845 | * log10 (CRTDLL.422)
|
|---|
| 4846 | */
|
|---|
| 4847 | double CDECL CRTDLL_log10( double x )
|
|---|
| 4848 | {
|
|---|
| 4849 | dprintf2(("CRTDLL: log10\n"));
|
|---|
| 4850 | return (log10(x));
|
|---|
| 4851 | }
|
|---|
| 4852 |
|
|---|
| 4853 |
|
|---|
| 4854 | /*********************************************************************
|
|---|
| 4855 | * longjmp (CRTDLL.423)
|
|---|
| 4856 | */
|
|---|
| 4857 | VOID CDECL CRTDLL_longjmp(jmp_buf env, int val)
|
|---|
| 4858 | {
|
|---|
| 4859 | dprintf2(("CRTDLL: longjmp\n"));
|
|---|
| 4860 | longjmp(env, val);
|
|---|
| 4861 | }
|
|---|
| 4862 |
|
|---|
| 4863 |
|
|---|
| 4864 | /*********************************************************************
|
|---|
| 4865 | * malloc (CRTDLL.424)
|
|---|
| 4866 | */
|
|---|
| 4867 | VOID* CDECL CRTDLL_malloc(DWORD size)
|
|---|
| 4868 | {
|
|---|
| 4869 | // dprintf2(("CRTDLL: malloc\n"));
|
|---|
| 4870 | return Heap_Alloc(size);
|
|---|
| 4871 | }
|
|---|
| 4872 |
|
|---|
| 4873 |
|
|---|
| 4874 | /*********************************************************************
|
|---|
| 4875 | * mblen (CRTDLL.425)
|
|---|
| 4876 | */
|
|---|
| 4877 | INT CDECL CRTDLL_mblen( const char *s, size_t n )
|
|---|
| 4878 | {
|
|---|
| 4879 | dprintf2(("CRTDLL: mblen\n"));
|
|---|
| 4880 | return (mblen(s, n));
|
|---|
| 4881 | }
|
|---|
| 4882 |
|
|---|
| 4883 |
|
|---|
| 4884 | /*********************************************************************
|
|---|
| 4885 | * CRTDLL_mbtowc (CRTDLL.427)
|
|---|
| 4886 | */
|
|---|
| 4887 | INT CDECL CRTDLL_mbtowc( WCHAR *dst, LPCSTR str, INT n )
|
|---|
| 4888 | {
|
|---|
| 4889 | dprintf2(("CRTDLL: _mbtowc\n"));
|
|---|
| 4890 | wchar_t res;
|
|---|
| 4891 | int ret = mbtowc( &res, str, n );
|
|---|
| 4892 | if (dst) *dst = (WCHAR)res;
|
|---|
| 4893 | return ret;
|
|---|
| 4894 | }
|
|---|
| 4895 |
|
|---|
| 4896 |
|
|---|
| 4897 | /*********************************************************************
|
|---|
| 4898 | * mktime (CRTDLL.433)
|
|---|
| 4899 | */
|
|---|
| 4900 | time_t CDECL CRTDLL_mktime( struct tm *timeptr )
|
|---|
| 4901 | {
|
|---|
| 4902 | dprintf2(("CRTDLL: mktime\n"));
|
|---|
| 4903 | return mktime( timeptr );
|
|---|
| 4904 | }
|
|---|
| 4905 |
|
|---|
| 4906 |
|
|---|
| 4907 | /*********************************************************************
|
|---|
| 4908 | * modf (CRTDLL.434)
|
|---|
| 4909 | */
|
|---|
| 4910 | double CDECL CRTDLL_modf( double value, double *iptr )
|
|---|
| 4911 | {
|
|---|
| 4912 | dprintf2(("CRTDLL: modf\n"));
|
|---|
| 4913 | return modf( value, iptr );
|
|---|
| 4914 | }
|
|---|
| 4915 |
|
|---|
| 4916 |
|
|---|
| 4917 | /*********************************************************************
|
|---|
| 4918 | * perror (CRTDLL.435)
|
|---|
| 4919 | */
|
|---|
| 4920 | void CDECL CRTDLL_perror( const char *s )
|
|---|
| 4921 | {
|
|---|
| 4922 | dprintf2(("CRTDLL: perror\n"));
|
|---|
| 4923 | perror( s );
|
|---|
| 4924 | }
|
|---|
| 4925 |
|
|---|
| 4926 |
|
|---|
| 4927 | /*********************************************************************
|
|---|
| 4928 | * printf (CRTDLL.437)
|
|---|
| 4929 | */
|
|---|
| 4930 | int CDECL CRTDLL_printf( const char *format, ... )
|
|---|
| 4931 | {
|
|---|
| 4932 | dprintf2(("CRTDLL: printf\n"));
|
|---|
| 4933 | va_list arg;
|
|---|
| 4934 | int done;
|
|---|
| 4935 |
|
|---|
| 4936 | va_start (arg, format);
|
|---|
| 4937 | done = vprintf (format, arg);
|
|---|
| 4938 | va_end (arg);
|
|---|
| 4939 | return done;
|
|---|
| 4940 | }
|
|---|
| 4941 |
|
|---|
| 4942 |
|
|---|
| 4943 | /*********************************************************************
|
|---|
| 4944 | * putc (CRTDLL.438)
|
|---|
| 4945 | */
|
|---|
| 4946 | int CDECL CRTDLL_putc( int c, FILE *fp )
|
|---|
| 4947 | {
|
|---|
| 4948 | dprintf2(("CRTDLL: putc\n"));
|
|---|
| 4949 | return putc( c, fp );
|
|---|
| 4950 | }
|
|---|
| 4951 |
|
|---|
| 4952 |
|
|---|
| 4953 | /*********************************************************************
|
|---|
| 4954 | * putchar (CRTDLL.439)
|
|---|
| 4955 | */
|
|---|
| 4956 | int CDECL CRTDLL_putchar( int c )
|
|---|
| 4957 | {
|
|---|
| 4958 | dprintf2(("CRTDLL: putchar\n"));
|
|---|
| 4959 | return putchar( c );
|
|---|
| 4960 | }
|
|---|
| 4961 |
|
|---|
| 4962 |
|
|---|
| 4963 | /*********************************************************************
|
|---|
| 4964 | * puts (CRTDLL.440)
|
|---|
| 4965 | */
|
|---|
| 4966 | int CDECL CRTDLL_puts( const char *s )
|
|---|
| 4967 | {
|
|---|
| 4968 | dprintf2(("CRTDLL: puts\n"));
|
|---|
| 4969 | return puts( s );
|
|---|
| 4970 | }
|
|---|
| 4971 |
|
|---|
| 4972 |
|
|---|
| 4973 | /*********************************************************************
|
|---|
| 4974 | * raise (CRTDLL.442)
|
|---|
| 4975 | */
|
|---|
| 4976 | int CDECL CRTDLL_raise( int sig )
|
|---|
| 4977 | {
|
|---|
| 4978 | dprintf2(("CRTDLL: raise\n"));
|
|---|
| 4979 | return raise( sig );
|
|---|
| 4980 | }
|
|---|
| 4981 |
|
|---|
| 4982 |
|
|---|
| 4983 | /*********************************************************************
|
|---|
| 4984 | * rand (CRTDLL.443)
|
|---|
| 4985 | */
|
|---|
| 4986 | int CDECL CRTDLL_rand( void )
|
|---|
| 4987 | {
|
|---|
| 4988 | // dprintf2(("CRTDLL: rand\n"));
|
|---|
| 4989 | return (rand());
|
|---|
| 4990 | }
|
|---|
| 4991 |
|
|---|
| 4992 |
|
|---|
| 4993 | /*********************************************************************
|
|---|
| 4994 | * realloc (CRTDLL.444)
|
|---|
| 4995 | */
|
|---|
| 4996 | void * CDECL CRTDLL_realloc( void *ptr, size_t size )
|
|---|
| 4997 | {
|
|---|
| 4998 | dprintf2(("CRTDLL: realloc\n"));
|
|---|
| 4999 | return HeapReAlloc( GetProcessHeap(), 0, ptr, size );
|
|---|
| 5000 | }
|
|---|
| 5001 |
|
|---|
| 5002 |
|
|---|
| 5003 | /*********************************************************************
|
|---|
| 5004 | * remove (CRTDLL.445)
|
|---|
| 5005 | */
|
|---|
| 5006 | INT CDECL CRTDLL_remove(LPCSTR file)
|
|---|
| 5007 | {
|
|---|
| 5008 | dprintf2(("CRTDLL: remove\n"));
|
|---|
| 5009 | if (!DeleteFileA(file))
|
|---|
| 5010 | return -1;
|
|---|
| 5011 | return 0;
|
|---|
| 5012 | }
|
|---|
| 5013 |
|
|---|
| 5014 |
|
|---|
| 5015 | /*********************************************************************
|
|---|
| 5016 | * rename (CRTDLL.446)
|
|---|
| 5017 | */
|
|---|
| 5018 | int CDECL CRTDLL_rename (const char *old, const char *new2)
|
|---|
| 5019 | {
|
|---|
| 5020 | dprintf2(("CRTDLL: rename\n"));
|
|---|
| 5021 | return (rename(old, new2));
|
|---|
| 5022 | }
|
|---|
| 5023 |
|
|---|
| 5024 |
|
|---|
| 5025 | /*********************************************************************
|
|---|
| 5026 | * rewind (CRTDLL.447)
|
|---|
| 5027 | */
|
|---|
| 5028 | void CDECL CRTDLL_rewind( FILE *fp )
|
|---|
| 5029 | {
|
|---|
| 5030 | dprintf2(("CRTDLL: rewind\n"));
|
|---|
| 5031 | rewind(fp);
|
|---|
| 5032 | }
|
|---|
| 5033 |
|
|---|
| 5034 |
|
|---|
| 5035 | /*********************************************************************
|
|---|
| 5036 | * scanf (CRTDLL.448)
|
|---|
| 5037 | */
|
|---|
| 5038 | int CDECL CRTDLL_scanf( const char *format, ... )
|
|---|
| 5039 | {
|
|---|
| 5040 | dprintf(("CRTDLL: scanf not implemented.\n"));
|
|---|
| 5041 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 5042 | return FALSE;
|
|---|
| 5043 | }
|
|---|
| 5044 |
|
|---|
| 5045 |
|
|---|
| 5046 | /*********************************************************************
|
|---|
| 5047 | * setbuf (CRTDLL.449)
|
|---|
| 5048 | */
|
|---|
| 5049 | void CDECL CRTDLL_setbuf( FILE *fp, char *buf )
|
|---|
| 5050 | {
|
|---|
| 5051 | dprintf2(("CRTDLL: setbuf\n"));
|
|---|
| 5052 | setbuf(fp, buf);
|
|---|
| 5053 | }
|
|---|
| 5054 |
|
|---|
| 5055 |
|
|---|
| 5056 | /*********************************************************************
|
|---|
| 5057 | * setlocale (CRTDLL.450)
|
|---|
| 5058 | */
|
|---|
| 5059 | char * CDECL CRTDLL_setlocale(int category,const char *locale)
|
|---|
| 5060 | {
|
|---|
| 5061 | dprintf2(("CRTDLL: setlocale\n"));
|
|---|
| 5062 | return (setlocale(category, locale));
|
|---|
| 5063 | }
|
|---|
| 5064 |
|
|---|
| 5065 |
|
|---|
| 5066 | /*********************************************************************
|
|---|
| 5067 | * setvbuf (CRTDLL.451)
|
|---|
| 5068 | */
|
|---|
| 5069 | int CDECL CRTDLL_setvbuf( FILE *fp, char *buf, int mode, size_t size )
|
|---|
| 5070 | {
|
|---|
| 5071 | dprintf2(("CRTDLL: setvbuf\n"));
|
|---|
| 5072 | return (setvbuf(fp, buf, mode, size));
|
|---|
| 5073 | }
|
|---|
| 5074 |
|
|---|
| 5075 |
|
|---|
| 5076 | /*********************************************************************
|
|---|
| 5077 | * signal (CRTDLL.452)
|
|---|
| 5078 | */
|
|---|
| 5079 | void CDECL CRTDLL_signal( int sig, void (*func)(int))
|
|---|
| 5080 | {
|
|---|
| 5081 | dprintf(("CRTDLL: signal not implemented.\n"));
|
|---|
| 5082 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 5083 | }
|
|---|
| 5084 |
|
|---|
| 5085 |
|
|---|
| 5086 | /*********************************************************************
|
|---|
| 5087 | * sinh (CRTDLL.454)
|
|---|
| 5088 | */
|
|---|
| 5089 | double CDECL CRTDLL_sinh( double x )
|
|---|
| 5090 | {
|
|---|
| 5091 | dprintf2(("CRTDLL: sinh\n"));
|
|---|
| 5092 | return (sinh(x));
|
|---|
| 5093 | }
|
|---|
| 5094 |
|
|---|
| 5095 |
|
|---|
| 5096 | /*********************************************************************
|
|---|
| 5097 | * srand (CRTDLL.457)
|
|---|
| 5098 | */
|
|---|
| 5099 | void CDECL CRTDLL_srand( unsigned int seed )
|
|---|
| 5100 | {
|
|---|
| 5101 | dprintf2(("CRTDLL: srand\n"));
|
|---|
| 5102 | srand(seed);
|
|---|
| 5103 | }
|
|---|
| 5104 |
|
|---|
| 5105 |
|
|---|
| 5106 | /*********************************************************************
|
|---|
| 5107 | * strcoll (CRTDLL.462)
|
|---|
| 5108 | */
|
|---|
| 5109 | int CDECL CRTDLL_strcoll( const char *s1, const char *s2 )
|
|---|
| 5110 | {
|
|---|
| 5111 | dprintf2(("CRTDLL: strcoll\n"));
|
|---|
| 5112 | return strcoll(s1, s2);
|
|---|
| 5113 | }
|
|---|
| 5114 |
|
|---|
| 5115 |
|
|---|
| 5116 | /*********************************************************************
|
|---|
| 5117 | * strerror (CRTDLL.465)
|
|---|
| 5118 | */
|
|---|
| 5119 | char * CDECL CRTDLL_strerror( int errnum )
|
|---|
| 5120 | {
|
|---|
| 5121 | dprintf2(("CRTDLL: strerror\n"));
|
|---|
| 5122 | return strerror(errnum);
|
|---|
| 5123 | }
|
|---|
| 5124 |
|
|---|
| 5125 |
|
|---|
| 5126 | /*********************************************************************
|
|---|
| 5127 | * strftime (CRTDLL.466)
|
|---|
| 5128 | */
|
|---|
| 5129 | size_t CDECL CRTDLL_strftime( char *s, size_t maxsiz, const char *fmt, const struct tm *tp )
|
|---|
| 5130 | {
|
|---|
| 5131 | dprintf2(("CRTDLL: strftime\n"));
|
|---|
| 5132 | return strftime(s, maxsiz, fmt, tp);
|
|---|
| 5133 | }
|
|---|
| 5134 |
|
|---|
| 5135 |
|
|---|
| 5136 | /*********************************************************************
|
|---|
| 5137 | * strtod (CRTDLL.475)
|
|---|
| 5138 | */
|
|---|
| 5139 | double CDECL CRTDLL_strtod( const char *nptr, char **endptr )
|
|---|
| 5140 | {
|
|---|
| 5141 | dprintf2(("CRTDLL: strtod\n"));
|
|---|
| 5142 | return strtod(nptr, endptr);
|
|---|
| 5143 | }
|
|---|
| 5144 |
|
|---|
| 5145 |
|
|---|
| 5146 | /*********************************************************************
|
|---|
| 5147 | * strtok (CRTDLL.476)
|
|---|
| 5148 | */
|
|---|
| 5149 | char * CDECL CRTDLL_strtok( char *s1, const char *s2 )
|
|---|
| 5150 | {
|
|---|
| 5151 | dprintf2(("CRTDLL: strtok\n"));
|
|---|
| 5152 | return strtok(s1, s2);
|
|---|
| 5153 | }
|
|---|
| 5154 |
|
|---|
| 5155 |
|
|---|
| 5156 | /*********************************************************************
|
|---|
| 5157 | * strtol (CRTDLL.477)
|
|---|
| 5158 | */
|
|---|
| 5159 | long int CDECL CRTDLL_strtol( const char *nptr, char **endptr, int base )
|
|---|
| 5160 | {
|
|---|
| 5161 | dprintf2(("CRTDLL: strtol\n"));
|
|---|
| 5162 | return strtol(nptr, endptr, base);
|
|---|
| 5163 | }
|
|---|
| 5164 |
|
|---|
| 5165 |
|
|---|
| 5166 | /*********************************************************************
|
|---|
| 5167 | * strtoul (CRTDLL.478)
|
|---|
| 5168 | */
|
|---|
| 5169 | unsigned long CDECL CRTDLL_strtoul( const char *nptr, char **endptr, int base )
|
|---|
| 5170 | {
|
|---|
| 5171 | dprintf2(("CRTDLL: strtoul\n"));
|
|---|
| 5172 | return strtoul(nptr, endptr, base);
|
|---|
| 5173 | }
|
|---|
| 5174 |
|
|---|
| 5175 |
|
|---|
| 5176 | /*********************************************************************
|
|---|
| 5177 | * strxfrm (CRTDLL.479)
|
|---|
| 5178 | */
|
|---|
| 5179 | size_t CDECL CRTDLL_strxfrm( char *s1, const char *s2, size_t n )
|
|---|
| 5180 | {
|
|---|
| 5181 | dprintf2(("CRTDLL: strxfrm\n"));
|
|---|
| 5182 | return strxfrm(s1, s2, n);
|
|---|
| 5183 | }
|
|---|
| 5184 |
|
|---|
| 5185 |
|
|---|
| 5186 | /*********************************************************************
|
|---|
| 5187 | * swscanf (CRTDLL.481)
|
|---|
| 5188 | */
|
|---|
| 5189 | int CDECL CRTDLL_swscanf( const wchar_t *s1, const wchar_t *s2, ... )
|
|---|
| 5190 | {
|
|---|
| 5191 | dprintf(("CRTDLL: swscanf not implemented.\n"));
|
|---|
| 5192 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 5193 | return FALSE;
|
|---|
| 5194 | }
|
|---|
| 5195 |
|
|---|
| 5196 |
|
|---|
| 5197 | /*********************************************************************
|
|---|
| 5198 | * system (CRTDLL.482)
|
|---|
| 5199 | */
|
|---|
| 5200 | int CDECL CRTDLL_system( const char *string )
|
|---|
| 5201 | {
|
|---|
| 5202 | dprintf2(("CRTDLL: system\n"));
|
|---|
| 5203 | return system(string);
|
|---|
| 5204 | }
|
|---|
| 5205 |
|
|---|
| 5206 |
|
|---|
| 5207 | /*********************************************************************
|
|---|
| 5208 | * tanh (CRTDLL.485)
|
|---|
| 5209 | */
|
|---|
| 5210 | double CDECL CRTDLL_tanh( double x )
|
|---|
| 5211 | {
|
|---|
| 5212 | dprintf2(("CRTDLL: tanh\n"));
|
|---|
| 5213 | return tanh(x);
|
|---|
| 5214 | }
|
|---|
| 5215 |
|
|---|
| 5216 |
|
|---|
| 5217 | /*********************************************************************
|
|---|
| 5218 | * time (CRTDLL.485)
|
|---|
| 5219 | */
|
|---|
| 5220 | time_t CDECL CRTDLL_time( time_t *timer )
|
|---|
| 5221 | {
|
|---|
| 5222 | dprintf2(("CRTDLL: time\n"));
|
|---|
| 5223 |
|
|---|
| 5224 | return time(timer);
|
|---|
| 5225 | }
|
|---|
| 5226 |
|
|---|
| 5227 |
|
|---|
| 5228 | /*********************************************************************
|
|---|
| 5229 | * tmpfile (CRTDLL.486)
|
|---|
| 5230 | */
|
|---|
| 5231 | FILE * CDECL CRTDLL_tmpfile( void )
|
|---|
| 5232 | {
|
|---|
| 5233 | dprintf2(("CRTDLL: tmpfile\n"));
|
|---|
| 5234 | return (tmpfile());
|
|---|
| 5235 | }
|
|---|
| 5236 |
|
|---|
| 5237 |
|
|---|
| 5238 | /*********************************************************************
|
|---|
| 5239 | * tmpnam (CRTDLL.487)
|
|---|
| 5240 | */
|
|---|
| 5241 | char * CDECL CRTDLL_tmpnam( char *s )
|
|---|
| 5242 | {
|
|---|
| 5243 | dprintf2(("CRTDLL: tmpnam\n"));
|
|---|
| 5244 | return (tmpnam(s));
|
|---|
| 5245 | }
|
|---|
| 5246 |
|
|---|
| 5247 |
|
|---|
| 5248 | /*********************************************************************
|
|---|
| 5249 | * ungetc (CRTDLL.492)
|
|---|
| 5250 | */
|
|---|
| 5251 | INT CDECL CRTDLL_ungetc(int c, FILE *f)
|
|---|
| 5252 | {
|
|---|
| 5253 | dprintf(("CRTDLL: ungetc not implemented.\n"));
|
|---|
| 5254 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 5255 | return FALSE;
|
|---|
| 5256 | }
|
|---|
| 5257 |
|
|---|
| 5258 |
|
|---|
| 5259 | /*********************************************************************
|
|---|
| 5260 | * ungetwc (CRTDLL.493)
|
|---|
| 5261 | */
|
|---|
| 5262 | wint_t CDECL CRTDLL_ungetwc( wint_t wc, FILE *strm )
|
|---|
| 5263 | {
|
|---|
| 5264 | dprintf2(("CRTDLL: ungetwc\n"));
|
|---|
| 5265 | return (ungetwc(wc, strm));
|
|---|
| 5266 | }
|
|---|
| 5267 |
|
|---|
| 5268 | /*********************************************************************
|
|---|
| 5269 | * vfprintf (CRTDLL.494)
|
|---|
| 5270 | */
|
|---|
| 5271 | INT CDECL CRTDLL_vfprintf( CRTDLL_FILE *file, LPSTR format, va_list args )
|
|---|
| 5272 | {
|
|---|
| 5273 | dprintf2(("CRTDLL: vprintf\n"));
|
|---|
| 5274 | char buffer[2048]; /* FIXME... */
|
|---|
| 5275 | vsprintf( buffer, format, args );
|
|---|
| 5276 | return CRTDLL_fwrite( buffer, 1, strlen(buffer), file );
|
|---|
| 5277 | }
|
|---|
| 5278 |
|
|---|
| 5279 |
|
|---|
| 5280 | /*********************************************************************
|
|---|
| 5281 | * vfwprintf (CRTDLL.495)
|
|---|
| 5282 | */
|
|---|
| 5283 | int CDECL CRTDLL_vfwprintf( FILE *F, const wchar_t *s, va_list arg )
|
|---|
| 5284 | {
|
|---|
| 5285 | dprintf(("CRTDLL: vfwprintf not implemented.\n"));
|
|---|
| 5286 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 5287 | return FALSE;
|
|---|
| 5288 | }
|
|---|
| 5289 |
|
|---|
| 5290 |
|
|---|
| 5291 | /*********************************************************************
|
|---|
| 5292 | * vprintf (CRTDLL.496)
|
|---|
| 5293 | */
|
|---|
| 5294 | int CDECL CRTDLL_vprintf( const char *format, __va_list arg )
|
|---|
| 5295 | {
|
|---|
| 5296 | dprintf2(("CRTDLL: vprintf\n"));
|
|---|
| 5297 | return (vprintf(format, arg));
|
|---|
| 5298 | }
|
|---|
| 5299 |
|
|---|
| 5300 |
|
|---|
| 5301 | /*********************************************************************
|
|---|
| 5302 | * vswprintf (CRTDLL.498)
|
|---|
| 5303 | */
|
|---|
| 5304 | int CDECL CRTDLL_vswprintf( wchar_t *s , size_t t, const wchar_t *format, va_list arg )
|
|---|
| 5305 | {
|
|---|
| 5306 | dprintf2(("CRTDLL: vswprintf\n"));
|
|---|
| 5307 | return (vswprintf(s, t, format, arg));
|
|---|
| 5308 | }
|
|---|
| 5309 |
|
|---|
| 5310 |
|
|---|
| 5311 | /*********************************************************************
|
|---|
| 5312 | * vwprintf (CRTDLL.499)
|
|---|
| 5313 | */
|
|---|
| 5314 | int CDECL CRTDLL_vwprintf( const wchar_t *s, va_list arg)
|
|---|
| 5315 | {
|
|---|
| 5316 | dprintf(("CRTDLL: vwprintf not implemented.\n"));
|
|---|
| 5317 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 5318 | return FALSE;
|
|---|
| 5319 | }
|
|---|
| 5320 |
|
|---|
| 5321 |
|
|---|
| 5322 | /*********************************************************************
|
|---|
| 5323 | * wcscoll (CRTDLL.503)
|
|---|
| 5324 | */
|
|---|
| 5325 | int CDECL CRTDLL_wcscoll(const wchar_t *s1, const wchar_t *s2)
|
|---|
| 5326 | {
|
|---|
| 5327 | dprintf2(("CRTDLL: wcscoll\n"));
|
|---|
| 5328 | return (wcscoll(s1, s2));
|
|---|
| 5329 | }
|
|---|
| 5330 |
|
|---|
| 5331 |
|
|---|
| 5332 | /*********************************************************************
|
|---|
| 5333 | * wcsftime (CRTDLL.506)
|
|---|
| 5334 | */
|
|---|
| 5335 | size_t CDECL CRTDLL_wcsftime( wchar_t *s, size_t maxsize,
|
|---|
| 5336 | const wchar_t *format, const struct tm *timeptr )
|
|---|
| 5337 | {
|
|---|
| 5338 | dprintf2(("CRTDLL: wcsftime\n"));
|
|---|
| 5339 | return (wcsftime(s, maxsize, format, timeptr));
|
|---|
| 5340 | }
|
|---|
| 5341 |
|
|---|
| 5342 |
|
|---|
| 5343 | /*********************************************************************
|
|---|
| 5344 | * wcstod (CRTDLL.515)
|
|---|
| 5345 | */
|
|---|
| 5346 | double CDECL CRTDLL_wcstod( const wchar_t *nptr, wchar_t **endptr )
|
|---|
| 5347 | {
|
|---|
| 5348 | dprintf2(("CRTDLL: wcstod\n"));
|
|---|
| 5349 | return (wcstod(nptr, endptr));
|
|---|
| 5350 | }
|
|---|
| 5351 |
|
|---|
| 5352 |
|
|---|
| 5353 | /*********************************************************************
|
|---|
| 5354 | * wcsxfrm (CRTDLL.520)
|
|---|
| 5355 | */
|
|---|
| 5356 | size_t CDECL CRTDLL_wcsxfrm( wchar_t *s1, const wchar_t *s2, size_t n )
|
|---|
| 5357 | {
|
|---|
| 5358 | dprintf2(("CRTDLL: wcsxfrm\n"));
|
|---|
| 5359 | return (wcsxfrm(s1, s2, n));
|
|---|
| 5360 | }
|
|---|
| 5361 |
|
|---|
| 5362 |
|
|---|
| 5363 | /*********************************************************************
|
|---|
| 5364 | * wcstomb (CRTDLL.521)
|
|---|
| 5365 | */
|
|---|
| 5366 | int CDECL CRTDLL_wctomb( char *s, wchar_t wchar )
|
|---|
| 5367 | {
|
|---|
| 5368 | dprintf2(("CRTDLL: wctomb\n"));
|
|---|
| 5369 | return (wctomb(s,wchar));
|
|---|
| 5370 | }
|
|---|
| 5371 |
|
|---|
| 5372 |
|
|---|
| 5373 | /*********************************************************************
|
|---|
| 5374 | * wprintf (CRTDLL.522)
|
|---|
| 5375 | */
|
|---|
| 5376 | int CDECL CRTDLL_wprintf( const wchar_t *s, ... )
|
|---|
| 5377 | {
|
|---|
| 5378 | dprintf(("CRTDLL: wprintf not implemented.\n"));
|
|---|
| 5379 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 5380 | return FALSE;
|
|---|
| 5381 | }
|
|---|
| 5382 |
|
|---|
| 5383 |
|
|---|
| 5384 | /*********************************************************************
|
|---|
| 5385 | * wscanf (CRTDLL.523)
|
|---|
| 5386 | */
|
|---|
| 5387 | int CDECL CRTDLL_wscanf( const wchar_t *s, ... )
|
|---|
| 5388 | {
|
|---|
| 5389 | dprintf(("CRTDLL: wscanf not implemented.\n"));
|
|---|
| 5390 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 5391 | return FALSE;
|
|---|
| 5392 | }
|
|---|
| 5393 |
|
|---|
| 5394 |
|
|---|
| 5395 |
|
|---|
| 5396 | /*********************************************************************
|
|---|
| 5397 | * __set_errno (INTERNAL-#1)
|
|---|
| 5398 | */
|
|---|
| 5399 | int __set_errno (int error)
|
|---|
| 5400 | {
|
|---|
| 5401 | errno = error;
|
|---|
| 5402 | return error;
|
|---|
| 5403 | }
|
|---|
| 5404 |
|
|---|
| 5405 |
|
|---|
| 5406 | /*********************************************************************
|
|---|
| 5407 | * _mbbtoupper (INTERNAL-#2)
|
|---|
| 5408 | */
|
|---|
| 5409 | unsigned int _mbbtoupper(unsigned int c)
|
|---|
| 5410 | {
|
|---|
| 5411 | if (!CRTDLL__ismbblead(c) )
|
|---|
| 5412 | return toupper(c);
|
|---|
| 5413 |
|
|---|
| 5414 | return c;
|
|---|
| 5415 | }
|
|---|
| 5416 |
|
|---|
| 5417 |
|
|---|
| 5418 | /*********************************************************************
|
|---|
| 5419 | * _mbbtolower (INTERNAL-#3)
|
|---|
| 5420 | */
|
|---|
| 5421 | unsigned int _mbbtolower(unsigned int c)
|
|---|
| 5422 | {
|
|---|
| 5423 | if (!CRTDLL__ismbblead(c) )
|
|---|
| 5424 | return tolower(c);
|
|---|
| 5425 | return c;
|
|---|
| 5426 | }
|
|---|
| 5427 |
|
|---|
| 5428 |
|
|---|
| 5429 | /*********************************************************************
|
|---|
| 5430 | * _mbclen2 (INTERNAL-#4)
|
|---|
| 5431 | */
|
|---|
| 5432 | size_t _mbclen2(const unsigned int s)
|
|---|
| 5433 | {
|
|---|
| 5434 | return (CRTDLL__ismbblead(s>>8) && CRTDLL__ismbbtrail(s&0x00FF)) ? 2 : 1;
|
|---|
| 5435 | }
|
|---|
| 5436 |
|
|---|
| 5437 |
|
|---|
| 5438 | /*********************************************************************
|
|---|
| 5439 | * _isinf (INTERNAL-#5)
|
|---|
| 5440 | */
|
|---|
| 5441 | int _isinf(double __x)
|
|---|
| 5442 | {
|
|---|
| 5443 | double_t * x = (double_t *)&__x;
|
|---|
| 5444 | return ( x->exponent == 0x7ff && ( x->mantissah == 0 && x->mantissal == 0 ));
|
|---|
| 5445 | }
|
|---|
| 5446 |
|
|---|
| 5447 |
|
|---|
| 5448 | /*********************************************************************
|
|---|
| 5449 | * _filehnd (INTERNAL-#6)
|
|---|
| 5450 | */
|
|---|
| 5451 | void* filehnd(int fileno)
|
|---|
| 5452 | {
|
|---|
| 5453 | if ( fileno < 0 )
|
|---|
| 5454 | return (void *)-1;
|
|---|
| 5455 | #define STD_AUX_HANDLE 3
|
|---|
| 5456 | #define STD_PRINTER_HANDLE 4
|
|---|
| 5457 |
|
|---|
| 5458 | switch(fileno)
|
|---|
| 5459 | {
|
|---|
| 5460 | case 0:
|
|---|
| 5461 | return (void*)GetStdHandle(STD_INPUT_HANDLE);
|
|---|
| 5462 | case 1:
|
|---|
| 5463 | return (void*)GetStdHandle(STD_OUTPUT_HANDLE);
|
|---|
| 5464 | case 2:
|
|---|
| 5465 | return (void*)GetStdHandle(STD_ERROR_HANDLE);
|
|---|
| 5466 | case 3:
|
|---|
| 5467 | return (void*)GetStdHandle(STD_AUX_HANDLE);
|
|---|
| 5468 | case 4:
|
|---|
| 5469 | return (void*)GetStdHandle(STD_PRINTER_HANDLE);
|
|---|
| 5470 | default:
|
|---|
| 5471 | break;
|
|---|
| 5472 | }
|
|---|
| 5473 |
|
|---|
| 5474 | if ( fileno >= maxfno )
|
|---|
| 5475 | return (void *)-1;
|
|---|
| 5476 |
|
|---|
| 5477 | if ( fileno_modes[fileno].fd == -1 )
|
|---|
| 5478 | return (void *)-1;
|
|---|
| 5479 | return (void*)fileno_modes[fileno].hFile;
|
|---|
| 5480 | }
|
|---|