Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenwcstod.c
Go to the documentation of this file.
00001 /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ 00002 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ 00003 #include <stdlib.h> 00004 00005 00006 /* 00007 * @implemented 00008 */ 00009 #if 0 //FIXME: Compare with wcstod in wcs.c 00010 double wcstod(const wchar_t *s, wchar_t **sret) 00011 { 00012 long double r; /* result */ 00013 int e; /* exponent */ 00014 long double d; /* scale */ 00015 int sign; /* +- 1.0 */ 00016 int esign; 00017 int i; 00018 int flags=0; 00019 00020 r = 0.0; 00021 sign = 1; 00022 e = 0; 00023 esign = 1; 00024 00025 while ((*s == L' ') || (*s == L'\t')) 00026 s++; 00027 00028 if (*s == L'+') 00029 s++; 00030 else if (*s == L'-') 00031 { 00032 sign = -1; 00033 s++; 00034 } 00035 00036 while ((*s >= L'0') && (*s <= L'9')) 00037 { 00038 flags |= 1; 00039 r *= 10.0; 00040 r += *s - L'0'; 00041 s++; 00042 } 00043 00044 if (*s == L'.') 00045 { 00046 d = 0.1L; 00047 s++; 00048 while ((*s >= L'0') && (*s <= L'9')) 00049 { 00050 flags |= 2; 00051 r += d * (*s - L'0'); 00052 s++; 00053 d *= 0.1L; 00054 } 00055 } 00056 00057 if (flags == 0) 00058 { 00059 if (sret) 00060 *sret = (wchar_t *)s; 00061 return 0; 00062 } 00063 00064 if ((*s == L'e') || (*s == L'E')) 00065 { 00066 s++; 00067 if (*s == L'+') 00068 s++; 00069 else if (*s == L'-') 00070 { 00071 s++; 00072 esign = -1; 00073 } 00074 if ((*s < L'0') || (*s > L'9')) 00075 { 00076 if (sret) 00077 *sret = (wchar_t *)s; 00078 return r; 00079 } 00080 00081 while ((*s >= L'0') && (*s <= L'9')) 00082 { 00083 e *= 10; 00084 e += *s - L'0'; 00085 s++; 00086 } 00087 } 00088 00089 if (esign < 0) 00090 for (i = 1; i <= e; i++) 00091 r *= 0.1L; 00092 else 00093 for (i = 1; i <= e; i++) 00094 r *= 10.0; 00095 00096 if (sret) 00097 *sret = (wchar_t *)s; 00098 return r * sign; 00099 } 00100 #endif Generated on Sat May 26 2012 04:35:36 for ReactOS by
1.7.6.1
|