source: git/libpolys/reporter/reporter.h @ cb1a06

spielwiese
Last change on this file since cb1a06 was cb1a06, checked in by Hans Schoenemann <hannes@…>, 13 years ago
moved printlevel to kernel/febase.h
  • Property mode set to 100644
File size: 3.4 KB
Line 
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#include <misc/auxiliary.h>
13
14extern char*  feErrors;
15extern int    feErrorsLen;
16extern FILE*  feProtFile;
17extern int    pagelength, colmax;
18extern int    yy_blocklineno;
19extern int    yy_noeof;
20extern const char feNotImplemented[];
21extern BOOLEAN errorreported;
22extern int     feProt;
23extern BOOLEAN feWarn;
24extern BOOLEAN feOut;
25extern int  traceit ;
26#define TRACE_SHOW_PROC   1
27#define TRACE_SHOW_LINENO 2
28#define TRACE_SHOW_LINE   4
29#define TRACE_SHOW_RINGS  8
30#define TRACE_SHOW_LINE1  16
31#define TRACE_BREAKPOINT  32
32#define TRACE_TMP_BREAKPOINT  64
33
34#define PROT_NONE 0
35#define PROT_I    1
36#define PROT_O    2
37#define PROT_IO   3
38
39/* the C-part: */
40#define mflush() fflush(stdout)
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46void    Werror(const char *fmt, ...) __attribute__((format(printf,1,2)));
47void    WerrorS(const char *s);
48void    WarnS(const char *s);
49void    Print(const char* fmt, ...) __attribute__((format(printf,1,2)));
50/* Print should not produce more than strlen(fmt)+510 characters! */
51
52void    PrintNSpaces(const int n);
53void    PrintLn();
54void    PrintS(const char* s);
55
56#ifdef __cplusplus
57}
58/* the C++-part: */
59
60char *  StringAppend(const char *fmt, ...);
61char *  StringAppendS(const char *s);
62char *  StringSetS(const char* s);
63void    Warn(const char *fmt, ...);
64
65const char *  eati(const char *s, int *i);
66
67#endif /* c++ only */
68
69/* everything in between calls to these procedures is printed into a string
70 * which is returned by SprintEnd()
71 * Shall ONLY be used for a temporary redirection of the standard output
72 * (i.e. if Singular runs as a server)
73 */
74void SPrintStart();
75char* SPrintEnd();
76
77/* error reporting */
78#ifdef __cplusplus
79extern "C"
80{
81#endif
82extern int dReportError(const char* fmt, ...);
83#define dReportBug(s) \
84  dReportError("Bug reported: %s\n occured at %s,%d\n", s, __FILE__, __LINE__)
85
86// this is just a dummy procedure which is called after the error
87// has been reported. Within the debugger, set a breakpoint on this
88// proc.
89extern void dErrorBreak();
90#ifdef __cplusplus
91}
92#endif
93
94#ifndef HAVE_ASSUME
95#define assume(x) ((void) 0)
96#define r_assume(x) ((void) 0)
97#else /* ! HAVE_ASSUME */
98
99#define assume_violation(s,f,l) \
100  dReportError("assume violation at %s:%d condition: %s", f,l,s)
101
102#define assume(x)   _assume(x, __FILE__, __LINE__)
103#define r_assume(x) _r_assume(x, __FILE__, __LINE__)
104
105#define _assume(x, f, l)                        \
106do                                              \
107{                                               \
108  if (! (x))                                    \
109  {                                             \
110    assume_violation(#x, f, l);                 \
111  }                                             \
112}                                               \
113while (0)
114
115#define _r_assume(x, f, l)                      \
116do                                              \
117{                                               \
118  if (! (x))                                    \
119  {                                             \
120    assume_violation(#x, f, l);                 \
121    return 0;                                   \
122  }                                             \
123}                                               \
124while (0)
125#endif /* HAVE_ASSUME */
126
127#endif /* ifndef OUTPUT_H */
Note: See TracBrowser for help on using the repository browser.