Changeset cc94b0a in git


Ignore:
Timestamp:
Mar 31, 1998, 11:00:50 AM (25 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
bc82d60fa171675a0c23a3e2051318500187aa39
Parents:
c9ea817ef59b4d9f8adaa507840ddb8ff4d4a945
Message:
Tue Mar 31 10:47:06 MET DST 1998 hannes
        * feread.cc: fixed handling of empty history
	* clapsing.cc: fixed gcd(0,..) and gcd(..,0) -> pOne()
	* febase.h/febase.inc: renaming of scanner variables
	  ( yy_blocklineno, yy_noeof)
	* febase.inc: increased speed in feReadLine
	* minor changes in scanner/grammar/iparith.cc (example)


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

Legend:

Unmodified
Added
Removed
  • Singular/ChangeLog

    rc9ea817 rcc94b0a  
     1Tue Mar 31 10:47:06 MET DST 1998 hannes
     2        * feread.cc: fixed handling of empty history
     3        * clapsing.cc: fixed gcd(0,..) and gcd(..,0) -> pOne()
     4        * febase.h/febase.inc: renaming of scanner variables
     5          ( yy_blocklineno, yy_noeof)
     6        * febase.inc: increased speed in feReadLine
     7        * minor changes in scanner/grammar/iparith.cc (example)
     8
    191998-03-27  Olaf Bachmann  <obachman@mathematik.uni-kl.de>
    210
  • Singular/clapsing.cc

    rc9ea817 rcc94b0a  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 // $Id: clapsing.cc,v 1.25 1998-02-17 15:07:51 obachman Exp $
     5// $Id: clapsing.cc,v 1.26 1998-03-31 09:00:43 Singular Exp $
    66/*
    77* ABSTRACT: interface between Singular and factory
     
    2626poly singclap_gcd ( poly f, poly g )
    2727{
     28  if ((f==NULL)||(g==NULL))
     29    return pOne();
     30
    2831  poly res=NULL;
    2932 
  • Singular/febase.h

    rc9ea817 rcc94b0a  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: febase.h,v 1.8 1998-03-16 14:56:30 obachman Exp $ */
     6/* $Id: febase.h,v 1.9 1998-03-31 09:00:43 Singular Exp $ */
    77/*
    88* ABSTRACT
     
    1818extern int    si_echo, printlevel;
    1919extern int    pagelength, colmax;
    20 extern int    blocklineno;
     20extern int    yy_blocklineno;
     21extern int    yy_noeof;
    2122extern char   prompt_char;
    2223#ifdef HAVE_TCL
  • Singular/febase.inc

    rc9ea817 rcc94b0a  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: febase.inc,v 1.4 1998-03-02 15:22:48 Singular Exp $ */
     4/* $Id: febase.inc,v 1.5 1998-03-31 09:00:42 Singular Exp $ */
    55/*
    66* ABSTRACT: handling of 'voices'
    77*/
    8 
    9 extern int noeof;
    10 int blocklineno;     // to get the lineno of the block start from scanner
     8#include <ctype.h>
     9
     10int    yy_noeof=0;     // the scanner "state"
     11int    yy_blocklineno; // to get the lineno of the block start from scanner
    1112Voice  *currentVoice = NULL;
    12 FILE *feFilePending; /*temp. storage for grammar.y */
     13FILE   *feFilePending; /*temp. storage for grammar.y */
    1314
    1415static char * BT_name[]={"BT_none","BT_break","BT_proc","BT_example",
     
    153154    case BT_if:
    154155    case BT_else:
    155                      yylineno = blocklineno;
     156                     yylineno = yy_blocklineno;
    156157                     break;
    157158    case BT_break:
    158                      yylineno = blocklineno-1;
     159                     yylineno = yy_blocklineno-1;
    159160                     break;
    160161    //case BT_file:
     
    320321    else
    321322    {
    322       currentVoice->prev->ifsw=BI_stdin;
     323      currentVoice->prev->ifsw=0;
    323324    }
    324325    if ((currentVoice->sw == BI_file)
     
    432433{
    433434  // try to read from the buffer:
    434   b[1] = '\0';
     435  // b[1] = '\0';
    435436  if ((currentVoice->buffer!=NULL)
    436437  && (currentVoice->buffer[currentVoice->fptr]!='\0'))
    437438  {
    438439NewBuff:
    439     b[0]=currentVoice->buffer[currentVoice->fptr];
     440    int i=0;
     441    int startfptr=currentVoice->fptr;
     442    l--;
     443    loop
     444    {
     445      char c=
     446      b[i]=currentVoice->buffer[currentVoice->fptr];
     447      i++;
     448      if ((c<' ')
     449      || (c==';')
     450      //|| (c=='(')
     451      || (c==')')
     452      || (c=='}')
     453      || (c=='"')
     454      || (c=='$')) break;
     455      if (i>=l) break;
     456      currentVoice->fptr++;
     457      if(currentVoice->buffer[currentVoice->fptr]=='\0') break;
     458    }
     459    //b[0]=currentVoice->buffer[currentVoice->fptr];
     460    b[i]='\0';
     461    //b[1]='\0';
    440462    if (currentVoice->sw==BI_buffer)
    441463    {
    442       if (currentVoice->fptr==0)
     464      //if (currentVoice->fptr==0)
     465      if (startfptr==0)
    443466      {
    444467        char *anf=currentVoice->buffer;
     
    453476        FreeL((ADDRESS)s);
    454477      }
    455       else if (/*(currentVoice->fptr>0) &&*/
    456       (currentVoice->buffer[currentVoice->fptr-1]=='\n'))
     478      //else if (/*(currentVoice->fptr>0) &&*/
     479      //(currentVoice->buffer[currentVoice->fptr-1]=='\n'))
     480      else if (/*(startfptr>0) &&*/
     481      (currentVoice->buffer[startfptr-1]=='\n'))
    457482      {
    458         char *anf=currentVoice->buffer+currentVoice->fptr;
     483        //char *anf=currentVoice->buffer+currentVoice->fptr;
     484        char *anf=currentVoice->buffer+startfptr;
    459485        char *ss=strchr(anf,'\n');
    460486        int len;
     
    470496    }
    471497    currentVoice->fptr++;
    472     return 1;
     498    return i;
     499    //return 1;
    473500  }
    474501  // no buffer there or e-o-buffer or eoln:
     
    514541  /* else if (s==NULL) */
    515542  {
    516     switch(noeof)
     543    switch(yy_noeof)
    517544    {
    518545      case 0:
  • Singular/feread.cc

    rc9ea817 rcc94b0a  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: feread.cc,v 1.8 1998-03-16 19:07:50 Singular Exp $ */
     4/* $Id: feread.cc,v 1.9 1998-03-31 09:00:40 Singular Exp $ */
    55/*
    66* ABSTRACT: input from ttys, simulating fgets
     
    668668
    669669    /* try to read a history */
     670    using_history();
    670671    read_history (".singular_hist");
    671672  } 
     
    675676{
    676677  /* try to read a history */
    677   if(!feBatch && !fe_use_fgets)
     678  if(!feBatch && !fe_use_fgets && (history_total_bytes()!=0))
    678679    write_history (".singular_hist");
    679680}
  • Singular/grammar.y

    rc9ea817 rcc94b0a  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: grammar.y,v 1.24 1998-03-11 12:03:40 Singular Exp $ */
     4/* $Id: grammar.y,v 1.25 1998-03-31 09:00:46 Singular Exp $ */
    55/*
    66* ABSTRACT: SINGULAR shell grammatik
     
    10371037            }
    10381038          }
    1039         | EXAMPLE_CMD STRINGTOK
     1039        | EXAMPLE_CMD extendedid
    10401040          {
    10411041            singular_help($2,TRUE);
  • Singular/iparith.cc

    rc9ea817 rcc94b0a  
    154154  { "else",        0, ELSE_CMD ,          ELSE_CMD},
    155155  { "eval",        0, EVAL ,              EVAL},
     156  { "example",     0, EXAMPLE_CMD ,       EXAMPLE_CMD},
    156157  { "execute",     0, EXECUTE_CMD ,       EXECUTE_CMD},
    157158  { "export",      0, EXPORT_CMD ,        EXPORT_CMD},
     
    301302
    302303/* other reserved words:scanner.l */
    303   { "pause",       0, -1 ,             0},
     304  { "pause",       2, -1 ,             0},
    304305  { "while",       0, -1 ,             0},
    305306  { "for",         0, -1 ,             0},
    306307  { "help",        0, -1 ,             0},
    307   { "example",     0, -1 ,             0},
    308308  { "newline",     0, -1 ,             0},
    309309  { "exit",        0, -1 ,             0},
     
    21842184{
    21852185  poly p=(poly)v->CopyD();
    2186   pCleardenom(p);
     2186  if (p!=NULL) pCleardenom(p);
    21872187  res->data = (char *)p;
    21882188  return FALSE;
  • Singular/scanner.l

    rc9ea817 rcc94b0a  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 /* $Id: scanner.l,v 1.9 1998-02-27 14:06:24 Singular Exp $ */
     5/* $Id: scanner.l,v 1.10 1998-03-31 09:00:44 Singular Exp $ */
    66#include <stdio.h>
    77#include <string.h>
     
    1919#define ALLOC(a) Alloc((a))
    2020int yylineno  = 0;
    21 int noeof = 0;
    2221static int blocknest = 0;
    2322extern char * yytext;
     
    9493^#![^\n]*                { }
    9594pause[ \t\n]*[\.;]       { fePause(); }
    96 while                    { blocknest = 0; noeof = noeof_brace; BEGIN(brace);
     95while                    { blocknest = 0; yy_noeof = noeof_brace; BEGIN(brace);
    9796                           return WHILE_CMD;}
    98 for                      { blocknest = 0; noeof = noeof_brace; BEGIN(brace);
     97for                      { blocknest = 0; yy_noeof = noeof_brace; BEGIN(brace);
    9998                           return FOR_CMD;}
    10099
    101 ("help"|"?")[ \t\n]*     { noeof = noeof_asstring;
     100("help"|"?")[ \t\n]*     { yy_noeof = noeof_asstring;
    102101                           BEGIN(asstring);
    103102                           return HELP_CMD;
    104                          }
    105 
    106 example[ \t\n]*          { noeof = noeof_asstring;
    107                            IsCmd("example",lvalp->i);
    108                            BEGIN(asstring);
    109                            return EXAMPLE_CMD;
    110103                         }
    111104
     
    113106                           char c; char *cp;
    114107                           lvalp->name = mstrdup(iiProcName((char *)yytext,c,cp));
    115                            noeof = noeof_procname;
     108                           yy_noeof = noeof_procname;
    116109                           blocknest = 1;
    117110                           BEGIN(brace);
     
    120113<asstring>[^;\n]+        {
    121114                           lvalp->name = mstrdup((char *)yytext);
    122                            noeof = 0; BEGIN(INITIAL);
     115                           yy_noeof = 0; BEGIN(INITIAL);
    123116                           return STRINGTOK;
    124117                         }
    125118<asstring>;              {
    126                            noeof = 0; BEGIN(INITIAL);
     119                           yy_noeof = 0; BEGIN(INITIAL);
    127120                           return *yytext;
    128121                         }
    129122
    130123<brace>"\""              {
    131                            noeof = noeof_string;
     124                           yy_noeof = noeof_string;
    132125                           BEGIN(bracestr);
    133126                           yymore();
     
    145138                           if (--blocknest <= 0)
    146139                           {
    147                              noeof = 0;
     140                             yy_noeof = 0;
    148141                             BEGIN(INITIAL);
    149142                             lvalp->name = dupyytext();
     
    153146                         }
    154147<bracestr>"\""           {
    155                            noeof = noeof_brace;
     148                           yy_noeof = noeof_brace;
    156149                           BEGIN(brace);
    157150                           yymore();
     
    170163                         }
    171164<bracket>")"             {
    172                            noeof = 0; BEGIN(INITIAL);
     165                           yy_noeof = 0; BEGIN(INITIAL);
    173166                           return ')';
    174167                         }
    175168
    176169"{"                      {
    177                            blocklineno = yylineno;
     170                           yy_blocklineno = yylineno;
    178171                           blocknest = 1;
    179                            noeof = noeof_block;
     172                           yy_noeof = noeof_block;
    180173                           BEGIN(block);
    181174                         }
    182175<block>"\""              {
    183                            noeof = noeof_string;
     176                           yy_noeof = noeof_string;
    184177                           BEGIN(blockstr);
    185178                           yymore();
     
    189182<blockstr>"\\\""         { yymore(); }
    190183<blockstr>"\""           {
    191                            noeof = noeof_block;
     184                           yy_noeof = noeof_block;
    192185                           BEGIN(block);
    193186                           yymore();
     
    199192                           {
    200193                             BEGIN(INITIAL);
    201                              noeof = 0;
     194                             yy_noeof = 0;
    202195                             lvalp->name = dupyytextNL();
    203196                             return BLOCKTOK;
     
    205198                           yymore();
    206199                         }
    207 "\""                     { BEGIN(string); noeof = noeof_string;}
     200"\""                     { BEGIN(string); yy_noeof = noeof_string;}
    208201~                        { return SYS_BREAK; }
    209202<string>[^\"]            { yymore(); }
     
    212205<string>"\""             {
    213206                           char * s;
    214                            noeof = 0;
     207                           yy_noeof = 0;
    215208                           BEGIN(INITIAL);
    216209                           s = lvalp->name = dupyytext();
Note: See TracChangeset for help on using the changeset viewer.