Changeset a70441f in git for doc/doc2tex.pl


Ignore:
Timestamp:
Apr 27, 2000, 12:07:30 PM (23 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
e5f8ae07e0b41bb1b0e5aaaac2dad244e619d563
Parents:
eec9b2d2a332c04f20d743bdd4ccc107766fbc61
Message:
Windows and gcc 2.95 porting


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

Legend:

Unmodified
Added
Removed
  • doc/doc2tex.pl

    reec9b2 ra70441f  
    11#!/usr/local/bin/perl
    2 # $Id: doc2tex.pl,v 1.24 2000-03-09 16:37:23 hannes Exp $
     2# $Id: doc2tex.pl,v 1.25 2000-04-27 10:07:20 obachman Exp $
    33###################################################################
    44#  Computer Algebra System SINGULAR
     
    77#
    88####
    9 # @c example [error] [no_comp]
     9# @c example [error] [no_comp] [unix_only]
    1010#    -> the text till the next @c example is feed into Singular,
    1111#       the text is then substituted by
     
    2222#       unless 'error' is specified
    2323#       if no_comp is given, then computation is not run
     24#       if unix_only is given, then computation is only run
     25#                              under unix
    2426#       
    2527#
     
    5052#
    5153###################################################################
     54
     55use Config;
     56$Win32 = 1 if ($Config{osname} =~ /win/i);
    5257
    5358#
     
    6671$make = 0;
    6772$make_opts = " --no-print-directory";
     73
    6874
    6975#
     
    217223
    218224######################################################################
    219 # @c example [error] [no_comp]
     225# @c example [error] [no_comp] [unix_only]
    220226#    -> the text till the next @c example is fed into Singular,
    221227#       the text is then substituted by
     
    232238#       unless 'error' is specified
    233239#       If [no_comp] is given, actual computation is not run
     240#       if [unix_only] is given, then computation is only run
     241#                                under unix
     242
    234243sub HandleExample
    235244{
    236   my($inc_file, $ex_file, $lline, $thisexample, $error_ok, $cache, $no_comp);
     245  my($inc_file, $ex_file, $lline, $thisexample, $error_ok, $cache, $no_comp,
     246     $unix_only);
    237247 
    238248  $lline = $line;
     
    262272  $error_ok = 1 if /error/;
    263273  $no_comp = 1 if /no_comp/;
    264 
    265   # print content in example file till next @c example
     274  $unix_only = 1 if /unix_only/ && $Win32;
     275 
     276  # print content in example file till next @c example
     277  print TEX "// only supported on Unix platforms\n"
     278    if $unix_only;
     279 
    266280  while (<DOC>)
    267281  {
     
    269283    last if (/^\@c\s*example\s*$/);
    270284#    s/^\s*//; # remove preceeding white spaces
    271     if ($no_ex || $no_comp)
     285    if ($no_ex || $no_comp || $unix_only)
    272286    {
    273287      &protect_texi;
     
    289303
    290304  # done, if no examples
    291   return if ($no_ex || $no_comp);
     305  return if ($no_ex || $no_comp || $unix_only);
    292306
    293307  # check whether it can be reused
     
    321335    print EX "$thisexample";
    322336    close(EX);
     337
     338    unless ($Singular_OK)
     339    {
     340      if (system("echo '\$' | $Singular $Singular_opts > $res_file"))
     341      {
     342        $Singular .= '.exe' if ($Win32 && $Singular !~ /\.exe$/);
     343        Error("CanŽt run '$Singular $Singular_opts': $@")
     344          if (system("echo '\$' | $Singular $Singular_opts > $res_file"));
     345      }
     346      $Singular_OK = 1
     347    }
    323348
    324349    &System("echo '\$' | $Singular $Singular_opts $ex_file > $res_file");
     
    492517  $proc = $1 if (/^:(.*?) /);
    493518  $n_fun = 1 if ($no_fun || /no_fun/);
    494   $n_ex = 1 if ($no_ex || /no_ex/);
     519  $n_ex = 1 if ($no_ex || /no_ex/ || (/unix_only/ && $Win32));
    495520  $section = $1 if /(\w*)section/;
    496521 
Note: See TracChangeset for help on using the changeset viewer.