IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11232


Ignore:
Timestamp:
Jan 22, 2007, 2:54:39 PM (19 years ago)
Author:
eugene
Message:

added -setword

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/pantasks/ipptool2book.c

    r11084 r11232  
    22
    33# define FREEKEYS \
    4   if (keys) { for (i = 0; i < Nkeys; i++) { free (keys[i]); } free (keys); }
     4  if (keys) { for (i = 0; i < Nkeys; i++) { free (keys[i]); } free (keys); } \
     5  for (i = 0; i < setWordN; i++) { free (setWordList[i]); free (setWordValue[i]); } \
     6  free (setWordValue); free (setWordList);
    57
    68// convert the named queue with ipptool metadata output into book format
     
    1012  char *line, *tmpword, *tmpvalue;
    1113  char pagename[512], *bookName, **keys, *p, *q;
     14  char **setWordList;
     15  char **setWordValue;
     16  int setWordN, setWordNalloc;
    1217  Page *page;
    1318  Book *book;
    1419  Queue *queue;
     20
     21  /* supply additional constant words */
     22  setWordN = 0;
     23  setWordNalloc = 10;
     24  ALLOCATE (setWordList, char *, setWordNalloc);
     25  ALLOCATE (setWordValue, char *, setWordNalloc);
     26  while ((N = get_argument (argc, argv, "-setword"))) {
     27    remove_argument (N, &argc, argv);
     28    setWordList[setWordN] = strcreate (argv[N]);
     29    remove_argument (N, &argc, argv);
     30    setWordValue[setWordN] = strcreate (argv[N]);
     31    remove_argument (N, &argc, argv);
     32    setWordN ++;
     33    if (setWordN >= setWordNalloc) {
     34      setWordNalloc += 10;
     35      REALLOCATE (setWordList, char *, setWordNalloc);
     36      REALLOCATE (setWordValue, char *, setWordNalloc);
     37    }     
     38  }
    1539
    1640  Unique = FALSE;
     
    172196      }
    173197
     198      // add the fixed words to the page
     199      for (i = 0; i < setWordN; i++) {
     200        BookSetWord (page, setWordList[i], setWordValue[i]);
     201      }
     202
    174203      onPage = FALSE;
    175204      continue;
Note: See TracChangeset for help on using the changeset viewer.