Changeset 5480da in git


Ignore:
Timestamp:
Apr 4, 1998, 12:47:15 AM (25 years ago)
Author:
Kai Krüger <krueger@…>
Branches:
(u'spielwiese', 'f6c3dc58b0df4bd712574325fe76d0626174ad97')
Children:
a42239a667454add16526617638435dcc1115d49
Parents:
fca547bc4a4fdc03461b1fa87b33c326d44b5733
Message:
Added new help for libraries


git-svn-id: file:///usr/local/Singular/svn/trunk@1318 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • Singular/ChangeLog

    rfca547 r5480da  
     1Sat Apr  4 00:52:58 MET DST 1998 Kai Krueger <krueger@mathematik.uni-kl.de>
     2        * iplib.cc libparse.cc libparse.h libparse.l misc.cc LIB/*.lib
     3          Changed help for libraries.
     4       
    15Wed Apr  1 20:55:15 MET DST 1998 hannes
    26        * mpsr_Tok.cc,tok.h: minor fix, removed VERBOSE_CMD
  • Singular/LIB/all.lib

    rfca547 r5480da  
    1 // $Id: all.lib,v 1.6 1998-03-10 13:02:33 Singular Exp $
     1// $Id: all.lib,v 1.7 1998-04-03 22:46:58 krueger Exp $
    22///////////////////////////////////////////////////////////////////////////////
    33
     4version="$Id: all.lib,v 1.7 1998-04-03 22:46:58 krueger Exp $";
     5info="
    46LIBRARY:  all.lib   Load all libraries
    57         
     
    810  elim.lib      PROCEDURES FOR ELIMINATION, SATURATION AND BLOWING UP
    911  factor.lib    PROCEDURES FOR CALLING EXTERNAL FACTORIZER
     12  fastsolv.lib
    1013  finvar.lib    PROCEDURES TO CALCULATE INVARIANT RINGS & MORE
    1114  general.lib   PROCEDURES OF GENERAL TYPE
     
    1518  invar.lib     PROCEDURES FOR COMPUTING INVARIANTS OF (C,+)-ACTIONS
    1619  matrix.lib    PROCEDURES FOR MATRIX OPERATIONS
     20  normal.lib
    1721  poly.lib      PROCEDURES FOR MANIPULATING POLYS, IDEALS, MODULES       
    1822  presolve.lib  PROCEDURES FOR PRE-SOLVING POLYNOMIAL EQUATIONS
     
    2428  standard.lib  PROCEDURES WHICH ARE ALWAYS LOADED AT START-UP
    2529  tex.lib       PROCEDURES FOR TYPESET OF SINGULAROBJECTS IN TEX
     30  tst.lib
     31";
    2632
    2733///////////////////////////////////////////////////////////////////////////////
     
    3137LIB "elim.lib";
    3238LIB "factor.lib";
     39LIB "fastsolv.lib";
    3340LIB "finvar.lib";
    3441LIB "general.lib";
     
    3845LIB "invar.lib";
    3946LIB "matrix.lib";
     47LIB "normal.lib";
    4048LIB "poly.lib";
    4149LIB "presolve.lib";
     
    4654LIB "sing.lib";
    4755LIB "tex.lib";
    48 LIB "tools.lib";
     56// LIB "tools.lib";
  • Singular/LIB/deform.lib

    rfca547 r5480da  
    1 // $Id: deform.lib,v 1.6 1998-03-06 11:52:52 krueger Exp $
     1// $Id: deform.lib,v 1.7 1998-04-03 22:46:59 krueger Exp $
    22//(bm, last modified 12/97)   
    33///////////////////////////////////////////////////////////////////////////////
     4
     5version="$Id: deform.lib,v 1.7 1998-04-03 22:46:59 krueger Exp $";
     6info="
    47LIBRARY:  deform.lib       PROCEDURES FOR COMPUTING MINIVERSAL DEFORMATION
    58                            (new version)
     
    811                          miniversal deformation of module Mo modulo ideal I
    912 lift_rel_kb(N,M[,kbM,p]) lifting N into a kbase of M
    10  kill_rings(["prefix"])   kills the exported rings from above
     13 kill_rings([\"prefix\"])   kills the exported rings from above
    1114 lift_kbase(N,M);         coef-matrix expressing N as lin. comb. of k-basis of M
    1215 
     
    1417                  get_rings,compute_ext,get_inf_def,interact1,
    1518                  interact2,negative_part,homog_test
     19";
     20
    1621LIB "inout.lib";
    1722LIB "general.lib";
  • Singular/LIB/elim.lib

    rfca547 r5480da  
    1 // $Id: elim.lib,v 1.2 1997-04-28 19:27:16 obachman Exp $
     1// $Id: elim.lib,v 1.3 1998-04-03 22:47:00 krueger Exp $
    22// system("random",787422842);
    33// (GMG, last modified 22.06.96)
    44///////////////////////////////////////////////////////////////////////////////
    55
     6version="$Id: elim.lib,v 1.3 1998-04-03 22:47:00 krueger Exp $";
     7info="
    68LIBRARY:  elim.lib      PROCEDURES FOR ELIMINATIOM, SATURATION AND BLOWING UP
    79
     
    1315 select(id,n[,m]);      select generators containing nth [..mth] variable
    1416           (parameters in square brackets [] are optional)
     17";
    1518
    1619LIB "inout.lib";
  • Singular/LIB/factor.lib

    rfca547 r5480da  
    1 // $Id: factor.lib,v 1.3 1997-05-05 12:02:44 Singular Exp $
     1// $Id: factor.lib,v 1.4 1998-04-03 22:47:01 krueger Exp $
    22//(RS)
    33///////////////////////////////////////////////////////////////////////////////
    44
     5version="$Id: factor.lib,v 1.4 1998-04-03 22:47:01 krueger Exp $";
     6info="
    57LIBRARY:  factor.lib    PROCEDURES FOR CALLING THE REDUCE FACTORIZER
    68
    79 delete_dollar(s)       return the string s with '$' deleted
    810 reduce_factor(f)       list of factors of f, calling REDUCE (UNIX only)
     11";
    912
    1013///////////////////////////////////////////////////////////////////////////////
  • Singular/LIB/fastsolv.lib

    rfca547 r5480da  
    1 // $ID$
     1//
     2version="$Id: fastsolv.lib,v 1.2 1998-04-03 22:47:01 krueger Exp $";
     3info="";
     4
    25// ====================================================================
    36//  library fast.lib
  • Singular/LIB/finvar.lib

    rfca547 r5480da  
    1 // $Header: /exports/cvsroot-2/cvsroot/Singular/LIB/finvar.lib,v 1.7 1998-03-06 11:52:53 krueger Exp $
     1// $Header: /exports/cvsroot-2/cvsroot/Singular/LIB/finvar.lib,v 1.8 1998-04-03 22:47:02 krueger Exp $
    22////////////////////////////////////////////////////////////////////////////////
    33
     4version="$Id: finvar.lib,v 1.8 1998-04-03 22:47:02 krueger Exp $";
     5info="
    46LIBRARY:  finvar.lib       LIBRARY TO CALCULATE INVARIANT RINGS & MORE
    57                           (c) Agnes Eileen Heydtmann,
     
    4042  relative_orbit_variety(...)            ideal of a relative orbit variety
    4143  image_of_variety(...)                  ideal of the image of a variety
     44";
    4245
    4346////////////////////////////////////////////////////////////////////////////////
  • Singular/LIB/general.lib

    rfca547 r5480da  
    1 // $Id: general.lib,v 1.4 1997-08-12 14:01:07 Singular Exp $
     1// $Id: general.lib,v 1.5 1998-04-03 22:47:04 krueger Exp $
    22//system("random",787422842);
    33//(GMG, last modified 22.06.96)
    44///////////////////////////////////////////////////////////////////////////////
    55
     6version="$Id: general.lib,v 1.5 1998-04-03 22:47:04 krueger Exp $";
     7info="
    68LIBRARY:  general.lib   PROCEDURES OF GENERAL TYPE
    79
    8  A_Z("a",n);            string a,b,... of n comma seperated letters
     10 A_Z(\"a\",n);            string a,b,... of n comma seperated letters
    911 binomial(n,m[,../..]); n choose m (type int), [type string/type number]
    1012 factorial(n[,../..]);  n factorial (=n!) (type int), [type string/number]
     
    2224 which(command);        searches for command and returns absolute
    2325                        path, if found
     26";
     27
    2428LIB "inout.lib";
    2529///////////////////////////////////////////////////////////////////////////////
  • Singular/LIB/hnoether.lib

    rfca547 r5480da  
    1 // $Id: hnoether.lib,v 1.3 1998-03-17 15:06:35 Singular Exp $
     1// $Id: hnoether.lib,v 1.4 1998-04-03 22:47:05 krueger Exp $
    22// author:  Martin Lamm,  email: lamm@mathematik.uni-kl.de
    33// last change:           13.03.98
    44///////////////////////////////////////////////////////////////////////////////
    55
     6version="$Id: hnoether.lib,v 1.4 1998-04-03 22:47:05 krueger Exp $";
     7info="
    68LIBRARY:  hnoether.lib   PROCEDURES FOR THE HAMBURGER-NOETHER-DEVELOPMENT
    79
     
    4547 HN(f,grenze);       recursive subroutine for reddevelop
    4648 constructHNEs(...); subroutine for HN
     49";
    4750
    4851LIB "primitiv.lib";
  • Singular/LIB/homolog.lib

    rfca547 r5480da  
    1 // $Id: homolog.lib,v 1.4 1997-09-12 07:40:34 Singular Exp $
     1// $Id: homolog.lib,v 1.5 1998-04-03 22:47:06 krueger Exp $
    22//(BM/GMG, last modified 22.06.96)
    33///////////////////////////////////////////////////////////////////////////////
    44
     5version="$Id: homolog.lib,v 1.5 1998-04-03 22:47:06 krueger Exp $";
     6info="
    57LIBRARY:  homolog.lib   PROCEDURES FOR HOMOLOGICAL ALGEBRA
    68
     
    1416 kohom(A,k);            Hom(R^k,A),     A matrix over basering R
    1517 kontrahom(A,k);        Hom(A,R^k),     A matrix over basering R
     18";
    1619
    1720LIB "general.lib";
  • Singular/LIB/inout.lib

    rfca547 r5480da  
    1 // $Id: inout.lib,v 1.3 1997-09-12 07:40:35 Singular Exp $
     1// $Id: inout.lib,v 1.4 1998-04-03 22:47:06 krueger Exp $
    22// system("random",787422842);
    33// (GMG/BM, last modified 22.06.96)
    44///////////////////////////////////////////////////////////////////////////////
    55
     6version="$Id: inout.lib,v 1.4 1998-04-03 22:47:06 krueger Exp $";
     7info="
    68LIBRARY:  inout.lib     PROCEDURES FOR MANIPULATING IN- AND OUTPUT
    79
     
    1719 writelist(fil,nam,L);  write the list L into a file `fil` and call it `nam`
    1820           (parameters in square brackets [] are optional)
     21";
    1922
    2023///////////////////////////////////////////////////////////////////////////////
  • Singular/LIB/invar.lib

    rfca547 r5480da  
    1 // $Id: invar.lib,v 1.4 1998-02-16 12:07:01 pfister Exp $
     1// $Id: invar.lib,v 1.5 1998-04-03 22:47:07 krueger Exp $
    22///////////////////////////////////////////////////////
    33// invar.lib
     
    77//////////////////////////////////////////////////////
    88
     9version="$Id: invar.lib,v 1.5 1998-04-03 22:47:07 krueger Exp $";
     10info="
    911LIBRARY: invar.lib PROCEDURES FOR COMPUTING INVARIANTS OF (C,+)-ACTIONS
    1012
     
    2325  // returns 1 if the action of the additive group defined by the
    2426  // matrix m as above i proper and 0 if not.
     27";
    2528
    2629///////////////////////////////////////////////////////////////////////////////
  • Singular/LIB/matrix.lib

    rfca547 r5480da  
    1 // $Id: matrix.lib,v 1.4 1997-09-18 09:58:24 Singular Exp $
     1// $Id: matrix.lib,v 1.5 1998-04-03 22:47:08 krueger Exp $
    22// (GMG/BM, last modified 22.06.96)
    33///////////////////////////////////////////////////////////////////////////////
     4
     5version="$Id: matrix.lib,v 1.5 1998-04-03 22:47:08 krueger Exp $";
     6info="
    47LIBRARY:  matrix.lib    PROCEDURES FOR MATRIX OPERATIONS
    58
     
    2730 permrow(A,i,j);        permute i-th and j-th rows
    2831           (parameters in square brackets [] are optional)
     32";
    2933
    3034LIB "inout.lib";
  • Singular/LIB/normal.lib

    rfca547 r5480da  
    66///////////////////////////////////////////////////////////////////////////////
    77
     8version="$Id: normal.lib,v 1.4 1998-04-03 22:47:08 krueger Exp $";
     9info="
    810LIBRARY: normal.lib: PROCEDURE FOR NORMALIZATION (I)
    911
     
    1113  // computes a set of rings such that their product is the
    1214  // normalization of the reduced basering/I
     15";
    1316
    1417LIB "sing.lib";
  • Singular/LIB/poly.lib

    rfca547 r5480da  
    1 // $Id: poly.lib,v 1.9 1997-12-17 17:28:05 obachman Exp $
     1// $Id: poly.lib,v 1.10 1998-04-03 22:47:09 krueger Exp $
    22//system("random",787422842);
    33//(GMG, last modified 22.06.96)
     
    55///////////////////////////////////////////////////////////////////////////////
    66
     7version="$Id: poly.lib,v 1.10 1998-04-03 22:47:09 krueger Exp $";
     8info="
    79LIBRARY:  poly.lib      PROCEDURES FOR MANIPULATING POLYS, IDEALS, MODULES
    810
     
    2123 rad_con(p,I);          check radical containment of poly p in ideal I
    2224           (parameters in square brackets [] are optional)
    23 
     25";
    2426
    2527LIB "general.lib";
  • Singular/LIB/presolve.lib

    rfca547 r5480da  
    1 // $Id: presolve.lib,v 1.2 1998-03-06 11:52:57 krueger Exp $
     1// $Id: presolve.lib,v 1.3 1998-04-03 22:47:10 krueger Exp $
    22//system("random",787422842);
    33//(GMG), last modified 97/10/07 by GMG
    44///////////////////////////////////////////////////////////////////////////////
    55
     6version="$Id: presolve.lib,v 1.3 1998-04-03 22:47:10 krueger Exp $";
     7info="
    68LIBRARY:  presolve.lib     PROCEDURES FOR PRE-SOLVING POLYNOMIAL EQUATIONS
    79
     
    2022 valvars(id[..]);       valuation of vars w.r.t. to their complexity in id
    2123           (parameters in square brackets [] are optional)
     24";
    2225
    2326LIB "inout.lib";
  • Singular/LIB/primdec.lib

    rfca547 r5480da  
    1 // $Id: primdec.lib,v 1.10 1998-03-06 11:52:57 krueger Exp $
     1// $Id: primdec.lib,v 1.11 1998-04-03 22:47:10 krueger Exp $
    22///////////////////////////////////////////////////////
    33// primdec.lib
     
    1111//////////////////////////////////////////////////////
    1212
     13version="$Id: primdec.lib,v 1.11 1998-04-03 22:47:10 krueger Exp $";
     14info="
    1315LIBRARY: primdec.lib: PROCEDURE FOR PRIMARY DECOMPOSITION (I)
    1416
     
    3335  // The integer choose must be either 0 or 1.
    3436  // If choose=0, the given ordering of the variables is used.
    35   // If choose=1, the system tries to find an "optimal ordering",
     37  // If choose=1, the system tries to find an \"optimal ordering\",
    3638  // which in some cases may considerably speed up the algorithm
    3739
     
    5052  // If choose=0, min_ass_prim_charsets with the given
    5153  // ordering of the variables is used.
    52   // If choose=1, min_ass_prim_charsets with the "optimized"
     54  // If choose=1, min_ass_prim_charsets with the \"optimized\"
    5355  // ordering of the variables is used.
    5456  // If choose=2, minAssPrimes from primdec.lib is used
    5557  // If choose=3, minAssPrimes+factorizing Buchberger from primdec.lib is used
     58";
    5659
    5760LIB "general.lib";
  • Singular/LIB/primitiv.lib

    rfca547 r5480da  
    1 // $Id: primitiv.lib,v 1.2 1997-08-13 14:13:29 Singular Exp $
     1// $Id: primitiv.lib,v 1.3 1998-04-03 22:47:11 krueger Exp $
    22// This library requires Singular 1.0
    33
     4version="$Id: primitiv.lib,v 1.3 1998-04-03 22:47:11 krueger Exp $";
     5info="
    46LIBRARY:    primitiv.lib    PROCEDURES FOR FINDING A PRIMITIVE ELEMENT
    57
     
    911                                       and switch to it
    1012 randomLast(int b);       random transformation of the last variable
     13";
    1114
    1215LIB "random.lib";
  • Singular/LIB/random.lib

    rfca547 r5480da  
    1 // $Id: random.lib,v 1.3 1997-08-12 14:01:11 Singular Exp $
     1// $Id: random.lib,v 1.4 1998-04-03 22:47:12 krueger Exp $
    22//system("random",787422842);
    33//(GMG/BM, last modified 22.06.96)
    44///////////////////////////////////////////////////////////////////////////////
    55
     6version="$Id: random.lib,v 1.4 1998-04-03 22:47:12 krueger Exp $";
     7info="
    68LIBRARY:  random.lib    PROCEDURES OF RANDOM MATRIX AND POLY OPERATIONS
    79
     
    1416 sparsetriag(n,m[..]);  nxm sparse lower-triag intmat with random coefficients
    1517           (parameters in square brackets [] are optional)
     18";
    1619
    1720LIB "inout.lib";
  • Singular/LIB/ring.lib

    rfca547 r5480da  
    1 // $Id: ring.lib,v 1.4 1997-09-12 08:18:04 Singular Exp $
     1// $Id: ring.lib,v 1.5 1998-04-03 22:47:13 krueger Exp $
    22//(GMG, last modified 03.11.95)
    33///////////////////////////////////////////////////////////////////////////////
    44
     5version="$Id: ring.lib,v 1.5 1998-04-03 22:47:13 krueger Exp $";
     6info="
    57LIBRARY:  ring.lib      PROCEDURES FOR MANIPULATING RINGS AND MAPS
    68
    7  changechar("R",c[,r]); make a copy R of basering [ring r] with new char c
    8  changeord("R",o[,r]);  make a copy R of basering [ring r] with new ord o
    9  changevar("R",v[,r]);  make a copy R of basering [ring r] with new vars v
    10  defring("R",c,n,v,o);  define a ring R in specified char c, n vars v, ord o
     9 changechar(\"R\",c[,r]); make a copy R of basering [ring r] with new char c
     10 changeord(\"R\",o[,r]);  make a copy R of basering [ring r] with new ord o
     11 changevar(\"R\",v[,r]);  make a copy R of basering [ring r] with new vars v
     12 defring(\"R\",c,n,v,o);  define a ring R in specified char c, n vars v, ord o
    1113 defrings(n[,p]);       define ring Sn in n vars, char 32003 [p], ord ds
    1214 defringp(n[,p]);       define ring Pn in n vars, char 32003 [p], ord dp
    13  extendring("R",n,v,o); extend given ring by n vars v, ord o and name it R
     15 extendring(\"R\",n,v,o); extend given ring by n vars v, ord o and name it R
    1416 fetchall(R[,str]);     fetch all objects of ring R to basering
    1517 imapall(R[,str]);      imap all objects of ring R to basering
    1618 mapall(R,i[,str]);     map all objects of ring R via ideal i to basering
    17  ringtensor("R",s,t,..);create ring R, tensor product of rings s,t,...
     19 ringtensor(\"R\",s,t,..);create ring R, tensor product of rings s,t,...
    1820           (parameters in square brackets [] are optional)
     21";
    1922
    2023LIB "inout.lib";
  • Singular/LIB/sing.lib

    rfca547 r5480da  
    1 // $Id: sing.lib,v 1.8 1998-01-28 18:47:59 Singular Exp $
     1// $Id: sing.lib,v 1.9 1998-04-03 22:47:13 krueger Exp $
    22//system("random",787422842);
    33//(GMG/BM, last modified 26.06.96)
    44///////////////////////////////////////////////////////////////////////////////
    55
     6version="$Id: sing.lib,v 1.9 1998-04-03 22:47:13 krueger Exp $";
     7info="
    68LIBRARY:  sing.lib      PROCEDURES FOR SINGULARITIES
    79
     
    2325 T2((i);                T2-module of ideal i
    2426 T12(i);                T1- and T2-module of ideal i
     27";
    2528
    2629LIB "inout.lib";
  • Singular/LIB/standard.lib

    rfca547 r5480da  
    1 // $Id: standard.lib,v 1.6 1998-03-06 15:32:23 Singular Exp $
     1// $Id: standard.lib,v 1.7 1998-04-03 22:47:14 krueger Exp $
    22///////////////////////////////////////////////////////////////////////////////
    33
     4version="$Id: standard.lib,v 1.7 1998-04-03 22:47:14 krueger Exp $";
     5info="
    46LIBRARY: standard.lib   PROCEDURES WHICH ARE ALWAYS LOADED AT START-UP
    57
    68 stdfglm(ideal[,ord])   standard basis of the ideal via fglm [and ordering ord]
    79 stdhilbert(ideal)      standard basis of the ideal using the Hilbert function
     10";
     11
    812///////////////////////////////////////////////////////////////////////////////
    913
  • Singular/LIB/tex.lib

    rfca547 r5480da  
    1 // $Id: tex.lib,v 1.4 1998-03-06 11:52:59 krueger Exp $   
     1// $Id: tex.lib,v 1.5 1998-04-03 22:47:15 krueger Exp $   
    22//
    33// author : Christian Gorzel email: gorzelc@math.uni-muenster.de
     
    55///////////////////////////////////////////////////////////////////////////////
    66
    7 
     7version="$Id: tex.lib,v 1.5 1998-04-03 22:47:15 krueger Exp $";
     8info="
    89LIBRARY: tex.lib      PROCEDURES FOR TYPESET OF SINGULAROBJECTS IN TEX
    910                        by Christian Gorzel, send bugs and
     
    3839  TeXaligned    : (int) flag, write mappings (and ideals) aligned
    3940  TeXreplace    : list, entries twoelemented list for replacing symbols
    40   NoDollars     : (int) flag, suppresses surrounding "$" signs
    41 
     41  NoDollars     : (int) flag, suppresses surrounding \"$\" signs
     42";
    4243
    4344///////////////////////////////////////////////////////////////////////////////
  • Singular/LIB/tst.lib

    rfca547 r5480da  
    1 // $Id: tst.lib,v 1.2 1998-02-16 13:23:25 obachman Exp $
     1// $Id: tst.lib,v 1.3 1998-04-03 22:47:15 krueger Exp $
    22//(obachman, last modified 2/13/98)
    33///////////////////////////////////////////////////////////////////////////////
    44
     5version="$Id: tst.lib,v 1.3 1998-04-03 22:47:15 krueger Exp $";
     6info="
    57LIBRARY:  tst.lib      PROCEDURES FOR RUNNING AUTOMATIC TST TESTS
    68
    7  tst_system(s)          returns string which is stdout of system("sh", s)
     9 tst_system(s)          returns string which is stdout of system(\"sh\", s)
    810 tst_ignore(any,[keyword], [link]) writes string(any) to link (or stdout),
    9                                    prepending prefix "// ignore:"
     11                                   prepending prefix \"// ignore:\"
    1012 tst_init()             writes some identification data to stdout
    1113                        with tst_ignore
     14";
     15
    1216///////////////////////////////////////////////////////////////////////////////
    1317
  • Singular/iplib.cc

    rfca547 r5480da  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: iplib.cc,v 1.13 1998-04-03 17:38:40 Singular Exp $ */
     4/* $Id: iplib.cc,v 1.14 1998-04-03 22:46:53 krueger Exp $ */
    55/*
    66* ABSTRACT: interpreter: LIB and help
     
    2121#include "ipshell.h"
    2222#include "lists.h"
     23#ifdef HAVE_LIBPARSER
     24#  include "libparse.h"
     25#endif /* HAVE_LIBPARSER */
    2326
    2427procinfo *iiInitSingularProcinfo(procinfo *pi, char *libname, char *procname,
     
    2629char *iiConvName(char *p);
    2730#ifdef HAVE_LIBPARSER
    28 int yylplex(char *libname, char *libfile);
    2931void yylprestart (FILE *input_file );
    3032int current_pos(int i=0);
     
    3335extern char *yylp_errlist[];
    3436void print_init();
    35 void reinit_yylp();
    3637libstackv library_stack;
    3738#endif
     
    298299  int err;
    299300  procinfov pi = IDPROC(pn);
     301  if(pi->is_static && myynest==0) {
     302    Werror("'%s::%s()' is a local procedure and cannot be accessed by an user.",
     303           pi->libname, pi->procname);
     304    return NULL;
     305  }
    300306  iiCheckNest();
    301307  iiLocalRing[myynest]=currRing;
     
    490496  extern FILE *yylpin;
    491497  libstackv ls_start = library_stack;
     498  lib_style_types lib_style;
    492499
    493500  yylpin = fp;
     
    495502  print_init();
    496503#  endif
    497   yylplex(newlib, libnamebuf);
     504  Warn( "loading %s...", libnamebuf);
     505  yylplex(newlib, libnamebuf, &lib_style);
     506  if(lib_style == OLD_LIBSTYLE)
     507    Warn( "library %s has an old format. Please fix it for the next time",
     508          newlib);
     509  else {
     510    Warn( "loading %s done, version: %s", newlib, text_buffer);
     511    FreeL(text_buffer);
     512  }
    498513  if(yylp_errno) {
    499514    Werror("Library %s: ERROR occured: in line %d, %d.", newlib, yylplineno,
  • Singular/libparse.h

    rfca547 r5480da  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: libparse.h,v 1.1 1998-03-11 12:03:47 Singular Exp $ */
     6/* $Id: libparse.h,v 1.2 1998-04-03 22:46:55 krueger Exp $ */
    77/*
    88* ABSTRACT: lib parsing
    99*/
    1010#include "subexpr.h"
     11typedef enum { LOAD_LIB, GET_INFO } lp_modes;
     12typedef enum { OLD_LIBSTYLE, NEW_LIBSTYLE } lib_style_types;
     13
    1114procinfo *iiInitSingularProcinfo(procinfov pi, char *libname,
    1215                                 char *procname, int line, long pos,
    1316                                 BOOLEAN pstatic = 0);
    14 #endif
     17int yylplex(char *libname, char *libfile, lib_style_types *lib_style,
     18            lp_modes=LOAD_LIB);
     19void reinit_yylp();
     20
     21extern char * text_buffer;
     22
     23#endif /* LIBPARSE_H */
    1524
    1625
  • Singular/libparse.l

    rfca547 r5480da  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 /* $Id: libparse.l,v 1.3 1998-03-11 12:03:46 Singular Exp $ */
     5/* $Id: libparse.l,v 1.4 1998-04-03 22:46:56 krueger Exp $ */
    66#include <stdio.h>
    77#include <string.h>
     
    2727#define YY_SKIP_YYWRAP
    2828
     29typedef enum { LP_NONE, LP_INFO, LP_VERSION} lib_cmds;
     30
    2931int libread(FILE* f, char* buf, int max_size);
    3032int current_pos(int i);
     33void print_version(lp_modes mode, char *p);
     34void copy_string(lp_modes mode);
     35void make_version(char *p, int what);
    3136
    3237int brace1 = 0;  /* { } */
     
    3742int p_static = 0;
    3843int old_state = 0;
     44lib_cmds last_cmd = LP_NONE;
    3945
    4046char libnamebuf[128];
     47char *text_buffer;
     48long string_start;
    4149
    4250char *yylp_buffer_start;
     
    5664   "missing close bracket '}' at end of library in line %d.",    /* 10 */
    5765   "missing close bracket ')' at end of library in line %d.",    /* 11 */
    58    "missing close bracket ']' at end of library in line %d.",    /* 11 */
     66   "missing close bracket ']' at end of library in line %d.",    /* 12 */
    5967   NULL
    6068};
     
    7583#define YYLP_MISS_BR3   12
    7684
    77 print_version(char *p);
    78 
    7985#ifdef STANDALONE_PARSER
    8086procinfov pi;
     
    97103#endif /* STANDALONE_PARSER */
    98104
    99 #define SET_DEF_END(pi, p) \
    100    pi->data.s.def_end = p;
    101 #define SET_HELP_START(pi, p) \
    102    pi->data.s.help_start = p; \
    103 
    104 #define SET_BODY_START(pi, l, p) \
    105    { pi->data.s.body_lineno = l; \
     105#define SET_DEF_END(mode, pi, p) \
     106   if ( mode == LOAD_LIB) pi->data.s.def_end = p;
     107#define SET_HELP_START(mode, pi, p) \
     108   if ( mode == LOAD_LIB) pi->data.s.help_start = p; \
     109
     110#define SET_BODY_START(mode, pi, l, p) \
     111   if ( mode == LOAD_LIB) { \
     112     pi->data.s.body_lineno = l; \
    106113     pi->data.s.body_start = p; \
    107114   }
    108 #define SET_BODY_END(pi, p) { \
    109    pi->data.s.body_end = p-1; \
    110    pi->data.s.proc_end = p-1; \
     115#define SET_BODY_END(mode, pi, p) \
     116   if ( mode == LOAD_LIB) { \
     117     pi->data.s.body_end = p-1; \
     118     pi->data.s.proc_end = p-1; \
    111119   }
    112120
    113 #define SET_EXAMPLE_START(pi, l, p) \
    114    { pi->data.s.example_lineno = l; \
     121#define SET_EXAMPLE_START(mode, pi, l, p) \
     122   if ( mode == LOAD_LIB) { \
     123     pi->data.s.example_lineno = l; \
    115124     pi->data.s.example_start = p; \
    116125   }
    117 #define SET_PROC_END(pi, p) \
    118    { pi->data.s.proc_end = p-1; \
     126#define SET_PROC_END(mode, pi, p) \
     127   if ( mode == LOAD_LIB) { \
     128     pi->data.s.proc_end = p-1; \
    119129     if(pi->data.s.body_end==0) pi->data.s.body_end = p-1; \
    120130   }
    121131
    122132  #undef YY_DECL
    123   #define YY_DECL int yylex(char *newlib, char *libfile)
     133  #define YY_DECL int yylex(char *newlib, char *libfile, \
     134                                 lib_style_types *lib_style, \
     135                                 lp_modes mode = LOAD_LIB)
    124136
    125137  #undef YY_INPUT
     
    133145       yylplineno = 1; \
    134146       yylp_errno = 0; \
     147       *lib_style = OLD_LIBSTYLE; \
    135148       strcpy(libnamebuf,"(**unknown version**)"); \
    136149     }
     
    152165comment        [\/][\/]
    153166dolar          [$]
     167symbols        [~!@#$%^&*()_+-={}\\\|\[\];:,<.>/\?\' \n\~\`]
     168aletters       ({letter}|{digit}|{symbols}|{dolar}|{escquote})
     169strings        ({aletters}*)
     170quote          [\"]
     171escquote       (\\\")
     172taborspace     [ \t]
     173tos            ({taborspace}*)
    154174
    155175/* %start START */
     
    169189%%
    170190(\/\/[^\n]*)|(^#![^\n]*)|([ \t]) { }
    171 \/\*                     { old_state = YYSTATE; BEGIN(comment); }
    172 
    173 static                   { p_static=1; }
     191\/\/*      { old_state = YYSTATE; BEGIN(comment); }
     192
     193info=+"\"" { old_state = YYSTATE; quote++; BEGIN(string);
     194             string_start = current_pos(yyleng);
     195             *lib_style = NEW_LIBSTYLE;
     196             last_cmd = LP_INFO;
     197           }
     198
     199(version=+{quote}+{strings}+{quote})|(version+{tos}+=+{quote}+{strings}+{quote})|(version+{tos}+=+{tos}+{quote}+{strings}+{quote})|(version=+{tos}+{quote}+{strings}+{quote}) {
     200             if ( mode != GET_INFO ) {
     201               make_version(yytext,1);
     202#ifdef STANDALONE_PARSER
     203               printf("Version:%s;\n", libnamebuf);
     204#else
     205               text_buffer = mstrdup(libnamebuf);
     206#endif
     207             }
     208           }
     209
     210static     { p_static=1; }
    174211
    175212(proc[ \t]+{name})|([ \t]proc[ \t]+{name}) {
    176                            char proc[256];
    177                            BEGIN(pdef);
    178 #if YYLPDEBUG
    179                            printf("Newlib:%s\n", newlib);
     213             char proc[256];
     214             BEGIN(pdef);
     215#if YYLPDEBUG
     216             printf("Newlib:%s\n", newlib);
    180217#endif
    181218#ifdef STANDALONE_PARSER
    182                            if(pi!=NULL) {
    183                              printpi(pi);
    184                              pi_clear(pi);
    185                            }
    186                            pi = (procinfo *)malloc(sizeof(procinfo));
    187                            iiInitSingularProcinfo(pi, newlib, yytext+5,
    188                                                       yylplineno,
    189                                                       current_pos(0),
    190                                                       p_static);
     219             if ( pi != NULL ) {
     220               printpi(pi);
     221               pi_clear(pi);
     222             }
     223             pi = (procinfo *)malloc(sizeof(procinfo));
     224             iiInitSingularProcinfo(pi, newlib, yytext+5, yylplineno,
     225                                        current_pos(0), p_static);
    191226#else STANDALONE_PARSER
    192                            proc[0]='\0';
    193                            sscanf( yytext, "%*[^p]proc %s", proc);
    194                            if(strlen(proc)<1) sscanf( yytext, "proc %s", proc);
    195                            h = enterid( mstrdup(proc), myynest, PROC_CMD,
    196                                                &idroot, FALSE );
    197                            if (h!=NULL)
    198                            {
    199                              iiInitSingularProcinfo(IDPROC(h), newlib, proc,
    200                                          yylplineno, current_pos(0),p_static);
    201                              if (BVERBOSE(V_LOAD_PROC))
    202                                  Warn( "     proc %s loaded", proc );
    203                            }
     227             if( mode == LOAD_LIB) {
     228               proc[0]='\0';
     229               sscanf( yytext, "%*[^p]proc %s", proc);
     230               if(strlen(proc)<1) sscanf( yytext, "proc %s", proc);
     231               h = enterid( mstrdup(proc), myynest, PROC_CMD,
     232                                   &idroot, FALSE );
     233               if (h!=NULL) {
     234                 iiInitSingularProcinfo(IDPROC(h), newlib, proc,
     235                                yylplineno, current_pos(0),p_static);
     236                 if (BVERBOSE(V_LOAD_PROC))
     237                   Warn( "     proc %s loaded", proc );
     238               }
    204239#endif STANDALONE_PARSER
    205                            SET_DEF_END(pi, current_pos(yyleng+1));
    206 #if YYLPDEBUG
    207                            printf("PROC %d at %d/%d: (%d) %s\n", p_static,
    208                                   yylplineno, current_pos(0), brace1, yytext);
    209 #endif
    210                            p_static=0;
    211                          }
    212 example                  {
    213                            BEGIN(pexample);
    214                            SET_EXAMPLE_START(pi, yylplineno, current_pos(0));
    215 #if YYLPDEBUG
    216                            printf("EXAMPLE at %d/%d (%d)\n", yylplineno,
    217                                   current_pos(0), brace1);
    218 #endif
    219                          }
    220 
    221 LIB[ \t]+"\""            { quote++;
    222                            BEGIN(libcmd);
    223                          }
    224 
    225 <header>({comment}+[ \t]*+{dolar}+Id:+{string}+[^\n]*)|({comment}+[ \t]*+{dolar}+Header:+{string}+[^\n]*) {
    226                            char ver[10];
    227                            char date[16];
    228                            ver[0]='?'; ver[1]='.'; ver[2]='?'; ver[3]='\0';
    229                            date[0]='?'; date[1]='\0';
    230                            sscanf(yytext,"// %*s %*s %10s %16s",ver,date);
    231                            strcpy(libnamebuf,"(");
    232                            strcat(libnamebuf,ver);
    233                            strcat(libnamebuf,",");
    234                            strcat(libnamebuf,date);
    235                            strcat(libnamebuf,")");
    236                            //printf("ID=%s; \n", yytext);
    237                          }
     240               SET_DEF_END(mode, pi, current_pos(yyleng+1));
     241#if YYLPDEBUG
     242               printf("PROC %d at %d/%d: (%d) %s\n", p_static,
     243                      yylplineno, current_pos(0), brace1, yytext);
     244#endif
     245               p_static=0;
     246             }
     247           }
     248example    {
     249             BEGIN(pexample);
     250             SET_EXAMPLE_START(mode, pi, yylplineno, current_pos(0));
     251#if YYLPDEBUG
     252             printf("EXAMPLE at %d/%d (%d)\n", yylplineno,
     253                    current_pos(0), brace1);
     254#endif
     255           }
     256
     257LIB[ \t]+"\"" { quote++;
     258             BEGIN(libcmd);
     259           }
     260
     261<header>({comment}+{tos}+{dolar}+Id:+{string}+[^\n]*)|({comment}+{tos}+{dolar}+Header:+{string}+[^\n]*) {
     262             make_version(yytext, 0);
     263           }
    238264<header>^{comment}+[^\n]* {
    239265#if YYLPDEBUG > 1
    240                             printf("+HEAD:%s\n", yytext);
    241 #endif
    242                           }
     266             printf("+HEAD:%s\n", yytext);
     267#endif
     268           }
    243269<header>(^#![^\n]*)      {
    244270#if YYLPDEBUG > 1
    245                            printf("-HEAD:%s\n", yytext);
    246 #endif
    247                          }
    248 <header>^proc\           { yyless(0);
    249                            print_version(libfile);
    250                            BEGIN(INITIAL);
    251                            yymore();
    252                          }
     271             printf("-HEAD:%s\n", yytext);
     272#endif
     273           }
     274<header>^proc\  { yyless(0);
     275             print_version(mode, libfile);
     276             BEGIN(INITIAL);
     277             yymore();
     278           }
     279<header>(info=\")|(version=\")|(version+{tos}+=\")|(version+{tos}+=+{tos}+\")|(version=+{tos}+\") { yyless(0);
     280             *lib_style = NEW_LIBSTYLE;
     281             BEGIN(INITIAL);
     282             yymore();
     283           }
     284
    253285<header>^LIB[ \t]+"\""   { quote++;
    254                            print_version(libfile);
    255                            BEGIN(libcmd);
    256                          }
    257 <header>\n               { yylplineno++; }
    258 <header>.                {
     286             print_version(mode, libfile);
     287             BEGIN(libcmd);
     288           }
     289<header>\n { yylplineno++; }
     290<header>.  {
    259291#if YYLPDEBUG > 1
    260                            printf(" HEAD:%s\n", yytext);
    261 #endif
    262                            print_version(libfile);
    263                            BEGIN(help);
    264                          }
     292             printf(" HEAD:%s\n", yytext);
     293#endif
     294             print_version(mode, libfile);
     295             BEGIN(help);
     296           }
    265297<help>^{comment}+[^\n]*  {
    266298#if YYLPDEBUG > 1
    267                            printf(" HELP:%s\n", yytext);
    268 #endif
    269                            BEGIN(INITIAL); }
     299             printf(" HELP:%s\n", yytext);
     300#endif
     301             BEGIN(INITIAL); }
    270302<help>^#![^\n]*          {
    271303#if YYLPDEBUG > 1
    272                            printf(" HELP:%s\n", yytext);
    273 #endif
    274                            BEGIN(INITIAL);
    275                          }
    276 <help>^proc\             { yyless(0);
    277                            //printf("2) proc found.\n");
    278                            BEGIN(INITIAL);
    279                            yymore();
    280                          }
     304             printf(" HELP:%s\n", yytext);
     305#endif
     306             BEGIN(INITIAL);
     307           }
     308<help>^proc\  {
     309             yyless(0);
     310             //printf("2) proc found.\n");
     311             BEGIN(INITIAL);
     312             yymore();
     313           }
    281314<help>^LIB[ \t]+"\""     { quote++;
    282                            BEGIN(libcmd);
    283                          }
    284 
    285 <help>\n                 { yylplineno++; }
    286 <help>.                  {
     315             BEGIN(libcmd);
     316           }
     317
     318<help>\n   { yylplineno++; }
     319<help>.    {
    287320#if YYLPDEBUG > 1
    288                            printf("-HELP:%s\n", yytext);
    289 #endif
    290                          }
     321             printf("-HELP:%s\n", yytext);
     322#endif
     323           }
    291324
    292325
    293326<libcmd>{string}"\""     { quote--;
    294                            yytext[yyleng-1] = '\0';
     327             yytext[yyleng-1] = '\0';
    295328#ifndef STANDALONE_PARSER
    296                            library_stack->push(newlib, yytext);
     329             if ( mode == LOAD_LIB ) {
     330             library_stack->push(newlib, yytext);
     331           }
    297332#endif /* STANDALONE_PARSER */
    298333#if YYLPDEBUG
    299                            printf("LIB:'%s'\n", yytext);
    300 #endif
    301                            BEGIN(INITIAL);
    302                          }
    303 
    304 <pdef>[ \t]              { }
    305 <pdef>\(                 {
    306                            brace2++;
    307 #if YYLPDEBUG
    308                            printf("%s", yytext);
    309 #endif
    310                          }
    311 <pdef>\)                 {
    312                            brace2--;
    313 #if YYLPDEBUG
    314                            printf(">%s<\n", yytext);
    315                            printf("{=%d, (=%d, [=%d\n", brace1, brace2, brace3);
    316 #endif
    317                            if(brace2<=0) {
    318 #if YYLPDEBUG
    319                              printf("BEGIN(phead){=%d, (=%d, [=%d\n", brace1, brace2, brace3);
    320 #endif
    321                              SET_DEF_END(pi, current_pos(yyleng));
    322                              SET_HELP_START(pi, current_pos(yyleng));
    323                              BEGIN(phead);
    324                            }
    325                          }
    326 <pdef>"{"                {
    327                            if(brace2>0) {
    328 #if YYLPDEBUG
    329                              printf("{=%d, (=%d, [=%d\n", brace1, brace2, brace3);
    330 #endif
    331                              yylp_errno = YYLP_DEF_BR2;
    332                              return(1);
    333                            } else {
    334                              brace1++; BEGIN(pbody);
    335                              SET_BODY_START(pi, yylplineno, current_pos(0));
    336                            }
    337                          }
    338 <pdef>\n                 { yylplineno++;
    339                            if(brace2<=0) {
    340 #if YYLPDEBUG
    341                              printf("BEGIN(phead-2){=%d, (=%d, [=%d\n", brace1, brace2, brace3);
    342 #endif
    343                              SET_HELP_START(pi, current_pos(0));
    344                              BEGIN(phead);
    345                            }
    346                          }
    347 <pdef>.                  {
    348                            if(brace2<=0) {
    349                              SET_HELP_START(pi, current_pos(0));
    350                              BEGIN(phead);
    351                            }
    352                          }
     334             printf("LIB:'%s'\n", yytext);
     335#endif
     336             BEGIN(INITIAL);
     337           }
     338
     339<pdef>[ \t] { }
     340<pdef>\(   {
     341             brace2++;
     342#if YYLPDEBUG
     343             printf("%s", yytext);
     344#endif
     345           }
     346<pdef>\)   {
     347             brace2--;
     348#if YYLPDEBUG
     349             printf(">%s<\n", yytext);
     350             printf("{=%d, (=%d, [=%d\n", brace1, brace2, brace3);
     351#endif
     352             if(brace2<=0) {
     353#if YYLPDEBUG
     354               printf("BEGIN(phead){=%d, (=%d, [=%d\n", brace1, brace2, brace3);
     355#endif
     356               SET_DEF_END(mode, pi, current_pos(yyleng));
     357               SET_HELP_START(mode, pi, current_pos(yyleng));
     358               BEGIN(phead);
     359             }
     360           }
     361<pdef>"{"  {
     362             if(brace2>0) {
     363#if YYLPDEBUG
     364               printf("{=%d, (=%d, [=%d\n", brace1, brace2, brace3);
     365#endif
     366               yylp_errno = YYLP_DEF_BR2;
     367               return(1);
     368             } else {
     369               brace1++; BEGIN(pbody);
     370               SET_BODY_START(mode, pi, yylplineno, current_pos(0));
     371             }
     372           }
     373<pdef>\n   { yylplineno++;
     374             if(brace2<=0) {
     375#if YYLPDEBUG
     376               printf("BEGIN(phead-2){=%d, (=%d, [=%d\n", brace1, brace2, brace3);
     377#endif
     378               SET_HELP_START(mode, pi, current_pos(0));
     379               BEGIN(phead);
     380             }
     381           }
     382<pdef>.    {
     383             if(brace2<=0) {
     384               SET_HELP_START(mode, pi, current_pos(0));
     385               BEGIN(phead);
     386             }
     387           }
    353388
    354389<phead>"\\{"             { }
     
    358393                           printf("BEGIN(pbody){=%d, (=%d, [=%d\n", brace1, brace2, brace3);
    359394#endif
    360                            SET_BODY_START(pi, yylplineno, current_pos(0));
     395                           SET_BODY_START(mode, pi, yylplineno, current_pos(0));
    361396#if YYLPDEBUG
    362397                           printf("BODY at %d/%d", yylplineno, current_pos(0));
     
    390425                           }
    391426                           if(brace1<=0) {
    392                              SET_BODY_END(pi, current_pos(yyleng));
    393                              SET_PROC_END(pi, current_pos(yyleng));
     427                             SET_BODY_END(mode, pi, current_pos(yyleng));
     428                             SET_PROC_END(mode, pi, current_pos(yyleng));
    394429#if YYLPDEBUG
    395430                             printf("-%d\n", current_pos(0));
     
    422457
    423458<string>"\""             { quote--;
     459                           copy_string(mode);
     460                           last_cmd = LP_NONE;
    424461                           BEGIN(old_state); /* printf("%s", yytext); */
    425462                         }
    426 <string>\\\\             { }
    427 <string>\\\"             { }
     463<string>(\\\\)|(\\\")    { }
    428464<string>\n               { yylplineno++; }
    429465<string>.                { }
     
    442478                             if(brace3>0) { yylp_errno=YYLP_EX_BR3; return(1); }
    443479                             BEGIN(INITIAL);
    444                              SET_PROC_END(pi, current_pos(yyleng));
     480                             SET_PROC_END(mode, pi, current_pos(yyleng));
    445481                           }
    446482                         }
     
    481517                           yylp_errno = YYLP_BAD_CHAR;
    482518#if YYLPDEBUG
    483                            printf("%s", yytext);
     519                           printf("[%s]", yytext);
    484520#endif
    485521                           return(1);
     
    524560}
    525561
     562void make_version(char *p,int what)
     563{
     564  char ver[10];
     565  char date[16];
     566  ver[0]='?'; ver[1]='.'; ver[2]='?'; ver[3]='\0';
     567  date[0]='?'; date[1]='\0';
     568  if(what) sscanf(p,"%*[^=]= %*s %*s %10s %16s",ver,date);
     569  else sscanf(p,"// %*s %*s %10s %16s",ver,date);
     570  strcpy(libnamebuf,"(");
     571  strcat(libnamebuf,ver);
     572  strcat(libnamebuf,",");
     573  strcat(libnamebuf,date);
     574  strcat(libnamebuf,")");
     575//  printf("ID=(%d)%s; \n", what, p);
     576}
     577
     578void copy_string(lp_modes mode)
     579{
     580  if((last_cmd == LP_INFO)&&(mode == GET_INFO)) {
     581    long current_location = ftell(yylpin);
     582    int len = (int)(current_pos(0) - string_start);
     583    fseek(yylpin, string_start, SEEK_SET);
     584    text_buffer = AllocL(len+1);
     585    fread(text_buffer, len, 1, yylpin);
     586    fseek(yylpin, current_location, SEEK_SET);
     587  }
     588}
     589
    526590void print_init()
    527591{
     
    529593}
    530594
    531 print_version(char *p)
     595void print_version(lp_modes mode, char *p)
    532596{
    533597#ifdef STANDALONE_PARSER
    534    //printf("loading %s%s", p, libnamebuf);
     598  //printf("loading %s%s", p, libnamebuf);
    535599#else
    536    if (BVERBOSE(V_LOAD_LIB))
    537       Warn( "loading %s%s", p, libnamebuf);
     600  if ( mode == LOAD_LIB ) {
     601    if (BVERBOSE(V_LOAD_LIB))
     602       Warn( "loading %s%s", p, libnamebuf);
     603  }
    538604#endif
    539605}
     
    542608main( int argc, char *argv[] )
    543609{
     610  lib_style_types lib_style;
    544611  ++argv, --argc;  /* skip over program name */
    545612  if ( argc > 0 )
    546      yyin = fopen( argv[0], "r" );
     613     yyin = fopen( argv[0], "rb" );
    547614  else
    548615     yyin = stdin;
     
    551618          "function", "line", "start-eod", "line", "body-eop",
    552619          "line", "example-eoe");
    553   yylplex(argv[0], argv[0]);
     620  yylplex(argv[0], argv[0], &lib_style);
    554621  if(yylp_errno) {
    555622    printf("ERROR accured: ");
  • Singular/misc.cc

    rfca547 r5480da  
    2828#include "intvec.h"
    2929#define SI_DONT_HAVE_GLOBAL_VARS
     30
     31#ifdef HAVE_LIBPARSER
     32#  include "libparse.h"
     33#endif /* HAVE_LIBPARSER */
    3034
    3135#ifdef HAVE_FACTORY
     
    362366  {
    363367  /* --------- is it a library ? --------------------------------*/
    364     FILE *fp=feFopen(str,"rb");
     368    char libnamebuf[128];
     369    FILE *fp=feFopen(str,"rb", libnamebuf);
    365370    if (fp!=NULL)
    366371    {
    367       char buf[256];
    368       BOOLEAN found=FALSE;
    369       while (fgets( buf, sizeof(buf), fp))
    370       {
    371         if (strncmp(buf,"//",2)==0)
    372         {
    373           if (found) return;
    374         }
    375         else if ((strncmp(buf,"proc ",5)==0)||(strncmp(buf,"LIB ",4)==0))
    376         {
    377           if (!found) Warn("no help part in library found");
    378           return;
    379         }
    380         else
    381         {
    382           found=TRUE;
    383           PrintS(buf);
    384         }
     372#ifdef HAVE_LIBPARSER
     373      extern FILE *yylpin;
     374      lib_style_types lib_style; // = OLD_LIBSTYLE;
     375     
     376      yylpin = fp;
     377      yylplex(str, libnamebuf, &lib_style, GET_INFO);
     378      reinit_yylp();
     379      if(lib_style == OLD_LIBSTYLE) {
     380        char buf[256];
     381        fseek(fp, 0, SEEK_SET);
     382#else /* HAVE_LIBPARSER */
     383        { char buf[256];
     384#endif /* HAVE_LIBPARSER */
     385        Warn( "library %s has an old format. Please fix it for the next time",
     386              str);
     387        BOOLEAN found=FALSE;
     388        while (fgets( buf, sizeof(buf), fp))
     389          {
     390            if (strncmp(buf,"//",2)==0)
     391              {
     392                if (found) return;
     393              }
     394            else if ((strncmp(buf,"proc ",5)==0)||(strncmp(buf,"LIB ",4)==0))
     395              {
     396                if (!found) Warn("no help part in library found");
     397                return;
     398              }
     399            else
     400              {
     401                found=TRUE;
     402                PrintS(buf);
     403              }
     404          }
     405      } else {
     406        fclose( yylpin );
     407        PrintS(text_buffer);
     408        FreeL(text_buffer);
    385409      }
    386410    }
Note: See TracChangeset for help on using the changeset viewer.