[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]
[patch] Re: WML wml::std::lang questions
- From: Denis Barbier <nospam@thanx>
- Date: Sat, 13 Mar 1999 16:52:13 +0100 (CET)
Hi Mike and others
i decided to post this patch, because i think it is easier
for you to patch wml_p9_slice rather than recompiling a new wml.
Denis
--- wml_p9_slice Tue Feb 16 14:19:25 1999
+++ wml_p9_slice Sat Mar 13 16:50:35 1999
@@ -109,6 +109,13 @@
exit(1);
}
+sub printwarning {
+ my ($str) = @_;
+
+ $str =~ s|^|** Slice:Warning: |mg;
+ print STDERR $str;
+}
+
##EOF##
package SliceTermParser;
@@ -442,7 +449,9 @@
my ($tmp);
if ($main::CFG->{SLICE}->{SET}->{OBJ}->{"$name"} eq '') {
- &main::error("no such slice '$name'\n");
+ &main::printwarning("no such slice '$name'\n");
+ $main::CFG->{SLICE}->{SET}->{OBJ}->{"$name"} =
+ $main::CFG->{SLICE}->{SET}->{OBJ}->{DEF0}->Clone;
}
$tmp = sprintf("\$T%03d", $tmpcnt++);
return $tmp;
@@ -899,7 +908,7 @@
foreach $entry (@{$CFG->{OPT}->{O}}) {
# determine parameters
- if ($entry =~ m|^([A-Z0-9~!+u*n\-\\^x()@]+):(.+)@(.+)$|) {
+ if ($entry =~ m|^([_A-Z0-9~!+u*n\-\\^x()@]+):(.+)@(.+)$|) {
# full syntax
($slice, $outfile, $chmod) = ($1, $2, $3);
}
@@ -917,16 +926,6 @@
}
&verbose(" file `$outfile': sliceterm='$slice', chmodopts='$chmod'\n");
- # open output file
- if ($outfile eq '-') {
- $out = new IO::Handle;
- $out->fdopen(fileno(STDOUT), 'w');
- }
- else {
- $out = new IO::File;
- $out->open(">$outfile");
- }
-
# now when there is plain data cut out the slices
if (length($CFG->{INPUT}->{PLAIN}) > 0) {
# parse the sliceterm and create corresponding
@@ -948,22 +947,37 @@
# and move result to $set
eval "$cmds; \$set = $var";
- # now scan the set and write out characters
- # which have a corresponding bit set.
- $start = 0;
- while (($start < $set->Size()) &&
- (($min, $max) = $set->Interval_Scan_inc($start))) {
- $out->print(substr($CFG->{INPUT}->{PLAIN}, $min, ($max-$min+1)));
- $start = $max + 2;
- }
- }
+ # test if this slice is non-empty
+ if (! $set->is_empty) {
+
+ # open output file
+ if ($outfile eq '-') {
+ $out = new IO::Handle;
+ $out->fdopen(fileno(STDOUT), 'w');
+ }
+ else {
+ $out = new IO::File;
+ $out->open(">$outfile");
+ }
- # close outputfile
- $out->close;
+ # now scan the set and write out characters
+ # which have a corresponding bit set.
+ $start = 0;
+ while (($start < $set->Size()) &&
+ (($min, $max) = $set->Interval_Scan_inc($start))) {
+ $out->print(substr($CFG->{INPUT}->{PLAIN},
+ $min, ($max-$min+1)));
+ $start = $max + 2;
+ }
+
+ # close outputfile
+ $out->close;
- # additionally run chmod on the output file
- if ($outfile ne '-' and $chmod ne '' and -f $outfile) {
- system("chmod $chmod $outfile");
+ # additionally run chmod on the output file
+ if ($outfile ne '-' and $chmod ne '' and -f $outfile) {
+ system("chmod $chmod $outfile");
+ }
+ }
}
}
}
______________________________________________________________________
Website META Language (WML) www.engelschall.com/sw/wml/
Official Support Mailing List sw-wml@engelschall.com
Automated List Manager majordomo@engelschall.com