Changeset 706c95 in git


Ignore:
Timestamp:
Jul 28, 1999, 7:51:08 PM (25 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
bb78517a1a700b9a02a09333203500c9bf99b4d5
Parents:
e82b5056a1be30c4e177376a20c03847146e8f11
Message:
* hannes: random.lib - back to old version randomLast:
               (faster, less output in tests)
          moved help routines into seperate files: fehelp.*


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

Legend:

Unmodified
Added
Removed
  • Singular/LIB/random.lib

    re82b505 r706c95  
    1 // $Id: random.lib,v 1.8 1999-07-26 13:03:35 Singular Exp $
     1// $Id: random.lib,v 1.9 1999-07-28 17:51:08 Singular Exp $
    22//system("random",787422842);
    33//(GMG/BM, last modified 22.06.96)
    44///////////////////////////////////////////////////////////////////////////////
    55
    6 version="$Id: random.lib,v 1.8 1999-07-26 13:03:35 Singular Exp $";
     6version="$Id: random.lib,v 1.9 1999-07-28 17:51:08 Singular Exp $";
    77info="
    88LIBRARY:  random.lib    PROCEDURES OF RANDOM MATRIX AND POLY OPERATIONS
     
    258258"
    259259{
    260   ideal i = maxideal(1);
    261   i[size(i)] = randomid(maxideal(1),1,b)[1];
    262   return(i);
     260  ideal i=maxideal(1);
     261  int k=size(i);
     262  i[k]=0;
     263  i=randomid(i,size(i),b);
     264  ideal ires=maxideal(1);
     265  ires[k]=i[1]+var(k);
     266  return(ires);
    263267}
    264268example
  • Singular/Makefile.in

    re82b505 r706c95  
    6767CXXSOURCES=grammar.cc scanner.cc algmap.cc attrib.cc binom.cc clapconv.cc \
    6868    clapmem.cc clapsing.cc claptmpl.cc cntrlc.cc \
    69     extra.cc febase.cc feread.cc \
     69    extra.cc febase.cc feread.cc fehelp.cc \
    7070    ffields.cc hdegree.cc hilb.cc hutil.cc \
    7171    ideals.cc intvec.cc iparith.cc \
     
    9797        numbers.h stype.h clapconv.h ipconv.h maps.h page.h \
    9898        subexpr.h clapsing.h ipid.h matpol.h polys.h syz.h \
    99         cntrlc.h ipprint.h ring.h timer.h sdb.h \
     99        cntrlc.h ipprint.h ring.h timer.h sdb.h fehelp.h \
    100100        febase.h ipshell.h shortfl.h tok.h mpr_complex.h mpr_global.h \
    101101        mmemory.h mmprivate.h mmheap.h mmpage.h page.h \
     
    121121
    122122OBJS=grammar.o scanner.o matpol.o binom.o mpr_complex.o gnumpfl.o gnumpc.o \
    123      febase.o feread.o timer.o intvec.o attrib.o lists.o\
     123     febase.o feread.o fehelp.o timer.o intvec.o attrib.o lists.o\
    124124     longrat.o longrat0.o misc.o ring.o numbers.o maps.o\
    125125     hilb.o comm.o kstd1.o kstd2.o kutil.o khstd.o kstdfac.o modulop.o spolys.o\
     
    354354
    355355OBJG1=  grammar.og scanner.og matpol.og binom.og gnumpfl.og mpr_complex.og \
    356      febase.og feread.og timer.og intvec.og attrib.og lists.og gnumpc.og\
    357      longrat.og longrat0.og misc.og ring.og numbers.og maps.og\
     356     febase.og feread.og fehelp.og timer.og intvec.og attrib.og lists.og \
     357     gnumpc.og longrat.og longrat0.og misc.og ring.og numbers.og maps.og\
    358358     hilb.og comm.og kstd1.og kstd2.og kutil.og khstd.og kstdfac.og modulop.og \
    359359     spolys.og ideals.og subexpr.og hdegree.og hutil.og ffields.og shortfl.og \
     
    363363     mminit.og sing_dld.og sing_dbm.og silink.og sparsmat.og\
    364364     sing_mp.og fglm.og fglmzero.og fglmvec.og fglmgauss.og fglmhom.og\
    365      algmap.og clapconv.og  clapmem.og clapsing.og \
    366      cntrlc.og  sdb.og\
     365     algmap.og clapconv.og  clapmem.og clapsing.og cntrlc.og  sdb.og\
    367366     mpsr_Error.og mpsr_Put.og mpsr_PutPoly.og mpsr_GetPoly.og \
    368367     mpsr_Get.og mpsr_GetMisc.og \
     
    431430
    432431OBJP1=  grammar.op scanner.op matpol.op binom.op gnumpfl.op mpr_complex.op \
    433      febase.op feread.op timer.op intvec.op attrib.op lists.op gnumpc.op \
    434      longrat.op longrat0.op misc.op ring.op numbers.op maps.op\
     432     febase.op feread.op fehelp.op timer.op intvec.op attrib.op lists.op \
     433     gnumpc.op longrat.op longrat0.op misc.op ring.op numbers.op maps.op\
    435434     hilb.op comm.op kstd1.op kstd2.op kutil.op khstd.op kstdfac.op modulop.op \
    436435     spolys.op ideals.op subexpr.op hdegree.op hutil.op ffields.op shortfl.op \
  • Singular/febase.h

    re82b505 r706c95  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: febase.h,v 1.30 1999-07-20 12:29:48 Singular Exp $ */
     6/* $Id: febase.h,v 1.31 1999-07-28 17:51:05 Singular Exp $ */
    77/*
    88* ABSTRACT: basic i/o
     
    214214  #endif
    215215#endif
    216 #endif
    217 #endif
     216#endif /* ifndef __MWERKS__ */
    218217
    219218/* everything in between calls to these procedures is printed into a string
     
    222221void SPrintStart();
    223222char* SPrintEnd();
     223#endif /* ifndef FEBASE_H */
  • Singular/grammar.y

    re82b505 r706c95  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: grammar.y,v 1.66 1999-07-28 08:38:58 Singular Exp $ */
     4/* $Id: grammar.y,v 1.67 1999-07-28 17:51:06 Singular Exp $ */
    55/*
    66* ABSTRACT: SINGULAR shell grammatik
     
    3232#include "intvec.h"
    3333#include "febase.h"
     34#include "fehelp.h"
    3435#include "matpol.h"
    3536#include "ring.h"
  • Singular/ipshell.h

    re82b505 r706c95  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: ipshell.h,v 1.18 1999-07-09 14:58:28 Singular Exp $ */
     6/* $Id: ipshell.h,v 1.19 1999-07-28 17:51:07 Singular Exp $ */
    77/*
    88* ABSTRACT
     
    168168/* ================================================================== */
    169169char * versionString();
     170/* ================================================================== */
     171void  singular_example(char *str);
    170172#endif
    171173
  • Singular/misc.cc

    re82b505 r706c95  
    2929#define SI_DONT_HAVE_GLOBAL_VARS
    3030
    31 #ifdef HAVE_LIBPARSER
    32 #  include "libparse.h"
    33 #endif /* HAVE_LIBPARSER */
     31//#ifdef HAVE_LIBPARSER
     32//#  include "libparse.h"
     33//#endif /* HAVE_LIBPARSER */
    3434
    3535#ifdef HAVE_FACTORY
     
    209209#endif
    210210
    211 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
    212 #define HELP_OK        0
    213 
    214 #ifdef buildin_help
    215 
    216 #define FIN_INDEX    '\037'
    217 #define not  !
    218 #define HELP_NOT_OPEN  1
    219 #define HELP_NOT_FOUND 2
    220 #ifndef macintosh
    221 #define Index_File     SINGULAR_INFODIR "/singular.hlp"
    222 #define Help_File      SINGULAR_INFODIR "/singular.hlp"
    223 #else
    224 #define Index_File     SINGULAR_INFODIR "singular.hlp"
    225 #define Help_File      SINGULAR_INFODIR "singular.hlp"
    226 #endif
    227 #define BUF_LEN        128
    228 #define IDX_LEN        64
    229 #define MAX_LINES      21
    230 
    231 static int compare(char *s1,char *s2)
    232 {
    233   for(;*s1==*s2;s1++,s2++)
    234      if(*s2=='\0') return(0);
    235   return(*s2);
    236 }
    237 
    238 #ifdef macintosh
    239 static char tolow(char p)
    240 #else
    241 static inline char tolow(char p)
    242 #endif
    243 {
    244   if (('A'<=p)&&(p<='Z')) return p | 040;
    245   return p;
    246 }
    247 
    248 /*************************************************/
    249 static int show(unsigned long offset,FILE *help, char *close)
    250 { char buffer[BUF_LEN+1];
    251   int  lines = 0;
    252 
    253   if( help== NULL)
    254     if( (help = feFopen(Help_File, "r")) == NULL)
    255       return HELP_NOT_OPEN;
    256 
    257   fseek(help,  (long)(offset+1), (int)0);
    258   while( !feof(help)
    259         && *fgets(buffer, BUF_LEN, help) != EOF
    260         && buffer[0] != FIN_INDEX)
    261   {
    262     printf("%s", buffer);
    263     if(lines++> MAX_LINES)
    264     {
    265 #ifdef macintosh
    266       printf("\n Press <RETURN> to continue or x and <RETURN> to exit help.\n");
    267 #else
    268       printf("\n Press <RETURN> to continue or x to exit help.\n");
    269 #endif
    270       fflush(stdout);
    271       *close = (char)getchar();
    272       if(*close=='x')
    273       {
    274         getchar();
    275         break;
    276       }
    277       lines=0;
    278     }
    279   }
    280   if(*close!='x')
    281   {
    282 #ifdef macintosh
    283     printf("\nEnd of part. Press <RETURN> to continue or x and <RETURN> to exit help.\n");
    284 #else
    285     printf("\nEnd of part. Press <RETURN> to continue or x to exit help.\n");
    286 #endif
    287     fflush(stdout);
    288     *close = (char)getchar();
    289     if(*close=='x')
    290       getchar();
    291   }
    292   return HELP_OK;
    293 }
    294 
    295 /*************************************************/
    296 int singular_manual(char *str)
    297 { FILE *index=NULL,*help=NULL;
    298   unsigned long offset;
    299   char *p,close;
    300   int done = 0;
    301   char buffer[BUF_LEN+1],
    302        Index[IDX_LEN+1],
    303        String[IDX_LEN+1];
    304 
    305   if( (index = feFopen(Index_File, "r",NULL,TRUE)) == NULL)
    306   {
    307     return HELP_NOT_OPEN;
    308   }
    309 
    310   for(p=str; *p; p++) *p = tolow(*p);/* */
    311   do
    312   {
    313     p--;
    314   }
    315   while ((p != str) && (*p<=' '));
    316   p++;
    317   *p='\0';
    318   (void)sprintf(String, " %s ", str);
    319 
    320   while(!feof(index)
    321         && fgets(buffer, BUF_LEN, index) != (char *)0
    322         && buffer[0] != FIN_INDEX);
    323 
    324   while(!feof(index))
    325   {
    326     (void)fgets(buffer, BUF_LEN, index); /* */
    327     (void)sscanf(buffer, "Node:%[^\177]\177%ld\n", Index, &offset);
    328     for(p=Index; *p; p++) *p = tolow(*p);/* */
    329     (void)strcat(Index, " ");
    330     if( strstr(Index, String)!=NULL)
    331     {
    332       done++; (void)show(offset, help, &close);
    333     }
    334     Index[0]='\0';
    335     if(close=='x')
    336     break;
    337   }
    338   (void)fclose(index);
    339   (void)fclose(help);
    340   if(not done)
    341   {
    342     Warn("`%s` not found",String);
    343     return HELP_NOT_FOUND;
    344   }
    345   return HELP_OK;
    346 }
    347 #endif // buildin_help
    348 /*************************************************/
    349 
    350 void singular_help(char *str)
    351 {
    352   char *s=str;
    353   while (*s==' ') s++;
    354   char *ss=s;
    355   while (*ss!='\0') ss++;
    356   while (*ss<=' ')
    357   {
    358     *ss='\0';
    359     ss--;
    360   }
    361 #ifdef HAVE_NAMESPACES
    362   idhdl h, ns;
    363   iiname2hdl(s, &ns, &h);
    364 #else /* HAVE_NAMESPACES */
    365   /* --------- is it a proc ? --------------------------------*/
    366   idhdl h=idroot->get(s,myynest);
    367 #endif /* HAVE_NAMESPACES */
    368   if ((h!=NULL) && (IDTYP(h)==PROC_CMD)
    369   && (strcmp(IDPROC(h)->libname, "standard.lib")!=0))
    370   {
    371     char *lib=iiGetLibName(IDPROC(h));
    372     if((lib!=NULL)&&(*lib!='\0'))
    373     {
    374       Print("// proc %s from lib %s\n",s,lib);
    375       s=iiGetLibProcBuffer(IDPROC(h), 0);
    376       PrintS(s);
    377       FreeL((ADDRESS)s);
    378     }
    379   }
    380   else
    381   {
    382   /* --------- is it a library ? --------------------------------*/
    383     char libnamebuf[128];
    384     FILE *fp=NULL;
    385     if ((str[1]!='\0')
    386     && ((fp=feFopen(str,"rb", libnamebuf))!=NULL))
    387     {
    388 #ifdef HAVE_LIBPARSER
    389       extern FILE *yylpin;
    390       lib_style_types lib_style; // = OLD_LIBSTYLE;
    391 
    392       yylpin = fp;
    393 #  ifdef HAVE_NAMESPACES
    394       yylplex(str, libnamebuf, &lib_style, IDROOT, FALSE, GET_INFO);
    395 #  else /* HAVE_NAMESPACES */
    396       yylplex(str, libnamebuf, &lib_style, GET_INFO);
    397 #  endif /* HAVE_NAMESPACES */
    398       reinit_yylp();
    399       if(lib_style == OLD_LIBSTYLE)
    400       {
    401         char buf[256];
    402         fseek(fp, 0, SEEK_SET);
    403 #else /* HAVE_LIBPARSER */
    404         { char buf[256];
    405 #endif /* HAVE_LIBPARSER */
    406         Warn( "library %s has an old format. Please fix it for the next time",
    407               str);
    408         BOOLEAN found=FALSE;
    409         while (fgets( buf, sizeof(buf), fp))
    410         {
    411           if (strncmp(buf,"//",2)==0)
    412           {
    413             if (found) return;
    414           }
    415           else if ((strncmp(buf,"proc ",5)==0)||(strncmp(buf,"LIB ",4)==0))
    416           {
    417             if (!found) Warn("no help part in library found");
    418             return;
    419           }
    420           else
    421           {
    422             found=TRUE;
    423             PrintS(buf);
    424           }
    425         }
    426       }
    427 #ifdef HAVE_LIBPARSER
    428       else
    429       {
    430         fclose( yylpin );
    431         PrintS(text_buffer);
    432         FreeL(text_buffer);
    433         text_buffer=NULL;
    434       }
    435 #endif /* HAVE_LIBPARSER */
    436     }
    437   /* --------- everything else is for the manual ----------------*/
    438     else
    439     {
    440 #ifdef HAVE_TCL
    441       if(!tclmode)
    442 #endif
    443      #ifdef buildin_help
    444         singular_manual(str);
    445      #else
    446         system(feGetInfoCall(str));
    447      #ifndef MSDOS
    448       //sprintf(tmp,"clear");
    449       //system(tmp);
    450      #endif
    451 #endif
    452     }
    453   }
    454 }
    455 
    456211void singular_example(char *str)
    457212{
  • Singular/structs.h

    re82b505 r706c95  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: structs.h,v 1.21 1999-07-28 08:39:00 Singular Exp $ */
     6/* $Id: structs.h,v 1.22 1999-07-28 17:51:07 Singular Exp $ */
    77/*
    88* ABSTRACT
     
    200200#ifdef __cplusplus
    201201int   inits(void);
    202 void  singular_help(char *str);
    203 void  singular_example(char *str);
    204 #ifdef buildin_help
    205 int   singular_manual(char *str);
    206 #endif
    207202#ifdef buildin_rand
    208203extern int siSeed;
Note: See TracChangeset for help on using the changeset viewer.