OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Michael van Elst
  Root:   /e/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-re                       Date:   13-Nov-2002 16:32:29
  Branch: HEAD                             Handle: 2002111315322900

  Modified files:
    openpkg-re              openpkg-index

  Log:
    support %else

  Summary:
    Revision    Changes     Path
    1.7         +20 -5      openpkg-re/openpkg-index
  ____________________________________________________________________________

  Index: openpkg-re/openpkg-index
  ============================================================
  $ cvs diff -u -r1.6 -r1.7 openpkg-index
  --- openpkg-re/openpkg-index  13 Nov 2002 09:24:29 -0000      1.6
  +++ openpkg-re/openpkg-index  13 Nov 2002 15:32:29 -0000      1.7
  @@ -186,14 +186,26 @@
               #
               if ($term ne '') {
                   push @term, "( $term )";
  -                $cond = join(' && ', @term).'';
  +                $cond = join(' && ', grep { $_ ne '' } @term).'';
  +            } else {
  +                push @term, '';
  +            }
  +        } elsif ($v =~ /^\#else\s*$/) {
  +            #
  +            # reverse last condition
  +            #
  +            if (@term) {
  +                $term[-1] = ' ! '.$term[-1];
  +                $cond = join(' && ', grep { $_ ne '' } @term).'';
  +            } else {
  +                die "FATAL: else without if\n";
               }
           } elsif ($v =~ /^\#endif\s*$/) {
               #
               # unwind last #if expression
               #
               pop @term;
  -            $cond = join(' + ', @term).'';
  +            $cond = join(' && ', grep { $_ ne '' } @term).'';
   
           } elsif ($v =~ /^\#(?:define)\s*(\S+)\s*(.*?)\s*$/) {
   
  @@ -246,7 +258,7 @@
       $s =~ s/^\s*#.*?\n//mg;
   
       # map commands
  -    $s =~ s/^%(ifdef|ifndef|if|define|endif|\{)/#$1/mg;
  +    $s =~ s/^%(ifdef|ifndef|if|define|else|endif|\{)/#$1/mg;
   
       # split sections
       foreach (split(/^(?=%\w+\s*\n)/m, $s)) {
  @@ -456,8 +468,11 @@
       $specpath = "$prefix/$d/$d.spec";
       if (-f $specpath) {
           $s = `cat $specpath`;
  -        $a = spec2data($s)
  -        and xml_record(\*STDOUT, $a);
  +        if ($a = spec2data($s)) {
  +            xml_record(\*STDOUT, $a);
  +        } else {
  +            die "ERROR: cannot parse $specpath\n";
  +        }
       }
   }
   xml_foot(\*STDOUT);
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to