}
my $parser = XML::LibXML->new();
-my $specfile = "";
-my $setfile = "";
-my $specfileName = "";
-my $setfileName = "";
-my $spectree;
-my $settree;
-my $setMapsType;
+my $specFile = "";
+my $configFile = "";
+my $specFileName = "";
+my $configFileName = "";
+my $specTree;
+my $configTree;
+my $configMapsType;
my %fileLevelHash;
print "<p>config file does not exist</p>";
exit;
}
- parseSetAndSpec( $cgiHash{'configFile'} );
+ parseConfigAndSpec( $cgiHash{'configFile'} );
print
-"<div class='ancestorInfo' align='center'>specifications loaded from $specfileName</div>";
+"<div class='ancestorInfo' align='center'>specifications loaded from $specFileName</div>";
- print_registers($specfile);
+ print_registers($specFile);
}
if ( $cgiHash{'print'} eq 'settree' ) {
print "<p>config file does not exist</p>";
exit;
}
- parseSetAndSpec( $cgiHash{'configFile'} );
- buildAncestry( $setfileName, "" )
+ parseConfigAndSpec( $cgiHash{'configFile'} );
+ buildAncestry( $configFileName, "" )
; #arg1: target file, # arg2: recursion parent target file
# assignFieldColors();#obsolete
- $settree = $ancestryTree; # not so elegant
+ $configTree = $ancestryTree; # not so elegant
print_ancestorInfo();
- print_registers($setfile);
+ print_registers($configFile);
}
if ( defined $cgiHash{'debuginput'} ) {
printHash( \%cgiHash );
if ( $cgiHash{'action'} eq 'save' ) {
- parseSet( $cgiHash{'configFile'} );
+ parseConfig( $cgiHash{'configFile'} );
save( $cgiHash{'register'}, $cgiHash{'field'}, $cgiHash{'value'} );
}
if ( $cgiHash{'action'} eq 'delete' ) {
- parseSet( $cgiHash{'configFile'} );
+ parseConfig( $cgiHash{'configFile'} );
del( $cgiHash{'register'}, $cgiHash{'field'} );
}
if ( $cgiHash{'action'} eq 'copyDefaultRegister' ) {
- parseSetAndSpec( $cgiHash{'configFile'} );
+ parseConfigAndSpec( $cgiHash{'configFile'} );
del( $cgiHash{'register'}, "" ); # delete existing register from setfile
copyDefaultRegister( $cgiHash{'register'} );
}
}
if ( $cgiHash{'action'} eq 'changeAncestor' ) {
- parseSet( $cgiHash{'configFile'} );
+ parseConfig( $cgiHash{'configFile'} );
changeAncestor( $cgiHash{'newAncestor'} );
}
#print "</td></tr></table>";
print "</td></tr><tr><td>";
- print "$setfileName";
+ print "$configFileName";
print "</td></tr></table>";
print "</div>";
}
return $t;
}
-sub parseSetAndSpec {
- parseSet( $_[0] );
- $specfileName = $settree->findvalue("/MAPS/\@specDbFile");
- $specfile = $specDir . "/" . $specfileName;
- unless ( -e $specfile ) {
+sub parseConfigAndSpec {
+ parseConfig( $_[0] );
+ $specFileName = $configTree->findvalue("/MAPS/\@specDbFile");
+ $specFile = $specDir . "/" . $specFileName;
+ unless ( -e $specFile ) {
print
-"<p>specification file \"$specfileName\" could not be found in the specification directory \"$specDir\"</p>";
+"<p>specification file \"$specFileName\" could not be found in the specification directory \"$specDir\"</p>";
exit;
}
- $spectree = $parser->parse_file($specfile);
+ $specTree = $parser->parse_file($specFile);
}
-sub parseSet {
- $setfileName = $_[0];
- $setfile = $confDir . "/" . $_[0];
- $settree = $parser->parse_file($setfile);
- $setMapsType = $settree->findvalue("/MAPS/\@type");
+sub parseConfig {
+ $configFileName = $_[0];
+ $configFile = $confDir . "/" . $_[0];
+ $configTree = $parser->parse_file($configFile);
+ $configMapsType = $configTree->findvalue("/MAPS/\@type");
}
sub buildAncestry { # recursive
print "<p>";
print $parentXmlFileName. "->"
. join( "->", @ancestryList ) . "->"
- . $setfileName;
+ . $configFileName;
print "</p>";
print "<p>The faulty include directive was removed.</p>";
print
. $xmlfileName
. "</strike>" . "->"
. join( "->", @ancestryList ) . "->"
- . $setfileName;
+ . $configFileName;
print "</p>";
print "<p>The faulty include directive was removed.</p>";
print "<p><input type='button' onclick='loadFile()' value='back'></p>";
}
my $xmltree;
- if ( $xmlfile eq $setfile ) {
- $xmltree = $settree;
+ if ( $xmlfile eq $configFile ) {
+ $xmltree = $configTree;
}
else {
my $currentSpecFileName = $xmltree->findvalue("/MAPS/\@specDbFile");
# compliance checking MAPS type
- unless ( $currentMapsType eq $setMapsType ) {
+ unless ( $currentMapsType eq $configMapsType ) {
print
"<p>the included config file does not comply with the MAPS type of the current config file</p>";
print "<p>The faulty include directive was removed.</p>";
}
# compliance checking specDbFile
- unless ( $currentSpecFileName eq $specfileName ) {
+ unless ( $currentSpecFileName eq $specFileName ) {
print
"<p>the included config file is not based on the same specification file as current config file</p>";
print "<p>The faulty include directive was removed.</p>";
my $registerName = $_[0];
my $fieldName = $_[1];
- my $xmlfile = $setfile;
- my $xmltree = $settree;
+ my $xmlfile = $configFile;
+ my $xmltree = $configTree;
my $maps = $xmltree->findnodes("/MAPS")->shift();
my $register =
$xmltree->findnodes( "/MAPS/register[\@name='" . $registerName . "']" )
sub changeAncestor {
my $ancestorFileName = $_[0];
- my $xmltree = $settree;
- my $xmlfile = $setfile;
+ my $xmltree = $configTree;
+ my $xmlfile = $configFile;
my $maps = $xmltree->findnodes("/MAPS")->shift();
$maps->setAttribute( "inheritSettingsFrom", $ancestorFileName );
}
sub getAncestor {
- my $xmltree = $settree;
+ my $xmltree = $configTree;
return ( $xmltree->findvalue("/MAPS/\@inheritSettingsFrom") || "" );
}
my $registerName = $_[0];
my $fieldName = $_[1];
- my $xmlfile = $setfile;
+ my $xmlfile = $configFile;
my $newValue = $_[2];
- my $xmltree = $settree;
+ my $xmltree = $configTree;
my $maps = $xmltree->findnodes("/MAPS")->shift();
#my @fields = $xmltree->findnodes("/MAPS/register[\@name='".$registerName."']/field[\@name='".$fieldName."']");
sub copyDefaultRegister {
my $registerName = $_[0];
- my $settree = $parser->parse_file($setfile);
- my $spectree = $parser->parse_file($specfile);
- my $setmaps = $settree->findnodes("/MAPS")->shift();
- my $specmaps = $spectree->findnodes("/MAPS")->shift();
+ my $configTree = $parser->parse_file($configFile);
+ my $specTree = $parser->parse_file($specFile);
+ my $configmaps = $configTree->findnodes("/MAPS")->shift();
+ my $specmaps = $specTree->findnodes("/MAPS")->shift();
my $specRegister =
- $spectree->findnodes( "/MAPS/register[\@name='" . $registerName . "']" )
+ $specTree->findnodes( "/MAPS/register[\@name='" . $registerName . "']" )
->shift();
- my $setRegister = $setmaps->addNewChild( "", "register" );
- $setRegister->setAttribute( "name", $registerName );
+ my $configRegister = $configmaps->addNewChild( "", "register" );
+ $configRegister->setAttribute( "name", $registerName );
my @specFields = $specRegister->findnodes("./field");
for my $specField (@specFields) {
my $fieldName = $specField->findvalue("./\@name");
my $fieldValue = $specField->findvalue("./\@defaultValue");
- my $setField = $setRegister->addNewChild( "", "field" );
- $setField->setAttribute( "name", $fieldName );
- $setField->setAttribute( "value", $fieldValue );
- print $setField->findvalue("./\@value");
+ my $configField = $configRegister->addNewChild( "", "field" );
+ $configField->setAttribute( "name", $fieldName );
+ $configField->setAttribute( "value", $fieldValue );
+ print $configField->findvalue("./\@value");
}
- open( SCHREIBEN, "> $setfile" )
- or print "could not open file $setfile for writing: $!\n";
+ open( SCHREIBEN, "> $configFile" )
+ or print "could not open file $configFile for writing: $!\n";
- print SCHREIBEN $settree->toString();
+ print SCHREIBEN $configTree->toString();
close SCHREIBEN;
}
#
# my @ancestryWithChild;
# push(@ancestryWithChild,@ancestryList);
-# push(@ancestryWithChild,$setfileName);
+# push(@ancestryWithChild,$configFileName);
#
# my $index=0;
# for my $fileName (reverse(@ancestryWithChild)){
sub print_registers {
my $xmlfile = $_[0];
my $xmltree;
- if ( $xmlfile eq $setfile ) {
- $xmltree = $settree;
+ if ( $xmlfile eq $configFile ) {
+ $xmltree = $configTree;
}
- elsif ( $xmlfile eq $specfile ) {
- $xmltree = $spectree;
+ elsif ( $xmlfile eq $specFile ) {
+ $xmltree = $specTree;
}
else {
die "xmlfile given to sub print_registers is unknown";
}
my @registers = sort by_name $xmltree->findnodes("/MAPS/register");
print "<table class=\"registers\"";
- if ( $xmlfile eq $setfile ) {
+ if ( $xmlfile eq $configFile ) {
print "id='configFileRegisters'";
}
print ">";
my $registerId = $register->findvalue("./\@id");
my $registerSize = $register->findvalue("./\@size");
my $registerDescr = prepare_text(
- $spectree->findvalue(
+ $specTree->findvalue(
"/MAPS/register[\@name='" . $registerName . "']/description"
)
|| "n/a"
#print "<td>$registerId</td>";
- if ( $xmlfile eq $setfile ) { # we are printing the Specifications Tree
+ if ( $xmlfile eq $configFile ) { # we are printing the Specifications Tree
print <<EOF;
<td class='button_move' onclick='deleteSettings("$registerName","");'> X </td>
EOF
}
- if ( $xmlfile eq $specfile ) { # we are printing the Settings Tree
+ if ( $xmlfile eq $specFile ) { # we are printing the Settings Tree
print <<EOF;
<td class='button_move' onclick='copyDefaultRegister("$registerName");'> → </td>
my $readOnlyFlag = 0;
my $fieldValue = $field->findvalue("./\@value");
my $fieldSize =
- $spectree->findvalue( "/MAPS/register[\@name='"
+ $specTree->findvalue( "/MAPS/register[\@name='"
. $registerName
. "']/field[\@name='"
. $fieldName
. "']/\@size" )
|| "n/a";
my $fieldDescr = prepare_text(
- $spectree->findvalue(
+ $specTree->findvalue(
"/MAPS/register[\@name='"
. $registerName
. "']/field[\@name='"
}
print '</td>';
- if ( $xmlfile eq $specfile ) { # we are printing the Specifications tree
+ if ( $xmlfile eq $specFile ) { # we are printing the Specifications tree
print <<EOF;
<td class='button_move' onclick='saveSettings("$registerName","$fieldName","$fieldValue");'> → </td>
EOF
}
- if ( $xmlfile eq $setfile ) { # we are printing the Settings Tree
+ if ( $xmlfile eq $configFile ) { # we are printing the Settings Tree
if ( $isHeritageFrom eq "" )
{ # these are actual settings, not inherited!