source: git/Singular/libparse.h @ 7b8818

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