1 | #ifndef OUTPUT_H |
---|
2 | #define OUTPUT_H |
---|
3 | /**************************************** |
---|
4 | * Computer Algebra System SINGULAR * |
---|
5 | ****************************************/ |
---|
6 | /* $Id$ */ |
---|
7 | /* |
---|
8 | * ABSTRACT: basic output |
---|
9 | */ |
---|
10 | #include <stdio.h> |
---|
11 | #include <string.h> |
---|
12 | |
---|
13 | #if (SIZEOF_LONG == 8) |
---|
14 | typedef int BOOLEAN; |
---|
15 | /* testet on x86_64, gcc 3.4.6: 2 % */ |
---|
16 | /* testet on IA64, gcc 3.4.6: 1 % */ |
---|
17 | #else |
---|
18 | /* testet on athlon, gcc 2.95.4: 1 % */ |
---|
19 | typedef short BOOLEAN; |
---|
20 | #endif |
---|
21 | |
---|
22 | #ifndef FALSE |
---|
23 | #define FALSE 0 |
---|
24 | #endif |
---|
25 | |
---|
26 | #ifndef TRUE |
---|
27 | #define TRUE 1 |
---|
28 | #endif |
---|
29 | |
---|
30 | |
---|
31 | |
---|
32 | extern char* feErrors; |
---|
33 | extern int feErrorsLen; |
---|
34 | extern FILE* feProtFile; |
---|
35 | extern int pagelength, colmax; |
---|
36 | extern int yy_blocklineno; |
---|
37 | extern int yy_noeof; |
---|
38 | extern const char feNotImplemented[]; |
---|
39 | extern BOOLEAN errorreported; |
---|
40 | extern int feProt; |
---|
41 | extern BOOLEAN feWarn; |
---|
42 | extern BOOLEAN feOut; |
---|
43 | extern int traceit ; |
---|
44 | #define TRACE_SHOW_PROC 1 |
---|
45 | #define TRACE_SHOW_LINENO 2 |
---|
46 | #define TRACE_SHOW_LINE 4 |
---|
47 | #define TRACE_SHOW_RINGS 8 |
---|
48 | #define TRACE_SHOW_LINE1 16 |
---|
49 | #define TRACE_BREAKPOINT 32 |
---|
50 | #define TRACE_TMP_BREAKPOINT 64 |
---|
51 | |
---|
52 | #define PROT_NONE 0 |
---|
53 | #define PROT_I 1 |
---|
54 | #define PROT_O 2 |
---|
55 | #define PROT_IO 3 |
---|
56 | |
---|
57 | /* the C-part: */ |
---|
58 | #define mflush() fflush(stdout) |
---|
59 | |
---|
60 | #ifdef __cplusplus |
---|
61 | extern "C" { |
---|
62 | #endif |
---|
63 | |
---|
64 | void Werror(const char *fmt, ...) __attribute__((format(printf,1,2))); |
---|
65 | void WerrorS(const char *s); |
---|
66 | void WarnS(const char *s); |
---|
67 | void Print(const char* fmt, ...) __attribute__((format(printf,1,2))); |
---|
68 | /* Print should not produce more than strlen(fmt)+510 characters! */ |
---|
69 | |
---|
70 | void PrintNSpaces(const int n); |
---|
71 | void PrintLn(); |
---|
72 | #ifdef HAVE_TCL |
---|
73 | void PrintTCLS(const char c, const char * s); |
---|
74 | #else |
---|
75 | #define PrintTCLS(A,B) Print("TCL-ErrS:%s",B) |
---|
76 | #endif |
---|
77 | void PrintS(const char* s); |
---|
78 | |
---|
79 | #ifdef __cplusplus |
---|
80 | } |
---|
81 | /* the C++-part: */ |
---|
82 | |
---|
83 | #ifdef HAVE_TCL |
---|
84 | |
---|
85 | inline void PrintTCL(const char c, int l,const char *s) |
---|
86 | { |
---|
87 | if (s!=NULL) printf("%c:%d:%s",c,l,s); |
---|
88 | else if(l==0) printf("%c:0:",c); |
---|
89 | else printf("%c:1:%c",c,'0'+l); |
---|
90 | fflush(stdout); |
---|
91 | } |
---|
92 | #else |
---|
93 | #define PrintTCL(A,B,C) Print("TCL-Err:%s",C) |
---|
94 | #endif /* HAVE_TCL */ |
---|
95 | |
---|
96 | char * StringAppend(const char *fmt, ...); |
---|
97 | char * StringAppendS(const char *s); |
---|
98 | char * StringSetS(const char* s); |
---|
99 | void Warn(const char *fmt, ...); |
---|
100 | |
---|
101 | #endif /* c++ only */ |
---|
102 | |
---|
103 | /* everything in between calls to these procedures is printed into a string |
---|
104 | * which is returned by SprintEnd() |
---|
105 | */ |
---|
106 | void SPrintStart(); |
---|
107 | char* SPrintEnd(); |
---|
108 | |
---|
109 | |
---|
110 | #endif /* ifndef OUTPUT_H */ |
---|