[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: It's time...



On Sat, 8 May 1999, Ralf S. Engelschall wrote:

> On Sat, May 08, 1999, Denis Barbier wrote:
> 
> > On Fri, 7 May 1999, Stefan `Sec` Zehl wrote:
> > 
> > > What about the slices inside slices problem I posted about ?
> > 
> > i see no solution to this problem, sorry.
> > Does anyone want to patch slice.src?
> 
> Please do not change this particular slice.src, it was generated out of the
> original sources. I've placed the "assembled" slice program in the WML source
> tree instead of the full sources, because the original intention was that
> Slice is always maintained externally as a stand-alone package.

Hi Ralf, i'll do what you suggest.

The problem Stefan report is that
   [A:[A:x:]:]
causes an error (not caused by missing ending slice name).

I have found a workaround, but it will not solve Stefan's problem.
Indeed, Stefan tries to write something like
   [LANG_EN:en [LANG_EN:en [LANG_DE:de:]:]:]

-o ALL-LANG_*+LANG_EN gives
   en en de
-o ALL-LANG_*+LANG_DE gives
   de

So Stefan, you can't nest language slices.

Denis
PS: Below is a proposed patch
--- slice.src	1999/03/16 18:26:36	1.6
+++ slice.src	1999/05/09 08:24:52
@@ -712,15 +712,15 @@
             $L = &alloclevel();                 # allocate next free level
 
             push(@CURRENT_SLICE_NAMES, $name1); # remember name  for end delimiter
-            $CURRENT_LEVEL_BRAIN{"$name1"} = $L;# remember level for end delimiter
+            $CURRENT_LEVEL_BRAIN{"$name1"} .=  ":$L";# remember level for end delimiter
             if ($CFG->{SLICE}->{MINLEVELS}->{"$name1"} eq '' or 
                 $CFG->{SLICE}->{MINLEVELS}->{"$name1"} > $L) {
                 $CFG->{SLICE}->{MINLEVELS}->{"$name1"} = $L;
             }
 
             #  now begin entry with LEVEL:START
-            $CFG->{SLICE}->{SET}->{ASC}->{"$name1"} .= 
-                 ($CFG->{SLICE}->{SET}->{ASC}->{"$name1"} ? ',' : '') . "$L:$pos"; 
+            $CFG->{SLICE}->{SET}->{ASC}->{"$name1:$L"} .= 
+                 ($CFG->{SLICE}->{SET}->{ASC}->{"$name1:$L"} ? ',' : '') . "$L:$pos"; 
 
             #  adjust notice about highest level
             $CFG->{SLICE}->{MAXLEVEL} = ($CFG->{SLICE}->{MAXLEVEL} < $L ? 
@@ -740,14 +740,15 @@
 
             $namex = pop(@CURRENT_SLICE_NAMES);      # take remembered name
             $name2 = $namex if ($name2 eq '');       # fill name because of shortcut syntax
-            $L     = $CURRENT_LEVEL_BRAIN{"$name2"}; # take remembered level
+            $CURRENT_LEVEL_BRAIN{"$name2"} =~ s|:(\d+)$||; # take remembered level
+            $L = $1;
 
             &clearlevel($L);                         # de-allocate level
 
             # now end entry with :END
-            $CFG->{SLICE}->{SET}->{ASC}->{"$name2"} .= ":$pos";
+            $CFG->{SLICE}->{SET}->{ASC}->{"$name2:$L"} .= ":$pos";
 
-            &verbose("    slice `$name2': end at $pos\n");
+            &verbose("    slice `$name2': end at $pos, level $L\n");
 
             $pos++;
             $open--;
@@ -825,6 +826,15 @@
     $n = length($CFG->{INPUT}->{PLAIN})+1;
     $set  = new Bit::Vector($n); # working set
     $setA = new Bit::Vector($n); # "all" set
+
+    #   restore slice names
+    foreach $slice (keys(%{$CFG->{SLICE}->{SET}->{ASC}})) {
+        $asc = $CFG->{SLICE}->{SET}->{ASC}->{$slice};
+        delete $CFG->{SLICE}->{SET}->{ASC}->{$slice};
+        $slice =~ s|:\d+$||g;
+        $CFG->{SLICE}->{SET}->{ASC}->{$slice} .=
+                 ($CFG->{SLICE}->{SET}->{ASC}->{"$slice"} ? ',' : '') . $asc;
+    }
 
     #   convert ASCII representation to real internal set objects
     foreach $slice (keys(%{$CFG->{SLICE}->{SET}->{ASC}})) {

______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com