English Language flag
// Log In
// CVSweb
Project: FreeWRT
// Summary // Activity // Search // Tracker // Lists // News // SCM // Wiki

SCM Repository

ViewVC logotype

Diff of /branches/common-nfo/tools/nfotiser/parser.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3460 by tg, Thu Aug 9 14:05:23 2007 UTC revision 3461 by tg, Thu Aug 9 14:53:21 2007 UTC
# Line 82  static void syntaxerr_(size_t, const cha Line 82  static void syntaxerr_(size_t, const cha
82   *   + \1 = keyword (toupper'd)   *   + \1 = keyword (toupper'd)
83   *   + \2 = kw_iter (unsigned integer value)   *   + \2 = kw_iter (unsigned integer value)
84   *   + \3 = kw_multi (case preserving)   *   + \3 = kw_multi (case preserving)
85     * - KWT_MULTITOP => ([A-Za-z_][A-Za-z0-9_]*)_(([0-9]*)_)?([A-Za-z0-9_]*)
86     *   + \1 = keyword (toupper'd)
87     *   + \2 = kw_iter (unsigned integer value), 0 if not set
88     *   + \3 = kw_multi (case preserving)
89   *   *
90   * Cf. https://www.freewrt.org/trac/wiki/Documentation/Specs/Freewrt_info_files   * Cf. https://www.freewrt.org/trac/wiki/Documentation/Specs/Freewrt_info_files
91   * for more examples and a more human-readable version of this specification.   * for more examples and a more human-readable version of this specification.
# Line 186  nfo_parse(int fd, const struct parser_ke Line 190  nfo_parse(int fd, const struct parser_ke
190          D(2, "D: [%4zu] storing string '%s'\n", lineno, t);          D(2, "D: [%4zu] storing string '%s'\n", lineno, t);
191          *tp = '\n';          *tp = '\n';
192          tp = str_add(cp, t);          tp = str_add(cp, t);
         if (cp != NULL)  
                 free(cp);  
193          free(t);          free(t);
194          cp = tp;          cp = tp;
195          ++lineno;          ++lineno;
# Line 226  nfo_parse(int fd, const struct parser_ke Line 228  nfo_parse(int fd, const struct parser_ke
228                  /* okay, we got a prefix match, get args */                  /* okay, we got a prefix match, get args */
229                  np = cp + n + 1;                  np = cp + n + 1;
230                  if (kwp->kwtype == KWT_ITERATED ||                  if (kwp->kwtype == KWT_ITERATED ||
231                        (kwp->kwtype == KWT_MULTITOP &&
232                         (*np >= '0' && *np <= '9')) ||
233                      kwp->kwtype == KWT_MULTITER) {                      kwp->kwtype == KWT_MULTITER) {
234                          char *zp = np;                          char *zp = np;
235    
# Line 245  nfo_parse(int fd, const struct parser_ke Line 249  nfo_parse(int fd, const struct parser_ke
249                          np = zp;                          np = zp;
250                  }                  }
251                  if (kwp->kwtype == KWT_MULTI ||                  if (kwp->kwtype == KWT_MULTI ||
252                        kwp->kwtype == KWT_MULTITOP ||
253                      kwp->kwtype == KWT_MULTITER)                      kwp->kwtype == KWT_MULTITER)
254                          entry_multi = str_save(np);                          entry_multi = str_save(np);
255                  /* values filled out */                  /* values filled out */
# Line 296  parser_dump(struct parser_res *entry, co Line 301  parser_dump(struct parser_res *entry, co
301              kwp->kwtype == KWT_NORMAL ? "normal" :              kwp->kwtype == KWT_NORMAL ? "normal" :
302              kwp->kwtype == KWT_MULTI ? "multi" :              kwp->kwtype == KWT_MULTI ? "multi" :
303              kwp->kwtype == KWT_ITERATED ? "iterated" :              kwp->kwtype == KWT_ITERATED ? "iterated" :
304              kwp->kwtype == KWT_MULTITER ? "multiter" : "unknown");              kwp->kwtype == KWT_MULTITER ? "multiter" :
305                kwp->kwtype == KWT_MULTITOP ? "multitop" : "unknown");
306          if (kwp) {          if (kwp) {
307                  if (kwp->kwtype == KWT_ITERATED ||                  if (kwp->kwtype == KWT_ITERATED ||
308                        kwp->kwtype == KWT_MULTITOP ||
309                      kwp->kwtype == KWT_MULTITER)                      kwp->kwtype == KWT_MULTITER)
310                          printf(", iterator %u", entry->kw_iter);                          printf(", iterator %u", entry->kw_iter);
311                  if (kwp->kwtype == KWT_MULTI ||                  if (kwp->kwtype == KWT_MULTI ||
312                        kwp->kwtype == KWT_MULTITOP ||
313                      kwp->kwtype == KWT_MULTITER)                      kwp->kwtype == KWT_MULTITER)
314                          printf(", multival '%s'", entry->kw_multi);                          printf(", multival '%s'", entry->kw_multi);
315          }          }

Legend:
Removed from v.3460  
changed lines
  Added in v.3461

root@freewrt.org:443
ViewVC Help
Powered by ViewVC 1.1.20