Changeset c4bbf1f in git for Singular/libparse.l


Ignore:
Timestamp:
Apr 22, 1998, 12:37:47 PM (25 years ago)
Author:
Kai Krüger <krueger@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
30ae549770efe9d4bd2b4489572c5cf0f77e7c39
Parents:
03483470cb89c43677d7dc4875a95a0fb672f9a9
Message:
fixes for HAVE_LIBPARSER not def


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

Legend:

Unmodified
Added
Removed
  • Singular/libparse.l

    r0348347 rc4bbf1f  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 /* $Id: libparse.l,v 1.8 1998-04-22 08:40:55 krueger Exp $ */
     5/* $Id: libparse.l,v 1.9 1998-04-22 10:37:46 krueger Exp $ */
    66#include <stdio.h>
    77#include <string.h>
     
    2525
    2626#ifdef HAVE_LIBPARSER
    27 #define YY_SKIP_YYWRAP
     27#  define YY_SKIP_YYWRAP
    2828
    2929typedef enum { LP_NONE, LP_INFO, LP_VERSION} lib_cmds;
     
    6969int yylp_errno = 0;
    7070
    71 #define YYLP_ERR_NONE    0
    72 #define YYLP_DEF_BR2     1
    73 #define YYLP_BODY_BR2    2
    74 #define YYLP_BODY_BR3    3
    75 #define YYLP_BODY_TMBR2  4
    76 #define YYLP_BODY_TMBR3  5
    77 #define YYLP_EX_BR2      6
    78 #define YYLP_EX_BR3      7
    79 #define YYLP_BAD_CHAR    8
    80 #define YYLP_MISSQUOT    9
    81 #define YYLP_MISS_BR1   10
    82 #define YYLP_MISS_BR2   11
    83 #define YYLP_MISS_BR3   12
    84 
    85 #ifdef __MWERKS__
    86 #ifdef __cplusplus
     71#  define YYLP_ERR_NONE    0
     72#  define YYLP_DEF_BR2     1
     73#  define YYLP_BODY_BR2    2
     74#  define YYLP_BODY_BR3    3
     75#  define YYLP_BODY_TMBR2  4
     76#  define YYLP_BODY_TMBR3  5
     77#  define YYLP_EX_BR2      6
     78#  define YYLP_EX_BR3      7
     79#  define YYLP_BAD_CHAR    8
     80#  define YYLP_MISSQUOT    9
     81#  define YYLP_MISS_BR1   10
     82#  define YYLP_MISS_BR2   11
     83#  define YYLP_MISS_BR3   12
     84
     85#  ifdef __MWERKS__
     86#    ifdef __cplusplus
    8787extern "C" {
    88 #endif
    89 #ifdef macintosh
     88#    endif
     89#    ifdef macintosh
    9090int    fileno(FILE *stream);
    9191FILE   *fdopen(int filedes, char *type);
     
    9999long   _tell(int filedes);
    100100int    _isatty(int filedes);
    101 #define fileno  _fileno
    102 #define fdopen  _fdopen
    103 #define ftell    _ftell
    104 #define tell    _tell
    105 #define isatty  _isatty
    106 #endif /* macintosh */
    107 #ifdef __cplusplus
    108 }
    109 #endif
    110 #endif
    111 
    112 #ifdef STANDALONE_PARSER
     101#      define fileno  _fileno
     102#      define fdopen  _fdopen
     103#      define ftell    _ftell
     104#      define tell    _tell
     105#      define isatty  _isatty
     106#    endif /* macintosh */
     107#    ifdef __cplusplus
     108}
     109#    endif
     110#  endif
     111
     112#  ifdef STANDALONE_PARSER
    113113procinfov pi;
    114114printpi(procinfov pi);
     
    117117  int yylpwrap();
    118118}
    119 #else /* STANDALONE_PARSER */
     119#  else /* STANDALONE_PARSER */
    120120idhdl h0;
    121 define pi IDPROC(h0)
     121  define pi IDPROC(h0)
    122122extern "C"
    123123{
     
    125125}
    126126extern libstackv library_stack;
    127 #endif /* STANDALONE_PARSER */
    128 
    129 #define SET_DEF_END(mode, pi, p) \
    130    if ( mode == LOAD_LIB) pi->data.s.def_end = p;
    131 #define SET_HELP_START(mode, pi, p) \
    132    if ( mode == LOAD_LIB) pi->data.s.help_start = p; \
    133 
    134 #define SET_BODY_START(mode, pi, l, p) \
    135    if ( mode == LOAD_LIB) { \
    136      pi->data.s.body_lineno = l; \
    137      pi->data.s.body_start = p; \
    138    }
    139 #define SET_BODY_END(mode, pi, p) \
    140    if ( mode == LOAD_LIB) { \
    141      pi->data.s.body_end = p-1; \
    142      pi->data.s.proc_end = p-1; \
    143    }
    144 
    145 #define SET_EXAMPLE_START(mode, pi, l, p) \
    146    if ( mode == LOAD_LIB) { \
    147      pi->data.s.example_lineno = l; \
    148      pi->data.s.example_start = p; \
    149    }
    150 #define SET_PROC_END(mode, pi, p) \
    151    if ( mode == LOAD_LIB) { \
    152      pi->data.s.proc_end = p-1; \
    153      if(pi->data.s.body_end==0) pi->data.s.body_end = p-1; \
    154    }
    155 
    156   #undef YY_DECL
    157   #define YY_DECL int yylex(char *newlib, char *libfile, \
     127#  endif /* STANDALONE_PARSER */
     128
     129#  define SET_DEF_END(mode, pi, p) \
     130     if ( mode == LOAD_LIB) pi->data.s.def_end = p;
     131#  define SET_HELP_START(mode, pi, p) \
     132     if ( mode == LOAD_LIB) pi->data.s.help_start = p; \
     133
     134#  define SET_BODY_START(mode, pi, l, p) \
     135     if ( mode == LOAD_LIB) { \
     136       pi->data.s.body_lineno = l; \
     137       pi->data.s.body_start = p; \
     138     }
     139#  define SET_BODY_END(mode, pi, p) \
     140     if ( mode == LOAD_LIB) { \
     141       pi->data.s.body_end = p-1; \
     142       pi->data.s.proc_end = p-1; \
     143     }
     144
     145#  define SET_EXAMPLE_START(mode, pi, l, p) \
     146     if ( mode == LOAD_LIB) { \
     147       pi->data.s.example_lineno = l; \
     148       pi->data.s.example_start = p; \
     149     }
     150#  define SET_PROC_END(mode, pi, p) \
     151     if ( mode == LOAD_LIB) { \
     152       pi->data.s.proc_end = p-1; \
     153       if(pi->data.s.body_end==0) pi->data.s.body_end = p-1; \
     154     }
     155
     156undef YY_DECL
     157define YY_DECL int yylex(char *newlib, char *libfile, \
    158158                                 lib_style_types *lib_style, \
    159159                                 lp_modes mode)
    160160
    161   #undef YY_INPUT
    162   #define YY_INPUT(buf,result,max_size) \
     161undef YY_INPUT
     162define YY_INPUT(buf,result,max_size) \
    163163          if ( ((result = libread( (yyin), (char *) buf, max_size )) < 0 ) \
    164164                  && ferror( yyin ) ) \
    165165                YY_FATAL_ERROR( "read in flex scanner failed" );
    166166
    167   #define YY_USER_INIT { \
     167define YY_USER_INIT { \
    168168       BEGIN(header); \
    169169       yylplineno = 1; \
     
    173173     }
    174174
    175 #if 0
     175#  if 0
    176176<pbody>proc[ \t]+{name}  {
    177177                           printf("MISSING: PROC-cmd found. ERROR!\n"); }
     
    179179                           yylplineno++;
    180180                           printf("MISSING: EXAMPLE-cmd found. ERROR!\n"); }
    181 #endif
     181#  endif
    182182%}
    183183
     
    624624void copy_string(lp_modes mode)
    625625{
    626 #ifndef STANDALONE_PARSER
     626#  ifndef STANDALONE_PARSER
    627627  if((last_cmd == LP_INFO)&&(mode == GET_INFO)) {
    628628    long current_location = ftell(yylpin);
     
    633633    fseek(yylpin, current_location, SEEK_SET);
    634634  }
    635 #endif /* STANDALONE_PARSER */
     635#  endif /* STANDALONE_PARSER */
    636636}
    637637
     
    643643void print_version(lp_modes mode, char *p)
    644644{
    645 #ifdef STANDALONE_PARSER
     645#  ifdef STANDALONE_PARSER
    646646  //printf("loading %s%s", p, libnamebuf);
    647 #else
     647#  else
    648648  if ( mode == LOAD_LIB ) {
    649649    if (BVERBOSE(V_LOAD_LIB) && p!=NULL ) Print(" %s...", p);
    650650       //Warn( "loading %s%s", p, libnamebuf);
    651651  }
    652 #endif
    653 }
    654 
    655 #ifdef STANDALONE_PARSER
     652#  endif
     653}
     654
     655#  ifdef STANDALONE_PARSER
    656656main( int argc, char *argv[] )
    657657{
     
    675675}
    676676
    677 #endif /* STANDALONE_PARSER */
     677#  endif /* STANDALONE_PARSER */
    678678#endif /* HAVE_LIBPARSE */
Note: See TracChangeset for help on using the changeset viewer.