Changeset df595d in git


Ignore:
Timestamp:
Apr 27, 1998, 12:55:56 PM (26 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
e9a5b9f04c03846bd8c017cf227e7f9b1dc2e264
Parents:
1387fc63c740eb636ccead6aacbb9969235f1dfd
Message:
*** empty log message ***


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

Legend:

Unmodified
Added
Removed
  • Singular/libparse.l

    r1387fc6 rdf595d  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 /* $Id: libparse.l,v 1.10 1998-04-22 14:29:26 krueger Exp $ */
     5/* $Id: libparse.l,v 1.11 1998-04-27 10:55:55 Singular Exp $ */
    66#include <stdio.h>
    77#include <string.h>
     
    5151int yylplineno = 1;
    5252
    53 char *yylp_errlist[]= { 
     53char *yylp_errlist[]= {
    5454   "",
    5555   "missing close bracket ')' for proc definition in line %d.",  /*  1 */
     
    156156#  undef YY_DECL
    157157#  define YY_DECL int yylex(char *newlib, char *libfile, \
    158                                 lib_style_types *lib_style, \
    159                                 lp_modes mode)
     158                                lib_style_types *lib_style, \
     159                                lp_modes mode)
    160160
    161161#  undef YY_INPUT
    162162#  define YY_INPUT(buf,result,max_size) \
    163163          if ( ((result = libread( (yyin), (char *) buf, max_size )) < 0 ) \
    164                   && ferror( yyin ) ) \
    165                 YY_FATAL_ERROR( "read in flex scanner failed" );
     164                  && ferror( yyin ) ) \
     165                YY_FATAL_ERROR( "read in flex scanner failed" );
    166166
    167167#  define YY_USER_INIT { \
     
    174174
    175175#  if 0
    176 <pbody>proc[ \t]+{name}  { 
     176<pbody>proc[ \t]+{name}  {
    177177                           printf("MISSING: PROC-cmd found. ERROR!\n"); }
    178 <pbody>example[ \t]*\n   { 
     178<pbody>example[ \t]*\n   {
    179179                           yylplineno++;
    180180                           printf("MISSING: EXAMPLE-cmd found. ERROR!\n"); }
     
    219219             *lib_style = NEW_LIBSTYLE;
    220220             last_cmd = LP_INFO;
    221            } 
     221           }
    222222
    223223(version=+{quote}+{strings}+{quote})|(version+{tos}+=+{quote}+{strings}+{quote})|(version+{tos}+=+{tos}+{quote}+{strings}+{quote})|(version=+{tos}+{quote}+{strings}+{quote}) {
     
    248248               pi = (procinfo *)malloc(sizeof(procinfo));
    249249               iiInitSingularProcinfo(pi, newlib, yytext+5, yylplineno,
    250                                         current_pos(0), p_static);
     250                                        current_pos(0), p_static);
    251251#else STANDALONE_PARSER
    252252             if( mode == LOAD_LIB) {
     
    255255               if(strlen(proc)<1) sscanf( yytext, "proc %s", proc);
    256256               h0 = enterid( mstrdup(proc), myynest, PROC_CMD,
    257                                    &idroot, FALSE );
     257                                   &idroot, FALSE );
    258258               if (h0!=NULL) {
    259259                 iiInitSingularProcinfo(IDPROC(h0), newlib, proc,
    260                                 yylplineno, current_pos(0),p_static);
     260                                yylplineno, current_pos(0),p_static);
    261261                 if (BVERBOSE(V_LOAD_PROC))
    262262                   Warn( "     proc %s loaded", proc );
     
    266266#if YYLPDEBUG
    267267               printf("PROC %d at %d/%d: (%d) %s\n", p_static,
    268                       yylplineno, current_pos(0), brace1, yytext);
     268                      yylplineno, current_pos(0), brace1, yytext);
    269269#endif
    270270               p_static=FALSE;
     
    278278#if YYLPDEBUG
    279279             printf("EXAMPLE at %d/%d (%d)\n", yylplineno,
    280                     current_pos(0), brace1);
     280                    current_pos(0), brace1);
    281281#endif
    282282           }
     
    287287
    288288<header>({comment}+{tos}+{dolar}+Id:+{string}+[^\n]*)|({comment}+{tos}+{dolar}+Header:+{string}+[^\n]*) {
    289              make_version(yytext, 0); 
     289             make_version(yytext, 0);
    290290             //print_version(mode, "");
    291291#if YYLPDEBUG > 1
     
    293293#endif
    294294           }
    295 <header>(^{comment}+[^\n]*) { 
     295<header>(^{comment}+[^\n]*) {
    296296#if YYLPDEBUG > 1
    297297             printf("+(cmt)HEAD:%s\n", yytext);
    298298#endif
    299299           }
    300 <header>(^#![^\n]*) { 
     300<header>(^#![^\n]*) {
    301301#if YYLPDEBUG > 1
    302302             printf("-HEAD:%s\n", yytext);
     
    319319           }
    320320<header>\n { yylplineno++; }
    321 <header>.  { 
     321<header>.  {
    322322#if YYLPDEBUG > 1
    323323             printf(" HEAD:%s\n", yytext);
     
    326326             BEGIN(help);
    327327           }
    328 <help>(^{comment}+[^\n]*)  { 
     328<help>(^{comment}+[^\n]*)  {
    329329#if YYLPDEBUG > 1
    330330             printf(" HELP:%s\n", yytext);
    331331#endif
    332332             BEGIN(INITIAL); }
    333 <help>(^#![^\n]*) { 
     333<help>(^#![^\n]*) {
    334334#if YYLPDEBUG > 1
    335335             printf(" HELP:%s\n", yytext);
     
    353353
    354354<help>\n { yylplineno++; }
    355 <help>.    { 
     355<help>.    {
    356356#if YYLPDEBUG > 1
    357357             printf("-HELP:%s\n", yytext);
     
    374374
    375375<pdef>[ \t] { }
    376 <pdef>\(   { 
     376<pdef>\(   {
    377377             brace2++;
    378378#if YYLPDEBUG
     
    380380#endif
    381381           }
    382 <pdef>\)   { 
     382<pdef>\)   {
    383383             brace2--;
    384384#if YYLPDEBUG
     
    395395             }
    396396           }
    397 <pdef>"{"  { 
     397<pdef>"{"  {
    398398             if(brace2>0) {
    399399#if YYLPDEBUG
     
    402402               yylp_errno = YYLP_DEF_BR2;
    403403               return(1);
    404              } else { 
     404             } else {
    405405               brace1++; BEGIN(pbody);
    406406               SET_BODY_START(mode, pi, yylplineno, current_pos(0));
     
    408408           }
    409409<pdef>\n { yylplineno++;
    410               if(brace2<=0) { 
     410              if(brace2<=0) {
    411411#if YYLPDEBUG
    412412                printf("BEGIN(phead-2){=%d, (=%d, [=%d\n", brace1, brace2, brace3);
     
    416416              }
    417417            }
    418 <pdef>.    { 
    419              if(brace2<=0) { 
     418<pdef>.    {
     419             if(brace2<=0) {
    420420               SET_HELP_START(mode, pi, current_pos(0));
    421421               BEGIN(phead);
     
    441441                           BEGIN(string); /* printf("%s", yytext); */
    442442                         }
    443 <pbody>"{"               { 
     443<pbody>"{"               {
    444444                           brace1++;
    445445#if YYLPDEBUG
     
    447447#endif
    448448                         }
    449 <pbody>"}"               { 
     449<pbody>"}"               {
    450450#if YYLPDEBUG
    451451                           printf("line: %d, (%d)%s\n", yylplineno, brace1, yytext);
    452452#endif
    453453                           brace1--;
    454                            if(brace2>0) { 
     454                           if(brace2>0) {
    455455                             yylp_errno = YYLP_BODY_BR2;
    456456                             return(1);
     
    469469                           }
    470470                         }
    471 <pbody>"("               { 
     471<pbody>"("               {
    472472                           brace2++; /* printf("%s", yytext); */
    473473                         }
    474 <pbody>")"               { 
     474<pbody>")"               {
    475475                           brace2--; /* printf("%s", yytext); */
    476                            if(brace2<0) { 
     476                           if(brace2<0) {
    477477                             yylp_errno = YYLP_BODY_TMBR2;
    478478                             return(1);
    479479                           }
    480480                         }
    481 <pbody>"["               { 
     481<pbody>"["               {
    482482                           brace3++; /* printf("%s", yytext); */
    483483                         }
    484 <pbody>"]"               { 
     484<pbody>"]"               {
    485485                           brace3--; /* printf("%s", yytext); */
    486486                           if(brace3<0) {
     
    505505                           BEGIN(string); /* printf("%s", yytext); */
    506506                         }
    507 <pexample>"{"            { 
     507<pexample>"{"            {
    508508                           brace1++; /* printf("(%d)%s", brace1, yytext); */
    509509                         }
    510 <pexample>"}"            { 
     510<pexample>"}"            {
    511511                           brace1--; /* printf("(%d)%s", brace1, yytext); */
    512512                           if(brace1<=0) {
     
    517517                           }
    518518                         }
    519 <pexample>"("            { 
     519<pexample>"("            {
    520520                           brace2++; /* printf("%s", yytext); */
    521521                         }
    522 <pexample>")"            { 
     522<pexample>")"            {
    523523                           brace2--; /* printf("%s", yytext); */
    524524                         }
    525 <pexample>"["            { 
     525<pexample>"["            {
    526526                           brace3++; /* printf("%s", yytext); */
    527527                         }
    528 <pexample>"]"            { 
     528<pexample>"]"            {
    529529                           brace3--; /* printf("%s", yytext); */
    530530                         }
     
    551551#endif
    552552                         }
    553 .                        { p_static = FALSE; 
     553.                        { p_static = FALSE;
    554554                           yylp_errno = YYLP_BAD_CHAR;
    555                            printf("[%s\d]", *yytext);
     555                           printf("[%d]", *yytext);
    556556#if YYLPDEBUG
    557557                           printf("[%s]", yytext);
     
    587587
    588588extern "C" {
    589   int yylpwrap() { 
     589  int yylpwrap() {
    590590    //printf("======================= YYWRAP ====================\n");
    591591    if(brace1>0) { yylp_errno=YYLP_MISS_BR1; }
     
    627627{
    628628#  ifndef STANDALONE_PARSER
    629   if((last_cmd == LP_INFO)&&(mode == GET_INFO)) {
     629  if((last_cmd == LP_INFO)&&(mode == GET_INFO))
     630  {
    630631    long current_location = ftell(yylpin);
    631632    int len = (int)(current_pos(0) - string_start);
    632633    fseek(yylpin, string_start, SEEK_SET);
    633634    text_buffer = (char *)AllocL(len+1);
     635    text_buffer[len]='\0';
    634636    fread(text_buffer, len, 1, yylpin);
    635637    fseek(yylpin, current_location, SEEK_SET);
     
    666668
    667669  printf( "  %-15s  %20s      %s,%s    %s,%s     %s,%s\n", "Library",
    668           "function", "line", "start-eod", "line", "body-eob",
    669           "line", "example-eoe");
     670          "function", "line", "start-eod", "line", "body-eob",
     671          "line", "example-eoe");
    670672  yylplex(argv[0], argv[0], &lib_style);
    671673  if(yylp_errno) {
     
    673675    printf(yylp_errlist[yylp_errno], yylplineno);
    674676    printf("\n");
    675   } 
     677  }
    676678  else if(pi!=NULL) printpi(pi);
    677679}
  • Singular/misc.cc

    r1387fc6 rdf595d  
    373373      extern FILE *yylpin;
    374374      lib_style_types lib_style; // = OLD_LIBSTYLE;
    375      
     375
    376376      yylpin = fp;
    377377      yylplex(str, libnamebuf, &lib_style, GET_INFO);
    378378      reinit_yylp();
    379       if(lib_style == OLD_LIBSTYLE) {
    380         char buf[256];
    381         fseek(fp, 0, SEEK_SET);
     379      if(lib_style == OLD_LIBSTYLE)
     380      {
     381        char buf[256];
     382        fseek(fp, 0, SEEK_SET);
    382383#else /* HAVE_LIBPARSER */
    383         { char buf[256];
     384        { char buf[256];
    384385#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           }
     386        Warn( "library %s has an old format. Please fix it for the next time",
     387              str);
     388        BOOLEAN found=FALSE;
     389        while (fgets( buf, sizeof(buf), fp))
     390        {
     391          if (strncmp(buf,"//",2)==0)
     392          {
     393            if (found) return;
     394          }
     395          else if ((strncmp(buf,"proc ",5)==0)||(strncmp(buf,"LIB ",4)==0))
     396          {
     397            if (!found) Warn("no help part in library found");
     398            return;
     399          }
     400          else
     401          {
     402            found=TRUE;
     403            PrintS(buf);
     404          }
     405        }
    405406      }
    406407#ifdef HAVE_LIBPARSER
    407       else {
    408         fclose( yylpin );
    409         PrintS(text_buffer);
    410         FreeL(text_buffer);
     408      else
     409      {
     410        fclose( yylpin );
     411        PrintS(text_buffer);
     412        FreeL(text_buffer);
    411413      }
    412414#endif /* HAVE_LIBPARSER */
Note: See TracChangeset for help on using the changeset viewer.