[d636ad] | 1 | #ifndef LIBPARSE_H |
---|
| 2 | #define LIBPARSE_H |
---|
| 3 | /**************************************** |
---|
| 4 | * Computer Algebra System SINGULAR * |
---|
| 5 | ****************************************/ |
---|
[341696] | 6 | /* $Id$ */ |
---|
[d636ad] | 7 | /* |
---|
| 8 | * ABSTRACT: lib parsing |
---|
| 9 | */ |
---|
[5480da] | 10 | typedef enum { OLD_LIBSTYLE, NEW_LIBSTYLE } lib_style_types; |
---|
[f2c53c0] | 11 | typedef enum { LOAD_LIB, GET_INFO } lp_modes; |
---|
| 12 | |
---|
| 13 | #ifdef STANDALONE_PARSER |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | #define idhdl void* |
---|
| 17 | #define leftv void* |
---|
| 18 | #define package void* |
---|
| 19 | #define BOOLEAN int |
---|
| 20 | |
---|
| 21 | typedef enum { LANG_NONE, LANG_TOP, LANG_SINGULAR, LANG_C, LANG_MAX} language_defs; |
---|
| 22 | // LANG_TOP : Toplevel package only |
---|
| 23 | // LANG_SINGULAR: |
---|
| 24 | // LANG_C : |
---|
| 25 | // |
---|
| 26 | |
---|
| 27 | class proc_singular |
---|
| 28 | { |
---|
| 29 | public: |
---|
| 30 | long proc_start; // position where proc is starting |
---|
| 31 | long def_end; // position where proc header is ending |
---|
| 32 | long help_start; // position where help is starting |
---|
| 33 | long help_end; // position where help is starting |
---|
| 34 | long body_start; // position where proc-body is starting |
---|
| 35 | long body_end; // position where proc-body is ending |
---|
| 36 | long example_start; // position where example is starting |
---|
| 37 | long proc_end; // position where proc is ending |
---|
| 38 | int proc_lineno; |
---|
| 39 | int body_lineno; |
---|
| 40 | int example_lineno; |
---|
| 41 | char *body; |
---|
| 42 | long help_chksum; |
---|
| 43 | }; |
---|
| 44 | |
---|
| 45 | struct proc_object |
---|
| 46 | { |
---|
| 47 | //public: |
---|
| 48 | BOOLEAN (*function)(leftv res, leftv v); |
---|
| 49 | }; |
---|
| 50 | union uprocinfodata |
---|
| 51 | { |
---|
| 52 | public: |
---|
| 53 | proc_singular s; // data of Singular-procedure |
---|
| 54 | struct proc_object o; // pointer to binary-function |
---|
| 55 | }; |
---|
| 56 | |
---|
| 57 | typedef union uprocinfodata procinfodata; |
---|
| 58 | |
---|
| 59 | class procinfo; |
---|
| 60 | typedef procinfo * procinfov; |
---|
| 61 | |
---|
| 62 | class procinfo |
---|
| 63 | { |
---|
| 64 | public: |
---|
| 65 | char *libname; |
---|
| 66 | char *procname; |
---|
| 67 | package pack; |
---|
| 68 | language_defs language; |
---|
| 69 | short ref; |
---|
| 70 | char is_static; // if set, proc not accessible for user |
---|
| 71 | char trace_flag; |
---|
| 72 | procinfodata data; |
---|
| 73 | }; |
---|
| 74 | #else |
---|
| 75 | #include "febase.h" |
---|
| 76 | #endif |
---|
[5480da] | 77 | |
---|
[f2c53c0] | 78 | procinfo *iiInitSingularProcinfo(procinfo* pi, const char *libname, |
---|
[889f6e] | 79 | const char *procname, int line, long pos, BOOLEAN pstatic=FALSE); |
---|
| 80 | |
---|
[e9ad8a6] | 81 | int yylplex(char *libname, char *libfile, lib_style_types *lib_style, |
---|
[a3bc95e] | 82 | idhdl pl, BOOLEAN autoexport=FALSE, lp_modes=LOAD_LIB); |
---|
[46d09b] | 83 | |
---|
[5480da] | 84 | void reinit_yylp(); |
---|
| 85 | |
---|
| 86 | extern char * text_buffer; |
---|
| 87 | |
---|
[60a3add] | 88 | # define YYLP_ERR_NONE 0 |
---|
| 89 | # define YYLP_DEF_BR2 1 |
---|
| 90 | # define YYLP_BODY_BR2 2 |
---|
| 91 | # define YYLP_BODY_BR3 3 |
---|
| 92 | # define YYLP_BODY_TMBR2 4 |
---|
| 93 | # define YYLP_BODY_TMBR3 5 |
---|
| 94 | # define YYLP_EX_BR2 6 |
---|
| 95 | # define YYLP_EX_BR3 7 |
---|
| 96 | # define YYLP_BAD_CHAR 8 |
---|
| 97 | # define YYLP_MISSQUOT 9 |
---|
| 98 | # define YYLP_MISS_BR1 10 |
---|
| 99 | # define YYLP_MISS_BR2 11 |
---|
| 100 | # define YYLP_MISS_BR3 12 |
---|
| 101 | |
---|
| 102 | # ifdef STANDALONE_PARSER |
---|
[a70441f] | 103 | #ifndef unix |
---|
| 104 | extern FILE* myfopen(char *path, char *mode); |
---|
| 105 | extern size_t myfread(void *ptr, size_t size, size_t nmemb, FILE *stream); |
---|
| 106 | #else |
---|
| 107 | #define myfopen fopen |
---|
| 108 | #define myfread fread |
---|
| 109 | #endif |
---|
[60a3add] | 110 | # endif |
---|
[c1e2b1] | 111 | |
---|
[e9ad8a6] | 112 | #endif /* LIBPARSE_H */ |
---|
[d636ad] | 113 | |
---|
| 114 | |
---|