File: feedback2.h

package info (click to toggle)
pymol 2.5.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 42,288 kB
  • sloc: cpp: 476,472; python: 76,538; ansic: 29,510; javascript: 6,792; sh: 47; makefile: 24
file content (125 lines) | stat: -rw-r--r-- 3,104 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125

#ifndef _H_Feedback
#define _H_Feedback

/* 

IMPORTANT DEVELOPER NOTICE:

All non-debugging output should pass through the PRINTF and ENDF
macros currently defined below, or through the FeedbackAdd or
FeedbackAutoAdd routines.

Feedback bits are:

results -- DEFAULT: ON

output from a definite action which gives a result, such as an RMS
fit, a measured surface area, etc.

errors -- DEFAULT: ON

complaints which will cause failure at some level.

actions -- DEFAULT: ON

Output regarding actions in progress or completed, but which
don't return a particular result.  Example: loading an object or
creating a selection.

warnings -- DEFAULT: ON

Questionable situations which will not necessarily result in task
failure.  

details -- DEFAULT: ON

Verbose output reflecting details about what is going on.

blather -- DEFAULT: OFF

Output which doesn't fit into the above catogories, and is not likely
to be required except in extreme cases, but doesn't fall into the
category of debugging.

debugging -- DEFAULT: OFF

Text output while would only be of interest to a developer. 

NOTE: Debugging output is the only kind of output which should be sent
directly to standard output (actually, standard error).

NOTE: Debugging output should always be preceeded by the enclosing
function name.

*/



/* WARNING: The following constants are replicated in Python for the purpose
 * of minimize program startup time */

/* Discrete Systems and/or Code Modules */

#define FB_all               0 /* only used for setting */

#define FB_feedback_                 1
#define FB_smiles_parsing            2
#define FB_smiles_creation           3


#define FB_total                     20 /* highest index + 1 */

/* Feedback level bit masks */

#define FB_none            0x00


#define FB_results         0x01
#define FB_errors          0x02
#define FB_actions         0x04
#define FB_warnings        0x08
#define FB_details         0x10
#define FB_blather         0x20
#define FB_debugging       0x80

#define FB_everything      0xFF 

extern char *feedback_Mask;

void feedback_Init(void);
void feedback_Free(void);
void feedback_Push(void);
void feedback_Pop(void);

void feedback_SetMask(unsigned int sysmod,unsigned char mask);
void feedback_Disable(unsigned int sysmod,unsigned char mask);
void feedback_Enable(unsigned int sysmod,unsigned char mask);

/* Mechanism: a high-speed bit test, with no range checking 
 * in order to avoid penalizing performance-senstive code
 * modules which may contain live debugging code.  
 */

#define feedback_(sysmod,mask) (feedback_Mask[sysmod]&mask) 

#define FEEDBACK_MAX_OUTPUT 1024
typedef char feedback_LineType[FEEDBACK_MAX_OUTPUT];

/* Print feedback_ Macros -- this the most flexible and cross-OS
 * portable solution I've come up with for sending output with
 * variable arguments.
*/

#define PRINTFB(sysmod,mask) { if(feedback_(sysmod,mask)) { printf(
#define ENDFB );}}

#define PRINTF { printf(
#define ENDF   );}

/* debugging: goes to stderr */

#define PRINTFD(sysmod) {if(feedback_(sysmod,FB_debugging)) fprintf(stderr,
#define ENDFD   );}

#endif