1 | #ifndef FEBASE_H |
---|
2 | #define FEBASE_H |
---|
3 | /**************************************** |
---|
4 | * Computer Algebra System SINGULAR * |
---|
5 | ****************************************/ |
---|
6 | /* $Id: febase.h,v 1.5 1997-11-18 16:30:57 Singular Exp $ */ |
---|
7 | /* |
---|
8 | * ABSTRACT |
---|
9 | */ |
---|
10 | #include <stdio.h> |
---|
11 | #include "structs.h" |
---|
12 | |
---|
13 | extern int si_echo, printlevel; |
---|
14 | extern int pagelength, colmax; |
---|
15 | extern int voice; |
---|
16 | extern int fileVoice; |
---|
17 | extern char prompt_char; |
---|
18 | extern BOOLEAN tclmode; |
---|
19 | extern int blocklineno; |
---|
20 | extern BOOLEAN errorreported; |
---|
21 | extern short* ifswitch; |
---|
22 | extern BOOLEAN fe_use_fgets; |
---|
23 | extern BOOLEAN feBatch; |
---|
24 | extern char* feErrors; |
---|
25 | extern BOOLEAN feProt; |
---|
26 | extern FILE* feProtFile; |
---|
27 | extern char fe_promptstr[]; |
---|
28 | |
---|
29 | #define PROT_NONE 0 |
---|
30 | #define PROT_I 1 |
---|
31 | #define PROT_O 2 |
---|
32 | #define PROT_IO 3 |
---|
33 | |
---|
34 | /* the C-part: */ |
---|
35 | #ifdef __cplusplus |
---|
36 | extern "C" { |
---|
37 | #endif |
---|
38 | |
---|
39 | void Werror(char *fmt, ...); |
---|
40 | void WerrorS(char *s); |
---|
41 | |
---|
42 | #ifdef __cplusplus |
---|
43 | } |
---|
44 | /* the C++-part: */ |
---|
45 | |
---|
46 | enum /* BufferTypes */ |
---|
47 | { |
---|
48 | BT_break = 1, // while, for |
---|
49 | BT_proc, // proc, script |
---|
50 | BT_example, // example |
---|
51 | BT_file, // <"file" |
---|
52 | BT_execute, // execute |
---|
53 | BT_if, // if |
---|
54 | BT_else // else |
---|
55 | }; |
---|
56 | |
---|
57 | void I_FEbase(void); |
---|
58 | FILE * feFopen(char *path, char *mode, char *where=NULL, int useWerror=FALSE); |
---|
59 | void fePause(void); |
---|
60 | void Print(char* fmt, ...); |
---|
61 | void PrintS(char* s); |
---|
62 | void PrintLn(); |
---|
63 | void PrintTCLS(char c, char * s); |
---|
64 | #ifndef macintosh |
---|
65 | inline void PrintTCL(char c, int l,char *s) |
---|
66 | { |
---|
67 | #ifdef HAVE_TCL |
---|
68 | if (s!=NULL) printf("%c:%d:%s\n",c,l,s); |
---|
69 | else printf("%c:%d:\n",c,l); |
---|
70 | fflush(stdout); |
---|
71 | #endif |
---|
72 | } |
---|
73 | #endif |
---|
74 | |
---|
75 | char * StringAppend(char *fmt, ...); |
---|
76 | char * StringAppendS(char *s); |
---|
77 | char * StringSet(char *fmt, ...); |
---|
78 | char * StringSetS(char* s); |
---|
79 | const char * VoiceName(); |
---|
80 | const char * VoiceName(int v); |
---|
81 | int VoiceType(); |
---|
82 | void WarnS(char *s); |
---|
83 | void Warn(char *fmt, ...); |
---|
84 | int contBuffer(int typ); |
---|
85 | char * eati(char *s, int *i); |
---|
86 | int exitBuffer(int typ); |
---|
87 | int exitVoice(void); |
---|
88 | #define mflush() fflush(stdout) |
---|
89 | void monitor(char* s,int mode); |
---|
90 | void newBuffer(char* s, int t, char *pname = NULL); |
---|
91 | int newVoice(char* fn); |
---|
92 | int readbuf(char* b, int l); |
---|
93 | void showInput(void); |
---|
94 | void * myynewbuffer(); |
---|
95 | void myyoldbuffer(void * oldb); |
---|
96 | |
---|
97 | /* feread.cc: */ |
---|
98 | #ifdef HAVE_FEREAD |
---|
99 | void fe_set_input_mode (void); |
---|
100 | void fe_temp_set (void); |
---|
101 | void fe_temp_reset (void); |
---|
102 | char * fe_fgets_stdin(char *s, int size); |
---|
103 | #ifndef MSDOS |
---|
104 | #ifdef HAVE_ATEXIT |
---|
105 | void fe_reset_input_mode (void); |
---|
106 | #else |
---|
107 | void fe_reset_input_mode (int i, void *v); |
---|
108 | #endif |
---|
109 | #else |
---|
110 | #define fe_reset_input_mode() |
---|
111 | #endif |
---|
112 | #else |
---|
113 | #ifdef HAVE_READLINE |
---|
114 | void fe_set_input_mode (void); |
---|
115 | char * fe_fgets_stdin_rl(char *pr,char *s, int size); |
---|
116 | #define fe_fgets_stdin(A,B) fe_fgets_stdin_rl(fe_promptstr,A,B) |
---|
117 | #else |
---|
118 | #define fe_fgets_stdin(A,B) fgets(A,B,stdin) |
---|
119 | #endif |
---|
120 | #endif |
---|
121 | #endif |
---|
122 | #endif |
---|