fevoices.h
Go to the documentation of this file.
1 #ifndef FEVOICES_H
2 #define FEVOICES_H
3 /****************************************
4  * * Computer Algebra System SINGULAR *
5  * ****************************************/
6 /*
7  * * ABSTRACT: class Voice
8  * */
9 
10 #include <reporter/reporter.h>
11 
12 #include <resources/feResource.h>
13 
14 #include <kernel/structs.h>
15 
17 {
18  BT_none = 0, // entry level
19  BT_break = 1, // while, for
20  BT_proc, // proc
21  BT_example, // example
22  BT_file, // <"file"
23  BT_execute, // execute
24  BT_if, // if
25  BT_else // else
26 };
27 
29 {
30  BI_stdin = 1,
33 };
34 enum noeof_t
35 {
43 }; /* for scanner.l */
44 
45 extern int yylineno;
46 extern char my_yylinebuf[80];
47 
48 #ifdef __cplusplus
49 
50 /* the C++-part: */
51 
52 // LANG_TOP : Toplevel package only
53 // LANG_SINGULAR:
54 // LANG_C :
55 //
56 
57 class Voice
58 {
59  public:
62  char * filename; // file name or proc name
63  procinfo * pi; // proc info
64  void * oldb; // internal scanner buffer
65  // for files only:
66  FILE * files; // file handle
67  // for buffers only:
68  char * buffer; // buffer pointer
69  long fptr; // current position in buffer
70  long ftellptr; // with glibc 2.22, file position gets lost
71  // in sig_chld_hdl (ssi:ffork link), see examples/waitall.sing
72 
73  int start_lineno; // lineno, to restore in recursion
74  int curr_lineno; // current lineno
75  feBufferInputs sw; // BI_stdin: read from STDIN
76  // BI_buffer: buffer
77  // BI_file: files
78  char ifsw; // if-switch:
79  /*1 ifsw==0: no if statement, else is invalid
80  * ==1: if (0) processed, execute else
81  * ==2: if (1) processed, else allowed but not executed
82  */
83  feBufferTypes typ; // buffer type: see BT_..
84 
85  Voice() { memset(this,0,sizeof(*this));}
87  void Next();
88 } ;
89 
90 extern Voice *currentVoice;
91 
93 
94 const char * VoiceName();
95 void VoiceBackTrack();
99 void monitor(void *F, int mode); /* FILE*, int */
100 BOOLEAN newFile(char* fname, FILE *f=NULL);
101 void newBuffer(char* s, feBufferTypes t, procinfo *pname = NULL, int start_lineno = 0);
102 void * myynewbuffer();
103 void myyoldbuffer(void * oldb);
104 
105 #endif
106 #endif
107 
long fptr
Definition: fevoices.h:69
const CanonicalForm int s
Definition: facAbsFact.cc:55
BOOLEAN contBuffer(feBufferTypes typ)
Definition: fevoices.cc:309
BOOLEAN exitVoice()
Definition: fevoices.cc:346
char * buffer
Definition: fevoices.h:68
void Next()
Definition: fevoices.cc:94
feBufferTypes Typ()
Definition: fevoices.cc:111
char * filename
Definition: fevoices.h:62
void * myynewbuffer()
Definition: scanner.cc:2319
void monitor(void *F, int mode)
Definition: febase.cc:72
Definition: fevoices.h:57
Voice * next
Definition: fevoices.h:60
int curr_lineno
Definition: fevoices.h:74
char my_yylinebuf[80]
Definition: febase.cc:48
poly pp
Definition: myNF.cc:296
const char * VoiceName()
Definition: fevoices.cc:66
void VoiceBackTrack()
Definition: fevoices.cc:77
noeof_t
Definition: fevoices.h:34
int start_lineno
Definition: fevoices.h:73
char ifsw
Definition: fevoices.h:78
Definition: fevoices.h:24
BOOLEAN newFile(char *fname, FILE *f=NULL)
Definition: fevoices.cc:129
procinfo * pi
Definition: fevoices.h:63
FILE * f
Definition: checklibs.c:7
feBufferTypes typ
Definition: fevoices.h:83
feBufferInputs
Definition: fevoices.h:28
Voice * prev
Definition: fevoices.h:61
void * oldb
Definition: fevoices.h:64
int yylineno
Definition: febase.cc:45
feBufferTypes
Definition: fevoices.h:16
void myyoldbuffer(void *oldb)
Definition: scanner.cc:2326
#define NULL
Definition: omList.c:10
BOOLEAN exitBuffer(feBufferTypes typ)
Definition: fevoices.cc:241
FILE * files
Definition: fevoices.h:66
Voice * feInitStdin(Voice *pp)
Definition: fevoices.cc:661
feBufferInputs sw
Definition: fevoices.h:75
Voice()
Definition: fevoices.h:85
long ftellptr
Definition: fevoices.h:70
Voice * currentVoice
Definition: fevoices.cc:57
int BOOLEAN
Definition: auxiliary.h:131
void newBuffer(char *s, feBufferTypes t, procinfo *pname=NULL, int start_lineno=0)
Definition: fevoices.cc:171