+
+WXDLLEXPORT double wxStrtod(const wxChar *nptr, wxChar **endptr)
+{
+ const wxChar *start = nptr;
+
+ // FIXME: only correct for C locale
+ while (wxIsspace(*nptr)) nptr++;
+ if (*nptr == wxT('+') || *nptr == wxT('-')) nptr++;
+ while (wxIsdigit(*nptr)) nptr++;
+ if (*nptr == wxT('.')) {
+ nptr++;
+ while (wxIsdigit(*nptr)) nptr++;
+ }
+ if (*nptr == wxT('E') || *nptr == wxT('e')) {
+ nptr++;
+ if (*nptr == wxT('+') || *nptr == wxT('-')) nptr++;
+ while (wxIsdigit(*nptr)) nptr++;
+ }
+
+ wxString data(nptr, nptr-start);
+ wxWX2MBbuf dat = data.mb_str(wxConvLibc);
+ char *rdat = wxMBSTRINGCAST dat;
+ double ret = strtod(dat, &rdat);
+
+ if (endptr) *endptr = (wxChar *)(start + (rdat - (const char *)dat));
+
+ return ret;
+}
+
+WXDLLEXPORT long int wxStrtol(const wxChar *nptr, wxChar **endptr, int base)
+{
+ const wxChar *start = nptr;
+
+ // FIXME: only correct for C locale
+ while (wxIsspace(*nptr)) nptr++;
+ if (*nptr == wxT('+') || *nptr == wxT('-')) nptr++;
+ if (((base == 0) || (base == 16)) &&
+ (nptr[0] == wxT('0') && nptr[1] == wxT('x'))) {
+ nptr += 2;
+ base = 16;
+ }
+ else if ((base == 0) && (nptr[0] == wxT('0'))) base = 8;
+ else if (base == 0) base = 10;
+
+ while ((wxIsdigit(*nptr) && (*nptr - wxT('0') < base)) ||
+ (wxIsalpha(*nptr) && (wxToupper(*nptr) - wxT('A') + 10 < base))) nptr++;
+
+ wxString data(nptr, nptr-start);
+ wxWX2MBbuf dat = data.mb_str(wxConvLibc);
+ char *rdat = wxMBSTRINGCAST dat;
+ long int ret = strtol(dat, &rdat, base);
+
+ if (endptr) *endptr = (wxChar *)(start + (rdat - (const char *)dat));
+
+ return ret;
+}