| 1 | /* $Id: crtdll.cpp,v 1.18 1999-12-21 13:46:24 sandervl Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | * The C RunTime DLL
|
|---|
| 5 | *
|
|---|
| 6 | * Implements C run-time functionality as known from UNIX.
|
|---|
| 7 | *
|
|---|
| 8 | * Partialy based on Wine and ReactOS
|
|---|
| 9 | *
|
|---|
| 10 | * Copyright 1996,1998 Marcus Meissner
|
|---|
| 11 | * Copyright 1996 Jukka Iivonen
|
|---|
| 12 | * Copyright 1997 Uwe Bonnes
|
|---|
| 13 | * Copyright 1999 Jens Wiessner
|
|---|
| 14 | */
|
|---|
| 15 |
|
|---|
| 16 | #include <os2win.h>
|
|---|
| 17 | #include <stdio.h>
|
|---|
| 18 | #include <stdlib.h>
|
|---|
| 19 | #include <string.h>
|
|---|
| 20 | #include <odinwrap.h>
|
|---|
| 21 | #include <misc.h>
|
|---|
| 22 | #include <unicode.h>
|
|---|
| 23 | #include <heapstring.h>
|
|---|
| 24 | #include <ctype.h>
|
|---|
| 25 | #include <setjmp.h>
|
|---|
| 26 | #include <ntddk.h>
|
|---|
| 27 | #include <debugtools.h>
|
|---|
| 28 |
|
|---|
| 29 | #include <wchar.h>
|
|---|
| 30 | #include <wctype.h>
|
|---|
| 31 | #include <math.h>
|
|---|
| 32 | #include <libc\locale.h>
|
|---|
| 33 | #include <signal.h>
|
|---|
| 34 | #include <io.h>
|
|---|
| 35 | #include <assert.h>
|
|---|
| 36 | #include <process.h>
|
|---|
| 37 | #include <float.h>
|
|---|
| 38 | #include <conio.h>
|
|---|
| 39 | #include <direct.h>
|
|---|
| 40 | #include <malloc.h>
|
|---|
| 41 | #include <drive.h>
|
|---|
| 42 | #include <fcntl.h>
|
|---|
| 43 | #include <search.h>
|
|---|
| 44 | #include <heap.h>
|
|---|
| 45 | #include <errno.h>
|
|---|
| 46 | #include <sys\utime.h>
|
|---|
| 47 | #include <sys\stat.h>
|
|---|
| 48 |
|
|---|
| 49 | #include <crtdll.h>
|
|---|
| 50 | #include "crtinc.h"
|
|---|
| 51 | #include "ieee.h"
|
|---|
| 52 |
|
|---|
| 53 | DEFAULT_DEBUG_CHANNEL(crtdll)
|
|---|
| 54 |
|
|---|
| 55 | //SvL: per process heap for CRTDLL
|
|---|
| 56 | HANDLE CRTDLL_hHeap = 0;
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 | /*********************************************************************
|
|---|
| 60 | * CRTDLL_MainInit (CRTDLL.init)
|
|---|
| 61 | */
|
|---|
| 62 | BOOL WINAPI CRTDLL_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|---|
| 63 | {
|
|---|
| 64 | if (fdwReason == DLL_PROCESS_ATTACH) {
|
|---|
| 65 | CRTDLL__fdopen(0,"r");
|
|---|
| 66 | CRTDLL__fdopen(1,"w");
|
|---|
| 67 | CRTDLL__fdopen(2,"w");
|
|---|
| 68 | CRTDLL_hHeap = HeapCreate(0, 0x10000, 0);
|
|---|
| 69 | }
|
|---|
| 70 | else
|
|---|
| 71 | if (fdwReason == DLL_PROCESS_DETACH) {
|
|---|
| 72 | HeapDestroy(CRTDLL_hHeap);
|
|---|
| 73 | CRTDLL_hHeap = 0;
|
|---|
| 74 | }
|
|---|
| 75 | return TRUE;
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 | /*********************************************************************
|
|---|
| 80 | * new (CRTDLL.001)
|
|---|
| 81 | */
|
|---|
| 82 | VOID* CDECL CRTDLL_new(DWORD size)
|
|---|
| 83 | {
|
|---|
| 84 | dprintf(("CRTDLL: ??2@YAPAXI@Z\n"));
|
|---|
| 85 | VOID* result;
|
|---|
| 86 | if(!(result = Heap_Alloc(size)) && new_handler)
|
|---|
| 87 | (*new_handler)();
|
|---|
| 88 | return result;
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 | /*********************************************************************
|
|---|
| 93 | * delete (CRTDLL.002)
|
|---|
| 94 | */
|
|---|
| 95 | VOID CDECL CRTDLL_delete(VOID* ptr)
|
|---|
| 96 | {
|
|---|
| 97 | dprintf(("CRTDLL: ??3@YAXPAX@Z\n"));
|
|---|
| 98 | Heap_Free(ptr);
|
|---|
| 99 | }
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 | /*********************************************************************
|
|---|
| 103 | * set_new_handler(CRTDLL.003)
|
|---|
| 104 | */
|
|---|
| 105 | new_handler_type CDECL CRTDLL_set_new_handler(new_handler_type func)
|
|---|
| 106 | {
|
|---|
| 107 | dprintf(("CRTDLL: ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z\n"));
|
|---|
| 108 | new_handler_type old_handler = new_handler;
|
|---|
| 109 | new_handler = func;
|
|---|
| 110 | return old_handler;
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|
| 113 |
|
|---|
| 114 | /*********************************************************************
|
|---|
| 115 | * _CIacos (CRTDLL.004)
|
|---|
| 116 | */
|
|---|
| 117 | double CDECL CRTDLL__CIacos( double x )
|
|---|
| 118 | {
|
|---|
| 119 | dprintf(("CRTDLL: _CIacos\n"));
|
|---|
| 120 | dprintf(("should be register function\n"));
|
|---|
| 121 | return acos(x);
|
|---|
| 122 | }
|
|---|
| 123 |
|
|---|
| 124 |
|
|---|
| 125 | /*********************************************************************
|
|---|
| 126 | * _CIasin (CRTDLL.005)
|
|---|
| 127 | */
|
|---|
| 128 | double CDECL CRTDLL__CIasin( double x )
|
|---|
| 129 | {
|
|---|
| 130 | dprintf(("CRTDLL: _CIasin\n"));
|
|---|
| 131 | dprintf(("should be register function\n"));
|
|---|
| 132 | return asin(x);
|
|---|
| 133 | }
|
|---|
| 134 |
|
|---|
| 135 |
|
|---|
| 136 | /*********************************************************************
|
|---|
| 137 | * _CIatan (CRTDLL.006)
|
|---|
| 138 | */
|
|---|
| 139 | double CDECL CRTDLL__CIatan( double x )
|
|---|
| 140 | {
|
|---|
| 141 | dprintf(("CRTDLL: _CIatan\n"));
|
|---|
| 142 | dprintf(("should be register function\n"));
|
|---|
| 143 | return atan(x);
|
|---|
| 144 | }
|
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 | /*********************************************************************
|
|---|
| 148 | * _CIatan2 (CRTDLL.007)
|
|---|
| 149 | */
|
|---|
| 150 | double CDECL CRTDLL__CIatan2( double x, double y )
|
|---|
| 151 | {
|
|---|
| 152 | dprintf(("CRTDLL: _CIatan2\n"));
|
|---|
| 153 | dprintf(("should be register function\n"));
|
|---|
| 154 | return atan2(x,y);
|
|---|
| 155 | }
|
|---|
| 156 |
|
|---|
| 157 |
|
|---|
| 158 | /*********************************************************************
|
|---|
| 159 | * _CIcos (CRTDLL.008)
|
|---|
| 160 | */
|
|---|
| 161 | double CDECL CRTDLL__CIcos( double x )
|
|---|
| 162 | {
|
|---|
| 163 | dprintf(("CRTDLL: _CIcos\n"));
|
|---|
| 164 | dprintf(("should be register function\n"));
|
|---|
| 165 | return cos(x);
|
|---|
| 166 | }
|
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 | /*********************************************************************
|
|---|
| 170 | * _CIcosh (CRTDLL.009)
|
|---|
| 171 | */
|
|---|
| 172 | double CDECL CRTDLL__CIcosh( double x )
|
|---|
| 173 | {
|
|---|
| 174 | dprintf(("CRTDLL: _CIcosh\n"));
|
|---|
| 175 | dprintf(("should be register function\n"));
|
|---|
| 176 | return cosh(x);
|
|---|
| 177 | }
|
|---|
| 178 |
|
|---|
| 179 |
|
|---|
| 180 | /*********************************************************************
|
|---|
| 181 | * _CIexp (CRTDLL.010)
|
|---|
| 182 | */
|
|---|
| 183 | double CDECL CRTDLL__CIexp( double x )
|
|---|
| 184 | {
|
|---|
| 185 | dprintf(("CRTDLL: _CIexp\n"));
|
|---|
| 186 | dprintf(("should be register function\n"));
|
|---|
| 187 | return exp(x);
|
|---|
| 188 | }
|
|---|
| 189 |
|
|---|
| 190 |
|
|---|
| 191 | /*********************************************************************
|
|---|
| 192 | * _CIfmod (CRTDLL.011)
|
|---|
| 193 | */
|
|---|
| 194 | double CDECL CRTDLL__CIfmod( double x, double y )
|
|---|
| 195 | {
|
|---|
| 196 | dprintf(("CRTDLL: _CIfmod\n"));
|
|---|
| 197 | dprintf(("should be register function\n"));
|
|---|
| 198 | return fmod(x,y);
|
|---|
| 199 | }
|
|---|
| 200 |
|
|---|
| 201 |
|
|---|
| 202 | /*********************************************************************
|
|---|
| 203 | * _CIlog (CRTDLL.012)
|
|---|
| 204 | */
|
|---|
| 205 | double CDECL CRTDLL__CIlog( double x )
|
|---|
| 206 | {
|
|---|
| 207 | dprintf(("CRTDLL: _CIlog\n"));
|
|---|
| 208 | dprintf(("should be register function\n"));
|
|---|
| 209 | return log(x);
|
|---|
| 210 | }
|
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 | /*********************************************************************
|
|---|
| 214 | * _CIlog10 (CRTDLL.013)
|
|---|
| 215 | */
|
|---|
| 216 | double CDECL CRTDLL__CIlog10( double x )
|
|---|
| 217 | {
|
|---|
| 218 | dprintf(("CRTDLL: _CIlog10\n"));
|
|---|
| 219 | dprintf(("should be register function\n"));
|
|---|
| 220 | return log10(x);
|
|---|
| 221 | }
|
|---|
| 222 |
|
|---|
| 223 |
|
|---|
| 224 | /*********************************************************************
|
|---|
| 225 | * _CIsin (CRTDLL.015)
|
|---|
| 226 | */
|
|---|
| 227 | double CDECL CRTDLL__CIsin( double x )
|
|---|
| 228 | {
|
|---|
| 229 | dprintf(("CRTDLL: _CIsin\n"));
|
|---|
| 230 | dprintf(("should be register function\n"));
|
|---|
| 231 | return sin(x);
|
|---|
| 232 | }
|
|---|
| 233 |
|
|---|
| 234 |
|
|---|
| 235 | /*********************************************************************
|
|---|
| 236 | * _CIsinh (CRTDLL.016)
|
|---|
| 237 | */
|
|---|
| 238 | double CDECL CRTDLL__CIsinh( double x )
|
|---|
| 239 | {
|
|---|
| 240 | dprintf(("CRTDLL: _CIsinh\n"));
|
|---|
| 241 | dprintf(("should be register function\n"));
|
|---|
| 242 | return sinh(x);
|
|---|
| 243 | }
|
|---|
| 244 |
|
|---|
| 245 |
|
|---|
| 246 | /*********************************************************************
|
|---|
| 247 | * _CIsqrt (CRTDLL.017)
|
|---|
| 248 | */
|
|---|
| 249 | double CDECL CRTDLL__CIsqrt( double x )
|
|---|
| 250 | {
|
|---|
| 251 | dprintf(("CRTDLL: _CIsqrt\n"));
|
|---|
| 252 | dprintf(("should be register function\n"));
|
|---|
| 253 | return acos(x);
|
|---|
| 254 | }
|
|---|
| 255 |
|
|---|
| 256 |
|
|---|
| 257 | /*********************************************************************
|
|---|
| 258 | * _CItan (CRTDLL.018)
|
|---|
| 259 | */
|
|---|
| 260 | double CDECL CRTDLL__CItan( double x )
|
|---|
| 261 | {
|
|---|
| 262 | dprintf(("CRTDLL: _CItan\n"));
|
|---|
| 263 | dprintf(("should be register function\n"));
|
|---|
| 264 | return tan(x);
|
|---|
| 265 | }
|
|---|
| 266 |
|
|---|
| 267 |
|
|---|
| 268 | /*********************************************************************
|
|---|
| 269 | * _CItanh (CRTDLL.019)
|
|---|
| 270 | */
|
|---|
| 271 | double CDECL CRTDLL__CItanh( double x )
|
|---|
| 272 | {
|
|---|
| 273 | dprintf(("CRTDLL: _CItanh\n"));
|
|---|
| 274 | dprintf(("should be register function\n"));
|
|---|
| 275 | return tanh(x);
|
|---|
| 276 | }
|
|---|
| 277 |
|
|---|
| 278 |
|
|---|
| 279 | /*********************************************************************
|
|---|
| 280 | * _XcptFilter (CRTDLL.21)
|
|---|
| 281 | */
|
|---|
| 282 | INT CDECL CRTDLL__XcptFilter(DWORD ret, struct _EXCEPTION_POINTERS * ExceptionInfo )
|
|---|
| 283 | {
|
|---|
| 284 | dprintf(("CRTDLL: _XcptFilter\n"));
|
|---|
| 285 | return UnhandledExceptionFilter(ExceptionInfo);
|
|---|
| 286 | }
|
|---|
| 287 |
|
|---|
| 288 |
|
|---|
| 289 | /*********************************************************************
|
|---|
| 290 | * _GetMainArgs (CRTDLL.22)
|
|---|
| 291 | */
|
|---|
| 292 | DWORD CDECL CRTDLL__GetMainArgs(LPDWORD argc,LPSTR **argv,
|
|---|
| 293 | LPSTR *environ,DWORD flag)
|
|---|
| 294 | {
|
|---|
| 295 | char *cmdline;
|
|---|
| 296 | char **xargv;
|
|---|
| 297 | int xargc,i,afterlastspace;
|
|---|
| 298 | DWORD version;
|
|---|
| 299 |
|
|---|
| 300 | dprintf(("CRTDLL: GetMainArgs\n"));
|
|---|
| 301 |
|
|---|
| 302 | CRTDLL_acmdln_dll = cmdline = HEAP_strdupA( GetProcessHeap(), 0,
|
|---|
| 303 | GetCommandLineA() );
|
|---|
| 304 |
|
|---|
| 305 | version = GetVersion();
|
|---|
| 306 | CRTDLL_osver_dll = version >> 16;
|
|---|
| 307 | CRTDLL_winminor_dll = version & 0xFF;
|
|---|
| 308 | CRTDLL_winmajor_dll = (version>>8) & 0xFF;
|
|---|
| 309 | CRTDLL_baseversion_dll = version >> 16;
|
|---|
| 310 | CRTDLL_winver_dll = ((version >> 8) & 0xFF) + ((version & 0xFF) << 8);
|
|---|
| 311 | CRTDLL_baseminor_dll = (version >> 16) & 0xFF;
|
|---|
| 312 | CRTDLL_basemajor_dll = (version >> 24) & 0xFF;
|
|---|
| 313 | CRTDLL_osversion_dll = version & 0xFFFF;
|
|---|
| 314 | CRTDLL_osminor_dll = version & 0xFF;
|
|---|
| 315 | CRTDLL_osmajor_dll = (version>>8) & 0xFF;
|
|---|
| 316 |
|
|---|
| 317 | /* missing threading init */
|
|---|
| 318 |
|
|---|
| 319 | i=0;xargv=NULL;xargc=0;afterlastspace=0;
|
|---|
| 320 | /*
|
|---|
| 321 | while (cmdline[i]) {
|
|---|
| 322 | if (cmdline[i]==' ') {
|
|---|
| 323 | xargv=(char**)HeapReAlloc( GetProcessHeap(), 0, xargv,
|
|---|
| 324 | sizeof(char*)*(++xargc));
|
|---|
| 325 | cmdline[i]='\0';
|
|---|
| 326 | xargv[xargc-1] = HEAP_strdupA( GetProcessHeap(), 0,
|
|---|
| 327 | cmdline+afterlastspace);
|
|---|
| 328 | i++;
|
|---|
| 329 | while (cmdline[i]==' ')
|
|---|
| 330 | i++;
|
|---|
| 331 | if (cmdline[i])
|
|---|
| 332 | afterlastspace=i;
|
|---|
| 333 |
|
|---|
| 334 | } else
|
|---|
| 335 | i++;
|
|---|
| 336 |
|
|---|
| 337 | }
|
|---|
| 338 |
|
|---|
| 339 | xargv=(char**)HeapReAlloc( GetProcessHeap(), 0, xargv,
|
|---|
| 340 | sizeof(char*)*(++xargc));
|
|---|
| 341 | cmdline[i]='\0';
|
|---|
| 342 | xargv[xargc-1] = HEAP_strdupA( GetProcessHeap(), 0,
|
|---|
| 343 | cmdline+afterlastspace);
|
|---|
| 344 | */
|
|---|
| 345 | CRTDLL_argc_dll = xargc;
|
|---|
| 346 | *argc = xargc;
|
|---|
| 347 | CRTDLL_argv_dll = xargv;
|
|---|
| 348 | *argv = xargv;
|
|---|
| 349 | CRTDLL_environ_dll = *environ = GetEnvironmentStringsA();
|
|---|
| 350 | dprintf(("CRTDLL: GetMainArgs end\n"));
|
|---|
| 351 | return 0;
|
|---|
| 352 | }
|
|---|
| 353 |
|
|---|
| 354 |
|
|---|
| 355 | /*********************************************************************
|
|---|
| 356 | * __dllonexit (CRTDLL.25)
|
|---|
| 357 | */
|
|---|
| 358 | VOID CDECL CRTDLL___dllonexit ()
|
|---|
| 359 | {
|
|---|
| 360 | dprintf(("__dllonexit not implemented.\n"));
|
|---|
| 361 | }
|
|---|
| 362 |
|
|---|
| 363 |
|
|---|
| 364 | /*********************************************************************
|
|---|
| 365 | * __doserrno (CRTDLL.26)
|
|---|
| 366 | */
|
|---|
| 367 | int * CDECL CRTDLL___doserrno()
|
|---|
| 368 | {
|
|---|
| 369 | dprintf(("__doserrno\n"));
|
|---|
| 370 | _doserrno = GetLastError();
|
|---|
| 371 | return &_doserrno;
|
|---|
| 372 | }
|
|---|
| 373 |
|
|---|
| 374 |
|
|---|
| 375 | /*********************************************************************
|
|---|
| 376 | * __fpecode (CRTDLL.27)
|
|---|
| 377 | */
|
|---|
| 378 | int fpecode = 0;
|
|---|
| 379 |
|
|---|
| 380 | int * CDECL CRTDLL___fpecode ( void )
|
|---|
| 381 | {
|
|---|
| 382 | dprintf(("__fpecode\n"));
|
|---|
| 383 | return &fpecode;
|
|---|
| 384 | }
|
|---|
| 385 |
|
|---|
| 386 |
|
|---|
| 387 | /*********************************************************************
|
|---|
| 388 | * CRTDLL___isascii (CRTDLL.28)
|
|---|
| 389 | */
|
|---|
| 390 | int CDECL CRTDLL___isascii(int i)
|
|---|
| 391 | {
|
|---|
| 392 | dprintf(("CRTDLL: __isascii\n"));
|
|---|
| 393 | return (!((i)&(~0x7f)));
|
|---|
| 394 | }
|
|---|
| 395 |
|
|---|
| 396 |
|
|---|
| 397 | /*********************************************************************
|
|---|
| 398 | * CRTDLL___iscsym (CRTDLL.29)
|
|---|
| 399 | */
|
|---|
| 400 | int CDECL CRTDLL___iscsym(int c)
|
|---|
| 401 | {
|
|---|
| 402 | dprintf(("CRTDLL: __iscsym\n"));
|
|---|
| 403 | return (CRTDLL_isalnum(c) || ( c == '_' )) ;
|
|---|
| 404 | }
|
|---|
| 405 |
|
|---|
| 406 |
|
|---|
| 407 | /*********************************************************************
|
|---|
| 408 | * CRTDLL___iscsymf (CRTDLL.30)
|
|---|
| 409 | */
|
|---|
| 410 | int CDECL CRTDLL___iscsymf(int c)
|
|---|
| 411 | {
|
|---|
| 412 | dprintf(("CRTDLL: __iscsymf\n"));
|
|---|
| 413 | return (isalpha(c) || ( c == '_' )) ;
|
|---|
| 414 | }
|
|---|
| 415 |
|
|---|
| 416 |
|
|---|
| 417 | /*********************************************************************
|
|---|
| 418 | * CRTDLL___pxcptinfoptrs (CRTDLL.32)
|
|---|
| 419 | */
|
|---|
| 420 | void ** CDECL CRTDLL___pxcptinfoptrs (void)
|
|---|
| 421 | {
|
|---|
| 422 | dprintf(("CRTDLL: __pxcptinfoptrs not implemented.\n"));
|
|---|
| 423 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 424 | return NULL;
|
|---|
| 425 | }
|
|---|
| 426 |
|
|---|
| 427 |
|
|---|
| 428 | /*********************************************************************
|
|---|
| 429 | * CRTDLL___threadhandle (CRTDLL.33)
|
|---|
| 430 | */
|
|---|
| 431 | unsigned long CDECL CRTDLL___threadhandle( void )
|
|---|
| 432 | {
|
|---|
| 433 | dprintf(("CRTDLL: __threadhandle\n"));
|
|---|
| 434 | return GetCurrentThread();
|
|---|
| 435 | }
|
|---|
| 436 |
|
|---|
| 437 |
|
|---|
| 438 | /*********************************************************************
|
|---|
| 439 | * CRTDLL___threadid (CRTDLL.34)
|
|---|
| 440 | */
|
|---|
| 441 | unsigned long CDECL CRTDLL___threadid(void)
|
|---|
| 442 | {
|
|---|
| 443 | dprintf(("CRTDLL: __threadid\n"));
|
|---|
| 444 | return GetCurrentThreadId();
|
|---|
| 445 | }
|
|---|
| 446 |
|
|---|
| 447 |
|
|---|
| 448 | /*********************************************************************
|
|---|
| 449 | * CRTDLL__abnormal_termination (CRTDLL.36)
|
|---|
| 450 | */
|
|---|
| 451 | int CDECL CRTDLL__abnormal_termination(void)
|
|---|
| 452 | {
|
|---|
| 453 | dprintf(("CRTDLL: _abnormal_termination not implemented.\n"));
|
|---|
| 454 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 455 | return FALSE;
|
|---|
| 456 | }
|
|---|
| 457 |
|
|---|
| 458 |
|
|---|
| 459 | /*********************************************************************
|
|---|
| 460 | * CRTDLL__access (CRTDLL.37)
|
|---|
| 461 | */
|
|---|
| 462 | int CDECL CRTDLL__access(const char *path,int mode)
|
|---|
| 463 | {
|
|---|
| 464 | dprintf(("CRTDLL: _access\n"));
|
|---|
| 465 | return (_access(path, mode));
|
|---|
| 466 | }
|
|---|
| 467 |
|
|---|
| 468 |
|
|---|
| 469 | /*********************************************************************
|
|---|
| 470 | * CRTDLL___toascii (CRTDLL.38)
|
|---|
| 471 | */
|
|---|
| 472 | int CDECL CRTDLL___toascii(int c)
|
|---|
| 473 | {
|
|---|
| 474 | dprintf(("CRTDLL: __toascii\n"));
|
|---|
| 475 | return ((unsigned)(c) & 0x7F );
|
|---|
| 476 | }
|
|---|
| 477 |
|
|---|
| 478 |
|
|---|
| 479 | /*********************************************************************
|
|---|
| 480 | * _aexit_rtn_dll (CRTDLL.39)
|
|---|
| 481 | */
|
|---|
| 482 | VOID CDECL CRTDLL__aexit_rtn_dll(int exitcode)
|
|---|
| 483 | {
|
|---|
| 484 | dprintf(("CRTDLL: _aexit_rtn_dll\n"));
|
|---|
| 485 | ExitProcess(exitcode);
|
|---|
| 486 | }
|
|---|
| 487 |
|
|---|
| 488 |
|
|---|
| 489 | /*********************************************************************
|
|---|
| 490 | * _amsg_exit (CRTDLL.40)
|
|---|
| 491 | */
|
|---|
| 492 | VOID CDECL CRTDLL__amsg_exit(int errnum)
|
|---|
| 493 | {
|
|---|
| 494 | dprintf(("CRTDLL: _amsg_exit\n"));
|
|---|
| 495 | fprintf(stderr,strerror(errnum));
|
|---|
| 496 | ExitProcess(-1);
|
|---|
| 497 | }
|
|---|
| 498 |
|
|---|
| 499 |
|
|---|
| 500 | /*********************************************************************
|
|---|
| 501 | * CRTDLL__assert (CRTDLL.41)
|
|---|
| 502 | */
|
|---|
| 503 | void CDECL CRTDLL__assert( char *s1, char *s2, int i)
|
|---|
| 504 | {
|
|---|
| 505 | dprintf(("CRTDLL: _assert\n"));
|
|---|
| 506 | _assert(s1, s2, i);
|
|---|
| 507 | }
|
|---|
| 508 |
|
|---|
| 509 |
|
|---|
| 510 | /*********************************************************************
|
|---|
| 511 | * CRTDLL__beep (CRTDLL.45)
|
|---|
| 512 | */
|
|---|
| 513 | void CDECL CRTDLL__beep(unsigned nFreq, unsigned nDur)
|
|---|
| 514 | {
|
|---|
| 515 | dprintf(("_beep\n"));
|
|---|
| 516 | Beep(nFreq,nDur);
|
|---|
| 517 | }
|
|---|
| 518 |
|
|---|
| 519 |
|
|---|
| 520 | /*********************************************************************
|
|---|
| 521 | * CRTDLL__beginthread (CRTDLL.46)
|
|---|
| 522 | */
|
|---|
| 523 | unsigned long CDECL CRTDLL__beginthread(void (*pfuncStart)(void *),
|
|---|
| 524 | unsigned unStackSize, void* pArgList)
|
|---|
| 525 | {
|
|---|
| 526 | DWORD ThreadId;
|
|---|
| 527 | HANDLE hThread;
|
|---|
| 528 | if ( pfuncStart == NULL )
|
|---|
| 529 | __set_errno(EINVAL);
|
|---|
| 530 |
|
|---|
| 531 | hThread = CreateThread( NULL,unStackSize,(LPTHREAD_START_ROUTINE)pfuncStart,pArgList,0, &ThreadId);
|
|---|
| 532 | if (hThread == NULL ) {
|
|---|
| 533 | __set_errno(EAGAIN);
|
|---|
| 534 | return -1;
|
|---|
| 535 | }
|
|---|
| 536 | return (unsigned long)hThread;
|
|---|
| 537 | }
|
|---|
| 538 |
|
|---|
| 539 |
|
|---|
| 540 | /*********************************************************************
|
|---|
| 541 | * _c_exit (CRTDLL.47)
|
|---|
| 542 | *
|
|---|
| 543 | */
|
|---|
| 544 | void CDECL CRTDLL__c_exit(INT ret)
|
|---|
| 545 | {
|
|---|
| 546 | dprintf(("_c_exit(%d)\n",ret));
|
|---|
| 547 | ExitProcess(ret);
|
|---|
| 548 | }
|
|---|
| 549 |
|
|---|
| 550 |
|
|---|
| 551 | /*********************************************************************
|
|---|
| 552 | * CRTDLL__cabs (CRTDLL.48)
|
|---|
| 553 | */
|
|---|
| 554 | double CDECL CRTDLL__cabs(struct _complex z)
|
|---|
| 555 | {
|
|---|
| 556 | dprintf(("CRTDLL: _cabs\n"));
|
|---|
| 557 | return sqrt( z.x*z.x + z.y*z.y );
|
|---|
| 558 | }
|
|---|
| 559 |
|
|---|
| 560 |
|
|---|
| 561 | /*********************************************************************
|
|---|
| 562 | * _cexit (CRTDLL.49)
|
|---|
| 563 | */
|
|---|
| 564 | void CDECL CRTDLL__cexit(INT ret)
|
|---|
| 565 | {
|
|---|
| 566 | dprintf(("_cexit(%d)\n",ret));
|
|---|
| 567 | ExitProcess(ret);
|
|---|
| 568 | }
|
|---|
| 569 |
|
|---|
| 570 |
|
|---|
| 571 | /*********************************************************************
|
|---|
| 572 | * CRTDLL__cgets (CRTDLL.50)
|
|---|
| 573 | */
|
|---|
| 574 | char * CDECL CRTDLL__cgets( char *s )
|
|---|
| 575 | {
|
|---|
| 576 | dprintf(("CRTDLL: _cgets\n"));
|
|---|
| 577 | return (_cgets(s));
|
|---|
| 578 | }
|
|---|
| 579 |
|
|---|
| 580 |
|
|---|
| 581 | /*********************************************************************
|
|---|
| 582 | * _chdir (CRTDLL.51)
|
|---|
| 583 | */
|
|---|
| 584 | INT CDECL CRTDLL__chdir(LPCSTR newdir)
|
|---|
| 585 | {
|
|---|
| 586 | dprintf(("CRTDLL: chdir\n"));
|
|---|
| 587 | if (!SetCurrentDirectoryA(newdir))
|
|---|
| 588 | return 1;
|
|---|
| 589 | return 0;
|
|---|
| 590 | }
|
|---|
| 591 |
|
|---|
| 592 |
|
|---|
| 593 | /*********************************************************************
|
|---|
| 594 | * _chdrive (CRTDLL.52)
|
|---|
| 595 | *
|
|---|
| 596 | * newdir [I] drive to change to, A=1
|
|---|
| 597 | *
|
|---|
| 598 | */
|
|---|
| 599 | BOOL CDECL CRTDLL__chdrive(INT newdrive)
|
|---|
| 600 | {
|
|---|
| 601 | /* FIXME: generates errnos */
|
|---|
| 602 | dprintf(("CRTDLL: _chdrive\n"));
|
|---|
| 603 | return DRIVE_SetCurrentDrive(newdrive-1);
|
|---|
| 604 | }
|
|---|
| 605 |
|
|---|
| 606 |
|
|---|
| 607 | /*********************************************************************
|
|---|
| 608 | * CRTDLL__chgsign (CRTDLL.53)
|
|---|
| 609 | */
|
|---|
| 610 | double CDECL CRTDLL__chgsign(double __x)
|
|---|
| 611 | {
|
|---|
| 612 | dprintf(("CRTDLL: _chgsign\n"));
|
|---|
| 613 | double_t *x = (double_t *)&x;
|
|---|
| 614 | if ( x->sign == 1 )
|
|---|
| 615 | x->sign = 0;
|
|---|
| 616 | else
|
|---|
| 617 | x->sign = 1;
|
|---|
| 618 |
|
|---|
| 619 | return __x;
|
|---|
| 620 | }
|
|---|
| 621 |
|
|---|
| 622 |
|
|---|
| 623 | /*********************************************************************
|
|---|
| 624 | * CRTDLL__chmod (CRTDLL.54)
|
|---|
| 625 | */
|
|---|
| 626 | int CDECL CRTDLL__chmod( const char *s, int i)
|
|---|
| 627 | {
|
|---|
| 628 | dprintf(("CRTDLL: _chmod\n"));
|
|---|
| 629 | return (_chmod(s, i));
|
|---|
| 630 | }
|
|---|
| 631 |
|
|---|
| 632 |
|
|---|
| 633 | /*********************************************************************
|
|---|
| 634 | * CRTDLL__chsize (CRTDLL.55)
|
|---|
| 635 | */
|
|---|
| 636 | int CDECL CRTDLL__chsize( int i, long l )
|
|---|
| 637 | {
|
|---|
| 638 | dprintf(("CRTDLL: _chsize\n"));
|
|---|
| 639 | return (_chsize(i, l));
|
|---|
| 640 | }
|
|---|
| 641 |
|
|---|
| 642 |
|
|---|
| 643 | /*********************************************************************
|
|---|
| 644 | * CRTDLL__clearfp (CRTDLL.56)
|
|---|
| 645 | */
|
|---|
| 646 | unsigned int CDECL CRTDLL__clearfp( void )
|
|---|
| 647 | {
|
|---|
| 648 | dprintf(("CRTDLL: _clearfp\n"));
|
|---|
| 649 | return (_clear87());
|
|---|
| 650 | }
|
|---|
| 651 |
|
|---|
| 652 |
|
|---|
| 653 | /*********************************************************************
|
|---|
| 654 | * CRTDLL__close (CRTDLL.57)
|
|---|
| 655 | */
|
|---|
| 656 | int CDECL CRTDLL__close(int handle)
|
|---|
| 657 | {
|
|---|
| 658 | dprintf(("CRTDLL: _close\n"));
|
|---|
| 659 | return (_close(handle));
|
|---|
| 660 | }
|
|---|
| 661 |
|
|---|
| 662 |
|
|---|
| 663 | /*********************************************************************
|
|---|
| 664 | * CRTDLL__commit (CRTDLL.58)
|
|---|
| 665 | */
|
|---|
| 666 | int CDECL CRTDLL__commit( int _fd )
|
|---|
| 667 | {
|
|---|
| 668 | dprintf(("CRTDLL: _commit\n"));
|
|---|
| 669 | if (! FlushFileBuffers((HFILE)CRTDLL__get_osfhandle(_fd)) ) {
|
|---|
| 670 | __set_errno(EBADF);
|
|---|
| 671 | return -1;
|
|---|
| 672 | }
|
|---|
| 673 | return 0;
|
|---|
| 674 | }
|
|---|
| 675 |
|
|---|
| 676 |
|
|---|
| 677 | /*********************************************************************
|
|---|
| 678 | * CRTDLL__control87 (CRTDLL.60)
|
|---|
| 679 | */
|
|---|
| 680 | unsigned CDECL CRTDLL__control87(unsigned i1,unsigned i2)
|
|---|
| 681 | {
|
|---|
| 682 | dprintf(("CRTDLL: _control87\n"));
|
|---|
| 683 | return (_control87(i1, i2));
|
|---|
| 684 | }
|
|---|
| 685 |
|
|---|
| 686 |
|
|---|
| 687 | /*********************************************************************
|
|---|
| 688 | * CRTDLL__controlfp (CRTDLL.61)
|
|---|
| 689 | */
|
|---|
| 690 | unsigned CDECL CRTDLL__controlfp(unsigned i1,unsigned i2)
|
|---|
| 691 | {
|
|---|
| 692 | dprintf(("CRTDLL: _controlfp\n"));
|
|---|
| 693 | return (_control87(i1, i2));
|
|---|
| 694 | }
|
|---|
| 695 |
|
|---|
| 696 |
|
|---|
| 697 | /*********************************************************************
|
|---|
| 698 | * CRTDLL__copysign (CRTDLL.62)
|
|---|
| 699 | */
|
|---|
| 700 | double CDECL CRTDLL__copysign( double __d, double __s )
|
|---|
| 701 | {
|
|---|
| 702 | dprintf(("CRTDLL: _copysign\n"));
|
|---|
| 703 | double_t *d = (double_t *)&__d;
|
|---|
| 704 | double_t *s = (double_t *)&__s;
|
|---|
| 705 |
|
|---|
| 706 | d->sign = s->sign;
|
|---|
| 707 |
|
|---|
| 708 | return __d;
|
|---|
| 709 | }
|
|---|
| 710 |
|
|---|
| 711 |
|
|---|
| 712 | /*********************************************************************
|
|---|
| 713 | * _cprintf (CRTDLL.63)
|
|---|
| 714 | */
|
|---|
| 715 | INT CDECL CRTDLL__cprintf( char *fmt, ... )
|
|---|
| 716 | {
|
|---|
| 717 | dprintf(("CRTDLL: _cprintf.\n"));
|
|---|
| 718 |
|
|---|
| 719 | int cnt;
|
|---|
| 720 | char buf[ 2048 ]; /* this is buggy, because buffer might be too small. */
|
|---|
| 721 | va_list ap;
|
|---|
| 722 |
|
|---|
| 723 | va_start(ap, fmt);
|
|---|
| 724 | cnt = vsprintf(buf, fmt, ap);
|
|---|
| 725 | va_end(ap);
|
|---|
| 726 |
|
|---|
| 727 | _cputs(buf);
|
|---|
| 728 | return cnt;
|
|---|
| 729 | }
|
|---|
| 730 |
|
|---|
| 731 |
|
|---|
| 732 | /*********************************************************************
|
|---|
| 733 | * CRTDLL__cputs (CRTDLL.65)
|
|---|
| 734 | */
|
|---|
| 735 | INT CDECL CRTDLL__cputs( char * s )
|
|---|
| 736 | {
|
|---|
| 737 | dprintf(("CRTDLL: _cputs\n"));
|
|---|
| 738 | return (_cputs(s));
|
|---|
| 739 | }
|
|---|
| 740 |
|
|---|
| 741 |
|
|---|
| 742 | /*********************************************************************
|
|---|
| 743 | * CRTDLL__creat (CRTDLL.66)
|
|---|
| 744 | */
|
|---|
| 745 | INT CDECL CRTDLL__creat( const char *s, int i )
|
|---|
| 746 | {
|
|---|
| 747 | dprintf(("CRTDLL: _creat\n"));
|
|---|
| 748 | return (_creat(s, i));
|
|---|
| 749 | }
|
|---|
| 750 |
|
|---|
| 751 |
|
|---|
| 752 | /*********************************************************************
|
|---|
| 753 | * CRTDLL__cscanf (CRTDLL.67)
|
|---|
| 754 | */
|
|---|
| 755 | INT CDECL CRTDLL__cscanf( char *s, ... )
|
|---|
| 756 | {
|
|---|
| 757 | dprintf(("CRTDLL: _cscanf not implemented.\n"));
|
|---|
| 758 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 759 | return FALSE;
|
|---|
| 760 | }
|
|---|
| 761 |
|
|---|
| 762 |
|
|---|
| 763 | /*********************************************************************
|
|---|
| 764 | * CRTDLL__cwait (CRTDLL.69)
|
|---|
| 765 | */
|
|---|
| 766 | int CDECL CRTDLL__cwait( int *status, int process_id, int action_code )
|
|---|
| 767 | {
|
|---|
| 768 | dprintf(("CRTDLL: _cwait\n"));
|
|---|
| 769 | return (_cwait(status, process_id, action_code));
|
|---|
| 770 | }
|
|---|
| 771 |
|
|---|
| 772 |
|
|---|
| 773 | /*********************************************************************
|
|---|
| 774 | * CRTDLL__dup (CRTDLL.71)
|
|---|
| 775 | */
|
|---|
| 776 | int CDECL CRTDLL__dup(int handle)
|
|---|
| 777 | {
|
|---|
| 778 | dprintf(("CRTDLL: _dup\n"));
|
|---|
| 779 | return (_dup(handle));
|
|---|
| 780 | }
|
|---|
| 781 |
|
|---|
| 782 |
|
|---|
| 783 | /*********************************************************************
|
|---|
| 784 | * CRTDLL__dup2 (CRTDLL.72)
|
|---|
| 785 | */
|
|---|
| 786 | int CDECL CRTDLL__dup2(int handle1,int handle2)
|
|---|
| 787 | {
|
|---|
| 788 | dprintf(("CRTDLL: _dup2\n"));
|
|---|
| 789 | return (_dup2(handle1, handle2));
|
|---|
| 790 | }
|
|---|
| 791 |
|
|---|
| 792 |
|
|---|
| 793 | /*********************************************************************
|
|---|
| 794 | * CRTDLL__ecvt (CRTDLL.73)
|
|---|
| 795 | */
|
|---|
| 796 | char * CDECL CRTDLL__ecvt( double val, int ndig, int *dec, int *sign )
|
|---|
| 797 | {
|
|---|
| 798 | dprintf(("CRTDLL: _ecvt\n"));
|
|---|
| 799 | return (_ecvt(val, ndig, dec, sign));
|
|---|
| 800 | }
|
|---|
| 801 |
|
|---|
| 802 |
|
|---|
| 803 | /*********************************************************************
|
|---|
| 804 | * CRTDLL__endthread (CRTDLL.74)
|
|---|
| 805 | */
|
|---|
| 806 | void CDECL CRTDLL__endthread(void)
|
|---|
| 807 | {
|
|---|
| 808 | dprintf(("CRTDLL: _endthread\n"));
|
|---|
| 809 | _endthread ();
|
|---|
| 810 | }
|
|---|
| 811 |
|
|---|
| 812 |
|
|---|
| 813 | /*********************************************************************
|
|---|
| 814 | * CRTDLL___eof (CRTDLL.76)
|
|---|
| 815 | */
|
|---|
| 816 | int CDECL CRTDLL__eof( int _fd )
|
|---|
| 817 | {
|
|---|
| 818 | dprintf(("CRTDLL: _eof\n"));
|
|---|
| 819 | int cur_pos = CRTDLL__lseek(_fd, 0, SEEK_CUR);
|
|---|
| 820 | int end_pos = CRTDLL__filelength( _fd );
|
|---|
| 821 | if ( cur_pos == -1 || end_pos == -1)
|
|---|
| 822 | return -1;
|
|---|
| 823 |
|
|---|
| 824 | if ( cur_pos == end_pos )
|
|---|
| 825 | return 1;
|
|---|
| 826 |
|
|---|
| 827 | return 0;
|
|---|
| 828 | }
|
|---|
| 829 |
|
|---|
| 830 |
|
|---|
| 831 | /*********************************************************************
|
|---|
| 832 | * CRTDLL__errno (CRTDLL.77)
|
|---|
| 833 | */
|
|---|
| 834 | int * CDECL CRTDLL__errno(void)
|
|---|
| 835 | {
|
|---|
| 836 | dprintf(("CRTDLL: _errno\n"));
|
|---|
| 837 | return (_errno());
|
|---|
| 838 | }
|
|---|
| 839 |
|
|---|
| 840 |
|
|---|
| 841 | /*********************************************************************
|
|---|
| 842 | * _except_handler2 (CRTDLL.78)
|
|---|
| 843 | */
|
|---|
| 844 | INT CDECL CRTDLL__except_handler2 ( PEXCEPTION_RECORD rec,
|
|---|
| 845 | PEXCEPTION_FRAME frame, PCONTEXT context,
|
|---|
| 846 | PEXCEPTION_FRAME *dispatcher)
|
|---|
| 847 | {
|
|---|
| 848 | dprintf(("CRTDLL: _except_handler2\n"));
|
|---|
| 849 | return 1;
|
|---|
| 850 | }
|
|---|
| 851 |
|
|---|
| 852 |
|
|---|
| 853 | /*********************************************************************
|
|---|
| 854 | * _execl (CRTDLL.79)
|
|---|
| 855 | */
|
|---|
| 856 | int CDECL CRTDLL__execl(const char* szPath, const char* szArgv0, ...)
|
|---|
| 857 | {
|
|---|
| 858 | dprintf(("CRTDLL: _execl\n"));
|
|---|
| 859 |
|
|---|
| 860 | char *szArg[100];
|
|---|
| 861 | const char *a;
|
|---|
| 862 | int i = 0;
|
|---|
| 863 | va_list l = 0;
|
|---|
| 864 | va_start(l,szArgv0);
|
|---|
| 865 | do {
|
|---|
| 866 | a = va_arg(l,const char *);
|
|---|
| 867 | szArg[i++] = (char *)a;
|
|---|
| 868 | } while ( a != NULL && i < 100 );
|
|---|
| 869 |
|
|---|
| 870 | return _spawnve(P_OVERLAY, (char*)szPath, szArg, _environ);
|
|---|
| 871 | }
|
|---|
| 872 |
|
|---|
| 873 |
|
|---|
| 874 | /*********************************************************************
|
|---|
| 875 | * CRTDLL__execle (CRTDLL.80)
|
|---|
| 876 | */
|
|---|
| 877 | int CDECL CRTDLL__execle(char *path, char *szArgv0, ...)
|
|---|
| 878 | {
|
|---|
| 879 | dprintf(("CRTDLL: _execle not correct implemented.\n"));
|
|---|
| 880 | char *szArg[100];
|
|---|
| 881 | const char *a;
|
|---|
| 882 | char *ptr;
|
|---|
| 883 | int i = 0;
|
|---|
| 884 | va_list l = 0;
|
|---|
| 885 | va_start(l,szArgv0);
|
|---|
| 886 | do {
|
|---|
| 887 | a = (const char *)va_arg(l,const char *);
|
|---|
| 888 | szArg[i++] = (char *)a;
|
|---|
| 889 | } while ( a != NULL && i < 100 );
|
|---|
| 890 |
|
|---|
| 891 |
|
|---|
| 892 | // szArg0 is passed and not environment if there is only one parameter;
|
|---|
| 893 |
|
|---|
| 894 | if ( i >=2 ) {
|
|---|
| 895 | ptr = szArg[i-2];
|
|---|
| 896 | szArg[i-2] = NULL;
|
|---|
| 897 | }
|
|---|
| 898 | else
|
|---|
| 899 | ptr = NULL;
|
|---|
| 900 |
|
|---|
| 901 | return _spawnve(P_OVERLAY, path, szArg, (char**)ptr);
|
|---|
| 902 | }
|
|---|
| 903 |
|
|---|
| 904 |
|
|---|
| 905 | /*********************************************************************
|
|---|
| 906 | * CRTDLL__execlp (CRTDLL.81)
|
|---|
| 907 | */
|
|---|
| 908 | int CDECL CRTDLL__execlp( char *szPath, char *szArgv0, ...)
|
|---|
| 909 | {
|
|---|
| 910 | dprintf(("CRTDLL: _execlp\n"));
|
|---|
| 911 | char *szArg[100];
|
|---|
| 912 | const char *a;
|
|---|
| 913 | int i = 0;
|
|---|
| 914 | va_list l = 0;
|
|---|
| 915 | va_start(l,szArgv0);
|
|---|
| 916 | do {
|
|---|
| 917 | a = (const char *)va_arg(l,const char *);
|
|---|
| 918 | szArg[i++] = (char *)a;
|
|---|
| 919 | } while ( a != NULL && i < 100 );
|
|---|
| 920 | return _spawnvpe(P_OVERLAY, szPath,szArg, _environ);
|
|---|
| 921 | }
|
|---|
| 922 |
|
|---|
| 923 |
|
|---|
| 924 | /*********************************************************************
|
|---|
| 925 | * CRTDLL__execlpe (CRTDLL.82)
|
|---|
| 926 | */
|
|---|
| 927 | int CDECL CRTDLL__execlpe( char *path, char *szArgv0, ...)
|
|---|
| 928 | {
|
|---|
| 929 | dprintf(("CRTDLL: _execlpe not correct implemented.\n"));
|
|---|
| 930 | char *szArg[100];
|
|---|
| 931 | const char *a;
|
|---|
| 932 | char *ptr;
|
|---|
| 933 | int i = 0;
|
|---|
| 934 | va_list l = 0;
|
|---|
| 935 | va_start(l,szArgv0);
|
|---|
| 936 | do {
|
|---|
| 937 | a = (const char *)va_arg(l,const char *);
|
|---|
| 938 | szArg[i++] = (char *)a;
|
|---|
| 939 | } while ( a != NULL && i < 100 );
|
|---|
| 940 |
|
|---|
| 941 |
|
|---|
| 942 | // szArg0 is passed and not environment if there is only one parameter;
|
|---|
| 943 |
|
|---|
| 944 | if ( i >=2 ) {
|
|---|
| 945 | ptr = szArg[i-2];
|
|---|
| 946 | szArg[i-2] = NULL;
|
|---|
| 947 | }
|
|---|
| 948 | else
|
|---|
| 949 | ptr = NULL;
|
|---|
| 950 | return spawnvpe(P_OVERLAY, path, szArg, (char**)ptr);
|
|---|
| 951 | }
|
|---|
| 952 |
|
|---|
| 953 |
|
|---|
| 954 | /*********************************************************************
|
|---|
| 955 | * CRTDLL__execv (CRTDLL.83)
|
|---|
| 956 | */
|
|---|
| 957 | int CDECL CRTDLL__execv( char *s1, char **s2)
|
|---|
| 958 | {
|
|---|
| 959 | dprintf(("CRTDLL: _execv\n"));
|
|---|
| 960 | return (_execv(s1, s2));
|
|---|
| 961 | }
|
|---|
| 962 |
|
|---|
| 963 |
|
|---|
| 964 | /*********************************************************************
|
|---|
| 965 | * CRTDLL__execve (CRTDLL.84)
|
|---|
| 966 | */
|
|---|
| 967 | int CDECL CRTDLL__execve( char *s1, char **s2, char **s3)
|
|---|
| 968 | {
|
|---|
| 969 | dprintf(("CRTDLL: _execve\n"));
|
|---|
| 970 | return (_execve(s1, s2, s3));
|
|---|
| 971 | }
|
|---|
| 972 |
|
|---|
| 973 |
|
|---|
| 974 | /*********************************************************************
|
|---|
| 975 | * CRTDLL__execvp (CRTDLL.85)
|
|---|
| 976 | */
|
|---|
| 977 | int CDECL CRTDLL__execvp( char *s1, char **s2)
|
|---|
| 978 | {
|
|---|
| 979 | dprintf(("CRTDLL: _execvp\n"));
|
|---|
| 980 | return (_execvp(s1, s2));
|
|---|
| 981 | }
|
|---|
| 982 |
|
|---|
| 983 |
|
|---|
| 984 | /*********************************************************************
|
|---|
| 985 | * CRTDLL__execvpe (CRTDLL.86)
|
|---|
| 986 | */
|
|---|
| 987 | int CDECL CRTDLL__execvpe( char *s1, char **s2, char **s3)
|
|---|
| 988 | {
|
|---|
| 989 | dprintf(("CRTDLL: _execvpe\n"));
|
|---|
| 990 | return (_execvpe(s1, s2, s3));
|
|---|
| 991 | }
|
|---|
| 992 |
|
|---|
| 993 |
|
|---|
| 994 | /*********************************************************************
|
|---|
| 995 | * _exit (CRTDLL.87)
|
|---|
| 996 | */
|
|---|
| 997 | VOID CDECL CRTDLL__exit(DWORD ret)
|
|---|
| 998 | {
|
|---|
| 999 | dprintf(("CRTDLL: _exit\n"));
|
|---|
| 1000 | ExitProcess(ret);
|
|---|
| 1001 | }
|
|---|
| 1002 |
|
|---|
| 1003 |
|
|---|
| 1004 | /*********************************************************************
|
|---|
| 1005 | * _expand (CRTDLL.88)
|
|---|
| 1006 | */
|
|---|
| 1007 | void * CDECL CRTDLL__expand( void *ptr, size_t size )
|
|---|
| 1008 | {
|
|---|
| 1009 | dprintf(("CRTDLL: _expand not implemented.\n"));
|
|---|
| 1010 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1011 | return FALSE;
|
|---|
| 1012 | }
|
|---|
| 1013 |
|
|---|
| 1014 |
|
|---|
| 1015 | /*********************************************************************
|
|---|
| 1016 | * _fcloseall (CRTDLL.89)
|
|---|
| 1017 | */
|
|---|
| 1018 | int CDECL CRTDLL__fcloseall( void )
|
|---|
| 1019 | {
|
|---|
| 1020 | dprintf(("CRTDLL: _fcloseall\n"));
|
|---|
| 1021 | return (_fcloseall());
|
|---|
| 1022 | }
|
|---|
| 1023 |
|
|---|
| 1024 |
|
|---|
| 1025 | /*********************************************************************
|
|---|
| 1026 | * _fcvt (CRTDLL.90)
|
|---|
| 1027 | */
|
|---|
| 1028 | char * CDECL CRTDLL__fcvt( double val, int ndig, int *dec, int *sign )
|
|---|
| 1029 | {
|
|---|
| 1030 | dprintf(("CRTDLL: _fcvt\n"));
|
|---|
| 1031 | return (_fcvt(val, ndig, dec, sign));
|
|---|
| 1032 | }
|
|---|
| 1033 |
|
|---|
| 1034 |
|
|---|
| 1035 | /*********************************************************************
|
|---|
| 1036 | * _fdopen (CRTDLL.91)
|
|---|
| 1037 | */
|
|---|
| 1038 | CRTDLL_FILE * CDECL CRTDLL__fdopen(INT handle, LPCSTR mode)
|
|---|
| 1039 | {
|
|---|
| 1040 | dprintf(("CRTDLL: fdopen\n"));
|
|---|
| 1041 | CRTDLL_FILE *file;
|
|---|
| 1042 |
|
|---|
| 1043 | switch (handle)
|
|---|
| 1044 | {
|
|---|
| 1045 | case 0:
|
|---|
| 1046 | file = CRTDLL_stdin;
|
|---|
| 1047 | if (!file->handle) file->handle = GetStdHandle( STD_INPUT_HANDLE );
|
|---|
| 1048 | break;
|
|---|
| 1049 | case 1:
|
|---|
| 1050 | file = CRTDLL_stdout;
|
|---|
| 1051 | if (!file->handle) file->handle = GetStdHandle( STD_OUTPUT_HANDLE );
|
|---|
| 1052 | break;
|
|---|
| 1053 | case 2:
|
|---|
| 1054 | file=CRTDLL_stderr;
|
|---|
| 1055 | if (!file->handle) file->handle = GetStdHandle( STD_ERROR_HANDLE );
|
|---|
| 1056 | break;
|
|---|
| 1057 | default:
|
|---|
| 1058 | file = (PCRTDLL_FILE)Heap_Alloc(sizeof(*file) );
|
|---|
| 1059 | file->handle = handle;
|
|---|
| 1060 | break;
|
|---|
| 1061 | }
|
|---|
| 1062 | return file;
|
|---|
| 1063 | }
|
|---|
| 1064 |
|
|---|
| 1065 |
|
|---|
| 1066 | /*********************************************************************
|
|---|
| 1067 | * _fgetchar (CRTDLL.92)
|
|---|
| 1068 | */
|
|---|
| 1069 | int CDECL CRTDLL__fgetchar( void )
|
|---|
| 1070 | {
|
|---|
| 1071 | dprintf(("CRTDLL: _fgetchar\n"));
|
|---|
| 1072 | return (_fgetchar());
|
|---|
| 1073 | }
|
|---|
| 1074 |
|
|---|
| 1075 |
|
|---|
| 1076 | /*********************************************************************
|
|---|
| 1077 | * _fgetwchar (CRTDLL.93)
|
|---|
| 1078 | */
|
|---|
| 1079 | wint_t CDECL CRTDLL__fgetwchar( void *i )
|
|---|
| 1080 | {
|
|---|
| 1081 | dprintf(("CRTDLL: _fgetwchar\n"));
|
|---|
| 1082 | return CRTDLL__getch();
|
|---|
| 1083 | }
|
|---|
| 1084 |
|
|---|
| 1085 |
|
|---|
| 1086 | /*********************************************************************
|
|---|
| 1087 | * _filbuf (CRTDLL.94)
|
|---|
| 1088 | */
|
|---|
| 1089 | int CDECL CRTDLL__filbuf(FILE * f)
|
|---|
| 1090 | {
|
|---|
| 1091 | dprintf(("CRTDLL: _filbuf not implemented.\n"));
|
|---|
| 1092 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1093 | return FALSE;
|
|---|
| 1094 | }
|
|---|
| 1095 |
|
|---|
| 1096 |
|
|---|
| 1097 | /*********************************************************************
|
|---|
| 1098 | * CRTDLL__filelength (CRTDLL.96)
|
|---|
| 1099 | */
|
|---|
| 1100 | long CDECL CRTDLL__filelength( int i )
|
|---|
| 1101 | {
|
|---|
| 1102 | dprintf(("CRTDLL: _filelength\n"));
|
|---|
| 1103 | return (_filelength(i));
|
|---|
| 1104 | }
|
|---|
| 1105 |
|
|---|
| 1106 |
|
|---|
| 1107 | /*********************************************************************
|
|---|
| 1108 | * _fileno (CRTDLL.97)
|
|---|
| 1109 | */
|
|---|
| 1110 | int CDECL CRTDLL__fileno(FILE * f)
|
|---|
| 1111 | {
|
|---|
| 1112 | dprintf(("CRTDLL: _fileno\n"));
|
|---|
| 1113 | return (_fileno(f));
|
|---|
| 1114 | }
|
|---|
| 1115 |
|
|---|
| 1116 |
|
|---|
| 1117 | /*********************************************************************
|
|---|
| 1118 | * _findclose (CRTDLL.098)
|
|---|
| 1119 | */
|
|---|
| 1120 | int CDECL CRTDLL__findclose( long handle )
|
|---|
| 1121 | {
|
|---|
| 1122 | dprintf(("CRTDLL: _findclose\n"));
|
|---|
| 1123 | // check no wildcards or invalid handle
|
|---|
| 1124 | if ( handle == 0 || handle == -1)
|
|---|
| 1125 | return 0;
|
|---|
| 1126 | return FindClose(handle);
|
|---|
| 1127 | }
|
|---|
| 1128 |
|
|---|
| 1129 |
|
|---|
| 1130 | /*********************************************************************
|
|---|
| 1131 | * _findfirst (CRTDLL.099)
|
|---|
| 1132 | */
|
|---|
| 1133 | DWORD CDECL CRTDLL__findfirst(LPCSTR fname, struct find_t * x2)
|
|---|
| 1134 | {
|
|---|
| 1135 | dprintf(("CRTDLL: _findfirst not implemented.\n"));
|
|---|
| 1136 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1137 | return FALSE;
|
|---|
| 1138 | }
|
|---|
| 1139 |
|
|---|
| 1140 |
|
|---|
| 1141 | /*********************************************************************
|
|---|
| 1142 | * _findnext (CRTDLL.100)
|
|---|
| 1143 | */
|
|---|
| 1144 | INT CDECL CRTDLL__findnext(DWORD hand, struct find_t * x2)
|
|---|
| 1145 | {
|
|---|
| 1146 | dprintf(("CRTDLL: _findnext not implemented.\n"));
|
|---|
| 1147 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1148 | return FALSE;
|
|---|
| 1149 | }
|
|---|
| 1150 |
|
|---|
| 1151 |
|
|---|
| 1152 | /*********************************************************************
|
|---|
| 1153 | * _finite (CRTDLL.101)
|
|---|
| 1154 | */
|
|---|
| 1155 | INT CDECL CRTDLL__finite(double x)
|
|---|
| 1156 | {
|
|---|
| 1157 | dprintf(("CRTDLL: _finite\n"));
|
|---|
| 1158 | return !_isinf(x);
|
|---|
| 1159 | }
|
|---|
| 1160 |
|
|---|
| 1161 |
|
|---|
| 1162 | /*********************************************************************
|
|---|
| 1163 | * _flsbuf (CRTDLL.102)
|
|---|
| 1164 | */
|
|---|
| 1165 | INT CDECL CRTDLL__flsbuf(int i, FILE * f)
|
|---|
| 1166 | {
|
|---|
| 1167 | dprintf(("CRTDLL: _flsbuf not implemented.\n"));
|
|---|
| 1168 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1169 | return FALSE;
|
|---|
| 1170 | }
|
|---|
| 1171 |
|
|---|
| 1172 |
|
|---|
| 1173 | /*********************************************************************
|
|---|
| 1174 | * _flushall (CRTDLL.103)
|
|---|
| 1175 | */
|
|---|
| 1176 | INT CDECL CRTDLL__flushall(void)
|
|---|
| 1177 | {
|
|---|
| 1178 | dprintf(("CRTDLL: _flushall\n"));
|
|---|
| 1179 | return (_flushall());
|
|---|
| 1180 | }
|
|---|
| 1181 |
|
|---|
| 1182 |
|
|---|
| 1183 | /*********************************************************************
|
|---|
| 1184 | * _fpclass (CRTDLL.105)
|
|---|
| 1185 | */
|
|---|
| 1186 | INT CDECL CRTDLL__fpclass( double __d )
|
|---|
| 1187 | {
|
|---|
| 1188 | dprintf(("CRTDLL: _fpclass\n"));
|
|---|
| 1189 | double_t *d = (double_t *)&__d;
|
|---|
| 1190 |
|
|---|
| 1191 | if ( d->exponent == 0 ) {
|
|---|
| 1192 | if ( d->mantissah == 0 && d->mantissal == 0 ) {
|
|---|
| 1193 | if ( d->sign ==0 )
|
|---|
| 1194 | return FP_NZERO;
|
|---|
| 1195 | else
|
|---|
| 1196 | return FP_PZERO;
|
|---|
| 1197 | } else {
|
|---|
| 1198 | if ( d->sign ==0 )
|
|---|
| 1199 | return FP_NDENORM;
|
|---|
| 1200 | else
|
|---|
| 1201 | return FP_PDENORM;
|
|---|
| 1202 | }
|
|---|
| 1203 | }
|
|---|
| 1204 | if (d->exponent == 0x7ff ) {
|
|---|
| 1205 | if ( d->mantissah == 0 && d->mantissal == 0 ) {
|
|---|
| 1206 | if ( d->sign ==0 )
|
|---|
| 1207 | return FP_NINF;
|
|---|
| 1208 | else
|
|---|
| 1209 | return FP_PINF;
|
|---|
| 1210 | }
|
|---|
| 1211 | else if ( d->mantissah == 0 && d->mantissal != 0 ) {
|
|---|
| 1212 | return FP_QNAN;
|
|---|
| 1213 | }
|
|---|
| 1214 | else if ( d->mantissah == 0 && d->mantissal != 0 ) {
|
|---|
| 1215 | return FP_SNAN;
|
|---|
| 1216 | }
|
|---|
| 1217 |
|
|---|
| 1218 | }
|
|---|
| 1219 |
|
|---|
| 1220 | return 0;
|
|---|
| 1221 | }
|
|---|
| 1222 |
|
|---|
| 1223 |
|
|---|
| 1224 | /*********************************************************************
|
|---|
| 1225 | * _fpieee_flt (CRTDLL.106)
|
|---|
| 1226 | */
|
|---|
| 1227 | INT CDECL CRTDLL__fpieee_flt( unsigned long exc_code, struct _EXCEPTION_POINTERS *exc_info, int handler)
|
|---|
| 1228 | {
|
|---|
| 1229 | dprintf(("CRTDLL: _fpieee_flt not implemented.\n"));
|
|---|
| 1230 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1231 | return 0;
|
|---|
| 1232 | }
|
|---|
| 1233 |
|
|---|
| 1234 |
|
|---|
| 1235 |
|
|---|
| 1236 | /*********************************************************************
|
|---|
| 1237 | * _fpreset (CRTDLL.107)
|
|---|
| 1238 | */
|
|---|
| 1239 | void CDECL CRTDLL__fpreset(void)
|
|---|
| 1240 | {
|
|---|
| 1241 | dprintf(("CRTDLL: _fpreset not implemented.\n"));
|
|---|
| 1242 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1243 | }
|
|---|
| 1244 |
|
|---|
| 1245 |
|
|---|
| 1246 | /*********************************************************************
|
|---|
| 1247 | * _fputchar (CRTDLL.108)
|
|---|
| 1248 | */
|
|---|
| 1249 | INT CDECL CRTDLL__fputchar( int c )
|
|---|
| 1250 | {
|
|---|
| 1251 | dprintf(("CRTDLL: _fputchar\n"));
|
|---|
| 1252 | return(_fputchar(c));
|
|---|
| 1253 | }
|
|---|
| 1254 |
|
|---|
| 1255 |
|
|---|
| 1256 | /*********************************************************************
|
|---|
| 1257 | * _fputwchar (CRTDLL.109)
|
|---|
| 1258 | */
|
|---|
| 1259 | wint_t CDECL CRTDLL__fputwchar( wint_t )
|
|---|
| 1260 | {
|
|---|
| 1261 | dprintf(("CRTDLL: _fputwchar not implemented.\n"));
|
|---|
| 1262 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1263 | return FALSE;
|
|---|
| 1264 | }
|
|---|
| 1265 |
|
|---|
| 1266 |
|
|---|
| 1267 | /*********************************************************************
|
|---|
| 1268 | * _fsopen (CRTDLL.110)
|
|---|
| 1269 | */
|
|---|
| 1270 | FILE * CDECL CRTDLL__fsopen( const char *file, const char *mode, int shflag )
|
|---|
| 1271 | {
|
|---|
| 1272 | dprintf(("CRTDLL: _fsopen not implemented.\n"));
|
|---|
| 1273 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1274 | return FALSE;
|
|---|
| 1275 | }
|
|---|
| 1276 |
|
|---|
| 1277 |
|
|---|
| 1278 | /*********************************************************************
|
|---|
| 1279 | * _fstat (CRTDLL.111)
|
|---|
| 1280 | */
|
|---|
| 1281 | int CDECL CRTDLL__fstat(int file, struct stat* buf)
|
|---|
| 1282 | {
|
|---|
| 1283 | dprintf(("CRTDLL: _fstat not implemented.\n"));
|
|---|
| 1284 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1285 | return FALSE;
|
|---|
| 1286 | }
|
|---|
| 1287 |
|
|---|
| 1288 |
|
|---|
| 1289 | /*********************************************************************
|
|---|
| 1290 | * _ftime (CRTDLL.112)
|
|---|
| 1291 | */
|
|---|
| 1292 | int CDECL CRTDLL__ftime( struct timeb *timebuf )
|
|---|
| 1293 | {
|
|---|
| 1294 | dprintf(("CRTDLL: _ftime not implemented.\n"));
|
|---|
| 1295 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1296 | return FALSE;
|
|---|
| 1297 | }
|
|---|
| 1298 |
|
|---|
| 1299 |
|
|---|
| 1300 | /*********************************************************************
|
|---|
| 1301 | * _fullpath (CRTDLL.114)
|
|---|
| 1302 | */
|
|---|
| 1303 | char * CDECL CRTDLL__fullpath( char *buf, char *path, size_t size )
|
|---|
| 1304 | {
|
|---|
| 1305 | dprintf(("CRTDLL: _fullpath\n"));
|
|---|
| 1306 | return (_fullpath(buf, path, size));
|
|---|
| 1307 | }
|
|---|
| 1308 |
|
|---|
| 1309 |
|
|---|
| 1310 | /*********************************************************************
|
|---|
| 1311 | * _futime (CRTDLL.115)
|
|---|
| 1312 | */
|
|---|
| 1313 | int CDECL CRTDLL__futime( int handle, struct _utimbuf *filetime )
|
|---|
| 1314 | {
|
|---|
| 1315 | dprintf(("CRTDLL: _futime not implemented.\n"));
|
|---|
| 1316 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1317 | return FALSE;
|
|---|
| 1318 | }
|
|---|
| 1319 |
|
|---|
| 1320 |
|
|---|
| 1321 | /*********************************************************************
|
|---|
| 1322 | * _gcvt (CRTDLL.116)
|
|---|
| 1323 | */
|
|---|
| 1324 | char * CDECL CRTDLL__gcvt( double val, int ndig, char *buf )
|
|---|
| 1325 | {
|
|---|
| 1326 | dprintf(("CRTDLL: _gcvt\n"));
|
|---|
| 1327 | return (_gcvt(val, ndig, buf));
|
|---|
| 1328 | }
|
|---|
| 1329 |
|
|---|
| 1330 |
|
|---|
| 1331 | /*********************************************************************
|
|---|
| 1332 | * _get_osfhandle (CRTDLL.117)
|
|---|
| 1333 | */
|
|---|
| 1334 | void* CDECL CRTDLL__get_osfhandle( int fileno )
|
|---|
| 1335 | {
|
|---|
| 1336 | dprintf(("CRTDLL: _get_osfhandle\n"));
|
|---|
| 1337 | return filehnd(fileno);
|
|---|
| 1338 | }
|
|---|
| 1339 |
|
|---|
| 1340 |
|
|---|
| 1341 | /*********************************************************************
|
|---|
| 1342 | * _getch (CRTDLL.118)
|
|---|
| 1343 | */
|
|---|
| 1344 | int CDECL CRTDLL__getch(void)
|
|---|
| 1345 | {
|
|---|
| 1346 | dprintf(("CRTDLL: _getch\n"));
|
|---|
| 1347 | return (_getch());
|
|---|
| 1348 | }
|
|---|
| 1349 |
|
|---|
| 1350 |
|
|---|
| 1351 | /*********************************************************************
|
|---|
| 1352 | * _getche (CRTDLL.119)
|
|---|
| 1353 | */
|
|---|
| 1354 | int CDECL CRTDLL__getche(void)
|
|---|
| 1355 | {
|
|---|
| 1356 | dprintf(("CRTDLL: _getche\n"));
|
|---|
| 1357 | return (_getche());
|
|---|
| 1358 | }
|
|---|
| 1359 |
|
|---|
| 1360 |
|
|---|
| 1361 | /*********************************************************************
|
|---|
| 1362 | * _getcwd (CRTDLL.120)
|
|---|
| 1363 | */
|
|---|
| 1364 | char * CDECL CRTDLL__getcwd( char *buf, size_t size )
|
|---|
| 1365 | {
|
|---|
| 1366 | dprintf(("CRTDLL: _getcwd\n"));
|
|---|
| 1367 | return (_getcwd(buf, size));
|
|---|
| 1368 | }
|
|---|
| 1369 |
|
|---|
| 1370 |
|
|---|
| 1371 | /*********************************************************************
|
|---|
| 1372 | * _getdcwd (CRTDLL.121)
|
|---|
| 1373 | */
|
|---|
| 1374 | char * CDECL CRTDLL__getdcwd( int drive, char *buffer, size_t maxlen )
|
|---|
| 1375 | {
|
|---|
| 1376 | dprintf(("CRTDLL: _getdcwd\n"));
|
|---|
| 1377 | return (_getdcwd(drive, buffer, maxlen));
|
|---|
| 1378 | }
|
|---|
| 1379 |
|
|---|
| 1380 |
|
|---|
| 1381 | /*********************************************************************
|
|---|
| 1382 | * _getdiskfree (CRTDLL.122)
|
|---|
| 1383 | */
|
|---|
| 1384 | unsigned int CDECL CRTDLL__getdiskfree( unsigned int drive, struct _diskfree_t *diskspace)
|
|---|
| 1385 | {
|
|---|
| 1386 | dprintf(("CRTDLL: _getdiskfree\n"));
|
|---|
| 1387 | char RootPathName[10];
|
|---|
| 1388 | RootPathName[0] = toupper(drive +'@');
|
|---|
| 1389 | RootPathName[1] = ':';
|
|---|
| 1390 | RootPathName[2] = '\\';
|
|---|
| 1391 | RootPathName[3] = 0;
|
|---|
| 1392 | if ( diskspace == NULL )
|
|---|
| 1393 | return 0;
|
|---|
| 1394 |
|
|---|
| 1395 | if ( !GetDiskFreeSpaceA(RootPathName,(LPDWORD)&diskspace->sectors_per_cluster,(LPDWORD)&diskspace->bytes_per_sector,
|
|---|
| 1396 | (LPDWORD )&diskspace->avail_clusters,(LPDWORD )&diskspace->total_clusters ) )
|
|---|
| 1397 | return 0;
|
|---|
| 1398 | return diskspace->avail_clusters;
|
|---|
| 1399 | }
|
|---|
| 1400 |
|
|---|
| 1401 |
|
|---|
| 1402 | /*********************************************************************
|
|---|
| 1403 | * _getdllprocaddr (CRTDLL.123)
|
|---|
| 1404 | */
|
|---|
| 1405 | FARPROC CDECL CRTDLL__getdllprocaddr(HMODULE hModule,char * lpProcName, int iOrdinal)
|
|---|
| 1406 | {
|
|---|
| 1407 | dprintf(("CRTDLL: _getdllprocaddr\n"));
|
|---|
| 1408 | if ( lpProcName != NULL )
|
|---|
| 1409 | return GetProcAddress(hModule, lpProcName);
|
|---|
| 1410 | else
|
|---|
| 1411 | return GetProcAddress(hModule, (LPSTR)iOrdinal);
|
|---|
| 1412 | return (NULL);
|
|---|
| 1413 | }
|
|---|
| 1414 |
|
|---|
| 1415 |
|
|---|
| 1416 | /*********************************************************************
|
|---|
| 1417 | * _getdrive (CRTDLL.124)
|
|---|
| 1418 | */
|
|---|
| 1419 | unsigned CDECL CRTDLL__getdrive( void )
|
|---|
| 1420 | {
|
|---|
| 1421 | dprintf(("CRTDLL: _getdrive\n"));
|
|---|
| 1422 | return DRIVE_GetCurrentDrive() + 1;
|
|---|
| 1423 | }
|
|---|
| 1424 |
|
|---|
| 1425 |
|
|---|
| 1426 | /*********************************************************************
|
|---|
| 1427 | * _getdrives (CRTDLL.125)
|
|---|
| 1428 | */
|
|---|
| 1429 | unsigned long CDECL CRTDLL__getdrives(void)
|
|---|
| 1430 | {
|
|---|
| 1431 | dprintf(("CRTDLL: _getdrives\n"));
|
|---|
| 1432 | return GetLogicalDrives();
|
|---|
| 1433 | }
|
|---|
| 1434 |
|
|---|
| 1435 |
|
|---|
| 1436 | /*********************************************************************
|
|---|
| 1437 | * _getpid (CRTDLL.126)
|
|---|
| 1438 | */
|
|---|
| 1439 | int CDECL CRTDLL__getpid( void )
|
|---|
| 1440 | {
|
|---|
| 1441 | dprintf(("CRTDLL: _getpid\n"));
|
|---|
| 1442 | return (_getpid());
|
|---|
| 1443 | }
|
|---|
| 1444 |
|
|---|
| 1445 |
|
|---|
| 1446 | /*********************************************************************
|
|---|
| 1447 | * _getsystime (CRTDLL.127)
|
|---|
| 1448 | */
|
|---|
| 1449 | unsigned int CDECL CRTDLL__getsystime(struct tm *tp)
|
|---|
| 1450 | {
|
|---|
| 1451 | dprintf(("CRTDLL: _getsystime not implemented.\n"));
|
|---|
| 1452 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1453 | return FALSE;
|
|---|
| 1454 | }
|
|---|
| 1455 |
|
|---|
| 1456 |
|
|---|
| 1457 | /*********************************************************************
|
|---|
| 1458 | * _getw (CRTDLL.128)
|
|---|
| 1459 | */
|
|---|
| 1460 | int CDECL CRTDLL__getw( FILE *stream )
|
|---|
| 1461 | {
|
|---|
| 1462 | dprintf(("CRTDLL: _getw\n"));
|
|---|
| 1463 | int w;
|
|---|
| 1464 |
|
|---|
| 1465 | /* Is there a better way? */
|
|---|
| 1466 | if (CRTDLL_fread( &w, sizeof(w), 1, stream) != 1)
|
|---|
| 1467 | return(EOF);
|
|---|
| 1468 | return(w);
|
|---|
| 1469 | }
|
|---|
| 1470 |
|
|---|
| 1471 |
|
|---|
| 1472 | /*******************************************************************
|
|---|
| 1473 | * _global_unwind2 (CRTDLL.129)
|
|---|
| 1474 | */
|
|---|
| 1475 | void CDECL CRTDLL__global_unwind2( PEXCEPTION_FRAME frame )
|
|---|
| 1476 | {
|
|---|
| 1477 | dprintf(("CRTDLL: global_undwind2\n"));
|
|---|
| 1478 | RtlUnwind( frame, 0, NULL, 0 );
|
|---|
| 1479 | }
|
|---|
| 1480 |
|
|---|
| 1481 |
|
|---|
| 1482 | /*********************************************************************
|
|---|
| 1483 | * _heapchk (CRTDLL.130)
|
|---|
| 1484 | */
|
|---|
| 1485 | int CDECL CRTDLL__heapchk( void )
|
|---|
| 1486 | {
|
|---|
| 1487 | dprintf(("CRTDLL: _heapchk\n"));
|
|---|
| 1488 | return (_heapchk());
|
|---|
| 1489 | }
|
|---|
| 1490 |
|
|---|
| 1491 |
|
|---|
| 1492 | /*********************************************************************
|
|---|
| 1493 | * _heapmin (CRTDLL.131)
|
|---|
| 1494 | */
|
|---|
| 1495 | int CDECL CRTDLL__heapmin( void )
|
|---|
| 1496 | {
|
|---|
| 1497 | dprintf(("CRTDLL: _heapmin\n"));
|
|---|
| 1498 | return (_heapmin());
|
|---|
| 1499 | }
|
|---|
| 1500 |
|
|---|
| 1501 |
|
|---|
| 1502 | /*********************************************************************
|
|---|
| 1503 | * _heapset (CRTDLL.132)
|
|---|
| 1504 | */
|
|---|
| 1505 | int CDECL CRTDLL__heapset( unsigned int fill )
|
|---|
| 1506 | {
|
|---|
| 1507 | dprintf(("CRTDLL: _heapset\n"));
|
|---|
| 1508 | return (_heapset(fill));
|
|---|
| 1509 | }
|
|---|
| 1510 |
|
|---|
| 1511 |
|
|---|
| 1512 | /*********************************************************************
|
|---|
| 1513 | * _heapwalk (CRTDLL.133)
|
|---|
| 1514 | */
|
|---|
| 1515 | int CDECL CRTDLL__heapwalk( struct _heapinfo *entry )
|
|---|
| 1516 | {
|
|---|
| 1517 | dprintf(("CRTDLL: _heapwalk not implemented.\n"));
|
|---|
| 1518 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1519 | return 0;
|
|---|
| 1520 | }
|
|---|
| 1521 |
|
|---|
| 1522 |
|
|---|
| 1523 | /*********************************************************************
|
|---|
| 1524 | * _hypot (CRTDLL.134)
|
|---|
| 1525 | */
|
|---|
| 1526 | double CDECL CRTDLL__hypot(double x1, double x2)
|
|---|
| 1527 | {
|
|---|
| 1528 | dprintf(("CRTDLL: _hypot\n"));
|
|---|
| 1529 | return (_hypot(x1, x2));
|
|---|
| 1530 | }
|
|---|
| 1531 |
|
|---|
| 1532 |
|
|---|
| 1533 | /*********************************************************************
|
|---|
| 1534 | * _initterm (CRTDLL.135)
|
|---|
| 1535 | */
|
|---|
| 1536 | DWORD CDECL CRTDLL__initterm(_INITTERMFUN *start,_INITTERMFUN *end)
|
|---|
| 1537 | {
|
|---|
| 1538 | dprintf(("CRTDLL: initterm\n"));
|
|---|
| 1539 | _INITTERMFUN *current;
|
|---|
| 1540 |
|
|---|
| 1541 | current=start;
|
|---|
| 1542 | while (current<end) {
|
|---|
| 1543 | if (*current) (*current)();
|
|---|
| 1544 | current++;
|
|---|
| 1545 | }
|
|---|
| 1546 | return 0;
|
|---|
| 1547 | }
|
|---|
| 1548 |
|
|---|
| 1549 |
|
|---|
| 1550 | /*********************************************************************
|
|---|
| 1551 | * _isatty (CRTDLL.137)
|
|---|
| 1552 | */
|
|---|
| 1553 | BOOL CDECL CRTDLL__isatty(DWORD x)
|
|---|
| 1554 | {
|
|---|
| 1555 | dprintf(("(%ld)\n",x));
|
|---|
| 1556 | return TRUE;
|
|---|
| 1557 | }
|
|---|
| 1558 |
|
|---|
| 1559 |
|
|---|
| 1560 | /*********************************************************************
|
|---|
| 1561 | * _isctype (CRTDLL.138)
|
|---|
| 1562 | */
|
|---|
| 1563 | BOOL CDECL CRTDLL__isctype(CHAR x,CHAR type)
|
|---|
| 1564 | {
|
|---|
| 1565 | dprintf(("CRTDLL: isctype\n"));
|
|---|
| 1566 | if ((type & CRTDLL_SPACE) && isspace(x))
|
|---|
| 1567 | return TRUE;
|
|---|
| 1568 | if ((type & CRTDLL_PUNCT) && ispunct(x))
|
|---|
| 1569 | return TRUE;
|
|---|
| 1570 | if ((type & CRTDLL_LOWER) && islower(x))
|
|---|
| 1571 | return TRUE;
|
|---|
| 1572 | if ((type & CRTDLL_UPPER) && isupper(x))
|
|---|
| 1573 | return TRUE;
|
|---|
| 1574 | if ((type & CRTDLL_ALPHA) && isalpha(x))
|
|---|
| 1575 | return TRUE;
|
|---|
| 1576 | if ((type & CRTDLL_DIGIT) && isdigit(x))
|
|---|
| 1577 | return TRUE;
|
|---|
| 1578 | if ((type & CRTDLL_CONTROL) && iscntrl(x))
|
|---|
| 1579 | return TRUE;
|
|---|
| 1580 | /* check CRTDLL_LEADBYTE */
|
|---|
| 1581 | return FALSE;
|
|---|
| 1582 | }
|
|---|
| 1583 |
|
|---|
| 1584 |
|
|---|
| 1585 | /*********************************************************************
|
|---|
| 1586 | * _ismbbalnum (CRTDLL.139)
|
|---|
| 1587 | */
|
|---|
| 1588 | int CDECL CRTDLL__ismbbalnum( unsigned int c )
|
|---|
| 1589 | {
|
|---|
| 1590 | dprintf(("CRTDLL: _ismbbalnum\n"));
|
|---|
| 1591 | return (CRTDLL_isalnum(c) || CRTDLL__ismbbkalnum(c));
|
|---|
| 1592 | }
|
|---|
| 1593 |
|
|---|
| 1594 |
|
|---|
| 1595 | /*********************************************************************
|
|---|
| 1596 | * _ismbbalpha (CRTDLL.140)
|
|---|
| 1597 | */
|
|---|
| 1598 | int CDECL CRTDLL__ismbbalpha( unsigned int c )
|
|---|
| 1599 | {
|
|---|
| 1600 | dprintf(("CRTDLL: _ismbbalpha\n"));
|
|---|
| 1601 | return (isalpha(c) || CRTDLL__ismbbkalnum(c));
|
|---|
| 1602 | }
|
|---|
| 1603 |
|
|---|
| 1604 |
|
|---|
| 1605 | /*********************************************************************
|
|---|
| 1606 | * _ismbbgraph (CRTDLL.141)
|
|---|
| 1607 | */
|
|---|
| 1608 | int CDECL CRTDLL__ismbbgraph( unsigned int c )
|
|---|
| 1609 | {
|
|---|
| 1610 | dprintf(("CRTDLL: _ismbbgraph\n"));
|
|---|
| 1611 | return (CRTDLL_isgraph(c) || CRTDLL__ismbbkana(c));
|
|---|
| 1612 | }
|
|---|
| 1613 |
|
|---|
| 1614 |
|
|---|
| 1615 | /*********************************************************************
|
|---|
| 1616 | * _ismbbkalnum (CRTDLL.142)
|
|---|
| 1617 | */
|
|---|
| 1618 | int CDECL CRTDLL__ismbbkalnum( unsigned int c )
|
|---|
| 1619 | {
|
|---|
| 1620 | dprintf(("CRTDLL: _ismbbkalnum\n"));
|
|---|
| 1621 | return ((_jctype+1)[(unsigned char)(c)] & (_KNJ_P));
|
|---|
| 1622 | }
|
|---|
| 1623 |
|
|---|
| 1624 |
|
|---|
| 1625 | /*********************************************************************
|
|---|
| 1626 | * _ismbbkana (CRTDLL.143)
|
|---|
| 1627 | */
|
|---|
| 1628 | int CDECL CRTDLL__ismbbkana( unsigned int c )
|
|---|
| 1629 | {
|
|---|
| 1630 | dprintf(("CRTDLL: _ismbbkana\n"));
|
|---|
| 1631 | return ((_jctype+1)[(unsigned char)(c)] & (_KNJ_M|_KNJ_P));
|
|---|
| 1632 | }
|
|---|
| 1633 |
|
|---|
| 1634 |
|
|---|
| 1635 | /*********************************************************************
|
|---|
| 1636 | * _ismbbkpunct (CRTDLL.144)
|
|---|
| 1637 | */
|
|---|
| 1638 | int CDECL CRTDLL__ismbbkpunct( unsigned int c )
|
|---|
| 1639 | {
|
|---|
| 1640 | dprintf(("CRTDLL: _ismbbkpunct\n"));
|
|---|
| 1641 | return ((_jctype+1)[(unsigned char)(c)] & (_KNJ_P));
|
|---|
| 1642 | }
|
|---|
| 1643 |
|
|---|
| 1644 |
|
|---|
| 1645 | /*********************************************************************
|
|---|
| 1646 | * _ismbblead (CRTDLL.145)
|
|---|
| 1647 | */
|
|---|
| 1648 | int CDECL CRTDLL__ismbblead( unsigned int c )
|
|---|
| 1649 | {
|
|---|
| 1650 | dprintf(("CRTDLL: _ismbblead\n"));
|
|---|
| 1651 | return ((_jctype+1)[(unsigned char)(c)] & _KNJ_1);
|
|---|
| 1652 | }
|
|---|
| 1653 |
|
|---|
| 1654 |
|
|---|
| 1655 | /*********************************************************************
|
|---|
| 1656 | * _ismbbprint (CRTDLL.146)
|
|---|
| 1657 | */
|
|---|
| 1658 | int CDECL CRTDLL__ismbbprint( unsigned int c )
|
|---|
| 1659 | {
|
|---|
| 1660 | dprintf(("CRTDLL: _ismbbprint\n"));
|
|---|
| 1661 | return (isprint(c) || CRTDLL__ismbbkana(c));
|
|---|
| 1662 | }
|
|---|
| 1663 |
|
|---|
| 1664 |
|
|---|
| 1665 | /*********************************************************************
|
|---|
| 1666 | * _ismbbpunct (CRTDLL.147)
|
|---|
| 1667 | */
|
|---|
| 1668 | int CDECL CRTDLL__ismbbpunct( unsigned int c )
|
|---|
| 1669 | {
|
|---|
| 1670 | dprintf(("CRTDLL: _ismbbpunct\n"));
|
|---|
| 1671 | return (ispunct(c) || CRTDLL__ismbbkana(c));
|
|---|
| 1672 | }
|
|---|
| 1673 |
|
|---|
| 1674 |
|
|---|
| 1675 | /*********************************************************************
|
|---|
| 1676 | * _ismbbtrail (CRTDLL.148)
|
|---|
| 1677 | */
|
|---|
| 1678 | int CDECL CRTDLL__ismbbtrail( unsigned int c )
|
|---|
| 1679 | {
|
|---|
| 1680 | dprintf(("CRTDLL: _ismbbtrail\n"));
|
|---|
| 1681 | return ((_jctype+1)[(unsigned char)(c)] & _KNJ_2);
|
|---|
| 1682 | }
|
|---|
| 1683 |
|
|---|
| 1684 |
|
|---|
| 1685 | /*********************************************************************
|
|---|
| 1686 | * _ismbcalpha (CRTDLL.149)
|
|---|
| 1687 | */
|
|---|
| 1688 | int CDECL CRTDLL__ismbcalpha( unsigned int c )
|
|---|
| 1689 | {
|
|---|
| 1690 | dprintf(("CRTDLL: _ismbcalpha\n"));
|
|---|
| 1691 | if ((c & 0xFF00) != 0) {
|
|---|
| 1692 | // true multibyte character
|
|---|
| 1693 | return 0;
|
|---|
| 1694 | }
|
|---|
| 1695 | else
|
|---|
| 1696 | return CRTDLL__ismbbalpha(c);
|
|---|
| 1697 |
|
|---|
| 1698 | return 0;
|
|---|
| 1699 | }
|
|---|
| 1700 |
|
|---|
| 1701 |
|
|---|
| 1702 | /*********************************************************************
|
|---|
| 1703 | * _ismbcdigit (CRTDLL.150)
|
|---|
| 1704 | */
|
|---|
| 1705 | int CDECL CRTDLL__ismbcdigit( unsigned int c )
|
|---|
| 1706 | {
|
|---|
| 1707 | dprintf(("CRTDLL: _ismbcdigit\n"));
|
|---|
| 1708 | if ((c & 0xFF00) != 0) {
|
|---|
| 1709 | // true multibyte character
|
|---|
| 1710 | return 0;
|
|---|
| 1711 | }
|
|---|
| 1712 | else
|
|---|
| 1713 | return 0;
|
|---|
| 1714 | // return _ismbbdigit(c);
|
|---|
| 1715 |
|
|---|
| 1716 | return 0;
|
|---|
| 1717 | }
|
|---|
| 1718 |
|
|---|
| 1719 |
|
|---|
| 1720 | /*********************************************************************
|
|---|
| 1721 | * _ismbchira (CRTDLL.151)
|
|---|
| 1722 | */
|
|---|
| 1723 | int CDECL CRTDLL__ismbchira( unsigned int c )
|
|---|
| 1724 | {
|
|---|
| 1725 | dprintf(("CRTDLL: _ismbchira\n"));
|
|---|
| 1726 | return ((c>=0x829F) && (c<=0x82F1));
|
|---|
| 1727 | }
|
|---|
| 1728 |
|
|---|
| 1729 |
|
|---|
| 1730 | /*********************************************************************
|
|---|
| 1731 | * _ismbckata (CRTDLL.152)
|
|---|
| 1732 | */
|
|---|
| 1733 | int CDECL CRTDLL__ismbckata( unsigned int c )
|
|---|
| 1734 | {
|
|---|
| 1735 | dprintf(("CRTDLL: _ismbckata\n"));
|
|---|
| 1736 | return ((c>=0x8340) && (c<=0x8396));
|
|---|
| 1737 | }
|
|---|
| 1738 |
|
|---|
| 1739 | /*********************************************************************
|
|---|
| 1740 | * _ismbcl0 (CRTDLL.153)
|
|---|
| 1741 | */
|
|---|
| 1742 | int CDECL CRTDLL__ismbcl0( unsigned int ch )
|
|---|
| 1743 | {
|
|---|
| 1744 | dprintf(("CRTDLL: _ismbcl0 not implemented.\n"));
|
|---|
| 1745 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1746 | return 0;
|
|---|
| 1747 | }
|
|---|
| 1748 |
|
|---|
| 1749 |
|
|---|
| 1750 | /*********************************************************************
|
|---|
| 1751 | * _ismbcl1 (CRTDLL.154)
|
|---|
| 1752 | */
|
|---|
| 1753 | int CDECL CRTDLL__ismbcl1( unsigned int ch )
|
|---|
| 1754 | {
|
|---|
| 1755 | dprintf(("CRTDLL: _ismbcl1 not implemented.\n"));
|
|---|
| 1756 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1757 | return 0;
|
|---|
| 1758 | }
|
|---|
| 1759 |
|
|---|
| 1760 |
|
|---|
| 1761 | /*********************************************************************
|
|---|
| 1762 | * _ismbcl2 (CRTDLL.155)
|
|---|
| 1763 | */
|
|---|
| 1764 | int CDECL CRTDLL__ismbcl2( unsigned int ch )
|
|---|
| 1765 | {
|
|---|
| 1766 | dprintf(("CRTDLL: _ismbcl2 not implemented.\n"));
|
|---|
| 1767 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1768 | return 0;
|
|---|
| 1769 | }
|
|---|
| 1770 |
|
|---|
| 1771 |
|
|---|
| 1772 | /*********************************************************************
|
|---|
| 1773 | * _ismbclegal (CRTDLL.156)
|
|---|
| 1774 | */
|
|---|
| 1775 | int CDECL CRTDLL__ismbclegal( unsigned int c )
|
|---|
| 1776 | {
|
|---|
| 1777 | dprintf(("CRTDLL: _ismbclegal\n"));
|
|---|
| 1778 | if ((c & 0xFF00) != 0) {
|
|---|
| 1779 | return CRTDLL__ismbblead(c>>8) && CRTDLL__ismbbtrail(c&0xFF);
|
|---|
| 1780 | }
|
|---|
| 1781 | else
|
|---|
| 1782 | return CRTDLL__ismbbtrail(c&0xFF);
|
|---|
| 1783 |
|
|---|
| 1784 | return 0;
|
|---|
| 1785 | }
|
|---|
| 1786 |
|
|---|
| 1787 |
|
|---|
| 1788 | /*********************************************************************
|
|---|
| 1789 | * _ismbclower (CRTDLL.157)
|
|---|
| 1790 | */
|
|---|
| 1791 | int CDECL CRTDLL__ismbclower( unsigned int c )
|
|---|
| 1792 | {
|
|---|
| 1793 | dprintf(("CRTDLL: _ismbclower\n"));
|
|---|
| 1794 | if ((c & 0xFF00) != 0) {
|
|---|
| 1795 | if ( c >= 0x829A && c<= 0x829A )
|
|---|
| 1796 | return 1;
|
|---|
| 1797 | }
|
|---|
| 1798 | else
|
|---|
| 1799 | return isupper(c);
|
|---|
| 1800 | }
|
|---|
| 1801 |
|
|---|
| 1802 |
|
|---|
| 1803 | /*********************************************************************
|
|---|
| 1804 | * _ismbcprint (CRTDLL.158)
|
|---|
| 1805 | */
|
|---|
| 1806 | int CDECL CRTDLL__ismbcprint( unsigned int c )
|
|---|
| 1807 | {
|
|---|
| 1808 | dprintf(("CRTDLL: _ismbcprint\n"));
|
|---|
| 1809 | if ((c & 0xFF00) != 0) {
|
|---|
| 1810 | // true multibyte character
|
|---|
| 1811 | return 0;
|
|---|
| 1812 | }
|
|---|
| 1813 | else
|
|---|
| 1814 | return 0;
|
|---|
| 1815 | // return _ismbbdigit(c);
|
|---|
| 1816 |
|
|---|
| 1817 | return 0;
|
|---|
| 1818 | }
|
|---|
| 1819 |
|
|---|
| 1820 |
|
|---|
| 1821 | /*********************************************************************
|
|---|
| 1822 | * _ismbcspace (CRTDLL.159)
|
|---|
| 1823 | */
|
|---|
| 1824 | int CDECL CRTDLL__ismbcspace( unsigned int c )
|
|---|
| 1825 | {
|
|---|
| 1826 | dprintf(("CRTDLL: _ismbcspace not implemented.\n"));
|
|---|
| 1827 | if ((c & 0xFF00) != 0) {
|
|---|
| 1828 | // true multibyte character
|
|---|
| 1829 | return 0;
|
|---|
| 1830 | }
|
|---|
| 1831 | else
|
|---|
| 1832 | return 0;
|
|---|
| 1833 | // return _ismbbdigit(c);
|
|---|
| 1834 |
|
|---|
| 1835 | return 0;
|
|---|
| 1836 | }
|
|---|
| 1837 |
|
|---|
| 1838 |
|
|---|
| 1839 | /*********************************************************************
|
|---|
| 1840 | * _ismbcsymbol (CRTDLL.160)
|
|---|
| 1841 | */
|
|---|
| 1842 | int CDECL CRTDLL__ismbcsymbol( unsigned int c )
|
|---|
| 1843 | {
|
|---|
| 1844 | dprintf(("CRTDLL: _ismbcsymbol not implemented.\n"));
|
|---|
| 1845 | if ((c & 0xFF00) != 0) {
|
|---|
| 1846 | // true multibyte character
|
|---|
| 1847 | return 0;
|
|---|
| 1848 | }
|
|---|
| 1849 | else
|
|---|
| 1850 | return 0;
|
|---|
| 1851 | // return _ismbbdigit(c);
|
|---|
| 1852 |
|
|---|
| 1853 | return 0;
|
|---|
| 1854 | }
|
|---|
| 1855 |
|
|---|
| 1856 |
|
|---|
| 1857 | /*********************************************************************
|
|---|
| 1858 | * _ismbcupper (CRTDLL.161)
|
|---|
| 1859 | */
|
|---|
| 1860 | int CDECL CRTDLL__ismbcupper( unsigned int c )
|
|---|
| 1861 | {
|
|---|
| 1862 | dprintf(("CRTDLL: _ismbcupper\n"));
|
|---|
| 1863 | if ((c & 0xFF00) != 0) {
|
|---|
| 1864 | if ( c >= 0x8260 && c<= 0x8279 )
|
|---|
| 1865 | return 1;
|
|---|
| 1866 | }
|
|---|
| 1867 | else
|
|---|
| 1868 | return isupper(c);
|
|---|
| 1869 | }
|
|---|
| 1870 |
|
|---|
| 1871 |
|
|---|
| 1872 | /*********************************************************************
|
|---|
| 1873 | * _ismbslead (CRTDLL.162)
|
|---|
| 1874 | */
|
|---|
| 1875 | int CDECL CRTDLL__ismbslead(const unsigned char *str, const unsigned char *t)
|
|---|
| 1876 | {
|
|---|
| 1877 | dprintf(("CRTDLL: _ismbslead\n"));
|
|---|
| 1878 | unsigned char *s = (unsigned char *)str;
|
|---|
| 1879 | while(*s != 0 && s != t)
|
|---|
| 1880 | {
|
|---|
| 1881 | s+= _mbclen2(*s);
|
|---|
| 1882 | }
|
|---|
| 1883 | return CRTDLL__ismbblead( *s);
|
|---|
| 1884 | }
|
|---|
| 1885 |
|
|---|
| 1886 |
|
|---|
| 1887 | /*********************************************************************
|
|---|
| 1888 | * _ismbstrail (CRTDLL.163)
|
|---|
| 1889 | */
|
|---|
| 1890 | int CDECL CRTDLL__ismbstrail(const unsigned char *str, const unsigned char *t)
|
|---|
| 1891 | {
|
|---|
| 1892 | dprintf(("CRTDLL: _ismbstrail\n"));
|
|---|
| 1893 | unsigned char *s = (unsigned char *)str;
|
|---|
| 1894 | while(*s != 0 && s != t)
|
|---|
| 1895 | {
|
|---|
| 1896 |
|
|---|
| 1897 | s+= _mbclen2(*s);
|
|---|
| 1898 | }
|
|---|
| 1899 |
|
|---|
| 1900 | return CRTDLL__ismbbtrail(*s);
|
|---|
| 1901 | }
|
|---|
| 1902 |
|
|---|
| 1903 |
|
|---|
| 1904 | /*********************************************************************
|
|---|
| 1905 | * _isnan (CRTDLL.164)
|
|---|
| 1906 | */
|
|---|
| 1907 | int CDECL CRTDLL__isnan( double __x )
|
|---|
| 1908 | {
|
|---|
| 1909 | dprintf(("CRTDLL: _isnan\n"));
|
|---|
| 1910 | double_t * x = (double_t *)&__x;
|
|---|
| 1911 | return ( x->exponent == 0x7ff && ( x->mantissah != 0 || x->mantissal != 0 ));
|
|---|
| 1912 | }
|
|---|
| 1913 |
|
|---|
| 1914 |
|
|---|
| 1915 | /*********************************************************************
|
|---|
| 1916 | * _j0 (CRTDLL.166)
|
|---|
| 1917 | */
|
|---|
| 1918 | double CDECL CRTDLL__j0(double x)
|
|---|
| 1919 | {
|
|---|
| 1920 | dprintf(("CRTDLL: _j0\n"));
|
|---|
| 1921 | return (_j0(x));
|
|---|
| 1922 | }
|
|---|
| 1923 |
|
|---|
| 1924 |
|
|---|
| 1925 | /*********************************************************************
|
|---|
| 1926 | * _j1 (CRTDLL.167)
|
|---|
| 1927 | */
|
|---|
| 1928 | double CDECL CRTDLL__j1(double x)
|
|---|
| 1929 | {
|
|---|
| 1930 | dprintf(("CRTDLL: _j1\n"));
|
|---|
| 1931 | return (_j1(x));}
|
|---|
| 1932 |
|
|---|
| 1933 |
|
|---|
| 1934 | /*********************************************************************
|
|---|
| 1935 | * _jn (CRTDLL.168)
|
|---|
| 1936 | */
|
|---|
| 1937 | double CDECL CRTDLL__jn(int i, double x)
|
|---|
| 1938 | {
|
|---|
| 1939 | dprintf(("CRTDLL: _jn\n"));
|
|---|
| 1940 | return (_jn(i, x));
|
|---|
| 1941 | }
|
|---|
| 1942 |
|
|---|
| 1943 |
|
|---|
| 1944 | /*********************************************************************
|
|---|
| 1945 | * _kbhit (CRTDLL.169)
|
|---|
| 1946 | */
|
|---|
| 1947 | int CDECL CRTDLL__kbhit( void )
|
|---|
| 1948 | {
|
|---|
| 1949 | dprintf(("CRTDLL: _kbhit\n"));
|
|---|
| 1950 | return (_kbhit());
|
|---|
| 1951 | }
|
|---|
| 1952 |
|
|---|
| 1953 |
|
|---|
| 1954 | /*********************************************************************
|
|---|
| 1955 | * _lfind (CRTDLL.170)
|
|---|
| 1956 | */
|
|---|
| 1957 | void * CDECL CRTDLL__lfind(const void *key, const void *base, size_t *nelp,
|
|---|
| 1958 | size_t width, int (*compar)(const void *, const void *))
|
|---|
| 1959 | {
|
|---|
| 1960 | dprintf(("CRTDLL: _lfind\n"));
|
|---|
| 1961 | char *char_base = (char *)base;
|
|---|
| 1962 | int i;
|
|---|
| 1963 | for(i=0;i<*nelp;i++) {
|
|---|
| 1964 | if ( compar(key,char_base) == 0)
|
|---|
| 1965 | return char_base;
|
|---|
| 1966 | char_base += width;
|
|---|
| 1967 | }
|
|---|
| 1968 | return NULL;
|
|---|
| 1969 | }
|
|---|
| 1970 |
|
|---|
| 1971 |
|
|---|
| 1972 | /*********************************************************************
|
|---|
| 1973 | * _loaddll (CRTDLL.171)
|
|---|
| 1974 | */
|
|---|
| 1975 | void * CDECL CRTDLL__loaddll (char *name)
|
|---|
| 1976 | {
|
|---|
| 1977 | dprintf(("CRTDLL: _loaddll\n"));
|
|---|
| 1978 | return (void*)LoadLibraryA(name);
|
|---|
| 1979 | }
|
|---|
| 1980 |
|
|---|
| 1981 |
|
|---|
| 1982 | /*******************************************************************
|
|---|
| 1983 | * _local_unwind2 (CRTDLL.172)
|
|---|
| 1984 | */
|
|---|
| 1985 | void CDECL CRTDLL__local_unwind2( PEXCEPTION_FRAME endframe, DWORD nr )
|
|---|
| 1986 | {
|
|---|
| 1987 | dprintf(("CRTDLL: local_undwind2\n"));
|
|---|
| 1988 | }
|
|---|
| 1989 |
|
|---|
| 1990 |
|
|---|
| 1991 | /*********************************************************************
|
|---|
| 1992 | * _locking (CRTDLL.173)
|
|---|
| 1993 | */
|
|---|
| 1994 | int CDECL CRTDLL__locking(int handle,int mode,unsigned long nbyte)
|
|---|
| 1995 | {
|
|---|
| 1996 | dprintf(("CRTDLL: _locking not implemented.\n"));
|
|---|
| 1997 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 1998 | return FALSE;
|
|---|
| 1999 | }
|
|---|
| 2000 |
|
|---|
| 2001 |
|
|---|
| 2002 | /*********************************************************************
|
|---|
| 2003 | * _logb (CRTDLL.174)
|
|---|
| 2004 | */
|
|---|
| 2005 | double CDECL CRTDLL__logb( double x )
|
|---|
| 2006 | {
|
|---|
| 2007 | dprintf(("CRTDLL: _logb not implemented.\n"));
|
|---|
| 2008 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 2009 | return FALSE;
|
|---|
| 2010 | }
|
|---|
| 2011 |
|
|---|
| 2012 |
|
|---|
| 2013 | /*********************************************************************
|
|---|
| 2014 | * _lrotl (CRTDLL.175)
|
|---|
| 2015 | */
|
|---|
| 2016 | unsigned long CDECL CRTDLL__lrotl( unsigned long value, unsigned int shift )
|
|---|
| 2017 | {
|
|---|
| 2018 | dprintf(("CRTDLL: _lrotl\n"));
|
|---|
| 2019 | return (_lrotl(value, shift));
|
|---|
| 2020 | }
|
|---|
| 2021 |
|
|---|
| 2022 |
|
|---|
| 2023 | /*********************************************************************
|
|---|
| 2024 | * _lrotr (CRTDLL.176)
|
|---|
| 2025 | */
|
|---|
| 2026 | unsigned long CDECL CRTDLL__lrotr( unsigned long value, unsigned int shift )
|
|---|
| 2027 | {
|
|---|
| 2028 | dprintf(("CRTDLL: _lrotr\n"));
|
|---|
| 2029 | return (_lrotr(value, shift));
|
|---|
| 2030 | }
|
|---|
| 2031 |
|
|---|
| 2032 |
|
|---|
| 2033 | /*********************************************************************
|
|---|
| 2034 | * _lsearch (CRTDLL.177)
|
|---|
| 2035 | */
|
|---|
| 2036 | void * CDECL CRTDLL__lsearch(const void *key, void *base, size_t *nelp, size_t width,
|
|---|
| 2037 | int (*compar)(const void *, const void *))
|
|---|
| 2038 | {
|
|---|
| 2039 | dprintf(("CRTDLL: _lsearch not implemented.\n"));
|
|---|
| 2040 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 2041 | return FALSE;
|
|---|
| 2042 | }
|
|---|
| 2043 |
|
|---|
| 2044 |
|
|---|
| 2045 | /*********************************************************************
|
|---|
| 2046 | * _lseek (CRTDLL.178)
|
|---|
| 2047 | */
|
|---|
| 2048 | long CDECL CRTDLL__lseek(int handle,long offset,int origin)
|
|---|
| 2049 | {
|
|---|
| 2050 | dprintf(("CRTDLL: _lssek\n"));
|
|---|
| 2051 | return (_lseek(handle, offset, origin));
|
|---|
| 2052 | }
|
|---|
| 2053 |
|
|---|
| 2054 |
|
|---|
| 2055 | /*********************************************************************
|
|---|
| 2056 | * _makepath (CRTDLL.180)
|
|---|
| 2057 | */
|
|---|
| 2058 | void CDECL CRTDLL__makepath( char *path, char *drive,
|
|---|
| 2059 | char *dir, char *fname, char *ext )
|
|---|
| 2060 | {
|
|---|
| 2061 | dprintf(("CRTDLL: _makepath\n"));
|
|---|
| 2062 | _makepath(path, drive, dir, fname, ext);
|
|---|
| 2063 | }
|
|---|
| 2064 |
|
|---|
| 2065 |
|
|---|
| 2066 | /*********************************************************************
|
|---|
| 2067 | * _matherr (CRTDLL.181)
|
|---|
| 2068 | */
|
|---|
| 2069 | double CDECL CRTDLL__matherr( struct exception * excep )
|
|---|
| 2070 | {
|
|---|
| 2071 | dprintf(("CRTDLL: _matherr\n"));
|
|---|
| 2072 | return (_matherr(excep));
|
|---|
| 2073 | }
|
|---|
| 2074 |
|
|---|
| 2075 |
|
|---|
| 2076 | /*********************************************************************
|
|---|
| 2077 | * _mbbtombc (CRTDLL.182)
|
|---|
| 2078 | */
|
|---|
| 2079 | unsigned int CDECL CRTDLL__mbbtombc( unsigned int c )
|
|---|
| 2080 | {
|
|---|
| 2081 | dprintf(("CRTDLL: _mbbtombc\n"));
|
|---|
| 2082 | if (c >= 0x20 && c <= 0x7e) {
|
|---|
| 2083 | return han_to_zen_ascii_table[c - 0x20];
|
|---|
| 2084 | } else if (ISKANA(c)) {
|
|---|
| 2085 | return han_to_zen_kana_table[c - 0xa0];
|
|---|
| 2086 | }
|
|---|
| 2087 | return c;
|
|---|
| 2088 | }
|
|---|
| 2089 |
|
|---|
| 2090 |
|
|---|
| 2091 | /*********************************************************************
|
|---|
| 2092 | * _mbbtype (CRTDLL.183)
|
|---|
| 2093 | */
|
|---|
| 2094 | int CDECL CRTDLL__mbbtype( unsigned char c, int type )
|
|---|
| 2095 | {
|
|---|
| 2096 | dprintf(("CRTDLL: _mbbtype\n"));
|
|---|
| 2097 | if ( type == 1 ) {
|
|---|
| 2098 | if ((c >= 0x40 && c <= 0x7e ) || (c >= 0x80 && c <= 0xfc ) )
|
|---|
| 2099 | {
|
|---|
| 2100 | return _MBC_TRAIL;
|
|---|
| 2101 | }
|
|---|
| 2102 | else if (( c >= 0x20 && c >= 0x7E ) || ( c >= 0xA1 && c <= 0xDF ) ||
|
|---|
| 2103 | ( c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC ) )
|
|---|
| 2104 | return _MBC_ILLEGAL;
|
|---|
| 2105 | else
|
|---|
| 2106 | return 0;
|
|---|
| 2107 |
|
|---|
| 2108 | }
|
|---|
| 2109 | else {
|
|---|
| 2110 | if (( c >= 0x20 && c <= 0x7E ) || ( c >= 0xA1 && c <= 0xDF )) {
|
|---|
| 2111 | return _MBC_SINGLE;
|
|---|
| 2112 | }
|
|---|
| 2113 | else if ( (c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC) )
|
|---|
| 2114 | return _MBC_LEAD;
|
|---|
| 2115 | else if (( c >= 0x20 && c >= 0x7E ) || ( c >= 0xA1 && c <= 0xDF ) ||
|
|---|
| 2116 | ( c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC ) )
|
|---|
| 2117 | return _MBC_ILLEGAL;
|
|---|
| 2118 | else
|
|---|
| 2119 | return 0;
|
|---|
| 2120 |
|
|---|
| 2121 | }
|
|---|
| 2122 |
|
|---|
| 2123 |
|
|---|
| 2124 | return 0;
|
|---|
| 2125 | }
|
|---|
| 2126 |
|
|---|
| 2127 |
|
|---|
| 2128 | /*********************************************************************
|
|---|
| 2129 | * _mbccpy (CRTDLL.184)
|
|---|
| 2130 | */
|
|---|
| 2131 | void CDECL CRTDLL__mbccpy( unsigned char *dst, const unsigned char *src )
|
|---|
| 2132 | {
|
|---|
| 2133 | dprintf(("CRTDLL: _mbccpy\n"));
|
|---|
| 2134 |
|
|---|
| 2135 | if (!CRTDLL__ismbblead(*src) )
|
|---|
| 2136 | return;
|
|---|
| 2137 |
|
|---|
| 2138 | memcpy(dst,src,_mbclen2(*src));
|
|---|
| 2139 | }
|
|---|
| 2140 |
|
|---|
| 2141 |
|
|---|
| 2142 | /*********************************************************************
|
|---|
| 2143 | * _mbcjistojms (CRTDLL.185)
|
|---|
| 2144 | */
|
|---|
| 2145 | int CDECL CRTDLL__mbcjistojms( unsigned int c )
|
|---|
| 2146 | {
|
|---|
| 2147 | dprintf(("CRTDLL: _mbcjistojms\n"));
|
|---|
| 2148 | int c1, c2;
|
|---|
| 2149 |
|
|---|
| 2150 | c2 = (unsigned char)c;
|
|---|
| 2151 | c1 = c >> 8;
|
|---|
| 2152 | if (c1 >= 0x21 && c1 <= 0x7e && c2 >= 0x21 && c2 <= 0x7e) {
|
|---|
| 2153 | if (c1 & 0x01) {
|
|---|
| 2154 | c2 += 0x1f;
|
|---|
| 2155 | if (c2 >= 0x7f)
|
|---|
| 2156 | c2 ++;
|
|---|
| 2157 | } else {
|
|---|
| 2158 | c2 += 0x7e;
|
|---|
| 2159 | }
|
|---|
| 2160 | c1 += 0xe1;
|
|---|
| 2161 | c1 >>= 1;
|
|---|
| 2162 | if (c1 >= 0xa0)
|
|---|
| 2163 | c1 += 0x40;
|
|---|
| 2164 | return ((c1 << 8) | c2);
|
|---|
| 2165 | }
|
|---|
| 2166 | return 0;
|
|---|
| 2167 | }
|
|---|
| 2168 |
|
|---|
| 2169 |
|
|---|
| 2170 | /*********************************************************************
|
|---|
| 2171 | * _mbcjmstojis (CRTDLL.186)
|
|---|
| 2172 | */
|
|---|
| 2173 | int CDECL CRTDLL__mbcjmstojis( unsigned int c )
|
|---|
| 2174 | {
|
|---|
| 2175 | dprintf(("CRTDLL: _mbcjmstojis\n"));
|
|---|
| 2176 | int c1, c2;
|
|---|
| 2177 |
|
|---|
| 2178 | c2 = (unsigned char)c;
|
|---|
| 2179 | c1 = c >> 8;
|
|---|
| 2180 | if (c1 < 0xf0 && CRTDLL__ismbblead(c1) && CRTDLL__ismbbtrail(c2)) {
|
|---|
| 2181 | if (c1 >= 0xe0)
|
|---|
| 2182 | c1 -= 0x40;
|
|---|
| 2183 | c1 -= 0x70;
|
|---|
| 2184 | c1 <<= 1;
|
|---|
| 2185 | if (c2 < 0x9f) {
|
|---|
| 2186 | c1 --;
|
|---|
| 2187 | c2 -= 0x1f;
|
|---|
| 2188 | if (c2 >= (0x80-0x1f))
|
|---|
| 2189 | c2 --;
|
|---|
| 2190 | } else {
|
|---|
| 2191 | c2 -= 0x7e;
|
|---|
| 2192 | }
|
|---|
| 2193 | return ((c1 << 8) | c2);
|
|---|
| 2194 | }
|
|---|
| 2195 | return 0;
|
|---|
| 2196 | }
|
|---|
| 2197 |
|
|---|
| 2198 |
|
|---|
| 2199 | /*********************************************************************
|
|---|
| 2200 | * _mbclen (CRTDLL.187)
|
|---|
| 2201 | */
|
|---|
| 2202 | size_t CDECL CRTDLL__mbclen( const unsigned char *s )
|
|---|
| 2203 | {
|
|---|
| 2204 | dprintf(("CRTDLL: _mbclen\n"));
|
|---|
| 2205 | return (CRTDLL__ismbblead(*s>>8) && CRTDLL__ismbbtrail(*s&0x00FF)) ? 2 : 1;
|
|---|
| 2206 | }
|
|---|
| 2207 |
|
|---|
| 2208 |
|
|---|
| 2209 | /*********************************************************************
|
|---|
| 2210 | * _mbctohira (CRTDLL.188)
|
|---|
| 2211 | */
|
|---|
| 2212 | int CDECL CRTDLL__mbctohira( unsigned int c )
|
|---|
| 2213 | {
|
|---|
| 2214 | dprintf(("CRTDLL: _mbctohira\n"));
|
|---|
| 2215 | return c;
|
|---|
| 2216 | }
|
|---|
| 2217 |
|
|---|
| 2218 |
|
|---|
| 2219 | /*********************************************************************
|
|---|
| 2220 | * _mbctokata (CRTDLL.189)
|
|---|
| 2221 | */
|
|---|
| 2222 | int CDECL CRTDLL__mbctokata( unsigned int c )
|
|---|
| 2223 | {
|
|---|
| 2224 | dprintf(("CRTDLL: _mbctokata\n"));
|
|---|
| 2225 | return c;
|
|---|
| 2226 | }
|
|---|
| 2227 |
|
|---|
| 2228 |
|
|---|
| 2229 | /*********************************************************************
|
|---|
| 2230 | * _mbctolower (CRTDLL.190)
|
|---|
| 2231 | */
|
|---|
| 2232 | unsigned int CDECL CRTDLL__mbctolower( unsigned int c )
|
|---|
| 2233 | {
|
|---|
| 2234 | dprintf(("CRTDLL: _mbctolower\n"));
|
|---|
| 2235 | if ((c & 0xFF00) != 0) {
|
|---|
| 2236 | // true multibyte case conversion needed
|
|---|
| 2237 | if ( CRTDLL__ismbclower(c) )
|
|---|
| 2238 | return c + CASE_DIFF;
|
|---|
| 2239 |
|
|---|
| 2240 | } else
|
|---|
| 2241 | return _mbbtolower(c);
|
|---|
| 2242 |
|
|---|
| 2243 | return 0;
|
|---|
| 2244 | }
|
|---|
| 2245 |
|
|---|
| 2246 |
|
|---|
| 2247 | /*********************************************************************
|
|---|
| 2248 | * _mbctombb (CRTDLL.191)
|
|---|
| 2249 | */
|
|---|
| 2250 | unsigned int CDECL CRTDLL__mbctombb( unsigned int c )
|
|---|
| 2251 | {
|
|---|
| 2252 | dprintf(("CRTDLL: _mbctombb\n"));
|
|---|
| 2253 | int i;
|
|---|
| 2254 | unsigned short *p;
|
|---|
| 2255 |
|
|---|
| 2256 | if (JISKANA(c)) {
|
|---|
| 2257 | return zen_to_han_kana_table[c - 0x8340];
|
|---|
| 2258 | } else if (JISHIRA(c)) {
|
|---|
| 2259 | c = JTOKANA(c);
|
|---|
| 2260 | return zen_to_han_kana_table[c - 0x8340];
|
|---|
| 2261 | } else if (c <= 0x8396) {
|
|---|
| 2262 | for (i = 0x20, p = han_to_zen_ascii_table; i <= 0x7e; i++, p++) {
|
|---|
| 2263 | if (*p == c) {
|
|---|
| 2264 | return i;
|
|---|
| 2265 | }
|
|---|
| 2266 | }
|
|---|
| 2267 | for (i = 0; i < ZTOH_SYMBOLS; i++) {
|
|---|
| 2268 | if (zen_to_han_symbol_table_1[i] == c) {
|
|---|
| 2269 | return zen_to_han_symbol_table_2[i];
|
|---|
| 2270 | }
|
|---|
| 2271 | }
|
|---|
| 2272 | }
|
|---|
| 2273 | return c;
|
|---|
| 2274 | }
|
|---|
| 2275 |
|
|---|
| 2276 |
|
|---|
| 2277 | /*********************************************************************
|
|---|
| 2278 | * _mbctoupper (CRTDLL.192)
|
|---|
| 2279 | */
|
|---|
| 2280 | unsigned int CDECL CRTDLL__mbctoupper( unsigned int c )
|
|---|
| 2281 | {
|
|---|
| 2282 | dprintf(("CRTDLL: _mbctoupper\n"));
|
|---|
| 2283 | if ((c & 0xFF00) != 0) {
|
|---|
| 2284 | // true multibyte case conversion needed
|
|---|
| 2285 | if ( CRTDLL__ismbcupper(c) )
|
|---|
| 2286 | return c + CASE_DIFF;
|
|---|
| 2287 |
|
|---|
| 2288 | } else
|
|---|
| 2289 | return _mbbtoupper(c);
|
|---|
| 2290 |
|
|---|
| 2291 | return 0;
|
|---|
| 2292 | }
|
|---|
| 2293 |
|
|---|
| 2294 |
|
|---|
| 2295 | /*********************************************************************
|
|---|
| 2296 | * _mbsbtype (CRTDLL.194)
|
|---|
| 2297 | */
|
|---|
| 2298 | int CDECL CRTDLL__mbsbtype( const unsigned char *str, int n )
|
|---|
| 2299 | {
|
|---|
| 2300 | dprintf(("CRTDLL: _mbsbtype\n"));
|
|---|
| 2301 | if ( str == NULL )
|
|---|
| 2302 | return -1;
|
|---|
| 2303 | return CRTDLL__mbbtype(*(str+n),1);
|
|---|
| 2304 | }
|
|---|
| 2305 |
|
|---|
| 2306 |
|
|---|
| 2307 | /*********************************************************************
|
|---|
| 2308 | * _mbscat (CRTDLL.195)
|
|---|
| 2309 | */
|
|---|
| 2310 | unsigned char * CDECL CRTDLL__mbscat( unsigned char *dst, const unsigned char *src )
|
|---|
| 2311 | {
|
|---|
| 2312 | dprintf(("CRTDLL: _mbscat\n"));
|
|---|
| 2313 | return (unsigned char*)strcat((char*)dst,(char*)src);
|
|---|
| 2314 | }
|
|---|
| 2315 |
|
|---|
| 2316 |
|
|---|
| 2317 | /*********************************************************************
|
|---|
| 2318 | * _mbschr (CRTDLL.196)
|
|---|
| 2319 | */
|
|---|
| 2320 | unsigned char * CDECL CRTDLL__mbschr( const unsigned char *str, unsigned int c )
|
|---|
| 2321 | {
|
|---|
| 2322 | dprintf(("CRTDLL: _mbschr\n"));
|
|---|
| 2323 | return (unsigned char*)strchr((char*)str,c);
|
|---|
| 2324 | }
|
|---|
| 2325 |
|
|---|
| 2326 |
|
|---|
| 2327 | /*********************************************************************
|
|---|
| 2328 | * _mbscmp (CRTDLL.197)
|
|---|
| 2329 | */
|
|---|
| 2330 | int CDECL CRTDLL__mbscmp( const unsigned char *s1, const unsigned char *s2 )
|
|---|
| 2331 | {
|
|---|
| 2332 | dprintf(("CRTDLL: _mbscmp\n"));
|
|---|
| 2333 | return strcmp((char*)s1,(char*)s2);
|
|---|
| 2334 | }
|
|---|
| 2335 |
|
|---|
| 2336 |
|
|---|
| 2337 | /*********************************************************************
|
|---|
| 2338 | * _mbscpy (CRTDLL.198)
|
|---|
| 2339 | */
|
|---|
| 2340 | unsigned char * CDECL CRTDLL__mbscpy( unsigned char *s1, const unsigned char *s2 )
|
|---|
| 2341 | {
|
|---|
| 2342 | dprintf(("CRTDLL: _mbscpy\n"));
|
|---|
| 2343 | return (unsigned char*)strcpy((char*)s1,(char*)s2);
|
|---|
| 2344 | }
|
|---|
| 2345 |
|
|---|
| 2346 |
|
|---|
| 2347 | /*********************************************************************
|
|---|
| 2348 | * _mbscspn (CRTDLL.199)
|
|---|
| 2349 | */
|
|---|
| 2350 | size_t CDECL CRTDLL__mbscspn( const unsigned char *s1, const unsigned char *s2 )
|
|---|
| 2351 | {
|
|---|
| 2352 | dprintf(("CRTDLL: _mbscspn\n"));
|
|---|
| 2353 | const char *p, *spanp;
|
|---|
| 2354 | char c, sc;
|
|---|
| 2355 |
|
|---|
| 2356 | for (p = (const char*)s1;;)
|
|---|
| 2357 | {
|
|---|
| 2358 | c = *p++;
|
|---|
| 2359 | spanp = (const char*)s2;
|
|---|
| 2360 | do {
|
|---|
| 2361 | if ((sc = *spanp++) == c)
|
|---|
| 2362 | return (size_t)(p - 1) - (size_t)s1;
|
|---|
| 2363 | } while (sc != 0);
|
|---|
| 2364 | }
|
|---|
| 2365 | /* NOTREACHED */
|
|---|
| 2366 | }
|
|---|
| 2367 |
|
|---|
| 2368 |
|
|---|
| 2369 | /*********************************************************************
|
|---|
| 2370 | * _mbsdec (CRTDLL.200)
|
|---|
| 2371 | */
|
|---|
| 2372 | unsigned char * CDECL CRTDLL__mbsdec( const unsigned char *str, const unsigned char *cur )
|
|---|
| 2373 | {
|
|---|
| 2374 | dprintf(("CRTDLL: _mbsdec\n"));
|
|---|
| 2375 | unsigned char *s = (unsigned char *)cur;
|
|---|
| 2376 | if ( str >= cur )
|
|---|
| 2377 | return NULL;
|
|---|
| 2378 | s--;
|
|---|
| 2379 | if (CRTDLL__ismbblead(*(s-1)) )
|
|---|
| 2380 | s--;
|
|---|
| 2381 |
|
|---|
| 2382 | return s;
|
|---|
| 2383 | }
|
|---|
| 2384 |
|
|---|
| 2385 |
|
|---|
| 2386 | /*********************************************************************
|
|---|
| 2387 | * _mbsdup (CRTDLL.201)
|
|---|
| 2388 | */
|
|---|
| 2389 | unsigned char * CDECL CRTDLL__mbsdup( unsigned char *_s )
|
|---|
| 2390 | {
|
|---|
| 2391 | dprintf(("CRTDLL: _mbsdup\n"));
|
|---|
| 2392 | char *rv;
|
|---|
| 2393 | if (_s == 0)
|
|---|
| 2394 | return 0;
|
|---|
| 2395 | rv = (char *)malloc(CRTDLL__mbslen((LPCSTR)_s) + 1);
|
|---|
| 2396 | if (rv == 0)
|
|---|
| 2397 | return 0;
|
|---|
| 2398 | CRTDLL__mbscpy((unsigned char*)rv, _s);
|
|---|
| 2399 | return (unsigned char*)rv;
|
|---|
| 2400 | }
|
|---|
| 2401 |
|
|---|
| 2402 |
|
|---|
| 2403 | /*********************************************************************
|
|---|
| 2404 | * CRTDLL__mbsicmp (CRTDLL.202)
|
|---|
| 2405 | */
|
|---|
| 2406 | int CDECL CRTDLL__mbsicmp( const unsigned char *x, const unsigned char *y )
|
|---|
| 2407 | {
|
|---|
| 2408 | dprintf(("CRTDLL: _mbsicmp\n"));
|
|---|
| 2409 | do {
|
|---|
| 2410 | if (!*x)
|
|---|
| 2411 | return !!*y;
|
|---|
| 2412 | if (!*y)
|
|---|
| 2413 | return !!*x;
|
|---|
| 2414 | /* FIXME: MBCS handling... */
|
|---|
| 2415 | if (*x!=*y)
|
|---|
| 2416 | return 1;
|
|---|
| 2417 | x++;
|
|---|
| 2418 | y++;
|
|---|
| 2419 | } while (1);
|
|---|
| 2420 | }
|
|---|
| 2421 |
|
|---|
| 2422 |
|
|---|
| 2423 | /*********************************************************************
|
|---|
| 2424 | * CRTDLL__mbsinc (CRTDLL.203)
|
|---|
| 2425 | */
|
|---|
| 2426 | LPSTR CDECL CRTDLL__mbsinc( LPCSTR str )
|
|---|
| 2427 | {
|
|---|
| 2428 | dprintf(("CRTDLL: _mbsinc\n"));
|
|---|
| 2429 | int len = mblen( str, MB_LEN_MAX );
|
|---|
| 2430 | if (len < 1) len = 1;
|
|---|
| 2431 | return (LPSTR)(str + len);
|
|---|
| 2432 | }
|
|---|
| 2433 |
|
|---|
| 2434 |
|
|---|
| 2435 | /*********************************************************************
|
|---|
| 2436 | * CRTDLL__mbslen (CRTDLL.204)
|
|---|
| 2437 | */
|
|---|
| 2438 | INT CDECL CRTDLL__mbslen( LPCSTR str )
|
|---|
| 2439 | {
|
|---|
| 2440 | dprintf(("CRTDLL: _mbslen\n"));
|
|---|
| 2441 | INT len, total = 0;
|
|---|
| 2442 | while ((len = mblen( str, MB_LEN_MAX )) > 0)
|
|---|
| 2443 | {
|
|---|
| 2444 | str += len;
|
|---|
| 2445 | total++;
|
|---|
| 2446 | }
|
|---|
| 2447 | return total;
|
|---|
| 2448 | }
|
|---|
| 2449 |
|
|---|
| 2450 |
|
|---|
| 2451 | /*********************************************************************
|
|---|
| 2452 | * _mbslwr (CRTDLL.205)
|
|---|
| 2453 | */
|
|---|
| 2454 | unsigned char * CDECL CRTDLL__mbslwr( unsigned char *x )
|
|---|
| 2455 | {
|
|---|
| 2456 | dprintf(("CRTDLL: _mbslwr\n"));
|
|---|
| 2457 | unsigned char *y=x;
|
|---|
| 2458 |
|
|---|
| 2459 | while (*y) {
|
|---|
| 2460 | if (!CRTDLL__ismbblead(*y) )
|
|---|
| 2461 | *y = tolower(*y);
|
|---|
| 2462 | else {
|
|---|
| 2463 | *y=CRTDLL__mbctolower(*(unsigned short *)y);
|
|---|
| 2464 | y++;
|
|---|
| 2465 | }
|
|---|
| 2466 | }
|
|---|
| 2467 | return x;
|
|---|
| 2468 | }
|
|---|
| 2469 |
|
|---|
| 2470 |
|
|---|
| 2471 | /*********************************************************************
|
|---|
| 2472 | * _mbsnbcat (CRTDLL.206)
|
|---|
| 2473 | */
|
|---|
| 2474 | unsigned char * CDECL CRTDLL__mbsnbcat( unsigned char *dst, const unsigned char *src, size_t n )
|
|---|
| 2475 | {
|
|---|
| 2476 | dprintf(("CRTDLL: _mbsnbcat\n"));
|
|---|
| 2477 | char *d;
|
|---|
| 2478 | char *s = (char *)src;
|
|---|
| 2479 | if (n != 0) {
|
|---|
| 2480 | d = (char*)dst + strlen((char*)dst); // get the end of string
|
|---|
| 2481 | d += _mbclen2(*d); // move 1 or 2 up
|
|---|
| 2482 |
|
|---|
| 2483 | do {
|
|---|
| 2484 | if ((*d++ = *s++) == 0)
|
|---|
| 2485 | {
|
|---|
| 2486 | while (--n != 0)
|
|---|
| 2487 | *d++ = 0;
|
|---|
| 2488 | break;
|
|---|
| 2489 | }
|
|---|
| 2490 | if ( !(n==1 && CRTDLL__ismbblead(*s)) )
|
|---|
| 2491 | n--;
|
|---|
| 2492 | } while (n > 0);
|
|---|
| 2493 | }
|
|---|
| 2494 | return dst;
|
|---|
| 2495 | }
|
|---|
| 2496 |
|
|---|
| 2497 |
|
|---|
| 2498 | /*********************************************************************
|
|---|
| 2499 | * _mbsnbcmp (CRTDLL.207)
|
|---|
| 2500 | */
|
|---|
| 2501 | int CDECL CRTDLL__mbsnbcmp( const unsigned char *str1, const unsigned char *str2, size_t n )
|
|---|
| 2502 | {
|
|---|
| 2503 | dprintf(("CRTDLL: _mbsnbcmp\n"));
|
|---|
| 2504 | unsigned char *s1 = (unsigned char *)str1;
|
|---|
| 2505 | unsigned char *s2 = (unsigned char *)str2;
|
|---|
| 2506 |
|
|---|
| 2507 | unsigned short *short_s1, *short_s2;
|
|---|
| 2508 |
|
|---|
| 2509 | int l1, l2;
|
|---|
| 2510 |
|
|---|
| 2511 | if (n == 0)
|
|---|
| 2512 | return 0;
|
|---|
| 2513 | do {
|
|---|
| 2514 |
|
|---|
| 2515 | if (*s1 == 0)
|
|---|
| 2516 | break;
|
|---|
| 2517 |
|
|---|
| 2518 | l1 = CRTDLL__ismbblead(*s1);
|
|---|
| 2519 | l2 = CRTDLL__ismbblead(*s2);
|
|---|
| 2520 | if ( !l1 && !l2 ) {
|
|---|
| 2521 |
|
|---|
| 2522 | if (*s1 != *s2)
|
|---|
| 2523 | return *s1 - *s2;
|
|---|
| 2524 | else {
|
|---|
| 2525 | s1 += 1;
|
|---|
| 2526 | s2 += 1;
|
|---|
| 2527 | n--;
|
|---|
| 2528 | }
|
|---|
| 2529 | }
|
|---|
| 2530 | else if ( l1 && l2 ){
|
|---|
| 2531 | short_s1 = (unsigned short *)s1;
|
|---|
| 2532 | short_s2 = (unsigned short *)s2;
|
|---|
| 2533 | if ( *short_s1 != *short_s2 )
|
|---|
| 2534 | return *short_s1 - *short_s2;
|
|---|
| 2535 | else {
|
|---|
| 2536 | s1 += 2;
|
|---|
| 2537 | s2 += 2;
|
|---|
| 2538 | n-=2;
|
|---|
| 2539 |
|
|---|
| 2540 | }
|
|---|
| 2541 | }
|
|---|
| 2542 | else
|
|---|
| 2543 | return *s1 - *s2;
|
|---|
| 2544 | } while (n > 0);
|
|---|
| 2545 | return 0;
|
|---|
| 2546 | }
|
|---|
| 2547 |
|
|---|
| 2548 |
|
|---|
| 2549 | /*********************************************************************
|
|---|
| 2550 | * _mbsnbcnt (CRTDLL.208)
|
|---|
| 2551 | */
|
|---|
| 2552 | size_t CDECL CRTDLL__mbsnbcnt( const unsigned char *str, size_t n )
|
|---|
| 2553 | {
|
|---|
| 2554 | dprintf(("CRTDLL: _mbsnbcnt\n"));
|
|---|
| 2555 | unsigned char *s = (unsigned char *)str;
|
|---|
| 2556 | while(*s != 0 && n > 0) {
|
|---|
| 2557 | if (!CRTDLL__ismbblead(*s) )
|
|---|
| 2558 | n--;
|
|---|
| 2559 | s++;
|
|---|
| 2560 | }
|
|---|
| 2561 |
|
|---|
| 2562 | return (size_t)(s - str);
|
|---|
| 2563 | }
|
|---|
| 2564 |
|
|---|
| 2565 |
|
|---|
| 2566 | /*********************************************************************
|
|---|
| 2567 | * _mbsnbcpy (CRTDLL.209)
|
|---|
| 2568 | */
|
|---|
| 2569 | unsigned char * CDECL CRTDLL__mbsnbcpy( unsigned char *str1, const unsigned char *str2, size_t n )
|
|---|
| 2570 | {
|
|---|
| 2571 | dprintf(("CRTDLL: _mbsnbcpy\n"));
|
|---|
| 2572 | unsigned char *s1 = (unsigned char *)str1;
|
|---|
| 2573 | unsigned char *s2 = (unsigned char *)str2;
|
|---|
| 2574 |
|
|---|
| 2575 | unsigned short *short_s1, *short_s2;
|
|---|
| 2576 |
|
|---|
| 2577 | if (n == 0)
|
|---|
| 2578 | return 0;
|
|---|
| 2579 | do {
|
|---|
| 2580 |
|
|---|
| 2581 | if (*s2 == 0)
|
|---|
| 2582 | break;
|
|---|
| 2583 |
|
|---|
| 2584 | if ( !CRTDLL__ismbblead(*s2) ) {
|
|---|
| 2585 |
|
|---|
| 2586 | *s1 = *s2;
|
|---|
| 2587 | s1 += 1;
|
|---|
| 2588 | s2 += 1;
|
|---|
| 2589 | n--;
|
|---|
| 2590 | }
|
|---|
| 2591 | else {
|
|---|
| 2592 | short_s1 = (unsigned short *)s1;
|
|---|
| 2593 | short_s2 = (unsigned short *)s2;
|
|---|
| 2594 | *short_s1 = *short_s2;
|
|---|
| 2595 | s1 += 2;
|
|---|
| 2596 | s2 += 2;
|
|---|
| 2597 | n-=2;
|
|---|
| 2598 | }
|
|---|
| 2599 | } while (n > 0);
|
|---|
| 2600 | return str1;
|
|---|
| 2601 | }
|
|---|
| 2602 |
|
|---|
| 2603 |
|
|---|
| 2604 | /*********************************************************************
|
|---|
| 2605 | * _mbsnbicmp (CRTDLL.210)
|
|---|
| 2606 | */
|
|---|
| 2607 | int CDECL CRTDLL__mbsnbicmp( const unsigned char *s1, const unsigned char *s2, size_t n )
|
|---|
| 2608 | {
|
|---|
| 2609 | dprintf(("CRTDLL: _mbsnbicmp\n"));
|
|---|
| 2610 | if (n == 0)
|
|---|
| 2611 | return 0;
|
|---|
| 2612 | do {
|
|---|
| 2613 | if (_mbbtoupper(*s1) != _mbbtoupper(*s2))
|
|---|
| 2614 | return _mbbtoupper(*(unsigned const char *)s1) - _mbbtoupper(*(unsigned const char *)s2);
|
|---|
| 2615 | s1 += _mbclen2(*s1);
|
|---|
| 2616 | s2 += _mbclen2(*s2);
|
|---|
| 2617 |
|
|---|
| 2618 |
|
|---|
| 2619 | if (*s1 == 0)
|
|---|
| 2620 | break;
|
|---|
| 2621 | n--;
|
|---|
| 2622 | } while (n > 0);
|
|---|
| 2623 | return 0;
|
|---|
| 2624 | }
|
|---|
| 2625 |
|
|---|
| 2626 |
|
|---|
| 2627 | /*********************************************************************
|
|---|
| 2628 | * _mbsnbset (CRTDLL.211)
|
|---|
| 2629 | */
|
|---|
| 2630 | unsigned char * CDECL CRTDLL__mbsnbset( unsigned char *src, unsigned int val, size_t count )
|
|---|
| 2631 | {
|
|---|
| 2632 | dprintf(("CRTDLL: _mbsnbset\n"));
|
|---|
| 2633 | unsigned char *char_src = (unsigned char *)src;
|
|---|
| 2634 | unsigned short *short_src = (unsigned short *)src;
|
|---|
| 2635 |
|
|---|
| 2636 | if ( _mbclen2(val) == 1 ) {
|
|---|
| 2637 |
|
|---|
| 2638 | while(count > 0) {
|
|---|
| 2639 | *char_src = val;
|
|---|
| 2640 | char_src++;
|
|---|
| 2641 | count--;
|
|---|
| 2642 | }
|
|---|
| 2643 | *char_src = 0;
|
|---|
| 2644 | }
|
|---|
| 2645 | else {
|
|---|
| 2646 | while(count > 0) {
|
|---|
| 2647 | *short_src = val;
|
|---|
| 2648 | short_src++;
|
|---|
| 2649 | count-=2;
|
|---|
| 2650 | }
|
|---|
| 2651 | *short_src = 0;
|
|---|
| 2652 | }
|
|---|
| 2653 |
|
|---|
| 2654 | return src;
|
|---|
| 2655 | }
|
|---|
| 2656 |
|
|---|
| 2657 |
|
|---|
| 2658 | /*********************************************************************
|
|---|
| 2659 | * _mbsncat (CRTDLL.212)
|
|---|
| 2660 | */
|
|---|
| 2661 | unsigned char * CDECL CRTDLL__mbsncat( unsigned char *dst, const unsigned char *src, size_t n )
|
|---|
| 2662 | {
|
|---|
| 2663 | dprintf(("CRTDLL: _mbsncat\n"));
|
|---|
| 2664 | char *d = (char *)dst;
|
|---|
| 2665 | char *s = (char *)src;
|
|---|
| 2666 | if (n != 0) {
|
|---|
| 2667 | d = (char*)dst + strlen((char*)dst); // get the end of string
|
|---|
| 2668 | d += _mbclen2(*d); // move 1 or 2 up
|
|---|
| 2669 |
|
|---|
| 2670 | do {
|
|---|
| 2671 | if ((*d++ = *s++) == 0)
|
|---|
| 2672 | {
|
|---|
| 2673 | while (--n != 0)
|
|---|
| 2674 | *d++ = 0;
|
|---|
| 2675 | break;
|
|---|
| 2676 | }
|
|---|
| 2677 | if (!CRTDLL__ismbblead(*s) )
|
|---|
| 2678 | n--;
|
|---|
| 2679 | } while (n > 0);
|
|---|
| 2680 | }
|
|---|
| 2681 | return dst;
|
|---|
| 2682 | }
|
|---|
| 2683 |
|
|---|
| 2684 |
|
|---|
| 2685 | /*********************************************************************
|
|---|
| 2686 | * _mbsnccnt (CRTDLL.213)
|
|---|
| 2687 | */
|
|---|
| 2688 | size_t CDECL CRTDLL__mbsnccnt( const unsigned char *str, size_t n )
|
|---|
| 2689 | {
|
|---|
| 2690 | dprintf(("CRTDLL: _mbsnccnt\n"));
|
|---|
| 2691 | unsigned char *s = (unsigned char *)str;
|
|---|
| 2692 | size_t cnt = 0;
|
|---|
| 2693 | while(*s != 0 && n > 0) {
|
|---|
| 2694 | if (CRTDLL__ismbblead(*s) )
|
|---|
| 2695 | s++;
|
|---|
| 2696 | else
|
|---|
| 2697 | n--;
|
|---|
| 2698 | s++;
|
|---|
| 2699 | cnt++;
|
|---|
| 2700 | }
|
|---|
| 2701 |
|
|---|
| 2702 | return cnt;
|
|---|
| 2703 | }
|
|---|
| 2704 |
|
|---|
| 2705 |
|
|---|
| 2706 | /*********************************************************************
|
|---|
| 2707 | * _mbsncmp (CRTDLL.214)
|
|---|
| 2708 | */
|
|---|
| 2709 | int CDECL CRTDLL__mbsncmp( const unsigned char *str1, const unsigned char *str2, size_t n )
|
|---|
| 2710 | {
|
|---|
| 2711 | dprintf(("CRTDLL: _mbsncmp\n"));
|
|---|
| 2712 | unsigned char *s1 = (unsigned char *)str1;
|
|---|
| 2713 | unsigned char *s2 = (unsigned char *)str2;
|
|---|
| 2714 |
|
|---|
| 2715 | unsigned short *short_s1, *short_s2;
|
|---|
| 2716 |
|
|---|
| 2717 | int l1, l2;
|
|---|
| 2718 |
|
|---|
| 2719 | if (n == 0)
|
|---|
| 2720 | return 0;
|
|---|
| 2721 | do {
|
|---|
| 2722 |
|
|---|
| 2723 | if (*s1 == 0)
|
|---|
| 2724 | break;
|
|---|
| 2725 |
|
|---|
| 2726 | l1 = CRTDLL__ismbblead(*s1);
|
|---|
| 2727 | l2 = CRTDLL__ismbblead(*s2);
|
|---|
| 2728 | if ( !l1 && !l2 ) {
|
|---|
| 2729 |
|
|---|
| 2730 | if (*s1 != *s2)
|
|---|
| 2731 | return *s1 - *s2;
|
|---|
| 2732 | else {
|
|---|
| 2733 | s1 += 1;
|
|---|
| 2734 | s2 += 1;
|
|---|
| 2735 | n--;
|
|---|
| 2736 | }
|
|---|
| 2737 | }
|
|---|
| 2738 | else if ( l1 && l2 ){
|
|---|
| 2739 | short_s1 = (unsigned short *)s1;
|
|---|
| 2740 | short_s2 = (unsigned short *)s2;
|
|---|
| 2741 | if ( *short_s1 != *short_s2 )
|
|---|
| 2742 | return *short_s1 - *short_s2;
|
|---|
| 2743 | else {
|
|---|
| 2744 | s1 += 2;
|
|---|
| 2745 | s2 += 2;
|
|---|
| 2746 | n--;
|
|---|
| 2747 |
|
|---|
| 2748 | }
|
|---|
| 2749 | }
|
|---|
| 2750 | else
|
|---|
| 2751 | return *s1 - *s2;
|
|---|
| 2752 | } while (n > 0);
|
|---|
| 2753 | return 0;
|
|---|
| 2754 | }
|
|---|
| 2755 |
|
|---|
| 2756 |
|
|---|
| 2757 | /*********************************************************************
|
|---|
| 2758 | * _mbsncpy (CRTDLL.215)
|
|---|
| 2759 | */
|
|---|
| 2760 | unsigned char * CDECL CRTDLL__mbsncpy( unsigned char *str1, const unsigned char *str2, size_t n )
|
|---|
| 2761 | {
|
|---|
| 2762 | dprintf(("CRTDLL: _mbsncpy\n"));
|
|---|
| 2763 | unsigned char *s1 = (unsigned char *)str1;
|
|---|
| 2764 | unsigned char *s2 = (unsigned char *)str2;
|
|---|
| 2765 |
|
|---|
| 2766 | unsigned short *short_s1, *short_s2;
|
|---|
| 2767 |
|
|---|
| 2768 | if (n == 0)
|
|---|
| 2769 | return 0;
|
|---|
| 2770 | do {
|
|---|
| 2771 |
|
|---|
| 2772 | if (*s2 == 0)
|
|---|
| 2773 | break;
|
|---|
| 2774 |
|
|---|
| 2775 | if ( !CRTDLL__ismbblead(*s2) ) {
|
|---|
| 2776 |
|
|---|
| 2777 | *s1 = *s2;
|
|---|
| 2778 | s1 += 1;
|
|---|
| 2779 | s2 += 1;
|
|---|
| 2780 | n--;
|
|---|
| 2781 | }
|
|---|
| 2782 | else {
|
|---|
| 2783 | short_s1 = (unsigned short *)s1;
|
|---|
| 2784 | short_s2 = (unsigned short *)s2;
|
|---|
| 2785 | *short_s1 = *short_s2;
|
|---|
| 2786 | s1 += 2;
|
|---|
| 2787 | s2 += 2;
|
|---|
| 2788 | n--;
|
|---|
| 2789 | }
|
|---|
| 2790 | } while (n > 0);
|
|---|
| 2791 | return str1;
|
|---|
| 2792 | }
|
|---|
| 2793 |
|
|---|
| 2794 |
|
|---|
| 2795 | /*********************************************************************
|
|---|
| 2796 | * _mbsnextc (CRTDLL.216)
|
|---|
| 2797 | */
|
|---|
| 2798 | unsigned int CDECL CRTDLL__mbsnextc( const unsigned char *src )
|
|---|
| 2799 | {
|
|---|
| 2800 | dprintf(("CRTDLL: _mbsnextc\n"));
|
|---|
| 2801 | unsigned char *char_src = (unsigned char *)src;
|
|---|
| 2802 | unsigned short *short_src = (unsigned short *)src;
|
|---|
| 2803 |
|
|---|
| 2804 | if ( src == NULL )
|
|---|
| 2805 | return 0;
|
|---|
| 2806 |
|
|---|
| 2807 | if ( !CRTDLL__ismbblead(*src) )
|
|---|
| 2808 | return *char_src;
|
|---|
| 2809 | else
|
|---|
| 2810 | return *short_src;
|
|---|
| 2811 | return 0;
|
|---|
| 2812 |
|
|---|
| 2813 | }
|
|---|
| 2814 |
|
|---|
| 2815 |
|
|---|
| 2816 | /*********************************************************************
|
|---|
| 2817 | * _mbsnicmp (CRTDLL.217)
|
|---|
| 2818 | */
|
|---|
| 2819 | int CDECL CRTDLL__mbsnicmp( const unsigned char *s1, const unsigned char *s2, size_t n )
|
|---|
| 2820 | {
|
|---|
| 2821 | dprintf(("CRTDLL: _mbsnicmp\n"));
|
|---|
| 2822 | if (n == 0)
|
|---|
| 2823 | return 0;
|
|---|
| 2824 | do {
|
|---|
| 2825 | if (_mbbtoupper(*s1) != _mbbtoupper(*s2))
|
|---|
| 2826 | return _mbbtoupper(*(unsigned const char *)s1) - _mbbtoupper(*(unsigned const char *)s2);
|
|---|
| 2827 |
|
|---|
| 2828 | // Next 2 lines won't compile
|
|---|
| 2829 | // *s1 += _mbclen2(*s1);
|
|---|
| 2830 | // *s2 += _mbclen2(*s2);
|
|---|
| 2831 |
|
|---|
| 2832 |
|
|---|
| 2833 | if (*s1 == 0)
|
|---|
| 2834 | break;
|
|---|
| 2835 | if (!CRTDLL__ismbblead(*s1) )
|
|---|
| 2836 | n--;
|
|---|
| 2837 | } while (n > 0);
|
|---|
| 2838 | return 0;
|
|---|
| 2839 | }
|
|---|
| 2840 |
|
|---|
| 2841 |
|
|---|
| 2842 | /*********************************************************************
|
|---|
| 2843 | * _mbsninc (CRTDLL.218)
|
|---|
| 2844 | */
|
|---|
| 2845 | unsigned char * CDECL CRTDLL__mbsninc( const unsigned char *str, size_t n )
|
|---|
| 2846 | {
|
|---|
| 2847 | dprintf(("CRTDLL: _mbsninc\n"));
|
|---|
| 2848 | unsigned char *s = (unsigned char *)str;
|
|---|
| 2849 | while(*s != 0 && n > 0) {
|
|---|
| 2850 | if (!CRTDLL__ismbblead(*s) )
|
|---|
| 2851 | n--;
|
|---|
| 2852 | s++;
|
|---|
| 2853 | }
|
|---|
| 2854 |
|
|---|
| 2855 | return s;
|
|---|
| 2856 | }
|
|---|
| 2857 |
|
|---|
| 2858 |
|
|---|
| 2859 | /*********************************************************************
|
|---|
| 2860 | * _mbsnset (CRTDLL.219)
|
|---|
| 2861 | */
|
|---|
| 2862 | unsigned char * CDECL CRTDLL__mbsnset( unsigned char *src, unsigned int val, size_t count )
|
|---|
| 2863 | {
|
|---|
| 2864 | dprintf(("CRTDLL: _mbsnset\n"));
|
|---|
| 2865 | unsigned char *char_src = (unsigned char *)src;
|
|---|
| 2866 | unsigned short *short_src = (unsigned short *)src;
|
|---|
| 2867 |
|
|---|
| 2868 | if ( _mbclen2(val) == 1 ) {
|
|---|
| 2869 |
|
|---|
| 2870 | while(count > 0) {
|
|---|
| 2871 | *char_src = val;
|
|---|
| 2872 | char_src++;
|
|---|
| 2873 | count--;
|
|---|
| 2874 | }
|
|---|
| 2875 | *char_src = 0;
|
|---|
| 2876 | }
|
|---|
| 2877 | else {
|
|---|
| 2878 | while(count > 0) {
|
|---|
| 2879 | *short_src = val;
|
|---|
| 2880 | short_src++;
|
|---|
| 2881 | count-=2;
|
|---|
| 2882 | }
|
|---|
| 2883 | *short_src = 0;
|
|---|
| 2884 | }
|
|---|
| 2885 |
|
|---|
| 2886 | return src;
|
|---|
| 2887 |
|
|---|
| 2888 | }
|
|---|
| 2889 |
|
|---|
| 2890 |
|
|---|
| 2891 | /*********************************************************************
|
|---|
| 2892 | * _mbspbrk (CRTDLL.220)
|
|---|
| 2893 | */
|
|---|
| 2894 | unsigned char * CDECL CRTDLL__mbspbrk( const unsigned char *s1, const unsigned char *s2 )
|
|---|
| 2895 | {
|
|---|
| 2896 | dprintf(("CRTDLL: _mbspbrk\n"));
|
|---|
| 2897 | const char *scanp;
|
|---|
| 2898 | int c, sc;
|
|---|
| 2899 |
|
|---|
| 2900 | while ((c = *s1++) != 0)
|
|---|
| 2901 | {
|
|---|
| 2902 | for (scanp = (char*)s2; (sc = *scanp++) != 0;)
|
|---|
| 2903 | if (sc == c)
|
|---|
| 2904 | return (unsigned char *)((char *)s1 - (char *)1);
|
|---|
| 2905 | }
|
|---|
| 2906 | return 0;
|
|---|
| 2907 | }
|
|---|
| 2908 |
|
|---|
| 2909 |
|
|---|
| 2910 | /*********************************************************************
|
|---|
| 2911 | * CRTDLL__mbsrchr (CRTDLL.221)
|
|---|
| 2912 | */
|
|---|
| 2913 | LPSTR CDECL CRTDLL__mbsrchr(LPSTR s,CHAR x)
|
|---|
| 2914 | {
|
|---|
| 2915 | dprintf(("CRTDLL: _mbsrchr\n"));
|
|---|
| 2916 | /* FIXME: handle multibyte strings */
|
|---|
| 2917 | return strrchr(s,x);
|
|---|
| 2918 | }
|
|---|
| 2919 |
|
|---|
| 2920 |
|
|---|
| 2921 | /*********************************************************************
|
|---|
| 2922 | * _mbsrev (CRTDLL.222)
|
|---|
| 2923 | */
|
|---|
| 2924 | unsigned char * CDECL CRTDLL__mbsrev( unsigned char *s )
|
|---|
| 2925 | {
|
|---|
| 2926 | dprintf(("CRTDLL: _mbsrev\n"));
|
|---|
| 2927 | unsigned char *e;
|
|---|
| 2928 | unsigned char a;
|
|---|
| 2929 | e=s;
|
|---|
| 2930 | while (*e) {
|
|---|
| 2931 | if ( CRTDLL__ismbblead(*e) ) {
|
|---|
| 2932 | a = *e;
|
|---|
| 2933 | *e = *++e;
|
|---|
| 2934 | if ( *e == 0 )
|
|---|
| 2935 | break;
|
|---|
| 2936 | *e = a;
|
|---|
| 2937 | }
|
|---|
| 2938 | e++;
|
|---|
| 2939 | }
|
|---|
| 2940 | while (s<e) {
|
|---|
| 2941 | a=*s;
|
|---|
| 2942 | *s=*e;
|
|---|
| 2943 | *e=a;
|
|---|
| 2944 | s++;
|
|---|
| 2945 | e--;
|
|---|
| 2946 | }
|
|---|
| 2947 |
|
|---|
| 2948 |
|
|---|
| 2949 | return s;
|
|---|
| 2950 | }
|
|---|
| 2951 |
|
|---|
| 2952 |
|
|---|
| 2953 | /*********************************************************************
|
|---|
| 2954 | * _mbsset (CRTDLL.223)
|
|---|
| 2955 | */
|
|---|
| 2956 | unsigned char * CDECL CRTDLL__mbsset( unsigned char *src, unsigned int c )
|
|---|
| 2957 | {
|
|---|
| 2958 | dprintf(("CRTDLL: _mbsset\n"));
|
|---|
| 2959 | unsigned char *char_src = src;
|
|---|
| 2960 | unsigned short *short_src = (unsigned short*)src;
|
|---|
| 2961 |
|
|---|
| 2962 | if ( _mbclen2(c) == 1 ) {
|
|---|
| 2963 |
|
|---|
| 2964 | while(*char_src != 0) {
|
|---|
| 2965 | *char_src = c;
|
|---|
| 2966 | char_src++;
|
|---|
| 2967 | }
|
|---|
| 2968 | *char_src = 0;
|
|---|
| 2969 | }
|
|---|
| 2970 | else {
|
|---|
| 2971 | while(*short_src != 0) {
|
|---|
| 2972 | *short_src = c;
|
|---|
| 2973 | short_src++;
|
|---|
| 2974 | }
|
|---|
| 2975 | *short_src = 0;
|
|---|
| 2976 | }
|
|---|
| 2977 |
|
|---|
| 2978 | return src;
|
|---|
| 2979 | }
|
|---|
| 2980 |
|
|---|
| 2981 |
|
|---|
| 2982 | /*********************************************************************
|
|---|
| 2983 | * _mbsspn (CRTDLL.224)
|
|---|
| 2984 | */
|
|---|
| 2985 | size_t CDECL CRTDLL__mbsspn( const unsigned char *s1, const unsigned char *s2 )
|
|---|
| 2986 | {
|
|---|
| 2987 | dprintf(("CRTDLL: _mbsspn\n"));
|
|---|
| 2988 | const char *p = (char*)s1, *spanp;
|
|---|
| 2989 | char c, sc;
|
|---|
| 2990 |
|
|---|
| 2991 | cont:
|
|---|
| 2992 | c = *p++;
|
|---|
| 2993 | for (spanp = (char*)s2; (sc = *spanp++) != 0;)
|
|---|
| 2994 | if (sc == c)
|
|---|
| 2995 | goto cont;
|
|---|
| 2996 | return (size_t)(p - 1) - (size_t)s1;
|
|---|
| 2997 | }
|
|---|
| 2998 |
|
|---|
| 2999 |
|
|---|
| 3000 | /*********************************************************************
|
|---|
| 3001 | * _mbsspnp (CRTDLL.225)
|
|---|
| 3002 | */
|
|---|
| 3003 | unsigned char * CDECL CRTDLL__mbsspnp( const unsigned char *s1, const unsigned char *s2 )
|
|---|
| 3004 | {
|
|---|
| 3005 | dprintf(("CRTDLL: _mbsspnp\n"));
|
|---|
| 3006 | const char *p = (char*)s1, *spanp;
|
|---|
| 3007 | char c, sc;
|
|---|
| 3008 |
|
|---|
| 3009 | cont:
|
|---|
| 3010 | c = *p++;
|
|---|
| 3011 | for (spanp = (char*)s2; (sc = *spanp++) != 0;)
|
|---|
| 3012 | if (sc == c)
|
|---|
| 3013 | goto cont;
|
|---|
| 3014 | return (unsigned char*)p;
|
|---|
| 3015 | }
|
|---|
| 3016 |
|
|---|
| 3017 |
|
|---|
| 3018 | /*********************************************************************
|
|---|
| 3019 | * _mbsstr (CRTDLL.226)
|
|---|
| 3020 | */
|
|---|
| 3021 | unsigned char * CDECL CRTDLL__mbsstr( const unsigned char *s1, const unsigned char *s2 )
|
|---|
| 3022 | {
|
|---|
| 3023 | dprintf(("CRTDLL: _mbsstr\n"));
|
|---|
| 3024 | return (unsigned char*)strstr((const char*)s1,(const char*)s2);
|
|---|
| 3025 | }
|
|---|
| 3026 |
|
|---|
| 3027 |
|
|---|
| 3028 | /*********************************************************************
|
|---|
| 3029 | * _mbstok (CRTDLL.227)
|
|---|
| 3030 | */
|
|---|
| 3031 | unsigned char * CDECL CRTDLL__mbstok( unsigned char *s, const unsigned char *delim )
|
|---|
| 3032 | {
|
|---|
| 3033 | dprintf(("CRTDLL: _mbstok\n"));
|
|---|
| 3034 | const char *spanp;
|
|---|
| 3035 | int c, sc;
|
|---|
| 3036 | char *tok;
|
|---|
| 3037 | static char *last;
|
|---|
| 3038 |
|
|---|
| 3039 |
|
|---|
| 3040 | if (s == NULL && (s = (unsigned char*)last) == NULL)
|
|---|
| 3041 | return (NULL);
|
|---|
| 3042 |
|
|---|
| 3043 | /*
|
|---|
| 3044 | * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
|
|---|
| 3045 | */
|
|---|
| 3046 | cont:
|
|---|
| 3047 | c = *s;
|
|---|
| 3048 | s = (unsigned char*)CRTDLL__mbsinc((LPCSTR)s);
|
|---|
| 3049 |
|
|---|
| 3050 | for (spanp = (const char*)delim; (sc = *spanp) != 0; spanp = CRTDLL__mbsinc(spanp)) {
|
|---|
| 3051 | if (c == sc)
|
|---|
| 3052 | goto cont;
|
|---|
| 3053 | }
|
|---|
| 3054 |
|
|---|
| 3055 | if (c == 0) { /* no non-delimiter characters */
|
|---|
| 3056 | last = NULL;
|
|---|
| 3057 | return (NULL);
|
|---|
| 3058 | }
|
|---|
| 3059 | tok = (char*)s - 1;
|
|---|
| 3060 |
|
|---|
| 3061 | /*
|
|---|
| 3062 | * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
|
|---|
| 3063 | * Note that delim must have one NUL; we stop if we see that, too.
|
|---|
| 3064 | */
|
|---|
| 3065 | for (;;) {
|
|---|
| 3066 | c = *s;
|
|---|
| 3067 | s = (unsigned char*)CRTDLL__mbsinc((LPCSTR)s);
|
|---|
| 3068 | spanp = (const char*)delim;
|
|---|
| 3069 | do {
|
|---|
| 3070 | if ((sc = *spanp) == c) {
|
|---|
| 3071 | if (c == 0)
|
|---|
| 3072 | s = NULL;
|
|---|
| 3073 | else
|
|---|
| 3074 | s[-1] = 0;
|
|---|
| 3075 | last = (char*)s;
|
|---|
| 3076 | return ((unsigned char*)tok);
|
|---|
| 3077 | }
|
|---|
| 3078 | spanp = CRTDLL__mbsinc(spanp);
|
|---|
| 3079 | } while (sc != 0);
|
|---|
| 3080 | }
|
|---|
| 3081 | /* NOTREACHED */
|
|---|
| 3082 | }
|
|---|
| 3083 |
|
|---|
| 3084 |
|
|---|
| 3085 | /*********************************************************************
|
|---|
| 3086 | * _mbstrlen (CRTDLL.228)
|
|---|
| 3087 | */
|
|---|
| 3088 | size_t CDECL CRTDLL__mbstrlen(const char *string)
|
|---|
| 3089 | {
|
|---|
| 3090 | dprintf(("CRTDLL: _mbstrlen\n"));
|
|---|
| 3091 | char *s = (char *)string;
|
|---|
| 3092 | size_t i;
|
|---|
| 3093 | while ( *s != 0 ) {
|
|---|
| 3094 | if ( CRTDLL__ismbblead(*s) )
|
|---|
| 3095 | s++;
|
|---|
| 3096 | s++;
|
|---|
| 3097 | i++;
|
|---|
| 3098 | }
|
|---|
| 3099 | return i;
|
|---|
| 3100 | }
|
|---|
| 3101 |
|
|---|
| 3102 |
|
|---|
| 3103 | /*********************************************************************
|
|---|
| 3104 | * _mbsupr (CRTDLL.229)
|
|---|
| 3105 | */
|
|---|
| 3106 | unsigned char * CDECL CRTDLL__mbsupr( unsigned char *x )
|
|---|
| 3107 | {
|
|---|
| 3108 | dprintf(("CRTDLL: _mbsupr\n"));
|
|---|
| 3109 | unsigned char *y=x;
|
|---|
| 3110 | while (*y) {
|
|---|
| 3111 | if (!CRTDLL__ismbblead(*y) )
|
|---|
| 3112 | *y = toupper(*y);
|
|---|
| 3113 | else {
|
|---|
| 3114 | *y=CRTDLL__mbctoupper(*(unsigned short *)y);
|
|---|
| 3115 | y++;
|
|---|
| 3116 | }
|
|---|
| 3117 | }
|
|---|
| 3118 | return x;
|
|---|
| 3119 | }
|
|---|
| 3120 |
|
|---|
| 3121 |
|
|---|
| 3122 | /*********************************************************************
|
|---|
| 3123 | * CRTDLL__memccpy (CRTDLL.230)
|
|---|
| 3124 | */
|
|---|
| 3125 | void * CDECL CRTDLL__memccpy(void *to, const void *from,int c,size_t count)
|
|---|
| 3126 | {
|
|---|
| 3127 | dprintf(("CRTDLL: _memccpy\n"));
|
|---|
| 3128 | memcpy(to,from,count);
|
|---|
| 3129 | return memchr(to,c,count);
|
|---|
| 3130 | }
|
|---|
| 3131 |
|
|---|
| 3132 |
|
|---|
| 3133 | /*********************************************************************
|
|---|
| 3134 | * _mkdir (CRTDLL.232)
|
|---|
| 3135 | */
|
|---|
| 3136 | INT CDECL CRTDLL__mkdir(LPCSTR newdir)
|
|---|
| 3137 | {
|
|---|
| 3138 | dprintf(("CRTDLL: mkdir\n"));
|
|---|
| 3139 | if (!CreateDirectoryA(newdir,NULL))
|
|---|
| 3140 | return -1;
|
|---|
| 3141 | return 0;
|
|---|
| 3142 | }
|
|---|
| 3143 |
|
|---|
| 3144 |
|
|---|
| 3145 | /*********************************************************************
|
|---|
| 3146 | * _mktemp (CRTDLL.233)
|
|---|
| 3147 | */
|
|---|
| 3148 | char * CDECL CRTDLL__mktemp( char * _template )
|
|---|
| 3149 | {
|
|---|
| 3150 | dprintf(("CRTDLL: _mktemp\n"));
|
|---|
| 3151 | static int count = 0;
|
|---|
| 3152 | char *cp, *dp;
|
|---|
| 3153 | int i, len, xcount, loopcnt;
|
|---|
| 3154 |
|
|---|
| 3155 |
|
|---|
| 3156 |
|
|---|
| 3157 | len = strlen (_template);
|
|---|
| 3158 | cp = _template + len;
|
|---|
| 3159 |
|
|---|
| 3160 | xcount = 0;
|
|---|
| 3161 | while (xcount < 6 && cp > _template && cp[-1] == 'X')
|
|---|
| 3162 | xcount++, cp--;
|
|---|
| 3163 |
|
|---|
| 3164 | if (xcount) {
|
|---|
| 3165 | dp = cp;
|
|---|
| 3166 | while (dp > _template && dp[-1] != '/' && dp[-1] != '\\' && dp[-1] != ':')
|
|---|
| 3167 | dp--;
|
|---|
| 3168 |
|
|---|
| 3169 | /* Keep the first characters of the template, but turn the rest into
|
|---|
| 3170 | Xs. */
|
|---|
| 3171 | while (cp > dp + 8 - xcount) {
|
|---|
| 3172 | *--cp = 'X';
|
|---|
| 3173 | xcount = (xcount >= 6) ? 6 : 1 + xcount;
|
|---|
| 3174 | }
|
|---|
| 3175 |
|
|---|
| 3176 | /* If dots occur too early -- squash them. */
|
|---|
| 3177 | while (dp < cp) {
|
|---|
| 3178 | if (*dp == '.') *dp = 'a';
|
|---|
| 3179 | dp++;
|
|---|
| 3180 | }
|
|---|
| 3181 |
|
|---|
| 3182 | /* Try to add ".tmp" to the filename. Truncate unused Xs. */
|
|---|
| 3183 | if (cp + xcount + 3 < _template + len)
|
|---|
| 3184 | strcpy (cp + xcount, ".tmp");
|
|---|
| 3185 | else
|
|---|
| 3186 | cp[xcount] = 0;
|
|---|
| 3187 |
|
|---|
| 3188 | for (loopcnt = 0; loopcnt < (1 << (5 * xcount)); loopcnt++) {
|
|---|
| 3189 | int c = count++;
|
|---|
| 3190 | for (i = 0; i < xcount; i++, c >>= 5)
|
|---|
| 3191 | cp[i] = "abcdefghijklmnopqrstuvwxyz012345"[c & 0x1f];
|
|---|
| 3192 | if (CRTDLL__access(_template,0) == -1)
|
|---|
| 3193 | return _template;
|
|---|
| 3194 | }
|
|---|
| 3195 | }
|
|---|
| 3196 | /* Failure: truncate the template and return NULL. */
|
|---|
| 3197 | *_template = 0;
|
|---|
| 3198 | return 0;
|
|---|
| 3199 | }
|
|---|
| 3200 |
|
|---|
| 3201 |
|
|---|
| 3202 | /*********************************************************************
|
|---|
| 3203 | * _msize (CRTDLL.234)
|
|---|
| 3204 | */
|
|---|
| 3205 | size_t CDECL CRTDLL__msize( void *ptr )
|
|---|
| 3206 | {
|
|---|
| 3207 | dprintf(("CRTDLL: _msize\n"));
|
|---|
| 3208 | return (_msize(ptr));
|
|---|
| 3209 | }
|
|---|
| 3210 |
|
|---|
| 3211 |
|
|---|
| 3212 | /*********************************************************************
|
|---|
| 3213 | * _nextafter (CRTDLL.235)
|
|---|
| 3214 | */
|
|---|
| 3215 | double CDECL CRTDLL__nextafter( double x, double y )
|
|---|
| 3216 | {
|
|---|
| 3217 | dprintf(("CRTDLL: _nextafter\n"));
|
|---|
| 3218 | if ( x == y)
|
|---|
| 3219 | return x;
|
|---|
| 3220 | if ( CRTDLL__isnan(x) || CRTDLL__isnan(y) )
|
|---|
| 3221 | return x;
|
|---|
| 3222 |
|
|---|
| 3223 | return x;
|
|---|
| 3224 | }
|
|---|
| 3225 |
|
|---|
| 3226 |
|
|---|
| 3227 | /*********************************************************************
|
|---|
| 3228 | * _onexit (CRTDLL.236)
|
|---|
| 3229 | */
|
|---|
| 3230 | onexit_t CDECL CRTDLL__onexit(onexit_t t)
|
|---|
| 3231 | {
|
|---|
| 3232 | dprintf(("CRTDLL: _onexit\n"));
|
|---|
| 3233 | return (_onexit(t));
|
|---|
| 3234 | }
|
|---|
| 3235 |
|
|---|
| 3236 |
|
|---|
| 3237 | /*********************************************************************
|
|---|
| 3238 | * _open (CRTDLL.237)
|
|---|
| 3239 | */
|
|---|
| 3240 | HFILE CDECL CRTDLL__open(LPCSTR path,INT flags)
|
|---|
| 3241 | {
|
|---|
| 3242 | dprintf(("CRTDLL: _open\n"));
|
|---|
| 3243 | DWORD access = 0, creation = 0;
|
|---|
| 3244 | HFILE ret;
|
|---|
| 3245 |
|
|---|
| 3246 | switch(flags & 3)
|
|---|
| 3247 | {
|
|---|
| 3248 | case O_RDONLY: access |= GENERIC_READ; break;
|
|---|
| 3249 | case O_WRONLY: access |= GENERIC_WRITE; break;
|
|---|
| 3250 | case O_RDWR: access |= GENERIC_WRITE | GENERIC_READ; break;
|
|---|
| 3251 | }
|
|---|
| 3252 |
|
|---|
| 3253 | if (flags & 0x0100) /* O_CREAT */
|
|---|
| 3254 | {
|
|---|
| 3255 | if (flags & 0x0400) /* O_EXCL */
|
|---|
| 3256 | creation = CREATE_NEW;
|
|---|
| 3257 | else if (flags & 0x0200) /* O_TRUNC */
|
|---|
| 3258 | creation = CREATE_ALWAYS;
|
|---|
| 3259 | else
|
|---|
| 3260 | creation = OPEN_ALWAYS;
|
|---|
| 3261 | }
|
|---|
| 3262 | else /* no O_CREAT */
|
|---|
| 3263 | {
|
|---|
| 3264 | if (flags & 0x0200) /* O_TRUNC */
|
|---|
| 3265 | creation = TRUNCATE_EXISTING;
|
|---|
| 3266 | else
|
|---|
| 3267 | creation = OPEN_EXISTING;
|
|---|
| 3268 | }
|
|---|
| 3269 | if (flags & 0x0008) /* O_APPEND */
|
|---|
| 3270 | dprintf(("O_APPEND not supported\n" ));
|
|---|
| 3271 | if (flags & 0xf0f4)
|
|---|
| 3272 | dprintf(("CRTDLL_open file unsupported flags 0x%04x\n",flags));
|
|---|
| 3273 | /* End Fixme */
|
|---|
| 3274 |
|
|---|
| 3275 | ret = CreateFileA( path, access, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
|---|
| 3276 | NULL, creation, FILE_ATTRIBUTE_NORMAL, -1 );
|
|---|
| 3277 | dprintf(("CRTDLL_open file %s mode 0x%04x got handle %d\n", path,flags,ret));
|
|---|
| 3278 | return ret;
|
|---|
| 3279 | }
|
|---|
| 3280 |
|
|---|
| 3281 |
|
|---|
| 3282 | /*********************************************************************
|
|---|
| 3283 | * _open_osfhandle (CRTDLL.238)
|
|---|
| 3284 | */
|
|---|
| 3285 | INT CDECL CRTDLL__open_osfhandle( long osfhandle, int flags )
|
|---|
| 3286 | {
|
|---|
| 3287 | dprintf(("CRTDLL: _open_osfhandle\n"));
|
|---|
| 3288 | HFILE handle;
|
|---|
| 3289 |
|
|---|
| 3290 | switch (osfhandle) {
|
|---|
| 3291 | case STD_INPUT_HANDLE :
|
|---|
| 3292 | case 0 :
|
|---|
| 3293 | handle=0;
|
|---|
| 3294 | break;
|
|---|
| 3295 | case STD_OUTPUT_HANDLE:
|
|---|
| 3296 | case 1:
|
|---|
| 3297 | handle=1;
|
|---|
| 3298 | break;
|
|---|
| 3299 | case STD_ERROR_HANDLE:
|
|---|
| 3300 | case 2:
|
|---|
| 3301 | handle=2;
|
|---|
| 3302 | break;
|
|---|
| 3303 | default:
|
|---|
| 3304 | return (-1);
|
|---|
| 3305 | }
|
|---|
| 3306 | dprintf(("(handle %08lx,flags %d) return %d\n",
|
|---|
| 3307 | osfhandle,flags,handle));
|
|---|
| 3308 | return handle;
|
|---|
| 3309 | }
|
|---|
| 3310 |
|
|---|
| 3311 |
|
|---|
| 3312 | /*********************************************************************
|
|---|
| 3313 | * _pclose (CRTDLL.244)
|
|---|
| 3314 | */
|
|---|
| 3315 | INT CDECL CRTDLL__pclose( FILE *fp )
|
|---|
| 3316 | {
|
|---|
| 3317 | dprintf(("CRTDLL: _pclose not implemented.\n"));
|
|---|
| 3318 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 3319 | return FALSE;
|
|---|
| 3320 | }
|
|---|
| 3321 |
|
|---|
| 3322 |
|
|---|
| 3323 | /*********************************************************************
|
|---|
| 3324 | * _pipe (CRTDLL.247)
|
|---|
| 3325 | */
|
|---|
| 3326 | INT CDECL CRTDLL__pipe( int *phandles, unsigned psize, int textmode )
|
|---|
| 3327 | {
|
|---|
| 3328 | dprintf(("CRTDLL: _pipe not implemented.\n"));
|
|---|
| 3329 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 3330 | return FALSE;
|
|---|
| 3331 | }
|
|---|
| 3332 |
|
|---|
| 3333 |
|
|---|
| 3334 | /*********************************************************************
|
|---|
| 3335 | * _popen (CRTDLL.248)
|
|---|
| 3336 | */
|
|---|
| 3337 | FILE * CDECL CRTDLL__popen( const char *command, const char *mode )
|
|---|
| 3338 | {
|
|---|
| 3339 | dprintf(("CRTDLL: _popen not implemented.\n"));
|
|---|
| 3340 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 3341 | return FALSE;
|
|---|
| 3342 | }
|
|---|
| 3343 |
|
|---|
| 3344 |
|
|---|
| 3345 | /*********************************************************************
|
|---|
| 3346 | * _purecall (CRTDLL.249)
|
|---|
| 3347 | */
|
|---|
| 3348 | void CDECL CRTDLL__purecall(void)
|
|---|
| 3349 | {
|
|---|
| 3350 | dprintf(("CRTDLL: _purecall\n"));
|
|---|
| 3351 | }
|
|---|
| 3352 |
|
|---|
| 3353 |
|
|---|
| 3354 | /*********************************************************************
|
|---|
| 3355 | * _putch (CRTDLL.250)
|
|---|
| 3356 | */
|
|---|
| 3357 | INT CDECL CRTDLL__putch( int i )
|
|---|
| 3358 | {
|
|---|
| 3359 | dprintf(("CRTDLL: _putch\n"));
|
|---|
| 3360 | return (_putch(i));
|
|---|
| 3361 | }
|
|---|
| 3362 |
|
|---|
| 3363 |
|
|---|
| 3364 | /*********************************************************************
|
|---|
| 3365 | * _putenv (CRTDLL.251)
|
|---|
| 3366 | */
|
|---|
| 3367 | INT CDECL CRTDLL__putenv(const char *s)
|
|---|
| 3368 | {
|
|---|
| 3369 | dprintf(("CRTDLL: _putenv\n"));
|
|---|
| 3370 | return (_putenv(s));
|
|---|
| 3371 | }
|
|---|
| 3372 |
|
|---|
| 3373 |
|
|---|
| 3374 | /*********************************************************************
|
|---|
| 3375 | * _putw (CRTDLL.252)
|
|---|
| 3376 | */
|
|---|
| 3377 | INT CDECL CRTDLL__putw( int w, FILE *stream )
|
|---|
| 3378 | {
|
|---|
| 3379 | dprintf(("CRTDLL: _putw\n"));
|
|---|
| 3380 | if (fwrite( &w, sizeof(w), 1, stream) < 1)
|
|---|
| 3381 | return(EOF);
|
|---|
| 3382 | return(0);
|
|---|
| 3383 | }
|
|---|
| 3384 |
|
|---|
| 3385 |
|
|---|
| 3386 | /*********************************************************************
|
|---|
| 3387 | * _read (CRTDLL.254)
|
|---|
| 3388 | */
|
|---|
| 3389 | INT CDECL CRTDLL__read(INT fd, LPVOID buf, UINT count)
|
|---|
| 3390 | {
|
|---|
| 3391 | dprintf(("CRTDLL: _read not implemented.\n"));
|
|---|
| 3392 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 3393 | return FALSE;
|
|---|
| 3394 | }
|
|---|
| 3395 |
|
|---|
| 3396 |
|
|---|
| 3397 | /*********************************************************************
|
|---|
| 3398 | * _rmdir (CRTDLL.255)
|
|---|
| 3399 | */
|
|---|
| 3400 | INT CDECL CRTDLL__rmdir(const char *path)
|
|---|
| 3401 | {
|
|---|
| 3402 | dprintf(("CRTDLL: _rmdir\n"));
|
|---|
| 3403 | if (!RemoveDirectoryA(path))
|
|---|
| 3404 | return -1;
|
|---|
| 3405 | return 0;
|
|---|
| 3406 | }
|
|---|
| 3407 |
|
|---|
| 3408 |
|
|---|
| 3409 | /*********************************************************************
|
|---|
| 3410 | * _rmtmp (CRTDLL.256)
|
|---|
| 3411 | */
|
|---|
| 3412 | INT CDECL CRTDLL__rmtmp(void)
|
|---|
| 3413 | {
|
|---|
| 3414 | dprintf(("CRTDLL: _rmtmp\n"));
|
|---|
| 3415 | return(_rmtmp());
|
|---|
| 3416 | }
|
|---|
| 3417 |
|
|---|
| 3418 |
|
|---|
| 3419 | /*********************************************************************
|
|---|
| 3420 | * CRTDLL__rotl (CRTDLL.257)
|
|---|
| 3421 | */
|
|---|
| 3422 | unsigned int CDECL CRTDLL__rotl( unsigned int value, unsigned int shift )
|
|---|
| 3423 | {
|
|---|
| 3424 | dprintf(("CRTDLL: _rotl\n"));
|
|---|
| 3425 | return (_rotl(value, shift));
|
|---|
| 3426 | }
|
|---|
| 3427 |
|
|---|
| 3428 |
|
|---|
| 3429 | /*********************************************************************
|
|---|
| 3430 | * CRTDLL__rotr (CRTDLL.258)
|
|---|
| 3431 | */
|
|---|
| 3432 | unsigned int CDECL CRTDLL__rotr( unsigned int value, unsigned int shift )
|
|---|
| 3433 | {
|
|---|
| 3434 | dprintf(("CRTDLL: _rotr\n"));
|
|---|
| 3435 | return (_rotr(value, shift));
|
|---|
| 3436 | }
|
|---|
| 3437 |
|
|---|
| 3438 |
|
|---|
| 3439 | /*********************************************************************
|
|---|
| 3440 | * _scalb (CRTDLL.259)
|
|---|
| 3441 | */
|
|---|
| 3442 | double CDECL CRTDLL__scalb( double __x, long e )
|
|---|
| 3443 | {
|
|---|
| 3444 | dprintf(("CRTDLL: _scalb\n"));
|
|---|
| 3445 | double_t *x = (double_t *)&__x;
|
|---|
| 3446 |
|
|---|
| 3447 | x->exponent += e;
|
|---|
| 3448 |
|
|---|
| 3449 | return __x;
|
|---|
| 3450 | }
|
|---|
| 3451 |
|
|---|
| 3452 |
|
|---|
| 3453 | /*********************************************************************
|
|---|
| 3454 | * CRTDLL__searchenv (CRTDLL.260)
|
|---|
| 3455 | */
|
|---|
| 3456 | void CDECL CRTDLL__searchenv(const char *file,const char *var,char *path )
|
|---|
| 3457 | {
|
|---|
| 3458 | dprintf(("CRTDLL: _searchenv\n"));
|
|---|
| 3459 | char *env = CRTDLL_getenv(var);
|
|---|
| 3460 |
|
|---|
| 3461 | char *x;
|
|---|
| 3462 | char *y;
|
|---|
| 3463 | char *FilePart;
|
|---|
| 3464 | x = strchr(env,'=');
|
|---|
| 3465 | if ( x != NULL ) {
|
|---|
| 3466 | *x = 0;
|
|---|
| 3467 | x++;
|
|---|
| 3468 | }
|
|---|
| 3469 | y = strchr(env,';');
|
|---|
| 3470 | while ( y != NULL ) {
|
|---|
| 3471 | *y = 0;
|
|---|
| 3472 | if ( SearchPathA(x,file,NULL,MAX_PATH,path,&FilePart) > 0 ) {
|
|---|
| 3473 | return;
|
|---|
| 3474 | }
|
|---|
| 3475 | x = y+1;
|
|---|
| 3476 | y = strchr(env,';');
|
|---|
| 3477 | }
|
|---|
| 3478 | return;
|
|---|
| 3479 | }
|
|---|
| 3480 |
|
|---|
| 3481 |
|
|---|
| 3482 | /*********************************************************************
|
|---|
| 3483 | * CRTDLL__seterrormode (CRTDLL.261)
|
|---|
| 3484 | */
|
|---|
| 3485 | void CDECL CRTDLL__seterrormode(int i)
|
|---|
| 3486 | {
|
|---|
| 3487 | dprintf(("CRTDLL: _seterrormode\n"));
|
|---|
| 3488 | SetErrorMode(i);
|
|---|
| 3489 | return;
|
|---|
| 3490 | }
|
|---|
| 3491 |
|
|---|
| 3492 |
|
|---|
| 3493 | /*********************************************************************
|
|---|
| 3494 | * CRTDLL__setjmp (CRTDLL.262)
|
|---|
| 3495 | */
|
|---|
| 3496 | int CDECL CRTDLL__setjmp( jmp_buf env )
|
|---|
| 3497 | {
|
|---|
| 3498 | dprintf(("CRTDLL: _setjmp -> setjmp (NOT IDENTICAL!!!)\n"));
|
|---|
| 3499 | return(setjmp( env));
|
|---|
| 3500 | }
|
|---|
| 3501 |
|
|---|
| 3502 | /*********************************************************************
|
|---|
| 3503 | * CRTDLL__setjmp3 (CRTDLL.262)
|
|---|
| 3504 | */
|
|---|
| 3505 | int CDECL CRTDLL__setjmp3( jmp_buf env )
|
|---|
| 3506 | {
|
|---|
| 3507 | dprintf(("CRTDLL: _setjmp3 -> setjmp (NOT IDENTICAL!!!)\n"));
|
|---|
| 3508 | return(setjmp( env));
|
|---|
| 3509 | }
|
|---|
| 3510 |
|
|---|
| 3511 |
|
|---|
| 3512 | /*********************************************************************
|
|---|
| 3513 | * _setmode (CRTDLL.263)
|
|---|
| 3514 | */
|
|---|
| 3515 | INT CDECL CRTDLL__setmode( INT fh,INT mode)
|
|---|
| 3516 | {
|
|---|
| 3517 | dprintf(("CRTDLL: _setmode\n"));
|
|---|
| 3518 | return (_setmode(fh, mode));
|
|---|
| 3519 | }
|
|---|
| 3520 |
|
|---|
| 3521 |
|
|---|
| 3522 | /*********************************************************************
|
|---|
| 3523 | * _setsystime (CRTDLL.264)
|
|---|
| 3524 | */
|
|---|
| 3525 | unsigned int CDECL CRTDLL__setsystime(struct tm *tp, unsigned int ms)
|
|---|
| 3526 | {
|
|---|
| 3527 | dprintf(("CRTDLL: _setsystime not implemented.\n"));
|
|---|
| 3528 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 3529 | return FALSE;
|
|---|
| 3530 | }
|
|---|
| 3531 |
|
|---|
| 3532 |
|
|---|
| 3533 | /*********************************************************************
|
|---|
| 3534 | * _sleep (CRTDLL.265)
|
|---|
| 3535 | */
|
|---|
| 3536 | VOID CDECL CRTDLL__sleep(unsigned long timeout)
|
|---|
| 3537 | {
|
|---|
| 3538 | dprintf(("CRTDLL__sleep for %ld milliseconds\n",timeout));
|
|---|
| 3539 | Sleep((timeout)?timeout:1);
|
|---|
| 3540 | }
|
|---|
| 3541 |
|
|---|
| 3542 |
|
|---|
| 3543 | /*********************************************************************
|
|---|
| 3544 | * _sopen (CRTDLL.268)
|
|---|
| 3545 | */
|
|---|
| 3546 | int CDECL CRTDLL__sopen( const char *s, int i1, int i2, ... )
|
|---|
| 3547 | {
|
|---|
| 3548 | dprintf(("CRTDLL: _sopen not implemented.\n"));
|
|---|
| 3549 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 3550 | return FALSE;
|
|---|
| 3551 | }
|
|---|
| 3552 |
|
|---|
| 3553 |
|
|---|
| 3554 | /*********************************************************************
|
|---|
| 3555 | * CRTDLL__spawnl (CRTDLL.269)
|
|---|
| 3556 | */
|
|---|
| 3557 | int CDECL CRTDLL__spawnl(int nMode, const char* szPath, const char* szArgv0,...)
|
|---|
| 3558 | {
|
|---|
| 3559 | dprintf(("CRTDLL: _spawnl\n"));
|
|---|
| 3560 | char *szArg[100];
|
|---|
| 3561 | const char *a;
|
|---|
| 3562 | int i = 0;
|
|---|
| 3563 | va_list l = 0;
|
|---|
| 3564 | va_start(l,szArgv0);
|
|---|
| 3565 | do {
|
|---|
| 3566 | a = va_arg(l,const char *);
|
|---|
| 3567 | szArg[i++] = (char *)a;
|
|---|
| 3568 | } while ( a != NULL && i < 100 );
|
|---|
| 3569 |
|
|---|
| 3570 | return _spawnve(nMode, (char*)szPath, szArg, _environ);
|
|---|
| 3571 | }
|
|---|
| 3572 |
|
|---|
| 3573 |
|
|---|
| 3574 | /*********************************************************************
|
|---|
| 3575 | * CRTDLL__spawnle (CRTDLL.270)
|
|---|
| 3576 | */
|
|---|
| 3577 | int CDECL CRTDLL__spawnle( int mode, char *path, char **szArgv0, ... )
|
|---|
| 3578 | {
|
|---|
| 3579 | dprintf(("CRTDLL: _spawnle not correct implemented.\n"));
|
|---|
| 3580 | char *szArg[100];
|
|---|
| 3581 | char *a;
|
|---|
| 3582 | char *ptr;
|
|---|
| 3583 | int i = 0;
|
|---|
| 3584 | va_list l = 0;
|
|---|
| 3585 | va_start(l,szArgv0);
|
|---|
| 3586 | do {
|
|---|
| 3587 | a = (char*)va_arg(l,const char *);
|
|---|
| 3588 | szArg[i++] = (char *)a;
|
|---|
| 3589 | } while ( a != NULL && i < 100 );
|
|---|
| 3590 |
|
|---|
| 3591 |
|
|---|
| 3592 | // szArg0 is passed and not environment if there is only one parameter;
|
|---|
| 3593 |
|
|---|
| 3594 | if ( i >=2 ) {
|
|---|
| 3595 | ptr = szArg[i-2];
|
|---|
| 3596 | szArg[i-2] = NULL;
|
|---|
| 3597 | }
|
|---|
| 3598 | else
|
|---|
| 3599 | ptr = NULL;
|
|---|
| 3600 |
|
|---|
| 3601 | return _spawnve(mode, path, szArg, (char**)ptr);
|
|---|
| 3602 | }
|
|---|
| 3603 |
|
|---|
| 3604 |
|
|---|
| 3605 | /*********************************************************************
|
|---|
| 3606 | * CRTDLL__spawnlp (CRTDLL.271)
|
|---|
| 3607 | */
|
|---|
| 3608 | int CDECL CRTDLL__spawnlp(int nMode, const char* szPath, const char* szArgv0, ...)
|
|---|
| 3609 | {
|
|---|
| 3610 | dprintf(("CRTDLL: _spawnlp\n"));
|
|---|
| 3611 | char *szArg[100];
|
|---|
| 3612 | const char *a;
|
|---|
| 3613 | int i = 0;
|
|---|
| 3614 | va_list l = 0;
|
|---|
| 3615 | va_start(l,szArgv0);
|
|---|
| 3616 | do {
|
|---|
| 3617 | a = (const char *)va_arg(l,const char *);
|
|---|
| 3618 | szArg[i++] = (char *)a;
|
|---|
| 3619 | } while ( a != NULL && i < 100 );
|
|---|
| 3620 | return _spawnvpe(nMode, (char*)szPath,szArg, _environ);
|
|---|
| 3621 | }
|
|---|
| 3622 |
|
|---|
| 3623 |
|
|---|
| 3624 | /*********************************************************************
|
|---|
| 3625 | * CRTDLL__spawnlpe (CRTDLL.272)
|
|---|
| 3626 | */
|
|---|
| 3627 | int CDECL CRTDLL__spawnlpe( int mode, char *path, char *szArgv0, ... )
|
|---|
| 3628 | {
|
|---|
| 3629 | dprintf(("CRTDLL: _spawnlpe not correct implemented.\n"));
|
|---|
| 3630 | char *szArg[100];
|
|---|
| 3631 | const char *a;
|
|---|
| 3632 | char *ptr;
|
|---|
| 3633 | int i = 0;
|
|---|
| 3634 | va_list l = 0;
|
|---|
| 3635 | va_start(l,szArgv0);
|
|---|
| 3636 | do {
|
|---|
| 3637 | a = (char *)va_arg(l,const char *);
|
|---|
| 3638 | szArg[i++] = (char *)a;
|
|---|
| 3639 | } while ( a != NULL && i < 100 );
|
|---|
| 3640 |
|
|---|
| 3641 |
|
|---|
| 3642 | // szArg0 is passed and not environment if there is only one parameter;
|
|---|
| 3643 |
|
|---|
| 3644 | if ( i >=2 ) {
|
|---|
| 3645 | ptr = szArg[i-2];
|
|---|
| 3646 | szArg[i-2] = NULL;
|
|---|
| 3647 | }
|
|---|
| 3648 | else
|
|---|
| 3649 | ptr = NULL;
|
|---|
| 3650 |
|
|---|
| 3651 | return _spawnvpe(mode, path, szArg, (char**)ptr);
|
|---|
| 3652 | }
|
|---|
| 3653 |
|
|---|
| 3654 |
|
|---|
| 3655 | /*********************************************************************
|
|---|
| 3656 | * CRTDLL__spawnv (CRTDLL.273)
|
|---|
| 3657 | */
|
|---|
| 3658 | int CDECL CRTDLL__spawnv( int i, char *s1, char ** s2 )
|
|---|
| 3659 | {
|
|---|
| 3660 | dprintf(("CRTDLL: _spawnv\n"));
|
|---|
| 3661 | return (_spawnv(i, s1, s2));
|
|---|
| 3662 | }
|
|---|
| 3663 |
|
|---|
| 3664 |
|
|---|
| 3665 | /*********************************************************************
|
|---|
| 3666 | * CRTDLL__spawnve (CRTDLL.274)
|
|---|
| 3667 | */
|
|---|
| 3668 | int CDECL CRTDLL__spawnve( int i, char *s1, char ** s2, char ** s3 )
|
|---|
| 3669 | {
|
|---|
| 3670 | dprintf(("CRTDLL: _spawnve\n"));
|
|---|
| 3671 | return (_spawnve(i, s1, s2, s3));
|
|---|
| 3672 | }
|
|---|
| 3673 |
|
|---|
| 3674 |
|
|---|
| 3675 | /*********************************************************************
|
|---|
| 3676 | * CRTDLL__spawnvp (CRTDLL.275)
|
|---|
| 3677 | */
|
|---|
| 3678 | int CDECL CRTDLL__spawnvp( int i, char *s1, char ** s2 )
|
|---|
| 3679 | {
|
|---|
| 3680 | dprintf(("CRTDLL: _spawnvp\n"));
|
|---|
| 3681 | return (_spawnvp(i, s1, s2));
|
|---|
| 3682 | }
|
|---|
| 3683 |
|
|---|
| 3684 | /*********************************************************************
|
|---|
| 3685 | * CRTDLL__spawnv (CRTDLL.276)
|
|---|
| 3686 | */
|
|---|
| 3687 | int CDECL CRTDLL__spawnvpe( int i, char *s1, char ** s2, char ** s3 )
|
|---|
| 3688 | {
|
|---|
| 3689 | dprintf(("CRTDLL: _spawnvpe\n"));
|
|---|
| 3690 | return (_spawnvpe(i, s1, s2, s3));
|
|---|
| 3691 | }
|
|---|
| 3692 |
|
|---|
| 3693 |
|
|---|
| 3694 | /*********************************************************************
|
|---|
| 3695 | * CRTDLL__stat (CRTDLL.278)
|
|---|
| 3696 | */
|
|---|
| 3697 | int CDECL CRTDLL__stat( const char *s1, struct stat * n )
|
|---|
| 3698 | {
|
|---|
| 3699 | dprintf(("CRTDLL: _stat\n"));
|
|---|
| 3700 | return(_stat(s1, n));
|
|---|
| 3701 | }
|
|---|
| 3702 |
|
|---|
| 3703 |
|
|---|
| 3704 | /*********************************************************************
|
|---|
| 3705 | * CRTDLL__statusfp (CRTDLL.279)
|
|---|
| 3706 | */
|
|---|
| 3707 | unsigned int CDECL CRTDLL__statusfp( void )
|
|---|
| 3708 | {
|
|---|
| 3709 | dprintf(("CRTDLL: _statusfp\n"));
|
|---|
| 3710 | return (_status87());
|
|---|
| 3711 | }
|
|---|
| 3712 |
|
|---|
| 3713 |
|
|---|
| 3714 | /*********************************************************************
|
|---|
| 3715 | * CRTDLL__strdate (CRTDLL.281)
|
|---|
| 3716 | */
|
|---|
| 3717 | char * CDECL CRTDLL__strdate( char *buf )
|
|---|
| 3718 | {
|
|---|
| 3719 | dprintf(("CRTDLL: _strdate\n"));
|
|---|
| 3720 | return(_strdate(buf));
|
|---|
| 3721 | }
|
|---|
| 3722 |
|
|---|
| 3723 |
|
|---|
| 3724 | /*********************************************************************
|
|---|
| 3725 | * CRTDLL__strdec (CRTDLL.282)
|
|---|
| 3726 | */
|
|---|
| 3727 | char * CDECL CRTDLL__strdec( const char *, const char *p )
|
|---|
| 3728 | {
|
|---|
| 3729 | dprintf(("CRTDLL: _strdec\n"));
|
|---|
| 3730 | return( (char *)(p-1) );
|
|---|
| 3731 | }
|
|---|
| 3732 |
|
|---|
| 3733 |
|
|---|
| 3734 | /*********************************************************************
|
|---|
| 3735 | * CRTDLL__strdup (CRTDLL.283)
|
|---|
| 3736 | */
|
|---|
| 3737 | LPSTR CDECL CRTDLL__strdup(LPCSTR ptr)
|
|---|
| 3738 | {
|
|---|
| 3739 | dprintf(("CRTDLL: _strdup\n"));
|
|---|
| 3740 | return HEAP_strdupA(GetProcessHeap(),0,ptr);
|
|---|
| 3741 | }
|
|---|
| 3742 |
|
|---|
| 3743 |
|
|---|
| 3744 | /*********************************************************************
|
|---|
| 3745 | * _strerror (CRTDLL.284)
|
|---|
| 3746 | */
|
|---|
| 3747 | char * CDECL CRTDLL__strerror(const char *s)
|
|---|
| 3748 | {
|
|---|
| 3749 | dprintf(("CRTDLL: _strerror not implemented\n"));
|
|---|
| 3750 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 3751 | return FALSE;
|
|---|
| 3752 | // return (_strerror(s));
|
|---|
| 3753 | }
|
|---|
| 3754 |
|
|---|
| 3755 |
|
|---|
| 3756 | /*********************************************************************
|
|---|
| 3757 | * CRTDLL__stricoll (CRTDLL.286)
|
|---|
| 3758 | */
|
|---|
| 3759 | int CDECL CRTDLL__stricoll( const char *s1, const char *s2 )
|
|---|
| 3760 | {
|
|---|
| 3761 | dprintf(("CRTDLL: _stricoll\n"));
|
|---|
| 3762 | return stricmp(s1,s2);
|
|---|
| 3763 | }
|
|---|
| 3764 |
|
|---|
| 3765 |
|
|---|
| 3766 | /*********************************************************************
|
|---|
| 3767 | * CRTDLL__strinc (CRTDLL.287)
|
|---|
| 3768 | */
|
|---|
| 3769 | char * CDECL CRTDLL__strinc( const char *p )
|
|---|
| 3770 | {
|
|---|
| 3771 | dprintf(("CRTDLL: _strinc\n"));
|
|---|
| 3772 | return( (char *)(p+1) );
|
|---|
| 3773 | }
|
|---|
| 3774 |
|
|---|
| 3775 |
|
|---|
| 3776 | /*********************************************************************
|
|---|
| 3777 | * CRTDLL__strncnt (CRTDLL.289)
|
|---|
| 3778 | */
|
|---|
| 3779 | size_t CDECL CRTDLL__strncnt( const char *p, size_t l )
|
|---|
| 3780 | {
|
|---|
| 3781 | dprintf(("CRTDLL: _strncnt\n"));
|
|---|
| 3782 | size_t i;
|
|---|
| 3783 | i = strlen(p);
|
|---|
| 3784 | return( (i>l) ? l : i );
|
|---|
| 3785 | }
|
|---|
| 3786 |
|
|---|
| 3787 | /*********************************************************************
|
|---|
| 3788 | * CRTDLL__strnextc (CRTDLL.290)
|
|---|
| 3789 | */
|
|---|
| 3790 | unsigned int CDECL CRTDLL__strnextc( const char *p )
|
|---|
| 3791 | {
|
|---|
| 3792 | dprintf(("CRTDLL: _strnextc\n"));
|
|---|
| 3793 | return( (unsigned int)*p );
|
|---|
| 3794 | }
|
|---|
| 3795 |
|
|---|
| 3796 |
|
|---|
| 3797 | /*********************************************************************
|
|---|
| 3798 | * CRTDLL__strninc (CRTDLL.292)
|
|---|
| 3799 | */
|
|---|
| 3800 | char * CDECL CRTDLL__strninc( const char *p, size_t l )
|
|---|
| 3801 | {
|
|---|
| 3802 | dprintf(("CRTDLL: _strninc\n"));
|
|---|
| 3803 | return( (char *)(p+l) );
|
|---|
| 3804 | }
|
|---|
| 3805 |
|
|---|
| 3806 |
|
|---|
| 3807 | /*********************************************************************
|
|---|
| 3808 | * CRTDLL__strnset (CRTDLL.293)
|
|---|
| 3809 | */
|
|---|
| 3810 | char * CDECL CRTDLL__strnset(char* szToFill, int szFill, size_t sizeMaxFill)
|
|---|
| 3811 | {
|
|---|
| 3812 | dprintf(("CRTDLL: _strnset\n"));
|
|---|
| 3813 | char *t = szToFill;
|
|---|
| 3814 | int i = 0;
|
|---|
| 3815 | while( *szToFill != 0 && i < sizeMaxFill)
|
|---|
| 3816 | {
|
|---|
| 3817 | *szToFill = szFill;
|
|---|
| 3818 | szToFill++;
|
|---|
| 3819 | i++;
|
|---|
| 3820 | }
|
|---|
| 3821 | return t;
|
|---|
| 3822 | }
|
|---|
| 3823 |
|
|---|
| 3824 |
|
|---|
| 3825 | /*********************************************************************
|
|---|
| 3826 | * CRTDLL__strrev (CRTDLL.294)
|
|---|
| 3827 | */
|
|---|
| 3828 | char * CDECL CRTDLL__strrev( char *s )
|
|---|
| 3829 | {
|
|---|
| 3830 | dprintf(("CRTDLL: _strrev\n"));
|
|---|
| 3831 | char *e;
|
|---|
| 3832 | char a;
|
|---|
| 3833 | e=s;
|
|---|
| 3834 | while (*e)
|
|---|
| 3835 | e++;
|
|---|
| 3836 | while (s<e) {
|
|---|
| 3837 | a=*s;
|
|---|
| 3838 | *s=*e;
|
|---|
| 3839 | *e=a;
|
|---|
| 3840 | s++;
|
|---|
| 3841 | e--;
|
|---|
| 3842 | }
|
|---|
| 3843 | return s;
|
|---|
| 3844 | }
|
|---|
| 3845 |
|
|---|
| 3846 |
|
|---|
| 3847 | /*********************************************************************
|
|---|
| 3848 | * CRTDLL__strset (CRTDLL.295)
|
|---|
| 3849 | */
|
|---|
| 3850 | char * CDECL CRTDLL__strset(char* szToFill, int szFill)
|
|---|
| 3851 | {
|
|---|
| 3852 | dprintf(("CRTDLL: _strset\n"));
|
|---|
| 3853 | char *t = szToFill;
|
|---|
| 3854 | while( *szToFill != 0 )
|
|---|
| 3855 | {
|
|---|
| 3856 | *szToFill = szFill;
|
|---|
| 3857 | szToFill++;
|
|---|
| 3858 | }
|
|---|
| 3859 | return t;
|
|---|
| 3860 | }
|
|---|
| 3861 |
|
|---|
| 3862 |
|
|---|
| 3863 | /*********************************************************************
|
|---|
| 3864 | * CRTDLL__strspnp (CRTDLL.296)
|
|---|
| 3865 | */
|
|---|
| 3866 | char * CDECL CRTDLL__strspnp( const char *p1, const char *p2 )
|
|---|
| 3867 | {
|
|---|
| 3868 | dprintf(("CRTDLL: _strspnp\n"));
|
|---|
| 3869 | return( (*(p1 += strspn(p1,p2))!='\0') ? (char*)p1 : NULL );
|
|---|
| 3870 | }
|
|---|
| 3871 |
|
|---|
| 3872 |
|
|---|
| 3873 | /*********************************************************************
|
|---|
| 3874 | * CRTDLL__strtime (CRTDLL.297)
|
|---|
| 3875 | */
|
|---|
| 3876 | char * CDECL CRTDLL__strtime( char *buf )
|
|---|
| 3877 | {
|
|---|
| 3878 | dprintf(("CRTDLL: _strtime\n"));
|
|---|
| 3879 | return (_strtime(buf));
|
|---|
| 3880 | }
|
|---|
| 3881 |
|
|---|
| 3882 |
|
|---|
| 3883 | /*********************************************************************
|
|---|
| 3884 | * CRTDLL__swab (CRTDLL.299)
|
|---|
| 3885 | */
|
|---|
| 3886 | void CDECL CRTDLL__swab(char *s1, char *s2, int i)
|
|---|
| 3887 | {
|
|---|
| 3888 | dprintf(("CRTDLL: _swab\n"));
|
|---|
| 3889 | _swab(s1, s2, i);
|
|---|
| 3890 | }
|
|---|
| 3891 |
|
|---|
| 3892 |
|
|---|
| 3893 | /*********************************************************************
|
|---|
| 3894 | * CRTDLL__tell (CRTDLL.302)
|
|---|
| 3895 | */
|
|---|
| 3896 | long CDECL CRTDLL__tell( int i )
|
|---|
| 3897 | {
|
|---|
| 3898 | dprintf(("CRTDLL: _tell\n"));
|
|---|
| 3899 | return (_tell(i));
|
|---|
| 3900 | }
|
|---|
| 3901 |
|
|---|
| 3902 |
|
|---|
| 3903 | /*********************************************************************
|
|---|
| 3904 | * CRTDLL__tempnam (CRTDLL.303)
|
|---|
| 3905 | */
|
|---|
| 3906 | char * CDECL CRTDLL__tempnam( char *dir, char *prefix )
|
|---|
| 3907 | {
|
|---|
| 3908 | dprintf(("CRTDLL: _tempnam\n"));
|
|---|
| 3909 | return (_tempnam(dir, prefix));
|
|---|
| 3910 | }
|
|---|
| 3911 |
|
|---|
| 3912 |
|
|---|
| 3913 | /*********************************************************************
|
|---|
| 3914 | * CRTDLL__tolower (CRTDLL.305)
|
|---|
| 3915 | */
|
|---|
| 3916 | int CDECL CRTDLL__tolower(int n)
|
|---|
| 3917 | {
|
|---|
| 3918 | dprintf(("CRTDLL: _tolower\n"));
|
|---|
| 3919 | return (_tolower(n));
|
|---|
| 3920 | }
|
|---|
| 3921 |
|
|---|
| 3922 |
|
|---|
| 3923 | /*********************************************************************
|
|---|
| 3924 | * CRTDLL__toupper (CRTDLL.306)
|
|---|
| 3925 | */
|
|---|
| 3926 | int CDECL CRTDLL__toupper(int n)
|
|---|
| 3927 | {
|
|---|
| 3928 | dprintf(("CRTDLL: _toupper\n"));
|
|---|
| 3929 | return (_toupper(n));
|
|---|
| 3930 | }
|
|---|
| 3931 |
|
|---|
| 3932 |
|
|---|
| 3933 | /*********************************************************************
|
|---|
| 3934 | * _tzset (CRTDLL.308)
|
|---|
| 3935 | */
|
|---|
| 3936 | void CDECL CRTDLL__tzset( void )
|
|---|
| 3937 | {
|
|---|
| 3938 | dprintf(("CRTDLL: _tzset not implemented.\n"));
|
|---|
| 3939 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 3940 | }
|
|---|
| 3941 |
|
|---|
| 3942 |
|
|---|
| 3943 | /*********************************************************************
|
|---|
| 3944 | * CRTDLL__umask (CRTDLL.310)
|
|---|
| 3945 | */
|
|---|
| 3946 | int CDECL CRTDLL__umask( int i )
|
|---|
| 3947 | {
|
|---|
| 3948 | dprintf(("CRTDLL: _umask\n"));
|
|---|
| 3949 | return (_umask(i));
|
|---|
| 3950 | }
|
|---|
| 3951 |
|
|---|
| 3952 |
|
|---|
| 3953 | /*********************************************************************
|
|---|
| 3954 | * CRTDLL__ungetch (CRTDLL.311)
|
|---|
| 3955 | */
|
|---|
| 3956 | int CDECL CRTDLL__ungetch( int i )
|
|---|
| 3957 | {
|
|---|
| 3958 | dprintf(("CRTDLL: _ungetch\n"));
|
|---|
| 3959 | return (_ungetch(i));
|
|---|
| 3960 | }
|
|---|
| 3961 |
|
|---|
| 3962 |
|
|---|
| 3963 | /*********************************************************************
|
|---|
| 3964 | * _unlink (CRTDLL.312)
|
|---|
| 3965 | */
|
|---|
| 3966 | INT CDECL CRTDLL__unlink(LPCSTR pathname)
|
|---|
| 3967 | {
|
|---|
| 3968 | dprintf(("CRTDLL: _unlink\n"));
|
|---|
| 3969 | int ret=0;
|
|---|
| 3970 | DOS_FULL_NAME full_name;
|
|---|
| 3971 |
|
|---|
| 3972 | if (!DOSFS_GetFullName( pathname, FALSE, (CHAR*)&full_name )) {
|
|---|
| 3973 | dprintf(("CRTDLL_unlink file %s bad name\n",pathname));
|
|---|
| 3974 | return EOF;
|
|---|
| 3975 | }
|
|---|
| 3976 |
|
|---|
| 3977 | ret=unlink(full_name.long_name);
|
|---|
| 3978 | dprintf(("(%s unix %s)\n",
|
|---|
| 3979 | pathname,full_name.long_name));
|
|---|
| 3980 | if(ret)
|
|---|
| 3981 | dprintf((" Failed!\n"));
|
|---|
| 3982 |
|
|---|
| 3983 | return ret;
|
|---|
| 3984 | }
|
|---|
| 3985 |
|
|---|
| 3986 |
|
|---|
| 3987 | /*********************************************************************
|
|---|
| 3988 | * CRTDLL__unloaddll (CRTDLL.313)
|
|---|
| 3989 | */
|
|---|
| 3990 | int CDECL CRTDLL__unloaddll(void *handle)
|
|---|
| 3991 | {
|
|---|
| 3992 | dprintf(("CRTDLL: _unloaddll\n"));
|
|---|
| 3993 | return FreeLibrary((HMODULE)handle);
|
|---|
| 3994 | }
|
|---|
| 3995 |
|
|---|
| 3996 |
|
|---|
| 3997 | /*********************************************************************
|
|---|
| 3998 | * CRTDLL__utime (CRTDLL.314)
|
|---|
| 3999 | */
|
|---|
| 4000 | int CDECL CRTDLL__utime( char *path, struct utimbuf * times )
|
|---|
| 4001 | {
|
|---|
| 4002 | dprintf(("CRTDLL: _utime\n"));
|
|---|
| 4003 | return (_utime(path, times));
|
|---|
| 4004 | }
|
|---|
| 4005 |
|
|---|
| 4006 |
|
|---|
| 4007 | /*********************************************************************
|
|---|
| 4008 | * CRTDLL__vsnwprintf (CRTDLL.316)
|
|---|
| 4009 | */
|
|---|
| 4010 | int CDECL CRTDLL__vsnwprintf( wchar_t *s1, size_t n, const wchar_t *s2, va_list arg )
|
|---|
| 4011 | {
|
|---|
| 4012 | dprintf(("CRTDLL: _vsnwprintf not implemented.\n"));
|
|---|
| 4013 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 4014 | return FALSE;
|
|---|
| 4015 | }
|
|---|
| 4016 |
|
|---|
| 4017 |
|
|---|
| 4018 | /*********************************************************************
|
|---|
| 4019 | * CRTDLL__wcsdup (CRTDLL.317)
|
|---|
| 4020 | */
|
|---|
| 4021 | LPWSTR CDECL CRTDLL__wcsdup( LPCWSTR str )
|
|---|
| 4022 | {
|
|---|
| 4023 | dprintf(("CRTDLL: _wcsdup\n"));
|
|---|
| 4024 | LPWSTR ret = NULL;
|
|---|
| 4025 | if (str)
|
|---|
| 4026 | {
|
|---|
| 4027 | int size = (wcslen((const wchar_t*)str) + 1) * sizeof(WCHAR);
|
|---|
| 4028 | // FIXME ret = CRTDLL_malloc( size );
|
|---|
| 4029 | if (ret) memcpy( ret, str, size );
|
|---|
| 4030 | }
|
|---|
| 4031 | return ret;
|
|---|
| 4032 | }
|
|---|
| 4033 |
|
|---|
| 4034 |
|
|---|
| 4035 | /*********************************************************************
|
|---|
| 4036 | * CRTDLL__wcsicoll (CRTDLL.319)
|
|---|
| 4037 | */
|
|---|
| 4038 | int CDECL CRTDLL__wcsicoll( LPCWSTR str1, LPCWSTR str2 )
|
|---|
| 4039 | {
|
|---|
| 4040 | dprintf(("CRTDLL: _wcsicoll\n"));
|
|---|
| 4041 | return CRTDLL__wcsicmp( str1, str2 );
|
|---|
| 4042 | }
|
|---|
| 4043 |
|
|---|
| 4044 |
|
|---|
| 4045 | /*********************************************************************
|
|---|
| 4046 | * CRTDLL__wcsnset (CRTDLL.322)
|
|---|
| 4047 | */
|
|---|
| 4048 | LPWSTR CDECL CRTDLL__wcsnset( LPWSTR str, WCHAR c, INT n )
|
|---|
| 4049 | {
|
|---|
| 4050 | dprintf(("CRTDLL: _wcsnset\n"));
|
|---|
| 4051 | LPWSTR ret = str;
|
|---|
| 4052 | while ((n-- > 0) && *str) *str++ = c;
|
|---|
| 4053 | return ret;
|
|---|
| 4054 | }
|
|---|
| 4055 |
|
|---|
| 4056 |
|
|---|
| 4057 | /*********************************************************************
|
|---|
| 4058 | * CRTDLL__wcsrev (CRTDLL.323)
|
|---|
| 4059 | */
|
|---|
| 4060 | LPWSTR CDECL CRTDLL__wcsrev( LPWSTR str )
|
|---|
| 4061 | {
|
|---|
| 4062 | dprintf(("CRTDLL: _wcsrev\n"));
|
|---|
| 4063 | LPWSTR ret = str;
|
|---|
| 4064 | LPWSTR end = str + wcslen((const wchar_t*)str) - 1;
|
|---|
| 4065 | while (end > str)
|
|---|
| 4066 | {
|
|---|
| 4067 | WCHAR t = *end;
|
|---|
| 4068 | *end-- = *str;
|
|---|
| 4069 | *str++ = t;
|
|---|
| 4070 | }
|
|---|
| 4071 | return ret;
|
|---|
| 4072 | }
|
|---|
| 4073 |
|
|---|
| 4074 |
|
|---|
| 4075 | /*********************************************************************
|
|---|
| 4076 | * CRTDLL__wcsset (CRTDLL.324)
|
|---|
| 4077 | */
|
|---|
| 4078 | LPWSTR CDECL CRTDLL__wcsset( LPWSTR str, WCHAR c )
|
|---|
| 4079 | {
|
|---|
| 4080 | dprintf(("CRTDLL: _wcsset\n"));
|
|---|
| 4081 | LPWSTR ret = str;
|
|---|
| 4082 | while (*str) *str++ = c;
|
|---|
| 4083 | return ret;
|
|---|
| 4084 | }
|
|---|
| 4085 |
|
|---|
| 4086 |
|
|---|
| 4087 | /*********************************************************************
|
|---|
| 4088 | * _write (CRTDLL.329)
|
|---|
| 4089 | */
|
|---|
| 4090 | INT CDECL CRTDLL__write(INT fd,LPCVOID buf,UINT count)
|
|---|
| 4091 | {
|
|---|
| 4092 | dprintf(("CRTDLL: _write\n"));
|
|---|
| 4093 | INT len=0;
|
|---|
| 4094 |
|
|---|
| 4095 | if (fd == -1)
|
|---|
| 4096 | len = -1;
|
|---|
| 4097 | else if (fd<=2)
|
|---|
| 4098 | len = (UINT)write(fd,buf,(LONG)count);
|
|---|
| 4099 | else
|
|---|
| 4100 | len = _lwrite(fd,(LPCSTR)buf,count);
|
|---|
| 4101 | dprintf(("%d/%d byte to dfh %d from %p,\n",
|
|---|
| 4102 | len,count,fd,buf));
|
|---|
| 4103 | return len;
|
|---|
| 4104 | }
|
|---|
| 4105 |
|
|---|
| 4106 |
|
|---|
| 4107 | /*********************************************************************
|
|---|
| 4108 | * _y0 (CRTDLL.332)
|
|---|
| 4109 | */
|
|---|
| 4110 | double CDECL CRTDLL__y0(double x)
|
|---|
| 4111 | {
|
|---|
| 4112 | dprintf(("CRTDLL: _y0\n"));
|
|---|
| 4113 | return (_y0(x));
|
|---|
| 4114 | }
|
|---|
| 4115 |
|
|---|
| 4116 |
|
|---|
| 4117 | /*********************************************************************
|
|---|
| 4118 | * _y1 (CRTDLL.333)
|
|---|
| 4119 | */
|
|---|
| 4120 | double CDECL CRTDLL__y1(double x)
|
|---|
| 4121 | {
|
|---|
| 4122 | dprintf(("CRTDLL: _y1\n"));
|
|---|
| 4123 | return (_y1(x));
|
|---|
| 4124 | }
|
|---|
| 4125 |
|
|---|
| 4126 |
|
|---|
| 4127 | /*********************************************************************
|
|---|
| 4128 | * _yn (CRTDLL.334)
|
|---|
| 4129 | */
|
|---|
| 4130 | double CDECL CRTDLL__yn(int i, double x)
|
|---|
| 4131 | {
|
|---|
| 4132 | dprintf(("CRTDLL: _yn\n"));
|
|---|
| 4133 | return (_yn(i, x));
|
|---|
| 4134 | }
|
|---|
| 4135 |
|
|---|
| 4136 |
|
|---|
| 4137 | /*********************************************************************
|
|---|
| 4138 | * isleadbyte (CRTDLL.335)
|
|---|
| 4139 | */
|
|---|
| 4140 | void CDECL CRTDLL_abort( void )
|
|---|
| 4141 | {
|
|---|
| 4142 | dprintf(("CRTDLL: abort\n"));
|
|---|
| 4143 | abort();
|
|---|
| 4144 | }
|
|---|
| 4145 |
|
|---|
| 4146 |
|
|---|
| 4147 | /*********************************************************************
|
|---|
| 4148 | * acos (CRTDLL.336)
|
|---|
| 4149 | */
|
|---|
| 4150 | double CDECL CRTDLL_acos( double x )
|
|---|
| 4151 | {
|
|---|
| 4152 | dprintf(("CRTDLL: acos\n"));
|
|---|
| 4153 | return (acos(x));
|
|---|
| 4154 | }
|
|---|
| 4155 |
|
|---|
| 4156 |
|
|---|
| 4157 | /*********************************************************************
|
|---|
| 4158 | * asctime (CRTDLL.338)
|
|---|
| 4159 | */
|
|---|
| 4160 | char * CDECL CRTDLL_asctime( const struct tm *timeptr )
|
|---|
| 4161 | {
|
|---|
| 4162 | dprintf(("CRTDLL: asctime\n"));
|
|---|
| 4163 | return (asctime(timeptr));
|
|---|
| 4164 | }
|
|---|
| 4165 |
|
|---|
| 4166 |
|
|---|
| 4167 | /*********************************************************************
|
|---|
| 4168 | * asin (CRTDLL.339)
|
|---|
| 4169 | */
|
|---|
| 4170 | double CDECL CRTDLL_asin( double x )
|
|---|
| 4171 | {
|
|---|
| 4172 | dprintf(("CRTDLL: asin\n"));
|
|---|
| 4173 | return (asin(x));
|
|---|
| 4174 | }
|
|---|
| 4175 |
|
|---|
| 4176 |
|
|---|
| 4177 | /*********************************************************************
|
|---|
| 4178 | * atan2 (CRTDLL.341)
|
|---|
| 4179 | */
|
|---|
| 4180 | double CDECL CRTDLL_atan2( double y, double x )
|
|---|
| 4181 | {
|
|---|
| 4182 | dprintf(("CRTDLL: atan2\n"));
|
|---|
| 4183 | return (atan2(y, x));
|
|---|
| 4184 | }
|
|---|
| 4185 |
|
|---|
| 4186 |
|
|---|
| 4187 | /*********************************************************************
|
|---|
| 4188 | * atexit (CRTDLL.342)
|
|---|
| 4189 | */
|
|---|
| 4190 | int CDECL CRTDLL_atexit( register void ( *func )( void ) )
|
|---|
| 4191 | {
|
|---|
| 4192 | dprintf(("CRTDLL: atexit not implemented.\n"));
|
|---|
| 4193 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 4194 | return FALSE;
|
|---|
| 4195 | }
|
|---|
| 4196 |
|
|---|
| 4197 |
|
|---|
| 4198 | /*********************************************************************
|
|---|
| 4199 | * atof (CRTDLL.343)
|
|---|
| 4200 | */
|
|---|
| 4201 | double CDECL CRTDLL_atof( const char *nptr )
|
|---|
| 4202 | {
|
|---|
| 4203 | dprintf(("CRTDLL: atof\n"));
|
|---|
| 4204 | return (atof(nptr));
|
|---|
| 4205 | }
|
|---|
| 4206 |
|
|---|
| 4207 | /*********************************************************************
|
|---|
| 4208 | * calloc (CRTDLL.347)
|
|---|
| 4209 | */
|
|---|
| 4210 | void * CDECL CRTDLL_calloc( size_t n, size_t size )
|
|---|
| 4211 | {
|
|---|
| 4212 | // dprintf(("CRTDLL: calloc\n"));
|
|---|
| 4213 | return Heap_Alloc(size*n);
|
|---|
| 4214 | }
|
|---|
| 4215 |
|
|---|
| 4216 |
|
|---|
| 4217 | /*********************************************************************
|
|---|
| 4218 | * clearerr (CRTDLL.349)
|
|---|
| 4219 | */
|
|---|
| 4220 | void CDECL CRTDLL_clearerr( FILE *fp )
|
|---|
| 4221 | {
|
|---|
| 4222 | dprintf(("CRTDLL: clearerr\n"));
|
|---|
| 4223 | clearerr(fp);
|
|---|
| 4224 | }
|
|---|
| 4225 |
|
|---|
| 4226 |
|
|---|
| 4227 | /*********************************************************************
|
|---|
| 4228 | * clock (CRTDLL.350)
|
|---|
| 4229 | */
|
|---|
| 4230 | clock_t CDECL CRTDLL_clock( void )
|
|---|
| 4231 | {
|
|---|
| 4232 | dprintf(("CRTDLL: clock\n"));
|
|---|
| 4233 | return (clock());
|
|---|
| 4234 | }
|
|---|
| 4235 |
|
|---|
| 4236 |
|
|---|
| 4237 | /*********************************************************************
|
|---|
| 4238 | * cosh (CRTDLL.352)
|
|---|
| 4239 | */
|
|---|
| 4240 | double CDECL CRTDLL_cosh( double x )
|
|---|
| 4241 | {
|
|---|
| 4242 | dprintf(("CRTDLL: cosh\n"));
|
|---|
| 4243 | return (cosh(x));
|
|---|
| 4244 | }
|
|---|
| 4245 |
|
|---|
| 4246 |
|
|---|
| 4247 | /*********************************************************************
|
|---|
| 4248 | * ctime (CRTDLL.353)
|
|---|
| 4249 | */
|
|---|
| 4250 | char * CDECL CRTDLL_ctime( const time_t *timer )
|
|---|
| 4251 | {
|
|---|
| 4252 | dprintf(("CRTDLL: ctime\n"));
|
|---|
| 4253 | return (ctime(timer));
|
|---|
| 4254 | }
|
|---|
| 4255 |
|
|---|
| 4256 |
|
|---|
| 4257 | /*********************************************************************
|
|---|
| 4258 | * difftime (CRTDLL.354)
|
|---|
| 4259 | */
|
|---|
| 4260 | double CDECL CRTDLL_difftime( time_t t1, time_t t0 )
|
|---|
| 4261 | {
|
|---|
| 4262 | dprintf(("CRTDLL: difftime\n"));
|
|---|
| 4263 | return (difftime(t1, t0));
|
|---|
| 4264 | }
|
|---|
| 4265 |
|
|---|
| 4266 |
|
|---|
| 4267 | /*********************************************************************
|
|---|
| 4268 | * div (CRTDLL.355)
|
|---|
| 4269 | */
|
|---|
| 4270 | div_t CDECL CRTDLL_div( int numer, int denom )
|
|---|
| 4271 | {
|
|---|
| 4272 | dprintf(("CRTDLL: div\n"));
|
|---|
| 4273 | return (div(numer, denom));
|
|---|
| 4274 | }
|
|---|
| 4275 |
|
|---|
| 4276 |
|
|---|
| 4277 | /*********************************************************************
|
|---|
| 4278 | * exit (CRTDLL.356)
|
|---|
| 4279 | */
|
|---|
| 4280 | void CDECL CRTDLL_exit(DWORD ret)
|
|---|
| 4281 | {
|
|---|
| 4282 | dprintf(("CRTDLL: exit\n"));
|
|---|
| 4283 | ExitProcess(ret);
|
|---|
| 4284 | }
|
|---|
| 4285 |
|
|---|
| 4286 |
|
|---|
| 4287 | /*********************************************************************
|
|---|
| 4288 | * exp (CRTDLL.357)
|
|---|
| 4289 | */
|
|---|
| 4290 | double CDECL CRTDLL_exp( double x )
|
|---|
| 4291 | {
|
|---|
| 4292 | dprintf(("CRTDLL: exp\n"));
|
|---|
| 4293 | return (exp(x));
|
|---|
| 4294 | }
|
|---|
| 4295 |
|
|---|
| 4296 |
|
|---|
| 4297 | /*********************************************************************
|
|---|
| 4298 | * fclose (CRTDLL.359)
|
|---|
| 4299 | */
|
|---|
| 4300 | int CDECL CRTDLL_fclose( FILE *fp )
|
|---|
| 4301 | {
|
|---|
| 4302 | dprintf(("CRTDLL: fclose\n"));
|
|---|
| 4303 | return (fclose(fp));
|
|---|
| 4304 | }
|
|---|
| 4305 |
|
|---|
| 4306 |
|
|---|
| 4307 | /*********************************************************************
|
|---|
| 4308 | * feof (CRTDLL.360)
|
|---|
| 4309 | */
|
|---|
| 4310 | int CDECL CRTDLL_feof( FILE *fp )
|
|---|
| 4311 | {
|
|---|
| 4312 | dprintf(("CRTDLL: feof\n"));
|
|---|
| 4313 | return (feof(fp));
|
|---|
| 4314 | }
|
|---|
| 4315 |
|
|---|
| 4316 |
|
|---|
| 4317 | /*********************************************************************
|
|---|
| 4318 | * ferror (CRTDLL.361)
|
|---|
| 4319 | */
|
|---|
| 4320 | int CDECL CRTDLL_ferror( FILE *fp )
|
|---|
| 4321 | {
|
|---|
| 4322 | dprintf(("CRTDLL: ferror\n"));
|
|---|
| 4323 | return (ferror(fp));
|
|---|
| 4324 | }
|
|---|
| 4325 |
|
|---|
| 4326 |
|
|---|
| 4327 | /*********************************************************************
|
|---|
| 4328 | * fflush (CRTDLL.362)
|
|---|
| 4329 | */
|
|---|
| 4330 | int CDECL CRTDLL_fflush( FILE *fp )
|
|---|
| 4331 | {
|
|---|
| 4332 | dprintf(("CRTDLL: fflush\n"));
|
|---|
| 4333 | return (fflush(fp));
|
|---|
| 4334 | }
|
|---|
| 4335 |
|
|---|
| 4336 |
|
|---|
| 4337 | /*********************************************************************
|
|---|
| 4338 | * fgetc (CRTDLL.363)
|
|---|
| 4339 | */
|
|---|
| 4340 | int CDECL CRTDLL_fgetc( FILE *fp )
|
|---|
| 4341 | {
|
|---|
| 4342 | dprintf(("CRTDLL: fgetc\n"));
|
|---|
| 4343 | return (fgetc(fp));
|
|---|
| 4344 | }
|
|---|
| 4345 |
|
|---|
| 4346 |
|
|---|
| 4347 | /*********************************************************************
|
|---|
| 4348 | * fgetpos (CRTDLL.364)
|
|---|
| 4349 | */
|
|---|
| 4350 | int CDECL CRTDLL_fgetpos( FILE *fp, fpos_t *pos )
|
|---|
| 4351 | {
|
|---|
| 4352 | dprintf(("CRTDLL: fgetpos\n"));
|
|---|
| 4353 | return (fgetpos(fp, pos));
|
|---|
| 4354 | }
|
|---|
| 4355 |
|
|---|
| 4356 |
|
|---|
| 4357 | /*********************************************************************
|
|---|
| 4358 | * fgets (CRTDLL.365)
|
|---|
| 4359 | */
|
|---|
| 4360 | char * CDECL CRTDLL_fgets( char *s, int n, FILE *fp )
|
|---|
| 4361 | {
|
|---|
| 4362 | dprintf(("CRTDLL: fgets\n"));
|
|---|
| 4363 | return (fgets(s, n, fp));
|
|---|
| 4364 | }
|
|---|
| 4365 |
|
|---|
| 4366 |
|
|---|
| 4367 | /*********************************************************************
|
|---|
| 4368 | * fgetwc (CRTDLL.366)
|
|---|
| 4369 | */
|
|---|
| 4370 | wint_t CDECL CRTDLL_fgetwc( FILE *f )
|
|---|
| 4371 | {
|
|---|
| 4372 | dprintf(("CRTDLL: fgetwc\n"));
|
|---|
| 4373 | return (fgetwc(f));
|
|---|
| 4374 | }
|
|---|
| 4375 |
|
|---|
| 4376 |
|
|---|
| 4377 | /*********************************************************************
|
|---|
| 4378 | * fmod (CRTDLL.368)
|
|---|
| 4379 | */
|
|---|
| 4380 | double CDECL CRTDLL_fmod(double x, double y )
|
|---|
| 4381 | {
|
|---|
| 4382 | dprintf(("CRTDLL: fmod\n"));
|
|---|
| 4383 | return (fmod(x,y));
|
|---|
| 4384 | }
|
|---|
| 4385 |
|
|---|
| 4386 |
|
|---|
| 4387 | /*********************************************************************
|
|---|
| 4388 | * fopen (CRTDLL.369)
|
|---|
| 4389 | */
|
|---|
| 4390 | FILE * CDECL CRTDLL_fopen( const char *filename, const char *mode )
|
|---|
| 4391 | {
|
|---|
| 4392 | dprintf(("CRTDLL: fopen\n"));
|
|---|
| 4393 | return (fopen( filename, mode));
|
|---|
| 4394 | }
|
|---|
| 4395 |
|
|---|
| 4396 |
|
|---|
| 4397 | /*********************************************************************
|
|---|
| 4398 | * fprintf (CRTDLL.370)
|
|---|
| 4399 | */
|
|---|
| 4400 | INT CDECL CRTDLL_fprintf( CRTDLL_FILE *file, LPSTR format, ... )
|
|---|
| 4401 | {
|
|---|
| 4402 | dprintf(("CRTDLL: fprintf\n"));
|
|---|
| 4403 | va_list valist;
|
|---|
| 4404 | INT res;
|
|---|
| 4405 |
|
|---|
| 4406 | va_start( valist, format );
|
|---|
| 4407 | res = CRTDLL_vfprintf( file, format, valist );
|
|---|
| 4408 | va_end( valist );
|
|---|
| 4409 | return res;
|
|---|
| 4410 | }
|
|---|
| 4411 |
|
|---|
| 4412 |
|
|---|
| 4413 | /*********************************************************************
|
|---|
| 4414 | * fputc (CRTDLL.371)
|
|---|
| 4415 | */
|
|---|
| 4416 | int CDECL CRTDLL_fputc( int c, FILE *fp )
|
|---|
| 4417 | {
|
|---|
| 4418 | dprintf(("CRTDLL: fputc\n"));
|
|---|
| 4419 | return (fputc(c, fp));
|
|---|
| 4420 | }
|
|---|
| 4421 |
|
|---|
| 4422 |
|
|---|
| 4423 | /*********************************************************************
|
|---|
| 4424 | * fputs (CRTDLL.372)
|
|---|
| 4425 | */
|
|---|
| 4426 | int CDECL CRTDLL_fputs( const char *s, FILE *fp )
|
|---|
| 4427 | {
|
|---|
| 4428 | dprintf(("CRTDLL: fputs\n"));
|
|---|
| 4429 | return (fputs(s, fp));
|
|---|
| 4430 | }
|
|---|
| 4431 |
|
|---|
| 4432 |
|
|---|
| 4433 | /*********************************************************************
|
|---|
| 4434 | * fputwc (CRTDLL.373)
|
|---|
| 4435 | */
|
|---|
| 4436 | wint_t CDECL CRTDLL_fputwc( wint_t wc, FILE *strm )
|
|---|
| 4437 | {
|
|---|
| 4438 | dprintf(("CRTDLL: fputwc\n"));
|
|---|
| 4439 | return (fputwc(wc, strm));
|
|---|
| 4440 | }
|
|---|
| 4441 |
|
|---|
| 4442 |
|
|---|
| 4443 | /*********************************************************************
|
|---|
| 4444 | * fread (CRTDLL.374)
|
|---|
| 4445 | */
|
|---|
| 4446 | size_t CDECL CRTDLL_fread( void *ptr, size_t size, size_t n, FILE *fp )
|
|---|
| 4447 | {
|
|---|
| 4448 | // dprintf(("CRTDLL: fread\n"));
|
|---|
| 4449 | return (fread(ptr, size, n, fp));
|
|---|
| 4450 | }
|
|---|
| 4451 |
|
|---|
| 4452 |
|
|---|
| 4453 | /*********************************************************************
|
|---|
| 4454 | * free (CRTDLL.375)
|
|---|
| 4455 | */
|
|---|
| 4456 | VOID CDECL CRTDLL_free(LPVOID ptr)
|
|---|
| 4457 | {
|
|---|
| 4458 | // dprintf(("CRTDLL: free\n"));
|
|---|
| 4459 | Heap_Free(ptr);
|
|---|
| 4460 | }
|
|---|
| 4461 |
|
|---|
| 4462 |
|
|---|
| 4463 | /*********************************************************************
|
|---|
| 4464 | * freopen (CRTDLL.376)
|
|---|
| 4465 | */
|
|---|
| 4466 | FILE * CDECL CRTDLL_freopen( const char *filename, const char *mode, FILE *fp )
|
|---|
| 4467 | {
|
|---|
| 4468 | dprintf(("CRTDLL: freopen\n"));
|
|---|
| 4469 | return (freopen(filename, mode, fp));
|
|---|
| 4470 | }
|
|---|
| 4471 |
|
|---|
| 4472 |
|
|---|
| 4473 | /*********************************************************************
|
|---|
| 4474 | * frexp (CRTDLL.377)
|
|---|
| 4475 | */
|
|---|
| 4476 | double CDECL CRTDLL_frexp( double value, int *exp )
|
|---|
| 4477 | {
|
|---|
| 4478 | dprintf(("CRTDLL: frexp\n"));
|
|---|
| 4479 | return (frexp(value, exp));
|
|---|
| 4480 | }
|
|---|
| 4481 |
|
|---|
| 4482 |
|
|---|
| 4483 | /*********************************************************************
|
|---|
| 4484 | * fscanf (CRTDLL.378)
|
|---|
| 4485 | */
|
|---|
| 4486 | int CDECL CRTDLL_fscanf( FILE*fp, const char *format, ... )
|
|---|
| 4487 | {
|
|---|
| 4488 | dprintf(("CRTDLL: fscanf\n"));
|
|---|
| 4489 | #if 0
|
|---|
| 4490 | va_list valist;
|
|---|
| 4491 | INT res;
|
|---|
| 4492 |
|
|---|
| 4493 | va_start( valist, format );
|
|---|
| 4494 | #ifdef HAVE_VFSCANF
|
|---|
| 4495 | res = vfscanf( xlat_file_ptr(stream), format, valist );
|
|---|
| 4496 | #endif
|
|---|
| 4497 | va_end( valist );
|
|---|
| 4498 | return res;
|
|---|
| 4499 | #endif
|
|---|
| 4500 | dprintf(("broken\n"));
|
|---|
| 4501 | return 0;
|
|---|
| 4502 | }
|
|---|
| 4503 |
|
|---|
| 4504 |
|
|---|
| 4505 | /*********************************************************************
|
|---|
| 4506 | * fseek (CRTDLL.379)
|
|---|
| 4507 | */
|
|---|
| 4508 | int CDECL CRTDLL_fseek( FILE *file, long int offset, int whence )
|
|---|
| 4509 | {
|
|---|
| 4510 | dprintf(("CRTDLL: fseek\n"));
|
|---|
| 4511 | dprintf(("file %p to 0x%08lx pos %s\n",
|
|---|
| 4512 | file,offset,(whence==SEEK_SET)?"SEEK_SET":
|
|---|
| 4513 | (whence==SEEK_CUR)?"SEEK_CUR":
|
|---|
| 4514 | (whence==SEEK_END)?"SEEK_END":"UNKNOWN"));
|
|---|
| 4515 | // FIXME if (SetFilePointer( file->handle, offset, NULL, whence ) != 0xffffffff)
|
|---|
| 4516 | // FIXME return 0;
|
|---|
| 4517 | dprintf((" failed!\n"));
|
|---|
| 4518 | return -1;
|
|---|
| 4519 | }
|
|---|
| 4520 |
|
|---|
| 4521 |
|
|---|
| 4522 | /*********************************************************************
|
|---|
| 4523 | * fsetpos (CRTDLL.380)
|
|---|
| 4524 | */
|
|---|
| 4525 | int CDECL CRTDLL_fsetpos( FILE *fp, const fpos_t *pos )
|
|---|
| 4526 | {
|
|---|
| 4527 | dprintf(("CRTDLL: fsetpos\n"));
|
|---|
| 4528 | return (fsetpos(fp, pos));
|
|---|
| 4529 | }
|
|---|
| 4530 |
|
|---|
| 4531 |
|
|---|
| 4532 | /*********************************************************************
|
|---|
| 4533 | * ftell (CRTDLL.381)
|
|---|
| 4534 | */
|
|---|
| 4535 | long int CDECL CRTDLL_ftell( FILE *fp )
|
|---|
| 4536 | {
|
|---|
| 4537 | dprintf(("CRTDLL: ftell\n"));
|
|---|
| 4538 | return (ftell(fp));
|
|---|
| 4539 | }
|
|---|
| 4540 |
|
|---|
| 4541 |
|
|---|
| 4542 | /*********************************************************************
|
|---|
| 4543 | * fwprintf (CRTDLL.382)
|
|---|
| 4544 | */
|
|---|
| 4545 | int CDECL CRTDLL_fwprintf( FILE *iop, const wchar_t *fmt, ... )
|
|---|
| 4546 | {
|
|---|
| 4547 | dprintf(("CRTDLL: fwprintf not implemented.\n"));
|
|---|
| 4548 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 4549 | return FALSE;
|
|---|
| 4550 | }
|
|---|
| 4551 |
|
|---|
| 4552 |
|
|---|
| 4553 | /*********************************************************************
|
|---|
| 4554 | * fwrite (CRTDLL.383)
|
|---|
| 4555 | */
|
|---|
| 4556 | DWORD CDECL CRTDLL_fwrite( LPVOID ptr, INT size, INT nmemb, CRTDLL_FILE *file )
|
|---|
| 4557 | {
|
|---|
| 4558 | DWORD ret;
|
|---|
| 4559 |
|
|---|
| 4560 | dprintf(("CRTDLL: fwrite\n"));
|
|---|
| 4561 | if (!WriteFile( file->handle, ptr, size * nmemb, &ret, NULL ))
|
|---|
| 4562 | dprintf((" failed!\n"));
|
|---|
| 4563 |
|
|---|
| 4564 | return ret / size;
|
|---|
| 4565 | }
|
|---|
| 4566 |
|
|---|
| 4567 |
|
|---|
| 4568 | /*********************************************************************
|
|---|
| 4569 | * fwscanf (CRTDLL.384)
|
|---|
| 4570 | */
|
|---|
| 4571 | int CDECL CRTDLL_fwscanf( FILE *strm, const wchar_t *format, ... )
|
|---|
| 4572 | {
|
|---|
| 4573 | dprintf(("CRTDLL: fwscanf not implemented.\n"));
|
|---|
| 4574 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 4575 | return FALSE;
|
|---|
| 4576 | }
|
|---|
| 4577 |
|
|---|
| 4578 |
|
|---|
| 4579 | /*********************************************************************
|
|---|
| 4580 | * getc (CRTDLL.385)
|
|---|
| 4581 | */
|
|---|
| 4582 | int CDECL CRTDLL_getc( FILE *fp )
|
|---|
| 4583 | {
|
|---|
| 4584 | dprintf(("CRTDLL: getc\n"));
|
|---|
| 4585 | return (getc(fp));
|
|---|
| 4586 | }
|
|---|
| 4587 |
|
|---|
| 4588 |
|
|---|
| 4589 | /*********************************************************************
|
|---|
| 4590 | * getchar (CRTDLL.386)
|
|---|
| 4591 | */
|
|---|
| 4592 | int CDECL CRTDLL_getchar( void )
|
|---|
| 4593 | {
|
|---|
| 4594 | dprintf(("CRTDLL: getchar\n"));
|
|---|
| 4595 | return (getchar());
|
|---|
| 4596 | }
|
|---|
| 4597 |
|
|---|
| 4598 |
|
|---|
| 4599 | /*********************************************************************
|
|---|
| 4600 | * getenv (CRTDLL.387)
|
|---|
| 4601 | */
|
|---|
| 4602 | char * CDECL CRTDLL_getenv( const char *name )
|
|---|
| 4603 | {
|
|---|
| 4604 | dprintf(("CRTDLL: getenv\n"));
|
|---|
| 4605 | return (getenv(name));
|
|---|
| 4606 | }
|
|---|
| 4607 |
|
|---|
| 4608 |
|
|---|
| 4609 | /*********************************************************************
|
|---|
| 4610 | * gets (CRTDLL.388)
|
|---|
| 4611 | */
|
|---|
| 4612 | char * CDECL CRTDLL_gets( char *s )
|
|---|
| 4613 | {
|
|---|
| 4614 | dprintf(("CRTDLL: gets\n"));
|
|---|
| 4615 | return (gets(s));
|
|---|
| 4616 | }
|
|---|
| 4617 |
|
|---|
| 4618 |
|
|---|
| 4619 | /*********************************************************************
|
|---|
| 4620 | * gmtime (CRTDLL.389)
|
|---|
| 4621 | */
|
|---|
| 4622 | struct tm * CDECL CRTDLL_gmtime( const time_t *timer )
|
|---|
| 4623 | {
|
|---|
| 4624 | dprintf(("CRTDLL: gmtime\n"));
|
|---|
| 4625 | return (gmtime(timer));
|
|---|
| 4626 | }
|
|---|
| 4627 |
|
|---|
| 4628 |
|
|---|
| 4629 | /*********************************************************************
|
|---|
| 4630 | * is_wctype (CRTDLL.390)
|
|---|
| 4631 | */
|
|---|
| 4632 | INT CDECL CRTDLL_is_wctype(wint_t wc, wctype_t wctypeFlags)
|
|---|
| 4633 | {
|
|---|
| 4634 | dprintf(("CRTDLL: is_wctype\n"));
|
|---|
| 4635 | return ((CRTDLL_pwctype_dll[(unsigned char)(wc & 0xFF)]&wctypeFlags) == wctypeFlags );
|
|---|
| 4636 | }
|
|---|
| 4637 |
|
|---|
| 4638 |
|
|---|
| 4639 | /*********************************************************************
|
|---|
| 4640 | * isalnum (CRTDLL.391)
|
|---|
| 4641 | */
|
|---|
| 4642 | int CDECL CRTDLL_isalnum(int i)
|
|---|
| 4643 | {
|
|---|
| 4644 | dprintf(("CRTDLL: isalnum(%08xh)\n", i));
|
|---|
| 4645 | return (isalnum(i));
|
|---|
| 4646 | }
|
|---|
| 4647 |
|
|---|
| 4648 |
|
|---|
| 4649 | /*********************************************************************
|
|---|
| 4650 | * iscntrl (CRTDLL.393)
|
|---|
| 4651 | */
|
|---|
| 4652 | int CDECL CRTDLL_iscntrl(int i)
|
|---|
| 4653 | {
|
|---|
| 4654 | dprintf(("CRTDLL: iscntrl(%08xh)\n", i));
|
|---|
| 4655 | return (iscntrl(i));
|
|---|
| 4656 | }
|
|---|
| 4657 |
|
|---|
| 4658 |
|
|---|
| 4659 | /*********************************************************************
|
|---|
| 4660 | * isgraph (CRTDLL.395)
|
|---|
| 4661 | */
|
|---|
| 4662 | int CDECL CRTDLL_isgraph(int i)
|
|---|
| 4663 | {
|
|---|
| 4664 | dprintf(("CRTDLL: isgraph(%08xh)\n", i));
|
|---|
| 4665 | return (isgraph(i));
|
|---|
| 4666 | }
|
|---|
| 4667 |
|
|---|
| 4668 |
|
|---|
| 4669 | /*********************************************************************
|
|---|
| 4670 | * isleadbyte (CRTDLL.396)
|
|---|
| 4671 | */
|
|---|
| 4672 | int CDECL CRTDLL_isleadbyte(int i)
|
|---|
| 4673 | {
|
|---|
| 4674 | dprintf(("CRTDLL: isleadbyte(%08xh) not implemented.\n", i));
|
|---|
| 4675 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 4676 | return FALSE;
|
|---|
| 4677 | }
|
|---|
| 4678 |
|
|---|
| 4679 |
|
|---|
| 4680 | /*********************************************************************
|
|---|
| 4681 | * ispunct (CRTDLL.399)
|
|---|
| 4682 | */
|
|---|
| 4683 | int CDECL CRTDLL_ispunct(int i)
|
|---|
| 4684 | {
|
|---|
| 4685 | dprintf(("CRTDLL: ispunct(%08xh)\n", i));
|
|---|
| 4686 | return (ispunct(i));
|
|---|
| 4687 | }
|
|---|
| 4688 |
|
|---|
| 4689 |
|
|---|
| 4690 | /*********************************************************************
|
|---|
| 4691 | * iswalnum (CRTDLL.402)
|
|---|
| 4692 | */
|
|---|
| 4693 | int CDECL CRTDLL_iswalnum(wint_t i)
|
|---|
| 4694 | {
|
|---|
| 4695 | dprintf(("CRTDLL: iswalnum(%08xh)\n", i));
|
|---|
| 4696 | return (iswalnum(i));
|
|---|
| 4697 | }
|
|---|
| 4698 |
|
|---|
| 4699 |
|
|---|
| 4700 | /*********************************************************************
|
|---|
| 4701 | * iswascii (CRTDLL.404)
|
|---|
| 4702 | */
|
|---|
| 4703 | int CDECL CRTDLL_iswascii(wint_t c)
|
|---|
| 4704 | {
|
|---|
| 4705 | dprintf(("CRTDLL: iswascii\n", c));
|
|---|
| 4706 | return (!((c)&(~0x7f)));
|
|---|
| 4707 | }
|
|---|
| 4708 |
|
|---|
| 4709 |
|
|---|
| 4710 | /*********************************************************************
|
|---|
| 4711 | * iswcntrl (CRTDLL.405)
|
|---|
| 4712 | */
|
|---|
| 4713 | int CDECL CRTDLL_iswcntrl(wint_t i)
|
|---|
| 4714 | {
|
|---|
| 4715 | dprintf(("CRTDLL: iswcntrl(%08xh)\n", i));
|
|---|
| 4716 | return (iswcntrl(i));
|
|---|
| 4717 | }
|
|---|
| 4718 |
|
|---|
| 4719 |
|
|---|
| 4720 | /*********************************************************************
|
|---|
| 4721 | * iswdigit (CRTDLL.407)
|
|---|
| 4722 | */
|
|---|
| 4723 | int CDECL CRTDLL_iswdigit(wint_t i)
|
|---|
| 4724 | {
|
|---|
| 4725 | dprintf(("CRTDLL: iswdigit(%08xh)\n", i));
|
|---|
| 4726 | return (iswdigit(i));
|
|---|
| 4727 | }
|
|---|
| 4728 |
|
|---|
| 4729 |
|
|---|
| 4730 | /*********************************************************************
|
|---|
| 4731 | * iswgraph (CRTDLL.408)
|
|---|
| 4732 | */
|
|---|
| 4733 | int CDECL CRTDLL_iswgraph(wint_t i)
|
|---|
| 4734 | {
|
|---|
| 4735 | dprintf(("CRTDLL: iswgraph(%08xh)\n", i));
|
|---|
| 4736 | return (iswgraph(i));
|
|---|
| 4737 | }
|
|---|
| 4738 |
|
|---|
| 4739 |
|
|---|
| 4740 | /*********************************************************************
|
|---|
| 4741 | * iswlower (CRTDLL.409)
|
|---|
| 4742 | */
|
|---|
| 4743 | int CDECL CRTDLL_iswlower(wint_t i)
|
|---|
| 4744 | {
|
|---|
| 4745 | dprintf(("CRTDLL: iswlower(%08xh)\n", i));
|
|---|
| 4746 | return (iswlower(i));
|
|---|
| 4747 | }
|
|---|
| 4748 |
|
|---|
| 4749 |
|
|---|
| 4750 | /*********************************************************************
|
|---|
| 4751 | * iswprint (CRTDLL.410)
|
|---|
| 4752 | */
|
|---|
| 4753 | int CDECL CRTDLL_iswprint(wint_t i)
|
|---|
| 4754 | {
|
|---|
| 4755 | dprintf(("CRTDLL: iswprint(%08xh)\n", i));
|
|---|
| 4756 | return (iswprint(i));
|
|---|
| 4757 | }
|
|---|
| 4758 |
|
|---|
| 4759 |
|
|---|
| 4760 | /*********************************************************************
|
|---|
| 4761 | * iswpunct (CRTDLL.411)
|
|---|
| 4762 | */
|
|---|
| 4763 | int CDECL CRTDLL_iswpunct(wint_t i)
|
|---|
| 4764 | {
|
|---|
| 4765 | dprintf(("CRTDLL: iswpunct(%08xh)\n", i));
|
|---|
| 4766 | return (iswpunct(i));
|
|---|
| 4767 | }
|
|---|
| 4768 |
|
|---|
| 4769 |
|
|---|
| 4770 | /*********************************************************************
|
|---|
| 4771 | * iswspace (CRTDLL.412)
|
|---|
| 4772 | */
|
|---|
| 4773 | int CDECL CRTDLL_iswspace(wint_t i)
|
|---|
| 4774 | {
|
|---|
| 4775 | dprintf(("CRTDLL: iswspace(%08xh)\n", i));
|
|---|
| 4776 | return (iswspace(i));
|
|---|
| 4777 | }
|
|---|
| 4778 |
|
|---|
| 4779 |
|
|---|
| 4780 | /*********************************************************************
|
|---|
| 4781 | * iswupper (CRTDLL.413)
|
|---|
| 4782 | */
|
|---|
| 4783 | int CDECL CRTDLL_iswupper(wint_t i)
|
|---|
| 4784 | {
|
|---|
| 4785 | dprintf(("CRTDLL: iswupper(%08xh)\n", i));
|
|---|
| 4786 | return (iswupper(i));
|
|---|
| 4787 | }
|
|---|
| 4788 |
|
|---|
| 4789 |
|
|---|
| 4790 | /*********************************************************************
|
|---|
| 4791 | * iswxdigit (CRTDLL.414)
|
|---|
| 4792 | */
|
|---|
| 4793 | int CDECL CRTDLL_iswxdigit(wint_t i)
|
|---|
| 4794 | {
|
|---|
| 4795 | dprintf(("CRTDLL: iswxdigit(%08xh)\n", i));
|
|---|
| 4796 | return (iswxdigit(i));
|
|---|
| 4797 | }
|
|---|
| 4798 |
|
|---|
| 4799 |
|
|---|
| 4800 | /*********************************************************************
|
|---|
| 4801 | * ldexp (CRTDLL.417)
|
|---|
| 4802 | */
|
|---|
| 4803 | double CDECL CRTDLL_ldexp( double x, int exp )
|
|---|
| 4804 | {
|
|---|
| 4805 | dprintf(("CRTDLL: ldexp\n"));
|
|---|
| 4806 | return (ldexp(x, exp));
|
|---|
| 4807 | }
|
|---|
| 4808 |
|
|---|
| 4809 |
|
|---|
| 4810 | /*********************************************************************
|
|---|
| 4811 | * ldiv (CRTDLL.418)
|
|---|
| 4812 | */
|
|---|
| 4813 | ldiv_t CDECL CRTDLL_ldiv( long int numer, long int denom )
|
|---|
| 4814 | {
|
|---|
| 4815 | dprintf(("CRTDLL: ldiv\n"));
|
|---|
| 4816 | return (ldiv(numer, denom));
|
|---|
| 4817 | }
|
|---|
| 4818 |
|
|---|
| 4819 |
|
|---|
| 4820 | /*********************************************************************
|
|---|
| 4821 | * localeconv (CRTDLL.419)
|
|---|
| 4822 | */
|
|---|
| 4823 | struct lconv * CDECL CRTDLL_localeconv(void)
|
|---|
| 4824 | {
|
|---|
| 4825 | dprintf(("CRTDLL: localeconv\n"));
|
|---|
| 4826 | return (localeconv());
|
|---|
| 4827 | }
|
|---|
| 4828 |
|
|---|
| 4829 |
|
|---|
| 4830 | /*********************************************************************
|
|---|
| 4831 | * localtime (CRTDLL.420)
|
|---|
| 4832 | */
|
|---|
| 4833 | struct tm * CDECL CRTDLL_localtime( const time_t *timer )
|
|---|
| 4834 | {
|
|---|
| 4835 | dprintf(("CRTDLL: localtime\n"));
|
|---|
| 4836 | return (localtime(timer));
|
|---|
| 4837 | }
|
|---|
| 4838 |
|
|---|
| 4839 |
|
|---|
| 4840 | /*********************************************************************
|
|---|
| 4841 | * log10 (CRTDLL.422)
|
|---|
| 4842 | */
|
|---|
| 4843 | double CDECL CRTDLL_log10( double x )
|
|---|
| 4844 | {
|
|---|
| 4845 | dprintf(("CRTDLL: log10\n"));
|
|---|
| 4846 | return (log10(x));
|
|---|
| 4847 | }
|
|---|
| 4848 |
|
|---|
| 4849 |
|
|---|
| 4850 | /*********************************************************************
|
|---|
| 4851 | * longjmp (CRTDLL.423)
|
|---|
| 4852 | */
|
|---|
| 4853 | VOID CDECL CRTDLL_longjmp(jmp_buf env, int val)
|
|---|
| 4854 | {
|
|---|
| 4855 | dprintf(("CRTDLL: longjmp\n"));
|
|---|
| 4856 | longjmp(env, val);
|
|---|
| 4857 | }
|
|---|
| 4858 |
|
|---|
| 4859 |
|
|---|
| 4860 | /*********************************************************************
|
|---|
| 4861 | * malloc (CRTDLL.424)
|
|---|
| 4862 | */
|
|---|
| 4863 | VOID* CDECL CRTDLL_malloc(DWORD size)
|
|---|
| 4864 | {
|
|---|
| 4865 | // dprintf(("CRTDLL: malloc\n"));
|
|---|
| 4866 | return Heap_Alloc(size);
|
|---|
| 4867 | }
|
|---|
| 4868 |
|
|---|
| 4869 |
|
|---|
| 4870 | /*********************************************************************
|
|---|
| 4871 | * mblen (CRTDLL.425)
|
|---|
| 4872 | */
|
|---|
| 4873 | INT CDECL CRTDLL_mblen( const char *s, size_t n )
|
|---|
| 4874 | {
|
|---|
| 4875 | dprintf(("CRTDLL: mblen\n"));
|
|---|
| 4876 | return (mblen(s, n));
|
|---|
| 4877 | }
|
|---|
| 4878 |
|
|---|
| 4879 |
|
|---|
| 4880 | /*********************************************************************
|
|---|
| 4881 | * CRTDLL_mbtowc (CRTDLL.427)
|
|---|
| 4882 | */
|
|---|
| 4883 | INT CDECL CRTDLL_mbtowc( WCHAR *dst, LPCSTR str, INT n )
|
|---|
| 4884 | {
|
|---|
| 4885 | dprintf(("CRTDLL: _mbtowc\n"));
|
|---|
| 4886 | wchar_t res;
|
|---|
| 4887 | int ret = mbtowc( &res, str, n );
|
|---|
| 4888 | if (dst) *dst = (WCHAR)res;
|
|---|
| 4889 | return ret;
|
|---|
| 4890 | }
|
|---|
| 4891 |
|
|---|
| 4892 |
|
|---|
| 4893 | /*********************************************************************
|
|---|
| 4894 | * mktime (CRTDLL.433)
|
|---|
| 4895 | */
|
|---|
| 4896 | time_t CDECL CRTDLL_mktime( struct tm *timeptr )
|
|---|
| 4897 | {
|
|---|
| 4898 | dprintf(("CRTDLL: mktime\n"));
|
|---|
| 4899 | return mktime( timeptr );
|
|---|
| 4900 | }
|
|---|
| 4901 |
|
|---|
| 4902 |
|
|---|
| 4903 | /*********************************************************************
|
|---|
| 4904 | * modf (CRTDLL.434)
|
|---|
| 4905 | */
|
|---|
| 4906 | double CDECL CRTDLL_modf( double value, double *iptr )
|
|---|
| 4907 | {
|
|---|
| 4908 | dprintf(("CRTDLL: modf\n"));
|
|---|
| 4909 | return modf( value, iptr );
|
|---|
| 4910 | }
|
|---|
| 4911 |
|
|---|
| 4912 |
|
|---|
| 4913 | /*********************************************************************
|
|---|
| 4914 | * perror (CRTDLL.435)
|
|---|
| 4915 | */
|
|---|
| 4916 | void CDECL CRTDLL_perror( const char *s )
|
|---|
| 4917 | {
|
|---|
| 4918 | dprintf(("CRTDLL: perror\n"));
|
|---|
| 4919 | perror( s );
|
|---|
| 4920 | }
|
|---|
| 4921 |
|
|---|
| 4922 |
|
|---|
| 4923 | /*********************************************************************
|
|---|
| 4924 | * printf (CRTDLL.437)
|
|---|
| 4925 | */
|
|---|
| 4926 | int CDECL CRTDLL_printf( const char *format, ... )
|
|---|
| 4927 | {
|
|---|
| 4928 | dprintf(("CRTDLL: printf\n"));
|
|---|
| 4929 | va_list arg;
|
|---|
| 4930 | int done;
|
|---|
| 4931 |
|
|---|
| 4932 | va_start (arg, format);
|
|---|
| 4933 | done = vprintf (format, arg);
|
|---|
| 4934 | va_end (arg);
|
|---|
| 4935 | return done;
|
|---|
| 4936 | }
|
|---|
| 4937 |
|
|---|
| 4938 |
|
|---|
| 4939 | /*********************************************************************
|
|---|
| 4940 | * putc (CRTDLL.438)
|
|---|
| 4941 | */
|
|---|
| 4942 | int CDECL CRTDLL_putc( int c, FILE *fp )
|
|---|
| 4943 | {
|
|---|
| 4944 | dprintf(("CRTDLL: putc\n"));
|
|---|
| 4945 | return putc( c, fp );
|
|---|
| 4946 | }
|
|---|
| 4947 |
|
|---|
| 4948 |
|
|---|
| 4949 | /*********************************************************************
|
|---|
| 4950 | * putchar (CRTDLL.439)
|
|---|
| 4951 | */
|
|---|
| 4952 | int CDECL CRTDLL_putchar( int c )
|
|---|
| 4953 | {
|
|---|
| 4954 | dprintf(("CRTDLL: putchar\n"));
|
|---|
| 4955 | return putchar( c );
|
|---|
| 4956 | }
|
|---|
| 4957 |
|
|---|
| 4958 |
|
|---|
| 4959 | /*********************************************************************
|
|---|
| 4960 | * puts (CRTDLL.440)
|
|---|
| 4961 | */
|
|---|
| 4962 | int CDECL CRTDLL_puts( const char *s )
|
|---|
| 4963 | {
|
|---|
| 4964 | dprintf(("CRTDLL: puts\n"));
|
|---|
| 4965 | return puts( s );
|
|---|
| 4966 | }
|
|---|
| 4967 |
|
|---|
| 4968 |
|
|---|
| 4969 | /*********************************************************************
|
|---|
| 4970 | * raise (CRTDLL.442)
|
|---|
| 4971 | */
|
|---|
| 4972 | int CDECL CRTDLL_raise( int sig )
|
|---|
| 4973 | {
|
|---|
| 4974 | dprintf(("CRTDLL: raise\n"));
|
|---|
| 4975 | return raise( sig );
|
|---|
| 4976 | }
|
|---|
| 4977 |
|
|---|
| 4978 |
|
|---|
| 4979 | /*********************************************************************
|
|---|
| 4980 | * rand (CRTDLL.443)
|
|---|
| 4981 | */
|
|---|
| 4982 | int CDECL CRTDLL_rand( void )
|
|---|
| 4983 | {
|
|---|
| 4984 | // dprintf(("CRTDLL: rand\n"));
|
|---|
| 4985 | return (rand());
|
|---|
| 4986 | }
|
|---|
| 4987 |
|
|---|
| 4988 |
|
|---|
| 4989 | /*********************************************************************
|
|---|
| 4990 | * realloc (CRTDLL.444)
|
|---|
| 4991 | */
|
|---|
| 4992 | void * CDECL CRTDLL_realloc( void *ptr, size_t size )
|
|---|
| 4993 | {
|
|---|
| 4994 | dprintf(("CRTDLL: realloc\n"));
|
|---|
| 4995 | return HeapReAlloc( GetProcessHeap(), 0, ptr, size );
|
|---|
| 4996 | }
|
|---|
| 4997 |
|
|---|
| 4998 |
|
|---|
| 4999 | /*********************************************************************
|
|---|
| 5000 | * remove (CRTDLL.445)
|
|---|
| 5001 | */
|
|---|
| 5002 | INT CDECL CRTDLL_remove(LPCSTR file)
|
|---|
| 5003 | {
|
|---|
| 5004 | dprintf(("CRTDLL: remove\n"));
|
|---|
| 5005 | if (!DeleteFileA(file))
|
|---|
| 5006 | return -1;
|
|---|
| 5007 | return 0;
|
|---|
| 5008 | }
|
|---|
| 5009 |
|
|---|
| 5010 |
|
|---|
| 5011 | /*********************************************************************
|
|---|
| 5012 | * rename (CRTDLL.446)
|
|---|
| 5013 | */
|
|---|
| 5014 | int CDECL CRTDLL_rename (const char *old, const char *new2)
|
|---|
| 5015 | {
|
|---|
| 5016 | dprintf(("CRTDLL: rename\n"));
|
|---|
| 5017 | return (rename(old, new2));
|
|---|
| 5018 | }
|
|---|
| 5019 |
|
|---|
| 5020 |
|
|---|
| 5021 | /*********************************************************************
|
|---|
| 5022 | * rewind (CRTDLL.447)
|
|---|
| 5023 | */
|
|---|
| 5024 | void CDECL CRTDLL_rewind( FILE *fp )
|
|---|
| 5025 | {
|
|---|
| 5026 | dprintf(("CRTDLL: rewind\n"));
|
|---|
| 5027 | rewind(fp);
|
|---|
| 5028 | }
|
|---|
| 5029 |
|
|---|
| 5030 |
|
|---|
| 5031 | /*********************************************************************
|
|---|
| 5032 | * scanf (CRTDLL.448)
|
|---|
| 5033 | */
|
|---|
| 5034 | int CDECL CRTDLL_scanf( const char *format, ... )
|
|---|
| 5035 | {
|
|---|
| 5036 | dprintf(("CRTDLL: scanf not implemented.\n"));
|
|---|
| 5037 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 5038 | return FALSE;
|
|---|
| 5039 | }
|
|---|
| 5040 |
|
|---|
| 5041 |
|
|---|
| 5042 | /*********************************************************************
|
|---|
| 5043 | * setbuf (CRTDLL.449)
|
|---|
| 5044 | */
|
|---|
| 5045 | void CDECL CRTDLL_setbuf( FILE *fp, char *buf )
|
|---|
| 5046 | {
|
|---|
| 5047 | dprintf(("CRTDLL: setbuf\n"));
|
|---|
| 5048 | setbuf(fp, buf);
|
|---|
| 5049 | }
|
|---|
| 5050 |
|
|---|
| 5051 |
|
|---|
| 5052 | /*********************************************************************
|
|---|
| 5053 | * setlocale (CRTDLL.450)
|
|---|
| 5054 | */
|
|---|
| 5055 | char * CDECL CRTDLL_setlocale(int category,const char *locale)
|
|---|
| 5056 | {
|
|---|
| 5057 | dprintf(("CRTDLL: setlocale\n"));
|
|---|
| 5058 | return (setlocale(category, locale));
|
|---|
| 5059 | }
|
|---|
| 5060 |
|
|---|
| 5061 |
|
|---|
| 5062 | /*********************************************************************
|
|---|
| 5063 | * setvbuf (CRTDLL.451)
|
|---|
| 5064 | */
|
|---|
| 5065 | int CDECL CRTDLL_setvbuf( FILE *fp, char *buf, int mode, size_t size )
|
|---|
| 5066 | {
|
|---|
| 5067 | dprintf(("CRTDLL: setvbuf\n"));
|
|---|
| 5068 | return (setvbuf(fp, buf, mode, size));
|
|---|
| 5069 | }
|
|---|
| 5070 |
|
|---|
| 5071 |
|
|---|
| 5072 | /*********************************************************************
|
|---|
| 5073 | * signal (CRTDLL.452)
|
|---|
| 5074 | */
|
|---|
| 5075 | void CDECL CRTDLL_signal( int sig, void (*func)(int))
|
|---|
| 5076 | {
|
|---|
| 5077 | dprintf(("CRTDLL: signal not implemented.\n"));
|
|---|
| 5078 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 5079 | }
|
|---|
| 5080 |
|
|---|
| 5081 |
|
|---|
| 5082 | /*********************************************************************
|
|---|
| 5083 | * sinh (CRTDLL.454)
|
|---|
| 5084 | */
|
|---|
| 5085 | double CDECL CRTDLL_sinh( double x )
|
|---|
| 5086 | {
|
|---|
| 5087 | dprintf(("CRTDLL: sinh\n"));
|
|---|
| 5088 | return (sinh(x));
|
|---|
| 5089 | }
|
|---|
| 5090 |
|
|---|
| 5091 |
|
|---|
| 5092 | /*********************************************************************
|
|---|
| 5093 | * srand (CRTDLL.457)
|
|---|
| 5094 | */
|
|---|
| 5095 | void CDECL CRTDLL_srand( unsigned int seed )
|
|---|
| 5096 | {
|
|---|
| 5097 | dprintf(("CRTDLL: srand\n"));
|
|---|
| 5098 | srand(seed);
|
|---|
| 5099 | }
|
|---|
| 5100 |
|
|---|
| 5101 |
|
|---|
| 5102 | /*********************************************************************
|
|---|
| 5103 | * strcoll (CRTDLL.462)
|
|---|
| 5104 | */
|
|---|
| 5105 | int CDECL CRTDLL_strcoll( const char *s1, const char *s2 )
|
|---|
| 5106 | {
|
|---|
| 5107 | dprintf(("CRTDLL: strcoll\n"));
|
|---|
| 5108 | return strcoll(s1, s2);
|
|---|
| 5109 | }
|
|---|
| 5110 |
|
|---|
| 5111 |
|
|---|
| 5112 | /*********************************************************************
|
|---|
| 5113 | * strerror (CRTDLL.465)
|
|---|
| 5114 | */
|
|---|
| 5115 | char * CDECL CRTDLL_strerror( int errnum )
|
|---|
| 5116 | {
|
|---|
| 5117 | dprintf(("CRTDLL: strerror\n"));
|
|---|
| 5118 | return strerror(errnum);
|
|---|
| 5119 | }
|
|---|
| 5120 |
|
|---|
| 5121 |
|
|---|
| 5122 | /*********************************************************************
|
|---|
| 5123 | * strftime (CRTDLL.466)
|
|---|
| 5124 | */
|
|---|
| 5125 | size_t CDECL CRTDLL_strftime( char *s, size_t maxsiz, const char *fmt, const struct tm *tp )
|
|---|
| 5126 | {
|
|---|
| 5127 | dprintf(("CRTDLL: strftime\n"));
|
|---|
| 5128 | return strftime(s, maxsiz, fmt, tp);
|
|---|
| 5129 | }
|
|---|
| 5130 |
|
|---|
| 5131 |
|
|---|
| 5132 | /*********************************************************************
|
|---|
| 5133 | * strtod (CRTDLL.475)
|
|---|
| 5134 | */
|
|---|
| 5135 | double CDECL CRTDLL_strtod( const char *nptr, char **endptr )
|
|---|
| 5136 | {
|
|---|
| 5137 | dprintf(("CRTDLL: strtod\n"));
|
|---|
| 5138 | return strtod(nptr, endptr);
|
|---|
| 5139 | }
|
|---|
| 5140 |
|
|---|
| 5141 |
|
|---|
| 5142 | /*********************************************************************
|
|---|
| 5143 | * strtok (CRTDLL.476)
|
|---|
| 5144 | */
|
|---|
| 5145 | char * CDECL CRTDLL_strtok( char *s1, const char *s2 )
|
|---|
| 5146 | {
|
|---|
| 5147 | dprintf(("CRTDLL: strtok\n"));
|
|---|
| 5148 | return strtok(s1, s2);
|
|---|
| 5149 | }
|
|---|
| 5150 |
|
|---|
| 5151 |
|
|---|
| 5152 | /*********************************************************************
|
|---|
| 5153 | * strtol (CRTDLL.477)
|
|---|
| 5154 | */
|
|---|
| 5155 | long int CDECL CRTDLL_strtol( const char *nptr, char **endptr, int base )
|
|---|
| 5156 | {
|
|---|
| 5157 | dprintf(("CRTDLL: strtol\n"));
|
|---|
| 5158 | return strtol(nptr, endptr, base);
|
|---|
| 5159 | }
|
|---|
| 5160 |
|
|---|
| 5161 |
|
|---|
| 5162 | /*********************************************************************
|
|---|
| 5163 | * strtoul (CRTDLL.478)
|
|---|
| 5164 | */
|
|---|
| 5165 | unsigned long CDECL CRTDLL_strtoul( const char *nptr, char **endptr, int base )
|
|---|
| 5166 | {
|
|---|
| 5167 | dprintf(("CRTDLL: strtoul\n"));
|
|---|
| 5168 | return strtoul(nptr, endptr, base);
|
|---|
| 5169 | }
|
|---|
| 5170 |
|
|---|
| 5171 |
|
|---|
| 5172 | /*********************************************************************
|
|---|
| 5173 | * strxfrm (CRTDLL.479)
|
|---|
| 5174 | */
|
|---|
| 5175 | size_t CDECL CRTDLL_strxfrm( char *s1, const char *s2, size_t n )
|
|---|
| 5176 | {
|
|---|
| 5177 | dprintf(("CRTDLL: strxfrm\n"));
|
|---|
| 5178 | return strxfrm(s1, s2, n);
|
|---|
| 5179 | }
|
|---|
| 5180 |
|
|---|
| 5181 |
|
|---|
| 5182 | /*********************************************************************
|
|---|
| 5183 | * swscanf (CRTDLL.481)
|
|---|
| 5184 | */
|
|---|
| 5185 | int CDECL CRTDLL_swscanf( const wchar_t *s1, const wchar_t *s2, ... )
|
|---|
| 5186 | {
|
|---|
| 5187 | dprintf(("CRTDLL: swscanf not implemented.\n"));
|
|---|
| 5188 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 5189 | return FALSE;
|
|---|
| 5190 | }
|
|---|
| 5191 |
|
|---|
| 5192 |
|
|---|
| 5193 | /*********************************************************************
|
|---|
| 5194 | * system (CRTDLL.482)
|
|---|
| 5195 | */
|
|---|
| 5196 | int CDECL CRTDLL_system( const char *string )
|
|---|
| 5197 | {
|
|---|
| 5198 | dprintf(("CRTDLL: system\n"));
|
|---|
| 5199 | return system(string);
|
|---|
| 5200 | }
|
|---|
| 5201 |
|
|---|
| 5202 |
|
|---|
| 5203 | /*********************************************************************
|
|---|
| 5204 | * tanh (CRTDLL.485)
|
|---|
| 5205 | */
|
|---|
| 5206 | double CDECL CRTDLL_tanh( double x )
|
|---|
| 5207 | {
|
|---|
| 5208 | dprintf(("CRTDLL: tanh\n"));
|
|---|
| 5209 | return tanh(x);
|
|---|
| 5210 | }
|
|---|
| 5211 |
|
|---|
| 5212 |
|
|---|
| 5213 | /*********************************************************************
|
|---|
| 5214 | * time (CRTDLL.485)
|
|---|
| 5215 | */
|
|---|
| 5216 | time_t CDECL CRTDLL_time( time_t *timer )
|
|---|
| 5217 | {
|
|---|
| 5218 | dprintf(("CRTDLL: time\n"));
|
|---|
| 5219 |
|
|---|
| 5220 | return time(timer);
|
|---|
| 5221 | }
|
|---|
| 5222 |
|
|---|
| 5223 |
|
|---|
| 5224 | /*********************************************************************
|
|---|
| 5225 | * tmpfile (CRTDLL.486)
|
|---|
| 5226 | */
|
|---|
| 5227 | FILE * CDECL CRTDLL_tmpfile( void )
|
|---|
| 5228 | {
|
|---|
| 5229 | dprintf(("CRTDLL: tmpfile\n"));
|
|---|
| 5230 | return (tmpfile());
|
|---|
| 5231 | }
|
|---|
| 5232 |
|
|---|
| 5233 |
|
|---|
| 5234 | /*********************************************************************
|
|---|
| 5235 | * tmpnam (CRTDLL.487)
|
|---|
| 5236 | */
|
|---|
| 5237 | char * CDECL CRTDLL_tmpnam( char *s )
|
|---|
| 5238 | {
|
|---|
| 5239 | dprintf(("CRTDLL: tmpnam\n"));
|
|---|
| 5240 | return (tmpnam(s));
|
|---|
| 5241 | }
|
|---|
| 5242 |
|
|---|
| 5243 |
|
|---|
| 5244 | /*********************************************************************
|
|---|
| 5245 | * ungetc (CRTDLL.492)
|
|---|
| 5246 | */
|
|---|
| 5247 | INT CDECL CRTDLL_ungetc(int c, FILE *f)
|
|---|
| 5248 | {
|
|---|
| 5249 | dprintf(("CRTDLL: ungetc not implemented.\n"));
|
|---|
| 5250 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 5251 | return FALSE;
|
|---|
| 5252 | }
|
|---|
| 5253 |
|
|---|
| 5254 |
|
|---|
| 5255 | /*********************************************************************
|
|---|
| 5256 | * ungetwc (CRTDLL.493)
|
|---|
| 5257 | */
|
|---|
| 5258 | wint_t CDECL CRTDLL_ungetwc( wint_t wc, FILE *strm )
|
|---|
| 5259 | {
|
|---|
| 5260 | dprintf(("CRTDLL: ungetwc\n"));
|
|---|
| 5261 | return (ungetwc(wc, strm));
|
|---|
| 5262 | }
|
|---|
| 5263 |
|
|---|
| 5264 | /*********************************************************************
|
|---|
| 5265 | * vfprintf (CRTDLL.494)
|
|---|
| 5266 | */
|
|---|
| 5267 | INT CDECL CRTDLL_vfprintf( CRTDLL_FILE *file, LPSTR format, va_list args )
|
|---|
| 5268 | {
|
|---|
| 5269 | dprintf(("CRTDLL: vprintf\n"));
|
|---|
| 5270 | char buffer[2048]; /* FIXME... */
|
|---|
| 5271 | vsprintf( buffer, format, args );
|
|---|
| 5272 | return CRTDLL_fwrite( buffer, 1, strlen(buffer), file );
|
|---|
| 5273 | }
|
|---|
| 5274 |
|
|---|
| 5275 |
|
|---|
| 5276 | /*********************************************************************
|
|---|
| 5277 | * vfwprintf (CRTDLL.495)
|
|---|
| 5278 | */
|
|---|
| 5279 | int CDECL CRTDLL_vfwprintf( FILE *F, const wchar_t *s, va_list arg )
|
|---|
| 5280 | {
|
|---|
| 5281 | dprintf(("CRTDLL: vfwprintf not implemented.\n"));
|
|---|
| 5282 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 5283 | return FALSE;
|
|---|
| 5284 | }
|
|---|
| 5285 |
|
|---|
| 5286 |
|
|---|
| 5287 | /*********************************************************************
|
|---|
| 5288 | * vprintf (CRTDLL.496)
|
|---|
| 5289 | */
|
|---|
| 5290 | int CDECL CRTDLL_vprintf( const char *format, __va_list arg )
|
|---|
| 5291 | {
|
|---|
| 5292 | dprintf(("CRTDLL: vprintf\n"));
|
|---|
| 5293 | return (vprintf(format, arg));
|
|---|
| 5294 | }
|
|---|
| 5295 |
|
|---|
| 5296 |
|
|---|
| 5297 | /*********************************************************************
|
|---|
| 5298 | * vswprintf (CRTDLL.498)
|
|---|
| 5299 | */
|
|---|
| 5300 | int CDECL CRTDLL_vswprintf( wchar_t *s , size_t t, const wchar_t *format, va_list arg )
|
|---|
| 5301 | {
|
|---|
| 5302 | dprintf(("CRTDLL: vswprintf\n"));
|
|---|
| 5303 | return (vswprintf(s, t, format, arg));
|
|---|
| 5304 | }
|
|---|
| 5305 |
|
|---|
| 5306 |
|
|---|
| 5307 | /*********************************************************************
|
|---|
| 5308 | * vwprintf (CRTDLL.499)
|
|---|
| 5309 | */
|
|---|
| 5310 | int CDECL CRTDLL_vwprintf( const wchar_t *s, va_list arg)
|
|---|
| 5311 | {
|
|---|
| 5312 | dprintf(("CRTDLL: vwprintf not implemented.\n"));
|
|---|
| 5313 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 5314 | return FALSE;
|
|---|
| 5315 | }
|
|---|
| 5316 |
|
|---|
| 5317 |
|
|---|
| 5318 | /*********************************************************************
|
|---|
| 5319 | * wcscoll (CRTDLL.503)
|
|---|
| 5320 | */
|
|---|
| 5321 | int CDECL CRTDLL_wcscoll(const wchar_t *s1, const wchar_t *s2)
|
|---|
| 5322 | {
|
|---|
| 5323 | dprintf(("CRTDLL: wcscoll\n"));
|
|---|
| 5324 | return (wcscoll(s1, s2));
|
|---|
| 5325 | }
|
|---|
| 5326 |
|
|---|
| 5327 |
|
|---|
| 5328 | /*********************************************************************
|
|---|
| 5329 | * wcsftime (CRTDLL.506)
|
|---|
| 5330 | */
|
|---|
| 5331 | size_t CDECL CRTDLL_wcsftime( wchar_t *s, size_t maxsize,
|
|---|
| 5332 | const wchar_t *format, const struct tm *timeptr )
|
|---|
| 5333 | {
|
|---|
| 5334 | dprintf(("CRTDLL: wcsftime\n"));
|
|---|
| 5335 | return (wcsftime(s, maxsize, format, timeptr));
|
|---|
| 5336 | }
|
|---|
| 5337 |
|
|---|
| 5338 |
|
|---|
| 5339 | /*********************************************************************
|
|---|
| 5340 | * wcstod (CRTDLL.515)
|
|---|
| 5341 | */
|
|---|
| 5342 | double CDECL CRTDLL_wcstod( const wchar_t *nptr, wchar_t **endptr )
|
|---|
| 5343 | {
|
|---|
| 5344 | dprintf(("CRTDLL: wcstod\n"));
|
|---|
| 5345 | return (wcstod(nptr, endptr));
|
|---|
| 5346 | }
|
|---|
| 5347 |
|
|---|
| 5348 |
|
|---|
| 5349 | /*********************************************************************
|
|---|
| 5350 | * wcsxfrm (CRTDLL.520)
|
|---|
| 5351 | */
|
|---|
| 5352 | size_t CDECL CRTDLL_wcsxfrm( wchar_t *s1, const wchar_t *s2, size_t n )
|
|---|
| 5353 | {
|
|---|
| 5354 | dprintf(("CRTDLL: wcsxfrm\n"));
|
|---|
| 5355 | return (wcsxfrm(s1, s2, n));
|
|---|
| 5356 | }
|
|---|
| 5357 |
|
|---|
| 5358 |
|
|---|
| 5359 | /*********************************************************************
|
|---|
| 5360 | * wcstomb (CRTDLL.521)
|
|---|
| 5361 | */
|
|---|
| 5362 | int CDECL CRTDLL_wctomb( char *s, wchar_t wchar )
|
|---|
| 5363 | {
|
|---|
| 5364 | dprintf(("CRTDLL: wctomb\n"));
|
|---|
| 5365 | return (wctomb(s,wchar));
|
|---|
| 5366 | }
|
|---|
| 5367 |
|
|---|
| 5368 |
|
|---|
| 5369 | /*********************************************************************
|
|---|
| 5370 | * wprintf (CRTDLL.522)
|
|---|
| 5371 | */
|
|---|
| 5372 | int CDECL CRTDLL_wprintf( const wchar_t *s, ... )
|
|---|
| 5373 | {
|
|---|
| 5374 | dprintf(("CRTDLL: wprintf not implemented.\n"));
|
|---|
| 5375 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 5376 | return FALSE;
|
|---|
| 5377 | }
|
|---|
| 5378 |
|
|---|
| 5379 |
|
|---|
| 5380 | /*********************************************************************
|
|---|
| 5381 | * wscanf (CRTDLL.523)
|
|---|
| 5382 | */
|
|---|
| 5383 | int CDECL CRTDLL_wscanf( const wchar_t *s, ... )
|
|---|
| 5384 | {
|
|---|
| 5385 | dprintf(("CRTDLL: wscanf not implemented.\n"));
|
|---|
| 5386 | SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|---|
| 5387 | return FALSE;
|
|---|
| 5388 | }
|
|---|
| 5389 |
|
|---|
| 5390 |
|
|---|
| 5391 |
|
|---|
| 5392 | /*********************************************************************
|
|---|
| 5393 | * __set_errno (INTERNAL-#1)
|
|---|
| 5394 | */
|
|---|
| 5395 | int __set_errno (int error)
|
|---|
| 5396 | {
|
|---|
| 5397 | errno = error;
|
|---|
| 5398 | return error;
|
|---|
| 5399 | }
|
|---|
| 5400 |
|
|---|
| 5401 |
|
|---|
| 5402 | /*********************************************************************
|
|---|
| 5403 | * _mbbtoupper (INTERNAL-#2)
|
|---|
| 5404 | */
|
|---|
| 5405 | unsigned int _mbbtoupper(unsigned int c)
|
|---|
| 5406 | {
|
|---|
| 5407 | if (!CRTDLL__ismbblead(c) )
|
|---|
| 5408 | return toupper(c);
|
|---|
| 5409 |
|
|---|
| 5410 | return c;
|
|---|
| 5411 | }
|
|---|
| 5412 |
|
|---|
| 5413 |
|
|---|
| 5414 | /*********************************************************************
|
|---|
| 5415 | * _mbbtolower (INTERNAL-#3)
|
|---|
| 5416 | */
|
|---|
| 5417 | unsigned int _mbbtolower(unsigned int c)
|
|---|
| 5418 | {
|
|---|
| 5419 | if (!CRTDLL__ismbblead(c) )
|
|---|
| 5420 | return tolower(c);
|
|---|
| 5421 | return c;
|
|---|
| 5422 | }
|
|---|
| 5423 |
|
|---|
| 5424 |
|
|---|
| 5425 | /*********************************************************************
|
|---|
| 5426 | * _mbclen2 (INTERNAL-#4)
|
|---|
| 5427 | */
|
|---|
| 5428 | size_t _mbclen2(const unsigned int s)
|
|---|
| 5429 | {
|
|---|
| 5430 | return (CRTDLL__ismbblead(s>>8) && CRTDLL__ismbbtrail(s&0x00FF)) ? 2 : 1;
|
|---|
| 5431 | }
|
|---|
| 5432 |
|
|---|
| 5433 |
|
|---|
| 5434 | /*********************************************************************
|
|---|
| 5435 | * _isinf (INTERNAL-#5)
|
|---|
| 5436 | */
|
|---|
| 5437 | int _isinf(double __x)
|
|---|
| 5438 | {
|
|---|
| 5439 | double_t * x = (double_t *)&__x;
|
|---|
| 5440 | return ( x->exponent == 0x7ff && ( x->mantissah == 0 && x->mantissal == 0 ));
|
|---|
| 5441 | }
|
|---|
| 5442 |
|
|---|
| 5443 |
|
|---|
| 5444 | /*********************************************************************
|
|---|
| 5445 | * _filehnd (INTERNAL-#6)
|
|---|
| 5446 | */
|
|---|
| 5447 | void* filehnd(int fileno)
|
|---|
| 5448 | {
|
|---|
| 5449 | if ( fileno < 0 )
|
|---|
| 5450 | return (void *)-1;
|
|---|
| 5451 | #define STD_AUX_HANDLE 3
|
|---|
| 5452 | #define STD_PRINTER_HANDLE 4
|
|---|
| 5453 |
|
|---|
| 5454 | switch(fileno)
|
|---|
| 5455 | {
|
|---|
| 5456 | case 0:
|
|---|
| 5457 | return (void*)GetStdHandle(STD_INPUT_HANDLE);
|
|---|
| 5458 | case 1:
|
|---|
| 5459 | return (void*)GetStdHandle(STD_OUTPUT_HANDLE);
|
|---|
| 5460 | case 2:
|
|---|
| 5461 | return (void*)GetStdHandle(STD_ERROR_HANDLE);
|
|---|
| 5462 | case 3:
|
|---|
| 5463 | return (void*)GetStdHandle(STD_AUX_HANDLE);
|
|---|
| 5464 | case 4:
|
|---|
| 5465 | return (void*)GetStdHandle(STD_PRINTER_HANDLE);
|
|---|
| 5466 | default:
|
|---|
| 5467 | break;
|
|---|
| 5468 | }
|
|---|
| 5469 |
|
|---|
| 5470 | if ( fileno >= maxfno )
|
|---|
| 5471 | return (void *)-1;
|
|---|
| 5472 |
|
|---|
| 5473 | if ( fileno_modes[fileno].fd == -1 )
|
|---|
| 5474 | return (void *)-1;
|
|---|
| 5475 | return (void*)fileno_modes[fileno].hFile;
|
|---|
| 5476 | }
|
|---|