print "Content-type: text/html\n\n";
# TODO
-# correct size in tooltip
-# implement a hex/bin/dec converter that is easy to use
-# remove CGI processing routines that are now in xmlOperation.pl
-# still there but commented out
+# --- critical ---
-# substitute selectedConfigFile() with "$configFileName" inside print_registers and print_fieldsi
-# outsource print_registers and print_fields to xmlOperations
# make jtageditor callable with config file name as CGI
# argument, so editor opens specified config file
-
+# be able to accept long hex strings
# what happens when files are not writable?
+
+# --- would be nice, not critical ----
# make sure that error fields are hidden as well!
+# substitute selectedConfigFile() with "$configFileName" inside print_registers and print_fieldsi
+# outsource print_registers and print_fields to xmlOperations
+# implement a hex/bin/dec converter that is easy to use
-# correct size in tooltip
# DONE
+
+
+# remove CGI processing routines that are now in xmlOperation.pl
+# still there but commented out
+
+# correct size in tooltip
# build ancestry without ancestry tree outside
# do not include wrong type, different specfile
# whine, wenn specfile/setfiles not found
print $cgiHash{'debuginput'};
}
-# # obsolete
-# if ( defined $cgiHash{'action'} ) {
-#
-# printHash( \%cgiHash );
-# if ( $cgiHash{'action'} eq 'save' ) {
-# parseConfigFile( $cgiHash{'configFile'} );
-# save( $cgiHash{'register'}, $cgiHash{'field'}, $cgiHash{'value'} );
-# writeConfigFile();
-# }
-# if ( $cgiHash{'action'} eq 'delete' ) {
-# parseConfigFile( $cgiHash{'configFile'} );
-# del( $cgiHash{'register'}, $cgiHash{'field'} );
-# writeConfigFile();
-# }
-# if ( $cgiHash{'action'} eq 'copyDefaultRegister' ) {
-# parseConfigAndSpec( $cgiHash{'configFile'} );
-# del( $cgiHash{'register'}, "" ); # delete existing register from setfile
-# copyDefaultRegister( $cgiHash{'register'} );
-# writeConfigFile();
-# }
-# if ( $cgiHash{'action'} eq 'createFile' ) {
-# createConfigFile( $cgiHash{'configFile'}, $cgiHash{'specFile'} );
-# writeConfigFile();
-# }
-#
-# if ( $cgiHash{'action'} eq 'deleteFile' ) {
-# deleteFile( $cgiHash{'configFile'} );
-# }
-#
-# if ( $cgiHash{'action'} eq 'changeAncestor' ) {
-# parseConfigFile( $cgiHash{'configFile'} );
-# changeAncestor( $cgiHash{'newAncestor'} );
-# writeConfigFile();
-# }
-#
-# }
+
#################### SUBLAND ######################
)
|| "n/a"
);
-
- my $maxFieldVal = 2**$fieldSize-1;
- my $sizeInfo =
+
+ my $sizeInfo;
+ my $maxFieldVal = 2**32-1;
+ if ($fieldSize <=32){ # if Field size smaller than 32 you could be interested
+ # in a decimal value range info
+
+ $maxFieldVal = 2**$fieldSize-1;
+ $sizeInfo =
sprintf(
- "Field contains %d bits, possible values: 0-%d (0x0-0x%x)\n\n",
+ "Field contains %d bits, possible values: 0-%d (0x0-0x%X)\n\n",
$fieldSize, $maxFieldVal, $maxFieldVal );
+ } else {
+
+ $sizeInfo =
+ sprintf(
+ "Field contains %d bits, hex representation would be %d digits long.\n\n",
+ $fieldSize, ceil($fieldSize/4));
+
+ }
$fieldDescr = $sizeInfo . $fieldDescr;
}
}
print "</tr>";
- if ( ( any2dec($fieldValue) < 0 )
- or ( any2dec($fieldValue) > $maxFieldVal ) )
+
+##### check if range was exceeded ######
+ if ($fieldSize <= 32) { # 32 bit is the region where we want to allow decimal input
+
+ my $decFieldValue = any2dec($fieldValue);
+
+ if ( ($decFieldValue < 0 ) or ( $decFieldValue > $maxFieldVal ) )
{
print
"<tr class='fieldError'><td colspan = 4 align='center'>!!!Above value not in allowed range!!!</td></tr>"
; # just debug
}
+
+ } else { # field size exceeds the region where we want to accept decimal input
+
+ if ( numBase($fieldValue) eq "dec" ) {
+ unless( $fieldValue eq "0") { # a zero would be okay
+ print "<tr class='fieldError'><td colspan = 4 align='center'>!!!please don't enter decimal numbers for fields longer than 32 bit!!!</td></tr>";
+ }
+ }
+
+ }
+### end of range check ####
}
+
print "</table>";
}
}
-# already in Common.pm
-
-# sub any2dec { # converts numeric expressions 0x, 0b or decimal to decimal
-#
-# my $argument = $_[0];
-#
-# #print "any2dec input argument $argument\n";
-#
-# if ( $argument =~ m/0[bxBX]/ ) {
-# return oct $argument;
-# }
-# else {
-# return $argument;
-# }
-# }
-
sub printJavaScripts {
####### javascript function land ################