Changeset 1220 for trunk/src/crtdll/crtdll.cpp
- Timestamp:
- Oct 9, 1999, 3:32:26 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/crtdll/crtdll.cpp
r1207 r1220 1 /* $Id: crtdll.cpp,v 1. 9 1999-10-09 09:39:12sandervl Exp $ */1 /* $Id: crtdll.cpp,v 1.10 1999-10-09 13:32:25 sandervl Exp $ */ 2 2 3 3 /* … … 48 48 #include <crtdll.h> 49 49 #include "crtinc.h" 50 #include "ieee.h" 50 51 51 52 DEFAULT_DEBUG_CHANNEL(crtdll) … … 271 272 INT CDECL CRTDLL__XcptFilter(DWORD ret, struct _EXCEPTION_POINTERS * ExceptionInfo ) 272 273 { 273 dprintf(("CRTDLL: XcptFilter not implemented.\n")); 274 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 275 return FALSE; 274 dprintf(("CRTDLL: _XcptFilter\n")); 275 return UnhandledExceptionFilter(ExceptionInfo); 276 276 } 277 277 … … 372 372 * __fpecode (CRTDLL.27) 373 373 */ 374 int fpecode = 0; 375 374 376 int * CDECL CRTDLL___fpecode ( void ) 375 377 { 376 dprintf(("__fpecode not implemented.\n")); 377 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 378 return FALSE; 378 dprintf(("__fpecode\n")); 379 return &fpecode; 379 380 } 380 381 … … 604 605 * CRTDLL__chgsign (CRTDLL.53) 605 606 */ 606 double CDECL CRTDLL__chgsign(double x) 607 { 608 dprintf(("CRTDLL: _chgsign not implemented.\n")); 609 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 610 return FALSE; 607 double 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; 611 617 } 612 618 … … 689 695 * CRTDLL__copysign (CRTDLL.62) 690 696 */ 691 double CDECL CRTDLL__copysign( double x, double y ) 692 { 693 dprintf(("CRTDLL: _copysign not implemented.\n")); 694 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 695 return FALSE; 696 } 697 698 699 /********************************************************************* 700 * CRTDLL__cprintf (CRTDLL.63) 697 double 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) 701 711 */ 702 712 INT CDECL CRTDLL__cprintf( char *s, ... ) … … 830 840 831 841 /********************************************************************* 832 * CRTDLL__execl (CRTDLL.79)833 */ 834 int CDECL CRTDLL__execl( char *s1, char *s2, ...)842 * _execl (CRTDLL.79) 843 */ 844 int CDECL CRTDLL__execl(const char* szPath, const char* szArgv0, ...) 835 845 { 836 846 dprintf(("CRTDLL: _execl not implemented.\n")); … … 924 934 925 935 /********************************************************************* 926 * CRTDLL__expand (CRTDLL.88)936 * _expand (CRTDLL.88) 927 937 */ 928 938 void * CDECL CRTDLL__expand( void *ptr, size_t size ) … … 935 945 936 946 /********************************************************************* 937 * CRTDLL__fcloseall (CRTDLL.89)947 * _fcloseall (CRTDLL.89) 938 948 */ 939 949 int CDECL CRTDLL__fcloseall( void ) … … 945 955 946 956 /********************************************************************* 947 * CRTDLL__fcvt (CRTDLL.90)957 * _fcvt (CRTDLL.90) 948 958 */ 949 959 char * CDECL CRTDLL__fcvt( double val, int ndig, int *dec, int *sign ) … … 986 996 987 997 /********************************************************************* 988 * CRTDLL__fgetchar (CRTDLL.92)998 * _fgetchar (CRTDLL.92) 989 999 */ 990 1000 int CDECL CRTDLL__fgetchar( void ) … … 996 1006 997 1007 /********************************************************************* 998 * CRTDLL__fgetwchar (CRTDLL.93)1008 * _fgetwchar (CRTDLL.93) 999 1009 */ 1000 1010 wint_t CDECL CRTDLL__fgetwchar( void *i ) … … 1006 1016 1007 1017 /********************************************************************* 1008 * CRTDLL__filbuf (CRTDLL.94)1018 * _filbuf (CRTDLL.94) 1009 1019 */ 1010 1020 int CDECL CRTDLL__filbuf(FILE * f) … … 1027 1037 1028 1038 /********************************************************************* 1029 * CRTDLL__fileno (CRTDLL.97)1039 * _fileno (CRTDLL.97) 1030 1040 */ 1031 1041 int CDECL CRTDLL__fileno(FILE * f) … … 1076 1086 INT CDECL CRTDLL__finite(double x) 1077 1087 { 1078 dprintf(("CRTDLL: _finite not implemented.\n")); 1079 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 1080 return FALSE; 1088 dprintf(("CRTDLL: _finite\n")); 1089 return !_isinf(x); 1081 1090 } 1082 1091 … … 1106 1115 * _fpclass (CRTDLL.105) 1107 1116 */ 1108 INT CDECL CRTDLL__fpclass( double x ) 1109 { 1110 dprintf(("CRTDLL: _fpclass not implemented.\n")); 1111 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 1112 return FALSE; 1117 INT 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; 1113 1152 } 1114 1153 … … 1411 1450 dprintf(("CRTDLL: _heapwalk not implemented.\n")); 1412 1451 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 1413 return FALSE;1452 return 0; 1414 1453 } 1415 1454 … … 1420 1459 double CDECL CRTDLL__hypot(double x1, double x2) 1421 1460 { 1422 dprintf(("CRTDLL: _hypot not implemented.\n"));1461 dprintf(("CRTDLL: _hypot\n")); 1423 1462 return (_hypot(x1, x2)); 1424 1463 } … … 1799 1838 * _isnan (CRTDLL.164) 1800 1839 */ 1801 int CDECL CRTDLL__isnan( double x )1802 { 1803 dprintf(("CRTDLL: _isnan not implemented.\n"));1804 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);1805 return FALSE;1840 int 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 )); 1806 1845 } 1807 1846 … … 1864 1903 void * CDECL CRTDLL__loaddll (char *name) 1865 1904 { 1866 dprintf(("CRTDLL: _loaddll not implemented.\n")); 1867 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 1868 return FALSE; 1905 dprintf(("CRTDLL: _loaddll\n")); 1906 return (void*)LoadLibraryA(name); 1869 1907 } 1870 1908 … … 2205 2243 unsigned char * CDECL CRTDLL__mbscat( unsigned char *dst, const unsigned char *src ) 2206 2244 { 2207 dprintf(("CRTDLL: _mbscat not implemented.\n")); 2208 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 2209 return FALSE; 2245 dprintf(("CRTDLL: _mbscat\n")); 2246 return (unsigned char*)strcat((char*)dst,(char*)src); 2210 2247 } 2211 2248 … … 2216 2253 unsigned char * CDECL CRTDLL__mbschr( const unsigned char *str, unsigned int c ) 2217 2254 { 2218 dprintf(("CRTDLL: _mbschr not implemented.\n")); 2219 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 2220 return FALSE; 2255 dprintf(("CRTDLL: _mbschr\n")); 2256 return (unsigned char*)strchr((char*)str,c); 2221 2257 } 2222 2258 … … 2227 2263 int CDECL CRTDLL__mbscmp( const unsigned char *s1, const unsigned char *s2 ) 2228 2264 { 2229 dprintf(("CRTDLL: _mbscmp not implemented.\n")); 2230 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 2231 return FALSE; 2265 dprintf(("CRTDLL: _mbscmp\n")); 2266 return strcmp((char*)s1,(char*)s2); 2232 2267 } 2233 2268 … … 2238 2273 unsigned char * CDECL CRTDLL__mbscpy( unsigned char *s1, const unsigned char *s2 ) 2239 2274 { 2240 dprintf(("CRTDLL: _mbscpy not implemented.\n")); 2241 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 2242 return FALSE; 2275 dprintf(("CRTDLL: _mbscpy\n")); 2276 return (unsigned char*)strcpy((char*)s1,(char*)s2); 2243 2277 } 2244 2278 … … 2249 2283 size_t CDECL CRTDLL__mbscspn( const unsigned char *s1, const unsigned char *s2 ) 2250 2284 { 2251 dprintf(("CRTDLL: _mbscspn not implemented.\n")); 2252 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 2253 return FALSE; 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 */ 2254 2299 } 2255 2300 … … 2275 2320 * _mbsdup (CRTDLL.201) 2276 2321 */ 2277 unsigned char * CDECL CRTDLL__mbsdup( unsigned char *src ) 2278 { 2279 dprintf(("CRTDLL: _mbsdup not implemented.\n")); 2280 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 2281 return FALSE; 2322 unsigned 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; 2282 2333 } 2283 2334 … … 2903 2954 unsigned char * CDECL CRTDLL__mbsstr( const unsigned char *s1, const unsigned char *s2 ) 2904 2955 { 2905 dprintf(("CRTDLL: _mbsstr not implemented.\n")); 2906 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 2907 return FALSE; 2956 dprintf(("CRTDLL: _mbsstr\n")); 2957 return (unsigned char*)strstr((const char*)s1,(const char*)s2); 2908 2958 } 2909 2959 … … 2914 2964 unsigned char * CDECL CRTDLL__mbstok( unsigned char *s, const unsigned char *delim ) 2915 2965 { 2916 dprintf(("CRTDLL: _mbstok not implemented\n")); 2917 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 2918 return FALSE; 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 */ 2919 3015 } 2920 3016 … … 3273 3369 * _scalb (CRTDLL.259) 3274 3370 */ 3275 double CDECL CRTDLL__scalb( double x, long exp ) 3276 { 3277 dprintf(("CRTDLL: _scalb not implemented.\n")); 3278 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 3279 return FALSE; 3371 double 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; 3280 3379 } 3281 3380 … … 3754 3853 int CDECL CRTDLL__unloaddll(void *handle) 3755 3854 { 3756 dprintf(("CRTDLL: _unloaddll not implemented.\n")); 3757 SetLastError(ERROR_CALL_NOT_IMPLEMENTED); 3758 return FALSE; 3855 dprintf(("CRTDLL: _unloaddll\n")); 3856 return FreeLibrary((HMODULE)handle); 3759 3857 } 3760 3858 … … 5033 5131 * ungetc (CRTDLL.492) 5034 5132 */ 5035 INT CDECL CRTDLL_ungetc(int c )5133 INT CDECL CRTDLL_ungetc(int c, FILE *f) 5036 5134 { 5037 5135 dprintf(("CRTDLL: ungetc not implemented.\n")); … … 5219 5317 return (CRTDLL__ismbblead(s>>8) && CRTDLL__ismbbtrail(s&0x00FF)) ? 2 : 1; 5220 5318 } 5319 5320 5321 /********************************************************************* 5322 * _isinf (INTERNAL-#5) 5323 */ 5324 int _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 TracChangeset
for help on using the changeset viewer.