source: git/Singular/fevoices.h @ d7df93

spielwiese
Last change on this file since d7df93 was d7df93, checked in by Hans Schoenemann <hannes@…>, 4 years ago
add: VoiceLine()
  • Property mode set to 100644
File size: 2.6 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_VAR int yylineno;
46EXTERN_VAR char my_yylinebuf[80];
47extern const char sNoName_fe[];
48
49#ifdef __cplusplus
50
51/* the C++-part: */
52
53// LANG_TOP     : Toplevel package only
54// LANG_SINGULAR:
55// LANG_C       :
56//
57
58class Voice
59{
60  public:
61    Voice  * next;
62    Voice  * prev;
63    char   * filename;    // file name or proc name
64    procinfo * pi;        // proc info
65    void   * oldb;        // internal scanner buffer
66    // for files only:
67    FILE * files;         // file handle
68    // for buffers only:
69    char * buffer;        // buffer pointer
70    long   fptr;          // current position in buffer
71    long   ftellptr;      // with glibc 2.22, file position gets lost
72                          // in sig_chld_hdl (ssi:ffork link), see examples/waitall.sing
73
74    int    start_lineno;  // lineno, to restore in recursion
75    int    curr_lineno;   // current lineno
76    feBufferInputs   sw;  // BI_stdin: read from STDIN
77                          // BI_buffer: buffer
78                          // BI_file: files
79    char   ifsw;          // if-switch:
80            /*1 ifsw==0: no if statement, else is invalid
81            *       ==1: if (0) processed, execute else
82            *       ==2: if (1) processed, else allowed but not executed
83            */
84    feBufferTypes   typ;  // buffer type: see BT_..
85
86  Voice() { memset(this,0,sizeof(*this));}
87  feBufferTypes Typ();
88  void Next();
89} ;
90
91EXTERN_VAR Voice  *currentVoice;
92
93Voice * feInitStdin(Voice *pp);
94
95const  char * VoiceName();
96int VoiceLine();
97void    VoiceBackTrack();
98BOOLEAN contBuffer(feBufferTypes typ);
99BOOLEAN exitBuffer(feBufferTypes typ);
100BOOLEAN exitVoice();
101void    monitor(void *F, int mode); /* FILE*, int */
102BOOLEAN newFile(char* fname);
103void    newBuffer(char* s, feBufferTypes t, procinfo *pname = NULL, int start_lineno = 0);
104void *  myynewbuffer();
105void    myyoldbuffer(void * oldb);
106
107#endif
108#endif
109
Note: See TracBrowser for help on using the repository browser.