printf("This system is big-endian.\n");
}
printf("\n");
- if(!dataworks_get_if_supported()){
+ if(!dataworks_get_if_supported()) {
printf("!!! THIS PLATFORM IS UNSUPPORTED! !!!\n\n");
}
printf("%s\n", dataworks_get_copyright());
}
const char* dataworks_get_copyright(void) { return dataworks_copyright; }
-bool dataworks_get_if_supported(void){
+bool dataworks_get_if_supported(void) {
#ifdef SUPPORTED
return true;
#else
bool __dw_strcaseequ(const char* a, const char* b);
bool __dw_lockfile(struct dataworks_db* db);
bool __dw_unlockfile(struct dataworks_db* db);
+double __dw_atof(const char* str);
#define __dw_xstr(x) #x
#define __dw_str(x) __dw_xstr(x)
db->locked = false;
return true;
}
+
+double __dw_atof(const char* str) {
+ double num = 0;
+ bool pr = false;
+ int i;
+ double mul = 10;
+ for(i = 0; str[i] != 0; i++) {
+ if(str[i] >= '0' && str[i] <= '9') {
+ if(!pr) {
+ num *= 10;
+ num += str[i] - '0';
+ } else {
+ num += (str[i] - '0') / mul;
+ mul *= 10;
+ }
+ } else if(str[i] == '.') {
+ pr = true;
+ }
+ }
+ return str[0] == '-' ? -num : num;
+}