- Timestamp:
- May 29, 2012, 5:07:20 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20120405/ippToPsps/perl/pspsSchema2xml.pl
r31759 r33948 4 4 # 5 5 # 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 files7 # 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. 8 8 # 9 9 ####################################################################################### … … 51 51 52 52 my $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 file59 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 file65 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");69 53 70 54 # VOTable file … … 82 66 83 67 # finish up XML 84 $tablesWriter->endTag();85 $tablesWriter->end();86 87 # finish up XML88 $mapWriter->endTag();89 $mapWriter->end();90 91 # finish up XML92 68 $votWriter->endTag(); # end RESOURCE tag 93 69 $votWriter->endTag(); # end of TABLE tag 94 70 $votWriter->end(); 95 71 96 print OUT "\n#endif";97 close OUT;98 72 close WIKI; 99 73 … … 208 182 209 183 parseTable("Object"); 184 #parseTable("ObjectCalColor"); 210 185 } 211 186 … … 230 205 print WIKI "|| '''!".$tableNameOut."''' ||||||||||||||\n"; 231 206 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" => "");237 207 $votWriter->startTag('TABLE', 238 208 "name" => "$tableNameOut"); … … 287 257 288 258 if (!$found) {print "Could not find table '$tableName'\n";} 289 $tablesWriter->endTag();290 $mapWriter->endTag();291 259 292 260 $votWriter->startTag('DATA'); … … 295 263 $votWriter->endTag(); # end DATA tag 296 264 $votWriter->endTag(); # end TABLE tag 297 print OUT "} ".$tableNameOut.";\n";298 265 299 266 close SCHEMA; … … 384 351 $colNum++; 385 352 386 print OUT " ".uc($tableName)."_".uc($name)." = ".$colNum.",\n";387 353 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();395 354 396 355 # get VOTable type … … 413 372 $votWriter->endTag(); 414 373 415 $mapWriter->comment(" **MISSING** <map pspsName=\"$name\" ippType=\"$type\" ippName=\"\" comment=\"$fullComment\"/>");416 417 # $mapWriter->endTag();418 419 374 return $colNum; 420 375 }
Note:
See TracChangeset
for help on using the changeset viewer.
