source: git/Singular/fevoices.h @ fa167e

fieker-DuValspielwiese
Last change on this file since fa167e was cf19a8, checked in by Hans Schoenemann <hannes@…>, 10 years ago
chg: feVoices: kernel/structs.h ->Singular/fevoices.h
  • Property mode set to 100644
File size: 2.4 KB
Line 
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
16enum   feBufferTypes
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
28enum   feBufferInputs
29{
30  BI_stdin = 1,
31  BI_buffer,
32  BI_file
33};
34enum noeof_t
35{
36  noeof_brace = 1,
37  noeof_asstring,
38  noeof_block,
39  noeof_bracket,
40  noeof_comment,
41  noeof_procname,
42  noeof_string
43};  /* for scanner.l */
44
45extern int yylineno;
46extern 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
57class Voice
58{
59  public:
60    Voice  * next;
61    Voice  * prev;
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
71    int    start_lineno;  // lineno, to restore in recursion
72    int    curr_lineno;   // current lineno
73    feBufferInputs   sw;  // BI_stdin: read from STDIN
74                          // BI_buffer: buffer
75                          // BI_file: files
76    char   ifsw;          // if-switch:
77            /*1 ifsw==0: no if statement, else is invalid
78            *       ==1: if (0) processed, execute else
79            *       ==2: if (1) processed, else allowed but not executed
80            */
81    feBufferTypes   typ;  // buffer type: see BT_..
82
83  Voice() { memset(this,0,sizeof(*this));}
84  feBufferTypes Typ();
85  void Next();
86} ;
87
88extern Voice  *currentVoice;
89
90Voice * feInitStdin(Voice *pp);
91
92const  char * VoiceName();
93void    VoiceBackTrack();
94BOOLEAN contBuffer(feBufferTypes typ);
95BOOLEAN exitBuffer(feBufferTypes typ);
96BOOLEAN exitVoice();
97void    monitor(void *F, int mode); /* FILE*, int */
98BOOLEAN newFile(char* fname, FILE *f=NULL);
99void    newBuffer(char* s, feBufferTypes t, procinfo *pname = NULL, int start_lineno = 0);
100void *  myynewbuffer();
101void    myyoldbuffer(void * oldb);
102
103#endif
104#endif
105
Note: See TracBrowser for help on using the repository browser.