Changeset 65a2bd in git for doc/doc2tex.pl


Ignore:
Timestamp:
Jul 21, 1999, 9:53:28 PM (25 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'c5facdfddea2addfd91babd8b9019161dea4b695')
Children:
847cad00bd51532762eb834db78b83b695454b42
Parents:
f92cf85a06c9548f084c06b5adcdb9808ec2c69b
Message:
* dynamic making of stuff


git-svn-id: file:///usr/local/Singular/svn/trunk@3318 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/doc2tex.pl

    rf92cf8 r65a2bd  
    11#!/usr/local/bin/perl
    2 # $Id: doc2tex.pl,v 1.10 1999-07-20 14:36:36 obachman Exp $
     2# $Id: doc2tex.pl,v 1.11 1999-07-21 19:53:23 obachman Exp $
    33###################################################################
    44#  Computer Algebra System SINGULAR
     
    3636#
    3737####
    38 # @c lib libname.lib[:proc] [no_ex, lib_fun, lib_ex]
     38# @c lib libname.lib[:proc] [lib_fun, lib_ex, no_ex]
    3939#   Without :proc
    4040#   --> includes info of libname.lib in output file
     
    5656#
    5757$Singular = "../Singular/Singular"; # should be overwritten
    58 $libparse = "../Singular/libparse"; # change in final version
    5958$Singular_opts = " -teqr12345678";
    6059$clean = 0;
     
    6261$reuse = 1;
    6362$no_ex = 0;
    64 $lib_fun = 0;
    65 $lib_ex = 0;
     63$no_fun = 0;
    6664$doc_subdir = "./d2t_singular";
    6765@include_dirs = (".", "../Singular/LIB");
    6866$doc_examples_db = "$doc_subdir/examples";
     67$make = 0;
    6968
    7069#
     
    106105  $_ = shift(@ARGV);
    107106  if (/^-S(ingular)?$/)  { $Singular = shift(@ARGV); next;}
    108   if (/^-l(ibparse)?$/)  { $libparse = shift(@ARGV); next;}
    109107  if (/^-o(output)?$/)   { $tex_file = shift(@ARGV); next;}
    110108  if (/^-no_r(euse)?$/)  { $reuse = 0; next;}
    111109  if (/^-c(lean)?$/)     { $clean = 1; next;}
    112110  if (/^-no_e(x)?$/)     { $no_ex = 1; next;}
    113   if (/^-lib_fu(n)?$/)   { $lib_fun = 1;next;}
    114   if (/^-lib_e(x)?$/)    { $lib_ex = 1; next;}
     111  if (/^-no_fu(n)?$/)    { $no_fun = 1;next;}
     112  if (/^-m(ake)?$/)      { $make = 1;next;}
    115113  if (/^-s(ubdir)?$/)    { $doc_subdir = shift(@ARGV); next;}
    116114  if (/^-I$/)            { unshift(@include_dirs, shift(@ARGV)); next;}
    117115  if (/^-v(erbose)?$/)   { $verbose = shift(@ARGV); next;}
    118116  if (/^-h(elp)?$/)      { print &Usage; exit;}
    119   die &Usage;
     117  Error("Unknown Option $_\n" .&Usage);
    120118}
    121119$verbose = ($verbose < 0 ? 0 : $verbose);
     
    135133  $doc_dir = ".";
    136134}
    137 $tex_file = "$doc_dir/$doc.tex" unless ($tex_file);
    138                
     135unless ($tex_file)
     136{
     137  $tex_file = ($no_ex ? "$doc_dir/${doc}_noEx.tex" : "$doc_dir/$doc.tex");
     138}
     139
    139140#
    140141# open files
     
    144145open(TEX, ">$tex_file") || Error("can't open $tex_file for writing: $!\n");
    145146print "d2t: Generating $tex_file from $doc_file ...\n" if ($verbose > 1);
    146 print "d2t: $doc_file ==> $tex_file\n" if ($verbose == 1);
    147147if (-d $doc_subdir)
    148148{
     
    375375  @refs = sort(keys(%refs));
    376376  # put them out
     377  print TEX $header ? "$header\n" : "See also:\n";
    377378  print TEX "\@ifinfo\n\@menu\n";
    378   print TEX $header ? "$header\n" : "See also:\n";
    379379  foreach $ref (@refs) {print TEX "* ".$ref."::\n";}
    380380  print TEX "\@end menu\n\@end ifinfo\n\@iftex\n";
     
    396396###################################################################
    397397#
    398 # @c lib libname.lib [no_ex, lib_fun, lib_ex]
    399 #   --> includes info of libname.lib in output file
    400 #   --> includes function names of info into function index
    401 #   --> if lib_fun is given, includes listing of functions and
    402 #                      their help into output file
    403 #   --> if lib_ex is given, includes computed examples of functions, as well
    404 #
    405 # Optional no_ex, lib_fun, lib_ex arguments overwrite respective
    406 # command-line arguments
    407 #
     398# @c lib libname.lib[:proc] [no_ex, no_fun, (\w*)section]
     399#   --> replaced by @include $texfile where
     400#        $texfile = $subdir/libname_lib[_noFun,_noEx].tex
     401#   --> if $make, calls "make $texfile"
     402#   --> Error, if $tex_file does not exist
     403#   --> if [:proc] is given, then includes only of respective
     404#       proc body
     405#   --> if (\w*)section is given, replaces @subsection by @$1section
     406#       and pastes in content of tex file directly
    408407
    409408sub HandleLib
    410409{
    411   local($lib, $lib_name, $ltex_file, $l_ex, $l_fun, $no_node, $section);
    412   my ($func);
     410  my($lib, $proc, $n_fun, $n_ex, $section, $tex_file);
    413411
    414412  if (/^\@c\s*lib\s+([^\.]+)\.lib(.*)/)
    415413  {
    416414    $lib = $1;
    417     $lib_name = $lib.".lib";
    418415    $_ = $2;
    419416  }
     
    425422  }
    426423
    427   $func = $1 if (/^:(.*?) /);
    428   $l_fun = 1 if (($lib_fun || (/lib_fun/)) && !/no_fun/);
    429   $l_ex = 1 if (($lib_ex || /lib_ex/) && !/no_ex/ && $l_fun);
    430   if (/(\w+)section/)
    431   {
    432     $section = $1. 'section';
     424  $proc = $1 if (/^:(.*?) /);
     425  $n_fun = 1 if ($no_fun || /no_fun/);
     426  $n_ex = 1 if ($no_ex || /no_ex/);
     427  $section = $1 if /\w*section/;
     428 
     429  # contruct tex file name
     430  $tex_file = "$doc_subdir/$lib"."_lib";
     431  if ($n_fun)
     432  {
     433    $tex_file .= "_noFun";
     434  }
     435  elsif ($n_ex)
     436  {
     437    $tex_file .= "_noEx";
     438  }
     439  $tex_file .= ".tex";
     440
     441  if ($make)
     442  {
     443    print "<lib $lib" if ($verbose);
     444    if ($verbose <= 1)
     445    {
     446      System("make $tex_file > /dev/null")
     447    }
     448    else
     449    {
     450      System("make $tex_file");
     451    }
     452  }
     453 
     454  # make sure file exists
     455  if (-r $tex_file)
     456  {
     457    if ($verbose)
     458    {
     459      print "<lib $lib" unless $make;
     460      print ":$proc" if $proc;
     461      print ">";
     462    }
    433463  }
    434464  else
    435465  {
    436     $section = "subsection";
    437   }
    438   $ltex_file = "$doc_subdir/$lib"."_lib";
    439   unless ($l_ex)
    440   {
    441     if ($l_fun)
    442     {
    443       $ltex_file .= "_noEx";
     466    Error("Can't read $tex_file\n") unless -r $tex_file;
     467  }
     468
     469  # see whether we have to paste something in
     470  if ($proc || $section)
     471  {
     472    open(LTEX, "<$tex_file")
     473      || Error("Can't open $tex_file for reading: $!\n");
     474
     475    print TEX "\@c start include of docu for $lib.lib:$proc\n";
     476    print TEX "\@c replaced \@subsection by \@$section\n" if ($section);
     477    if ($proc)
     478    {
     479      my $found = 0;
     480      while (<LTEX>)
     481      {
     482        $found = 1 if /c ---content $proc---/;
     483        if ($found)
     484        {
     485          s/subsection/$section/ if $section;
     486          print TEX $_;
     487        }
     488        last if $found && /c ---end content $proc---/;
     489      }
     490      if ($found)
     491      {
     492        Error("no end content found for lib proc docu for $lib.lib:$proc $doc_file:$line \n")
     493          unless (/c ---end content $proc---/);
     494        print TEX "\@c generated lib proc docu for $lib.lib:$proc $doc_file:$line \n";
     495      }
     496      else
     497      {
     498        Error("did not find lib proc docu for $lib.lib:$proc $doc_file:$line \n");
     499      }
    444500    }
    445501    else
    446502    {
    447       $ltex_file .= "_noFun";
    448     }
    449   }
    450   $ltex_file .= ".tex";
    451  
    452   Error("can't open $lib.lib for reading: $!\n")
    453     unless  ($lib_dir = &Open(*LIB, "<$lib.lib"));
    454   close (LIB);
    455   if ($reuse && open(LTEX, "<$ltex_file") &&
    456       IsNewer($ltex_file, "$lib_dir/$lib.lib"))
    457   {
    458     unless ($func)
    459     {
    460       print "<lib $lib>" if ($verbose);
    461       print TEX "\@c reused lib docu for $lib_name $doc_file:$line \n";
    462     }
    463   }
    464   elsif (&GenerateLibDoc($lib, $ltex_file, $l_fun, $l_ex))
    465   {
    466     print TEX "\@c generated lib docu for $lib_name $doc_file:$line \n"
    467       unless $func;
    468     open(LTEX, "<$ltex_file")
    469       || Error("can't open $ltex_file for reading: $!\n");
    470   }
    471   if ($func)
    472   {
    473     print "<$lib:$func" if $verbose;
    474     print TEX "\@c generated lib proc docu for $lib_name:$func $doc_file:$line \n";
    475     my $found = 0;
    476     while (<LTEX>)
    477     {
    478       $found = 1 if /c ---content $func---/;
    479       print TEX $_ if $found;
    480       last if $found && /c ---end content $func---/;
    481     }
    482     if ($found)
    483     {
    484       Error("no end content found for lib proc docu for $lib_name:$func $doc_file:$line \n")
    485         unless (/c ---end content $func---/);
    486       print TEX "\@c generated lib proc docu for $lib_name:$func $doc_file:$line \n";
    487     }
    488     else
    489     {
    490       Error("did not find lib proc docu for $lib_name:$func $doc_file:$line \n");
    491     }
    492     print ">" if $verbose;
     503      while (<LTEX>)
     504      {
     505        s/subsection/$section/;
     506        print TEX $_;
     507      }
     508    }
     509    print TEX "\@c end include of docu for $lib.lib:$proc\n";
     510    close(LTEX);
    493511  }
    494512  else
    495513  {
    496     while (<LTEX>) {print TEX $_;}
    497     print TEX "\@c end generated lib docu for $lib_name $doc_file:$line \n";
    498   }
    499   close(LTEX);
    500   unlink $ltex_file if ($clean);
    501 }
    502  
    503 sub GenerateLibDoc
    504 {
    505   my($lib, $tex_file, $l_fun, $l_ex) = @_;
    506   my($lib_dir, $scall, $pl_file, $doc_file, $i, $example,$largs, $ref);
    507   # vars from executing the library perl scrip
    508   local($info, $libary, $version, @procs, %example, %help, $table_is_open);
    509  
    510   print "(lib $lib: " if ($verbose == 1);
    511   # construct doc/tex file name
    512   $doc_file = "$doc_subdir/$lib"."_lib";
    513   $doc_file .= "_noFun" unless ($l_fun);
    514   $doc_file .= ".doc";
    515 
    516   Error("can't open $lib.lib for reading: $!\n")
    517     unless  ($lib_dir = &Open(*LIB, "<$lib.lib"));
    518   close (LIB);
    519   if (-r $doc_file && $reuse && IsNewer($doc_file, "$lib_dir/$lib.lib"))
    520   {
    521     print "<doc>" if ($verbose == 1);
    522   }
    523   else
    524   {
    525     # generate perl file, if necessary
    526     $pl_file = "$doc_subdir/$lib"."_lib.pl";
    527     if (-r $pl_file && $reuse && IsNewer($pl_file, "$lib_dir/$lib.lib"))
    528     {
    529       print "<pl>" if ($verbose == 1);
    530     }
    531     else
    532     {
    533       print "(pl" if ($verbose == 1);
    534       &System("$libparse -i $lib_dir/$lib.lib > $pl_file");
    535       print ")" if ($verbose == 1);
    536     }
    537 
    538     print "(doc" if ($verbose == 1);
    539    
    540     do $pl_file;
    541     Error("error while executing $pl_file: $@\n") if ($@);
    542     unlink ($pl_file) if ($clean);
    543    
    544     # generate doc file
    545     open(LDOC, ">$doc_file") || die"$ERROR can't open $doc_file for writing: $!\n";
    546    
    547     # print header
    548     print LDOC "\@c library version: $version\n";
    549     print LDOC "\@c library file: $library\n";
    550     undef @procs;
    551     $ref = OutLibInfo(\*LDOC, $info, $l_fun);
    552     OutRef(\*LDOC, $ref) if $ref;
    553     # print menu of available functions
    554     if ($l_fun)
    555     {
    556       # print help and example of each function
    557       for ($i = 0; $i <= $#procs; $i++)
    558       {
    559         # print node and section heading
    560         print LDOC "\n\@c ------------------- " . $procs[$i]." -------------\n";
    561         print LDOC "\@node " . $procs[$i].",";
    562         print LDOC " ".$procs[$i+1] if ($i < $#procs);
    563         print LDOC ",";
    564         print LDOC " ".$procs[$i-1] if ($i > 0);
    565         print LDOC ", " . $lib ."_lib\n";
    566         print LDOC "\@$section " . $procs[$i] . "\n";
    567         print LDOC "\@cindex ". $procs[$i] . "\n";
    568 
    569         print LDOC "\@c ---content $procs[$i]---\n";
    570         print LDOC "Procedure from library \@code{$lib.lib} (\@pxref{${lib}_lib}).\n\n";
    571         if ($help{$procs[$i]} =~ /^\@/)
    572         {
    573           print LDOC $help{$procs[$i]};
    574           $ref = '';
    575         }
    576         else
    577         {
    578           print LDOC "\@table \@asis\n";
    579           $table_is_open = 1;
    580           # print help
    581           $ref = OutInfo(\*LDOC, $help{$procs[$i]});
    582           print LDOC "\@end table\n";
    583         }
    584         # print example
    585         if ($example = &CleanUpExample($lib, $example{$procs[$i]}))
    586         {
    587           print LDOC "\@strong{Example:}\n";
    588           print LDOC "\@smallexample\n\@c example\n";
    589           print LDOC $example;
    590           print LDOC "\n\@c example\n\@end smallexample\n";
    591         }
    592         OutRef(\*LDOC, $ref) if $ref;
    593         print LDOC "\@c ---end content $procs[$i]---\n";
    594       }
    595     }
    596     close(LDOC);
    597     print ")" if ($verbose == 1);
    598   }
    599 
    600   $largs = "-no_ex" unless ($l_ex);
    601   # call doc2tex on generated doc file
    602   print "\n" if ($verbose == 1);
    603   dbmclose(%EXAMPLES);
    604   &System("$0 $args $largs -o $tex_file $doc_file");
    605   dbmopen(%EXAMPLES, $doc_examples_db, oct(755))
    606     || die "$ERROR: can't open examples data base: $!\n";
    607  
    608   unlink($doc_file) if ($clean);
    609   return 1;
    610 }
    611 
    612 ###########################################################################
    613 # parse and print-out libinfo
    614 sub OutLibInfo
    615 {
    616   my ($FH, $info, $l_fun) = @_;
    617   print $FH "\@c ---content LibInfo---\n";
    618     if ($info =~ /^\@/)
    619   {
    620     print $FH $info;
    621     return;
    622   }
    623   print $FH "\@table \@asis\n";
    624   $table_is_open = 1;
    625  
    626   my ($ref) = OutInfo($FH, $info, $l_fun);
    627 
    628   print $FH "\@end table\n" if $table_is_open;
    629   print $FH "\@c ---end content LibInfo---\n";
    630   $table_is_open = 0;
    631   return $ref;
    632 }
    633 
    634 sub OutInfo
    635 {
    636   my ($FH, $info, $l_fun) = @_;
    637   if ($info =~ /^\s*\@/)
    638   {
    639     print $FH $info;
    640     return;
    641   }
    642   $info =~ s/^\s*//;
    643   $info =~ s/\s*$//;
    644   $info .= "\n";
    645 
    646   my ($item, $text, $line, $ref);
    647   while ($info =~ m/(.*\n)/g)
    648   {
    649     $line = $1;
    650     if ($1 =~ /^(\w.+?):(.*\n)/)
    651     {
    652       $ref .= OutInfoItem($FH, $item, $text, $l_fun) if $item && $text;
    653       $item = $1;
    654       $text = $2;
    655     }
    656     else
    657     {
    658       $text .= $line;
    659     }
    660   }
    661   $ref .= OutInfoItem($FH, $item, $text, $l_fun) if $item && $text;
    662   return $ref;
    663 }
    664 
    665 sub FormatInfoText
    666 {
    667   my $length = shift;
    668   $length = 0 unless $length;
    669   # insert @* infront of all lines whose previous line is shorter than
    670   # 60 characters
    671   $_ = ' ' x $length . $_;
    672   if (/^(.*)\n/)
    673   {
    674     $_ .= "\n";
    675     my $pline;
    676     my $line;
    677     my $ptext = $_;
    678     my $text = '';
    679     while ($ptext =~ /(.*)\n/g)
    680     {
    681       $line = $1;
    682       # break line if
    683       $text .= '@*'
    684         if ($line =~ /\w/ && $pline =~ /\w/ # line and prev line are not empty
    685             && $line !~ /^\s*\@\*/  # line does not start with @*
    686             && $pline !~ /\@\*\s*/  # prev line does not end with @*
    687             &&
    688             ((length($pline) < 60  && # prev line is shorter than 60 chars
    689               $pline !~ /\@code{.*?}/ # and does not contain @code, @math
    690               && $pline !~ /\@math{.*?}/)
    691              ||
    692              $line =~ /^\s*\w*\(.*?\)/ # $line starts with \w*(..)
    693              ||
    694              $pline =~ /^\s*\w*\(.*?\)[\s;:]*$/)); # prev line is only \w(..)
    695       $line =~ s/\s*$//;
    696       $text .= "$line\n";
    697       $pline = $line;
    698     }
    699     $_ = $text;
    700   }
    701   s/\t/ /g;
    702   s/\n +/\n/g;
    703   s/\s*$//g;
    704   s/ +/ /g;  # replace double whitespaces by one
    705   s/(\w+\(.*?\))/\@code{$1}/g;
    706   s/\@\*\s*/\@\*/g;
    707   s/(\@[^\*])/\@$1/g; # escape @ signs, except @*
    708   s/{/\@{/g; # escape {}
    709   s/}/\@}/g;
    710   # unprotect @@math@{@}, @code@{@}
    711   while (s/\@\@math\@{(.*?)\@}/\@math{$1}/g) {}
    712   while (s/\@\@code\@{(.*?)\@}/\@code{$1}/g) {}
    713   # remove @code{} inside @code{} and inside @math{}
    714   while (s/\@math{([^}]*)\@code{(.*?)}(.*)?}/\@math{$1$2$3}/g) {}
    715   while (s/\@code{([^}]*)\@code{(.*?)}(.*)?}/\@code{$1$2$3}/g) {}
    716 }
    717 
    718 sub OutInfoItem
    719 {
    720   my ($FH, $item, $text, $l_fun) = @_;
    721 
    722   $item = lc $item;
    723   $item = ucfirst $item;
    724 
    725   if ($item =~ /see also/i)
    726   {
    727     # return references
    728     return $text;
    729   }
    730   elsif ($item =~ m/example/i)
    731   {
    732     # forget about example, since it comes explicitely
    733     return '';
    734   }
    735   elsif ($item =~ m/procedure/i)
    736   {
    737     if ($l_fun && $table_is_open)
    738     {
    739       print $FH "\@end table\n\n";
    740       $table_is_open = 0;
    741     }
    742     $text =~ s/^\s*//;
    743     $text =~ s/\s*$//;
    744     $text =~ s/.*$// if ($text=~/parameters.*brackets.*are.*optional.*$/);
    745     $text .= "\n";
    746    
    747     my ($proc, $pargs, $pinfo, $line);
    748     if ($l_fun)
    749     {
    750       print $FH "\@strong{$item:}\n\@menu\n";
    751     }
    752     else
    753     {
    754       print $FH "\@item \@strong{$item:}\n\@table \@asis\n";
    755     }
    756     while ($text =~ /(.*\n)/g)
    757     {
    758       $line = $1;
    759       if ($1 =~ /^\s*(\w+)\((.*?)\)/)
    760       {
    761         OutProcInfo($FH, $proc, $procargs, $pinfo, $l_fun) if $proc && $pinfo;
    762         $proc = $1;
    763         $procargs = $2;
    764         $pinfo = $';
    765       }
    766       else
    767       {
    768         $pinfo .= $line;
    769       }
    770     }
    771     OutProcInfo($FH, $proc, $procargs, $pinfo, $l_fun) if $proc && $pinfo;
    772     print $FH ($l_fun ? "\@end menu\n" : "\@end table\n");
    773     return '';
    774   }
    775 
    776   if (! $table_is_open)
    777   {
    778     print $FH "\@table \@asis\n";
    779     $table_is_open = 1;
    780   }
    781   print $FH '@item @strong{'. "$item:}\n";
    782   # prepare text:
    783   local $_ = $text;
    784   if (($item =~ m/^library/i)  && m/\s*(\w*)\.lib/)
    785   {
    786     print $FH "$1.lib\n";
    787     $text = $';
    788     if ($text =~ /\w/)
    789     {
    790       print $FH '@item @strong{Purpose:'."}\n";
    791       print $FH lc $text;
    792     }
    793   }
    794   else
    795   {
    796     # just print the text
    797     FormatInfoText(length($item) + 1);
    798     print $FH "$_\n";
    799   }
    800   return '';
    801 }
    802 
    803 sub OutProcInfo
    804 {
    805   my($FH, $proc, $procargs, $pinfo, $l_fun) = @_;
    806   local $_ = $pinfo;
    807   s/^[;\s]*//;
    808   s/\n/ /g;
    809   FormatInfoText();
    810  
    811   if ($l_fun)
    812   {
    813     print $FH "* ${proc}:: $_\n";
    814     push @procs, $proc;
    815   }
    816   else
    817   {
    818     print $FH "\@item \@code{$proc($procargs)}  ";
    819     print $FH "\n\@cindex $proc\n$_\n";
    820   }
    821 }
    822 
    823 sub OutRef
    824 {
    825   my ($FH, $refs) = @_;
    826   $refs =~ s/^\s*//;
    827   $refs =~ s/\s*$//;
    828   $refs =~ s/\n/,/g;
    829   my @refs = split (/[,;\.]+/, $refs);
    830   my $ref;
    831 
    832   print $FH "\@c ref\nSee also:\n";
    833   $ref = shift @refs;
    834   print $FH "\@ref{$ref}";
    835   for $ref (@refs)
    836   {
    837     $ref =~ s/^\s*//;
    838     $ref =~ s/\s*$//;
    839     print $FH ", \@ref{$ref}"  if ($ref =~ /\w/);
    840   }
    841   print $FH "\n\@c ref\n";
    842 }
    843 
    844 sub CleanUpExample
    845 {
    846   local($lib, $example) = @_;
    847  
    848   # find portion in {}
    849   $example =~ s/^[^{]*{(.*)}[^}]*$/$1/s;
    850 
    851   if ($example =~ /EXAMPLE: \(not executed\)/)
    852   {
    853     # erase first three lines
    854     $example =~ s/^.*\n.*\n.*\n/\n/;
    855     # erase enclosing " " in every line
    856     $example =~ s/\n\s*"/\n/g;
    857     $example =~  s/";\n/\n/g;
    858   }
    859   # erase EXAMPLE, echo and pause statements
    860   $example =~ s/"EXAMPLE.*"[^;]*;//g;
    861   $example .= "\n";
    862   my ($mexample, $line);
    863   while ($example =~ m/(.*)\n/g)
    864   {
    865     $line = $1;
    866     $line =~ s|echo[^;]*;||g if $line !~ m|(.*)//(.*)echo[^;]*;|;
    867     $line =~ s|pause\(.*?\)[^;]*;||g if $line !~ m|(.*)//(.*)pause\(.*?\)[^;]*;|;
    868     $mexample .= "$line\n";
    869   }
    870   $example = $mexample;
    871  
    872   # prepend LIB command
    873   $example = "LIB \"$lib.lib\";\n".$example
    874     if ($example && $lib ne "standard");
    875   # erase empty lines
    876   $example =~ s/^\s*\n//g;
    877   # erase spaces from beginning of lines
    878   $example =~ s/\n\s*/\n/g;
    879   $example =~ s/\s*$//g;
    880   return $example;
    881 }
    882 
    883 ###################################################################
    884 #
    885 # Auxiallary functions
    886 #
    887 sub IsNewer
    888 {
    889   my $f1 = shift;
    890   my $f2 = shift;
    891   my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime)
    892     = stat($f1);
    893   my $m1 = $mtime;
    894   ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime) = stat($f2);
    895 
    896   return ($m1 > $mtime);
     514    print TEX "\@c include of docu for $lib.lib\n";
     515    print TEX "\@include $tex_file\n";
     516  }
    897517}
    898518
     
    951571  -Singular prog: use 'prog' as Singular program to generate ex output
    952572                          (default: '../Singular/Singular')
    953   -libparse prog: use 'prog' as libparse program to generate lib docu
    954                           (default: '../Singular/libparse')
    955573  -output file  : use 'file' as output file
    956574                          (default: input_file.tex)
    957575  -clean        : delete intermediate files
     576  -make         : use make to generate tex files for libraries
    958577  -no_reuse     : don't reuse intermediate files
    959578  -no_ex        : skip computation of examples
    960   -lib_fun      : include help for library functions
    961   -lib_ex       : include example for library functions
     579  -no_fun       : don't include help for library functions
    962580  -subdir  dir  : put intermediate files into 'dir'
    963581                          (default: './d2t_singular')
Note: See TracChangeset for help on using the changeset viewer.