Changeset 6712 for trunk/src/crtdll


Ignore:
Timestamp:
Sep 15, 2001, 11:47:44 AM (24 years ago)
Author:
sandervl
Message:

restored old version

Location:
trunk/src/crtdll
Files:
8 edited

Legend:

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

    r6645 r6712  
    1 /* $Id: crtdll.cpp,v 1.30 2001-09-05 12:14:23 bird Exp $ */
    21/*
    32 * The C RunTime DLL
    4  *
     3 * 
    54 * Implements C run-time functionality as known from UNIX.
    65 *
    7  * TODO:
     6 * TODO: 
    87 *   - Check setjmp(3)
    98 *   - fix *ALL* functions for the FS: wrapper problem
     
    7372// Definitions for internal functions
    7473//
    75 void        qsort1 (char*, char*, size_t,
     74void            qsort1 (char*, char*, size_t,
    7675                    int (* CDECL)(const void*, const void*));
    7776
     
    445444
    446445/*********************************************************************
    447  *  _cscanf                     (CRTDLL.67)
     446 *      _cscanf                                 (CRTDLL.67)
    448447 */
    449448INT CDECL CRTDLL__cscanf( char *s, va_list arg )
     
    605604
    606605/*********************************************************************
    607  *  _ftime                  (CRTDLL.112)
     606 *      _ftime                                  (CRTDLL.112)
    608607 */
    609608void CDECL CRTDLL__ftime( struct timeb *timebuf )
     
    619618LONG CDECL CRTDLL__ftol(void)
    620619{
    621     /* don't just do DO_FPU("fistp",retval), because the rounding
    622     * mode must also be set to "round towards zero"... */
    623     double fl;
    624     POP_FPU(fl);
    625     return (LONG)fl;
     620        /* don't just do DO_FPU("fistp",retval), because the rounding
     621        * mode must also be set to "round towards zero"... */
     622        double fl;
     623        POP_FPU(fl);
     624        return (LONG)fl;
    626625}
    627626
     
    776775
    777776/*********************************************************************
    778  *                  _ltoa   (CRTDLL.179)
     777 *                  _ltoa       (CRTDLL.179)
    779778 */
    780779LPSTR  CDECL CRTDLL__ltoa(long x,LPSTR buf,INT radix)
     
    785784
    786785/*********************************************************************
    787  *                  _matherr    (CRTDLL.181)
     786 *                  _matherr    (CRTDLL.181)
    788787 */
    789788double CDECL CRTDLL__matherr( struct exception * excep )
     
    882881
    883882/*********************************************************************
    884  *           CRTDLL__searchenv   (CRTDLL.260)
     883 *           CRTDLL__searchenv   (CRTDLL.260)
    885884 */
    886885void CDECL CRTDLL__searchenv(char *file, char *var,char *path )
     
    892891
    893892/*********************************************************************
    894  *           CRTDLL__seterrormode   (CRTDLL.261)
     893 *           CRTDLL__seterrormode       (CRTDLL.261)
    895894 */
    896895void CDECL CRTDLL__seterrormode(int uMode)
     
    903902
    904903/*********************************************************************
    905  *           CRTDLL__setjmp     (CRTDLL.262)
     904 *           CRTDLL__setjmp     (CRTDLL.262)
    906905 */
    907906int CDECL CRTDLL__setjmp( jmp_buf env )
     
    938937
    939938/*********************************************************************
    940  *  _sopen                  (CRTDLL.268)
     939 *      _sopen                                  (CRTDLL.268)
    941940 */
    942941int CDECL CRTDLL__sopen( const char *s, int i1, int i2, va_list arg )
     
    948947
    949948/*********************************************************************
    950  *           CRTDLL__spawnl     (CRTDLL.269)
     949 *           CRTDLL__spawnl     (CRTDLL.269)
    951950 */
    952951int CDECL CRTDLL__spawnl(int nMode, char* szPath, char* szArgv0, va_list arg)
     
    958957
    959958/*********************************************************************
    960  *           CRTDLL__spawnle     (CRTDLL.270)
     959 *           CRTDLL__spawnle     (CRTDLL.270)
    961960 */
    962961int CDECL CRTDLL__spawnle( int mode, char *path, char **szArgv0, va_list arg )
     
    968967
    969968/*********************************************************************
    970  *           CRTDLL__spawnlp     (CRTDLL.271)
     969 *           CRTDLL__spawnlp     (CRTDLL.271)
    971970 */
    972971int CDECL CRTDLL__spawnlp(int nMode, char* szPath, char* szArgv0, va_list arg)
     
    978977
    979978/*********************************************************************
    980  *           CRTDLL__spawnlpe   (CRTDLL.272)
     979 *           CRTDLL__spawnlpe   (CRTDLL.272)
    981980 */
    982981int CDECL CRTDLL__spawnlpe( int mode, char *path, char *szArgv0, va_list arg )
     
    988987
    989988/*********************************************************************
    990  *           CRTDLL__spawnv     (CRTDLL.273)
     989 *           CRTDLL__spawnv     (CRTDLL.273)
    991990 */
    992991int CDECL CRTDLL__spawnv( int i, char *s1, char ** s2 )
     
    998997
    999998/*********************************************************************
    1000  *           CRTDLL__spawnvp     (CRTDLL.275)
     999 *           CRTDLL__spawnvp     (CRTDLL.275)
    10011000 */
    10021001int CDECL CRTDLL__spawnvp( int i, char *s1, char ** s2 )
     
    10071006
    10081007/*********************************************************************
    1009  *           CRTDLL__spawnv     (CRTDLL.276)
     1008 *           CRTDLL__spawnv     (CRTDLL.276)
    10101009 */
    10111010int CDECL CRTDLL__spawnvpe( int i, char *s1, char ** s2, char ** s3 )
     
    10171016
    10181017/*********************************************************************
    1019  *           CRTDLL__statusfp    (CRTDLL.279)
     1018 *           CRTDLL__statusfp    (CRTDLL.279)
    10201019 */
    10211020unsigned int CDECL CRTDLL__statusfp( void )
     
    10241023  return (_status87());
    10251024}
    1026 
    1027 
    1028 /*********************************************************************
    1029  *           _ultoa      (CRTDLL.309)
     1025       
     1026
     1027/*********************************************************************
     1028 *           _ultoa              (CRTDLL.309)
    10301029 */
    10311030LPSTR  CDECL CRTDLL__ultoa(long x,LPSTR buf,INT radix)
     
    10371036
    10381037/*********************************************************************
    1039  *           CRTDLL__ungetch    (CRTDLL.311)
     1038 *           CRTDLL__ungetch    (CRTDLL.311)
    10401039 */
    10411040int CDECL CRTDLL__ungetch( int i )
     
    10471046
    10481047/*********************************************************************
    1049  *           _utime      (CRTDLL.314)
     1048 *           _utime              (CRTDLL.314)
    10501049 */
    10511050int CDECL CRTDLL__utime( char *path, struct utimbuf * times )
     
    10571056
    10581057/*********************************************************************
    1059  *  _vsnprintf              (CRTDLL.315)
     1058 *      _vsnprintf                              (CRTDLL.315)
    10601059 */
    10611060int CDECL CRTDLL__vsnprintf( char *s, size_t bufsize, const char *format, va_list arg )
     
    11011100
    11021101/*********************************************************************
    1103  *                  abs     (CRTDLL.336)
     1102 *                  abs         (CRTDLL.336)
    11041103 */
    11051104double CDECL CRTDLL_abs(double d)
     
    11131112
    11141113/*********************************************************************
    1115  *                  acos    (CRTDLL.337)
     1114 *                  acos        (CRTDLL.337)
    11161115 */
    11171116double CDECL CRTDLL_acos( double x )
     
    11231122
    11241123/*********************************************************************
    1125  *                  asctime (CRTDLL.338)
     1124 *                  asctime     (CRTDLL.338)
    11261125 */
    11271126char * CDECL CRTDLL_asctime( const struct tm *timeptr )
     
    11331132
    11341133/*********************************************************************
    1135  *                  asin    (CRTDLL.339)
     1134 *                  asin        (CRTDLL.339)
    11361135 */
    11371136double CDECL CRTDLL_asin( double x )
     
    11431142
    11441143/*********************************************************************
    1145  *                  atan    (CRTDLL.340)
     1144 *                  atan        (CRTDLL.340)
    11461145 */
    11471146double CDECL CRTDLL_atan(double d)
     
    11551154
    11561155/*********************************************************************
    1157  *                  atan2   (CRTDLL.341)
     1156 *                  atan2       (CRTDLL.341)
    11581157 */
    11591158double CDECL CRTDLL_atan2( double y, double x )
     
    11651164
    11661165/*********************************************************************
    1167  *                  atof    (CRTDLL.343)
     1166 *                  atof        (CRTDLL.343)
    11681167 */
    11691168double CDECL CRTDLL_atof( const char *nptr )
     
    11751174
    11761175/*********************************************************************
    1177  *                  atoi    (CRTDLL.344)
     1176 *                  atoi        (CRTDLL.344)
    11781177 */
    11791178int CDECL CRTDLL_atoi(LPSTR str)
     
    11871186
    11881187/*********************************************************************
    1189  *                  atol    (CRTDLL.345)
     1188 *                  atol        (CRTDLL.345)
    11901189 */
    11911190long CDECL CRTDLL_atol(LPSTR str)
     
    11991198
    12001199/*********************************************************************
    1201  *                  bsearch (CRTDLL.346)
     1200 *                  bsearch     (CRTDLL.346)
    12021201 */
    12031202void *CDECL CRTDLL_bsearch (const void *key, const void *base, size_t num, size_t width,
     
    12061205  int left, right, median, sign;
    12071206  const void *element;
    1208 
     1207 
    12091208  if (width == 0)
    12101209    return 0;
     
    12271226
    12281227/*********************************************************************
    1229  *                  ceil    (CRTDLL.348)
     1228 *                  ceil        (CRTDLL.348)
    12301229 */
    12311230double CDECL CRTDLL_ceil(double d)
     
    12381237
    12391238/*********************************************************************
    1240  *                  clock   (CRTDLL.350)
     1239 *                  clock       (CRTDLL.350)
    12411240 */
    12421241clock_t CDECL CRTDLL_clock( void )
     
    12481247
    12491248/*********************************************************************
    1250  *                  cos     (CRTDLL.351)
     1249 *                  cos         (CRTDLL.351)
    12511250 */
    12521251double CDECL CRTDLL_cos(double d)
     
    12601259
    12611260/*********************************************************************
    1262  *                  cosh    (CRTDLL.352)
     1261 *                  cosh        (CRTDLL.352)
    12631262 */
    12641263double CDECL CRTDLL_cosh( double x )
     
    12701269
    12711270/*********************************************************************
    1272  *                  ctime   (CRTDLL.353)
     1271 *                  ctime       (CRTDLL.353)
    12731272 */
    12741273char * CDECL CRTDLL_ctime( const time_t *timer )
     
    12801279
    12811280/*********************************************************************
    1282  *                  difftime    (CRTDLL.354)
     1281 *                  difftime    (CRTDLL.354)
    12831282 */
    12841283double CDECL CRTDLL_difftime( time_t t1, time_t t0 )
     
    12901289
    12911290/*********************************************************************
    1292  *                  div     (CRTDLL.355)
     1291 *                  div         (CRTDLL.355)
    12931292 */
    12941293ULONG CDECL CRTDLL_div( int number, int denom )
     
    13041303
    13051304/*********************************************************************
    1306  *                  exp     (CRTDLL.357)
     1305 *                  exp         (CRTDLL.357)
    13071306 */
    13081307double CDECL CRTDLL_exp( double x )
     
    13141313
    13151314/*********************************************************************
    1316  *                  fabs    (CRTDLL.358)
     1315 *                  fabs        (CRTDLL.358)
    13171316 */
    13181317double CDECL CRTDLL_fabs(double d)
     
    13261325
    13271326/*********************************************************************
    1328  *                  floor       (CRTDLL.367)
     1327 *                  floor               (CRTDLL.367)
    13291328 */
    13301329double CDECL CRTDLL_floor(double d)
     
    13381337
    13391338/*********************************************************************
    1340  *                  fmod    (CRTDLL.368)
     1339 *                  fmod        (CRTDLL.368)
    13411340 */
    13421341double CDECL CRTDLL_fmod(double x, double y )
     
    13481347
    13491348/*********************************************************************
    1350  *                  frexp     (CRTDLL.377)
     1349 *                  frexp         (CRTDLL.377)
    13511350 */
    13521351double CDECL CRTDLL_frexp( double value, int *exp )
     
    14901489
    14911490/*********************************************************************
    1492  *                  labs    (CRTDLL.416)
     1491 *                  labs        (CRTDLL.416)
    14931492 */
    14941493long int CDECL CRTDLL_labs( long int j )
     
    15001499
    15011500/*********************************************************************
    1502  *                  ldexp   (CRTDLL.417)
    1503  */
    1504 double CDECL CRTDLL_ldexp( double x, int exp )
     1501 *                  ldexp       (CRTDLL.417)
     1502 */
     1503double CDECL CRTDLL_ldexp( double x, int exp ) 
    15051504{
    15061505  dprintf2(("CRTDLL: ldexp\n"));
     
    15101509
    15111510/*********************************************************************
    1512  *                  ldiv    (CRTDLL.418)
    1513  */
    1514 ldiv_t CDECL CRTDLL_ldiv( long int numer, long int denom )
     1511 *                  ldiv        (CRTDLL.418)
     1512 */
     1513ldiv_t CDECL CRTDLL_ldiv( long int numer, long int denom ) 
    15151514{
    15161515  dprintf2(("CRTDLL: ldiv\n"));
     
    15201519
    15211520/*********************************************************************
    1522  *                  localeconv  (CRTDLL.419)
     1521 *                  localeconv  (CRTDLL.419)
    15231522 */
    15241523struct lconv * CDECL CRTDLL_localeconv(void)
     
    15301529
    15311530/*********************************************************************
    1532  *                  localtime   (CRTDLL.420)
     1531 *                  localtime   (CRTDLL.420)
    15331532 */
    15341533struct tm * CDECL CRTDLL_localtime( const time_t *timer )
     
    15401539
    15411540/*********************************************************************
    1542  *                  log     (CRTDLL.421)
     1541 *                  log         (CRTDLL.421)
    15431542 */
    15441543double CDECL CRTDLL_log( double x )
     
    15501549
    15511550/*********************************************************************
    1552  *                  log10   (CRTDLL.422)
     1551 *                  log10       (CRTDLL.422)
    15531552 */
    15541553double CDECL CRTDLL_log10( double x )
     
    15821581 *                  pow      (CRTDLL.436)
    15831582 */
    1584 double CDECL CRTDLL_pow( double x, double y )
     1583double CDECL CRTDLL_pow( double x, double y )   
    15851584{
    15861585    dprintf2(("CRTDLL: pow(%08xh, %08xh)\n",x, y));
     
    16221621
    16231622/*********************************************************************
    1624  *  scanf                   (CRTDLL.448)
     1623 *      scanf                                   (CRTDLL.448)
    16251624 */
    16261625int CDECL CRTDLL_scanf( const char *format, va_list arg )
     
    17061705
    17071706/*********************************************************************
    1708  *  sscanf                  (CRTDLL.458)
     1707 *      sscanf                                  (CRTDLL.458)
    17091708 */
    17101709int CDECL CRTDLL_sscanf( const char *s, const char *format, va_list arg )
     
    17831782
    17841783/*********************************************************************
    1785  *  ungetc                  (CRTDLL.492)
     1784 *      ungetc                                  (CRTDLL.492)
    17861785 */
    17871786INT CDECL CRTDLL_ungetc(int c, FILE *f)
     
    18131812
    18141813/*********************************************************************
    1815  *           CRTDLL__setjmp3     (CRTDLL.600)
     1814 *           CRTDLL__setjmp3     (CRTDLL.600)
    18161815 */
    18171816int CDECL CRTDLL__setjmp3( jmp_buf env )
  • trunk/src/crtdll/crtdll_main.c

    r6645 r6712  
    1 /* $Id: crtdll_main.c,v 1.2 2001-09-05 12:14:24 bird Exp $ */
    21/*
    32 * The C RunTime DLL
    4  *
     3 * 
    54 * Implements C run-time functionality as known from UNIX.
    65 *
     
    1413Unresolved issues Uwe Bonnes 970904:
    1514- tested with ftp://ftp.remcomp.com/pub/remcomp/lcc-win32.zip, a C-Compiler
    16         for Win32, based on lcc, from Jacob Navia
     15                for Win32, based on lcc, from Jacob Navia
    1716UB 000416:
    1817- probably not thread safe
    1918*/
    2019
    21 /* NOTE: This file also implements the wcs* functions. They _ARE_ in
     20/* NOTE: This file also implements the wcs* functions. They _ARE_ in 
    2221 * the newer Linux libcs, but use 4 byte wide characters, so are unusable,
    2322 * since we need 2 byte wide characters. - Marcus Meissner, 981031
     
    6463UINT CRTDLL_winminor_dll;     /* CRTDLL.330 */
    6564UINT CRTDLL_winver_dll;       /* CRTDLL.331 */
    66 INT  CRTDLL_doserrno = 0;
     65INT  CRTDLL_doserrno = 0; 
    6766INT  CRTDLL_errno = 0;
    6867const INT  CRTDLL__sys_nerr = 43;
     
    7877 *                  CRTDLL_MainInit  (CRTDLL.init)
    7978 */
    80 
     79 
    8180BOOL WINAPI CRTDLL_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
    8281{
    8382  FS_OS2
    84 
     83   
    8584    // call i/o initializer in file.c
    86     if (fdwReason == DLL_PROCESS_ATTACH)
     85    if (fdwReason == DLL_PROCESS_ATTACH) 
    8786    {
    8887      __CRTDLL__init_io();
    8988    }
    90 
     89   
    9190  /*
    9291    PH 2000/11/21 this code doesn't look very useful
    93 
     92   
    9493    if (fdwReason == DLL_PROCESS_ATTACH) {
    9594      _fdopen(0,"r");
     
    104103      }
    105104  */
    106 
     105 
    107106  FS_WIN32
    108107  return TRUE;
     
    177176        char *cmdline;
    178177        char  **xargv;
    179     int xargc,end,last_arg,afterlastspace;
    180     DWORD   version;
    181 
    182     TRACE("(%p,%p,%p,%ld).\n",
    183         argc,argv,environ,flag
    184     );
    185 
    186     if (CRTDLL_acmdln_dll != NULL)
    187         HeapFree(GetProcessHeap(), 0, CRTDLL_acmdln_dll);
    188 
    189     CRTDLL_acmdln_dll = cmdline = CRTDLL__strdup( GetCommandLineA() );
    190     TRACE("got '%s'\n", cmdline);
    191 
    192     version = GetVersion();
    193     CRTDLL_osver_dll       = version >> 16;
    194     CRTDLL_winminor_dll    = version & 0xFF;
    195     CRTDLL_winmajor_dll    = (version>>8) & 0xFF;
    196     CRTDLL_baseversion_dll = version >> 16;
    197     CRTDLL_winver_dll      = ((version >> 8) & 0xFF) + ((version & 0xFF) << 8);
    198     CRTDLL_baseminor_dll   = (version >> 16) & 0xFF;
    199     CRTDLL_basemajor_dll   = (version >> 24) & 0xFF;
    200     CRTDLL_osversion_dll   = version & 0xFFFF;
    201     CRTDLL_osminor_dll     = version & 0xFF;
    202     CRTDLL_osmajor_dll     = (version>>8) & 0xFF;
    203 
    204     /* missing threading init */
    205 
    206     end=0;last_arg=0;xargv=NULL;xargc=0;afterlastspace=0;
    207     while (1)
    208     {
    209         if ((cmdline[end]==' ') || (cmdline[end]=='\0'))
    210         {
    211         if (cmdline[end]=='\0')
    212             last_arg=1;
    213         else
    214             cmdline[end]='\0';
    215         /* alloc xargc + NULL entry */
    216             xargv=(char**)HeapReAlloc( GetProcessHeap(), 0, xargv,
    217                                      sizeof(char*)*(xargc+1));
    218         if (strlen(cmdline+afterlastspace))
    219         {
    220             xargv[xargc] = CRTDLL__strdup(cmdline+afterlastspace);
    221             xargc++;
     178        int     xargc,end,last_arg,afterlastspace;
     179        DWORD   version;
     180
     181        TRACE("(%p,%p,%p,%ld).\n",
     182                argc,argv,environ,flag
     183        );
     184
     185        if (CRTDLL_acmdln_dll != NULL)
     186                HeapFree(GetProcessHeap(), 0, CRTDLL_acmdln_dll);
     187
     188        CRTDLL_acmdln_dll = cmdline = CRTDLL__strdup( GetCommandLineA() );
     189        TRACE("got '%s'\n", cmdline);
     190
     191        version = GetVersion();
     192        CRTDLL_osver_dll       = version >> 16;
     193        CRTDLL_winminor_dll    = version & 0xFF;
     194        CRTDLL_winmajor_dll    = (version>>8) & 0xFF;
     195        CRTDLL_baseversion_dll = version >> 16;
     196        CRTDLL_winver_dll      = ((version >> 8) & 0xFF) + ((version & 0xFF) << 8);
     197        CRTDLL_baseminor_dll   = (version >> 16) & 0xFF;
     198        CRTDLL_basemajor_dll   = (version >> 24) & 0xFF;
     199        CRTDLL_osversion_dll   = version & 0xFFFF;
     200        CRTDLL_osminor_dll     = version & 0xFF;
     201        CRTDLL_osmajor_dll     = (version>>8) & 0xFF;
     202
     203        /* missing threading init */
     204
     205        end=0;last_arg=0;xargv=NULL;xargc=0;afterlastspace=0;
     206        while (1)
     207        {
     208            if ((cmdline[end]==' ') || (cmdline[end]=='\0'))
     209            {
     210                if (cmdline[end]=='\0')
     211                    last_arg=1;
     212                else
     213                    cmdline[end]='\0';
     214                /* alloc xargc + NULL entry */
     215                        xargv=(char**)HeapReAlloc( GetProcessHeap(), 0, xargv,
     216                                             sizeof(char*)*(xargc+1));
     217                if (strlen(cmdline+afterlastspace))
     218                {
     219                    xargv[xargc] = CRTDLL__strdup(cmdline+afterlastspace);
     220                    xargc++;
    222221                    if (!last_arg) /* need to seek to the next arg ? */
    223             {
    224             end++;
    225             while (cmdline[end]==' ')
    226                 end++;
    227     }
    228             afterlastspace=end;
    229         }
    230         else
    231         {
    232             xargv[xargc] = NULL; /* the last entry is NULL */
    233             break;
    234         }
    235         }
    236         else
    237         end++;
    238     }
    239     CRTDLL_argc_dll = xargc;
    240     *argc       = xargc;
    241     CRTDLL_argv_dll = xargv;
    242     *argv       = xargv;
    243 
    244     TRACE("found %d arguments\n",
    245         CRTDLL_argc_dll);
    246     CRTDLL_environ_dll = *environ = GetEnvironmentStringsA();
    247     return environ;
     222                    {
     223                        end++;
     224                        while (cmdline[end]==' ')
     225                            end++;
     226        }
     227                    afterlastspace=end;
     228                }
     229                else
     230                {
     231                    xargv[xargc] = NULL; /* the last entry is NULL */
     232                    break;
     233                }
     234            }
     235            else
     236                end++;
     237        }
     238        CRTDLL_argc_dll = xargc;
     239        *argc           = xargc;
     240        CRTDLL_argv_dll = xargv;
     241        *argv           = xargv;
     242
     243        TRACE("found %d arguments\n",
     244                CRTDLL_argc_dll);
     245        CRTDLL_environ_dll = *environ = GetEnvironmentStringsA();
     246        return environ;
    248247}
    249248
     
    254253DWORD CDECL CRTDLL__initterm(_INITTERMFUN *start,_INITTERMFUN *end)
    255254{
    256     _INITTERMFUN    *current;
    257 
    258     TRACE("(%p,%p)\n",start,end);
    259     current=start;
    260     while (current<end) {
    261         if (*current) (*current)();
    262         current++;
    263     }
    264     return 0;
     255        _INITTERMFUN    *current;
     256
     257        TRACE("(%p,%p)\n",start,end);
     258        current=start;
     259        while (current<end) {
     260                if (*current) (*current)();
     261                current++;
     262        }
     263        return 0;
    265264}
    266265
     
    310309INT CDECL CRTDLL_rand()
    311310{
    312     return (rand() & CRTDLL_RAND_MAX);
     311    return (rand() & CRTDLL_RAND_MAX); 
    313312}
    314313
     
    320319{
    321320  // return (_rotl(value, shift));
    322 
     321 
    323322    shift &= 31;
    324323    return (x << shift) | (x >> (32-shift));
     
    332331{
    333332  // return (_lrotl(value, shift));
    334 
     333 
    335334    shift &= 31;
    336335    return (x << shift) | (x >> (32-shift));
     
    344343{
    345344  // return (_lrotr(value, shift));
    346 
     345 
    347346    shift &= 0x1f;
    348347    return (x >> shift) | (x << (32-shift));
     
    356355{
    357356  // return (_rotr(value, shift));
    358 
     357 
    359358    shift &= 0x1f;
    360359    return (x >> shift) | (x << (32-shift));
     
    368367{
    369368  // return (vswprintf(s, t, format, arg));
    370 
     369 
    371370    return wvsprintfW( buffer, spec, args );
    372371}
     
    389388{
    390389  return (setlocale(category, locale));
    391 
     390 
    392391  /*
    393392    LPSTR categorystr;
     
    438437{
    439438  // return (_fullpath(buf, path, size));
    440 
     439 
    441440  if (!buf)
    442441  {
     
    456455{
    457456  // _splitpath( path, drive, dir, fname, ext);
    458 
     457 
    459458  /* drive includes :
    460459     directory includes leading and trailing (forward and backward slashes)
     
    520519{
    521520  // _makepath(path, drive, dir, fname, ext);
    522 
     521 
    523522    char ch;
    524523    TRACE("CRTDLL__makepath got %s %s %s %s\n", drive, directory,
     
    568567{
    569568  // return (_errno());
    570 
     569 
    571570  return &CRTDLL_errno;
    572571}
     
    575574/*********************************************************************
    576575 *                  __doserrno       (CRTDLL.26)
    577  *
     576 * 
    578577 * Return the address of the DOS errno (holding the last OS error).
    579578 * @@@PH Note: veeeery strange ...
     
    584583{
    585584  // return (__doserrno());
    586 
     585 
    587586  return &CRTDLL_doserrno;
    588587}
     
    602601{
    603602  // return (_strerror((char*)s));
    604 
     603 
    605604  static char strerrbuff[256];
    606605  sprintf(strerrbuff,"%s: %s\n",err,CRTDLL_strerror(CRTDLL_errno));
     
    617616{
    618617  // perror( s );
    619 
     618 
    620619  char *err_str = CRTDLL_strerror(CRTDLL_errno);
    621620  CRTDLL_fprintf(CRTDLL_stderr,"%s: %s\n",err,err_str);
    622621  CRTDLL_free(err_str);
    623622}
    624 
     623 
    625624
    626625/*********************************************************************
     
    632631 * The caller does not own the string returned.
    633632 */
    634 extern char *strerror(int errnum);
     633extern char *strerror(int errnum); 
    635634
    636635LPSTR CDECL CRTDLL_strerror (INT err)
     
    646645{
    647646  //return (signal(sig, ptr));
    648 
     647 
    649648  FIXME("(%d %p):stub.\n", sig, ptr);
    650649  return (void*)-1;
     
    668667{
    669668  // return (getenv(name));
    670 
     669 
    671670     LPSTR environ = GetEnvironmentStringsA();
    672671     LPSTR pp,pos = NULL;
     
    675674     for (pp = environ; (*pp); pp = pp + strlen(pp) +1)
    676675       {
    677     pos =strchr(pp,'=');
    678     if (pos)
    679        length = pos -pp;
    680     else
    681        length = strlen(pp);
    682     if (!strncmp(pp,name,length)) break;
     676        pos =strchr(pp,'=');
     677        if (pos)
     678           length = pos -pp;
     679        else
     680           length = strlen(pp);
     681        if (!strncmp(pp,name,length)) break;
    683682       }
    684      if ((pp)&& (pos))
     683     if ((pp)&& (pos)) 
    685684       {
    686     pp = pos+1;
    687     TRACE("got %s\n",pp);
     685        pp = pos+1;
     686        TRACE("got %s\n",pp);
    688687       }
    689688     FreeEnvironmentStringsA( environ );
     
    696695 */
    697696INT CDECL CRTDLL__except_handler2 (
    698     PEXCEPTION_RECORD rec,
    699     PEXCEPTION_FRAME frame,
    700     PCONTEXT context,
    701     PEXCEPTION_FRAME  *dispatcher)
    702 {
    703     FIXME ("exception %lx flags=%lx at %p handler=%p %p %p stub\n",
    704     rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress,
    705     frame->Handler, context, dispatcher);
    706     return ExceptionContinueSearch;
     697        PEXCEPTION_RECORD rec,
     698        PEXCEPTION_FRAME frame,
     699        PCONTEXT context,
     700        PEXCEPTION_FRAME  *dispatcher)
     701{
     702        FIXME ("exception %lx flags=%lx at %p handler=%p %p %p stub\n",
     703        rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress,
     704        frame->Handler, context, dispatcher);
     705        return ExceptionContinueSearch;
    707706}
    708707
     
    725724{
    726725  // return (_toascii(c));
    727 
     726 
    728727  return c & 0x7f;
    729728}
     
    755754{
    756755  // return (_iscsym(c));
    757 
     756 
    758757  return (isalnum(c) || c == '_');
    759758}
     
    774773{
    775774  // return (_iscsymf(c));
    776 
     775 
    777776  return (isalpha(c) || c == '_');
    778777}
     
    847846    {
    848847      if (cf((LPVOID*)match, (LPVOID*)pStart) == 0)
    849     return pStart; /* found */
     848        return pStart; /* found */
    850849      pStart += elem_size;
    851850    } while (--size);
     
    915914{
    916915  // return (_toupper(n));
    917 
     916 
    918917  return toupper(c);
    919918}
     
    926925{
    927926  // return (_tolower(n));
    928 
     927 
    929928  return tolower(c);
    930929}
     
    947946{
    948947  // return (_cabs(c));
    949 
     948 
    950949  return sqrt(c.real * c.real + c.imaginary * c.imaginary);
    951950}
     
    10071006 *
    10081007 * Reset the state of the floating point processor.
    1009  *
     1008 * 
    10101009 * PARAMS
    10111010 *   None.
  • trunk/src/crtdll/dir.c

    r6645 r6712  
    1 /* $Id: dir.c,v 1.5 2001-09-05 12:14:24 bird Exp $ */
    21/*
    32 * CRTDLL drive/directory functions
    4  *
     3 * 
    54 * Copyright 1996,1998 Marcus Meissner
    65 * Copyright 1996 Jukka Iivonen
     
    5857 * RETURNS
    5958 * Sucess:  0
    60  *
     59 * 
    6160 * Failure: -1
    6261 */
     
    6564  dprintf(("CRTDLL: _chdir(%s)\n",
    6665          newdir));
    67 
     66 
    6867  if (!SetCurrentDirectoryA(newdir))
    6968  {
     
    8584 * RETURNS
    8685 * Sucess:  0
    87  *
    88  * Failure: 1
     86 * 
     87 * Failure: 1 
    8988 */
    9089BOOL CDECL CRTDLL__chdrive(INT newdrive)
     
    9291  char buffer[3] = "A:";
    9392  buffer[0] += newdrive - 1;
    94 
     93 
    9594  dprintf(("CRTDLL: _chdrive(%s)\n",
    9695          buffer));
    97 
     96 
    9897  if (!SetCurrentDirectoryA( buffer ))
    9998  {
     
    109108/*********************************************************************
    110109 *                  _findclose     (CRTDLL.098)
    111  *
     110 * 
    112111 * Free the resources from a search handle created from _findfirst.
    113112 *
     
    124123  dprintf(("CRTDLL: _findclose(%08xh)\n",
    125124          hand));
    126 
     125 
    127126  if (!FindClose((HANDLE)hand))
    128127  {
     
    142141 * PARAMS
    143142 *   fspec [in]  File specification string for search, e.g "C:\*.BAT"
    144  *
     143 * 
    145144 *   ft [out]    A pointer to a find_t structure to populate.
    146145 *
     
    156155  WIN32_FIND_DATAA find_data;
    157156  HANDLE hfind;
    158 
     157 
    159158  dprintf(("CRTDLL: _findfirst(%s)\n",
    160159          fspec));
     
    174173/*********************************************************************
    175174 *                  _findnext     (CRTDLL.100)
    176  *
     175 * 
    177176 * Return the next matching file/directory from a search hadle.
    178177 *
    179178 * PARAMS
    180179 *   hand [in] Search handle from a pervious call to _findfirst
    181  *
     180 * 
    182181 *   ft [out]  A pointer to a find_t structure to populate.
    183182 *
     
    191190{
    192191  WIN32_FIND_DATAA find_data;
    193 
     192 
    194193  dprintf(("CRTDLL: _findnext(%08xh)\n",
    195194          hand));
    196 
     195 
    197196  if (!FindNextFileA(hand, &find_data))
    198197  {
     
    225224{
    226225  // return (_getcwd(buf, size));
    227 
     226 
    228227  char dir[_MAX_PATH];
    229228  int dir_len = GetCurrentDirectoryA(_MAX_PATH,dir);
    230 
     229 
    231230  dprintf(("CRTDLL: _getcwd()\n"));
    232 
     231 
    233232  if (dir_len < 1)
    234233    return NULL; /* FIXME: Real return value untested */
     
    259258{
    260259  // return (_getdcwd(drive, buffer, maxlen));
    261 
     260 
    262261  static CHAR* dummy;
    263 
     262 
    264263  dprintf(("CRTDLL: _getdcwd()\n"));
    265 
     264 
    266265  if (!drive || drive == CRTDLL__getdrive())
    267266    return CRTDLL__getcwd(buf,size); /* current */
     
    306305  DWORD ret[4];
    307306  UINT err;
    308 
     307 
    309308  dprintf(("CRTDLL: _getdiskfree(%08xh)\n", disk));
    310 
     309 
    311310  if (disk > 26)
    312311    return ERROR_INVALID_PARAMETER; /* CRTDLL doesn't set errno here */
     
    336335{
    337336  // return DRIVE_GetCurrentDrive() + 1;
    338 
     337 
    339338  char buffer[MAX_PATH];
    340 
     339 
    341340  dprintf(("CRTDLL: _getdrive()\n"));
    342341
    343   if (!GetCurrentDirectoryA( sizeof(buffer), buffer ))
    344     return 0;
    345   if (buffer[1] != ':')
     342  if (!GetCurrentDirectoryA( sizeof(buffer), buffer )) 
     343    return 0;
     344  if (buffer[1] != ':') 
    346345    return 0;
    347346  return toupper(buffer[0]) - 'A' + 1;
     
    358357  dprintf(("CRTDLL: _mkdir(%s)\n",
    359358          newdir));
    360 
     359 
    361360  if (CreateDirectoryA(newdir,NULL))
    362361    return 0;
     
    369368 *                  _rmdir           (CRTDLL.255)
    370369 *
    371  * Delete a directory
     370 * Delete a directory 
    372371 *
    373372 */
     
    376375  dprintf(("CRTDLL: _rmdir(%s)\n",
    377376          dir));
    378 
     377 
    379378  if (RemoveDirectoryA(dir))
    380379    return 0;
  • trunk/src/crtdll/exit.c

    r6645 r6712  
    1 /* $Id: exit.c,v 1.2 2001-09-05 12:14:24 bird Exp $ */
    21/*
    32 * CRTDLL exit/abort/atexit functions
    4  *
     3 * 
    54 * Copyright 1996,1998 Marcus Meissner
    65 * Copyright 1996 Jukka Iivonen
     
    1110 * and whether they return to the caller (really!).
    1211 *            return      do
    13  *  Name      to caller?  cleanup?
     12 *  Name      to caller?  cleanup? 
    1413 *  _c_exit     Y           N
    1514 *  _cexit      Y           Y
     
    5554
    5655/*********************************************************************
    57  *  __dllonexit                     (CRTDLL.25)
     56 *      __dllonexit                             (CRTDLL.25)
    5857 */
    5958VOID CDECL CRTDLL___dllonexit ()
    60 {
     59{       
    6160  dprintf(("__dllonexit not implemented.\n"));
    6261  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     
    6564
    6665/*********************************************************************
    67  *  _abnormal_termination           (CRTDLL.36)
     66 *      _abnormal_termination                   (CRTDLL.36)
    6867 */
    6968int CDECL CRTDLL__abnormal_termination(void)
     
    8483{
    8584  dprintf2(("CRTDLL: _amsg_exit\n"));
    86 
     85 
    8786  // fprintf(stderr,strerror(errnum));
    8887  // ExitProcess(-1);
    89 
     88 
    9089  CRTDLL_fprintf(CRTDLL_stderr,"\nrun-time error:\nError Code %d\n",errnum);
    9190  CRTDLL__exit(255);
     
    9695 *                  _assert     (CRTDLL.041)
    9796 *
    98  * Print an assertion message and call abort(). Really only present
     97 * Print an assertion message and call abort(). Really only present 
    9998 * for win binaries. Winelib programs would typically use libc's
    10099 * version.
     
    103102{
    104103  dprintf2(("CRTDLL: _assert\n"));
    105 
     104 
    106105  CRTDLL_fprintf(CRTDLL_stderr,"Assertion failed: %s, file %s, line %d\n\n",
    107106                 (char*)str,(char*)file, line);
    108107  CRTDLL_abort();
    109 
     108 
    110109  // _assert(str, file, line);
    111110}
     
    120119  dprintf2(("_c_exit(%d)\n",ret));
    121120  FIXME("not calling CRTDLL cleanup\n");
    122 
     121 
    123122  /* dont exit, return to caller */
    124 
     123 
    125124  ExitProcess(ret);
    126125}
     
    136135  FIXME("not calling CRTDLL cleanup\n");
    137136  /* dont exit, return to caller */
    138 
     137 
    139138  ExitProcess(ret);
    140139}
     
    146145VOID CDECL CRTDLL__exit(LONG ret)
    147146{
    148   dprintf2(("CRTDLL: _exit (%08xh)\n",
     147  dprintf2(("CRTDLL: _exit (%08xh)\n", 
    149148            ret));
    150149  TRACE(":exit code %ld\n",ret);
     
    200199{
    201200  dprintf2(("CRTDLL: abort\n"));
    202 
     201 
    203202  CRTDLL_fprintf(CRTDLL_stderr,"\nabnormal program termination\n");
    204203  CRTDLL__exit(3);
     
    208207
    209208/*********************************************************************
    210  *                  atexit  (CRTDLL.342)
     209 *                  atexit      (CRTDLL.342)
    211210 *
    212211 * Register a function to be called when the process terminates.
     
    215214{
    216215  dprintf(("CRTDLL: atexit\n"));
    217 
     216 
    218217  return CRTDLL__onexit(func) == func ? 0 : -1;
    219 
     218 
    220219  // if (_atexit_n >= sizeof (_atexit_v) / sizeof (_atexit_v[0]))
    221220  //   return -1;
  • trunk/src/crtdll/file.c

    r6645 r6712  
    1 /* $Id: file.c,v 1.3 2001-09-05 12:14:24 bird Exp $ */
    21/*
    32 * CRTDLL file functions
    4  *
     3 * 
    54 * Copyright 1996,1998 Marcus Meissner
    65 * Copyright 1996 Jukka Iivonen
     
    98 *
    109 * Implementation Notes:
    11  * Mapping is performed between FILE*, fd and HANDLE's. This allows us to
    12  * implement all calls using the Win32 API, support remapping fd's to
     10 * Mapping is performed between FILE*, fd and HANDLE's. This allows us to 
     11 * implement all calls using the Win32 API, support remapping fd's to 
    1312 * FILES and do some other tricks as well (like closeall, _get_osfhandle).
    1413 * For mix and matching with the host libc, processes can use the Win32 HANDLE
     
    129128  else
    130129    while(__CRTDLL_fdstart < __CRTDLL_fdend &&
    131       __CRTDLL_handles[__CRTDLL_fdstart] != INVALID_HANDLE_VALUE)
     130          __CRTDLL_handles[__CRTDLL_fdstart] != INVALID_HANDLE_VALUE)
    132131      __CRTDLL_fdstart++;
    133132
     
    144143{
    145144  TRACE(":fd (%d) allocating FILE*\n",fd);
    146   if (fd < 0 || fd >= __CRTDLL_fdend ||
     145  if (fd < 0 || fd >= __CRTDLL_fdend || 
    147146      __CRTDLL_handles[fd] == INVALID_HANDLE_VALUE)
    148147  {
     
    179178
    180179  TRACE(":handles (%d)(%d)(%d)\n",__CRTDLL_handles[0],
    181     __CRTDLL_handles[1],__CRTDLL_handles[2]);
     180        __CRTDLL_handles[1],__CRTDLL_handles[2]);
    182181
    183182  for (i = 0; i < 3; i++)
     
    196195{
    197196  // return (_access(path, mode));
    198 
     197 
    199198  DWORD attr = GetFileAttributesA(filename);
    200199
     
    203202    if (!filename)
    204203    {
    205     /* FIXME: Should GetFileAttributesA() return this? */
     204        /* FIXME: Should GetFileAttributesA() return this? */
    206205      __CRTDLL__set_errno(ERROR_INVALID_DATA);
    207206      return -1;
     
    304303{
    305304  // return (__eof(_fd));
    306 
     305 
    307306  DWORD curpos,endpos;
    308307  HANDLE hand = __CRTDLL__fdtoh(fd);
     
    339338{
    340339  // return (_fcloseall());
    341 
     340 
    342341  int num_closed = 0, i = 3;
    343342
     
    362361{
    363362  // return (_fdopen(handle, mode));
    364 
     363 
    365364  CRTDLL_FILE* file = __CRTDLL__alloc_fp(fd);
    366365
     
    379378{
    380379  // return (_fgetchar());
    381 
     380 
    382381  return CRTDLL_fgetc(CRTDLL_stdin);
    383382}
     
    391390 * becomes negative. We ensure that _cnt is always 0 after any read
    392391 * so this function is always called. Our implementation simply calls
    393  * fgetc as all the underlying buffering is handled by Wines
     392 * fgetc as all the underlying buffering is handled by Wines 
    394393 * implementation of the Win32 file I/O calls.
    395394 */
     
    411410{
    412411  // return (_fileno(f));
    413 
     412 
    414413  TRACE(":FILE* (%p) fd (%d)\n",file,file->_file);
    415414  return file->_file;
     
    441440{
    442441  // return (_flushall());
    443 
     442 
    444443  int num_flushed = 0, i = 3;
    445444
     
    448447    {
    449448      if (CRTDLL__commit(i) == -1)
    450     if (__CRTDLL_files[i])
    451       __CRTDLL_files[i]->_flag |= _IOERR;
     449        if (__CRTDLL_files[i])
     450          __CRTDLL_files[i]->_flag |= _IOERR;
    452451      num_flushed++;
    453452    }
     
    466465{
    467466  // return(_fputchar(c));
    468 
     467 
    469468  return CRTDLL_fputc(c, CRTDLL_stdout);
    470469}
     
    485484/*********************************************************************
    486485 *                  _fstat        (CRTDLL.111)
    487  *
     486 * 
    488487 * Get information about an open file.
    489488 */
     
    491490{
    492491  // return (_fstat(file, buf));
    493 
     492 
    494493  DWORD dw;
    495494  BY_HANDLE_FILE_INFORMATION hfi;
     
    549548  {
    550549    /* FIXME: I'm not convinced that I should be copying the
    551      * handle here - it may be leaked if the app doesn't
     550     * handle here - it may be leaked if the app doesn't 
    552551     * close it (and the API docs dont say that it should)
    553552     * Not duplicating it means that it can't be inherited
     
    558557     */
    559558    DuplicateHandle(GetCurrentProcess(),hand,GetCurrentProcess(),
    560             &newhand,0,TRUE,DUPLICATE_SAME_ACCESS );
     559                    &newhand,0,TRUE,DUPLICATE_SAME_ACCESS );
    561560  }
    562561  return newhand;
     
    589588{
    590589  // return (_lseek(handle, offset, origin));
    591 
     590 
    592591  LONG ret;
    593592  HANDLE hand = __CRTDLL__fdtoh(fd);
     
    778777{
    779778  // return (_setmode(fh, mode));
    780 
     779 
    781780  if (mode & _O_TEXT)
    782781    FIXME("fd (%d) mode (%d) TEXT not implemented\n",fd,mode);
     
    791790{
    792791  // return(_stat(s1, n));
    793 
     792 
    794793  DWORD dw;
    795794  WIN32_FILE_ATTRIBUTE_DATA hfi;
     
    827826    {
    828827      unsigned int ext = tolower(path[plen-1]) | (tolower(path[plen-2]) << 8)
    829     | (tolower(path[plen-3]) << 16);
     828        | (tolower(path[plen-3]) << 16);
    830829      if (ext == EXE || ext == BAT || ext == CMD || ext == COM)
    831     mode |= CRTDLL_S_IEXEC;
     830        mode |= CRTDLL_S_IEXEC;
    832831    }
    833832  }
     
    844843  buf->st_mtime = buf->st_ctime = dw;
    845844  TRACE("\n%d %d %d %d %d %d\n", buf->st_mode,buf->st_nlink,buf->st_size,
    846     buf->st_atime,buf->st_mtime, buf->st_ctime);
     845        buf->st_atime,buf->st_mtime, buf->st_ctime);
    847846  return 0;
    848847}
     
    857856{
    858857  // return (_tell(i));
    859 
     858 
    860859  return CRTDLL__lseek(fd, 0, SEEK_CUR);
    861860}
     
    864863/*********************************************************************
    865864 *                  _tempnam           (CRTDLL.305)
    866  *
     865 * 
    867866 */
    868867LPSTR CDECL CRTDLL__tempnam(LPCSTR dir, LPCSTR prefix)
    869868{
    870869  // return (_tempnam(dir, prefix));
    871 
     870 
    872871  char tmpbuf[MAX_PATH];
    873872
     
    891890{
    892891  // return (_umask(i));
    893 
     892 
    894893  INT old_umask = __CRTDLL_umask;
    895894  TRACE("umask (%d)\n",umask);
     
    977976{
    978977  // return (fclose(fp));
    979 
     978 
    980979  return CRTDLL__close(file->_file);
    981980}
     
    990989{
    991990  // return (feof(fp));
    992 
     991 
    993992  return file->_flag & _IOEOF;
    994993}
     
    10031002{
    10041003  // return (ferror(fp));
    1005 
     1004 
    10061005  return file->_flag & _IOERR;
    10071006}
     
    10251024{
    10261025  // return (fgetc(fp));
    1027 
     1026 
    10281027  char c;
    10291028  if (CRTDLL__read(file->_file,&c,1) != 1)
     
    10511050{
    10521051  // return (fgets(s, n, fp));
    1053 
     1052 
    10541053  int    cc;
    10551054  LPSTR  buf_start = s;
    10561055
    10571056  TRACE(":file(%p) fd (%d) str (%p) len (%d)\n",
    1058     file,file->_file,s,size);
     1057        file,file->_file,s,size);
    10591058
    10601059  /* BAD, for the whole WINE process blocks... just done this way to test
     
    10891088{
    10901089  // return (fputs(s, fp));
    1091 
     1090 
    10921091  return CRTDLL_fwrite(s,strlen(s),1,file);
    10931092}
     
    11001099{
    11011100    // return (fprintf(file, format, arg));
    1102 
     1101 
    11031102    va_list valist;
    11041103    INT res;
     
    11191118{
    11201119  // return (fopen( filename, mode));
    1121 
     1120 
    11221121  CRTDLL_FILE* file;
    11231122  INT flags = 0, plus = 0, fd;
     
    11831182{
    11841183  // return (fputc(c, fp));
    1185 
     1184 
    11861185  return CRTDLL__write(file->_file, &c, 1) == 1? c : EOF;
    11871186}
     
    11941193{
    11951194  // return (fread(ptr, size, n, fp));
    1196 
     1195 
    11971196  DWORD read = CRTDLL__read(file->_file,ptr, size * nmemb);
    11981197  if (read <= 0)
     
    12041203/*********************************************************************
    12051204 *                  freopen    (CRTDLL.379)
    1206  *
     1205 * 
    12071206 */
    12081207CRTDLL_FILE* CDECL CRTDLL_freopen(LPCSTR path, LPCSTR mode,CRTDLL_FILE* file)
    12091208{
    12101209  // return (freopen(filename, mode, fp));
    1211 
     1210 
    12121211  CRTDLL_FILE* newfile;
    12131212  INT fd;
     
    12571256{
    12581257  // return (fsetpos(fp, pos));
    1259 
     1258 
    12601259  return CRTDLL__lseek(file->_file,*pos,SEEK_SET);
    12611260}
     
    13931392{
    13941393  // return (fseek(file, offset, whence));
    1395 
     1394 
    13961395  return CRTDLL__lseek(file->_file,offset,whence);
    13971396}
     
    14041403{
    14051404  // return (ftell(fp));
    1406 
     1405 
    14071406  return CRTDLL__tell(file->_file);
    14081407}
     
    14291428{
    14301429  // return (getchar());
    1431 
     1430 
    14321431  return CRTDLL_fgetc(CRTDLL_stdin);
    14331432}
     
    14601459     */
    14611460    for(cc = CRTDLL_fgetc(CRTDLL_stdin); cc != EOF && cc != '\n';
    1462     cc = CRTDLL_fgetc(CRTDLL_stdin))
    1463     if(cc != '\r') *buf++ = (char)cc;
     1461        cc = CRTDLL_fgetc(CRTDLL_stdin))
     1462        if(cc != '\r') *buf++ = (char)cc;
    14641463
    14651464    *buf = '\0';
     
    14981497{
    14991498  // return puts( s );
    1500 
     1499 
    15011500  return CRTDLL_fputs(s, CRTDLL_stdout);
    15021501}
     
    15121511{
    15131512  // rewind(fp);
    1514 
     1513 
    15151514  TRACE(":file (%p) fd (%d)\n",file,file->_file);
    15161515  CRTDLL__lseek(file->_file,0,SEEK_SET);
     
    15251524{
    15261525  // return (remove(file));
    1527 
     1526 
    15281527  TRACE(":path (%s)\n",path);
    15291528  if (DeleteFileA(path))
     
    15411540{
    15421541  // return (rename(old, new2));
    1543 
     1542 
    15441543  TRACE(":from %s to %s\n",oldpath,newpath);
    15451544  if (MoveFileExA( oldpath, newpath, MOVEFILE_REPLACE_EXISTING))
     
    15571556{
    15581557  // setbuf(fp, buf);
    1559 
     1558 
    15601559  TRACE(":file (%p) fd (%d) buf (%p)\n", file, file->_file,buf);
    15611560  if (buf)
     
    15701569 *
    15711570 * lcclnk from lcc-win32 relies on a terminating dot in the name returned
    1572  *
     1571 * 
    15731572 */
    15741573LPSTR CDECL CRTDLL_tmpnam(LPSTR s)
    15751574{
    15761575  // return (tmpnam(s));
    1577 
     1576 
    15781577  char tmpbuf[MAX_PATH];
    15791578  char* prefix = "TMP";
     
    16001599{
    16011600  // return (vfprintf(file, format, args));
    1602 
     1601 
    16031602  /* FIXME: We should parse the format string, calculate the maximum,
    16041603   * length of each arg, malloc a buffer, print to it, and fwrite that.
  • trunk/src/crtdll/initterm.cpp

    r6645 r6712  
    1 /* $Id: initterm.cpp,v 1.7 2001-09-05 12:14:25 bird Exp $ */
    21/*
    32 * DLL entry point
     
    5655   case DLL_THREAD_ATTACH:
    5756   case DLL_THREAD_DETACH:
    58     return CRTDLL_Init(hinstDLL, fdwReason, fImpLoad);
     57        return CRTDLL_Init(hinstDLL, fdwReason, fImpLoad);
    5958
    6059   case DLL_PROCESS_DETACH:
    61     CRTDLL_Init(hinstDLL, fdwReason, fImpLoad);
    62     ctordtorTerm();
    63     return TRUE;
     60        CRTDLL_Init(hinstDLL, fdwReason, fImpLoad);
     61        ctordtorTerm();
     62        return TRUE;
    6463   }
    6564   return FALSE;
     
    9190         CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    9291
    93     dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab);
    94          if(dllHandle == 0)
    95         return 0UL;
     92//      dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab);
     93//         if(dllHandle == 0)
     94//              return 0UL;
    9695
    9796         break;
    9897      case 1 :
    99          if(dllHandle) {
    100         UnregisterLxDll(dllHandle);
    101          }
     98//         if(dllHandle) {
     99//              UnregisterLxDll(dllHandle);
     100//         }
    102101         break;
    103102
  • trunk/src/crtdll/memory.c

    r6645 r6712  
    1 /* $Id: memory.c,v 1.3 2001-09-05 12:14:25 bird Exp $ */
    21/*
    32 * CRTDLL memory functions
    4  *
     3 * 
    54 * Copyright 1996,1998 Marcus Meissner
    65 * Copyright 1996 Jukka Iivonen
     
    3332    VOID* result;
    3433    if(!(result = HeapAlloc(GetProcessHeap(),0,size)) && new_handler)
    35     (*new_handler)();
     34        (*new_handler)();
    3635    return result;
    3736}
     
    8079{
    8180  // return (_heapchk());
    82 
     81 
    8382  if (!HeapValidate( GetProcessHeap(), 0, NULL))
    8483  {
     
    9897{
    9998  // return (_heapmin());
    100 
     99 
    101100  if (!HeapCompact( GetProcessHeap(), 0 ))
    102101  {
     
    117116{
    118117  // return (_heapset(fill));
    119 
     118 
    120119  INT retVal;
    121120  struct _heapinfo heap;
     
    145144  phe.wFlags = next->_useflag == _USEDENTRY ? PROCESS_HEAP_ENTRY_BUSY : 0;
    146145
    147   if (phe.lpData && phe.wFlags & PROCESS_HEAP_ENTRY_BUSY &&
     146  if (phe.lpData && phe.wFlags & PROCESS_HEAP_ENTRY_BUSY && 
    148147      !HeapValidate( GetProcessHeap(), 0, phe.lpData ))
    149148  {
     
    181180{
    182181  // return (_msize(ptr));
    183 
     182 
    184183  LONG size = HeapSize(GetProcessHeap(),0,mem);
    185184  if (size == -1)
     
    216215/*********************************************************************
    217216 *                  malloc        (CRTDLL.424)
    218  *
     217 * 
    219218 * Alocate memory from the heap.
    220219 */
  • trunk/src/crtdll/spawn.c

    r6645 r6712  
    1 /* $Id: spawn.c,v 1.3 2001-09-05 12:14:25 bird Exp $ */
    21/*
    32 * CRTDLL spawn functions
    4  *
     3 * 
    54 * Copyright 1996,1998 Marcus Meissner
    65 * Copyright 1996 Jukka Iivonen
     
    2524 * Implementation Notes:
    2625 * MT Safe - But only because of missing functionality.
    27  *
     26 * 
    2827 * After translating input arguments into the required format for
    2928 * CreateProcess(), the internal function __CRTDLL__spawn() is
     
    8382
    8483  if (!CreateProcessA(exe, args, NULL, NULL, TRUE,
    85               flags == _P_DETACH ? DETACHED_PROCESS : 0,
    86               env, NULL, &si, &pi))
     84                      flags == _P_DETACH ? DETACHED_PROCESS : 0,
     85                      env, NULL, &si, &pi))
    8786  {
    8887    __CRTDLL__set_errno(GetLastError());
     
    158157{
    159158  // return (_spawnve(i, s1, s2, s3));
    160 
     159 
    161160  LPSTR args = __CRTDLL__argvtos(argv,' ');
    162161  LPSTR envs = __CRTDLL__argvtos(envv,0);
     
    187186{
    188187  // return system(string);
    189 
     188 
    190189    /* FIXME: should probably launch cmd interpreter in COMSPEC */
    191190    return __CRTDLL__spawn(_P_WAIT, NULL, x, NULL);
Note: See TracChangeset for help on using the changeset viewer.