IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 29, 2012, 5:07:20 PM (14 years ago)
Author:
eugene
Message:

merging changes from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120405/ippToPsps/perl/pspsSchema2xml.pl

    r31759 r33948  
    44#
    55# Script that searches a dir containing PSPS schema files, finds those that comtain the
    6 # tables on interest then parses them into an XML format. Also generates C-header files
    7 # containing enums that detail table column names and numbers.
     6# tables on interest then parses them into the VOTable format. Also generates trac-wiki
     7# formatted tables.
    88#
    99#######################################################################################
     
    5151
    5252my $enumsHeader = ucfirst($type)."BatchEnums";
    53 open(OUT, ">".$enumsHeader.".h") or die("Error");
    54 
    55 print OUT "#ifndef ".uc($enumsHeader)."_H\n";
    56 print OUT "#define ".uc($enumsHeader)."_H\n\n";
    57 
    58 # tables file
    59 my $tablesOutput = new IO::File(">tables.xml");
    60 my $tablesWriter = new XML::Writer(OUTPUT => $tablesOutput, DATA_MODE => 1, DATA_INDENT=>2);
    61 $tablesWriter->xmlDecl('UTF-8');
    62 $tablesWriter->startTag('tableDescriptions', "type" => "$type");
    63 
    64 # map file
    65 my $mapOutput = new IO::File(">map.xml");
    66 my $mapWriter = new XML::Writer(OUTPUT => $mapOutput, DATA_MODE => 1, DATA_INDENT=>2);
    67 $mapWriter->xmlDecl('UTF-8');
    68 $mapWriter->startTag('tabledata', "type" => "$type");
    6953
    7054# VOTable file
     
    8266
    8367# finish up XML
    84 $tablesWriter->endTag();
    85 $tablesWriter->end();
    86 
    87 # finish up XML
    88 $mapWriter->endTag();
    89 $mapWriter->end();
    90 
    91 # finish up XML
    9268$votWriter->endTag(); # end RESOURCE tag
    9369$votWriter->endTag(); # end of TABLE tag
    9470$votWriter->end();
    9571
    96 print OUT "\n#endif";
    97 close OUT;
    9872close WIKI;
    9973
     
    208182
    209183    parseTable("Object");
     184    #parseTable("ObjectCalColor");
    210185}
    211186
     
    230205    print WIKI "|| '''!".$tableNameOut."''' ||||||||||||||\n";
    231206    print WIKI "|| '''ODM attribute''' || '''units''' || '''Data type''' || '''Default''' || '''Description''' || '''IPP source''' || '''IPP variable/notes''' ||\n";
    232     print OUT "\ntypedef enum {\n";
    233     $tablesWriter->startTag('table', "name" => $tableNameOut);
    234     $mapWriter->startTag('table',
    235             "name" => $tableNameOut,
    236             "ippfitsextension" => "");
    237207    $votWriter->startTag('TABLE',
    238208            "name" => "$tableNameOut");
     
    287257
    288258    if (!$found) {print "Could not find table '$tableName'\n";}
    289     $tablesWriter->endTag();
    290     $mapWriter->endTag();
    291259
    292260    $votWriter->startTag('DATA');
     
    295263        $votWriter->endTag(); # end DATA tag
    296264        $votWriter->endTag(); # end TABLE tag
    297         print OUT "} ".$tableNameOut.";\n";
    298265
    299266    close SCHEMA;
     
    384351    $colNum++;
    385352
    386     print OUT "  ".uc($tableName)."_".uc($name)." = ".$colNum.",\n";
    387353    print WIKI "|| ".$name."||".$unit."||".$mstype."||".$default."||".$comment."|| || ||\n";
    388 
    389     $tablesWriter->startTag('column',
    390             "name" => $name,
    391             "type" => $type,
    392             "default" => $default,
    393             "comment" => $fullComment);
    394     $tablesWriter->endTag();
    395354
    396355    # get VOTable type
     
    413372    $votWriter->endTag();
    414373
    415     $mapWriter->comment(" **MISSING** <map pspsName=\"$name\" ippType=\"$type\" ippName=\"\" comment=\"$fullComment\"/>");
    416 
    417 #    $mapWriter->endTag();
    418 
    419374    return $colNum;
    420375}
Note: See TracChangeset for help on using the changeset viewer.