Changeset 2855 for trunk/src


Ignore:
Timestamp:
Feb 22, 2000, 12:11:31 AM (26 years ago)
Author:
sandervl
Message:

PD: Added wtol, wtoi, setsystime, getsystime

Location:
trunk/src/crtdll
Files:
3 edited

Legend:

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

    r2618 r2855  
    1 /* $Id: crt_wc.cpp,v 1.1 2000-02-03 21:37:48 sandervl Exp $ */
     1/* $Id: crt_wc.cpp,v 1.2 2000-02-21 23:11:30 sandervl Exp $ */
    22
    33/*
     
    1212 * Copyright 1997 Uwe Bonnes
    1313 * Copyright 1999-2000 Jens Wiessner
     14 * Copyright 2000 Przemyslaw Dobrowolski
    1415 *
    1516 * CRTDLL - widechar functions
     
    184185
    185186/*********************************************************************
     187 *      _wtoi                                   (CRTDLL.330)
     188 */
     189int CDECL CRTDLL__wtoi( const wchar_t *s )
     190{
     191  // int -32768-32768 = size 6 + null-terminatedstr
     192  char tempstr[7];
     193
     194  WideCharToMultiByte(0, // = CP_ACP
     195                      0,
     196                      (LPCWSTR)s,
     197                      -1,
     198                      tempstr,
     199                      7,
     200                      NULL,
     201                      NULL);
     202
     203  return (atoi(tempstr));
     204}
     205
     206
     207/*********************************************************************
     208 *      _wtol                                   (CRTDLL.331)
     209 */
     210long int CDECL CRTDLL__wtol( const wchar_t *s )
     211{
     212  // long int -2147483647-2147483647 = size 10 + null-terminatedstr
     213  char tempstr[11];
     214  WideCharToMultiByte(0, // = CP_ACP
     215                      0,
     216                      (LPCWSTR)s,
     217                      -1,
     218                      tempstr,
     219                      11,
     220                      NULL,
     221                      NULL);
     222
     223  return (atol(tempstr));
     224
     225  return 0;
     226}
     227
     228
     229/*********************************************************************
    186230 *                  fgetwc      (CRTDLL.366)
    187231 */
  • trunk/src/crtdll/crtdll.cpp

    r2844 r2855  
    1 /* $Id: crtdll.cpp,v 1.23 2000-02-21 10:34:01 sandervl Exp $ */
     1/* $Id: crtdll.cpp,v 1.24 2000-02-21 23:11:30 sandervl Exp $ */
    22
    33/*
     
    1414 * Copyright 1997 Uwe Bonnes
    1515 * Copyright 1999-2000 Jens Wiessner
     16 * Copyright 2000 Przemyslaw Dobrowolski
    1617 */
    1718
     
    11251126
    11261127/*********************************************************************
     1128 *                  _getsystime    (CRTDLL.127)
     1129 */
     1130unsigned int CDECL CRTDLL__getsystime(struct tm *tp)
     1131{
     1132  SYSTEMTIME  systemtime;
     1133
     1134  GetLocalTime(&systemtime);
     1135
     1136  tp->tm_isdst = -1; // FIXME: I don't know is there a correct value
     1137  tp->tm_sec   = systemtime.wSecond;
     1138  tp->tm_min   = systemtime.wMinute;
     1139  tp->tm_hour  = systemtime.wHour;
     1140  tp->tm_mday  = systemtime.wDay;
     1141  tp->tm_mon   = systemtime.wMonth - 1;
     1142  // struct tm has time from 1900  -> 2000 = 100
     1143  tp->tm_year  = systemtime.wYear - 1900;
     1144  tp->tm_wday  = systemtime.wDayOfWeek;
     1145
     1146  mktime(tp);
     1147
     1148  return (0); // FIXME: What Can we return??
     1149}
     1150
     1151
     1152/*********************************************************************
    11271153 *                  _getw     (CRTDLL.128)
    11281154 */
     
    17011727
    17021728/*********************************************************************
     1729 *                  _setsystime    (CRTDLL.264)
     1730 */
     1731unsigned int CDECL CRTDLL__setsystime(struct tm *tp, unsigned int ms)
     1732{
     1733  SYSTEMTIME  systemtime;
     1734
     1735  mktime(tp);
     1736
     1737  systemtime.wMilliseconds = ms;
     1738  systemtime.wSecond       = tp->tm_sec;
     1739  systemtime.wMinute       = tp->tm_min;
     1740  systemtime.wHour         = tp->tm_hour;
     1741  systemtime.wDay          = tp->tm_mday;
     1742  systemtime.wMonth        = tp->tm_mon + 1;
     1743  // struct tm has time from 1900 -> 2000 = 100
     1744  systemtime.wYear         = tp->tm_year + 1900;
     1745
     1746  if (SetLocalTime(&systemtime) != 0) return GetLastError();
     1747
     1748  return (0);
     1749}
     1750
     1751
     1752/*********************************************************************
    17031753 *                  _sleep           (CRTDLL.265)
    17041754 */
  • trunk/src/crtdll/stubs.cpp

    r2844 r2855  
    1 /* $Id: stubs.cpp,v 1.2 2000-02-21 10:34:02 sandervl Exp $ */
     1/* $Id: stubs.cpp,v 1.3 2000-02-21 23:11:31 sandervl Exp $ */
    22
    33/*
     
    267267
    268268/*********************************************************************
    269  *                  _getsystime    (CRTDLL.127)
    270  */
    271 unsigned int CDECL CRTDLL__getsystime(struct tm *tp)
    272 {
    273   dprintf(("CRTDLL: _getsystime not implemented.\n"));
    274   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    275   return 0;
    276 }
    277 
    278 
    279 /*********************************************************************
    280269 *      _heapwalk                               (CRTDLL.133)
    281270 */
     
    10891078  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    10901079  return FALSE;
    1091 }
    1092 
    1093 
    1094 /*********************************************************************
    1095  *                  _setsystime    (CRTDLL.264)
    1096  */
    1097 unsigned int CDECL CRTDLL__setsystime(struct tm *tp, unsigned int ms)
    1098 {
    1099   dprintf(("CRTDLL: _setsystime not implemented.\n"));
    1100   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    1101   return 0;
    11021080}
    11031081
     
    11511129}
    11521130
    1153                        
    1154 /*********************************************************************
    1155  *      _wtoi                                   (CRTDLL.330)
    1156  */
    1157 int CDECL CRTDLL__wtoi( const wchar_t *s )
    1158 {
    1159   dprintf(("CRTDLL: _wtoi(%08xh) not implemented.\n"));
    1160   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    1161   return 0;
    1162 }
    1163 
    1164                                                
    1165 /*********************************************************************
    1166  *      _wtol                                   (CRTDLL.331)
    1167  */
    1168 long int CDECL CRTDLL__wtol( const wchar_t *s )
    1169 {
    1170   dprintf(("CRTDLL: _wtol(%08xh) not implemented.\n"));
    1171   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    1172   return 0;
    1173 }
    1174 
    11751131
    11761132/*********************************************************************
Note: See TracChangeset for help on using the changeset viewer.