|
|
| version 1.3, 2005/02/12 12:40:39 | version 1.4, 2005/03/18 09:23:10 |
|---|---|
| Line 4 | Line 4 |
| #include "mimpidef.h" | #include "mimpidef.h" |
| static const char str_la[] = "LA"; | static const OEMCHAR str_la[] = OEMTEXT("LA"); |
| static const char str_pcm[] = "PCM"; | static const OEMCHAR str_pcm[] = OEMTEXT("PCM"); |
| static const char str_gs[] = "GS"; | static const OEMCHAR str_gs[] = OEMTEXT("GS"); |
| static const char str_rhythm[] = "RHYTHM"; | static const OEMCHAR str_rhythm[] = OEMTEXT("RHYTHM"); |
| static char *cutdelimit(char *buf) { | static OEMCHAR *cutdelimit(const OEMCHAR *buf) { |
| while((buf[0] > 0) && (buf[0] <= ' ')) { | while((buf[0] > 0) && (buf[0] <= ' ')) { |
| buf++; | buf++; |
| } | } |
| return(buf); | return((OEMCHAR *)buf); |
| } | } |
| static BRESULT getvalue(char **buf, int *value) { | static BRESULT getvalue(OEMCHAR **buf, int *value) { |
| char *p; | OEMCHAR *p; |
| int val; | int val; |
| BRESULT ret; | BRESULT ret; |
| char c; | OEMCHAR c; |
| p = cutdelimit(*buf); | p = cutdelimit(*buf); |
| val = 0; | val = 0; |
| ret = FAILURE; | ret = FAILURE; |
| while(1) { | while(1) { |
| c = *p++; | c = *p; |
| c -= '0'; | if ((c < '0') || (c > '9')) { |
| if ((c & 0xff) >= 10) { | |
| break; | break; |
| } | } |
| p++; | |
| val *= 10; | val *= 10; |
| val += c; | val += c - '0'; |
| ret = SUCCESS; | ret = SUCCESS; |
| } | } |
| if (ret == SUCCESS) { | if (ret == SUCCESS) { |
| Line 45 static BRESULT getvalue(char **buf, int | Line 45 static BRESULT getvalue(char **buf, int |
| return(ret); | return(ret); |
| } | } |
| static void analyze(MIMPIDEF *def, char *buf) { | static void analyze(MIMPIDEF *def, OEMCHAR *buf) { |
| int num; | int num; |
| int mod; | int mod; |
| Line 105 BRESULT mimpidef_load(MIMPIDEF *def, con | Line 105 BRESULT mimpidef_load(MIMPIDEF *def, con |
| UINT8 b; | UINT8 b; |
| TEXTFILEH fh; | TEXTFILEH fh; |
| char buf[256]; | OEMCHAR buf[256]; |
| if (def == NULL) { | if (def == NULL) { |
| goto mdld_err; | goto mdld_err; |
| Line 124 BRESULT mimpidef_load(MIMPIDEF *def, con | Line 124 BRESULT mimpidef_load(MIMPIDEF *def, con |
| if (fh == NULL) { | if (fh == NULL) { |
| goto mdld_err; | goto mdld_err; |
| } | } |
| while(textfile_read(fh, buf, sizeof(buf)) == SUCCESS) { | while(textfile_read(fh, buf, NELEMENTS(buf)) == SUCCESS) { |
| analyze(def, buf); | analyze(def, buf); |
| } | } |
| textfile_close(fh); | textfile_close(fh); |