Ignore:
Timestamp:
Nov 28, 1999, 6:22:27 PM (26 years ago)
Author:
sandervl
Message:

Jens Weissner's changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/crtdll/crtdll.cpp

    r1220 r1868  
    1 /* $Id: crtdll.cpp,v 1.10 1999-10-09 13:32:25 sandervl Exp $ */
     1/* $Id: crtdll.cpp,v 1.11 1999-11-28 17:22:26 sandervl Exp $ */
    22
    33/*
     
    548548 *           CRTDLL__cabs   (CRTDLL.48)
    549549 */
    550 double CDECL CRTDLL__cabs(struct complex * z)
    551 {
    552   dprintf(("CRTDLL: _cabs not implemented\n"));
    553   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    554   return FALSE;
     550double CDECL CRTDLL__cabs(struct _complex z)
     551{
     552  dprintf(("CRTDLL: _cabs\n"));
     553  return sqrt( z.x*z.x + z.y*z.y );
    555554}
    556555
     
    710709 *                  _cprintf    (CRTDLL.63)
    711710 */
    712 INT CDECL CRTDLL__cprintf( char *s, ... )
    713 {
    714   dprintf(("CRTDLL: _cprintf not implemented.\n"));
    715   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    716   return FALSE;
     711INT CDECL CRTDLL__cprintf( char *fmt, ... )
     712{
     713  dprintf(("CRTDLL: _cprintf.\n"));
     714
     715  int     cnt;
     716  char    buf[ 2048 ];          /* this is buggy, because buffer might be too small. */
     717  va_list ap;
     718 
     719  va_start(ap, fmt);
     720  cnt = vsprintf(buf, fmt, ap);
     721  va_end(ap);
     722 
     723  _cputs(buf);
     724  return cnt;
    717725}
    718726
     
    844852int CDECL CRTDLL__execl(const char* szPath, const char* szArgv0, ...)
    845853{
    846   dprintf(("CRTDLL: _execl not implemented.\n"));
    847   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    848   return FALSE;
     854  dprintf(("CRTDLL: _execl\n"));
     855
     856  char *szArg[100];
     857  const char *a;
     858  int i = 0;
     859  va_list l = 0;
     860  va_start(l,szArgv0);
     861  do {
     862        a = va_arg(l,const char *);
     863        szArg[i++] = (char *)a;
     864  } while ( a != NULL && i < 100 );
     865
     866  return _spawnve(P_OVERLAY, (char*)szPath, szArg, _environ);
    849867}
    850868
     
    864882 *           CRTDLL__execlp   (CRTDLL.81)
    865883 */
    866 int CDECL CRTDLL__execlp( char *s1, char *s2, ...)
    867 {
    868   dprintf(("CRTDLL: _execlp not implemented.\n"));
    869   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    870   return FALSE;
     884int CDECL CRTDLL__execlp( char *szPath, char *szArgv0, ...)
     885{
     886  dprintf(("CRTDLL: _execlp\n"));
     887  char *szArg[100];
     888  const char *a;
     889  int i = 0;
     890  va_list l = 0;
     891  va_start(l,szArgv0);
     892  do {
     893        a = (const char *)va_arg(l,const char *);
     894        szArg[i++] = (char *)a;
     895  } while ( a != NULL && i < 100 );
     896  return _spawnvpe(P_OVERLAY, szPath,szArg, _environ);
    871897}
    872898
     
    11681194 *                  _fpreset     (CRTDLL.107)
    11691195 */
    1170 INT CDECL CRTDLL__fpreset(void)
     1196void CDECL CRTDLL__fpreset(void)
    11711197{
    11721198  dprintf(("CRTDLL: _fpreset not implemented.\n"));
    11731199  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    1174   return FALSE;
    11751200}
    11761201
     
    17751800int CDECL CRTDLL__ismbcsymbol( unsigned int c )
    17761801{
    1777   dprintf(("CRTDLL: _ismbcsymbol\n"));
     1802  dprintf(("CRTDLL: _ismbcsymbol not implemented.\n"));
    17781803  if ((c & 0xFF00) != 0) {
    17791804        // true multibyte character
     
    18881913 *                  _lfind     (CRTDLL.170)
    18891914 */
    1890 void * 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)));
     1915void * CDECL CRTDLL__lfind(const void *key, const void *base, size_t *nelp,
     1916         size_t width, int (*compar)(const void *, const void *))
     1917{
     1918  dprintf(("CRTDLL: _lfind\n"));
     1919  char *char_base = (char *)base;
     1920  int i;
     1921  for(i=0;i<*nelp;i++) {
     1922        if ( compar(key,char_base) == 0)
     1923                return char_base;
     1924        char_base += width;
     1925  }
     1926  return NULL;
    18971927}
    18981928
     
    19621992 *                  _lsearch   (CRTDLL.177)
    19631993 */
    1964 void * CDECL CRTDLL__lsearch(const void *v1, void  *v2, unsigned int *i1, unsigned int i2,
    1965         int (CDECL *i3)(const void *v3, const void *v4))
     1994void * CDECL CRTDLL__lsearch(const void *key, void *base, size_t *nelp, size_t width,
     1995         int (*compar)(const void *, const void *))
    19661996{
    19671997  dprintf(("CRTDLL: _lsearch not implemented.\n"));
    19681998  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    19691999  return FALSE;
    1970 //  return (_lsearch(v1,v2,i1,i2,i3(v3,v4)));
    19712000}
    19722001
     
    31483177double CDECL CRTDLL__nextafter( double x, double y )
    31493178{
    3150   dprintf(("CRTDLL: _nextafter not implemented.\n"));
    3151   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    3152   return FALSE;
     3179  dprintf(("CRTDLL: _nextafter\n"));
     3180  if ( x == y)
     3181        return x;
     3182  if ( CRTDLL__isnan(x) || CRTDLL__isnan(y) )
     3183        return x;
     3184
     3185  return x;
    31533186}
    31543187
     
    34753508 *           CRTDLL__spawnl      (CRTDLL.269)
    34763509 */
    3477 int 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;
     3510int CDECL CRTDLL__spawnl(int nMode, const char* szPath, const char* szArgv0,...)
     3511{
     3512  dprintf(("CRTDLL: _spawnl\n"));
     3513  char *szArg[100];
     3514  const char *a;
     3515  int i = 0;
     3516  va_list l = 0;
     3517  va_start(l,szArgv0);
     3518  do {
     3519        a = va_arg(l,const char *);
     3520        szArg[i++] = (char *)a;
     3521  } while ( a != NULL && i < 100 );
     3522 
     3523  return _spawnve(nMode, (char*)szPath, szArg, _environ);
    34823524}
    34833525
     
    34973539 *           CRTDLL__spawnlp     (CRTDLL.271)
    34983540 */
    3499 int 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;
     3541int CDECL CRTDLL__spawnlp(int nMode, const char* szPath, const char* szArgv0, ...)
     3542{
     3543  dprintf(("CRTDLL: _spawnlp\n"));
     3544  char *szArg[100];
     3545  const char *a;
     3546  int i = 0;
     3547  va_list l = 0;
     3548  va_start(l,szArgv0);
     3549  do {
     3550        a = (const char *)va_arg(l,const char *);
     3551        szArg[i++] = (char *)a;
     3552  } while ( a != NULL && i < 100 );
     3553  return _spawnvpe(nMode, (char*)szPath,szArg, _environ);
    35043554}
    35053555
     
    38893939  {
    38903940      int size = (wcslen((const wchar_t*)str) + 1) * sizeof(WCHAR);
    3891 // FIXME     ret = CRTDLL_malloc( size );
     3941// FIXME      ret = CRTDLL_malloc( size );
    38923942      if (ret) memcpy( ret, str, size );
    38933943  }
     
    44344484 *                  fwprintf      (CRTDLL.382)
    44354485 */
    4436 int CDECL CRTDLL_fwprintf( FILE *strm, const wchar_t *format, ... )
     4486int CDECL CRTDLL_fwprintf( FILE *iop, const wchar_t *fmt, ... )
    44374487{
    44384488  dprintf(("CRTDLL: fwprintf not implemented.\n"));
     
    45234573INT CDECL CRTDLL_is_wctype(wint_t wc, wctype_t wctypeFlags)
    45244574{
    4525         dprintf(("CRTDLL: is_wctype not implemented.\n"));
    4526         return 0;
     4575        dprintf(("CRTDLL: is_wctype\n"));
     4576        return ((CRTDLL_pwctype_dll[(unsigned char)(wc & 0xFF)]&wctypeFlags) == wctypeFlags );
    45274577}
    45284578
     
    48174867int CDECL CRTDLL_printf( const char *format, ... )
    48184868{
    4819     dprintf(("CRTDLL: printf not implemented.\n"));
    4820     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    4821     return FALSE;
     4869  dprintf(("CRTDLL: printf not implemented.\n"));
     4870  va_list arg;
     4871  int done;
     4872
     4873  va_start (arg, format);
     4874  done = vprintf (format, arg);
     4875  va_end (arg);
     4876  return done;
    48224877}
    48234878
Note: See TracChangeset for help on using the changeset viewer.