Ignore:
Timestamp:
2014-05-08T15:38:11+12:00 (10 years ago)
Author:
ak19
Message:

First of 2 part commit for improving FormatConversion from GS2 to GS3. formatconverter.exe now takes an additional optional parameter which can be documentNode or classifierNode. This then determines what the formatconverter.exe does when it sees an If test on the existence of the numleafdocs variable, since a positive test applies only to classifierNodes, while a negative test applies only to documentNodes. Further, [link][icon][link] should output something slightly different for classifierNodes than for documentNodes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/recpt/formatconverter.cpp

    r28761 r29042  
    4646here" | ./formatconverter --silent
    4747***********************************************************************/
     48void print_usage() {
     49  cout << endl << "Usage: formatconverter [options]" << endl;
     50  cout << "\tOptions: --help, [--silent] [--documentNode|--classifierNode]" << endl << endl;
     51}
    4852
    4953int main(int argc, char **argv) {
     
    5458  text_t resultstring;
    5559
    56  
     60  text_t nodeType = "";
    5761  bool silent = false;
     62
    5863  if(argc > 1) {
    59     silent = (strcmp(argv[1], "--silent") == 0);
     64
     65    if((strcmp(argv[1], "--help") == 0)) {
     66      print_usage();
     67      return 0;
     68    }
     69
     70    else {
     71      for(int i = 1; i < argc; i++) {
     72    if (strcmp(argv[i], "--silent") == 0) { silent = true; }
     73    else if(strcmp(argv[i], "--documentNode") == 0) { nodeType = "document"; }
     74    else if(strcmp(argv[i], "--classifierNode") == 0) { nodeType = "classifier"; }
     75    else {
     76      print_usage();
     77      return 0;
     78    }
     79      }
     80    }
    6081  }
    6182
     
    7596
    7697  parse_formatstring (argstr, formatlistptr, metadata, getParents); 
    77   resultstring = get_GS3_formatstring (formatlistptr);
     98  resultstring = get_GS3_formatstring (formatlistptr, nodeType);
    7899
    79100  delete formatlistptr;
Note: See TracChangeset for help on using the changeset viewer.