Changeset c4bbf1f in git for Singular/libparse.l
- Timestamp:
- Apr 22, 1998, 12:37:47 PM (25 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- 30ae549770efe9d4bd2b4489572c5cf0f77e7c39
- Parents:
- 03483470cb89c43677d7dc4875a95a0fb672f9a9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/libparse.l
r0348347 rc4bbf1f 3 3 * Computer Algebra System SINGULAR * 4 4 ****************************************/ 5 /* $Id: libparse.l,v 1. 8 1998-04-22 08:40:55krueger Exp $ */5 /* $Id: libparse.l,v 1.9 1998-04-22 10:37:46 krueger Exp $ */ 6 6 #include <stdio.h> 7 7 #include <string.h> … … 25 25 26 26 #ifdef HAVE_LIBPARSER 27 # define YY_SKIP_YYWRAP27 # define YY_SKIP_YYWRAP 28 28 29 29 typedef enum { LP_NONE, LP_INFO, LP_VERSION} lib_cmds; … … 69 69 int yylp_errno = 0; 70 70 71 # define YYLP_ERR_NONE 072 # define YYLP_DEF_BR2 173 # define YYLP_BODY_BR2 274 # define YYLP_BODY_BR3 375 # define YYLP_BODY_TMBR2 476 # define YYLP_BODY_TMBR3 577 # define YYLP_EX_BR2 678 # define YYLP_EX_BR3 779 # define YYLP_BAD_CHAR 880 # define YYLP_MISSQUOT 981 # define YYLP_MISS_BR1 1082 # define YYLP_MISS_BR2 1183 # define YYLP_MISS_BR3 1284 85 # ifdef __MWERKS__86 # ifdef __cplusplus71 # 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 87 87 extern "C" { 88 # endif89 # ifdef macintosh88 # endif 89 # ifdef macintosh 90 90 int fileno(FILE *stream); 91 91 FILE *fdopen(int filedes, char *type); … … 99 99 long _tell(int filedes); 100 100 int _isatty(int filedes); 101 # define fileno _fileno102 # define fdopen _fdopen103 # define ftell _ftell104 # define tell _tell105 # define isatty _isatty106 # endif /* macintosh */107 # ifdef __cplusplus108 } 109 # endif110 # endif111 112 # ifdef STANDALONE_PARSER101 # 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 113 113 procinfov pi; 114 114 printpi(procinfov pi); … … 117 117 int yylpwrap(); 118 118 } 119 # else /* STANDALONE_PARSER */119 # else /* STANDALONE_PARSER */ 120 120 idhdl h0; 121 # define pi IDPROC(h0)121 # define pi IDPROC(h0) 122 122 extern "C" 123 123 { … … 125 125 } 126 126 extern 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_DECL157 #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 156 # undef YY_DECL 157 # define YY_DECL int yylex(char *newlib, char *libfile, \ 158 158 lib_style_types *lib_style, \ 159 159 lp_modes mode) 160 160 161 #undef YY_INPUT162 #define YY_INPUT(buf,result,max_size) \161 # undef YY_INPUT 162 # define YY_INPUT(buf,result,max_size) \ 163 163 if ( ((result = libread( (yyin), (char *) buf, max_size )) < 0 ) \ 164 164 && ferror( yyin ) ) \ 165 165 YY_FATAL_ERROR( "read in flex scanner failed" ); 166 166 167 #define YY_USER_INIT { \167 # define YY_USER_INIT { \ 168 168 BEGIN(header); \ 169 169 yylplineno = 1; \ … … 173 173 } 174 174 175 # if 0175 # if 0 176 176 <pbody>proc[ \t]+{name} { 177 177 printf("MISSING: PROC-cmd found. ERROR!\n"); } … … 179 179 yylplineno++; 180 180 printf("MISSING: EXAMPLE-cmd found. ERROR!\n"); } 181 # endif181 # endif 182 182 %} 183 183 … … 624 624 void copy_string(lp_modes mode) 625 625 { 626 # ifndef STANDALONE_PARSER626 # ifndef STANDALONE_PARSER 627 627 if((last_cmd == LP_INFO)&&(mode == GET_INFO)) { 628 628 long current_location = ftell(yylpin); … … 633 633 fseek(yylpin, current_location, SEEK_SET); 634 634 } 635 # endif /* STANDALONE_PARSER */635 # endif /* STANDALONE_PARSER */ 636 636 } 637 637 … … 643 643 void print_version(lp_modes mode, char *p) 644 644 { 645 # ifdef STANDALONE_PARSER645 # ifdef STANDALONE_PARSER 646 646 //printf("loading %s%s", p, libnamebuf); 647 # else647 # else 648 648 if ( mode == LOAD_LIB ) { 649 649 if (BVERBOSE(V_LOAD_LIB) && p!=NULL ) Print(" %s...", p); 650 650 //Warn( "loading %s%s", p, libnamebuf); 651 651 } 652 # endif653 } 654 655 # ifdef STANDALONE_PARSER652 # endif 653 } 654 655 # ifdef STANDALONE_PARSER 656 656 main( int argc, char *argv[] ) 657 657 { … … 675 675 } 676 676 677 # endif /* STANDALONE_PARSER */677 # endif /* STANDALONE_PARSER */ 678 678 #endif /* HAVE_LIBPARSE */
Note: See TracChangeset
for help on using the changeset viewer.