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

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