modified: SpatialOmicsCoord.py
[GalaxyCodeBases.git] / c_cpp / etc / calc / config.h
bloba431973d887e8219ca07b3372ecb54dbed363e18
1 /*
2 * config - configuration routines
4 * Copyright (C) 1999-2007 Landon Curt Noll and David I. Bell
6 * Primary author: Landon Curt Noll
8 * Calc is open software; you can redistribute it and/or modify it under
9 * the terms of the version 2.1 of the GNU Lesser General Public License
10 * as published by the Free Software Foundation.
12 * Calc is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
15 * Public License for more details.
17 * A copy of version 2.1 of the GNU Lesser General Public License is
18 * distributed with calc under the filename COPYING-LGPL. You should have
19 * received a copy with calc; if not, write to Free Software Foundation, Inc.
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * @(#) $Revision: 30.2 $
23 * @(#) $Id: config.h,v 30.2 2007/09/21 01:27:27 chongo Exp $
24 * @(#) $Source: /usr/local/src/bin/calc/RCS/config.h,v $
26 * Under source code control: 1995/11/01 22:20:17
27 * File existed as early as: 1995
29 * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
30 * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
34 #if !defined(__CONFIG_H__)
35 #define __CONFIG_H__
38 #if defined(CALC_SRC) /* if we are building from the calc source tree */
39 # include "decl.h"
40 # include "nametype.h"
41 # include "qmath.h"
42 #else
43 # include <calc/decl.h>
44 # include <calc/nametype.h>
45 # include <calc/qmath.h>
46 #endif
50 * configuration element types
52 #define CONFIG_ALL 0 /* not a real configuration parameter */
53 #define CONFIG_MODE 1 /* types of configuration parameters */
54 #define CONFIG_DISPLAY 2
55 #define CONFIG_EPSILON 3
56 #define CONFIG_EPSILONPREC 3 /* not a real type -- tied to CONFIG_EPSILON */
57 #define CONFIG_TRACE 4
58 #define CONFIG_MAXPRINT 5
59 #define CONFIG_MUL2 6
60 #define CONFIG_SQ2 7
61 #define CONFIG_POW2 8
62 #define CONFIG_REDC2 9
63 #define CONFIG_TILDE 10
64 #define CONFIG_TAB 11
65 #define CONFIG_QUOMOD 12
66 #define CONFIG_QUO 13
67 #define CONFIG_MOD 14
68 #define CONFIG_SQRT 15
69 #define CONFIG_APPR 16
70 #define CONFIG_CFAPPR 17
71 #define CONFIG_CFSIM 18
72 #define CONFIG_OUTROUND 19
73 #define CONFIG_ROUND 20
74 #define CONFIG_LEADZERO 21
75 #define CONFIG_FULLZERO 22
76 #define CONFIG_MAXSCAN 23
77 #define CONFIG_PROMPT 24
78 #define CONFIG_MORE 25
79 #define CONFIG_BLKMAXPRINT 26
80 #define CONFIG_BLKVERBOSE 27
81 #define CONFIG_BLKBASE 28
82 #define CONFIG_BLKFMT 29
83 #define CONFIG_RESOURCE_DEBUG 30
84 #define CONFIG_LIB_DEBUG CONFIG_RESOURCE_DEBUG
85 #define CONFIG_CALC_DEBUG 31
86 #define CONFIG_USER_DEBUG 32
87 #define CONFIG_VERBOSE_QUIT 33
88 #define CONFIG_CTRL_D 34
89 #define CONFIG_PROGRAM 35
90 #define CONFIG_BASENAME 36
91 #define CONFIG_VERSION 37
92 #define CONFIG_WINDOWS 38
93 #define CONFIG_MODE2 39
94 #define CONFIG_CYGWIN 40
95 #define CONFIG_COMPILE_CUSTOM 41
96 #define CONFIG_ALLOW_CUSTOM 42
97 #define CONFIG_BASEB 43
98 #define CONFIG_REDECL_WARN 44
99 #define CONFIG_DUPVAR_WARN 45
100 #define CONFIG_HZ 46
104 * config default symbols
106 #define DISPLAY_DEFAULT 20 /* default digits for float display */
107 #define EPSILON_DEFAULT "1e-20" /* allowed error for float calculations */
108 #define EPSILONPREC_DEFAULT 67 /* 67 ==> 2^-67 <= EPSILON_DEFAULT < 2^-66 */
109 #define MAXPRINT_DEFAULT 16 /* default number of elements printed */
110 #define MAXSCANCOUNT 20 /* default max scan errors before an abort */
114 * configuration object
116 * If you add elements to this structure, you need to also update:
118 * quickhash.c - config_hash()
119 * hash.c - hash_value()
120 * config.c - configs[], oldstd, newstd, setconfig(),
121 * config_value(), config_cmp(),
122 * and perhaps config_copy(), config_free()
123 * config.h - CONFIG_XYZ_SYMBOL (see above)
125 struct config {
126 int outmode; /* current output mode */
127 int outmode2; /* current secondary output mode */
128 LEN outdigits; /* current output digits for float or exp */
129 NUMBER *epsilon; /* default error for real functions */
130 long epsilonprec; /* epsilon binary precision (tied to epsilon) */
131 FLAG traceflags; /* tracing flags */
132 LEN maxprint; /* number of elements to print */
133 LEN mul2; /* size of number to use multiply algorithm 2 */
134 LEN sq2; /* size of number to use square algorithm 2 */
135 LEN pow2; /* size of modulus to use REDC for powers */
136 LEN redc2; /* size of modulus to use REDC algorithm 2 */
137 BOOL tilde_ok; /* ok to print a tilde on aproximations */
138 BOOL tab_ok; /* ok to print tab before numeric values */
139 LEN quomod; /* quomod() default rounding mode */
140 LEN quo; /* quotient // default rounding mode */
141 LEN mod; /* mod % default rounding mode */
142 LEN sqrt; /* sqrt() default rounding mode */
143 LEN appr; /* appr() default rounding mode */
144 LEN cfappr; /* cfappr() default rounding mode */
145 LEN cfsim; /* cfsim() default rounding mode */
146 LEN outround; /* output default rounding mode */
147 LEN round; /* round()/bround() default rounding mode */
148 BOOL leadzero; /* ok to print leading 0 before decimal pt */
149 BOOL fullzero; /* ok to print trailing 0's */
150 long maxscancount; /* max scan errors before abort */
151 char *prompt1; /* normal prompt */
152 char *prompt2; /* prompt when inside multi-line input */
153 int blkmaxprint; /* octets of a block to print, 0 => all */
154 BOOL blkverbose; /* TRUE => print all lines if a block */
155 int blkbase; /* block output base */
156 int blkfmt; /* block output style */
157 long calc_debug; /* internal debug, see CALC_DEBUG_XYZ below */
158 long resource_debug; /* resource debug, see RSCDBG_XYZ below */
159 long user_debug; /* user defined debug value: 0 default */
160 BOOL verbose_quit; /* TRUE => print Quit or abort executed msg */
161 int ctrl_d; /* see CTRL_D_xyz below */
162 char *program; /* our name */
163 char *base_name; /* basename of our name */
164 BOOL windows; /* TRUE => running under MS windows */
165 BOOL cygwin; /* TRUE => compiled with cygwin */
166 BOOL compile_custom; /* TRUE => compiled with -DCUSTOM */
167 BOOL *allow_custom; /* ptr to if custom functions are allowed */
168 char *version; /* calc version string */
169 int baseb; /* base for calculations */
170 BOOL redecl_warn; /* TRUE => warn of redeclating variables */
171 BOOL dupvar_warn; /* TRUE => warn of var name collisions */
173 typedef struct config CONFIG;
177 * resource_debug bit masks
179 #define RSCDBG_STDIN_FUNC (0x00000001) /* interactive func define debug */
180 #define RSCDBG_FILE_FUNC (0x00000002) /* file read func define debug */
181 #define RSCDBG_FUNC_INFO (0x00000004) /* print extra info for show func */
182 #define RSCDBG_PRINT_DBG (0x00000008) /* print debug messages */
183 #define RSCDBG_MASK (0x0000000f)
187 * calc_debug bit masks
189 #define CALCDBG_SYSTEM (0x00000001) /* print system cmd prior to exec */
190 #define CALCDBG_FUNC_QUIT (0x00000002) /* active functions when quit */
191 #define CALCDBG_HASH_STATE (0x00000004) /* hash state details */
192 #define CALCDBG_BLOCK (0x00000008) /* block debug */
193 #define CALCDBG_TTY (0x00000010) /* report TTY state changes */
194 #define CALCDBG_RUNSTATE (0x00000020) /* report run_state changes */
195 #define CALCDBG_RAND (0x00000040) /* report rand() activity */
196 #define CALCDBG_CUSTOM (0x00000080) /* custom function debug */
197 #define CALCDBG_MASK (0x000000ff)
200 * ctrl-d meanings
202 #define CTRL_D_VIRGIN_EOF (0) /* ^D only exits on virgin command lines */
203 #define CTRL_D_NEVER_EOF (1) /* ^D never exits, emacs binding meaning only */
204 #define CTRL_D_EMPTY_EOF (2) /* ^D always exits at start of line */
208 * global configuration states and aliases
210 EXTERN CONFIG *conf; /* current configuration */
211 EXTERN CONFIG oldstd; /* old classic standard configuration */
212 EXTERN CONFIG newstd; /* default compatible configuration */
213 E_FUNC char *calc_debug; /* !=NULL => value of config("calc_debug") */
214 E_FUNC char *resource_debug; /* !=NULL => config("resource_debug") value */
215 E_FUNC char *user_debug; /* !=NULL => value of config("user_debug") */
219 * configuration externals
221 E_FUNC CONFIG *config_copy(CONFIG *src);
222 E_FUNC void config_free(CONFIG *cfg);
223 E_FUNC void config_print(CONFIG *cfg);
224 E_FUNC int configtype(char*);
225 E_FUNC void config_print(CONFIG*);
226 E_FUNC BOOL config_cmp(CONFIG*, CONFIG*);
229 #endif /* !__CONFIG_H__ */