Loading...
Searching...
No Matches
fevoices.h
Go to the documentation of this file.
#ifndef FEVOICES_H
#define FEVOICES_H
/****************************************
* * Computer Algebra System SINGULAR *
* ****************************************/
/*
* * ABSTRACT: class Voice
* */
#include "reporter/reporter.h"
#include "resources/feResource.h"
#include "kernel/structs.h"
enum feBufferTypes
{
BT_none = 0, // entry level
BT_break = 1, // while, for
BT_proc, // proc
BT_example, // example
BT_file, // <"file"
BT_execute, // execute
BT_if, // if
BT_else // else
};
enum feBufferInputs
{
BI_stdin = 1,
BI_buffer,
BI_file
};
enum noeof_t
{
noeof_brace = 1,
noeof_asstring,
noeof_block,
noeof_bracket,
noeof_comment,
noeof_procname,
noeof_string
}; /* for scanner.l */
EXTERN_VAR int yylineno;
EXTERN_VAR char my_yylinebuf[80];
extern const char sNoName_fe[];
#ifdef __cplusplus
/* the C++-part: */
// LANG_TOP : Toplevel package only
// LANG_SINGULAR:
// LANG_C :
//
class Voice
{
public:
Voice * next;
Voice * prev;
char * filename; // file name or proc name
procinfo * pi; // proc info
void * oldb; // internal scanner buffer
// for files only:
FILE * files; // file handle
// for buffers only:
char * buffer; // buffer pointer
long fptr; // current position in buffer
long ftellptr; // with glibc 2.22, file position gets lost
// in sig_chld_hdl (ssi:ffork link), see examples/waitall.sing
int buff_size; // malloc size of buffer
int start_lineno; // lineno, to restore in recursion
int curr_lineno; // current lineno
feBufferInputs sw; // BI_stdin: read from STDIN
// BI_buffer: buffer
// BI_file: files
char ifsw; // if-switch:
/*1 ifsw==0: no if statement, else is invalid
* ==1: if (0) processed, execute else
* ==2: if (1) processed, else allowed but not executed
*/
feBufferTypes typ; // buffer type: see BT_..
Voice() { memset(this,0,sizeof(*this));}
feBufferTypes Typ();
void Next();
} ;
EXTERN_VAR Voice *currentVoice;
Voice * feInitStdin(Voice *pp);
const char * VoiceName();
int VoiceLine();
void VoiceBackTrack();
BOOLEAN contBuffer(feBufferTypes typ);
BOOLEAN exitBuffer(feBufferTypes typ);
BOOLEAN exitVoice();
void monitor(void *F, int mode); /* FILE*, int */
BOOLEAN newFile(char* fname);
void newBuffer(char* s, feBufferTypes t, procinfo *pname = NULL, int start_lineno = 0);
void * myynewbuffer();
void myyoldbuffer(void * oldb);
#endif
#endif
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
pp
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f ).
Definition cf_gcd.cc:676
Voice
Definition fevoices.h:59
Voice::curr_lineno
int curr_lineno
Definition fevoices.h:76
Voice::next
Voice * next
Definition fevoices.h:61
Voice::files
FILE * files
Definition fevoices.h:67
Voice::Voice
Voice()
Definition fevoices.h:87
Voice::buffer
char * buffer
Definition fevoices.h:69
Voice::Next
void Next()
Definition fevoices.cc:94
Voice::Typ
feBufferTypes Typ()
Definition fevoices.cc:111
Voice::ftellptr
long ftellptr
Definition fevoices.h:71
Voice::ifsw
char ifsw
Definition fevoices.h:80
Voice::start_lineno
int start_lineno
Definition fevoices.h:75
Voice::pi
procinfo * pi
Definition fevoices.h:64
Voice::buff_size
int buff_size
Definition fevoices.h:73
Voice::filename
char * filename
Definition fevoices.h:63
Voice::sw
feBufferInputs sw
Definition fevoices.h:77
Voice::oldb
void * oldb
Definition fevoices.h:65
Voice::prev
Voice * prev
Definition fevoices.h:62
Voice::typ
feBufferTypes typ
Definition fevoices.h:85
Voice::fptr
long fptr
Definition fevoices.h:70
s
const CanonicalForm int s
Definition facAbsFact.cc:51
feResource.h
yylineno
VAR int yylineno
Definition febase.cc:40
my_yylinebuf
VAR char my_yylinebuf[80]
Definition febase.cc:44
currentVoice
VAR Voice * currentVoice
Definition fevoices.cc:49
sNoName_fe
const char sNoName_fe[]
Definition fevoices.cc:57
feBufferInputs
feBufferInputs
Definition fevoices.h:29
BI_file
@ BI_file
Definition fevoices.h:32
BI_buffer
@ BI_buffer
Definition fevoices.h:31
BI_stdin
@ BI_stdin
Definition fevoices.h:30
myyoldbuffer
void myyoldbuffer(void *oldb)
Definition scanner.cc:2304
noeof_t
noeof_t
Definition fevoices.h:35
noeof_string
@ noeof_string
Definition fevoices.h:42
noeof_brace
@ noeof_brace
Definition fevoices.h:36
noeof_comment
@ noeof_comment
Definition fevoices.h:40
noeof_asstring
@ noeof_asstring
Definition fevoices.h:37
noeof_block
@ noeof_block
Definition fevoices.h:38
noeof_procname
@ noeof_procname
Definition fevoices.h:41
noeof_bracket
@ noeof_bracket
Definition fevoices.h:39
exitBuffer
BOOLEAN exitBuffer(feBufferTypes typ)
Definition fevoices.cc:236
contBuffer
BOOLEAN contBuffer(feBufferTypes typ)
Definition fevoices.cc:304
VoiceName
const char * VoiceName()
Definition fevoices.cc:58
newBuffer
void newBuffer(char *s, feBufferTypes t, procinfo *pname=NULL, int start_lineno=0)
Definition fevoices.cc:166
feBufferTypes
feBufferTypes
Definition fevoices.h:17
BT_none
@ BT_none
Definition fevoices.h:18
BT_else
@ BT_else
Definition fevoices.h:25
BT_if
@ BT_if
Definition fevoices.h:24
BT_break
@ BT_break
Definition fevoices.h:19
BT_example
@ BT_example
Definition fevoices.h:21
BT_execute
@ BT_execute
Definition fevoices.h:23
BT_proc
@ BT_proc
Definition fevoices.h:20
BT_file
@ BT_file
Definition fevoices.h:22
myynewbuffer
void * myynewbuffer()
Definition scanner.cc:2297
VoiceBackTrack
void VoiceBackTrack()
Definition fevoices.cc:77
monitor
void monitor(void *F, int mode)
Definition febase.cc:68
newFile
BOOLEAN newFile(char *fname)
Definition fevoices.cc:129
feInitStdin
Voice * feInitStdin(Voice *pp)
Definition fevoices.cc:677
VoiceLine
int VoiceLine()
Definition fevoices.cc:66
exitVoice
BOOLEAN exitVoice()
Definition fevoices.cc:341
EXTERN_VAR
#define EXTERN_VAR
Definition globaldefs.h:6
NULL
#define NULL
Definition omList.c:12
reporter.h
structs.h
procinfo
Definition subexpr.h:54