Scid  4.7.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
misc.cpp
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////
2 //
3 // FILE: misc.cpp
4 // Miscellaneous routines (File I/O, etc)
5 //
6 // Part of: Scid (Shane's Chess Information Database)
7 // Version: 3.5
8 //
9 // Notice: Copyright (c) 2001-2003 Shane Hudson. All rights reserved.
10 //
11 // Author: Shane Hudson (sgh@users.sourceforge.net)
12 //
13 //////////////////////////////////////////////////////////////////////
14 
15 #include "common.h"
16 #include "misc.h"
17 #include <stdio.h>
18 #include <ctype.h> // For isspace() function.
19 #include <cmath>
20 
21 //////////////////////////////////////////////////////////////////////
22 // ECO Code Routines
23 
24 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 // eco_FromString():
26 // Extract an ECO code from a string.
27 //
28 // Eco code numbering: no eco = 0, A00 = 1, A01 = 132, etc.
29 // That is, each basic ECO code = previous + 131.
30 // The extra 130 subcodes are the extended code:
31 // a, a1, a2, a3, a4, b, b1, .... z, z1, z2, z3, z4. (130 in total).
32 //
33 // Improvement, March 2000: now case-insensitive for first letter,
34 // for example, a41 == A41.
35 ecoT
36 eco_FromString (const char * ecoStr)
37 {
38  ecoT eco = ECO_None;
39  // Get the basic Eco code from the first 3 characters: they MUST be in
40  // the range "A00" to "E99" or the eco code will be considered empty.
41  // Changed, June 1999: now accepts partial ECO codes, e.g. "C1" -> C10
42 
43  if (*ecoStr >= 'A' && *ecoStr <= 'E') {
44  eco = (*ecoStr - 'A') * 13100;
45  } else if (*ecoStr >= 'a' && *ecoStr <= 'e') {
46  eco = (*ecoStr - 'a') * 13100;
47  } else {
48  return 0;
49  }
50  ecoStr++;
51  if (! *ecoStr) { return eco + 1; }
52 
53  if (*ecoStr < '0' || *ecoStr > '9') { return 0; }
54  eco += (*ecoStr - '0') * 1310;
55  ecoStr++;
56  if (! *ecoStr) { return eco + 1; }
57 
58  if (*ecoStr < '0' || *ecoStr > '9') { return 0; }
59  eco += (*ecoStr - '0') * 131;
60  ecoStr++;
61 
62  // Now check for the optional extended code: a, a1, ... z2, z3, z4.
63  if (*ecoStr >= 'a' && *ecoStr <= 'z') {
64  eco++;
65  eco += (*ecoStr - 'a') * 5;
66  ecoStr++;
67  if (*ecoStr >= '1' && *ecoStr <= '4') {
68  eco += *ecoStr - '0';
69  }
70  }
71  return eco + 1;
72 }
73 
74 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
75 // eco_ToString():
76 // Convert an ECO code to its string representation.
77 void
78 eco_ToString (ecoT ecoCode, char * ecoStr, bool extensions)
79 {
80  char * s = ecoStr;
81  if (ecoCode == ECO_None) { *s = 0; return; }
82  ecoCode--;
83 
84  // First the base code value:
85 
86  ecoT basicCode = ecoCode / 131; // 131 = 26 * 5 + 1 subcodes.
87  *s++ = basicCode / 100 + 'A';
88  *s++ = (basicCode % 100) / 10 + '0';
89  *s++ = (basicCode % 10) + '0';
90 
91  // Now the optional extensions:
92  if (extensions) {
93  ecoCode = ecoCode % 131;
94  if (ecoCode > 0) {
95  ecoCode--;
96  *s++ = (ecoCode / 5) + 'a';
97  ecoCode = ecoCode % 5;
98  if (ecoCode > 0) { *s++ = (ecoCode + '0'); }
99  }
100  *s = 0;
101  }
102  return;
103 }
104 
105 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106 // eco_BasicCode():
107 // Converts an ECO code to its basic form, without any
108 // Scid-specific extensions.
109 ecoT
111 {
112  if (eco == ECO_None) { return ECO_None; }
113 
114  eco--;
115  eco /= 131;
116  eco *= 131;
117  return eco + 1;
118 }
119 
120 /**
121  * ecoReduce() - maps eco to a smaller set
122  * @param eco: the eco value to convert (must be != 0)
123  *
124  * Scid ECO subcodes use 131 values for each canonical ECO.
125  * For example A00 is divided in A00,A00a,A00a1,A00a2,A00a3,A00a4,A00b...A00z4
126  * corresponding to eco values 1,2,3,4,5,6,7...131 (value 0 means no ECO).
127  * This functions will map subECOs like A00a1...A00a4 into A00a, reducing
128  * the 131 values to 27. The previous sequence will became 0,1,1,1,1,1,2...26
129  */
131  ASSERT(eco != 0);
132 
133  eco--;
134  ecoT res = (eco / 131) * 27;
135  return res + static_cast<ecoT>(std::ceil((eco % 131) / 5.0));
136 }
137 
138 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
139 // eco_LastSubCode():
140 // Converts an ECO code to the deepest subcode it could contain.
141 // Examples: B91a -> B91a4 and B91 -> B91z4.
142 ecoT
144 {
145  if (eco == ECO_None) { return ECO_None; }
146 
147  // if just a basic ECO code (1 letter, 2 digits), add the "z":
148  eco--;
149  if ((eco % 131) == 0) { eco += 126; } // 126 = 5 * 25 + 1.
150 
151  // Now if no final digit, add the "4":
152  if (((eco % 131) % 5) == 1) { eco += 4; }
153  return eco + 1;
154 }
155 
156 //////////////////////////////////////////////////////////////////////
157 // String Routines
158 
159 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160 // strCopyExclude(): copies original to target, filtering out any
161 // characters in excludeChars.
162 void
163 strCopyExclude (char * target, const char * original,
164  const char * excludeChars)
165 {
166  while (*original != 0) {
167  int exclude = 0;
168  for (char * s = (char *) excludeChars; *s; s++) {
169  if (*original == *s) {
170  exclude = 1;
171  break;
172  }
173  }
174  if (!exclude) {
175  *target = *original;
176  target++;
177  }
178  original++;
179  }
180  *target = 0;
181 }
182 
183 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
184 // strAppend():
185 // Appends extra to the end of target, and returns a pointer
186 // to the new END of the string target.
187 //
188 char *
189 strAppend (char * target, const char * extra)
190 {
191  ASSERT (target != NULL && extra != NULL);
192  while (*target != 0) { target++; } // get to end of target string
193  while (*extra != 0) {
194  *target = *extra;
195  target++;
196  extra++;
197  }
198  *target = 0;
199  return target;
200 }
201 
202 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
203 // strDuplicate(): Duplicates a string using new[] operator.
204 //
205 char *
206 strDuplicate (const char * original)
207 {
208  ASSERT (original != NULL);
209  char * newStr = new char [strLength(original) + 1];
210  if (newStr == NULL) return NULL;
211  char *s = newStr;
212  while (*original != 0) {
213  *s = *original;
214  s++; original++;
215  }
216  *s = 0; // Add trailing '\0'.
217  //printf ("Dup: %p: %s\n", newStr, newStr);
218  return newStr;
219 }
220 
221 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
222 // strPad():
223 // Copies original string to target, but copies *exactly* 'width'
224 // bytes. If the original is longer than specified width, not all of
225 // original will be copied to target. If original is shorter, then
226 // target will be padded out to 'width' bytes with the padding char.
227 //
228 // If the width is negative, no trimming or padding is done and
229 // the result is just a regular string copy.
230 //
231 // The return value is the length copied: always 'width' if
232 // width is >= 0, or the length of original if 'width' is negative.
233 //
234 uint
235 strPad (char * target, const char * original, int width, char padding)
236 {
237  ASSERT (target != NULL && original != NULL);
238  if (width < 0) {
239  strCopy (target, original);
240  return strLength (original);
241  }
242  int len = width;
243  while (len > 0) {
244  if (*original == 0) {
245  break;
246  }
247  *target = *original;
248  target++;
249  original++;
250  len--;
251  }
252  while (len--) { *target++ = padding; }
253  *target = 0;
254  return width;
255 }
256 
257 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
258 // strFirstChar():
259 // Returns the pointer into the provided string where the
260 // FIRST occurrence of matchChar is, or NULL if the string
261 // does not contain matchChar at all.
262 // Equivalent to strchr().
263 const char *
264 strFirstChar (const char * target, char matchChar)
265 {
266  const char * s = target;
267  while (*s != 0) {
268  if (*s == matchChar) { return s; }
269  s++;
270  }
271  return NULL;
272 }
273 
274 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
275 // strLastChar():
276 // Returns the pointer into the provided string where the
277 // LAST occurrence of matchChar is, or NULL if the string
278 // does not contain matchChar at all.
279 // Equivalent to strrchr().
280 const char *
281 strLastChar (const char * target, char matchChar)
282 {
283  const char * s = target;
284  const char * last = NULL;
285  while (*s != 0) {
286  if (*s == matchChar) { last = s; }
287  s++;
288  }
289  return last;
290 }
291 
292 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
293 // strStrip():
294 // Removes all occurrences of the specified char from the string.
295 void
296 strStrip (char * str, char ch)
297 {
298  char * s = str;
299  while (*str != 0) {
300  if (*str != ch) {
301  if (s != str) { *s = *str; }
302  s++;
303  }
304  str++;
305  }
306  *s = 0;
307 }
308 
309 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
310 // strTrimLeft():
311 // Returns the pointer into the provided string where the first
312 // character that does NOT equal a trimChar occurs.
313 const char *
314 strTrimLeft (const char * target, const char * trimChars)
315 {
316  const char * s = target;
317  while (*s != 0) {
318  if (! strContainsChar (trimChars, *s)) { break; }
319  s++;
320  }
321  return s;
322 }
323 
324 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
325 // strTrimSuffix():
326 // Trims the provided string in-place, at the last
327 // occurrence of the provided suffix character.
328 // Returns the number of characters trimmed.
329 // E.g., strTrimSuffix ("file.txt", '.') would leave the
330 // string as "file" and return 4.
331 uint
332 strTrimSuffix (char * target, char suffixChar)
333 {
334  uint trimCount = 0;
335  char * lastSuffixPtr = NULL;
336  char * s = target;
337  while (*s) {
338  if (*s == suffixChar) {
339  lastSuffixPtr = s;
340  trimCount = 0;
341  }
342  trimCount++;
343  s++;
344  }
345  if (lastSuffixPtr == NULL) { return 0; }
346  *lastSuffixPtr = 0;
347  return trimCount;
348 }
349 
350 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
351 // strTrimDate():
352 // Takes a date string ("xxxx.xx.xx" format) and trims
353 // the day part if it is ".??", and also the month part
354 // if it too is ".??".
355 void
356 strTrimDate (char * str)
357 {
358  if (str[7] == '.' && str[8] == '?' && str[9] == '?') {
359  str[7] = 0;
360  if (str[4] == '.' && str[5] == '?' && str[6] == '?') {
361  str[4] = 0;
362  }
363  }
364 }
365 
366 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~
367 // strTrimMarkCodes():
368 // Trims in-place all Scid-recognised board mark codes
369 // in a comment string, such as "[%mark ...]" and "[%arrow ...]"
370 void
371 strTrimMarkCodes (char * str)
372 {
373  char * in = str;
374  char * out = str;
375  bool inCode = false;
376  char * startLocation = NULL;
377 
378  while (1) {
379  char ch = *in;
380  if (inCode) {
381  // If we see end-of-string or code-starting '[', there is some
382  // error so go back to the start of this code and treat it
383  // normally.
384  if (ch == 0 || ch == '[') {
385  *out++ = *startLocation;
386  inCode = false;
387  in = startLocation;
388  } else if (ch == ']') {
389  // See a code-ending ']', so end the code.
390  inCode = false;
391  }
392  // For all other characters in a code, just ignore it.
393  } else {
394  // Stop at end-of-string:
395  if (ch == 0) { break; }
396  // Look for the start of a code that is to be stripped:
397  if (ch == '[' && in[1] == '%') {
398  inCode = true;
399  startLocation = in;
400  } else {
401  *out++ = ch;
402  }
403  }
404  in++;
405  }
406  // Terminate the modified string:
407  *out = 0;
408 }
409 
410 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
411 // strTrimMarkup():
412 // Trims in-place all HTML-like markup codes (<b>, </i>, etc)
413 // from the provided string.
414 void
415 strTrimMarkup (char * str)
416 {
417  char * in = str;
418  char * out = str;
419  bool inTag = false;
420 
421  while (*in != 0) {
422  char ch = *in;
423  if (inTag) {
424  if (ch == '>') { inTag = false; }
425  } else {
426  if (ch == '<') { inTag = true; } else { *out++ = ch; }
427  }
428  in++;
429  }
430  *out = 0;
431 }
432 
433 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
434 // strFirstWord:
435 // Skips over all whitespace at the start of the
436 // string to reach the first word.
437 const char *
438 strFirstWord (const char * str)
439 {
440  ASSERT (str != NULL);
441  while (*str != 0 && isspace(static_cast<unsigned char>(*str))) { str++; }
442  return str;
443 }
444 
445 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
446 // strNextWord:
447 // Skips over all successive non-whitespace characters
448 // in the string, then all successive whitespace chars,
449 // to reach the next word in the string.
450 const char *
451 strNextWord (const char * str)
452 {
453  ASSERT (str != NULL);
454  while (*str != 0 && !isspace(static_cast<unsigned char>(*str))) { str++; }
455  while (*str != 0 && isspace(static_cast<unsigned char>(*str))) { str++; }
456  return str;
457 }
458 
459 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
460 // strIsUnknownName():
461 // Returns true if the string is an "unknown" name: the empty
462 // string, "?" or "-". Used primarily to test if an event, site
463 // or round name string contains information worth printing.
464 bool
465 strIsUnknownName (const char * str)
466 {
467  if (str[0] == 0) { return true; }
468  if (str[0] == '-' && str[1] == 0) { return true; }
469  if (str[0] == '?' && str[1] == 0) { return true; }
470  return false;
471 }
472 
473 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~
474 // strIsSurnameOnly():
475 // Returns true if the name appears to be a surname only.
476 bool
477 strIsSurnameOnly (const char * name)
478 {
479  uint capcount = 0;
480  const char * s = name;
481  while (*s != 0) {
482  unsigned char c = *s;
483  if (! isalpha(c)) { return false; }
484  if (isupper(c)) {
485  capcount++;
486  if (capcount > 1) { return false; }
487  }
488  s++;
489  }
490  return true;
491 }
492 
493 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
494 // strGetBoolean():
495 // Extracts a boolean value from a string.
496 // True strings start with one of "TtYy1", false strings with
497 // one of "FfNn0".
498 // Returns false if the string does not contain a boolean value.
499 bool
500 strGetBoolean (const char * str)
501 {
502  static const char * sTrue[] = {
503  "true", "yes", "on", "1", "ja", "si", "oui", NULL
504  };
505  static const char * sFalse[] = {
506  "false", "no", "off", "0", NULL
507  };
508  if (str[0] == 0) { return false; }
509 
510  bool matchedTrue = false;
511  bool matchedFalse = false;
512 
513  const char ** next = sTrue;
514  while (*next != NULL) {
515  if (strIsCasePrefix (str, *next) || strIsCasePrefix (*next, str)) {
516  matchedTrue = true;
517  }
518  next++;
519  }
520  next = sFalse;
521  while (*next != NULL) {
522  if (strIsCasePrefix (str, *next) || strIsCasePrefix (*next, str)) {
523  matchedFalse = true;
524  }
525  next++;
526  }
527  if (matchedTrue && !matchedFalse) { return true; }
528  if (matchedFalse && !matchedTrue) { return false; }
529 
530  // default: return false.
531  return false;
532 }
533 
534 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~
535 // strGetIntegers:
536 // Extracts the specified number of signed integers in a
537 // whitespace-separated string to an array.
538 void
539 strGetIntegers (const char * str, int * results, uint nResults)
540 {
541  for (uint i=0; i < nResults; i++) {
542  while (*str != 0 && isspace(static_cast<unsigned char>(*str))) { str++; }
543  results[i] = strGetInteger (str);
544  while (*str != 0 && !isspace(static_cast<unsigned char>(*str))) { str++; }
545  }
546 }
547 
548 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~
549 // strGetUnsigneds:
550 // Extracts the specified number of unsigned integers in a
551 // whitespace-separated string to an array.
552 void
553 strGetUnsigneds (const char * str, uint * results, uint nResults)
554 {
555  for (uint i=0; i < nResults; i++) {
556  while (*str != 0 && isspace(static_cast<unsigned char>(*str))) { str++; }
557  results[i] = strGetUnsigned (str);
558  while (*str != 0 && !isspace(static_cast<unsigned char>(*str))) { str++; }
559  }
560 }
561 
562 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~
563 // strGetResult:
564 // Extracts a game result value from a string.
565 resultT
566 strGetResult (const char * str)
567 {
568  switch (*str) {
569  case '1':
570  // Check for "1/2"-style draw result:
571  if (str[1] == '/' && str[2] == '2') {
572  return RESULT_Draw;
573  }
574  return RESULT_White;
575  case '=': return RESULT_Draw;
576  case '0': return RESULT_Black;
577  case '*': return RESULT_None;
578  }
579  return RESULT_None;
580 }
581 
582 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
583 // strGetFlag():
584 // Extracts a flag (FLAG_YES, FLAG_NO or FLAG_BOTH) value from
585 // a string. Defaults to FLAG_EMPTY.
586 flagT
587 strGetFlag (const char * str)
588 {
589  char c = *str;
590  switch (c) {
591  case 'T': case 't':
592  case 'Y': case 'y':
593  case 'J': case 'j':
594  case 'O': case 'o':
595  case 'S': case 's':
596  case '1':
597  return FLAG_YES;
598  case 'F': case 'f':
599  case 'N': case 'n':
600  case '0':
601  return FLAG_NO;
602  case 'B': case 'b':
603  case '2':
604  return FLAG_BOTH;
605  }
606  // default: return empty.
607  return FLAG_EMPTY;
608 }
609 
610 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~
611 // strGetSquare():
612 // Extracts a square value from a string, such as "a2".
613 squareT
614 strGetSquare (const char * str)
615 {
616  char chFyle = str[0];
617  if (chFyle < 'a' || chFyle > 'h') { return NULL_SQUARE; }
618  char chRank = str[1];
619  if (chRank < '1' || chRank > '8') { return NULL_SQUARE; }
620  return square_Make (fyle_FromChar(chFyle), rank_FromChar(chRank));
621 }
622 
623 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
624 // strUniqueExactMatch():
625 // Given a string <keyStr> and a null-terminated array of strings
626 // <strTable>, returns the index of the unique match of the key
627 // string in the string table. If no match was found, or there was
628 // more than one match, -1 is returned.
629 //
630 // If the flag <exact> is true, only complete matches are considered.
631 // Otherwise, unique abbreviations are accepted.
632 // Example: looking up "repl" in {"repeat", "replace", NULL} would
633 // return 1 (matching "replace") but looking up "rep" would
634 // return -1 because its match is ambiguous.
635 //
636 // The array "strTable" does NOT need to be in any order, but the last
637 // entry must be NULL.
638 int
639 strUniqueExactMatch (const char * keyStr, const char ** strTable, bool exact)
640 {
641  int index = -1;
642  int abbrevMatches = 0;
643  const char * s1;
644  const char * s2;
645  const char ** entryPtr = strTable;
646 
647  // If keyStr or strTable are null, return no match:
648  if (keyStr == NULL || strTable == NULL) { return -1; }
649 
650  // Check each entry in turn:
651  for (int i=0; *entryPtr != NULL; entryPtr++, i++) {
652  // Check the key against this entry, character by character:
653  for (s1 = keyStr, s2 = *entryPtr; *s1 == *s2; s1++, s2++) {
654  // If *s1 is 0, we found an EXACT match, so return it now:
655  if (*s1 == 0) {
656  return i;
657  }
658  }
659  // If *s1 == 0 now, key is an abbreviation of this entry:
660  if (*s1 == 0) {
661  index = i;
662  abbrevMatches++;
663  }
664  }
665 
666  // If we reach here, there is no exact match. If an exact match was
667  // required, or there is not exactly one abbreviation, return no match:
668  if (exact || abbrevMatches != 1) {
669  return -1;
670  }
671  // Otherwise, return the match found:
672  return index;
673 }
674 
675 //////////////////////////////////////////////////////////////////////
676 // EOF: misc.cpp
677 //////////////////////////////////////////////////////////////////////
678 
fyleT fyle_FromChar(char c)
Definition: common.h:373
void eco_ToString(ecoT ecoCode, char *ecoStr, bool extensions)
Definition: misc.cpp:78
byte resultT
Definition: common.h:187
uint strLength(const char *str)
Definition: misc.h:411
const char * strTrimLeft(const char *target, const char *trimChars)
Definition: misc.cpp:314
const char * strFirstChar(const char *target, char matchChar)
Definition: misc.cpp:264
int strUniqueExactMatch(const char *keyStr, const char **strTable, bool exact)
Definition: misc.cpp:639
const squareT NULL_SQUARE
Definition: common.h:357
const ecoT ECO_None
Definition: common.h:168
char * strDuplicate(const char *original)
Definition: misc.cpp:206
ecoT eco_LastSubCode(ecoT eco)
Definition: misc.cpp:143
#define ASSERT(f)
Definition: common.h:59
const resultT RESULT_Black
Definition: common.h:191
names
Definition: tablebase.tcl:257
squareT strGetSquare(const char *str)
Definition: misc.cpp:614
void strTrimMarkCodes(char *str)
Definition: misc.cpp:371
const flagT FLAG_BOTH
Definition: misc.h:237
uint strTrimSuffix(char *target, char suffixChar)
Definition: misc.cpp:332
const resultT RESULT_Draw
Definition: common.h:192
uint flagT
Definition: misc.h:233
squareT square_Make(fyleT f, rankT r)
Definition: common.h:377
const flagT FLAG_NO
Definition: misc.h:236
ecoT eco_Reduce(ecoT eco)
ecoReduce() - maps eco to a smaller set
Definition: misc.cpp:130
uint strPad(char *target, const char *original, int width, char padding)
Definition: misc.cpp:235
bool strIsCasePrefix(const char *prefix, const char *longStr)
Definition: misc.h:347
const resultT RESULT_White
Definition: common.h:190
uint32_t uint
Definition: common.h:91
bool strIsSurnameOnly(const char *name)
Definition: misc.cpp:477
bool strIsUnknownName(const char *str)
Definition: misc.cpp:465
void strGetIntegers(const char *str, int *results, uint nResults)
Definition: misc.cpp:539
rankT rank_FromChar(char c)
Definition: common.h:369
int strGetInteger(const char *str)
Definition: misc.h:185
bool strContainsChar(const char *str, char ch)
Definition: misc.h:263
ushort ecoT
Definition: common.h:165
uint32_t strGetUnsigned(const char *str)
Definition: misc.h:195
const char * strNextWord(const char *str)
Definition: misc.cpp:451
char * strAppend(char *target, const char *extra)
Definition: misc.cpp:189
void strTrimMarkup(char *str)
Definition: misc.cpp:415
const char * strFirstWord(const char *str)
Definition: misc.cpp:438
void strCopyExclude(char *target, const char *original, const char *excludeChars)
Definition: misc.cpp:163
flagT strGetFlag(const char *str)
Definition: misc.cpp:587
void strCopy(char *target, const char *original)
Definition: misc.h:298
const flagT FLAG_EMPTY
Definition: misc.h:234
ecoT eco_FromString(const char *ecoStr)
Definition: misc.cpp:36
const flagT FLAG_YES
Definition: misc.h:235
resultsreportType fmt
Definition: optable.tcl:629
resultT strGetResult(const char *str)
Definition: misc.cpp:566
ecoT eco_BasicCode(ecoT eco)
Definition: misc.cpp:110
bool strGetBoolean(const char *str)
Definition: misc.cpp:500
void strGetUnsigneds(const char *str, uint *results, uint nResults)
Definition: misc.cpp:553
const resultT RESULT_None
Definition: common.h:189
void strStrip(char *str, char ch)
Definition: misc.cpp:296
void strTrimDate(char *str)
Definition: misc.cpp:356
byte squareT
Definition: common.h:105
const char * strLastChar(const char *target, char matchChar)
Definition: misc.cpp:281