diff options
Diffstat (limited to 'perllib/sdf/subs.pl')
-rw-r--r-- | perllib/sdf/subs.pl | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/perllib/sdf/subs.pl b/perllib/sdf/subs.pl index 2d155e6..2b26ece 100644 --- a/perllib/sdf/subs.pl +++ b/perllib/sdf/subs.pl @@ -28,7 +28,7 @@ $VERSION{''.__FILE__} = '$Revision$'; # Make sure we can call the Value function from the main package -sub Value {&SDF_USER'Value;} +sub Value {&SDF_USER::Value;} # Switch to the user package package SDF_USER; @@ -119,7 +119,7 @@ sub FormatTime { $fmt = $var{$fmt} if $var{$fmt} ne ''; $time = $var{$time} if $var{$time} ne ''; - return $time ? &'MiscDateFormat($fmt, $time) : ''; + return $time ? &::MiscDateFormat($fmt, $time) : ''; } # @@ -193,25 +193,25 @@ sub FindFile { my @dirs = ('.'); my $dir = $var{'DOC_DIR'}; push(@dirs, $dir) if $dir ne cwd(); - push(@dirs, @include_path, $'sdf_lib); + push(@dirs, @include_path, $::sdf_lib); # Do the search if ($image) { my $context = $var{'OPT_TARGET'}; - my @exts = @{$'SDF_IMAGE_EXTS{$context} || $'SDF_IMAGE_EXTS{'ps'}}; - &'AppTrace("user", 5, "searching for image '$filename' in directories (" . + my @exts = @{$::SDF_IMAGE_EXTS{$context} || $::SDF_IMAGE_EXTS{'ps'}}; + &::AppTrace("user", 5, "searching for image '$filename' in directories (" . join(",", @dirs) . ") with $context extensions (" . join(",", @exts) . ")"); - $fullname = &'NameFindOrGenerate($filename, \@dirs, \@exts, $context); + $fullname = &::NameFindOrGenerate($filename, \@dirs, \@exts, $context); } else { - &'AppTrace("user", 5, "searching for file '$filename' in directories (" . + &::AppTrace("user", 5, "searching for file '$filename' in directories (" . join(",", @dirs) . ")"); - $fullname = &'NameFind($filename, @dirs); + $fullname = &::NameFind($filename, @dirs); } # Return results - &'AppTrace("user", 2, "file '$filename' -> '$fullname'") if + &::AppTrace("user", 2, "file '$filename' -> '$fullname'") if $fullname ne ''; return $fullname; } @@ -231,15 +231,15 @@ sub FindModule { my @dirs = ('.'); my $dir = $var{'DOC_DIR'}; push(@dirs, $dir) if $dir ne cwd(); - push(@dirs, @module_path, $'sdf_lib, "$'sdf_lib/stdlib"); + push(@dirs, @module_path, $::sdf_lib, "$::sdf_lib/stdlib"); # Do the search - &'AppTrace("user", 4, "searching for module '$filename' in directories (" . + &::AppTrace("user", 4, "searching for module '$filename' in directories (" . join(",", @dirs) . ")"); - $fullname = &'NameFind($filename, @dirs); + $fullname = &::NameFind($filename, @dirs); # Return results - &'AppTrace("user", 2, "module '$filename' -> '$fullname'") if + &::AppTrace("user", 2, "module '$filename' -> '$fullname'") if $fullname ne ''; return $fullname; } @@ -260,14 +260,14 @@ sub FindLibrary { my @dirs = ('.'); my $dir = $var{'DOC_DIR'}; push(@dirs, $dir) if $dir ne cwd(); - push(@dirs, @library_path, $'sdf_lib); + push(@dirs, @library_path, $::sdf_lib); # Do the search - &'AppTrace("user", 3, "searching for library '$lib' in directories (" . + &::AppTrace("user", 3, "searching for library '$lib' in directories (" . join(",", @dirs) . ")"); $fullname = ''; for $dir (@dirs) { - $lib_path = $dir eq $'NAME_DIR_SEP ? "$dir$lib" : "$dir$'NAME_DIR_SEP$lib"; + $lib_path = $dir eq $::NAME_DIR_SEP ? "$dir$lib" : "$dir$::NAME_DIR_SEP$lib"; if (-d $lib_path) { $fullname = $lib_path; last; @@ -275,7 +275,7 @@ sub FindLibrary { } # Return results - &'AppTrace("user", 2, "library '$lib' -> '$fullname'") if + &::AppTrace("user", 2, "library '$lib' -> '$fullname'") if $fullname ne ''; return $fullname; } @@ -300,12 +300,12 @@ sub ExecMacro { local($macro_fn); # Set the context for messages - $'app_context = 'macro on ' unless $'sdf_sections; + $::app_context = 'macro on ' unless $::sdf_sections; # Activate event processing - &ReportEvents('macro') if @'sdf_report_names; + &ReportEvents('macro') if @::sdf_report_names; &ExecEventsNameMask(*evcode_macro, *evmask_macro) if @evcode_macro; - &ReportEvents('macro', 'Post') if @'sdf_report_names; + &ReportEvents('macro', 'Post') if @::sdf_report_names; # Macros implemented in Perl have a subroutine which can be called $macro_fn = $name . "_Macro"; @@ -319,27 +319,27 @@ sub ExecMacro { # increment within the generated output. return () unless @text; return @text if $name =~ /^_/ || $text[0] =~ /^\!_bof/; - return ("!_bos_ $'app_lineno;macro on ", @text, - "!_eos_ $'app_lineno;$'app_context"); + return ("!_bos_ $::app_lineno;macro on ", @text, + "!_eos_ $::app_lineno;$::app_context"); } # For macros implemented in SDF, the macro is stored in %macro elsif (defined($macro{$name})) { # Validate the arguments - &'AppMsg("warning", "ignoring arguments for macro '$name'") if $args ne ''; + &::AppMsg("warning", "ignoring arguments for macro '$name'") if $args ne ''; # Return the data - return ("!_bos_ $'app_lineno;macro on ", split("\n", $macro{$name}), - "!_eos_ $'app_lineno;$'app_context"); + return ("!_bos_ $::app_lineno;macro on ", split("\n", $macro{$name}), + "!_eos_ $::app_lineno;$::app_context"); } # If we reach here, macro is unknown if ($missing eq 'error') { - &'AppMsg("error", "unknown macro '$name'"); + &::AppMsg("error", "unknown macro '$name'"); } elsif ($missing eq 'warning') { - &'AppMsg("warning", "unknown macro '$name'"); + &::AppMsg("warning", "unknown macro '$name'"); } return (); } @@ -361,17 +361,17 @@ sub ExecFilter { return if $name eq ''; # Setup the message parameters, if necessary - $orig_lineno = $'app_lineno; - $orig_filename = $'ARGV; - $orig_context = $'app_context; - $'app_lineno = $lineno if defined $lineno; - $'ARGV = $filename if defined $filename; - $'app_context = $context if defined $context; + $orig_lineno = $::app_lineno; + $orig_filename = $::ARGV; + $orig_context = $::app_context; + $::app_lineno = $lineno if defined $lineno; + $::ARGV = $filename if defined $filename; + $::app_context = $context if defined $context; # Activate event processing - &ReportEvents('filter') if @'sdf_report_names; + &ReportEvents('filter') if @::sdf_report_names; &ExecEventsNameMask(*evcode_filter, *evmask_filter) if @evcode_filter; - &ReportEvents('filter', 'Post') if @'sdf_report_names; + &ReportEvents('filter', 'Post') if @::sdf_report_names; # If necessary, load the plug-in, if any $filter_fn = $name . "_Filter"; @@ -380,10 +380,10 @@ sub ExecFilter { # do nothing } else { - $plug_in = &FindModule(&'NameJoin('', $name, 'sdp')); + $plug_in = &FindModule(&::NameJoin('', $name, 'sdp')); if ($plug_in) { unless (require $plug_in) { - &'AppMsg("warning", "unable to load plug-in '$plug_in'"); + &::AppMsg("warning", "unable to load plug-in '$plug_in'"); } } } @@ -398,13 +398,13 @@ sub ExecFilter { &example_Filter(*text, &SdfFilterParams('example', $params)); } else { - &'AppMsg("error", "unknown filter '$name'"); + &::AppMsg("error", "unknown filter '$name'"); } # Restore the message parameters - $'app_lineno = $orig_lineno; - $'ARGV = $orig_filename; - $'app_context = $orig_context; + $::app_lineno = $orig_lineno; + $::ARGV = $orig_filename; + $::app_context = $orig_context; } # @@ -427,7 +427,7 @@ sub SdfMacroArgs { else { # Compile the arguments $index = $#_sdf_macro_args_data + 1; - ($format, @rules) = &'TableParse(eval "\@_${macro}_MacroArgs"); + ($format, @rules) = &::TableParse(eval "\@_${macro}_MacroArgs"); push(@_sdf_macro_args_data, @rules); $last = $#_sdf_macro_args_data; $_sdf_macro_args_info{$macro} = join(':', $index, $last); @@ -440,7 +440,7 @@ sub SdfMacroArgs { # If there is nothing left, use the default, if any if ($args eq '') { - &'AppMsg("error", "argument '$name' missing for macro '$macro'") + &::AppMsg("error", "argument '$name' missing for macro '$macro'") if $default eq ''; $value = $default eq '_NULL_' ? '' : $default; } @@ -450,8 +450,8 @@ sub SdfMacroArgs { ($value, $args) = &_SdfMacroNextArg($args, $type); # Validate the rule, if any - &'AppMsg("warning", "bad value '$value' for argument '$name' for macro '$macro'") - if ($value ne '' && !&'MiscCheckRule($value, $rule, $type)); + &::AppMsg("warning", "bad value '$value' for argument '$name' for macro '$macro'") + if ($value ne '' && !&::MiscCheckRule($value, $rule, $type)); } # Save the value @@ -484,7 +484,7 @@ sub _SdfMacroNextArg { # If we reach here, we need to evaluate the argument ($arg, $rest) = split(/\s*\;/, $args, 2); - $arg = &'_SdfEvaluate($arg, $type eq 'condition' ? '' : 'warning'); + $arg = &::_SdfEvaluate($arg, $type eq 'condition' ? '' : 'warning'); return ($arg, $rest); } @@ -504,7 +504,7 @@ sub SdfFilterParams { local($unknown, %unknown); # Get the parameters - %param = &'SdfAttrSplit($params); + %param = &::SdfAttrSplit($params); # Get the parameter table @param_table = eval "\@_${filter}_FilterParams"; @@ -520,7 +520,7 @@ sub SdfFilterParams { else { # Compile the parameters $index = $#_sdf_filter_params_data + 1; - ($format, @rules) = &'TableParse(@param_table); + ($format, @rules) = &::TableParse(@param_table); push(@_sdf_filter_params_data, @rules); $last = $#_sdf_filter_params_data; $_sdf_filter_params_info{$filter} = join(':', $index, $last); @@ -536,15 +536,15 @@ sub SdfFilterParams { delete $unknown{$name}; # Validate the rule, if any - if ($value ne '' && !&'MiscCheckRule($value, $rule, $type)) { - &'AppMsg("warning", "bad value '$value' for '$name' for filter '$filter'"); + if ($value ne '' && !&::MiscCheckRule($value, $rule, $type)) { + &::AppMsg("warning", "bad value '$value' for '$name' for filter '$filter'"); } } # Check for unknown parameters $unknown = join(',', sort keys %unknown); if ($unknown ne '') { - &'AppMsg("warning", "unknown parameter(s) '$unknown' for filter '$filter'"); + &::AppMsg("warning", "unknown parameter(s) '$unknown' for filter '$filter'"); } # Return result @@ -563,10 +563,10 @@ sub SdfTableParams { local($name, $value, $type, $rule); # Get the parameters - %param = &'SdfAttrSplit($params); + %param = &::SdfAttrSplit($params); # Remove parameters which only apply to other targets - &'SdfAttrClean(*param); + &::SdfAttrClean(*param); # Check the parameters are legal for $name (sort keys %param) { @@ -577,14 +577,14 @@ sub SdfTableParams { # Check the parameter is known unless ($names{$name}) { - &'AppMsg("warning", "unknown $macro parameter '$name'"); + &::AppMsg("warning", "unknown $macro parameter '$name'"); delete $param{$name}; next; } # Validate the rule, if any - if ($value ne '' && !&'MiscCheckRule($value, $rule, $type)) { - &'AppMsg("warning", "bad value '$value' for $macro parameter '$name'"); + if ($value ne '' && !&::MiscCheckRule($value, $rule, $type)) { + &::AppMsg("warning", "bad value '$value' for $macro parameter '$name'"); } } @@ -602,7 +602,7 @@ sub ReportEvents { local($rpt); local($fn); - for $rpt (@'sdf_report_names) { + for $rpt (@::sdf_report_names) { $fn = "${rpt}_ReportEvent${post}"; &$fn($tag) if defined &$fn; } @@ -633,7 +633,7 @@ sub ExecEventsStyleMask { # execute the action eval $action; - &'AppMsg("warning", "execution of '$action' failed: $@") if $@; + &::AppMsg("warning", "execution of '$action' failed: $@") if $@; } } @@ -661,7 +661,7 @@ sub ExecEventsNameMask { # execute the action eval $action; - &'AppMsg("warning", "execution of '$action' failed: $@") if $@; + &::AppMsg("warning", "execution of '$action' failed: $@") if $@; } } # @@ -703,13 +703,13 @@ sub CommandMacro { $filename = $arg{'filename'}; $fullname = &FindFile($filename); if ($fullname eq '') { - &'AppMsg("warning", "unable to find '$filename'"); + &::AppMsg("warning", "unable to find '$filename'"); return (); } # Execute the command unless (&FileFetch(*text, "$cmd $fullname|")) { - &'AppMsg("warning", "unable to execute command '$cmd' on '$fullname'"); + &::AppMsg("warning", "unable to execute command '$cmd' on '$fullname'"); return (); } @@ -734,7 +734,7 @@ sub CommandFilter { # When the above assumption is no good, we need to do something like .. #unless (open(TMPFILE, ">$tmp_file")) { - # &'AppMsg("warning", "unable to open tmp file '$tmp_file' in filter '$filter'"); + # &::AppMsg("warning", "unable to open tmp file '$tmp_file' in filter '$filter'"); #} #for my $line (@text) { # print TMPFILE "$line\n"; @@ -743,7 +743,7 @@ sub CommandFilter { # Execute the command @text = (); unless (&FileFetch(*text, "$cmd < $tmp_file |")) { - &'AppMsg("warning", "unable to execute command '$cmd' in filter '$filter'"); + &::AppMsg("warning", "unable to execute command '$cmd' in filter '$filter'"); } } @@ -800,7 +800,7 @@ sub CheckParaObject { # Convert the paragraph to an object $obj = $attr{'obj'}; delete $attr{'obj'}; - $text = '{{' . &'SdfJoin($obj, $text) . '}}'; + $text = '{{' . &::SdfJoin($obj, $text) . '}}'; } # @@ -833,11 +833,11 @@ sub BuildSectJump { if ($doc ne '') { delete $attr{'doc'}; unless ($obj_long{'references',$doc}) { - &'AppMsg('warning', "unknown document '$doc'"); + &::AppMsg('warning', "unknown document '$doc'"); } else { #if ($var{'HTML_TOPICS_MODE'} || $var{'HTML_SUBTOPICS_MODE'}) { - # &'AppMsg('warning', "cross-document section jumps not yet supported in topics mode"); + # &::AppMsg('warning', "cross-document section jumps not yet supported in topics mode"); #} $attr{'jump'} = $obj_long{'references',$doc,'Jump'} . "#$id"; } @@ -921,13 +921,13 @@ sub Value { $result .= $param{"suffix_$attr"}; } else { - &'AppMsg("warning", "load of view '$view' failed: $@"); + &::AppMsg("warning", "load of view '$view' failed: $@"); } } # Check the attribute is known and return unless ($known) { - &'AppMsg("warning", "undefined attribute '$attr' for object '$name' in class '$class'"); + &::AppMsg("warning", "undefined attribute '$attr' for object '$name' in class '$class'"); return ''; } #print STDERR "attr: $attr, view: $view, result: $result.\n" if $view; @@ -961,7 +961,7 @@ sub LoadView { if (open(CONV_SET, $name)) { my $nv_text = join("\n", <CONV_SET>); close(CONV_SET); - %params = &main'AppSectionValues($nv_text); + %params = &main::AppSectionValues($nv_text); #print STDERR "nv_text: $nv_text<\n"; #for $igc (sort keys %params) { #print STDERR "$igc: $params{$igc}.\n"; @@ -1121,13 +1121,13 @@ sub ProcessImageAttrs { # Check the figure exists if ($fullname eq '') { - &'AppMsg("warning", "unable to find image '$filename'"); + &::AppMsg("warning", "unable to find image '$filename'"); $fullname = $filename; } $attr{'fullname'} = $fullname; # Update the filename - $filename = (&'NameSplit($fullname))[3]; + $filename = (&::NameSplit($fullname))[3]; # Prepend the base location, if necessary $base = $attr{'base'}; |