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

spielwiese
Last change on this file since a97ac0 was a97ac0, checked in by Hans Schoenemann <hannes@…>, 10 years ago
chg: messages about assign/conversion/calling: option(warn) -> TRACE from master
  • Property mode set to 100644
File size: 3.6 KB
RevLine 
[ebcfee3]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>
[f093ba]11#include <misc/auxiliary.h>
[2c889f]12#include <resources/feFopen.h>
[3a4bda]13
[ebcfee3]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
[a97ac0]32#define TRACE_CALL       128
33#define TRACE_ASSIGN     256
34#define TRACE_CONV       512
35
[ebcfee3]36
[e5ecb5]37#define SI_PROT_I    1
38#define SI_PROT_O    2
39#define SI_PROT_IO   3
[ebcfee3]40
41/* the C-part: */
42#define mflush() fflush(stdout)
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48void    Werror(const char *fmt, ...) __attribute__((format(printf,1,2)));
[854405]49void    WerrorS_batch(const char *s);
[ebcfee3]50void    WarnS(const char *s);
51void    Print(const char* fmt, ...) __attribute__((format(printf,1,2)));
52/* Print should not produce more than strlen(fmt)+510 characters! */
53
54void    PrintNSpaces(const int n);
55void    PrintLn();
56void    PrintS(const char* s);
57
58#ifdef __cplusplus
59}
60/* the C++-part: */
61
[538512]62void  StringAppend(const char *fmt, ...);
63void  StringAppendS(const char *s);
64void  StringSetS(const char* s);
65char * StringEndS();
66void  Warn(const char *fmt, ...);
[ebcfee3]67
[9c83f2]68const char *  eati(const char *s, int *i);
69
[f323dd1]70// Prints resources into string with StringAppend, etc
71void feStringAppendResources(int warn = -1);
[ebcfee3]72#endif /* c++ only */
73
74/* everything in between calls to these procedures is printed into a string
75 * which is returned by SprintEnd()
[31cbb08]76 * Shall ONLY be used for a temporary redirection of the standard output
77 * (i.e. if Singular runs as a server)
[ebcfee3]78 */
79void SPrintStart();
80char* SPrintEnd();
81
[508610a]82/* error reporting */
83#ifdef __cplusplus
84extern "C"
85{
86#endif
87extern int dReportError(const char* fmt, ...);
88#define dReportBug(s) \
89  dReportError("Bug reported: %s\n occured at %s,%d\n", s, __FILE__, __LINE__)
90
91// this is just a dummy procedure which is called after the error
92// has been reported. Within the debugger, set a breakpoint on this
93// proc.
94extern void dErrorBreak();
95#ifdef __cplusplus
96}
97#endif
98
[8948da]99#ifndef HAVE_ASSUME
[d101b1]100#define assume(x) do {} while (0)
101#define r_assume(x) do {} while (0)
[8948da]102#else /* ! HAVE_ASSUME */
103
104#define assume_violation(s,f,l) \
105  dReportError("assume violation at %s:%d condition: %s", f,l,s)
106
107#define assume(x)   _assume(x, __FILE__, __LINE__)
108#define r_assume(x) _r_assume(x, __FILE__, __LINE__)
109
110#define _assume(x, f, l)                        \
111do                                              \
112{                                               \
113  if (! (x))                                    \
114  {                                             \
115    assume_violation(#x, f, l);                 \
116  }                                             \
117}                                               \
118while (0)
119
120#define _r_assume(x, f, l)                      \
121do                                              \
122{                                               \
123  if (! (x))                                    \
124  {                                             \
125    assume_violation(#x, f, l);                 \
126    return 0;                                   \
127  }                                             \
128}                                               \
129while (0)
130#endif /* HAVE_ASSUME */
[ebcfee3]131
132#endif /* ifndef OUTPUT_H */
Note: See TracBrowser for help on using the repository browser.