Rev 7847 | Rev 8086 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7847 | Rev 8079 | ||
---|---|---|---|
Line 65... | Line 65... | ||
65 | char *strip_trailing_spaces(char *p); /* strip trailing spaces; return string end. */ |
65 | char *strip_trailing_spaces(char *p); /* strip trailing spaces; return string end. */ |
66 | /* Verify whether a list is well-ordered. For debugging uses. |
66 | /* Verify whether a list is well-ordered. For debugging uses. |
67 | * Returns 0 if order is OK, -1 otherwise. |
67 | * Returns 0 if order is OK, -1 otherwise. |
68 | */ |
68 | */ |
69 | int verify_order(void *list, int items, size_t item_size); |
69 | int verify_order(void *list, int items, size_t item_size); |
70 |
|
70 | /* searches a list. Returns index if found, (-1-index of insertion) if nomatch. |
71 | * Uses binary search, list must be sorted. |
71 | * Uses binary search, list must be sorted. |
- | 72 | */ |
|
72 | int search_list(void *list, int items, size_t item_size, const char *str); |
73 | int search_list(void *list, int items, size_t item_size, const char *str); |
73 | unsigned int linenum(char *p); /* Returns number of lines in string p */ |
74 | unsigned int linenum(char *p); /* Returns number of lines in string p */ |
74 | unsigned int itemnum(char *p); /* Returns number of items in the list p, comma separated */ |
75 | unsigned int itemnum(char *p); /* Returns number of items in the list p, comma separated */ |
75 | unsigned int wordnum(char *p); /* Returns number of words in string p */ |
76 | unsigned int wordnum(char *p); /* Returns number of words in string p */ |
76 | unsigned int charnum(char *p); /* This is just to suppress an annoying compiler warning message. */ |
77 | unsigned int charnum(char *p); /* This is just to suppress an annoying compiler warning message. */ |
Line 79... | Line 80... | ||
79 | char *fnd_word(char *p, int n, char bf[]); /* find n-th word in string p */ |
80 | char *fnd_word(char *p, int n, char bf[]); /* find n-th word in string p */ |
80 | char *fnd_char(char *p, int n, char bf[]); /* find n-th char in string p */ |
81 | char *fnd_char(char *p, int n, char bf[]); /* find n-th char in string p */ |
81 | char *fnd_row(char *p, int n, char bf[]); /* find n-th row in a matrix p */ |
82 | char *fnd_row(char *p, int n, char bf[]); /* find n-th row in a matrix p */ |
82 | /* Separate items in the string p, end each item with 0, |
83 | /* Separate items in the string p, end each item with 0, |
83 | * and store item pointers in parm[]. Does not parse past max. |
84 | * and store item pointers in parm[]. Does not parse past max. |
84 | * Returns the number of fields. |
85 | * Returns the number of fields. |
- | 86 | */ |
|
85 | int separate_item(char *p, char *parm[], int max); |
87 | int separate_item(char *p, char *parm[], int max); |
86 | int separate_line(char *p, char *parm[], int max); |
88 | int separate_line(char *p, char *parm[], int max); |
87 | int separate_word(char *p, char *parm[], int max); |
89 | int separate_word(char *p, char *parm[], int max); |
88 | int _separator(char *p,char *parm[], int max, char fs); |
90 | int _separator(char *p,char *parm[], int max, char fs); |
89 | int rows2lines(char *p); /* Returns 1 if semicolons changed to new lines */ |
91 | int rows2lines(char *p); /* Returns 1 if semicolons changed to new lines */ |
Line 208... | Line 210... | ||
208 | short unsigned int xdata[LEVELPOINT_LIM],ydata[LEVELPOINT_LIM]; |
210 | short unsigned int xdata[LEVELPOINT_LIM],ydata[LEVELPOINT_LIM]; |
209 | } leveldata; |
211 | } leveldata; |
210 | int levelcurve(leveldata *ld); /* produces level curve data. Returns non-zero if error. */ |
212 | int levelcurve(leveldata *ld); /* produces level curve data. Returns non-zero if error. */ |
211 | 213 | ||
212 | /* My accelerated definitions. */ |
214 | /* My accelerated definitions. */ |
213 | #define myisdigit(x) (x>='0' && x<='9') |
- | |
214 | #define myisalpha(x) ((x&~32)>='A' && (x&~32)<='Z') |
- | |
215 | #define myisalnum(x) (myisalpha(x) || myisdigit(x)) |
- | |
216 | #define myisupper(x) (x>='A' && x<='Z') |
- | |
217 | #define myislower(x) (x>='a' && x<='z') |
- | |
218 | #define myislspace(x) (x==' ' || x=='\t') |
- | |
219 | #define myisspace(x) (x==' ' || x=='\t' || x=='\n' || x=='\r') |
- | |
220 | - | ||
221 | /* should put parenthesis around x |
- | |
222 |
|
215 | #define myisdigit(x) ((x)>='0' && (x)<='9') |
223 | #define myisalpha(x) (((x)&~32)>='A' && ((x)&~32)<='Z') |
216 | #define myisalpha(x) (((x)&~32)>='A' && ((x)&~32)<='Z') |
224 | #define myisalnum(x) (myisalpha(x) || myisdigit(x)) |
217 | #define myisalnum(x) (myisalpha(x) || myisdigit(x)) |
225 | #define myisupper(x) ((x)>='A' && (x)<='Z') |
218 | #define myisupper(x) ((x)>='A' && (x)<='Z') |
226 | #define myislower(x) ((x)>='a' && (x)<='z') |
219 | #define myislower(x) ((x)>='a' && (x)<='z') |
227 | #define myislspace(x) ((x)==' ' || (x)=='\t') |
220 | #define myislspace(x) ((x)==' ' || (x)=='\t') |
228 | #define myisspace(x) ((x)==' ' || (x)=='\t' || (x)=='\n' || (x)=='\r') |
221 | #define myisspace(x) ((x)==' ' || (x)=='\t' || (x)=='\n' || (x)=='\r') |
229 | */ |
222 | |
230 | /*ou |
223 | /*ou |
231 | inline int myisdigit(char x) { return x>='0' && x<='9'; } |
224 | inline int myisdigit(char x) { return x>='0' && x<='9'; } |
232 | */ |
225 | */ |