source: trunk/src/crtdll/crtdll.cpp@ 1220

Last change on this file since 1220 was 1220, checked in by sandervl, 26 years ago

More updates

File size: 123.0 KB
Line 
1/* $Id: crtdll.cpp,v 1.10 1999-10-09 13:32:25 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 <except.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 <sys\utime.h>
46#include <sys\stat.h>
47
48#include <crtdll.h>
49#include "crtinc.h"
50#include "ieee.h"
51
52DEFAULT_DEBUG_CHANNEL(crtdll)
53
54
55/*********************************************************************
56 * CRTDLL_MainInit (CRTDLL.init)
57 */
58BOOL WINAPI CRTDLL_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
59{
60 if (fdwReason == DLL_PROCESS_ATTACH) {
61 CRTDLL__fdopen(0,"r");
62 CRTDLL__fdopen(1,"w");
63 CRTDLL__fdopen(2,"w");
64 }
65 return TRUE;
66}
67
68
69/*********************************************************************
70 * new (CRTDLL.001)
71 */
72VOID* CDECL CRTDLL_new(DWORD size)
73{
74 dprintf(("CRTDLL: ??2@YAPAXI@Z\n"));
75 VOID* result;
76 if(!(result = HeapAlloc(GetProcessHeap(),0,size)) && new_handler)
77 (*new_handler)();
78 return result;
79}
80
81
82/*********************************************************************
83 * delete (CRTDLL.002)
84 */
85VOID CDECL CRTDLL_delete(VOID* ptr)
86{
87 dprintf(("CRTDLL: ??3@YAXPAX@Z\n"));
88 HeapFree(GetProcessHeap(),0,ptr);
89}
90
91
92/*********************************************************************
93 * set_new_handler(CRTDLL.003)
94 */
95new_handler_type CDECL CRTDLL_set_new_handler(new_handler_type func)
96{
97 dprintf(("CRTDLL: ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z\n"));
98 new_handler_type old_handler = new_handler;
99 new_handler = func;
100 return old_handler;
101}
102
103
104/*********************************************************************
105 * _CIacos (CRTDLL.004)
106 */
107double CDECL CRTDLL__CIacos( double x )
108{
109 dprintf(("NTDLL: _CIacos\n"));
110 dprintf(("should be register function\n"));
111 return acos(x);
112}
113
114
115/*********************************************************************
116 * _CIasin (CRTDLL.005)
117 */
118double CDECL CRTDLL__CIasin( double x )
119{
120 dprintf(("NTDLL: _CIasin\n"));
121 dprintf(("should be register function\n"));
122 return asin(x);
123}
124
125
126/*********************************************************************
127 * _CIatan (CRTDLL.006)
128 */
129double CDECL CRTDLL__CIatan( double x )
130{
131 dprintf(("NTDLL: _CIatan\n"));
132 dprintf(("should be register function\n"));
133 return atan(x);
134}
135
136
137/*********************************************************************
138 * _CIatan2 (CRTDLL.007)
139 */
140double CDECL CRTDLL__CIatan2( double x, double y )
141{
142 dprintf(("NTDLL: _CIatan2\n"));
143 dprintf(("should be register function\n"));
144 return atan2(x,y);
145}
146
147
148/*********************************************************************
149 * _CIcos (CRTDLL.008)
150 */
151double CDECL CRTDLL__CIcos( double x )
152{
153 dprintf(("NTDLL: _CIcos\n"));
154 dprintf(("should be register function\n"));
155 return cos(x);
156}
157
158
159/*********************************************************************
160 * _CIcosh (CRTDLL.009)
161 */
162double CDECL CRTDLL__CIcosh( double x )
163{
164 dprintf(("NTDLL: _CIcosh\n"));
165 dprintf(("should be register function\n"));
166 return cosh(x);
167}
168
169
170/*********************************************************************
171 * _CIexp (CRTDLL.010)
172 */
173double CDECL CRTDLL__CIexp( double x )
174{
175 dprintf(("NTDLL: _CIexp\n"));
176 dprintf(("should be register function\n"));
177 return exp(x);
178}
179
180
181/*********************************************************************
182 * _CIfmod (CRTDLL.011)
183 */
184double CDECL CRTDLL__CIfmod( double x, double y )
185{
186 dprintf(("NTDLL: _CIfmod\n"));
187 dprintf(("should be register function\n"));
188 return fmod(x,y);
189}
190
191
192/*********************************************************************
193 * _CIlog (CRTDLL.012)
194 */
195double CDECL CRTDLL__CIlog( double x )
196{
197 dprintf(("NTDLL: _CIlog\n"));
198 dprintf(("should be register function\n"));
199 return log(x);
200}
201
202
203/*********************************************************************
204 * _CIlog10 (CRTDLL.013)
205 */
206double CDECL CRTDLL__CIlog10( double x )
207{
208 dprintf(("NTDLL: _CIlog10\n"));
209 dprintf(("should be register function\n"));
210 return log10(x);
211}
212
213
214/*********************************************************************
215 * _CIsin (CRTDLL.015)
216 */
217double CDECL CRTDLL__CIsin( double x )
218{
219 dprintf(("NTDLL: _CIsin\n"));
220 dprintf(("should be register function\n"));
221 return sin(x);
222}
223
224
225/*********************************************************************
226 * _CIsinh (CRTDLL.016)
227 */
228double CDECL CRTDLL__CIsinh( double x )
229{
230 dprintf(("NTDLL: _CIsinh\n"));
231 dprintf(("should be register function\n"));
232 return sinh(x);
233}
234
235
236/*********************************************************************
237 * _CIsqrt (CRTDLL.017)
238 */
239double CDECL CRTDLL__CIsqrt( double x )
240{
241 dprintf(("NTDLL: _CIsqrt\n"));
242 dprintf(("should be register function\n"));
243 return acos(x);
244}
245
246
247/*********************************************************************
248 * _CItan (CRTDLL.018)
249 */
250double CDECL CRTDLL__CItan( double x )
251{
252 dprintf(("NTDLL: _CItan\n"));
253 dprintf(("should be register function\n"));
254 return tan(x);
255}
256
257
258/*********************************************************************
259 * _CItanh (CRTDLL.019)
260 */
261double CDECL CRTDLL__CItanh( double x )
262{
263 dprintf(("NTDLL: _CItanh\n"));
264 dprintf(("should be register function\n"));
265 return tanh(x);
266}
267
268
269/*********************************************************************
270 * _XcptFilter (CRTDLL.21)
271 */
272INT CDECL CRTDLL__XcptFilter(DWORD ret, struct _EXCEPTION_POINTERS * ExceptionInfo )
273{
274 dprintf(("CRTDLL: _XcptFilter\n"));
275 return UnhandledExceptionFilter(ExceptionInfo);
276}
277
278
279/*********************************************************************
280 * _GetMainArgs (CRTDLL.22)
281 */
282DWORD CDECL CRTDLL__GetMainArgs(LPDWORD argc,LPSTR **argv,
283 LPSTR *environ,DWORD flag)
284{
285 char *cmdline;
286 char **xargv;
287 int xargc,i,afterlastspace;
288 DWORD version;
289
290 dprintf(("CRTDLL: GetMainArgs\n"));
291
292 CRTDLL_acmdln_dll = cmdline = HEAP_strdupA( GetProcessHeap(), 0,
293 GetCommandLineA() );
294
295 version = GetVersion();
296 CRTDLL_osver_dll = version >> 16;
297 CRTDLL_winminor_dll = version & 0xFF;
298 CRTDLL_winmajor_dll = (version>>8) & 0xFF;
299 CRTDLL_baseversion_dll = version >> 16;
300 CRTDLL_winver_dll = ((version >> 8) & 0xFF) + ((version & 0xFF) << 8);
301 CRTDLL_baseminor_dll = (version >> 16) & 0xFF;
302 CRTDLL_basemajor_dll = (version >> 24) & 0xFF;
303 CRTDLL_osversion_dll = version & 0xFFFF;
304 CRTDLL_osminor_dll = version & 0xFF;
305 CRTDLL_osmajor_dll = (version>>8) & 0xFF;
306
307 /* missing threading init */
308
309 i=0;xargv=NULL;xargc=0;afterlastspace=0;
310/*
311 dprintf(("CRTDLL: GetMainArgs i loop\n"));
312 while (cmdline[i]) {
313 if (cmdline[i]==' ') {
314 dprintf(("CRTDLL: GetMainArgs *1\n"));
315 xargv=(char**)HeapReAlloc( GetProcessHeap(), 0, xargv,
316 sizeof(char*)*(++xargc));
317 cmdline[i]='\0';
318 xargv[xargc-1] = HEAP_strdupA( GetProcessHeap(), 0,
319 cmdline+afterlastspace);
320 i++;
321 dprintf(("CRTDLL: GetMainArgs *2\n"));
322 while (cmdline[i]==' ')
323 i++;
324 if (cmdline[i])
325 afterlastspace=i;
326 dprintf(("CRTDLL: GetMainArgs *3\n"));
327
328 } else
329 i++;
330
331 }
332
333 xargv=(char**)HeapReAlloc( GetProcessHeap(), 0, xargv,
334 sizeof(char*)*(++xargc));
335 dprintf(("CRTDLL: GetMainArgs *4\n"));
336 cmdline[i]='\0';
337 dprintf(("CRTDLL: GetMainArgs *5\n"));
338 xargv[xargc-1] = HEAP_strdupA( GetProcessHeap(), 0,
339 cmdline+afterlastspace);
340*/
341 CRTDLL_argc_dll = xargc;
342 *argc = xargc;
343 CRTDLL_argv_dll = xargv;
344 *argv = xargv;
345 dprintf(("CRTDLL: GetMainArgs end\n"));
346 CRTDLL_environ_dll = *environ = GetEnvironmentStringsA();
347 return 0;
348}
349
350
351/*********************************************************************
352 * __dllonexit (CRTDLL.25)
353 */
354VOID CDECL CRTDLL___dllonexit ()
355{
356 dprintf(("__dllonexit not implemented.\n"));
357}
358
359
360/*********************************************************************
361 * __doserrno (CRTDLL.26)
362 */
363int * CDECL CRTDLL___doserrno()
364{
365 dprintf(("__doserrno\n"));
366 _doserrno = GetLastError();
367 return &_doserrno;
368}
369
370
371/*********************************************************************
372 * __fpecode (CRTDLL.27)
373 */
374int fpecode = 0;
375
376int * CDECL CRTDLL___fpecode ( void )
377{
378 dprintf(("__fpecode\n"));
379 return &fpecode;
380}
381
382
383/*********************************************************************
384 * CRTDLL___isascii (CRTDLL.28)
385 */
386int CDECL CRTDLL___isascii(int i)
387{
388 dprintf(("CRTDLL: __isascii\n"));
389 return (!((i)&(~0x7f)));
390}
391
392
393/*********************************************************************
394 * CRTDLL___iscsym (CRTDLL.29)
395 */
396int CDECL CRTDLL___iscsym(int c)
397{
398 dprintf(("CRTDLL: __iscsym\n"));
399 return (CRTDLL_isalnum(c) || ( c == '_' )) ;
400}
401
402
403/*********************************************************************
404 * CRTDLL___iscsymf (CRTDLL.30)
405 */
406int CDECL CRTDLL___iscsymf(int c)
407{
408 dprintf(("CRTDLL: __iscsymf\n"));
409 return (isalpha(c) || ( c == '_' )) ;
410}
411
412
413/*********************************************************************
414 * CRTDLL___pxcptinfoptrs (CRTDLL.32)
415 */
416void ** CDECL CRTDLL___pxcptinfoptrs (void)
417{
418 dprintf(("CRTDLL: __pxcptinfoptrs not implemented.\n"));
419 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
420 return NULL;
421}
422
423
424/*********************************************************************
425 * CRTDLL___threadhandle (CRTDLL.33)
426 */
427unsigned long CDECL CRTDLL___threadhandle( void )
428{
429 dprintf(("CRTDLL: __threadhandle\n"));
430 return GetCurrentThread();
431}
432
433
434/*********************************************************************
435 * CRTDLL___threadid (CRTDLL.34)
436 */
437unsigned long CDECL CRTDLL___threadid(void)
438{
439 dprintf(("CRTDLL: __threadid\n"));
440 return GetCurrentThreadId();
441}
442
443
444/*********************************************************************
445 * CRTDLL__abnormal_termination (CRTDLL.36)
446 */
447int CDECL CRTDLL__abnormal_termination(void)
448{
449 dprintf(("CRTDLL: _abnormal_termination not implemented.\n"));
450 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
451 return FALSE;
452}
453
454
455/*********************************************************************
456 * CRTDLL__access (CRTDLL.37)
457 */
458int CDECL CRTDLL__access(const char *path,int mode)
459{
460 dprintf(("CRTDLL: _access\n"));
461 return (_access(path, mode));
462}
463
464
465/*********************************************************************
466 * CRTDLL___toascii (CRTDLL.38)
467 */
468int CDECL CRTDLL___toascii(int c)
469{
470 dprintf(("CRTDLL: __toascii\n"));
471 return ((unsigned)(c) & 0x7F );
472}
473
474
475/*********************************************************************
476 * _aexit_rtn_dll (CRTDLL.39)
477 */
478VOID CDECL CRTDLL__aexit_rtn_dll(int exitcode)
479{
480 dprintf(("CRTDLL: _aexit_rtn_dll\n"));
481 ExitProcess(exitcode);
482}
483
484
485/*********************************************************************
486 * _amsg_exit (CRTDLL.40)
487 */
488VOID CDECL CRTDLL__amsg_exit(int errnum)
489{
490 dprintf(("CRTDLL: _amsg_exit\n"));
491 fprintf(stderr,strerror(errnum));
492 ExitProcess(-1);
493}
494
495
496/*********************************************************************
497 * CRTDLL__assert (CRTDLL.41)
498 */
499void CDECL CRTDLL__assert( char *s1, char *s2, int i)
500{
501 dprintf(("CRTDLL: _assert\n"));
502 _assert(s1, s2, i);
503}
504
505
506/*********************************************************************
507 * CRTDLL__beep (CRTDLL.45)
508 */
509void CDECL CRTDLL__beep(unsigned nFreq, unsigned nDur)
510{
511 dprintf(("_beep\n"));
512 Beep(nFreq,nDur);
513}
514
515
516/*********************************************************************
517 * CRTDLL__beginthread (CRTDLL.46)
518 */
519unsigned long CDECL CRTDLL__beginthread(void (*pfuncStart)(void *),
520 unsigned unStackSize, void* pArgList)
521{
522 DWORD ThreadId;
523 HANDLE hThread;
524 if ( pfuncStart == NULL )
525 __set_errno(EINVAL);
526
527 hThread = CreateThread( NULL,unStackSize,(LPTHREAD_START_ROUTINE)pfuncStart,pArgList,0, &ThreadId);
528 if (hThread == NULL ) {
529 __set_errno(EAGAIN);
530 return -1;
531 }
532 return (unsigned long)hThread;
533}
534
535
536/*********************************************************************
537 * _c_exit (CRTDLL.47)
538 *
539 */
540void CDECL CRTDLL__c_exit(INT ret)
541{
542 dprintf(("_c_exit(%d)\n",ret));
543 ExitProcess(ret);
544}
545
546
547/*********************************************************************
548 * CRTDLL__cabs (CRTDLL.48)
549 */
550double CDECL CRTDLL__cabs(struct complex * z)
551{
552 dprintf(("CRTDLL: _cabs not implemented\n"));
553 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
554 return FALSE;
555}
556
557
558/*********************************************************************
559 * _cexit (CRTDLL.49)
560 */
561void CDECL CRTDLL__cexit(INT ret)
562{
563 dprintf(("_cexit(%d)\n",ret));
564 ExitProcess(ret);
565}
566
567
568/*********************************************************************
569 * CRTDLL__cgets (CRTDLL.50)
570 */
571char * CDECL CRTDLL__cgets( char *s )
572{
573 dprintf(("CRTDLL: _cgets\n"));
574 return (_cgets(s));
575}
576
577
578/*********************************************************************
579 * _chdir (CRTDLL.51)
580 */
581INT CDECL CRTDLL__chdir(LPCSTR newdir)
582{
583 dprintf(("CRTDLL: chdir\n"));
584 if (!SetCurrentDirectoryA(newdir))
585 return 1;
586 return 0;
587}
588
589
590/*********************************************************************
591 * _chdrive (CRTDLL.52)
592 *
593 * newdir [I] drive to change to, A=1
594 *
595 */
596BOOL CDECL CRTDLL__chdrive(INT newdrive)
597{
598 /* FIXME: generates errnos */
599 dprintf(("CRTDLL: _chdrive\n"));
600 return DRIVE_SetCurrentDrive(newdrive-1);
601}
602
603
604/*********************************************************************
605 * CRTDLL__chgsign (CRTDLL.53)
606 */
607double CDECL CRTDLL__chgsign(double __x)
608{
609 dprintf(("CRTDLL: _chgsign\n"));
610 double_t *x = (double_t *)&x;
611 if ( x->sign == 1 )
612 x->sign = 0;
613 else
614 x->sign = 1;
615
616 return __x;
617}
618
619
620/*********************************************************************
621 * CRTDLL__chmod (CRTDLL.54)
622 */
623int CDECL CRTDLL__chmod( const char *s, int i)
624{
625 dprintf(("CRTDLL: _chmod\n"));
626 return (_chmod(s, i));
627}
628
629
630/*********************************************************************
631 * CRTDLL__chsize (CRTDLL.55)
632 */
633int CDECL CRTDLL__chsize( int i, long l )
634{
635 dprintf(("CRTDLL: _chsize\n"));
636 return (_chsize(i, l));
637}
638
639
640/*********************************************************************
641 * CRTDLL__clearfp (CRTDLL.56)
642 */
643unsigned int CDECL CRTDLL__clearfp( void )
644{
645 dprintf(("CRTDLL: _clearfp\n"));
646 return (_clear87());
647}
648
649
650/*********************************************************************
651 * CRTDLL__close (CRTDLL.57)
652 */
653int CDECL CRTDLL__close(int handle)
654{
655 dprintf(("CRTDLL: _close\n"));
656 return (_close(handle));
657}
658
659
660/*********************************************************************
661 * CRTDLL__commit (CRTDLL.58)
662 */
663int CDECL CRTDLL__commit( int handle )
664{
665 dprintf(("CRTDLL: _commit not implemented.\n"));
666// if (! FlushFileBuffers(_get_osfhandle(_fd)) ) {
667// __set_errno(EBADF);
668// return -1;
669// }
670 return 0;
671}
672
673
674/*********************************************************************
675 * CRTDLL__control87 (CRTDLL.60)
676 */
677unsigned CDECL CRTDLL__control87(unsigned i1,unsigned i2)
678{
679 dprintf(("CRTDLL: _control87\n"));
680 return (_control87(i1, i2));
681}
682
683
684/*********************************************************************
685 * CRTDLL__controlfp (CRTDLL.61)
686 */
687unsigned CDECL CRTDLL__controlfp(unsigned i1,unsigned i2)
688{
689 dprintf(("CRTDLL: _controlfp\n"));
690 return (_control87(i1, i2));
691}
692
693
694/*********************************************************************
695 * CRTDLL__copysign (CRTDLL.62)
696 */
697double CDECL CRTDLL__copysign( double __d, double __s )
698{
699 dprintf(("CRTDLL: _copysign\n"));
700 double_t *d = (double_t *)&__d;
701 double_t *s = (double_t *)&__s;
702
703 d->sign = s->sign;
704
705 return __d;
706}
707
708
709/*********************************************************************
710 * _cprintf (CRTDLL.63)
711 */
712INT CDECL CRTDLL__cprintf( char *s, ... )
713{
714 dprintf(("CRTDLL: _cprintf not implemented.\n"));
715 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
716 return FALSE;
717}
718
719
720/*********************************************************************
721 * CRTDLL__cputs (CRTDLL.65)
722 */
723INT CDECL CRTDLL__cputs( char * s )
724{
725 dprintf(("CRTDLL: _cputs\n"));
726 return (_cputs(s));
727}
728
729
730/*********************************************************************
731 * CRTDLL__creat (CRTDLL.66)
732 */
733INT CDECL CRTDLL__creat( const char *s, int i )
734{
735 dprintf(("CRTDLL: _creat\n"));
736 return (_creat(s, i));
737}
738
739
740/*********************************************************************
741 * CRTDLL__cscanf (CRTDLL.67)
742 */
743INT CDECL CRTDLL__cscanf( char *s, ... )
744{
745 dprintf(("CRTDLL: _cscanf not implemented.\n"));
746 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
747 return FALSE;
748}
749
750
751/*********************************************************************
752 * CRTDLL__cwait (CRTDLL.69)
753 */
754int CDECL CRTDLL__cwait( int *status, int process_id, int action_code )
755{
756 dprintf(("CRTDLL: _cwait\n"));
757 return (_cwait(status, process_id, action_code));
758}
759
760
761/*********************************************************************
762 * CRTDLL__dup (CRTDLL.71)
763 */
764int CDECL CRTDLL__dup(int handle)
765{
766 dprintf(("CRTDLL: _dup\n"));
767 return (_dup(handle));
768}
769
770
771/*********************************************************************
772 * CRTDLL__dup2 (CRTDLL.72)
773 */
774int CDECL CRTDLL__dup2(int handle1,int handle2)
775{
776 dprintf(("CRTDLL: _dup2\n"));
777 return (_dup2(handle1, handle2));
778}
779
780
781/*********************************************************************
782 * CRTDLL__ecvt (CRTDLL.73)
783 */
784char * CDECL CRTDLL__ecvt( double val, int ndig, int *dec, int *sign )
785{
786 dprintf(("CRTDLL: _ecvt\n"));
787 return (_ecvt(val, ndig, dec, sign));
788}
789
790
791/*********************************************************************
792 * CRTDLL__endthread (CRTDLL.74)
793 */
794void CDECL CRTDLL__endthread(void)
795{
796 dprintf(("CRTDLL: _endthread\n"));
797 _endthread ();
798}
799
800
801/*********************************************************************
802 * CRTDLL___eof (CRTDLL.76)
803 */
804int CDECL CRTDLL__eof( int _fd )
805{
806 dprintf(("CRTDLL: _eof\n"));
807 int cur_pos = CRTDLL__lseek(_fd, 0, SEEK_CUR);
808 int end_pos = CRTDLL__filelength( _fd );
809 if ( cur_pos == -1 || end_pos == -1)
810 return -1;
811
812 if ( cur_pos == end_pos )
813 return 1;
814
815 return 0;
816}
817
818
819/*********************************************************************
820 * CRTDLL__errno (CRTDLL.77)
821 */
822int * CDECL CRTDLL__errno(void)
823{
824 dprintf(("CRTDLL: _errno\n"));
825 return (_errno());
826}
827
828
829/*********************************************************************
830 * _except_handler2 (CRTDLL.78)
831 */
832INT CDECL CRTDLL__except_handler2 ( PEXCEPTION_RECORD rec,
833 PEXCEPTION_FRAME frame, PCONTEXT context,
834 PEXCEPTION_FRAME *dispatcher)
835{
836 dprintf(("CRTDLL: _except_handler2\n"));
837 return 1;
838}
839
840
841/*********************************************************************
842 * _execl (CRTDLL.79)
843 */
844int CDECL CRTDLL__execl(const char* szPath, const char* szArgv0, ...)
845{
846 dprintf(("CRTDLL: _execl not implemented.\n"));
847 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
848 return FALSE;
849}
850
851
852/*********************************************************************
853 * CRTDLL__execle (CRTDLL.80)
854 */
855int CDECL CRTDLL__execle( char *s1, char *s2, ...)
856{
857 dprintf(("CRTDLL: _execle not implemented.\n"));
858 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
859 return FALSE;
860}
861
862
863/*********************************************************************
864 * CRTDLL__execlp (CRTDLL.81)
865 */
866int CDECL CRTDLL__execlp( char *s1, char *s2, ...)
867{
868 dprintf(("CRTDLL: _execlp not implemented.\n"));
869 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
870 return FALSE;
871}
872
873
874/*********************************************************************
875 * CRTDLL__execlpe (CRTDLL.82)
876 */
877int CDECL CRTDLL__execlpe( char *s1, char *s2, ...)
878{
879 dprintf(("CRTDLL: _execlpe not implemented.\n"));
880 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
881 return FALSE;
882}
883
884
885/*********************************************************************
886 * CRTDLL__execv (CRTDLL.83)
887 */
888int CDECL CRTDLL__execv( char *s1, char **s2)
889{
890 dprintf(("CRTDLL: _execv\n"));
891 return (_execv(s1, s2));
892}
893
894
895/*********************************************************************
896 * CRTDLL__execve (CRTDLL.84)
897 */
898int CDECL CRTDLL__execve( char *s1, char **s2, char **s3)
899{
900 dprintf(("CRTDLL: _execve\n"));
901 return (_execve(s1, s2, s3));
902}
903
904
905/*********************************************************************
906 * CRTDLL__execvp (CRTDLL.85)
907 */
908int CDECL CRTDLL__execvp( char *s1, char **s2)
909{
910 dprintf(("CRTDLL: _execvp\n"));
911 return (_execvp(s1, s2));
912}
913
914
915/*********************************************************************
916 * CRTDLL__execvpe (CRTDLL.86)
917 */
918int CDECL CRTDLL__execvpe( char *s1, char **s2, char **s3)
919{
920 dprintf(("CRTDLL: _execvpe\n"));
921 return (_execvpe(s1, s2, s3));
922}
923
924
925/*********************************************************************
926 * _exit (CRTDLL.87)
927 */
928VOID CDECL CRTDLL__exit(DWORD ret)
929{
930 dprintf(("CRTDLL: _exit\n"));
931 ExitProcess(ret);
932}
933
934
935/*********************************************************************
936 * _expand (CRTDLL.88)
937 */
938void * CDECL CRTDLL__expand( void *ptr, size_t size )
939{
940 dprintf(("CRTDLL: _expand not implemented.\n"));
941 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
942 return FALSE;
943}
944
945
946/*********************************************************************
947 * _fcloseall (CRTDLL.89)
948 */
949int CDECL CRTDLL__fcloseall( void )
950{
951 dprintf(("CRTDLL: _fcloseall\n"));
952 return (_fcloseall());
953}
954
955
956/*********************************************************************
957 * _fcvt (CRTDLL.90)
958 */
959char * CDECL CRTDLL__fcvt( double val, int ndig, int *dec, int *sign )
960{
961 dprintf(("CRTDLL: _fcvt\n"));
962 return (_fcvt(val, ndig, dec, sign));
963}
964
965
966/*********************************************************************
967 * _fdopen (CRTDLL.91)
968 */
969CRTDLL_FILE * CDECL CRTDLL__fdopen(INT handle, LPCSTR mode)
970{
971 dprintf(("CRTDLL: fdopen\n"));
972 CRTDLL_FILE *file;
973
974 switch (handle)
975 {
976 case 0:
977 file = CRTDLL_stdin;
978 if (!file->handle) file->handle = GetStdHandle( STD_INPUT_HANDLE );
979 break;
980 case 1:
981 file = CRTDLL_stdout;
982 if (!file->handle) file->handle = GetStdHandle( STD_OUTPUT_HANDLE );
983 break;
984 case 2:
985 file=CRTDLL_stderr;
986 if (!file->handle) file->handle = GetStdHandle( STD_ERROR_HANDLE );
987 break;
988 default:
989 file = (PCRTDLL_FILE)HeapAlloc( GetProcessHeap(), 0, sizeof(*file) );
990 file->handle = handle;
991 break;
992 }
993 return file;
994}
995
996
997/*********************************************************************
998 * _fgetchar (CRTDLL.92)
999 */
1000int CDECL CRTDLL__fgetchar( void )
1001{
1002 dprintf(("CRTDLL: _fgetchar\n"));
1003 return (_fgetchar());
1004}
1005
1006
1007/*********************************************************************
1008 * _fgetwchar (CRTDLL.93)
1009 */
1010wint_t CDECL CRTDLL__fgetwchar( void *i )
1011{
1012 dprintf(("CRTDLL: _fgetwchar\n"));
1013 return CRTDLL__getch();
1014}
1015
1016
1017/*********************************************************************
1018 * _filbuf (CRTDLL.94)
1019 */
1020int CDECL CRTDLL__filbuf(FILE * f)
1021{
1022 dprintf(("CRTDLL: _filbuf not implemented.\n"));
1023 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1024 return FALSE;
1025}
1026
1027
1028/*********************************************************************
1029 * CRTDLL__filelength (CRTDLL.96)
1030 */
1031long CDECL CRTDLL__filelength( int i )
1032{
1033 dprintf(("CRTDLL: _filelength\n"));
1034 return (_filelength(i));
1035}
1036
1037
1038/*********************************************************************
1039 * _fileno (CRTDLL.97)
1040 */
1041int CDECL CRTDLL__fileno(FILE * f)
1042{
1043 dprintf(("CRTDLL: _fileno\n"));
1044 return (_fileno(f));
1045}
1046
1047
1048/*********************************************************************
1049* _findclose (CRTDLL.098)
1050*/
1051int CDECL CRTDLL__findclose( long handle )
1052{
1053 dprintf(("CRTDLL: _findclose\n"));
1054 // check no wildcards or invalid handle
1055 if ( handle == 0 || handle == -1)
1056 return 0;
1057 return FindClose(handle);
1058}
1059
1060
1061 /*********************************************************************
1062 * _findfirst (CRTDLL.099)
1063 */
1064DWORD CDECL CRTDLL__findfirst(LPCSTR fname, struct find_t * x2)
1065{
1066 dprintf(("CRTDLL: _findfirst not implemented.\n"));
1067 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1068 return FALSE;
1069}
1070
1071
1072/*********************************************************************
1073 * _findnext (CRTDLL.100)
1074 */
1075INT CDECL CRTDLL__findnext(DWORD hand, struct find_t * x2)
1076{
1077 dprintf(("CRTDLL: _findnext not implemented.\n"));
1078 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1079 return FALSE;
1080}
1081
1082
1083/*********************************************************************
1084 * _finite (CRTDLL.101)
1085 */
1086INT CDECL CRTDLL__finite(double x)
1087{
1088 dprintf(("CRTDLL: _finite\n"));
1089 return !_isinf(x);
1090}
1091
1092
1093/*********************************************************************
1094 * _flsbuf (CRTDLL.102)
1095 */
1096INT CDECL CRTDLL__flsbuf(int i, FILE * f)
1097{
1098 dprintf(("CRTDLL: _flsbuf not implemented.\n"));
1099 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1100 return FALSE;
1101}
1102
1103
1104/*********************************************************************
1105 * _flushall (CRTDLL.103)
1106 */
1107INT CDECL CRTDLL__flushall(void)
1108{
1109 dprintf(("CRTDLL: _flushall\n"));
1110 return (_flushall());
1111}
1112
1113
1114/*********************************************************************
1115 * _fpclass (CRTDLL.105)
1116 */
1117INT CDECL CRTDLL__fpclass( double __d )
1118{
1119 dprintf(("CRTDLL: _fpclass\n"));
1120 double_t *d = (double_t *)&__d;
1121
1122 if ( d->exponent == 0 ) {
1123 if ( d->mantissah == 0 && d->mantissal == 0 ) {
1124 if ( d->sign ==0 )
1125 return FP_NZERO;
1126 else
1127 return FP_PZERO;
1128 } else {
1129 if ( d->sign ==0 )
1130 return FP_NDENORM;
1131 else
1132 return FP_PDENORM;
1133 }
1134 }
1135 if (d->exponent == 0x7ff ) {
1136 if ( d->mantissah == 0 && d->mantissal == 0 ) {
1137 if ( d->sign ==0 )
1138 return FP_NINF;
1139 else
1140 return FP_PINF;
1141 }
1142 else if ( d->mantissah == 0 && d->mantissal != 0 ) {
1143 return FP_QNAN;
1144 }
1145 else if ( d->mantissah == 0 && d->mantissal != 0 ) {
1146 return FP_SNAN;
1147 }
1148
1149 }
1150
1151 return 0;
1152}
1153
1154
1155/*********************************************************************
1156 * _fpieee_flt (CRTDLL.106)
1157 */
1158INT CDECL CRTDLL__fpieee_flt( unsigned long exc_code, struct _EXCEPTION_POINTERS *exc_info, int handler)
1159{
1160 dprintf(("CRTDLL: _fpieee_flt not implemented.\n"));
1161 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1162 return 0;
1163}
1164
1165
1166
1167/*********************************************************************
1168 * _fpreset (CRTDLL.107)
1169 */
1170INT CDECL CRTDLL__fpreset(void)
1171{
1172 dprintf(("CRTDLL: _fpreset not implemented.\n"));
1173 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1174 return FALSE;
1175}
1176
1177
1178/*********************************************************************
1179 * _fputchar (CRTDLL.108)
1180 */
1181INT CDECL CRTDLL__fputchar( int c )
1182{
1183 dprintf(("CRTDLL: _fputchar\n"));
1184 return(_fputchar(c));
1185}
1186
1187
1188/*********************************************************************
1189 * _fputwchar (CRTDLL.109)
1190 */
1191wint_t CDECL CRTDLL__fputwchar( wint_t )
1192{
1193 dprintf(("CRTDLL: _fputwchar not implemented.\n"));
1194 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1195 return FALSE;
1196}
1197
1198
1199/*********************************************************************
1200 * _fsopen (CRTDLL.110)
1201 */
1202FILE * CDECL CRTDLL__fsopen( const char *file, const char *mode, int shflag )
1203{
1204 dprintf(("CRTDLL: _fsopen not implemented.\n"));
1205 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1206 return FALSE;
1207}
1208
1209
1210/*********************************************************************
1211 * _fstat (CRTDLL.111)
1212 */
1213int CDECL CRTDLL__fstat(int file, struct stat* buf)
1214{
1215 dprintf(("CRTDLL: _fstat not implemented.\n"));
1216 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1217 return FALSE;
1218}
1219
1220
1221/*********************************************************************
1222 * _ftime (CRTDLL.112)
1223 */
1224int CDECL CRTDLL__ftime( struct timeb *timeptr )
1225{
1226 dprintf(("CRTDLL: _ftime not implemented.\n"));
1227 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1228 return FALSE;
1229}
1230
1231
1232/*********************************************************************
1233 * _fullpath (CRTDLL.114)
1234 */
1235char * CDECL CRTDLL__fullpath( char *buf, char *path, size_t size )
1236{
1237 dprintf(("CRTDLL: _fullpath\n"));
1238 return (_fullpath(buf, path, size));
1239}
1240
1241
1242/*********************************************************************
1243 * _futime (CRTDLL.115)
1244 */
1245int CDECL CRTDLL__futime( int handle, struct _utimbuf *filetime )
1246{
1247 dprintf(("CRTDLL: _futime not implemented.\n"));
1248 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1249 return FALSE;
1250}
1251
1252
1253/*********************************************************************
1254 * _gcvt (CRTDLL.116)
1255 */
1256char * CDECL CRTDLL__gcvt( double val, int ndig, char *buf )
1257{
1258 dprintf(("CRTDLL: _gcvt\n"));
1259 return (_gcvt(val, ndig, buf));
1260}
1261
1262
1263/*********************************************************************
1264 * _get_osfhandle (CRTDLL.117)
1265 */
1266long CDECL CRTDLL__get_osfhandle( int posixhandle )
1267{
1268 dprintf(("CRTDLL: _get_osfhandle not implemented.\n"));
1269 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1270 return FALSE;
1271}
1272
1273
1274/*********************************************************************
1275 * _getch (CRTDLL.118)
1276 */
1277int CDECL CRTDLL__getch(void)
1278{
1279 dprintf(("CRTDLL: _getch\n"));
1280 return (_getch());
1281}
1282
1283
1284/*********************************************************************
1285 * _getche (CRTDLL.119)
1286 */
1287int CDECL CRTDLL__getche(void)
1288{
1289 dprintf(("CRTDLL: _getche\n"));
1290 return (_getche());
1291}
1292
1293
1294/*********************************************************************
1295 * _getcwd (CRTDLL.120)
1296 */
1297char * CDECL CRTDLL__getcwd( char *buf, size_t size )
1298{
1299 dprintf(("CRTDLL: _getcwd\n"));
1300 return (_getcwd(buf, size));
1301}
1302
1303
1304/*********************************************************************
1305 * _getdcwd (CRTDLL.121)
1306 */
1307char * CDECL CRTDLL__getdcwd( int drive, char *buffer, size_t maxlen )
1308{
1309 dprintf(("CRTDLL: _getdcwd\n"));
1310 return (_getdcwd(drive, buffer, maxlen));
1311}
1312
1313
1314/*********************************************************************
1315 * _getdiskfree (CRTDLL.122)
1316 */
1317unsigned int CDECL CRTDLL__getdiskfree( unsigned int drive, struct _diskfree_t *diskspace)
1318{
1319 dprintf(("CRTDLL: _getdiskfree\n"));
1320 char RootPathName[10];
1321 RootPathName[0] = toupper(drive +'@');
1322 RootPathName[1] = ':';
1323 RootPathName[2] = '\\';
1324 RootPathName[3] = 0;
1325 if ( diskspace == NULL )
1326 return 0;
1327
1328 if ( !GetDiskFreeSpaceA(RootPathName,(LPDWORD)&diskspace->sectors_per_cluster,(LPDWORD)&diskspace->bytes_per_sector,
1329 (LPDWORD )&diskspace->avail_clusters,(LPDWORD )&diskspace->total_clusters ) )
1330 return 0;
1331 return diskspace->avail_clusters;
1332}
1333
1334
1335/*********************************************************************
1336 * _getdllprocaddr (CRTDLL.123)
1337 */
1338FARPROC CDECL CRTDLL__getdllprocaddr(HMODULE hModule,char * lpProcName, int iOrdinal)
1339{
1340 dprintf(("CRTDLL: _getdllprocaddr\n"));
1341 if ( lpProcName != NULL )
1342 return GetProcAddress(hModule, lpProcName);
1343 else
1344 return GetProcAddress(hModule, (LPSTR)iOrdinal);
1345 return (NULL);
1346}
1347
1348
1349/*********************************************************************
1350 * _getdrive (CRTDLL.124)
1351 */
1352unsigned CDECL CRTDLL__getdrive( void )
1353{
1354 dprintf(("CRTDLL: _getdrive\n"));
1355 return DRIVE_GetCurrentDrive() + 1;
1356}
1357
1358
1359/*********************************************************************
1360 * _getdrives (CRTDLL.125)
1361 */
1362unsigned long CDECL CRTDLL__getdrives(void)
1363{
1364 dprintf(("CRTDLL: _getdrives\n"));
1365 return GetLogicalDrives();
1366}
1367
1368
1369/*********************************************************************
1370 * _getpid (CRTDLL.126)
1371 */
1372int CDECL CRTDLL__getpid( void )
1373{
1374 dprintf(("CRTDLL: _getpid\n"));
1375 return (_getpid());
1376}
1377
1378
1379/*********************************************************************
1380 * _getsystime (CRTDLL.127)
1381 */
1382unsigned int CDECL CRTDLL__getsystime(struct tm *tp)
1383{
1384 dprintf(("CRTDLL: _getsystime not implemented.\n"));
1385 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1386 return FALSE;
1387}
1388
1389
1390/*********************************************************************
1391 * _getw (CRTDLL.128)
1392 */
1393int CDECL CRTDLL__getw( FILE *stream )
1394{
1395 dprintf(("CRTDLL: _getw\n"));
1396 int w;
1397
1398 /* Is there a better way? */
1399 if (CRTDLL_fread( &w, sizeof(w), 1, stream) != 1)
1400 return(EOF);
1401 return(w);
1402}
1403
1404
1405/*******************************************************************
1406 * _global_unwind2 (CRTDLL.129)
1407 */
1408void CDECL CRTDLL__global_unwind2( PEXCEPTION_FRAME frame )
1409{
1410 dprintf(("CRTDLL: global_undwind2\n"));
1411 RtlUnwind( frame, 0, NULL, 0 );
1412}
1413
1414
1415/*********************************************************************
1416 * _heapchk (CRTDLL.130)
1417 */
1418int CDECL CRTDLL__heapchk( void )
1419{
1420 dprintf(("CRTDLL: _heapchk\n"));
1421 return (_heapchk());
1422}
1423
1424
1425/*********************************************************************
1426 * _heapmin (CRTDLL.131)
1427 */
1428int CDECL CRTDLL__heapmin( void )
1429{
1430 dprintf(("CRTDLL: _heapmin\n"));
1431 return (_heapmin());
1432}
1433
1434
1435/*********************************************************************
1436 * _heapset (CRTDLL.132)
1437 */
1438int CDECL CRTDLL__heapset( unsigned int fill )
1439{
1440 dprintf(("CRTDLL: _heapset\n"));
1441 return (_heapset(fill));
1442}
1443
1444
1445/*********************************************************************
1446 * _heapwalk (CRTDLL.133)
1447 */
1448int CDECL CRTDLL__heapwalk( struct _heapinfo *entry )
1449{
1450 dprintf(("CRTDLL: _heapwalk not implemented.\n"));
1451 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1452 return 0;
1453}
1454
1455
1456/*********************************************************************
1457 * _hypot (CRTDLL.134)
1458 */
1459double CDECL CRTDLL__hypot(double x1, double x2)
1460{
1461 dprintf(("CRTDLL: _hypot\n"));
1462 return (_hypot(x1, x2));
1463}
1464
1465
1466/*********************************************************************
1467 * _initterm (CRTDLL.135)
1468 */
1469DWORD CDECL CRTDLL__initterm(_INITTERMFUN *start,_INITTERMFUN *end)
1470{
1471 dprintf(("CRTDLL: initterm\n"));
1472 _INITTERMFUN *current;
1473
1474 current=start;
1475 while (current<end) {
1476 if (*current) (*current)();
1477 current++;
1478 }
1479 return 0;
1480}
1481
1482
1483/*********************************************************************
1484 * _isatty (CRTDLL.137)
1485 */
1486BOOL CDECL CRTDLL__isatty(DWORD x)
1487{
1488 dprintf(("(%ld)\n",x));
1489 return TRUE;
1490}
1491
1492
1493/*********************************************************************
1494 * _isctype (CRTDLL.138)
1495 */
1496BOOL CDECL CRTDLL__isctype(CHAR x,CHAR type)
1497{
1498 dprintf(("CRTDLL: isctype\n"));
1499 if ((type & CRTDLL_SPACE) && isspace(x))
1500 return TRUE;
1501 if ((type & CRTDLL_PUNCT) && ispunct(x))
1502 return TRUE;
1503 if ((type & CRTDLL_LOWER) && islower(x))
1504 return TRUE;
1505 if ((type & CRTDLL_UPPER) && isupper(x))
1506 return TRUE;
1507 if ((type & CRTDLL_ALPHA) && isalpha(x))
1508 return TRUE;
1509 if ((type & CRTDLL_DIGIT) && isdigit(x))
1510 return TRUE;
1511 if ((type & CRTDLL_CONTROL) && iscntrl(x))
1512 return TRUE;
1513 /* check CRTDLL_LEADBYTE */
1514 return FALSE;
1515}
1516
1517
1518/*********************************************************************
1519 * _ismbbalnum (CRTDLL.139)
1520 */
1521int CDECL CRTDLL__ismbbalnum( unsigned int c )
1522{
1523 dprintf(("CRTDLL: _ismbbalnum\n"));
1524 return (CRTDLL_isalnum(c) || CRTDLL__ismbbkalnum(c));
1525}
1526
1527
1528/*********************************************************************
1529 * _ismbbalpha (CRTDLL.140)
1530 */
1531int CDECL CRTDLL__ismbbalpha( unsigned int c )
1532{
1533 dprintf(("CRTDLL: _ismbbalpha\n"));
1534 return (isalpha(c) || CRTDLL__ismbbkalnum(c));
1535}
1536
1537
1538/*********************************************************************
1539 * _ismbbgraph (CRTDLL.141)
1540 */
1541int CDECL CRTDLL__ismbbgraph( unsigned int c )
1542{
1543 dprintf(("CRTDLL: _ismbbgraph\n"));
1544 return (CRTDLL_isgraph(c) || CRTDLL__ismbbkana(c));
1545}
1546
1547
1548/*********************************************************************
1549 * _ismbbkalnum (CRTDLL.142)
1550 */
1551int CDECL CRTDLL__ismbbkalnum( unsigned int c )
1552{
1553 dprintf(("CRTDLL: _ismbbkalnum\n"));
1554 return ((_jctype+1)[(unsigned char)(c)] & (_KNJ_P));
1555}
1556
1557
1558/*********************************************************************
1559 * _ismbbkana (CRTDLL.143)
1560 */
1561int CDECL CRTDLL__ismbbkana( unsigned int c )
1562{
1563 dprintf(("CRTDLL: _ismbbkana\n"));
1564 return ((_jctype+1)[(unsigned char)(c)] & (_KNJ_M|_KNJ_P));
1565}
1566
1567
1568/*********************************************************************
1569 * _ismbbkpunct (CRTDLL.144)
1570 */
1571int CDECL CRTDLL__ismbbkpunct( unsigned int c )
1572{
1573 dprintf(("CRTDLL: _ismbbkpunct\n"));
1574 return ((_jctype+1)[(unsigned char)(c)] & (_KNJ_P));
1575}
1576
1577
1578/*********************************************************************
1579 * _ismbblead (CRTDLL.145)
1580 */
1581int CDECL CRTDLL__ismbblead( unsigned int c )
1582{
1583 dprintf(("CRTDLL: _ismbblead\n"));
1584 return ((_jctype+1)[(unsigned char)(c)] & _KNJ_1);
1585}
1586
1587
1588/*********************************************************************
1589 * _ismbbprint (CRTDLL.146)
1590 */
1591int CDECL CRTDLL__ismbbprint( unsigned int c )
1592{
1593 dprintf(("CRTDLL: _ismbbprint\n"));
1594 return (isprint(c) || CRTDLL__ismbbkana(c));
1595}
1596
1597
1598/*********************************************************************
1599 * _ismbbpunct (CRTDLL.147)
1600 */
1601int CDECL CRTDLL__ismbbpunct( unsigned int c )
1602{
1603 dprintf(("CRTDLL: _ismbbpunct\n"));
1604 return (ispunct(c) || CRTDLL__ismbbkana(c));
1605}
1606
1607
1608/*********************************************************************
1609 * _ismbbtrail (CRTDLL.148)
1610 */
1611int CDECL CRTDLL__ismbbtrail( unsigned int c )
1612{
1613 dprintf(("CRTDLL: _ismbbtrail\n"));
1614 return ((_jctype+1)[(unsigned char)(c)] & _KNJ_2);
1615}
1616
1617
1618/*********************************************************************
1619 * _ismbcalpha (CRTDLL.149)
1620 */
1621int CDECL CRTDLL__ismbcalpha( unsigned int c )
1622{
1623 dprintf(("CRTDLL: _ismbcalpha\n"));
1624 if ((c & 0xFF00) != 0) {
1625 // true multibyte character
1626 return 0;
1627 }
1628 else
1629 return CRTDLL__ismbbalpha(c);
1630
1631 return 0;
1632}
1633
1634
1635/*********************************************************************
1636 * _ismbcdigit (CRTDLL.150)
1637 */
1638int CDECL CRTDLL__ismbcdigit( unsigned int c )
1639{
1640 dprintf(("CRTDLL: _ismbcdigit\n"));
1641 if ((c & 0xFF00) != 0) {
1642 // true multibyte character
1643 return 0;
1644 }
1645 else
1646 return 0;
1647// return _ismbbdigit(c);
1648
1649 return 0;
1650}
1651
1652
1653/*********************************************************************
1654 * _ismbchira (CRTDLL.151)
1655 */
1656int CDECL CRTDLL__ismbchira( unsigned int c )
1657{
1658 dprintf(("CRTDLL: _ismbchira\n"));
1659 return ((c>=0x829F) && (c<=0x82F1));
1660}
1661
1662
1663/*********************************************************************
1664 * _ismbckata (CRTDLL.152)
1665 */
1666int CDECL CRTDLL__ismbckata( unsigned int c )
1667{
1668 dprintf(("CRTDLL: _ismbckata\n"));
1669 return ((c>=0x8340) && (c<=0x8396));
1670}
1671
1672/*********************************************************************
1673 * _ismbcl0 (CRTDLL.153)
1674 */
1675int CDECL CRTDLL__ismbcl0( unsigned int ch )
1676{
1677 dprintf(("CRTDLL: _ismbcl0 not implemented.\n"));
1678 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1679 return 0;
1680}
1681
1682
1683/*********************************************************************
1684 * _ismbcl1 (CRTDLL.154)
1685 */
1686int CDECL CRTDLL__ismbcl1( unsigned int ch )
1687{
1688 dprintf(("CRTDLL: _ismbcl1 not implemented.\n"));
1689 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1690 return 0;
1691}
1692
1693
1694/*********************************************************************
1695 * _ismbcl2 (CRTDLL.155)
1696 */
1697int CDECL CRTDLL__ismbcl2( unsigned int ch )
1698{
1699 dprintf(("CRTDLL: _ismbcl2 not implemented.\n"));
1700 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1701 return 0;
1702}
1703
1704
1705/*********************************************************************
1706 * _ismbclegal (CRTDLL.156)
1707 */
1708int CDECL CRTDLL__ismbclegal( unsigned int c )
1709{
1710 dprintf(("CRTDLL: _ismbclegal\n"));
1711 if ((c & 0xFF00) != 0) {
1712 return CRTDLL__ismbblead(c>>8) && CRTDLL__ismbbtrail(c&0xFF);
1713 }
1714 else
1715 return CRTDLL__ismbbtrail(c&0xFF);
1716
1717 return 0;
1718}
1719
1720
1721/*********************************************************************
1722 * _ismbclower (CRTDLL.157)
1723 */
1724int CDECL CRTDLL__ismbclower( unsigned int c )
1725{
1726 dprintf(("CRTDLL: _ismbclower\n"));
1727 if ((c & 0xFF00) != 0) {
1728 if ( c >= 0x829A && c<= 0x829A )
1729 return 1;
1730 }
1731 else
1732 return isupper(c);
1733}
1734
1735
1736/*********************************************************************
1737 * _ismbcprint (CRTDLL.158)
1738 */
1739int CDECL CRTDLL__ismbcprint( unsigned int c )
1740{
1741 dprintf(("CRTDLL: _ismbcprint\n"));
1742 if ((c & 0xFF00) != 0) {
1743 // true multibyte character
1744 return 0;
1745 }
1746 else
1747 return 0;
1748// return _ismbbdigit(c);
1749
1750 return 0;
1751}
1752
1753
1754/*********************************************************************
1755 * _ismbcspace (CRTDLL.159)
1756 */
1757int CDECL CRTDLL__ismbcspace( unsigned int c )
1758{
1759 dprintf(("CRTDLL: _ismbcspace not implemented.\n"));
1760 if ((c & 0xFF00) != 0) {
1761 // true multibyte character
1762 return 0;
1763 }
1764 else
1765 return 0;
1766// return _ismbbdigit(c);
1767
1768 return 0;
1769}
1770
1771
1772/*********************************************************************
1773 * _ismbcsymbol (CRTDLL.160)
1774 */
1775int CDECL CRTDLL__ismbcsymbol( unsigned int c )
1776{
1777 dprintf(("CRTDLL: _ismbcsymbol\n"));
1778 if ((c & 0xFF00) != 0) {
1779 // true multibyte character
1780 return 0;
1781 }
1782 else
1783 return 0;
1784// return _ismbbdigit(c);
1785
1786 return 0;
1787}
1788
1789
1790/*********************************************************************
1791 * _ismbcupper (CRTDLL.161)
1792 */
1793int CDECL CRTDLL__ismbcupper( unsigned int c )
1794{
1795 dprintf(("CRTDLL: _ismbcupper\n"));
1796 if ((c & 0xFF00) != 0) {
1797 if ( c >= 0x8260 && c<= 0x8279 )
1798 return 1;
1799 }
1800 else
1801 return isupper(c);
1802}
1803
1804
1805/*********************************************************************
1806 * _ismbslead (CRTDLL.162)
1807 */
1808int CDECL CRTDLL__ismbslead(const unsigned char *str, const unsigned char *t)
1809{
1810 dprintf(("CRTDLL: _ismbslead\n"));
1811 unsigned char *s = (unsigned char *)str;
1812 while(*s != 0 && s != t)
1813 {
1814 s+= _mbclen2(*s);
1815 }
1816 return CRTDLL__ismbblead( *s);
1817}
1818
1819
1820/*********************************************************************
1821 * _ismbstrail (CRTDLL.163)
1822 */
1823int CDECL CRTDLL__ismbstrail(const unsigned char *str, const unsigned char *t)
1824{
1825 dprintf(("CRTDLL: _ismbstrail\n"));
1826 unsigned char *s = (unsigned char *)str;
1827 while(*s != 0 && s != t)
1828 {
1829
1830 s+= _mbclen2(*s);
1831 }
1832
1833 return CRTDLL__ismbbtrail(*s);
1834}
1835
1836
1837/*********************************************************************
1838 * _isnan (CRTDLL.164)
1839 */
1840int CDECL CRTDLL__isnan( double __x )
1841{
1842 dprintf(("CRTDLL: _isnan\n"));
1843 double_t * x = (double_t *)&__x;
1844 return ( x->exponent == 0x7ff && ( x->mantissah != 0 || x->mantissal != 0 ));
1845}
1846
1847
1848/*********************************************************************
1849 * _j0 (CRTDLL.166)
1850 */
1851double CDECL CRTDLL__j0(double x)
1852{
1853 dprintf(("CRTDLL: _j0\n"));
1854 return (_j0(x));
1855}
1856
1857
1858/*********************************************************************
1859 * _j1 (CRTDLL.167)
1860 */
1861double CDECL CRTDLL__j1(double x)
1862{
1863 dprintf(("CRTDLL: _j1\n"));
1864 return (_j1(x));}
1865
1866
1867/*********************************************************************
1868 * _jn (CRTDLL.168)
1869 */
1870double CDECL CRTDLL__jn(int i, double x)
1871{
1872 dprintf(("CRTDLL: _jn\n"));
1873 return (_jn(i, x));
1874}
1875
1876
1877/*********************************************************************
1878 * _kbhit (CRTDLL.169)
1879 */
1880int CDECL CRTDLL__kbhit( void )
1881{
1882 dprintf(("CRTDLL: _kbhit\n"));
1883 return (_kbhit());
1884}
1885
1886
1887/*********************************************************************
1888 * _lfind (CRTDLL.170)
1889 */
1890void * CDECL CRTDLL__lfind(const void *v1, const void *v2, unsigned int *i1, unsigned int i2,
1891 int (CDECL *i3)(const void *v3, const void *v4))
1892{
1893 dprintf(("CRTDLL: _lfind not implemented.\n"));
1894 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1895 return FALSE;
1896// return (_lfind(v1,v2,i1,i2,i3(v3,v4)));
1897}
1898
1899
1900/*********************************************************************
1901 * _loaddll (CRTDLL.171)
1902 */
1903void * CDECL CRTDLL__loaddll (char *name)
1904{
1905 dprintf(("CRTDLL: _loaddll\n"));
1906 return (void*)LoadLibraryA(name);
1907}
1908
1909
1910/*******************************************************************
1911 * _local_unwind2 (CRTDLL.172)
1912 */
1913void CDECL CRTDLL__local_unwind2( PEXCEPTION_FRAME endframe, DWORD nr )
1914{
1915 dprintf(("CRTDLL: local_undwind2\n"));
1916}
1917
1918
1919/*********************************************************************
1920 * _locking (CRTDLL.173)
1921 */
1922int CDECL CRTDLL__locking(int handle,int mode,unsigned long nbyte)
1923{
1924 dprintf(("CRTDLL: _locking not implemented.\n"));
1925 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1926 return FALSE;
1927}
1928
1929
1930/*********************************************************************
1931 * _logb (CRTDLL.174)
1932 */
1933double CDECL CRTDLL__logb( double x )
1934{
1935 dprintf(("CRTDLL: _logb not implemented.\n"));
1936 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1937 return FALSE;
1938}
1939
1940
1941/*********************************************************************
1942 * _lrotl (CRTDLL.175)
1943 */
1944unsigned long CDECL CRTDLL__lrotl( unsigned long value, unsigned int shift )
1945{
1946 dprintf(("CRTDLL: _lrotl\n"));
1947 return (_lrotl(value, shift));
1948}
1949
1950
1951/*********************************************************************
1952 * _lrotr (CRTDLL.176)
1953 */
1954unsigned long CDECL CRTDLL__lrotr( unsigned long value, unsigned int shift )
1955{
1956 dprintf(("CRTDLL: _lrotr\n"));
1957 return (_lrotr(value, shift));
1958}
1959
1960
1961/*********************************************************************
1962 * _lsearch (CRTDLL.177)
1963 */
1964void * CDECL CRTDLL__lsearch(const void *v1, void *v2, unsigned int *i1, unsigned int i2,
1965 int (CDECL *i3)(const void *v3, const void *v4))
1966{
1967 dprintf(("CRTDLL: _lsearch not implemented.\n"));
1968 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1969 return FALSE;
1970// return (_lsearch(v1,v2,i1,i2,i3(v3,v4)));
1971}
1972
1973
1974/*********************************************************************
1975 * _lseek (CRTDLL.178)
1976 */
1977long CDECL CRTDLL__lseek(int handle,long offset,int origin)
1978{
1979 dprintf(("CRTDLL: _lssek\n"));
1980 return (_lseek(handle, offset, origin));
1981}
1982
1983
1984/*********************************************************************
1985 * _makepath (CRTDLL.180)
1986 */
1987void CDECL CRTDLL__makepath( char *path, char *drive,
1988 char *dir, char *fname, char *ext )
1989{
1990 dprintf(("CRTDLL: _makepath\n"));
1991 _makepath(path, drive, dir, fname, ext);
1992}
1993
1994
1995/*********************************************************************
1996 * _matherr (CRTDLL.181)
1997 */
1998#if (__IBMCPP__ > 300)
1999#define exception _exception
2000#endif
2001
2002double CDECL CRTDLL__matherr( struct exception * excep )
2003{
2004 dprintf(("CRTDLL: _matherr\n"));
2005 return (_matherr(excep));
2006}
2007
2008
2009/*********************************************************************
2010 * _mbbtombc (CRTDLL.182)
2011 */
2012unsigned int CDECL CRTDLL__mbbtombc( unsigned int c )
2013{
2014 dprintf(("CRTDLL: _mbbtombc\n"));
2015 if (c >= 0x20 && c <= 0x7e) {
2016 return han_to_zen_ascii_table[c - 0x20];
2017 } else if (ISKANA(c)) {
2018 return han_to_zen_kana_table[c - 0xa0];
2019 }
2020 return c;
2021}
2022
2023
2024/*********************************************************************
2025 * _mbbtype (CRTDLL.183)
2026 */
2027int CDECL CRTDLL__mbbtype( unsigned char c, int type )
2028{
2029 dprintf(("CRTDLL: _mbbtype\n"));
2030 if ( type == 1 ) {
2031 if ((c >= 0x40 && c <= 0x7e ) || (c >= 0x80 && c <= 0xfc ) )
2032 {
2033 return _MBC_TRAIL;
2034 }
2035 else if (( c >= 0x20 && c >= 0x7E ) || ( c >= 0xA1 && c <= 0xDF ) ||
2036 ( c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC ) )
2037 return _MBC_ILLEGAL;
2038 else
2039 return 0;
2040
2041 }
2042 else {
2043 if (( c >= 0x20 && c <= 0x7E ) || ( c >= 0xA1 && c <= 0xDF )) {
2044 return _MBC_SINGLE;
2045 }
2046 else if ( (c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC) )
2047 return _MBC_LEAD;
2048 else if (( c >= 0x20 && c >= 0x7E ) || ( c >= 0xA1 && c <= 0xDF ) ||
2049 ( c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC ) )
2050 return _MBC_ILLEGAL;
2051 else
2052 return 0;
2053
2054 }
2055
2056
2057 return 0;
2058}
2059
2060
2061/*********************************************************************
2062 * _mbccpy (CRTDLL.184)
2063 */
2064void CDECL CRTDLL__mbccpy( unsigned char *dst, const unsigned char *src )
2065{
2066 dprintf(("CRTDLL: _mbccpy\n"));
2067
2068 if (!CRTDLL__ismbblead(*src) )
2069 return;
2070
2071 memcpy(dst,src,_mbclen2(*src));
2072}
2073
2074
2075/*********************************************************************
2076 * _mbcjistojms (CRTDLL.185)
2077 */
2078int CDECL CRTDLL__mbcjistojms( unsigned int c )
2079{
2080 dprintf(("CRTDLL: _mbcjistojms\n"));
2081 int c1, c2;
2082
2083 c2 = (unsigned char)c;
2084 c1 = c >> 8;
2085 if (c1 >= 0x21 && c1 <= 0x7e && c2 >= 0x21 && c2 <= 0x7e) {
2086 if (c1 & 0x01) {
2087 c2 += 0x1f;
2088 if (c2 >= 0x7f)
2089 c2 ++;
2090 } else {
2091 c2 += 0x7e;
2092 }
2093 c1 += 0xe1;
2094 c1 >>= 1;
2095 if (c1 >= 0xa0)
2096 c1 += 0x40;
2097 return ((c1 << 8) | c2);
2098 }
2099 return 0;
2100}
2101
2102
2103/*********************************************************************
2104 * _mbcjmstojis (CRTDLL.186)
2105 */
2106int CDECL CRTDLL__mbcjmstojis( unsigned int c )
2107{
2108 dprintf(("CRTDLL: _mbcjmstojis\n"));
2109 int c1, c2;
2110
2111 c2 = (unsigned char)c;
2112 c1 = c >> 8;
2113 if (c1 < 0xf0 && CRTDLL__ismbblead(c1) && CRTDLL__ismbbtrail(c2)) {
2114 if (c1 >= 0xe0)
2115 c1 -= 0x40;
2116 c1 -= 0x70;
2117 c1 <<= 1;
2118 if (c2 < 0x9f) {
2119 c1 --;
2120 c2 -= 0x1f;
2121 if (c2 >= (0x80-0x1f))
2122 c2 --;
2123 } else {
2124 c2 -= 0x7e;
2125 }
2126 return ((c1 << 8) | c2);
2127 }
2128 return 0;
2129}
2130
2131
2132/*********************************************************************
2133 * _mbclen (CRTDLL.187)
2134 */
2135size_t CDECL CRTDLL__mbclen( const unsigned char *s )
2136{
2137 dprintf(("CRTDLL: _mbclen\n"));
2138 return (CRTDLL__ismbblead(*s>>8) && CRTDLL__ismbbtrail(*s&0x00FF)) ? 2 : 1;
2139}
2140
2141
2142/*********************************************************************
2143 * _mbctohira (CRTDLL.188)
2144 */
2145int CDECL CRTDLL__mbctohira( unsigned int c )
2146{
2147 dprintf(("CRTDLL: _mbctohira\n"));
2148 return c;
2149}
2150
2151
2152/*********************************************************************
2153 * _mbctokata (CRTDLL.189)
2154 */
2155int CDECL CRTDLL__mbctokata( unsigned int c )
2156{
2157 dprintf(("CRTDLL: _mbctokata\n"));
2158 return c;
2159}
2160
2161
2162/*********************************************************************
2163 * _mbctolower (CRTDLL.190)
2164 */
2165unsigned int CDECL CRTDLL__mbctolower( unsigned int c )
2166{
2167 dprintf(("CRTDLL: _mbctolower\n"));
2168 if ((c & 0xFF00) != 0) {
2169// true multibyte case conversion needed
2170 if ( CRTDLL__ismbclower(c) )
2171 return c + CASE_DIFF;
2172
2173 } else
2174 return _mbbtolower(c);
2175
2176 return 0;
2177}
2178
2179
2180/*********************************************************************
2181 * _mbctombb (CRTDLL.191)
2182 */
2183unsigned int CDECL CRTDLL__mbctombb( unsigned int c )
2184{
2185 dprintf(("CRTDLL: _mbctombb\n"));
2186 int i;
2187 unsigned short *p;
2188
2189 if (JISKANA(c)) {
2190 return zen_to_han_kana_table[c - 0x8340];
2191 } else if (JISHIRA(c)) {
2192 c = JTOKANA(c);
2193 return zen_to_han_kana_table[c - 0x8340];
2194 } else if (c <= 0x8396) {
2195 for (i = 0x20, p = han_to_zen_ascii_table; i <= 0x7e; i++, p++) {
2196 if (*p == c) {
2197 return i;
2198 }
2199 }
2200 for (i = 0; i < ZTOH_SYMBOLS; i++) {
2201 if (zen_to_han_symbol_table_1[i] == c) {
2202 return zen_to_han_symbol_table_2[i];
2203 }
2204 }
2205 }
2206 return c;
2207}
2208
2209
2210/*********************************************************************
2211 * _mbctoupper (CRTDLL.192)
2212 */
2213unsigned int CDECL CRTDLL__mbctoupper( unsigned int c )
2214{
2215 dprintf(("CRTDLL: _mbctoupper\n"));
2216 if ((c & 0xFF00) != 0) {
2217// true multibyte case conversion needed
2218 if ( CRTDLL__ismbcupper(c) )
2219 return c + CASE_DIFF;
2220
2221 } else
2222 return _mbbtoupper(c);
2223
2224 return 0;
2225}
2226
2227
2228/*********************************************************************
2229 * _mbsbtype (CRTDLL.194)
2230 */
2231int CDECL CRTDLL__mbsbtype( const unsigned char *str, int n )
2232{
2233 dprintf(("CRTDLL: _mbsbtype\n"));
2234 if ( str == NULL )
2235 return -1;
2236 return CRTDLL__mbbtype(*(str+n),1);
2237}
2238
2239
2240/*********************************************************************
2241 * _mbscat (CRTDLL.195)
2242 */
2243unsigned char * CDECL CRTDLL__mbscat( unsigned char *dst, const unsigned char *src )
2244{
2245 dprintf(("CRTDLL: _mbscat\n"));
2246 return (unsigned char*)strcat((char*)dst,(char*)src);
2247}
2248
2249
2250/*********************************************************************
2251 * _mbschr (CRTDLL.196)
2252 */
2253unsigned char * CDECL CRTDLL__mbschr( const unsigned char *str, unsigned int c )
2254{
2255 dprintf(("CRTDLL: _mbschr\n"));
2256 return (unsigned char*)strchr((char*)str,c);
2257}
2258
2259
2260/*********************************************************************
2261 * _mbscmp (CRTDLL.197)
2262 */
2263int CDECL CRTDLL__mbscmp( const unsigned char *s1, const unsigned char *s2 )
2264{
2265 dprintf(("CRTDLL: _mbscmp\n"));
2266 return strcmp((char*)s1,(char*)s2);
2267}
2268
2269
2270/*********************************************************************
2271 * _mbscpy (CRTDLL.198)
2272 */
2273unsigned char * CDECL CRTDLL__mbscpy( unsigned char *s1, const unsigned char *s2 )
2274{
2275 dprintf(("CRTDLL: _mbscpy\n"));
2276 return (unsigned char*)strcpy((char*)s1,(char*)s2);
2277}
2278
2279
2280/*********************************************************************
2281 * _mbscspn (CRTDLL.199)
2282 */
2283size_t CDECL CRTDLL__mbscspn( const unsigned char *s1, const unsigned char *s2 )
2284{
2285 dprintf(("CRTDLL: _mbscspn\n"));
2286 const char *p, *spanp;
2287 char c, sc;
2288
2289 for (p = (const char*)s1;;)
2290 {
2291 c = *p++;
2292 spanp = (const char*)s2;
2293 do {
2294 if ((sc = *spanp++) == c)
2295 return (size_t)(p - 1) - (size_t)s1;
2296 } while (sc != 0);
2297 }
2298 /* NOTREACHED */
2299}
2300
2301
2302/*********************************************************************
2303 * _mbsdec (CRTDLL.200)
2304 */
2305unsigned char * CDECL CRTDLL__mbsdec( const unsigned char *str, const unsigned char *cur )
2306{
2307 dprintf(("CRTDLL: _mbsdec\n"));
2308 unsigned char *s = (unsigned char *)cur;
2309 if ( str >= cur )
2310 return NULL;
2311 s--;
2312 if (CRTDLL__ismbblead(*(s-1)) )
2313 s--;
2314
2315 return s;
2316}
2317
2318
2319/*********************************************************************
2320 * _mbsdup (CRTDLL.201)
2321 */
2322unsigned char * CDECL CRTDLL__mbsdup( unsigned char *_s )
2323{
2324 dprintf(("CRTDLL: _mbsdup\n"));
2325 char *rv;
2326 if (_s == 0)
2327 return 0;
2328 rv = (char *)malloc(CRTDLL__mbslen((LPCSTR)_s) + 1);
2329 if (rv == 0)
2330 return 0;
2331 CRTDLL__mbscpy((unsigned char*)rv, _s);
2332 return (unsigned char*)rv;
2333}
2334
2335
2336/*********************************************************************
2337 * CRTDLL__mbsicmp (CRTDLL.202)
2338 */
2339int CDECL CRTDLL__mbsicmp( const unsigned char *x, const unsigned char *y )
2340{
2341 dprintf(("CRTDLL: _mbsicmp\n"));
2342 do {
2343 if (!*x)
2344 return !!*y;
2345 if (!*y)
2346 return !!*x;
2347 /* FIXME: MBCS handling... */
2348 if (*x!=*y)
2349 return 1;
2350 x++;
2351 y++;
2352 } while (1);
2353}
2354
2355
2356/*********************************************************************
2357 * CRTDLL__mbsinc (CRTDLL.203)
2358 */
2359LPSTR CDECL CRTDLL__mbsinc( LPCSTR str )
2360{
2361 dprintf(("CRTDLL: _mbsinc\n"));
2362 int len = mblen( str, MB_LEN_MAX );
2363 if (len < 1) len = 1;
2364 return (LPSTR)(str + len);
2365}
2366
2367
2368/*********************************************************************
2369 * CRTDLL__mbslen (CRTDLL.204)
2370 */
2371INT CDECL CRTDLL__mbslen( LPCSTR str )
2372{
2373 dprintf(("CRTDLL: _mbslen\n"));
2374 INT len, total = 0;
2375 while ((len = mblen( str, MB_LEN_MAX )) > 0)
2376 {
2377 str += len;
2378 total++;
2379 }
2380 return total;
2381}
2382
2383
2384/*********************************************************************
2385 * _mbslwr (CRTDLL.205)
2386 */
2387unsigned char * CDECL CRTDLL__mbslwr( unsigned char *x )
2388{
2389 dprintf(("CRTDLL: _mbslwr\n"));
2390 unsigned char *y=x;
2391
2392 while (*y) {
2393 if (!CRTDLL__ismbblead(*y) )
2394 *y = tolower(*y);
2395 else {
2396 *y=CRTDLL__mbctolower(*(unsigned short *)y);
2397 y++;
2398 }
2399 }
2400 return x;
2401}
2402
2403
2404/*********************************************************************
2405 * _mbsnbcat (CRTDLL.206)
2406 */
2407unsigned char * CDECL CRTDLL__mbsnbcat( unsigned char *dst, const unsigned char *src, size_t n )
2408{
2409 dprintf(("CRTDLL: _mbsnbcat\n"));
2410 char *d;
2411 char *s = (char *)src;
2412 if (n != 0) {
2413 d = (char*)dst + strlen((char*)dst); // get the end of string
2414 d += _mbclen2(*d); // move 1 or 2 up
2415
2416 do {
2417 if ((*d++ = *s++) == 0)
2418 {
2419 while (--n != 0)
2420 *d++ = 0;
2421 break;
2422 }
2423 if ( !(n==1 && CRTDLL__ismbblead(*s)) )
2424 n--;
2425 } while (n > 0);
2426 }
2427 return dst;
2428}
2429
2430
2431/*********************************************************************
2432 * _mbsnbcmp (CRTDLL.207)
2433 */
2434int CDECL CRTDLL__mbsnbcmp( const unsigned char *str1, const unsigned char *str2, size_t n )
2435{
2436 dprintf(("CRTDLL: _mbsnbcmp\n"));
2437 unsigned char *s1 = (unsigned char *)str1;
2438 unsigned char *s2 = (unsigned char *)str2;
2439
2440 unsigned short *short_s1, *short_s2;
2441
2442 int l1, l2;
2443
2444 if (n == 0)
2445 return 0;
2446 do {
2447
2448 if (*s1 == 0)
2449 break;
2450
2451 l1 = CRTDLL__ismbblead(*s1);
2452 l2 = CRTDLL__ismbblead(*s2);
2453 if ( !l1 && !l2 ) {
2454
2455 if (*s1 != *s2)
2456 return *s1 - *s2;
2457 else {
2458 s1 += 1;
2459 s2 += 1;
2460 n--;
2461 }
2462 }
2463 else if ( l1 && l2 ){
2464 short_s1 = (unsigned short *)s1;
2465 short_s2 = (unsigned short *)s2;
2466 if ( *short_s1 != *short_s2 )
2467 return *short_s1 - *short_s2;
2468 else {
2469 s1 += 2;
2470 s2 += 2;
2471 n-=2;
2472
2473 }
2474 }
2475 else
2476 return *s1 - *s2;
2477 } while (n > 0);
2478 return 0;
2479}
2480
2481
2482/*********************************************************************
2483 * _mbsnbcnt (CRTDLL.208)
2484 */
2485size_t CDECL CRTDLL__mbsnbcnt( const unsigned char *str, size_t n )
2486{
2487 dprintf(("CRTDLL: _mbsnbcnt\n"));
2488 unsigned char *s = (unsigned char *)str;
2489 while(*s != 0 && n > 0) {
2490 if (!CRTDLL__ismbblead(*s) )
2491 n--;
2492 s++;
2493 }
2494
2495 return (size_t)(s - str);
2496}
2497
2498
2499/*********************************************************************
2500 * _mbsnbcpy (CRTDLL.209)
2501 */
2502unsigned char * CDECL CRTDLL__mbsnbcpy( unsigned char *str1, const unsigned char *str2, size_t n )
2503{
2504 dprintf(("CRTDLL: _mbsnbcpy\n"));
2505 unsigned char *s1 = (unsigned char *)str1;
2506 unsigned char *s2 = (unsigned char *)str2;
2507
2508 unsigned short *short_s1, *short_s2;
2509
2510 if (n == 0)
2511 return 0;
2512 do {
2513
2514 if (*s2 == 0)
2515 break;
2516
2517 if ( !CRTDLL__ismbblead(*s2) ) {
2518
2519 *s1 = *s2;
2520 s1 += 1;
2521 s2 += 1;
2522 n--;
2523 }
2524 else {
2525 short_s1 = (unsigned short *)s1;
2526 short_s2 = (unsigned short *)s2;
2527 *short_s1 = *short_s2;
2528 s1 += 2;
2529 s2 += 2;
2530 n-=2;
2531 }
2532 } while (n > 0);
2533 return str1;
2534}
2535
2536
2537/*********************************************************************
2538 * _mbsnbicmp (CRTDLL.210)
2539 */
2540int CDECL CRTDLL__mbsnbicmp( const unsigned char *s1, const unsigned char *s2, size_t n )
2541{
2542 dprintf(("CRTDLL: _mbsnbicmp\n"));
2543 if (n == 0)
2544 return 0;
2545 do {
2546 if (_mbbtoupper(*s1) != _mbbtoupper(*s2))
2547 return _mbbtoupper(*(unsigned const char *)s1) - _mbbtoupper(*(unsigned const char *)s2);
2548 s1 += _mbclen2(*s1);
2549 s2 += _mbclen2(*s2);
2550
2551
2552 if (*s1 == 0)
2553 break;
2554 n--;
2555 } while (n > 0);
2556 return 0;
2557}
2558
2559
2560/*********************************************************************
2561 * _mbsnbset (CRTDLL.211)
2562 */
2563unsigned char * CDECL CRTDLL__mbsnbset( unsigned char *src, unsigned int val, size_t count )
2564{
2565 dprintf(("CRTDLL: _mbsnbset\n"));
2566 unsigned char *char_src = (unsigned char *)src;
2567 unsigned short *short_src = (unsigned short *)src;
2568
2569 if ( _mbclen2(val) == 1 ) {
2570
2571 while(count > 0) {
2572 *char_src = val;
2573 char_src++;
2574 count--;
2575 }
2576 *char_src = 0;
2577 }
2578 else {
2579 while(count > 0) {
2580 *short_src = val;
2581 short_src++;
2582 count-=2;
2583 }
2584 *short_src = 0;
2585 }
2586
2587 return src;
2588}
2589
2590
2591/*********************************************************************
2592 * _mbsncat (CRTDLL.212)
2593 */
2594unsigned char * CDECL CRTDLL__mbsncat( unsigned char *dst, const unsigned char *src, size_t n )
2595{
2596 dprintf(("CRTDLL: _mbsncat\n"));
2597 char *d = (char *)dst;
2598 char *s = (char *)src;
2599 if (n != 0) {
2600 d = (char*)dst + strlen((char*)dst); // get the end of string
2601 d += _mbclen2(*d); // move 1 or 2 up
2602
2603 do {
2604 if ((*d++ = *s++) == 0)
2605 {
2606 while (--n != 0)
2607 *d++ = 0;
2608 break;
2609 }
2610 if (!CRTDLL__ismbblead(*s) )
2611 n--;
2612 } while (n > 0);
2613 }
2614 return dst;
2615}
2616
2617
2618/*********************************************************************
2619 * _mbsnccnt (CRTDLL.213)
2620 */
2621size_t CDECL CRTDLL__mbsnccnt( const unsigned char *str, size_t n )
2622{
2623 dprintf(("CRTDLL: _mbsnccnt\n"));
2624 unsigned char *s = (unsigned char *)str;
2625 size_t cnt = 0;
2626 while(*s != 0 && n > 0) {
2627 if (CRTDLL__ismbblead(*s) )
2628 s++;
2629 else
2630 n--;
2631 s++;
2632 cnt++;
2633 }
2634
2635 return cnt;
2636}
2637
2638
2639/*********************************************************************
2640 * _mbsncmp (CRTDLL.214)
2641 */
2642int CDECL CRTDLL__mbsncmp( const unsigned char *str1, const unsigned char *str2, size_t n )
2643{
2644 dprintf(("CRTDLL: _mbsncmp\n"));
2645 unsigned char *s1 = (unsigned char *)str1;
2646 unsigned char *s2 = (unsigned char *)str2;
2647
2648 unsigned short *short_s1, *short_s2;
2649
2650 int l1, l2;
2651
2652 if (n == 0)
2653 return 0;
2654 do {
2655
2656 if (*s1 == 0)
2657 break;
2658
2659 l1 = CRTDLL__ismbblead(*s1);
2660 l2 = CRTDLL__ismbblead(*s2);
2661 if ( !l1 && !l2 ) {
2662
2663 if (*s1 != *s2)
2664 return *s1 - *s2;
2665 else {
2666 s1 += 1;
2667 s2 += 1;
2668 n--;
2669 }
2670 }
2671 else if ( l1 && l2 ){
2672 short_s1 = (unsigned short *)s1;
2673 short_s2 = (unsigned short *)s2;
2674 if ( *short_s1 != *short_s2 )
2675 return *short_s1 - *short_s2;
2676 else {
2677 s1 += 2;
2678 s2 += 2;
2679 n--;
2680
2681 }
2682 }
2683 else
2684 return *s1 - *s2;
2685 } while (n > 0);
2686 return 0;
2687}
2688
2689
2690/*********************************************************************
2691 * _mbsncpy (CRTDLL.215)
2692 */
2693unsigned char * CDECL CRTDLL__mbsncpy( unsigned char *str1, const unsigned char *str2, size_t n )
2694{
2695 dprintf(("CRTDLL: _mbsncpy\n"));
2696 unsigned char *s1 = (unsigned char *)str1;
2697 unsigned char *s2 = (unsigned char *)str2;
2698
2699 unsigned short *short_s1, *short_s2;
2700
2701 if (n == 0)
2702 return 0;
2703 do {
2704
2705 if (*s2 == 0)
2706 break;
2707
2708 if ( !CRTDLL__ismbblead(*s2) ) {
2709
2710 *s1 = *s2;
2711 s1 += 1;
2712 s2 += 1;
2713 n--;
2714 }
2715 else {
2716 short_s1 = (unsigned short *)s1;
2717 short_s2 = (unsigned short *)s2;
2718 *short_s1 = *short_s2;
2719 s1 += 2;
2720 s2 += 2;
2721 n--;
2722 }
2723 } while (n > 0);
2724 return str1;
2725}
2726
2727
2728/*********************************************************************
2729 * _mbsnextc (CRTDLL.216)
2730 */
2731unsigned int CDECL CRTDLL__mbsnextc( const unsigned char *src )
2732{
2733 dprintf(("CRTDLL: _mbsnextc\n"));
2734 unsigned char *char_src = (unsigned char *)src;
2735 unsigned short *short_src = (unsigned short *)src;
2736
2737 if ( src == NULL )
2738 return 0;
2739
2740 if ( !CRTDLL__ismbblead(*src) )
2741 return *char_src;
2742 else
2743 return *short_src;
2744 return 0;
2745
2746}
2747
2748
2749/*********************************************************************
2750 * _mbsnicmp (CRTDLL.217)
2751 */
2752int CDECL CRTDLL__mbsnicmp( const unsigned char *s1, const unsigned char *s2, size_t n )
2753{
2754 dprintf(("CRTDLL: _mbsnicmp\n"));
2755 if (n == 0)
2756 return 0;
2757 do {
2758 if (_mbbtoupper(*s1) != _mbbtoupper(*s2))
2759 return _mbbtoupper(*(unsigned const char *)s1) - _mbbtoupper(*(unsigned const char *)s2);
2760
2761// Next 2 lines won't compile
2762// *s1 += _mbclen2(*s1);
2763// *s2 += _mbclen2(*s2);
2764
2765
2766 if (*s1 == 0)
2767 break;
2768 if (!CRTDLL__ismbblead(*s1) )
2769 n--;
2770 } while (n > 0);
2771 return 0;
2772}
2773
2774
2775/*********************************************************************
2776 * _mbsninc (CRTDLL.218)
2777 */
2778unsigned char * CDECL CRTDLL__mbsninc( const unsigned char *str, size_t n )
2779{
2780 dprintf(("CRTDLL: _mbsninc\n"));
2781 unsigned char *s = (unsigned char *)str;
2782 while(*s != 0 && n > 0) {
2783 if (!CRTDLL__ismbblead(*s) )
2784 n--;
2785 s++;
2786 }
2787
2788 return s;
2789}
2790
2791
2792/*********************************************************************
2793 * _mbsnset (CRTDLL.219)
2794 */
2795unsigned char * CDECL CRTDLL__mbsnset( unsigned char *src, unsigned int val, size_t count )
2796{
2797 dprintf(("CRTDLL: _mbsnset\n"));
2798 unsigned char *char_src = (unsigned char *)src;
2799 unsigned short *short_src = (unsigned short *)src;
2800
2801 if ( _mbclen2(val) == 1 ) {
2802
2803 while(count > 0) {
2804 *char_src = val;
2805 char_src++;
2806 count--;
2807 }
2808 *char_src = 0;
2809 }
2810 else {
2811 while(count > 0) {
2812 *short_src = val;
2813 short_src++;
2814 count-=2;
2815 }
2816 *short_src = 0;
2817 }
2818
2819 return src;
2820
2821}
2822
2823
2824/*********************************************************************
2825 * _mbspbrk (CRTDLL.220)
2826 */
2827unsigned char * CDECL CRTDLL__mbspbrk( const unsigned char *s1, const unsigned char *s2 )
2828{
2829 dprintf(("CRTDLL: _mbspbrk\n"));
2830 const char *scanp;
2831 int c, sc;
2832
2833 while ((c = *s1++) != 0)
2834 {
2835 for (scanp = (char*)s2; (sc = *scanp++) != 0;)
2836 if (sc == c)
2837 return (unsigned char *)((char *)s1 - (char *)1);
2838 }
2839 return 0;
2840}
2841
2842
2843/*********************************************************************
2844 * CRTDLL__mbsrchr (CRTDLL.221)
2845 */
2846LPSTR CDECL CRTDLL__mbsrchr(LPSTR s,CHAR x)
2847{
2848 dprintf(("CRTDLL: _mbsrchr\n"));
2849 /* FIXME: handle multibyte strings */
2850 return strrchr(s,x);
2851}
2852
2853
2854/*********************************************************************
2855 * _mbsrev (CRTDLL.222)
2856 */
2857unsigned char * CDECL CRTDLL__mbsrev( unsigned char *s )
2858{
2859 dprintf(("CRTDLL: _mbsrev\n"));
2860 unsigned char *e;
2861 unsigned char a;
2862 e=s;
2863 while (*e) {
2864 if ( CRTDLL__ismbblead(*e) ) {
2865 a = *e;
2866 *e = *++e;
2867 if ( *e == 0 )
2868 break;
2869 *e = a;
2870 }
2871 e++;
2872 }
2873 while (s<e) {
2874 a=*s;
2875 *s=*e;
2876 *e=a;
2877 s++;
2878 e--;
2879 }
2880
2881
2882 return s;
2883}
2884
2885
2886/*********************************************************************
2887 * _mbsset (CRTDLL.223)
2888 */
2889unsigned char * CDECL CRTDLL__mbsset( unsigned char *src, unsigned int c )
2890{
2891 dprintf(("CRTDLL: _mbsset\n"));
2892 unsigned char *char_src = src;
2893 unsigned short *short_src = (unsigned short*)src;
2894
2895 if ( _mbclen2(c) == 1 ) {
2896
2897 while(*char_src != 0) {
2898 *char_src = c;
2899 char_src++;
2900 }
2901 *char_src = 0;
2902 }
2903 else {
2904 while(*short_src != 0) {
2905 *short_src = c;
2906 short_src++;
2907 }
2908 *short_src = 0;
2909 }
2910
2911 return src;
2912}
2913
2914
2915/*********************************************************************
2916 * _mbsspn (CRTDLL.224)
2917 */
2918size_t CDECL CRTDLL__mbsspn( const unsigned char *s1, const unsigned char *s2 )
2919{
2920 dprintf(("CRTDLL: _mbsspn\n"));
2921 const char *p = (char*)s1, *spanp;
2922 char c, sc;
2923
2924 cont:
2925 c = *p++;
2926 for (spanp = (char*)s2; (sc = *spanp++) != 0;)
2927 if (sc == c)
2928 goto cont;
2929 return (size_t)(p - 1) - (size_t)s1;
2930}
2931
2932
2933/*********************************************************************
2934 * _mbsspnp (CRTDLL.225)
2935 */
2936unsigned char * CDECL CRTDLL__mbsspnp( const unsigned char *s1, const unsigned char *s2 )
2937{
2938 dprintf(("CRTDLL: _mbsspnp\n"));
2939 const char *p = (char*)s1, *spanp;
2940 char c, sc;
2941
2942 cont:
2943 c = *p++;
2944 for (spanp = (char*)s2; (sc = *spanp++) != 0;)
2945 if (sc == c)
2946 goto cont;
2947 return (unsigned char*)p;
2948}
2949
2950
2951/*********************************************************************
2952 * _mbsstr (CRTDLL.226)
2953 */
2954unsigned char * CDECL CRTDLL__mbsstr( const unsigned char *s1, const unsigned char *s2 )
2955{
2956 dprintf(("CRTDLL: _mbsstr\n"));
2957 return (unsigned char*)strstr((const char*)s1,(const char*)s2);
2958}
2959
2960
2961/*********************************************************************
2962 * _mbstok (CRTDLL.227)
2963 */
2964unsigned char * CDECL CRTDLL__mbstok( unsigned char *s, const unsigned char *delim )
2965{
2966 dprintf(("CRTDLL: _mbstok\n"));
2967 const char *spanp;
2968 int c, sc;
2969 char *tok;
2970 static char *last;
2971
2972
2973 if (s == NULL && (s = (unsigned char*)last) == NULL)
2974 return (NULL);
2975
2976 /*
2977 * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
2978 */
2979 cont:
2980 c = *s;
2981 s = (unsigned char*)CRTDLL__mbsinc((LPCSTR)s);
2982
2983 for (spanp = (const char*)delim; (sc = *spanp) != 0; spanp = CRTDLL__mbsinc(spanp)) {
2984 if (c == sc)
2985 goto cont;
2986 }
2987
2988 if (c == 0) { /* no non-delimiter characters */
2989 last = NULL;
2990 return (NULL);
2991 }
2992 tok = (char*)s - 1;
2993
2994 /*
2995 * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
2996 * Note that delim must have one NUL; we stop if we see that, too.
2997 */
2998 for (;;) {
2999 c = *s;
3000 s = (unsigned char*)CRTDLL__mbsinc((LPCSTR)s);
3001 spanp = (const char*)delim;
3002 do {
3003 if ((sc = *spanp) == c) {
3004 if (c == 0)
3005 s = NULL;
3006 else
3007 s[-1] = 0;
3008 last = (char*)s;
3009 return ((unsigned char*)tok);
3010 }
3011 spanp = CRTDLL__mbsinc(spanp);
3012 } while (sc != 0);
3013 }
3014 /* NOTREACHED */
3015}
3016
3017
3018/*********************************************************************
3019 * _mbstrlen (CRTDLL.228)
3020 */
3021size_t CDECL CRTDLL__mbstrlen(const char *string)
3022{
3023 dprintf(("CRTDLL: _mbstrlen\n"));
3024 char *s = (char *)string;
3025 size_t i;
3026 while ( *s != 0 ) {
3027 if ( CRTDLL__ismbblead(*s) )
3028 s++;
3029 s++;
3030 i++;
3031 }
3032 return i;
3033}
3034
3035
3036/*********************************************************************
3037 * _mbsupr (CRTDLL.229)
3038 */
3039unsigned char * CDECL CRTDLL__mbsupr( unsigned char *x )
3040{
3041 dprintf(("CRTDLL: _mbsupr\n"));
3042 unsigned char *y=x;
3043 while (*y) {
3044 if (!CRTDLL__ismbblead(*y) )
3045 *y = toupper(*y);
3046 else {
3047 *y=CRTDLL__mbctoupper(*(unsigned short *)y);
3048 y++;
3049 }
3050 }
3051 return x;
3052}
3053
3054
3055/*********************************************************************
3056 * CRTDLL__memccpy (CRTDLL.230)
3057 */
3058void * CDECL CRTDLL__memccpy(void *to, const void *from,int c,size_t count)
3059{
3060 dprintf(("CRTDLL: _memccpy\n"));
3061 memcpy(to,from,count);
3062 return memchr(to,c,count);
3063}
3064
3065
3066/*********************************************************************
3067 * _mkdir (CRTDLL.232)
3068 */
3069INT CDECL CRTDLL__mkdir(LPCSTR newdir)
3070{
3071 dprintf(("CRTDLL: mkdir\n"));
3072 if (!CreateDirectoryA(newdir,NULL))
3073 return -1;
3074 return 0;
3075}
3076
3077
3078/*********************************************************************
3079 * _mktemp (CRTDLL.233)
3080 */
3081char * CDECL CRTDLL__mktemp( char * _template )
3082{
3083 dprintf(("CRTDLL: _mktemp\n"));
3084 static int count = 0;
3085 char *cp, *dp;
3086 int i, len, xcount, loopcnt;
3087
3088
3089
3090 len = strlen (_template);
3091 cp = _template + len;
3092
3093 xcount = 0;
3094 while (xcount < 6 && cp > _template && cp[-1] == 'X')
3095 xcount++, cp--;
3096
3097 if (xcount) {
3098 dp = cp;
3099 while (dp > _template && dp[-1] != '/' && dp[-1] != '\\' && dp[-1] != ':')
3100 dp--;
3101
3102 /* Keep the first characters of the template, but turn the rest into
3103 Xs. */
3104 while (cp > dp + 8 - xcount) {
3105 *--cp = 'X';
3106 xcount = (xcount >= 6) ? 6 : 1 + xcount;
3107 }
3108
3109 /* If dots occur too early -- squash them. */
3110 while (dp < cp) {
3111 if (*dp == '.') *dp = 'a';
3112 dp++;
3113 }
3114
3115 /* Try to add ".tmp" to the filename. Truncate unused Xs. */
3116 if (cp + xcount + 3 < _template + len)
3117 strcpy (cp + xcount, ".tmp");
3118 else
3119 cp[xcount] = 0;
3120
3121 for (loopcnt = 0; loopcnt < (1 << (5 * xcount)); loopcnt++) {
3122 int c = count++;
3123 for (i = 0; i < xcount; i++, c >>= 5)
3124 cp[i] = "abcdefghijklmnopqrstuvwxyz012345"[c & 0x1f];
3125 if (CRTDLL__access(_template,0) == -1)
3126 return _template;
3127 }
3128 }
3129 /* Failure: truncate the template and return NULL. */
3130 *_template = 0;
3131 return 0;
3132}
3133
3134
3135/*********************************************************************
3136 * _msize (CRTDLL.234)
3137 */
3138size_t CDECL CRTDLL__msize( void *ptr )
3139{
3140 dprintf(("CRTDLL: _msize\n"));
3141 return (_msize(ptr));
3142}
3143
3144
3145/*********************************************************************
3146 * _nextafter (CRTDLL.235)
3147 */
3148double CDECL CRTDLL__nextafter( double x, double y )
3149{
3150 dprintf(("CRTDLL: _nextafter not implemented.\n"));
3151 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3152 return FALSE;
3153}
3154
3155
3156/*********************************************************************
3157 * _onexit (CRTDLL.236)
3158 */
3159onexit_t CDECL CRTDLL__onexit(onexit_t t)
3160{
3161 dprintf(("CRTDLL: _onexit\n"));
3162 return (_onexit(t));
3163}
3164
3165
3166/*********************************************************************
3167 * _open (CRTDLL.237)
3168 */
3169HFILE CDECL CRTDLL__open(LPCSTR path,INT flags)
3170{
3171 dprintf(("CRTDLL: _open\n"));
3172 DWORD access = 0, creation = 0;
3173 HFILE ret;
3174
3175 switch(flags & 3)
3176 {
3177 case O_RDONLY: access |= GENERIC_READ; break;
3178 case O_WRONLY: access |= GENERIC_WRITE; break;
3179 case O_RDWR: access |= GENERIC_WRITE | GENERIC_READ; break;
3180 }
3181
3182 if (flags & 0x0100) /* O_CREAT */
3183 {
3184 if (flags & 0x0400) /* O_EXCL */
3185 creation = CREATE_NEW;
3186 else if (flags & 0x0200) /* O_TRUNC */
3187 creation = CREATE_ALWAYS;
3188 else
3189 creation = OPEN_ALWAYS;
3190 }
3191 else /* no O_CREAT */
3192 {
3193 if (flags & 0x0200) /* O_TRUNC */
3194 creation = TRUNCATE_EXISTING;
3195 else
3196 creation = OPEN_EXISTING;
3197 }
3198 if (flags & 0x0008) /* O_APPEND */
3199 dprintf(("O_APPEND not supported\n" ));
3200 if (flags & 0xf0f4)
3201 dprintf(("CRTDLL_open file unsupported flags 0x%04x\n",flags));
3202 /* End Fixme */
3203
3204 ret = CreateFileA( path, access, FILE_SHARE_READ | FILE_SHARE_WRITE,
3205 NULL, creation, FILE_ATTRIBUTE_NORMAL, -1 );
3206 dprintf(("CRTDLL_open file %s mode 0x%04x got handle %d\n", path,flags,ret));
3207 return ret;
3208}
3209
3210
3211/*********************************************************************
3212 * _open_osfhandle (CRTDLL.238)
3213 */
3214INT CDECL CRTDLL__open_osfhandle( long osfhandle, int flags )
3215{
3216 dprintf(("CRTDLL: _open_osfhandle\n"));
3217HFILE handle;
3218
3219 switch (osfhandle) {
3220 case STD_INPUT_HANDLE :
3221 case 0 :
3222 handle=0;
3223 break;
3224 case STD_OUTPUT_HANDLE:
3225 case 1:
3226 handle=1;
3227 break;
3228 case STD_ERROR_HANDLE:
3229 case 2:
3230 handle=2;
3231 break;
3232 default:
3233 return (-1);
3234 }
3235 dprintf(("(handle %08lx,flags %d) return %d\n",
3236 osfhandle,flags,handle));
3237 return handle;
3238}
3239
3240
3241/*********************************************************************
3242 * _pclose (CRTDLL.244)
3243 */
3244INT CDECL CRTDLL__pclose( FILE *fp )
3245{
3246 dprintf(("CRTDLL: _pclose not implemented.\n"));
3247 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3248 return FALSE;
3249}
3250
3251
3252/*********************************************************************
3253 * _pipe (CRTDLL.247)
3254 */
3255INT CDECL CRTDLL__pipe( int *phandles, unsigned psize, int textmode )
3256{
3257 dprintf(("CRTDLL: _pipe not implemented.\n"));
3258 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3259 return FALSE;
3260}
3261
3262
3263/*********************************************************************
3264 * _popen (CRTDLL.248)
3265 */
3266FILE * CDECL CRTDLL__popen( const char *command, const char *mode )
3267{
3268 dprintf(("CRTDLL: _popen not implemented.\n"));
3269 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3270 return FALSE;
3271}
3272
3273
3274/*********************************************************************
3275 * _purecall (CRTDLL.249)
3276 */
3277void CDECL CRTDLL__purecall(void)
3278{
3279 dprintf(("CRTDLL: _purecall\n"));
3280}
3281
3282
3283/*********************************************************************
3284 * _putch (CRTDLL.250)
3285 */
3286INT CDECL CRTDLL__putch( int i )
3287{
3288 dprintf(("CRTDLL: _putch\n"));
3289 return (_putch(i));
3290}
3291
3292
3293/*********************************************************************
3294 * _putenv (CRTDLL.251)
3295 */
3296INT CDECL CRTDLL__putenv(const char *s)
3297{
3298 dprintf(("CRTDLL: _putenv\n"));
3299 return (_putenv(s));
3300}
3301
3302
3303/*********************************************************************
3304 * _putw (CRTDLL.252)
3305 */
3306INT CDECL CRTDLL__putw( int w, FILE *stream )
3307{
3308 dprintf(("CRTDLL: _putw\n"));
3309 if (fwrite( &w, sizeof(w), 1, stream) < 1)
3310 return(EOF);
3311 return(0);
3312}
3313
3314
3315/*********************************************************************
3316 * _read (CRTDLL.254)
3317 */
3318INT CDECL CRTDLL__read(INT fd, LPVOID buf, UINT count)
3319{
3320 dprintf(("CRTDLL: _read not implemented.\n"));
3321 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3322 return FALSE;
3323}
3324
3325
3326/*********************************************************************
3327 * _rmdir (CRTDLL.255)
3328 */
3329INT CDECL CRTDLL__rmdir(const char *path)
3330{
3331 dprintf(("CRTDLL: _rmdir\n"));
3332 if (!RemoveDirectoryA(path))
3333 return -1;
3334 return 0;
3335}
3336
3337
3338/*********************************************************************
3339 * _rmtmp (CRTDLL.256)
3340 */
3341INT CDECL CRTDLL__rmtmp(void)
3342{
3343 dprintf(("CRTDLL: _rmtmp\n"));
3344 return(_rmtmp());
3345}
3346
3347
3348/*********************************************************************
3349 * CRTDLL__rotl (CRTDLL.257)
3350 */
3351unsigned int CDECL CRTDLL__rotl( unsigned int value, unsigned int shift )
3352{
3353 dprintf(("CRTDLL: _rotl\n"));
3354 return (_rotl(value, shift));
3355}
3356
3357
3358/*********************************************************************
3359 * CRTDLL__rotr (CRTDLL.258)
3360 */
3361unsigned int CDECL CRTDLL__rotr( unsigned int value, unsigned int shift )
3362{
3363 dprintf(("CRTDLL: _rotr\n"));
3364 return (_rotr(value, shift));
3365}
3366
3367
3368/*********************************************************************
3369 * _scalb (CRTDLL.259)
3370 */
3371double CDECL CRTDLL__scalb( double __x, long e )
3372{
3373 dprintf(("CRTDLL: _scalb\n"));
3374 double_t *x = (double_t *)&__x;
3375
3376 x->exponent += e;
3377
3378 return __x;
3379}
3380
3381
3382/*********************************************************************
3383 * CRTDLL__searchenv (CRTDLL.260)
3384 */
3385void CDECL CRTDLL__searchenv(const char *file,const char *var,char *path )
3386{
3387 dprintf(("CRTDLL: _searchenv\n"));
3388 char *env = CRTDLL_getenv(var);
3389
3390 char *x;
3391 char *y;
3392 char *FilePart;
3393 x = strchr(env,'=');
3394 if ( x != NULL ) {
3395 *x = 0;
3396 x++;
3397 }
3398 y = strchr(env,';');
3399 while ( y != NULL ) {
3400 *y = 0;
3401 if ( SearchPathA(x,file,NULL,MAX_PATH,path,&FilePart) > 0 ) {
3402 return;
3403 }
3404 x = y+1;
3405 y = strchr(env,';');
3406 }
3407 return;
3408}
3409
3410
3411/*********************************************************************
3412 * CRTDLL__seterrormode (CRTDLL.261)
3413 */
3414void CDECL CRTDLL__seterrormode(int i)
3415{
3416 dprintf(("CRTDLL: _seterrormode\n"));
3417 SetErrorMode(i);
3418 return;
3419}
3420
3421
3422/*********************************************************************
3423 * CRTDLL__setjmp (CRTDLL.262)
3424 */
3425int CDECL CRTDLL__setjmp( jmp_buf env )
3426{
3427 dprintf(("CRTDLL: _setjmp -> setjmp\n"));
3428 return(setjmp( env));
3429}
3430
3431
3432/*********************************************************************
3433 * _setmode (CRTDLL.263)
3434 */
3435INT CDECL CRTDLL__setmode( INT fh,INT mode)
3436{
3437 dprintf(("CRTDLL: _setmode\n"));
3438 return (_setmode(fh, mode));
3439}
3440
3441
3442/*********************************************************************
3443 * _setsystime (CRTDLL.264)
3444 */
3445unsigned int CDECL CRTDLL__setsystime(struct tm *tp, unsigned int ms)
3446{
3447 dprintf(("CRTDLL: _setsystime not implemented.\n"));
3448 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3449 return FALSE;
3450}
3451
3452
3453/*********************************************************************
3454 * _sleep (CRTDLL.265)
3455 */
3456VOID CDECL CRTDLL__sleep(unsigned long timeout)
3457{
3458 dprintf(("CRTDLL__sleep for %ld milliseconds\n",timeout));
3459 Sleep((timeout)?timeout:1);
3460}
3461
3462
3463/*********************************************************************
3464 * _sopen (CRTDLL.268)
3465 */
3466int CDECL CRTDLL__sopen( const char *s, int i1, int i2, ... )
3467{
3468 dprintf(("CRTDLL: _sopen not implemented.\n"));
3469 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3470 return FALSE;
3471}
3472
3473
3474/*********************************************************************
3475 * CRTDLL__spawnl (CRTDLL.269)
3476 */
3477int CDECL CRTDLL__spawnl( int i, char *s1, char *s2, ... )
3478{
3479 dprintf(("CRTDLL: _spawnl not implemented.\n"));
3480 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3481 return FALSE;
3482}
3483
3484
3485/*********************************************************************
3486 * CRTDLL__spawnle (CRTDLL.270)
3487 */
3488int CDECL CRTDLL__spawnle( int i, char *s1, char *s2, ... )
3489{
3490 dprintf(("CRTDLL: _spawnle not implemented.\n"));
3491 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3492 return FALSE;
3493}
3494
3495
3496/*********************************************************************
3497 * CRTDLL__spawnlp (CRTDLL.271)
3498 */
3499int CDECL CRTDLL__spawnlp( int i, char *s1, char *s2, ... )
3500{
3501 dprintf(("CRTDLL: _spawnlp not implemented.\n"));
3502 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3503 return FALSE;
3504}
3505
3506
3507/*********************************************************************
3508 * CRTDLL__spawnlpe (CRTDLL.272)
3509 */
3510int CDECL CRTDLL__spawnlpe( int i, char *s1, char *s2, ... )
3511{
3512 dprintf(("CRTDLL: _spawnlpe not implemented.\n"));
3513 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3514 return FALSE;
3515}
3516
3517
3518/*********************************************************************
3519 * CRTDLL__spawnv (CRTDLL.273)
3520 */
3521int CDECL CRTDLL__spawnv( int i, char *s1, char ** s2 )
3522{
3523 dprintf(("CRTDLL: _spawnv\n"));
3524 return (_spawnv(i, s1, s2));
3525}
3526
3527
3528/*********************************************************************
3529 * CRTDLL__spawnve (CRTDLL.274)
3530 */
3531int CDECL CRTDLL__spawnve( int i, char *s1, char ** s2, char ** s3 )
3532{
3533 dprintf(("CRTDLL: _spawnve\n"));
3534 return (_spawnve(i, s1, s2, s3));
3535}
3536
3537
3538/*********************************************************************
3539 * CRTDLL__spawnvp (CRTDLL.275)
3540 */
3541int CDECL CRTDLL__spawnvp( int i, char *s1, char ** s2 )
3542{
3543 dprintf(("CRTDLL: _spawnvp\n"));
3544 return (_spawnvp(i, s1, s2));
3545}
3546
3547/*********************************************************************
3548 * CRTDLL__spawnv (CRTDLL.276)
3549 */
3550int CDECL CRTDLL__spawnvpe( int i, char *s1, char ** s2, char ** s3 )
3551{
3552 dprintf(("CRTDLL: _spawnvpe\n"));
3553 return (_spawnvpe(i, s1, s2, s3));
3554}
3555
3556
3557/*********************************************************************
3558 * CRTDLL__stat (CRTDLL.278)
3559 */
3560int CDECL CRTDLL__stat( const char *s1, struct stat * n )
3561{
3562 dprintf(("CRTDLL: _stat\n"));
3563 return(_stat(s1, n));
3564}
3565
3566
3567/*********************************************************************
3568 * CRTDLL__statusfp (CRTDLL.279)
3569 */
3570unsigned int CDECL CRTDLL__statusfp( void )
3571{
3572 dprintf(("CRTDLL: _statusfp\n"));
3573 return (_status87());
3574}
3575
3576
3577/*********************************************************************
3578 * CRTDLL__strdate (CRTDLL.281)
3579 */
3580char * CDECL CRTDLL__strdate( char *buf )
3581{
3582 dprintf(("CRTDLL: _strdate\n"));
3583 return(_strdate(buf));
3584}
3585
3586
3587/*********************************************************************
3588 * CRTDLL__strdec (CRTDLL.282)
3589 */
3590char * CDECL CRTDLL__strdec( const char *, const char *p )
3591{
3592 dprintf(("CRTDLL: _strdec\n"));
3593 return( (char *)(p-1) );
3594}
3595
3596
3597/*********************************************************************
3598 * CRTDLL__strdup (CRTDLL.283)
3599 */
3600LPSTR CDECL CRTDLL__strdup(LPCSTR ptr)
3601{
3602 dprintf(("CRTDLL: _strdup\n"));
3603 return HEAP_strdupA(GetProcessHeap(),0,ptr);
3604}
3605
3606
3607/*********************************************************************
3608 * _strerror (CRTDLL.284)
3609 */
3610char * CDECL CRTDLL__strerror(const char *s)
3611{
3612 dprintf(("CRTDLL: _strerror not implemented\n"));
3613 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3614 return FALSE;
3615// return (_strerror(s));
3616}
3617
3618
3619/*********************************************************************
3620 * CRTDLL__stricoll (CRTDLL.286)
3621 */
3622int CDECL CRTDLL__stricoll( const char *s1, const char *s2 )
3623{
3624 dprintf(("CRTDLL: _stricoll\n"));
3625 return stricmp(s1,s2);
3626}
3627
3628
3629/*********************************************************************
3630 * CRTDLL__strinc (CRTDLL.287)
3631 */
3632char * CDECL CRTDLL__strinc( const char *p )
3633{
3634 dprintf(("CRTDLL: _strinc\n"));
3635 return( (char *)(p+1) );
3636}
3637
3638
3639/*********************************************************************
3640 * CRTDLL__strncnt (CRTDLL.289)
3641 */
3642size_t CDECL CRTDLL__strncnt( const char *p, size_t l )
3643{
3644 dprintf(("CRTDLL: _strncnt\n"));
3645 size_t i;
3646 i = strlen(p);
3647 return( (i>l) ? l : i );
3648}
3649
3650/*********************************************************************
3651 * CRTDLL__strnextc (CRTDLL.290)
3652 */
3653unsigned int CDECL CRTDLL__strnextc( const char *p )
3654{
3655 dprintf(("CRTDLL: _strnextc\n"));
3656 return( (unsigned int)*p );
3657}
3658
3659
3660/*********************************************************************
3661 * CRTDLL__strninc (CRTDLL.292)
3662 */
3663char * CDECL CRTDLL__strninc( const char *p, size_t l )
3664{
3665 dprintf(("CRTDLL: _strninc\n"));
3666 return( (char *)(p+l) );
3667}
3668
3669
3670/*********************************************************************
3671 * CRTDLL__strnset (CRTDLL.293)
3672 */
3673char * CDECL CRTDLL__strnset(char* szToFill, int szFill, size_t sizeMaxFill)
3674{
3675 dprintf(("CRTDLL: _strnset\n"));
3676 char *t = szToFill;
3677 int i = 0;
3678 while( *szToFill != 0 && i < sizeMaxFill)
3679 {
3680 *szToFill = szFill;
3681 szToFill++;
3682 i++;
3683 }
3684 return t;
3685}
3686
3687
3688/*********************************************************************
3689 * CRTDLL__strrev (CRTDLL.294)
3690 */
3691char * CDECL CRTDLL__strrev( char *s )
3692{
3693 dprintf(("CRTDLL: _strrev\n"));
3694 char *e;
3695 char a;
3696 e=s;
3697 while (*e)
3698 e++;
3699 while (s<e) {
3700 a=*s;
3701 *s=*e;
3702 *e=a;
3703 s++;
3704 e--;
3705 }
3706 return s;
3707}
3708
3709
3710/*********************************************************************
3711 * CRTDLL__strset (CRTDLL.295)
3712 */
3713char * CDECL CRTDLL__strset(char* szToFill, int szFill)
3714{
3715 dprintf(("CRTDLL: _strset\n"));
3716 char *t = szToFill;
3717 while( *szToFill != 0 )
3718 {
3719 *szToFill = szFill;
3720 szToFill++;
3721 }
3722 return t;
3723}
3724
3725
3726/*********************************************************************
3727 * CRTDLL__strspnp (CRTDLL.296)
3728 */
3729char * CDECL CRTDLL__strspnp( const char *p1, const char *p2 )
3730{
3731 dprintf(("CRTDLL: _strspnp\n"));
3732 return( (*(p1 += strspn(p1,p2))!='\0') ? (char*)p1 : NULL );
3733}
3734
3735
3736/*********************************************************************
3737 * CRTDLL__strtime (CRTDLL.297)
3738 */
3739char * CDECL CRTDLL__strtime( char *buf )
3740{
3741 dprintf(("CRTDLL: _strtime\n"));
3742 return (_strtime(buf));
3743}
3744
3745
3746/*********************************************************************
3747 * CRTDLL__swab (CRTDLL.299)
3748 */
3749void CDECL CRTDLL__swab(char *s1, char *s2, int i)
3750{
3751 dprintf(("CRTDLL: _swab\n"));
3752 _swab(s1, s2, i);
3753}
3754
3755
3756/*********************************************************************
3757 * CRTDLL__tell (CRTDLL.302)
3758 */
3759long CDECL CRTDLL__tell( int i )
3760{
3761 dprintf(("CRTDLL: _tell\n"));
3762 return (_tell(i));
3763}
3764
3765
3766/*********************************************************************
3767 * CRTDLL__tempnam (CRTDLL.303)
3768 */
3769char * CDECL CRTDLL__tempnam( char *dir, char *prefix )
3770{
3771 dprintf(("CRTDLL: _tempnam\n"));
3772 return (_tempnam(dir, prefix));
3773}
3774
3775
3776/*********************************************************************
3777 * CRTDLL__tolower (CRTDLL.305)
3778 */
3779int CDECL CRTDLL__tolower(int n)
3780{
3781 dprintf(("CRTDLL: _tolower\n"));
3782 return (_tolower(n));
3783}
3784
3785
3786/*********************************************************************
3787 * CRTDLL__toupper (CRTDLL.306)
3788 */
3789int CDECL CRTDLL__toupper(int n)
3790{
3791 dprintf(("CRTDLL: _toupper\n"));
3792 return (_toupper(n));
3793}
3794
3795
3796/*********************************************************************
3797 * _tzset (CRTDLL.308)
3798 */
3799void CDECL CRTDLL__tzset( void )
3800{
3801 dprintf(("CRTDLL: _tzset not implemented.\n"));
3802 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3803}
3804
3805
3806/*********************************************************************
3807 * CRTDLL__umask (CRTDLL.310)
3808 */
3809int CDECL CRTDLL__umask( int i )
3810{
3811 dprintf(("CRTDLL: _umask\n"));
3812 return (_umask(i));
3813}
3814
3815
3816/*********************************************************************
3817 * CRTDLL__ungetch (CRTDLL.311)
3818 */
3819int CDECL CRTDLL__ungetch( int i )
3820{
3821 dprintf(("CRTDLL: _ungetch\n"));
3822 return (_ungetch(i));
3823}
3824
3825
3826/*********************************************************************
3827 * _unlink (CRTDLL.312)
3828 */
3829INT CDECL CRTDLL__unlink(LPCSTR pathname)
3830{
3831 dprintf(("CRTDLL: _unlink\n"));
3832 int ret=0;
3833 DOS_FULL_NAME full_name;
3834
3835 if (!DOSFS_GetFullName( pathname, FALSE, (CHAR*)&full_name )) {
3836 dprintf(("CRTDLL_unlink file %s bad name\n",pathname));
3837 return EOF;
3838 }
3839
3840 ret=unlink(full_name.long_name);
3841 dprintf(("(%s unix %s)\n",
3842 pathname,full_name.long_name));
3843 if(ret)
3844 dprintf((" Failed!\n"));
3845
3846 return ret;
3847}
3848
3849
3850/*********************************************************************
3851 * CRTDLL__unloaddll (CRTDLL.313)
3852 */
3853int CDECL CRTDLL__unloaddll(void *handle)
3854{
3855 dprintf(("CRTDLL: _unloaddll\n"));
3856 return FreeLibrary((HMODULE)handle);
3857}
3858
3859
3860/*********************************************************************
3861 * CRTDLL__utime (CRTDLL.314)
3862 */
3863int CDECL CRTDLL__utime( char *path, struct utimbuf * times )
3864{
3865 dprintf(("CRTDLL: _utime\n"));
3866 return (_utime(path, times));
3867}
3868
3869
3870/*********************************************************************
3871 * CRTDLL__vsnwprintf (CRTDLL.316)
3872 */
3873int CDECL CRTDLL__vsnwprintf( wchar_t *s1, size_t n, const wchar_t *s2, va_list arg )
3874{
3875 dprintf(("CRTDLL: _vsnwprintf not implemented.\n"));
3876 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
3877 return FALSE;
3878}
3879
3880
3881/*********************************************************************
3882 * CRTDLL__wcsdup (CRTDLL.317)
3883 */
3884LPWSTR CDECL CRTDLL__wcsdup( LPCWSTR str )
3885{
3886 dprintf(("CRTDLL: _wcsdup\n"));
3887 LPWSTR ret = NULL;
3888 if (str)
3889 {
3890 int size = (wcslen((const wchar_t*)str) + 1) * sizeof(WCHAR);
3891// FIXME ret = CRTDLL_malloc( size );
3892 if (ret) memcpy( ret, str, size );
3893 }
3894 return ret;
3895}
3896
3897
3898/*********************************************************************
3899 * CRTDLL__wcsicoll (CRTDLL.319)
3900 */
3901int CDECL CRTDLL__wcsicoll( LPCWSTR str1, LPCWSTR str2 )
3902{
3903 dprintf(("CRTDLL: _wcsicoll\n"));
3904 return NTDLL__wcsicmp( str1, str2 );
3905}
3906
3907
3908/*********************************************************************
3909 * CRTDLL__wcsnset (CRTDLL.322)
3910 */
3911LPWSTR CDECL CRTDLL__wcsnset( LPWSTR str, WCHAR c, INT n )
3912{
3913 dprintf(("CRTDLL: _wcsnset\n"));
3914 LPWSTR ret = str;
3915 while ((n-- > 0) && *str) *str++ = c;
3916 return ret;
3917}
3918
3919
3920/*********************************************************************
3921 * CRTDLL__wcsrev (CRTDLL.323)
3922 */
3923LPWSTR CDECL CRTDLL__wcsrev( LPWSTR str )
3924{
3925 dprintf(("CRTDLL: _wcsrev\n"));
3926 LPWSTR ret = str;
3927 LPWSTR end = str + wcslen((const wchar_t*)str) - 1;
3928 while (end > str)
3929 {
3930 WCHAR t = *end;
3931 *end-- = *str;
3932 *str++ = t;
3933 }
3934 return ret;
3935}
3936
3937
3938/*********************************************************************
3939 * CRTDLL__wcsset (CRTDLL.324)
3940 */
3941LPWSTR CDECL CRTDLL__wcsset( LPWSTR str, WCHAR c )
3942{
3943 dprintf(("CRTDLL: _wcsset\n"));
3944 LPWSTR ret = str;
3945 while (*str) *str++ = c;
3946 return ret;
3947}
3948
3949
3950/*********************************************************************
3951 * _write (CRTDLL.329)
3952 */
3953INT CDECL CRTDLL__write(INT fd,LPCVOID buf,UINT count)
3954{
3955 dprintf(("CRTDLL: _write\n"));
3956 INT len=0;
3957
3958 if (fd == -1)
3959 len = -1;
3960 else if (fd<=2)
3961 len = (UINT)write(fd,buf,(LONG)count);
3962 else
3963 len = _lwrite(fd,(LPCSTR)buf,count);
3964 dprintf(("%d/%d byte to dfh %d from %p,\n",
3965 len,count,fd,buf));
3966 return len;
3967}
3968
3969
3970/*********************************************************************
3971 * _y0 (CRTDLL.332)
3972 */
3973double CDECL CRTDLL__y0(double x)
3974{
3975 dprintf(("CRTDLL: _y0\n"));
3976 return (_y0(x));
3977}
3978
3979
3980/*********************************************************************
3981 * _y1 (CRTDLL.333)
3982 */
3983double CDECL CRTDLL__y1(double x)
3984{
3985 dprintf(("CRTDLL: _y1\n"));
3986 return (_y1(x));
3987}
3988
3989
3990/*********************************************************************
3991 * _yn (CRTDLL.334)
3992 */
3993double CDECL CRTDLL__yn(int i, double x)
3994{
3995 dprintf(("CRTDLL: _yn\n"));
3996 return (_yn(i, x));
3997}
3998
3999
4000/*********************************************************************
4001 * isleadbyte (CRTDLL.335)
4002 */
4003void CDECL CRTDLL_abort( void )
4004{
4005 dprintf(("CRTDLL: abort\n"));
4006 abort();
4007}
4008
4009
4010/*********************************************************************
4011 * acos (CRTDLL.336)
4012 */
4013double CDECL CRTDLL_acos( double x )
4014{
4015 dprintf(("CRTDLL: acos\n"));
4016 return (acos(x));
4017}
4018
4019
4020/*********************************************************************
4021 * asctime (CRTDLL.338)
4022 */
4023char * CDECL CRTDLL_asctime( const struct tm *timeptr )
4024{
4025 dprintf(("CRTDLL: asctime\n"));
4026 return (asctime(timeptr));
4027}
4028
4029
4030/*********************************************************************
4031 * asin (CRTDLL.339)
4032 */
4033double CDECL CRTDLL_asin( double x )
4034{
4035 dprintf(("CRTDLL: asin\n"));
4036 return (asin(x));
4037}
4038
4039
4040/*********************************************************************
4041 * atan2 (CRTDLL.341)
4042 */
4043double CDECL CRTDLL_atan2( double y, double x )
4044{
4045 dprintf(("CRTDLL: atan2\n"));
4046 return (atan2(y, x));
4047}
4048
4049
4050/*********************************************************************
4051 * atexit (CRTDLL.342)
4052 */
4053int CDECL CRTDLL_atexit( register void ( *func )( void ) )
4054{
4055 dprintf(("CRTDLL: atexit not implemented.\n"));
4056 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
4057 return FALSE;
4058}
4059
4060
4061/*********************************************************************
4062 * atof (CRTDLL.343)
4063 */
4064double CDECL CRTDLL_atof( const char *nptr )
4065{
4066 dprintf(("CRTDLL: atof\n"));
4067 return (atof(nptr));
4068}
4069
4070
4071/*********************************************************************
4072 * bsearch (CRTDLL.346)
4073 */
4074void * CDECL CRTDLL_bsearch( const void *key, const void *base0, size_t nelem,
4075 size_t size, int (*cmp)(const void *ck, const void *ce))
4076{
4077 dprintf(("CRTDLL: bsearch\n"));
4078 char *base = (char *)base0;
4079 int lim, cmpval;
4080 void *p;
4081
4082 for (lim = nelem; lim != 0; lim >>= 1)
4083 {
4084 p = base + (lim >> 1) * size;
4085 cmpval = (*cmp)(key, p);
4086 if (cmpval == 0)
4087 return p;
4088 if (cmpval > 0)
4089 { /* key > p: move right */
4090 base = (char *)p + size;
4091 lim--;
4092 } /* else move left */
4093 }
4094 return 0;
4095}
4096
4097
4098/*********************************************************************
4099 * calloc (CRTDLL.347)
4100 */
4101void * CDECL CRTDLL_calloc( size_t n, size_t size )
4102{
4103 dprintf(("CRTDLL: calloc\n"));
4104 return (calloc(n, size));
4105}
4106
4107
4108/*********************************************************************
4109 * clearerr (CRTDLL.349)
4110 */
4111void CDECL CRTDLL_clearerr( FILE *fp )
4112{
4113 dprintf(("CRTDLL: clearerr\n"));
4114 clearerr(fp);
4115}
4116
4117
4118/*********************************************************************
4119 * clock (CRTDLL.350)
4120 */
4121clock_t CDECL CRTDLL_clock( void )
4122{
4123 dprintf(("CRTDLL: clock\n"));
4124 return (clock());
4125}
4126
4127
4128/*********************************************************************
4129 * cosh (CRTDLL.352)
4130 */
4131double CDECL CRTDLL_cosh( double x )
4132{
4133 dprintf(("CRTDLL: cosh\n"));
4134 return (cosh(x));
4135}
4136
4137
4138/*********************************************************************
4139 * ctime (CRTDLL.353)
4140 */
4141char * CDECL CRTDLL_ctime( const time_t *timer )
4142{
4143 dprintf(("CRTDLL: ctime\n"));
4144 return (ctime(timer));
4145}
4146
4147
4148/*********************************************************************
4149 * difftime (CRTDLL.354)
4150 */
4151double CDECL CRTDLL_difftime( time_t t1, time_t t0 )
4152{
4153 dprintf(("CRTDLL: difftime\n"));
4154 return (difftime(t1, t0));
4155}
4156
4157
4158/*********************************************************************
4159 * div (CRTDLL.355)
4160 */
4161div_t CDECL CRTDLL_div( int numer, int denom )
4162{
4163 dprintf(("CRTDLL: div\n"));
4164 return (div(numer, denom));
4165}
4166
4167
4168/*********************************************************************
4169 * exit (CRTDLL.356)
4170 */
4171void CDECL CRTDLL_exit(DWORD ret)
4172{
4173 dprintf(("CRTDLL: exit\n"));
4174 ExitProcess(ret);
4175}
4176
4177
4178/*********************************************************************
4179 * exp (CRTDLL.357)
4180 */
4181double CDECL CRTDLL_exp( double x )
4182{
4183 dprintf(("CRTDLL: exp\n"));
4184 return (exp(x));
4185}
4186
4187
4188/*********************************************************************
4189 * fclose (CRTDLL.359)
4190 */
4191int CDECL CRTDLL_fclose( FILE *fp )
4192{
4193 dprintf(("CRTDLL: fclose\n"));
4194 return (fclose(fp));
4195}
4196
4197
4198/*********************************************************************
4199 * feof (CRTDLL.360)
4200 */
4201int CDECL CRTDLL_feof( FILE *fp )
4202{
4203 dprintf(("CRTDLL: feof\n"));
4204 return (feof(fp));
4205}
4206
4207
4208/*********************************************************************
4209 * ferror (CRTDLL.361)
4210 */
4211int CDECL CRTDLL_ferror( FILE *fp )
4212{
4213 dprintf(("CRTDLL: ferror\n"));
4214 return (ferror(fp));
4215}
4216
4217
4218/*********************************************************************
4219 * fflush (CRTDLL.362)
4220 */
4221int CDECL CRTDLL_fflush( FILE *fp )
4222{
4223 dprintf(("CRTDLL: fflush\n"));
4224 return (fflush(fp));
4225}
4226
4227
4228/*********************************************************************
4229 * fgetc (CRTDLL.363)
4230 */
4231int CDECL CRTDLL_fgetc( FILE *fp )
4232{
4233 dprintf(("CRTDLL: fgetc\n"));
4234 return (fgetc(fp));
4235}
4236
4237
4238/*********************************************************************
4239 * fgetpos (CRTDLL.364)
4240 */
4241int CDECL CRTDLL_fgetpos( FILE *fp, fpos_t *pos )
4242{
4243 dprintf(("CRTDLL: fgetpos\n"));
4244 return (fgetpos(fp, pos));
4245}
4246
4247
4248/*********************************************************************
4249 * fgets (CRTDLL.365)
4250 */
4251char * CDECL CRTDLL_fgets( char *s, int n, FILE *fp )
4252{
4253 dprintf(("CRTDLL: fgets\n"));
4254 return (fgets(s, n, fp));
4255}
4256
4257
4258/*********************************************************************
4259 * fgetwc (CRTDLL.366)
4260 */
4261wint_t CDECL CRTDLL_fgetwc( FILE *f )
4262{
4263 dprintf(("CRTDLL: fgetwc\n"));
4264 return (fgetwc(f));
4265}
4266
4267
4268/*********************************************************************
4269 * fmod (CRTDLL.368)
4270 */
4271double CDECL CRTDLL_fmod(double x, double y )
4272{
4273 dprintf(("CRTDLL: fmod\n"));
4274 return (fmod(x,y));
4275}
4276
4277
4278/*********************************************************************
4279 * fopen (CRTDLL.369)
4280 */
4281FILE * CDECL CRTDLL_fopen( const char *filename, const char *mode )
4282{
4283 dprintf(("CRTDLL: fopen\n"));
4284 return (fopen( filename, mode));
4285}
4286
4287
4288/*********************************************************************
4289 * fprintf (CRTDLL.370)
4290 */
4291INT CDECL CRTDLL_fprintf( CRTDLL_FILE *file, LPSTR format, ... )
4292{
4293 dprintf(("CRTDLL: fprintf\n"));
4294 va_list valist;
4295 INT res;
4296
4297 va_start( valist, format );
4298 res = CRTDLL_vfprintf( file, format, valist );
4299 va_end( valist );
4300 return res;
4301}
4302
4303
4304/*********************************************************************
4305 * fputc (CRTDLL.371)
4306 */
4307int CDECL CRTDLL_fputc( int c, FILE *fp )
4308{
4309 dprintf(("CRTDLL: fputc\n"));
4310 return (fputc(c, fp));
4311}
4312
4313
4314/*********************************************************************
4315 * fputs (CRTDLL.372)
4316 */
4317int CDECL CRTDLL_fputs( const char *s, FILE *fp )
4318{
4319 dprintf(("CRTDLL: fputs\n"));
4320 return (fputs(s, fp));
4321}
4322
4323
4324/*********************************************************************
4325 * fputwc (CRTDLL.373)
4326 */
4327wint_t CDECL CRTDLL_fputwc( wint_t wc, FILE *strm )
4328{
4329 dprintf(("CRTDLL: fputwc\n"));
4330 return (fputwc(wc, strm));
4331}
4332
4333
4334/*********************************************************************
4335 * fread (CRTDLL.374)
4336 */
4337size_t CDECL CRTDLL_fread( void *ptr, size_t size, size_t n, FILE *fp )
4338{
4339 dprintf(("CRTDLL: fread\n"));
4340 return (fread(ptr, size, n, fp));
4341}
4342
4343
4344/*********************************************************************
4345 * free (CRTDLL.375)
4346 */
4347VOID CDECL CRTDLL_free(LPVOID ptr)
4348{
4349 dprintf(("CRTDLL: free\n"));
4350 HeapFree(GetProcessHeap(),0,ptr);
4351}
4352
4353
4354/*********************************************************************
4355 * freopen (CRTDLL.376)
4356 */
4357FILE * CDECL CRTDLL_freopen( const char *filename, const char *mode, FILE *fp )
4358{
4359 dprintf(("CRTDLL: freopen\n"));
4360 return (freopen(filename, mode, fp));
4361}
4362
4363
4364/*********************************************************************
4365 * frexp (CRTDLL.377)
4366 */
4367double CDECL CRTDLL_frexp( double value, int *exp )
4368{
4369 dprintf(("CRTDLL: frexp\n"));
4370 return (frexp(value, exp));
4371}
4372
4373
4374/*********************************************************************
4375 * fscanf (CRTDLL.378)
4376 */
4377int CDECL CRTDLL_fscanf( FILE*fp, const char *format, ... )
4378{
4379 dprintf(("CRTDLL: fscanf\n"));
4380#if 0
4381 va_list valist;
4382 INT res;
4383
4384 va_start( valist, format );
4385#ifdef HAVE_VFSCANF
4386 res = vfscanf( xlat_file_ptr(stream), format, valist );
4387#endif
4388 va_end( valist );
4389 return res;
4390#endif
4391 dprintf(("broken\n"));
4392 return 0;
4393}
4394
4395
4396/*********************************************************************
4397 * fseek (CRTDLL.379)
4398 */
4399int CDECL CRTDLL_fseek( FILE *file, long int offset, int whence )
4400{
4401 dprintf(("CRTDLL: fseek\n"));
4402 dprintf(("file %p to 0x%08lx pos %s\n",
4403 file,offset,(whence==SEEK_SET)?"SEEK_SET":
4404 (whence==SEEK_CUR)?"SEEK_CUR":
4405 (whence==SEEK_END)?"SEEK_END":"UNKNOWN"));
4406// FIXME if (SetFilePointer( file->handle, offset, NULL, whence ) != 0xffffffff)
4407// FIXME return 0;
4408 dprintf((" failed!\n"));
4409 return -1;
4410}
4411
4412
4413/*********************************************************************
4414 * fsetpos (CRTDLL.380)
4415 */
4416int CDECL CRTDLL_fsetpos( FILE *fp, const fpos_t *pos )
4417{
4418 dprintf(("CRTDLL: fsetpos\n"));
4419 return (fsetpos(fp, pos));
4420}
4421
4422
4423/*********************************************************************
4424 * ftell (CRTDLL.381)
4425 */
4426long int CDECL CRTDLL_ftell( FILE *fp )
4427{
4428 dprintf(("CRTDLL: ftell\n"));
4429 return (ftell(fp));
4430}
4431
4432
4433/*********************************************************************
4434 * fwprintf (CRTDLL.382)
4435 */
4436int CDECL CRTDLL_fwprintf( FILE *strm, const wchar_t *format, ... )
4437{
4438 dprintf(("CRTDLL: fwprintf not implemented.\n"));
4439 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
4440 return FALSE;
4441}
4442
4443
4444/*********************************************************************
4445 * fwrite (CRTDLL.383)
4446 */
4447DWORD CDECL CRTDLL_fwrite( LPVOID ptr, INT size, INT nmemb, CRTDLL_FILE *file )
4448{
4449 DWORD ret;
4450
4451 dprintf(("CRTDLL: fwrite\n"));
4452 if (!WriteFile( file->handle, ptr, size * nmemb, &ret, NULL ))
4453 dprintf((" failed!\n"));
4454
4455 return ret / size;
4456}
4457
4458
4459/*********************************************************************
4460 * fwscanf (CRTDLL.384)
4461 */
4462int CDECL CRTDLL_fwscanf( FILE *strm, const wchar_t *format, ... )
4463{
4464 dprintf(("CRTDLL: fwscanf not implemented.\n"));
4465 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
4466 return FALSE;
4467}
4468
4469
4470/*********************************************************************
4471 * getc (CRTDLL.385)
4472 */
4473int CDECL CRTDLL_getc( FILE *fp )
4474{
4475 dprintf(("CRTDLL: getc\n"));
4476 return (getc(fp));
4477}
4478
4479
4480/*********************************************************************
4481 * getchar (CRTDLL.386)
4482 */
4483int CDECL CRTDLL_getchar( void )
4484{
4485 dprintf(("CRTDLL: getchar\n"));
4486 return (getchar());
4487}
4488
4489
4490/*********************************************************************
4491 * getenv (CRTDLL.387)
4492 */
4493char * CDECL CRTDLL_getenv( const char *name )
4494{
4495 dprintf(("CRTDLL: getenv\n"));
4496 return (getenv(name));
4497}
4498
4499
4500/*********************************************************************
4501 * gets (CRTDLL.388)
4502 */
4503char * CDECL CRTDLL_gets( char *s )
4504{
4505 dprintf(("CRTDLL: gets\n"));
4506 return (gets(s));
4507}
4508
4509
4510/*********************************************************************
4511 * gmtime (CRTDLL.389)
4512 */
4513struct tm * CDECL CRTDLL_gmtime( const time_t *timer )
4514{
4515 dprintf(("CRTDLL: gmtime\n"));
4516 return (gmtime(timer));
4517}
4518
4519
4520/*********************************************************************
4521 * is_wctype (CRTDLL.390)
4522 */
4523INT CDECL CRTDLL_is_wctype(wint_t wc, wctype_t wctypeFlags)
4524{
4525 dprintf(("CRTDLL: is_wctype not implemented.\n"));
4526 return 0;
4527}
4528
4529
4530/*********************************************************************
4531 * isalnum (CRTDLL.391)
4532 */
4533int CDECL CRTDLL_isalnum(int i)
4534{
4535 dprintf(("CRTDLL: isalnum(%08xh)\n", i));
4536 return (isalnum(i));
4537}
4538
4539
4540/*********************************************************************
4541 * iscntrl (CRTDLL.393)
4542 */
4543int CDECL CRTDLL_iscntrl(int i)
4544{
4545 dprintf(("CRTDLL: iscntrl(%08xh)\n", i));
4546 return (iscntrl(i));
4547}
4548
4549
4550/*********************************************************************
4551 * isgraph (CRTDLL.395)
4552 */
4553int CDECL CRTDLL_isgraph(int i)
4554{
4555 dprintf(("CRTDLL: isgraph(%08xh)\n", i));
4556 return (isgraph(i));
4557}
4558
4559
4560/*********************************************************************
4561 * isleadbyte (CRTDLL.396)
4562 */
4563int CDECL CRTDLL_isleadbyte(int i)
4564{
4565 dprintf(("CRTDLL: isleadbyte(%08xh) not implemented.\n", i));
4566 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
4567 return FALSE;
4568}
4569
4570
4571/*********************************************************************
4572 * ispunct (CRTDLL.399)
4573 */
4574int CDECL CRTDLL_ispunct(int i)
4575{
4576 dprintf(("CRTDLL: ispunct(%08xh)\n", i));
4577 return (ispunct(i));
4578}
4579
4580
4581/*********************************************************************
4582 * iswalnum (CRTDLL.402)
4583 */
4584int CDECL CRTDLL_iswalnum(wint_t i)
4585{
4586 dprintf(("CRTDLL: iswalnum(%08xh)\n", i));
4587 return (iswalnum(i));
4588}
4589
4590
4591/*********************************************************************
4592 * iswascii (CRTDLL.404)
4593 */
4594int CDECL CRTDLL_iswascii(wint_t c)
4595{
4596 dprintf(("CRTDLL: iswascii\n", c));
4597 return (!((c)&(~0x7f)));
4598}
4599
4600
4601/*********************************************************************
4602 * iswcntrl (CRTDLL.405)
4603 */
4604int CDECL CRTDLL_iswcntrl(wint_t i)
4605{
4606 dprintf(("CRTDLL: iswcntrl(%08xh)\n", i));
4607 return (iswcntrl(i));
4608}
4609
4610
4611/*********************************************************************
4612 * iswdigit (CRTDLL.407)
4613 */
4614int CDECL CRTDLL_iswdigit(wint_t i)
4615{
4616 dprintf(("CRTDLL: iswdigit(%08xh)\n", i));
4617 return (iswdigit(i));
4618}
4619
4620
4621/*********************************************************************
4622 * iswgraph (CRTDLL.408)
4623 */
4624int CDECL CRTDLL_iswgraph(wint_t i)
4625{
4626 dprintf(("CRTDLL: iswgraph(%08xh)\n", i));
4627 return (iswgraph(i));
4628}
4629
4630
4631/*********************************************************************
4632 * iswlower (CRTDLL.409)
4633 */
4634int CDECL CRTDLL_iswlower(wint_t i)
4635{
4636 dprintf(("CRTDLL: iswlower(%08xh)\n", i));
4637 return (iswlower(i));
4638}
4639
4640
4641/*********************************************************************
4642 * iswprint (CRTDLL.410)
4643 */
4644int CDECL CRTDLL_iswprint(wint_t i)
4645{
4646 dprintf(("CRTDLL: iswprint(%08xh)\n", i));
4647 return (iswprint(i));
4648}
4649
4650
4651/*********************************************************************
4652 * iswpunct (CRTDLL.411)
4653 */
4654int CDECL CRTDLL_iswpunct(wint_t i)
4655{
4656 dprintf(("CRTDLL: iswpunct(%08xh)\n", i));
4657 return (iswpunct(i));
4658}
4659
4660
4661/*********************************************************************
4662 * iswspace (CRTDLL.412)
4663 */
4664int CDECL CRTDLL_iswspace(wint_t i)
4665{
4666 dprintf(("CRTDLL: iswspace(%08xh)\n", i));
4667 return (iswspace(i));
4668}
4669
4670
4671/*********************************************************************
4672 * iswupper (CRTDLL.413)
4673 */
4674int CDECL CRTDLL_iswupper(wint_t i)
4675{
4676 dprintf(("CRTDLL: iswupper(%08xh)\n", i));
4677 return (iswupper(i));
4678}
4679
4680
4681/*********************************************************************
4682 * iswxdigit (CRTDLL.414)
4683 */
4684int CDECL CRTDLL_iswxdigit(wint_t i)
4685{
4686 dprintf(("CRTDLL: iswxdigit(%08xh)\n", i));
4687 return (iswxdigit(i));
4688}
4689
4690
4691/*********************************************************************
4692 * ldexp (CRTDLL.417)
4693 */
4694double CDECL CRTDLL_ldexp( double x, int exp )
4695{
4696 dprintf(("CRTDLL: ldexp\n"));
4697 return (ldexp(x, exp));
4698}
4699
4700
4701/*********************************************************************
4702 * ldiv (CRTDLL.418)
4703 */
4704ldiv_t CDECL CRTDLL_ldiv( long int numer, long int denom )
4705{
4706 dprintf(("CRTDLL: ldiv\n"));
4707 return (ldiv(numer, denom));
4708}
4709
4710
4711/*********************************************************************
4712 * localeconv (CRTDLL.419)
4713 */
4714struct lconv * CDECL CRTDLL_localeconv(void)
4715{
4716 dprintf(("CRTDLL: localeconv\n"));
4717 return (localeconv());
4718}
4719
4720
4721/*********************************************************************
4722 * localtime (CRTDLL.420)
4723 */
4724struct tm * CDECL CRTDLL_localtime( const time_t *timer )
4725{
4726 dprintf(("CRTDLL: localtime\n"));
4727 return (localtime(timer));
4728}
4729
4730
4731/*********************************************************************
4732 * log10 (CRTDLL.422)
4733 */
4734double CDECL CRTDLL_log10( double x )
4735{
4736 dprintf(("CRTDLL: log10\n"));
4737 return (log10(x));
4738}
4739
4740
4741/*********************************************************************
4742 * longjmp (CRTDLL.423)
4743 */
4744VOID CDECL CRTDLL_longjmp(jmp_buf env, int val)
4745{
4746 dprintf(("CRTDLL: longjmp\n"));
4747 longjmp(env, val);
4748}
4749
4750
4751/*********************************************************************
4752 * malloc (CRTDLL.424)
4753 */
4754VOID* CDECL CRTDLL_malloc(DWORD size)
4755{
4756 dprintf(("CRTDLL: malloc\n"));
4757 return HeapAlloc(GetProcessHeap(),0,size);
4758}
4759
4760
4761/*********************************************************************
4762 * mblen (CRTDLL.425)
4763 */
4764INT CDECL CRTDLL_mblen( const char *s, size_t n )
4765{
4766 dprintf(("CRTDLL: mblen\n"));
4767 return (mblen(s, n));
4768}
4769
4770
4771/*********************************************************************
4772 * CRTDLL_mbtowc (CRTDLL.427)
4773 */
4774INT CDECL CRTDLL_mbtowc( WCHAR *dst, LPCSTR str, INT n )
4775{
4776 dprintf(("CRTDLL: _mbtowc\n"));
4777 wchar_t res;
4778 int ret = mbtowc( &res, str, n );
4779 if (dst) *dst = (WCHAR)res;
4780 return ret;
4781}
4782
4783
4784/*********************************************************************
4785 * mktime (CRTDLL.433)
4786 */
4787time_t CDECL CRTDLL_mktime( struct tm *timeptr )
4788{
4789 dprintf(("CRTDLL: mktime\n"));
4790 return mktime( timeptr );
4791}
4792
4793
4794/*********************************************************************
4795 * modf (CRTDLL.434)
4796 */
4797double CDECL CRTDLL_modf( double value, double *iptr )
4798{
4799 dprintf(("CRTDLL: modf\n"));
4800 return modf( value, iptr );
4801}
4802
4803
4804/*********************************************************************
4805 * perror (CRTDLL.435)
4806 */
4807void CDECL CRTDLL_perror( const char *s )
4808{
4809 dprintf(("CRTDLL: perror\n"));
4810 perror( s );
4811}
4812
4813
4814/*********************************************************************
4815 * printf (CRTDLL.437)
4816 */
4817int CDECL CRTDLL_printf( const char *format, ... )
4818{
4819 dprintf(("CRTDLL: printf not implemented.\n"));
4820 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
4821 return FALSE;
4822}
4823
4824
4825/*********************************************************************
4826 * putc (CRTDLL.438)
4827 */
4828int CDECL CRTDLL_putc( int c, FILE *fp )
4829{
4830 dprintf(("CRTDLL: putc\n"));
4831 return putc( c, fp );
4832}
4833
4834
4835/*********************************************************************
4836 * putchar (CRTDLL.439)
4837 */
4838int CDECL CRTDLL_putchar( int c )
4839{
4840 dprintf(("CRTDLL: putchar\n"));
4841 return putchar( c );
4842}
4843
4844
4845/*********************************************************************
4846 * puts (CRTDLL.440)
4847 */
4848int CDECL CRTDLL_puts( const char *s )
4849{
4850 dprintf(("CRTDLL: puts\n"));
4851 return puts( s );
4852}
4853
4854
4855/*********************************************************************
4856 * raise (CRTDLL.442)
4857 */
4858int CDECL CRTDLL_raise( int sig )
4859{
4860 dprintf(("CRTDLL: raise\n"));
4861 return raise( sig );
4862}
4863
4864
4865/*********************************************************************
4866 * rand (CRTDLL.443)
4867 */
4868int CDECL CRTDLL_rand( void )
4869{
4870 dprintf(("CRTDLL: rand\n"));
4871 return (rand());
4872}
4873
4874
4875/*********************************************************************
4876 * realloc (CRTDLL.444)
4877 */
4878void * CDECL CRTDLL_realloc( void *ptr, size_t size )
4879{
4880 dprintf(("CRTDLL: realloc\n"));
4881 return HeapReAlloc( GetProcessHeap(), 0, ptr, size );
4882}
4883
4884
4885/*********************************************************************
4886 * remove (CRTDLL.445)
4887 */
4888INT CDECL CRTDLL_remove(LPCSTR file)
4889{
4890 dprintf(("CRTDLL: remove\n"));
4891 if (!DeleteFileA(file))
4892 return -1;
4893 return 0;
4894}
4895
4896
4897/*********************************************************************
4898 * rename (CRTDLL.446)
4899 */
4900int CDECL CRTDLL_rename (const char *old, const char *new2)
4901{
4902 dprintf(("CRTDLL: rename\n"));
4903 return (rename(old, new2));
4904}
4905
4906
4907/*********************************************************************
4908 * rewind (CRTDLL.447)
4909 */
4910void CDECL CRTDLL_rewind( FILE *fp )
4911{
4912 dprintf(("CRTDLL: rewind\n"));
4913 rewind(fp);
4914}
4915
4916
4917/*********************************************************************
4918 * scanf (CRTDLL.448)
4919 */
4920int CDECL CRTDLL_scanf( const char *format, ... )
4921{
4922 dprintf(("CRTDLL: scanf not implemented.\n"));
4923 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
4924 return FALSE;
4925}
4926
4927
4928/*********************************************************************
4929 * setbuf (CRTDLL.449)
4930 */
4931void CDECL CRTDLL_setbuf( FILE *fp, char *buf )
4932{
4933 dprintf(("CRTDLL: setbuf\n"));
4934 setbuf(fp, buf);
4935}
4936
4937
4938/*********************************************************************
4939 * setlocale (CRTDLL.450)
4940 */
4941char * CDECL CRTDLL_setlocale(int category,const char *locale)
4942{
4943 dprintf(("CRTDLL: setlocale\n"));
4944 return (setlocale(category, locale));
4945}
4946
4947
4948/*********************************************************************
4949 * setvbuf (CRTDLL.451)
4950 */
4951int CDECL CRTDLL_setvbuf( FILE *fp, char *buf, int mode, size_t size )
4952{
4953 dprintf(("CRTDLL: setvbuf\n"));
4954 return (setvbuf(fp, buf, mode, size));
4955}
4956
4957
4958/*********************************************************************
4959 * signal (CRTDLL.452)
4960 */
4961void CDECL CRTDLL_signal( int sig, void (*func)(int))
4962{
4963 dprintf(("CRTDLL: signal not implemented.\n"));
4964 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
4965}
4966
4967
4968/*********************************************************************
4969 * sinh (CRTDLL.454)
4970 */
4971double CDECL CRTDLL_sinh( double x )
4972{
4973 dprintf(("CRTDLL: sinh\n"));
4974 return (sinh(x));
4975}
4976
4977
4978/*********************************************************************
4979 * srand (CRTDLL.457)
4980 */
4981void CDECL CRTDLL_srand( unsigned int seed )
4982{
4983 dprintf(("CRTDLL: srand\n"));
4984 srand(seed);
4985}
4986
4987
4988/*********************************************************************
4989 * strcoll (CRTDLL.462)
4990 */
4991int CDECL CRTDLL_strcoll( const char *s1, const char *s2 )
4992{
4993 dprintf(("CRTDLL: strcoll\n"));
4994 return strcoll(s1, s2);
4995}
4996
4997
4998/*********************************************************************
4999 * strerror (CRTDLL.465)
5000 */
5001char * CDECL CRTDLL_strerror( int errnum )
5002{
5003 dprintf(("CRTDLL: strerror\n"));
5004 return strerror(errnum);
5005}
5006
5007
5008/*********************************************************************
5009 * strftime (CRTDLL.466)
5010 */
5011size_t CDECL CRTDLL_strftime( char *s, size_t maxsiz, const char *fmt, const struct tm *tp )
5012{
5013 dprintf(("CRTDLL: strftime\n"));
5014 return strftime(s, maxsiz, fmt, tp);
5015}
5016
5017
5018/*********************************************************************
5019 * strtod (CRTDLL.475)
5020 */
5021double CDECL CRTDLL_strtod( const char *nptr, char **endptr )
5022{
5023 dprintf(("CRTDLL: strtod\n"));
5024 return strtod(nptr, endptr);
5025}
5026
5027
5028/*********************************************************************
5029 * strtok (CRTDLL.476)
5030 */
5031char * CDECL CRTDLL_strtok( char *s1, const char *s2 )
5032{
5033 dprintf(("CRTDLL: strtok\n"));
5034 return strtok(s1, s2);
5035}
5036
5037
5038/*********************************************************************
5039 * strtol (CRTDLL.477)
5040 */
5041long int CDECL CRTDLL_strtol( const char *nptr, char **endptr, int base )
5042{
5043 dprintf(("CRTDLL: strtol\n"));
5044 return strtol(nptr, endptr, base);
5045}
5046
5047
5048/*********************************************************************
5049 * strtoul (CRTDLL.478)
5050 */
5051unsigned long CDECL CRTDLL_strtoul( const char *nptr, char **endptr, int base )
5052{
5053 dprintf(("CRTDLL: strtoul\n"));
5054 return strtoul(nptr, endptr, base);
5055}
5056
5057
5058/*********************************************************************
5059 * strxfrm (CRTDLL.479)
5060 */
5061size_t CDECL CRTDLL_strxfrm( char *s1, const char *s2, size_t n )
5062{
5063 dprintf(("CRTDLL: strxfrm\n"));
5064 return strxfrm(s1, s2, n);
5065}
5066
5067
5068/*********************************************************************
5069 * swscanf (CRTDLL.481)
5070 */
5071int CDECL CRTDLL_swscanf( const wchar_t *s1, const wchar_t *s2, ... )
5072{
5073 dprintf(("CRTDLL: swscanf not implemented.\n"));
5074 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
5075 return FALSE;
5076}
5077
5078
5079/*********************************************************************
5080 * system (CRTDLL.482)
5081 */
5082int CDECL CRTDLL_system( const char *string )
5083{
5084 dprintf(("CRTDLL: system\n"));
5085 return system(string);
5086}
5087
5088
5089/*********************************************************************
5090 * tanh (CRTDLL.485)
5091 */
5092double CDECL CRTDLL_tanh( double x )
5093{
5094 dprintf(("CRTDLL: tanh\n"));
5095 return tanh(x);
5096}
5097
5098
5099/*********************************************************************
5100 * time (CRTDLL.485)
5101 */
5102time_t CDECL CRTDLL_time( time_t *timer )
5103{
5104 dprintf(("CRTDLL: time\n"));
5105
5106 return time(timer);
5107}
5108
5109
5110/*********************************************************************
5111 * tmpfile (CRTDLL.486)
5112 */
5113FILE * CDECL CRTDLL_tmpfile( void )
5114{
5115 dprintf(("CRTDLL: tmpfile\n"));
5116 return (tmpfile());
5117}
5118
5119
5120/*********************************************************************
5121 * tmpnam (CRTDLL.487)
5122 */
5123char * CDECL CRTDLL_tmpnam( char *s )
5124{
5125 dprintf(("CRTDLL: tmpnam\n"));
5126 return (tmpnam(s));
5127}
5128
5129
5130/*********************************************************************
5131 * ungetc (CRTDLL.492)
5132 */
5133INT CDECL CRTDLL_ungetc(int c, FILE *f)
5134{
5135 dprintf(("CRTDLL: ungetc not implemented.\n"));
5136 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
5137 return FALSE;
5138}
5139
5140
5141/*********************************************************************
5142 * ungetwc (CRTDLL.493)
5143 */
5144wint_t CDECL CRTDLL_ungetwc( wint_t wc, FILE *strm )
5145{
5146 dprintf(("CRTDLL: ungetwc\n"));
5147 return (ungetwc(wc, strm));
5148}
5149
5150
5151/*********************************************************************
5152 * vfprintf (CRTDLL.494)
5153 */
5154INT CDECL CRTDLL_vfprintf( CRTDLL_FILE *file, LPSTR format, va_list args )
5155{
5156 dprintf(("CRTDLL: vprintf\n"));
5157 char buffer[2048]; /* FIXME... */
5158 vsprintf( buffer, format, args );
5159 return CRTDLL_fwrite( buffer, 1, strlen(buffer), file );
5160}
5161
5162
5163/*********************************************************************
5164 * vfwprintf (CRTDLL.495)
5165 */
5166int CDECL CRTDLL_vfwprintf( FILE *F, const wchar_t *s, va_list arg )
5167{
5168 dprintf(("CRTDLL: vfwprintf not implemented.\n"));
5169 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
5170 return FALSE;
5171}
5172
5173
5174/*********************************************************************
5175 * vprintf (CRTDLL.496)
5176 */
5177int CDECL CRTDLL_vprintf( const char *format, __va_list arg )
5178{
5179 dprintf(("CRTDLL: vprintf\n"));
5180 return (vprintf(format, arg));
5181}
5182
5183
5184/*********************************************************************
5185 * vswprintf (CRTDLL.498)
5186 */
5187int CDECL CRTDLL_vswprintf( wchar_t *s , size_t t, const wchar_t *format, va_list arg )
5188{
5189 dprintf(("CRTDLL: vswprintf\n"));
5190 return (vswprintf(s, t, format, arg));
5191}
5192
5193
5194/*********************************************************************
5195 * vwprintf (CRTDLL.499)
5196 */
5197int CDECL CRTDLL_vwprintf( const wchar_t *s, va_list arg)
5198{
5199 dprintf(("CRTDLL: vwprintf not implemented.\n"));
5200 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
5201 return FALSE;
5202}
5203
5204
5205/*********************************************************************
5206 * wcscoll (CRTDLL.503)
5207 */
5208int CDECL CRTDLL_wcscoll(const wchar_t *s1, const wchar_t *s2)
5209{
5210 dprintf(("CRTDLL: wcscoll\n"));
5211 return (wcscoll(s1, s2));
5212}
5213
5214
5215/*********************************************************************
5216 * wcsftime (CRTDLL.506)
5217 */
5218size_t CDECL CRTDLL_wcsftime( wchar_t *s, size_t maxsize,
5219 const wchar_t *format, const struct tm *timeptr )
5220{
5221 dprintf(("CRTDLL: wcsftime\n"));
5222 return (wcsftime(s, maxsize, format, timeptr));
5223}
5224
5225
5226/*********************************************************************
5227 * wcstod (CRTDLL.515)
5228 */
5229double CDECL CRTDLL_wcstod( const wchar_t *nptr, wchar_t **endptr )
5230{
5231 dprintf(("CRTDLL: wcstod\n"));
5232 return (wcstod(nptr, endptr));
5233}
5234
5235
5236/*********************************************************************
5237 * wcsxfrm (CRTDLL.520)
5238 */
5239size_t CDECL CRTDLL_wcsxfrm( wchar_t *s1, const wchar_t *s2, size_t n )
5240{
5241 dprintf(("CRTDLL: wcsxfrm\n"));
5242 return (wcsxfrm(s1, s2, n));
5243}
5244
5245
5246/*********************************************************************
5247 * wcstomb (CRTDLL.521)
5248 */
5249int CDECL CRTDLL_wctomb( char *s, wchar_t wchar )
5250{
5251 dprintf(("CRTDLL: wctomb\n"));
5252 return (wctomb(s,wchar));
5253}
5254
5255
5256/*********************************************************************
5257 * wprintf (CRTDLL.522)
5258 */
5259int CDECL CRTDLL_wprintf( const wchar_t *s, ... )
5260{
5261 dprintf(("CRTDLL: wprintf not implemented.\n"));
5262 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
5263 return FALSE;
5264}
5265
5266
5267/*********************************************************************
5268 * wscanf (CRTDLL.523)
5269 */
5270int CDECL CRTDLL_wscanf( const wchar_t *s, ... )
5271{
5272 dprintf(("CRTDLL: wscanf not implemented.\n"));
5273 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
5274 return FALSE;
5275}
5276
5277
5278
5279/*********************************************************************
5280 * __set_errno (INTERNAL-#1)
5281 */
5282int __set_errno (int error)
5283{
5284 errno = error;
5285 return error;
5286}
5287
5288
5289/*********************************************************************
5290 * _mbbtoupper (INTERNAL-#2)
5291 */
5292unsigned int _mbbtoupper(unsigned int c)
5293{
5294 if (!CRTDLL__ismbblead(c) )
5295 return toupper(c);
5296
5297 return c;
5298}
5299
5300
5301/*********************************************************************
5302 * _mbbtolower (INTERNAL-#3)
5303 */
5304unsigned int _mbbtolower(unsigned int c)
5305{
5306 if (!CRTDLL__ismbblead(c) )
5307 return tolower(c);
5308 return c;
5309}
5310
5311
5312/*********************************************************************
5313 * _mbclen2 (INTERNAL-#4)
5314 */
5315size_t _mbclen2(const unsigned int s)
5316{
5317 return (CRTDLL__ismbblead(s>>8) && CRTDLL__ismbbtrail(s&0x00FF)) ? 2 : 1;
5318}
5319
5320
5321/*********************************************************************
5322 * _isinf (INTERNAL-#5)
5323 */
5324int _isinf(double __x)
5325{
5326 double_t * x = (double_t *)&__x;
5327 return ( x->exponent == 0x7ff && ( x->mantissah == 0 && x->mantissal == 0 ));
5328}
Note: See TracBrowser for help on using the repository browser.