GnuCOBOL  2.0
A free COBOL compiler
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
common.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002,2003,2004,2005,2006,2007 Keisuke Nishida
3  Copyright (C) 2007-2012 Roger While
4 
5  This file is part of GNU Cobol.
6 
7  The GNU Cobol runtime library is free software: you can redistribute it
8  and/or modify it under the terms of the GNU Lesser General Public License
9  as published by the Free Software Foundation, either version 3 of the
10  License, or (at your option) any later version.
11 
12  GNU Cobol is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with GNU Cobol. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef COB_COMMON_H
22 #define COB_COMMON_H
23 
24 /* General type defines */
25 #define cob_c8_t char
26 #define cob_s8_t signed char
27 #define cob_u8_t unsigned char
28 #define cob_s16_t short
29 #define cob_u16_t unsigned short
30 #define cob_s32_t int
31 #define cob_u32_t unsigned int
32 #define cob_sli_t long int
33 #define cob_uli_t unsigned long int
34 
35 #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
36 
37 #define cob_s64_t __int64
38 #define cob_u64_t unsigned __int64
39 
40 #define COB_S64_C(x) x ## I64
41 #define COB_U64_C(x) x ## UI64
42 #define CB_FMT_LLD "%I64d"
43 #define CB_FMT_LLU "%I64u"
44 #define CB_FMT_PLLD "%+*.*I64d"
45 #define CB_FMT_PLLU "%*.*I64u"
46 #define CB_FMT_LLD_F "%I64dI64"
47 #define CB_FMT_LLU_F "%I64uUI64"
48 
49 #else
50 
51 #define cob_s64_t long long
52 #define cob_u64_t unsigned long long
53 
54 #define COB_S64_C(x) x ## LL
55 #define COB_U64_C(x) x ## ULL
56 #define CB_FMT_LLD "%lld"
57 #define CB_FMT_LLU "%llu"
58 #define CB_FMT_PLLD "%+*.*lld"
59 #define CB_FMT_PLLU "%*.*llu"
60 #define CB_FMT_LLD_F "%lldLL"
61 #define CB_FMT_LLU_F "%lluULL"
62 
63 #endif
64 
65 #define cob_c8_ptr cob_c8_t *
66 #define cob_u8_ptr cob_u8_t *
67 #define cob_s8_ptr cob_s8_t *
68 #define cob_u16_ptr cob_u16_t *
69 #define cob_s16_ptr cob_s16_t *
70 #define cob_u32_ptr cob_u32_t *
71 #define cob_s32_ptr cob_s32_t *
72 #define cob_u64_ptr cob_u64_t *
73 #define cob_s64_ptr cob_s64_t *
74 
75 #define cob_void_ptr void *
76 #define cob_field_ptr cob_field *
77 #define cob_file_ptr cob_file *
78 #define cob_module_ptr cob_module *
79 #define cob_screen_ptr cob_screen *
80 #define cob_file_key_ptr cob_file_key *
81 
82 /* Byte swap functions */
83 
84 /*
85  The original idea for the byteswap routines was taken from GLib.
86  (Specifically glib/gtypes.h)
87  GLib is licensed under the GNU Lesser General Public License.
88 */
89 
90 /* Generic swapping functions */
91 
92 #undef COB_BSWAP_16_CONSTANT
93 #undef COB_BSWAP_32_CONSTANT
94 #undef COB_BSWAP_64_CONSTANT
95 #undef COB_BSWAP_16
96 #undef COB_BSWAP_32
97 #undef COB_BSWAP_64
98 
99 #define COB_BSWAP_16_CONSTANT(val) ((cob_u16_t) ( \
100  (((cob_u16_t)(val) & (cob_u16_t) 0x00FFU) << 8) | \
101  (((cob_u16_t)(val) & (cob_u16_t) 0xFF00U) >> 8)))
102 
103 #define COB_BSWAP_32_CONSTANT(val) ((cob_u32_t) ( \
104  (((cob_u32_t) (val) & (cob_u32_t) 0x000000FFU) << 24) | \
105  (((cob_u32_t) (val) & (cob_u32_t) 0x0000FF00U) << 8) | \
106  (((cob_u32_t) (val) & (cob_u32_t) 0x00FF0000U) >> 8) | \
107  (((cob_u32_t) (val) & (cob_u32_t) 0xFF000000U) >> 24)))
108 
109 #define COB_BSWAP_64_CONSTANT(val) ((cob_u64_t) ( \
110  (((cob_u64_t) (val) & \
111  (cob_u64_t) COB_U64_C(0x00000000000000FF)) << 56) | \
112  (((cob_u64_t) (val) & \
113  (cob_u64_t) COB_U64_C(0x000000000000FF00)) << 40) | \
114  (((cob_u64_t) (val) & \
115  (cob_u64_t) COB_U64_C(0x0000000000FF0000)) << 24) | \
116  (((cob_u64_t) (val) & \
117  (cob_u64_t) COB_U64_C(0x00000000FF000000)) << 8) | \
118  (((cob_u64_t) (val) & \
119  (cob_u64_t) COB_U64_C(0x000000FF00000000)) >> 8) | \
120  (((cob_u64_t) (val) & \
121  (cob_u64_t) COB_U64_C(0x0000FF0000000000)) >> 24) | \
122  (((cob_u64_t) (val) & \
123  (cob_u64_t) COB_U64_C(0x00FF000000000000)) >> 40) | \
124  (((cob_u64_t) (val) & \
125  (cob_u64_t) COB_U64_C(0xFF00000000000000)) >> 56)))
126 
127 /* Machine/OS specific overrides */
128 
129 #ifdef __GNUC__
130 
131 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
132 
133 #define COB_BSWAP_16(val) (COB_BSWAP_16_CONSTANT (val))
134 #define COB_BSWAP_32(val) (__builtin_bswap32 (val))
135 #define COB_BSWAP_64(val) (__builtin_bswap64 (val))
136 
137 #elif defined(__i386__)
138 
139 #define COB_BSWAP_16(val) (COB_BSWAP_16_CONSTANT (val))
140 #define COB_BSWAP_32(val) \
141  (__extension__ \
142  ({ register cob_u32_t __v, \
143  __x = ((cob_u32_t) (val)); \
144  if (__builtin_constant_p (__x)) \
145  __v = COB_BSWAP_32_CONSTANT (__x); \
146  else \
147  __asm__ ("bswap %0" \
148  : "=r" (__v) \
149  : "0" (__x)); \
150  __v; }))
151 #define COB_BSWAP_64(val) \
152  (__extension__ \
153  ({ union { cob_u64_t __ll; \
154  cob_u32_t __l[2]; } __w, __r; \
155  __w.__ll = ((cob_u64_t) (val)); \
156  if (__builtin_constant_p (__w.__ll)) \
157  __r.__ll = COB_BSWAP_64_CONSTANT (__w.__ll); \
158  else \
159  { \
160  __r.__l[0] = COB_BSWAP_32 (__w.__l[1]); \
161  __r.__l[1] = COB_BSWAP_32 (__w.__l[0]); \
162  } \
163  __r.__ll; }))
164 
165 #elif defined (__ia64__)
166 
167 #define COB_BSWAP_16(val) (COB_BSWAP_16_CONSTANT (val))
168 #define COB_BSWAP_32(val) \
169  (__extension__ \
170  ({ register cob_u32_t __v, \
171  __x = ((cob_u32_t) (val)); \
172  if (__builtin_constant_p (__x)) \
173  __v = COB_BSWAP_32_CONSTANT (__x); \
174  else \
175  __asm__ __volatile__ ("shl %0 = %1, 32 ;;" \
176  "mux1 %0 = %0, @rev ;;" \
177  : "=r" (__v) \
178  : "r" (__x)); \
179  __v; }))
180 #define COB_BSWAP_64(val) \
181  (__extension__ \
182  ({ register cob_u64_t __v, \
183  __x = ((cob_u64_t) (val)); \
184  if (__builtin_constant_p (__x)) \
185  __v = COB_BSWAP_64_CONSTANT (__x); \
186  else \
187  __asm__ __volatile__ ("mux1 %0 = %1, @rev ;;" \
188  : "=r" (__v) \
189  : "r" (__x)); \
190  __v; }))
191 
192 #elif defined (__x86_64__)
193 
194 #define COB_BSWAP_16(val) (COB_BSWAP_16_CONSTANT (val))
195 #define COB_BSWAP_32(val) \
196  (__extension__ \
197  ({ register cob_u32_t __v, \
198  __x = ((cob_u32_t) (val)); \
199  if (__builtin_constant_p (__x)) \
200  __v = COB_BSWAP_32_CONSTANT (__x); \
201  else \
202  __asm__ ("bswapl %0" \
203  : "=r" (__v) \
204  : "0" (__x)); \
205  __v; }))
206 #define COB_BSWAP_64(val) \
207  (__extension__ \
208  ({ register cob_u64_t __v, \
209  __x = ((cob_u64_t) (val)); \
210  if (__builtin_constant_p (__x)) \
211  __v = COB_BSWAP_64_CONSTANT (__x); \
212  else \
213  __asm__ ("bswapq %0" \
214  : "=r" (__v) \
215  : "0" (__x)); \
216  __v; }))
217 
218 #else /* Generic gcc */
219 
220 #define COB_BSWAP_16(val) (COB_BSWAP_16_CONSTANT (val))
221 #define COB_BSWAP_32(val) (COB_BSWAP_32_CONSTANT (val))
222 #define COB_BSWAP_64(val) (COB_BSWAP_64_CONSTANT (val))
223 
224 #endif
225 
226 #elif defined(_MSC_VER) && (_MSC_VER >= 1400)
227 
228 #define COB_BSWAP_16(val) (_byteswap_ushort (val))
229 #define COB_BSWAP_32(val) (_byteswap_ulong (val))
230 #define COB_BSWAP_64(val) (_byteswap_uint64 (val))
231 
232 #else /* Generic */
233 
234 #define COB_BSWAP_16(val) (COB_BSWAP_16_CONSTANT (val))
235 #define COB_BSWAP_32(val) (COB_BSWAP_32_CONSTANT (val))
236 #define COB_BSWAP_64(val) (COB_BSWAP_64_CONSTANT (val))
237 
238 #endif
239 
240 /* End byte swap functions */
241 
242 /* Compiler characteristics */
243 
244 #ifdef _MSC_VER
245 
246 #ifndef _CRT_SECURE_NO_DEPRECATE
247 #define _CRT_SECURE_NO_DEPRECATE 1
248 #endif
249 #include <malloc.h>
250 #include <io.h>
251 #include <fcntl.h>
252 
253 /* Disable certain warnings */
254 /* Deprecated functions */
255 #pragma warning(disable: 4996)
256 /* Function declarations without parameter list */
257 #pragma warning(disable: 4255)
258 
259 #define strncasecmp _strnicmp
260 #define strcasecmp _stricmp
261 #define snprintf _snprintf
262 #define getpid _getpid
263 #define access _access
264 
265 #define __attribute__(x)
266 
267 #ifdef S_ISDIR
268 #undef S_ISDIR
269 #endif
270 #define S_ISDIR(x) (((x) & _S_IFMT) == _S_IFDIR)
271 
272 #ifdef S_ISREG
273 #undef S_ISREG
274 #endif
275 #define S_ISREG(x) (((x) & _S_IFMT) == _S_IFREG)
276 
277 #ifndef _M_IA64
278 #ifdef _WIN64
279 #define __x86_64__
280 #else
281 #define __i386__
282 #endif
283 #endif
284 
285 #endif
286 
287 #ifdef __BORLANDC__
288 #include <io.h>
289 #define _timeb timeb
290 #define _ftime(a) ftime(a)
291 #define strncasecmp strnicmp
292 #define strcasecmp stricmp
293 #define _setmode setmode
294 #define _chdir chdir
295 #endif
296 
297 #include <setjmp.h>
298 
299 #if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(__clang__)
300 #ifdef COB_LIB_EXPIMP
301  #define COB_EXPIMP __declspec(dllexport) extern
302 #else
303  #define COB_EXPIMP __declspec(dllimport) extern
304 #endif
305 #else
306  #define COB_EXPIMP extern
307 #endif
308 
309 #if defined(__370__) || defined(_MSC_VER) || defined(__DECC) || \
310  defined(__BORLANDC__) || defined(__WATCOMC__)
311  #define COB_INLINE __inline
312 #elif defined(__INTEL_COMPILER)
313  /* icc */
314  #define COB_INLINE inline
315 #elif defined(__GNUC__)
316  /* gcc */
317  #define COB_INLINE __inline__
318 #elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 199900L
319  /* C99 and C++ */
320  #define COB_INLINE inline
321 #elif defined(COB_KEYWORD_INLINE)
322  #define COB_INLINE COB_KEYWORD_INLINE
323 #else
324  #define COB_INLINE
325 #endif
326 
327 /* Also OK for icc which defines __GNUC__ */
328 
329 #if defined(__GNUC__) || (defined(__xlc__) && __IBMC__ >= 700)
330 #define COB_A_NORETURN __attribute__((noreturn))
331 #define COB_A_FORMAT12 __attribute__((format(printf, 1, 2)))
332 #define COB_A_FORMAT23 __attribute__((format(printf, 2, 3)))
333 #define COB_A_FORMAT34 __attribute__((format(printf, 3, 4)))
334 #else
335 #define COB_A_NORETURN
336 #define COB_A_FORMAT12
337 #define COB_A_FORMAT23
338 #define COB_A_FORMAT34
339 #endif
340 
341 #ifdef _MSC_VER
342 #define DECLNORET __declspec(noreturn)
343 #else
344 #define DECLNORET
345 #endif
346 
347 #if defined(__GNUC__)
348 #define optim_memcpy(x,y,z) __builtin_memcpy (x, y, z)
349 #else
350 #define optim_memcpy(x,y,z) memcpy (x, y, z)
351 #endif
352 
353 #if defined(__GNUC__) && (__GNUC__ >= 3)
354 #define likely(x) __builtin_expect((long int)!!(x), 1L)
355 #define unlikely(x) __builtin_expect((long int)!!(x), 0L)
356 #define COB_A_MALLOC __attribute__((malloc))
357 #define COB_HAVE_STEXPR 1
358 
359 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
360 #define COB_NOINLINE __attribute__((noinline))
361 #define COB_A_INLINE __attribute__((always_inline))
362 #else
363 #define COB_NOINLINE
364 #define COB_A_INLINE
365 #endif
366 
367 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
368 #define COB_A_COLD __attribute__((cold))
369 #else
370 #define COB_A_COLD
371 #endif
372 
373 #elif defined(__xlc__) && __IBMC__ >= 700
374 
375 #if __IBMC__ >= 900
376 #define likely(x) __builtin_expect((long int)!!(x), 1L)
377 #define unlikely(x) __builtin_expect((long int)!!(x), 0L)
378 #else
379 #define likely(x) (x)
380 #define unlikely(x) (x)
381 #endif
382 #define COB_NOINLINE __attribute__((noinline))
383 #define COB_A_INLINE __attribute__((always_inline))
384 #define COB_A_MALLOC
385 #define COB_A_COLD
386 #if __IBMC__ >= 800
387 #define COB_HAVE_STEXPR 1
388 #else
389 #undef COB_HAVE_STEXPR
390 #endif
391 
392 #elif defined(__SUNPRO_C) && __SUNPRO_C >= 0x590
393 
394 #define likely(x) (x)
395 #define unlikely(x) (x)
396 #define COB_A_MALLOC __attribute__((malloc))
397 #define COB_NOINLINE __attribute__((noinline))
398 #define COB_A_INLINE __attribute__((always_inline))
399 #define COB_A_COLD
400 #define COB_HAVE_STEXPR 1
401 
402 #else
403 
404 #define likely(x) (x)
405 #define unlikely(x) (x)
406 #define COB_A_MALLOC
407 #define COB_NOINLINE
408 #define COB_A_INLINE
409 #define COB_A_COLD
410 #undef COB_HAVE_STEXPR
411 
412 #endif
413 
414 /* Prevent unwanted verbosity when using icc */
415 #ifdef __INTEL_COMPILER
416 
417 /* Unreachable code */
418 #pragma warning ( disable : 111 )
419 /* Declared but never referenced */
420 #pragma warning ( disable : 177 )
421 /* Format conversion */
422 #pragma warning ( disable : 181 )
423 /* Enumerated type mixed with other type */
424 #pragma warning ( disable : 188 )
425 /* #undefine tested for zero */
426 #pragma warning ( disable : 193 )
427 /* Set but not used */
428 #pragma warning ( disable : 593 )
429 /* Parameter not referenced */
430 #pragma warning ( disable : 869 )
431 /* Operands are evaluated in unspecified order */
432 #pragma warning ( disable : 981 )
433 /* Missing return at end of non-void function */
434 /* Note - occurs because we have a non-returning abort call in cobc */
435 #pragma warning ( disable : 1011 )
436 /* Declaration in same source as definition */
437 #pragma warning ( disable : 1419 )
438 /* Shadowed variable - 1599 and 1944 are essentially the same */
439 #pragma warning ( disable : 1599 )
440 #pragma warning ( disable : 1944 )
441 /* Possible loss of precision */
442 #pragma warning ( disable : 2259 )
443 
444 #endif
445 
446 #if !defined(__i386__) && !defined(__x86_64__) && !defined(__powerpc__) && !defined(__powerpc64__) && !defined(__ppc__) && !defined(__amd64__)
447  #define COB_NON_ALIGNED
448  /* Some DEC Alphas can only load shorts at 4-byte aligned addresses */
449  #ifdef __alpha
450  #define COB_SHORT_BORK
451  #endif
452  #if defined(_MSC_VER)
453  #define COB_ALLOW_UNALIGNED
454  #else
455  #define __unaligned
456  #endif
457 #else
458  #define COB_ALLOW_UNALIGNED
459  #define __unaligned
460 #endif
461 
462 
463 
464 #if defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__)
465 #define PATHSEPC ';'
466 #define PATHSEPS ";"
467 #else
468 #define PATHSEPC ':'
469 #define PATHSEPS ":"
470 #endif
471 
472 #ifndef _WIN32
473 #define SLASH_INT '/'
474 #define SLASH_STR "/"
475 #else
476 #define SLASH_INT '\\'
477 #define SLASH_STR "\\"
478 #endif
479 
480 /* End compiler stuff */
481 
482 /* EBCDIC determination */
483 
484 #if ' ' == 0x40
485 #define COB_EBCDIC_MACHINE
486 #else
487 #undef COB_EBCDIC_MACHINE
488 #endif
489 
490 /* Macro to prevent unused parameter warning */
491 
492 #define COB_UNUSED(z) do { (void)(z); } while (0)
493 
494 /* Buffer size definitions */
495 
496 #define COB_MINI_BUFF 256
497 #define COB_SMALL_BUFF 1024
498 #define COB_NORMAL_BUFF 2048
499 #define COB_FILE_BUFF 4096
500 #define COB_MEDIUM_BUFF 8192
501 #define COB_LARGE_BUFF 16384
502 #define COB_MINI_MAX (COB_MINI_BUFF - 1)
503 #define COB_SMALL_MAX (COB_SMALL_BUFF - 1)
504 #define COB_NORMAL_MAX (COB_NORMAL_BUFF - 1)
505 #define COB_FILE_MAX (COB_FILE_BUFF - 1)
506 #define COB_MEDIUM_MAX (COB_MEDIUM_BUFF - 1)
507 #define COB_LARGE_MAX (COB_LARGE_BUFF - 1)
508 
509 /* Perform stack size */
510 #define COB_STACK_SIZE 255
511 
512 /* Maximum size of file records */
513 #define MAX_FD_RECORD 65535
514 
515 /* Maximum number of parameters */
516 #define COB_MAX_FIELD_PARAMS 36
517 
518 /* Maximum number of field digits */
519 #define COB_MAX_DIGITS 38
520 
521 /* Maximum digits in binary field */
522 #define COB_MAX_BINARY 39
523 
524 /* Maximum digits in binary field */
525 #define COB_MAX_FIELD_SIZE 268435456
526 
527 /* Maximum number of cob_decimal structures */
528 #define COB_MAX_DEC_STRUCT 32
529 
530 /* Maximum length of COBOL words */
531 #define COB_MAX_WORDLEN 61
532 
533 /* Memory size for sorting */
534 #define COB_SORT_MEMORY 128 * 1024 * 1024
535 #define COB_SORT_CHUNK 256 * 1024
536 
537 /* Program return types */
538 #define COB_RET_TYPE_INT 0
539 #define COB_RET_TYPE_PTR 1
540 #define COB_RET_TYPE_VOID 2
541 
542 /* Fold case types */
543 #define COB_FOLD_UPPER 1
544 #define COB_FOLD_LOWER 2
545 
546 /* Locale types */
547 #define COB_LC_COLLATE 0
548 #define COB_LC_CTYPE 1
549 #define COB_LC_MESSAGES 2
550 #define COB_LC_MONETARY 3
551 #define COB_LC_NUMERIC 4
552 #define COB_LC_TIME 5
553 #define COB_LC_ALL 6
554 #define COB_LC_USER 7
555 #define COB_LC_CLASS 8
556 
557 /* Field types */
558 
559 #define COB_TYPE_UNKNOWN 0x00
560 #define COB_TYPE_GROUP 0x01U
561 #define COB_TYPE_BOOLEAN 0x02U
562 
563 #define COB_TYPE_NUMERIC 0x10U
564 #define COB_TYPE_NUMERIC_DISPLAY 0x10U
565 #define COB_TYPE_NUMERIC_BINARY 0x11U
566 #define COB_TYPE_NUMERIC_PACKED 0x12U
567 #define COB_TYPE_NUMERIC_FLOAT 0x13U
568 #define COB_TYPE_NUMERIC_DOUBLE 0x14U
569 #define COB_TYPE_NUMERIC_L_DOUBLE 0x15U
570 #define COB_TYPE_NUMERIC_FP_DEC64 0x16U
571 #define COB_TYPE_NUMERIC_FP_DEC128 0x17U
572 #define COB_TYPE_NUMERIC_FP_BIN32 0x18U
573 #define COB_TYPE_NUMERIC_FP_BIN64 0x19U
574 #define COB_TYPE_NUMERIC_FP_BIN128 0x1AU
575 
576 #define COB_TYPE_NUMERIC_EDITED 0x24U
577 
578 #define COB_TYPE_ALPHANUMERIC 0x21U
579 #define COB_TYPE_ALPHANUMERIC_ALL 0x22U
580 #define COB_TYPE_ALPHANUMERIC_EDITED 0x23U
581 
582 #define COB_TYPE_NATIONAL 0x40U
583 #define COB_TYPE_NATIONAL_EDITED 0x41U
584 
585 /* Field flags */
586 
587 #define COB_FLAG_HAVE_SIGN (1U << 0) /* 0x0001 */
588 #define COB_FLAG_SIGN_SEPARATE (1U << 1) /* 0x0002 */
589 #define COB_FLAG_SIGN_LEADING (1U << 2) /* 0x0004 */
590 #define COB_FLAG_BLANK_ZERO (1U << 3) /* 0x0008 */
591 #define COB_FLAG_JUSTIFIED (1U << 4) /* 0x0010 */
592 #define COB_FLAG_BINARY_SWAP (1U << 5) /* 0x0020 */
593 #define COB_FLAG_REAL_BINARY (1U << 6) /* 0x0040 */
594 #define COB_FLAG_IS_POINTER (1U << 7) /* 0x0080 */
595 #define COB_FLAG_NO_SIGN_NIBBLE (1U << 8) /* 0x0100 */
596 #define COB_FLAG_IS_FP (1U << 9) /* 0x0200 */
597 #define COB_FLAG_REAL_SIGN (1U << 10) /* 0x0400 */
598 #define COB_FLAG_BINARY_TRUNC (1U << 11) /* 0x0800 */
599 
600 #define COB_FIELD_HAVE_SIGN(f) ((f)->attr->flags & COB_FLAG_HAVE_SIGN)
601 #define COB_FIELD_SIGN_SEPARATE(f) ((f)->attr->flags & COB_FLAG_SIGN_SEPARATE)
602 #define COB_FIELD_SIGN_LEADING(f) ((f)->attr->flags & COB_FLAG_SIGN_LEADING)
603 #define COB_FIELD_BLANK_ZERO(f) ((f)->attr->flags & COB_FLAG_BLANK_ZERO)
604 #define COB_FIELD_JUSTIFIED(f) ((f)->attr->flags & COB_FLAG_JUSTIFIED)
605 #define COB_FIELD_BINARY_SWAP(f) ((f)->attr->flags & COB_FLAG_BINARY_SWAP)
606 #define COB_FIELD_REAL_BINARY(f) ((f)->attr->flags & COB_FLAG_REAL_BINARY)
607 #define COB_FIELD_IS_POINTER(f) ((f)->attr->flags & COB_FLAG_IS_POINTER)
608 #define COB_FIELD_NO_SIGN_NIBBLE(f) ((f)->attr->flags & COB_FLAG_NO_SIGN_NIBBLE)
609 #define COB_FIELD_IS_FP(f) ((f)->attr->flags & COB_FLAG_IS_FP)
610 #define COB_FIELD_REAL_SIGN(f) ((f)->attr->flags & COB_FLAG_REAL_SIGN)
611 #define COB_FIELD_BINARY_TRUNC(f) ((f)->attr->flags & COB_FLAG_BINARY_TRUNC)
612 
613 #define COB_FLAG_LEADSEP \
614  (COB_FLAG_SIGN_SEPARATE | COB_FLAG_SIGN_LEADING)
615 
616 #define COB_FIELD_SIGN_LEADSEP(f) \
617  (((f)->attr->flags & COB_FLAG_LEADSEP) == COB_FLAG_LEADSEP)
618 
619 #define COB_FIELD_TYPE(f) ((f)->attr->type)
620 #define COB_FIELD_DIGITS(f) ((f)->attr->digits)
621 #define COB_FIELD_SCALE(f) ((f)->attr->scale)
622 #define COB_FIELD_FLAGS(f) ((f)->attr->flags)
623 #define COB_FIELD_PIC(f) ((f)->attr->pic)
624 
625 #define COB_FIELD_DATA(f) \
626  ((f)->data + (COB_FIELD_SIGN_LEADSEP (f) ? 1 : 0))
627 
628 #define COB_FIELD_SIZE(f) \
629  (COB_FIELD_SIGN_SEPARATE (f) ? f->size - 1 : f->size)
630 
631 #define COB_FIELD_IS_NUMERIC(f) (COB_FIELD_TYPE (f) & COB_TYPE_NUMERIC)
632 #define COB_FIELD_IS_NUMDISP(f) (COB_FIELD_TYPE (f) == COB_TYPE_NUMERIC_DISPLAY)
633 #define COB_FIELD_IS_ALNUM(f) (COB_FIELD_TYPE (f) == COB_TYPE_ALPHANUMERIC)
634 #define COB_FIELD_IS_NATIONAL(f) (COB_FIELD_TYPE (f) & COB_TYPE_NATIONAL)
635 
636 
637 #define COB_DISPLAY_SIGN_ASCII 0
638 #define COB_DISPLAY_SIGN_EBCDIC 1
639 
640 #define COB_NATIONAL_SIZE 2
641 
642 #define COB_SET_FLD(v,x,y,z) (v.size = x, v.data = y, v.attr = z, &v)
643 #define COB_SET_DATA(x,z) (x.data = z, &x)
644 
645 /* Fatal error definitions */
646 
647 #define COB_FERROR_NONE 0
648 #define COB_FERROR_CANCEL 1
649 #define COB_FERROR_INITIALIZED 2
650 #define COB_FERROR_CODEGEN 3
651 #define COB_FERROR_CHAINING 4
652 #define COB_FERROR_STACK 5
653 #define COB_FERROR_GLOBAL 6
654 #define COB_FERROR_MEMORY 7
655 #define COB_FERROR_MODULE 8
656 #define COB_FERROR_RECURSIVE 9
657 #define COB_FERROR_SCR_INP 10
658 #define COB_FERROR_FILE 11
659 #define COB_FERROR_FUNCTION 12
660 #define COB_FERROR_FREE 13
661 
662 /* Exception identifier enumeration */
663 
664 #undef COB_EXCEPTION
665 #define COB_EXCEPTION(code,tag,name,critical) tag,
666 
669 #include <libcob/exception.def>
670  COB_EC_MAX
671 };
672 
673 #undef COB_EXCEPTION
674 
675 
676 /* File attributes */
677 
678 /* File version */
679 #define COB_FILE_VERSION 1
680 
681 /* Start conditions */
682 /* Note that COB_NE is disallowed */
683 #define COB_EQ 1 /* x == y */
684 #define COB_LT 2 /* x < y */
685 #define COB_LE 3 /* x <= y */
686 #define COB_GT 4 /* x > y */
687 #define COB_GE 5 /* x >= y */
688 #define COB_NE 6 /* x != y */
689 #define COB_FI 7 /* First */
690 #define COB_LA 8 /* Last */
691 
692 #define COB_ASCENDING 0
693 #define COB_DESCENDING 1
695 #define COB_FILE_MODE 0644
696 
697 /* Organization */
698 
699 #define COB_ORG_SEQUENTIAL 0
700 #define COB_ORG_LINE_SEQUENTIAL 1
701 #define COB_ORG_RELATIVE 2
702 #define COB_ORG_INDEXED 3
703 #define COB_ORG_SORT 4
704 #define COB_ORG_MAX 5
705 
706 /* Access mode */
707 
708 #define COB_ACCESS_SEQUENTIAL 1
709 #define COB_ACCESS_DYNAMIC 2
710 #define COB_ACCESS_RANDOM 3
711 
712 /* SELECT features */
713 
714 #define COB_SELECT_FILE_STATUS (1U << 0)
715 #define COB_SELECT_EXTERNAL (1U << 1)
716 #define COB_SELECT_LINAGE (1U << 2)
717 #define COB_SELECT_SPLITKEY (1U << 3)
718 #define COB_SELECT_STDIN (1U << 4)
719 #define COB_SELECT_STDOUT (1U << 5)
720 #define COB_SELECT_TEMPORARY (1U << 6)
721 
722 #define COB_FILE_SPECIAL(x) \
723  ((x)->flag_select_features & (COB_SELECT_STDIN | COB_SELECT_STDOUT))
724 #define COB_FILE_STDIN(x) ((x)->flag_select_features & COB_SELECT_STDIN)
725 #define COB_FILE_STDOUT(x) ((x)->flag_select_features & COB_SELECT_STDOUT)
726 #define COB_FILE_TEMPORARY(x) ((x)->flag_select_features & COB_SELECT_TEMPORARY)
727 
728 /* Lock mode */
729 
730 #define COB_LOCK_EXCLUSIVE (1U << 0)
731 #define COB_LOCK_MANUAL (1U << 1)
732 #define COB_LOCK_AUTOMATIC (1U << 2)
733 #define COB_LOCK_MULTIPLE (1U << 3)
734 #define COB_LOCK_OPEN_EXCLUSIVE (1U << 4)
735 
736 #define COB_FILE_EXCLUSIVE (COB_LOCK_EXCLUSIVE | COB_LOCK_OPEN_EXCLUSIVE)
737 
738 /* Open mode */
739 
740 #define COB_OPEN_CLOSED 0
741 #define COB_OPEN_INPUT 1
742 #define COB_OPEN_OUTPUT 2
743 #define COB_OPEN_I_O 3
744 #define COB_OPEN_EXTEND 4
745 #define COB_OPEN_LOCKED 5
746 
747 /* Close options */
748 
749 #define COB_CLOSE_NORMAL 0
750 #define COB_CLOSE_LOCK 1
751 #define COB_CLOSE_NO_REWIND 2
752 #define COB_CLOSE_UNIT 3
753 #define COB_CLOSE_UNIT_REMOVAL 4
754 
755 /* Write options */
756 
757 #define COB_WRITE_MASK 0x0000FFFF
758 
759 #define COB_WRITE_LINES 0x00010000
760 #define COB_WRITE_PAGE 0x00020000
761 #define COB_WRITE_CHANNEL 0x00040000
762 #define COB_WRITE_AFTER 0x00100000
763 #define COB_WRITE_BEFORE 0x00200000
764 #define COB_WRITE_EOP 0x00400000
765 #define COB_WRITE_LOCK 0x00800000
766 #define COB_WRITE_NO_LOCK 0x01000000
767 
768 /* Read options */
769 
770 #define COB_READ_NEXT (1 << 0)
771 #define COB_READ_PREVIOUS (1 << 1)
772 #define COB_READ_FIRST (1 << 2)
773 #define COB_READ_LAST (1 << 3)
774 #define COB_READ_LOCK (1 << 4)
775 #define COB_READ_NO_LOCK (1 << 5)
776 #define COB_READ_KEPT_LOCK (1 << 6)
777 #define COB_READ_WAIT_LOCK (1 << 7)
778 #define COB_READ_IGNORE_LOCK (1 << 8)
779 
780 #define COB_READ_MASK \
781  (COB_READ_NEXT | COB_READ_PREVIOUS | COB_READ_FIRST | COB_READ_LAST)
782 
783 /* I-O status */
784 
785 #define COB_STATUS_00_SUCCESS 00
786 #define COB_STATUS_02_SUCCESS_DUPLICATE 02
787 #define COB_STATUS_04_SUCCESS_INCOMPLETE 04
788 #define COB_STATUS_05_SUCCESS_OPTIONAL 05
789 #define COB_STATUS_07_SUCCESS_NO_UNIT 07
790 #define COB_STATUS_10_END_OF_FILE 10
791 #define COB_STATUS_14_OUT_OF_KEY_RANGE 14
792 #define COB_STATUS_21_KEY_INVALID 21
793 #define COB_STATUS_22_KEY_EXISTS 22
794 #define COB_STATUS_23_KEY_NOT_EXISTS 23
795 #define COB_STATUS_24_KEY_BOUNDARY 24
796 #define COB_STATUS_30_PERMANENT_ERROR 30
797 #define COB_STATUS_31_INCONSISTENT_FILENAME 31
798 #define COB_STATUS_34_BOUNDARY_VIOLATION 34
799 #define COB_STATUS_35_NOT_EXISTS 35
800 #define COB_STATUS_37_PERMISSION_DENIED 37
801 #define COB_STATUS_38_CLOSED_WITH_LOCK 38
802 #define COB_STATUS_39_CONFLICT_ATTRIBUTE 39
803 #define COB_STATUS_41_ALREADY_OPEN 41
804 #define COB_STATUS_42_NOT_OPEN 42
805 #define COB_STATUS_43_READ_NOT_DONE 43
806 #define COB_STATUS_44_RECORD_OVERFLOW 44
807 #define COB_STATUS_46_READ_ERROR 46
808 #define COB_STATUS_47_INPUT_DENIED 47
809 #define COB_STATUS_48_OUTPUT_DENIED 48
810 #define COB_STATUS_49_I_O_DENIED 49
811 #define COB_STATUS_51_RECORD_LOCKED 51
812 #define COB_STATUS_57_I_O_LINAGE 57
813 #define COB_STATUS_61_FILE_SHARING 61
814 #define COB_STATUS_91_NOT_AVAILABLE 91
815 
816 /* Special status */
817 /* Used by extfh handler */
818 #define COB_NOT_CONFIGURED 32768
819 
820 /* End File attributes */
821 
822 /* Number store defines */
823 #define COB_STORE_ROUND (1 << 0)
824 #define COB_STORE_KEEP_ON_OVERFLOW (1 << 1)
825 #define COB_STORE_TRUNC_ON_OVERFLOW (1 << 2)
826 
827 #define COB_STORE_AWAY_FROM_ZERO (1 << 4)
828 #define COB_STORE_NEAR_AWAY_FROM_ZERO (1 << 5)
829 #define COB_STORE_NEAR_EVEN (1 << 6)
830 #define COB_STORE_NEAR_TOWARD_ZERO (1 << 7)
831 #define COB_STORE_PROHIBITED (1 << 8)
832 #define COB_STORE_TOWARD_GREATER (1 << 9)
833 #define COB_STORE_TOWARD_LESSER (1 << 10)
834 #define COB_STORE_TRUNCATION (1 << 11)
835 
836 #define COB_STORE_MASK \
837  (COB_STORE_ROUND | COB_STORE_KEEP_ON_OVERFLOW | \
838  COB_STORE_TRUNC_ON_OVERFLOW)
839 
840 /* Screen attribute defines */
841 #define COB_SCREEN_BLACK 0
842 #define COB_SCREEN_BLUE 1
843 #define COB_SCREEN_GREEN 2
844 #define COB_SCREEN_CYAN 3
845 #define COB_SCREEN_RED 4
846 #define COB_SCREEN_MAGENTA 5
847 #define COB_SCREEN_YELLOW 6
848 #define COB_SCREEN_WHITE 7
849 
850 #define COB_SCREEN_LINE_PLUS (1 << 0)
851 #define COB_SCREEN_LINE_MINUS (1 << 1)
852 #define COB_SCREEN_COLUMN_PLUS (1 << 2)
853 #define COB_SCREEN_COLUMN_MINUS (1 << 3)
854 #define COB_SCREEN_AUTO (1 << 4)
855 #define COB_SCREEN_BELL (1 << 5)
856 #define COB_SCREEN_BLANK_LINE (1 << 6)
857 #define COB_SCREEN_BLANK_SCREEN (1 << 7)
858 #define COB_SCREEN_BLINK (1 << 8)
859 #define COB_SCREEN_ERASE_EOL (1 << 9)
860 #define COB_SCREEN_ERASE_EOS (1 << 10)
861 #define COB_SCREEN_FULL (1 << 11)
862 #define COB_SCREEN_HIGHLIGHT (1 << 12)
863 #define COB_SCREEN_LOWLIGHT (1 << 13)
864 #define COB_SCREEN_REQUIRED (1 << 14)
865 #define COB_SCREEN_REVERSE (1 << 15)
866 #define COB_SCREEN_SECURE (1 << 16)
867 #define COB_SCREEN_UNDERLINE (1 << 17)
868 #define COB_SCREEN_OVERLINE (1 << 18)
869 #define COB_SCREEN_PROMPT (1 << 19)
870 #define COB_SCREEN_UPDATE (1 << 20)
871 #define COB_SCREEN_INPUT (1 << 21)
872 #define COB_SCREEN_SCROLL_DOWN (1 << 22)
873 #define COB_SCREEN_INITIAL (1 << 23)
874 #define COB_SCREEN_NO_ECHO (1 << 24)
875 #define COB_SCREEN_LEFTLINE (1 << 25)
876 #define COB_SCREEN_NO_DISP (1 << 26)
877 #define COB_SCREEN_EMULATE_NL (1 << 27)
878 #define COB_SCREEN_UPPER (1 << 28)
879 #define COB_SCREEN_LOWER (1 << 29)
880 
881 #define COB_SCREEN_TYPE_GROUP 0
882 #define COB_SCREEN_TYPE_FIELD 1
883 #define COB_SCREEN_TYPE_VALUE 2
884 #define COB_SCREEN_TYPE_ATTRIBUTE 3
885 
886 /* End Screen attribute defines */
887 
888 
889 /* Structure/union declarations */
890 
891 
892 /* Field attribute structure */
893 
894 typedef struct {
895  unsigned short type; /* Field type */
896  unsigned short digits; /* Digit count */
897  signed short scale; /* Field scale */
898  unsigned short flags; /* Field flags */
899  const char *pic; /* Pointer to picture string */
901 
902 /* Field structure */
903 
904 typedef struct {
905  size_t size; /* Field size */
906  unsigned char *data; /* Pointer to field data */
907  const cob_field_attr *attr; /* Pointer to attribute */
908 } cob_field;
909 
910 #if 0 /* RXWRXW - Constant field */
911 /* Field structure for constants */
912 
913 typedef struct {
914  const size_t size; /* Field size */
915  const unsigned char *data; /* Pointer to field data */
916  const cob_field_attr *attr; /* Pointer to attribute */
917 } cob_const_field;
918 
919 
920 /* Union for field constants */
921 
922 typedef union {
923  const cob_const_field cf;
924  cob_field vf;
925 } cob_fld_union;
926 #endif
927 
928 /* Representation of 128 bit FP */
929 
930 typedef struct {
931  cob_u64_t fpval[2];
932 } cob_fp_128;
933 
934 /* Internal representation of decimal numbers */
935 /* n = value / 10 ^ scale */
936 /* Decimal structure */
937 
938 typedef struct {
939  mpz_t value; /* GMP value definition */
940  int scale; /* Decimal scale */
941 } cob_decimal;
942 
943 /* Perform stack structure */
944 
945 struct cob_frame {
946  void *return_address_ptr; /* Return address pointer */
947  unsigned int perform_through; /* Perform number */
948  unsigned int return_address_num; /* Return address number */
949 };
950 
951 /* Call union structures */
952 
953 typedef union {
954  unsigned char data[8];
955  cob_s64_t datall;
956  cob_u64_t dataull;
957  int dataint;
958 } cob_content;
959 
960 typedef union {
961  void *(*funcptr)(); /* Function returning "void *" */
962  void (*funcnull)(); /* Function returning nothing */
963  cob_field *(*funcfld)(); /* Function returning "cob_field *" */
964  int (*funcint)(); /* Function returning "int" */
965  void *funcvoid; /* Redefine to "void *" */
966 #ifdef _WIN32
967  /* stdcall variants */
968  void *(__stdcall *funcptr_std)();
969  void (__stdcall *funcnull_std)();
970  cob_field *(__stdcall *funcfld_std)();
971  int (__stdcall *funcint_std)();
972 #endif
974 
975 struct cob_call_struct {
976  const char *cob_cstr_name; /* Call name */
977  cob_call_union cob_cstr_call; /* Call entry */
978  cob_call_union cob_cstr_cancel; /* Cancel entry */
979 };
980 
981 /* Screen structure */
982 typedef struct __cob_screen {
983  struct __cob_screen *next; /* Pointer to next */
984  struct __cob_screen *child; /* For COB_SCREEN_TYPE_GROUP */
985  cob_field *field; /* For COB_SCREEN_TYPE_FIELD */
986  cob_field *value; /* For COB_SCREEN_TYPE_VALUE */
987  cob_field *line; /* LINE */
988  cob_field *column; /* COLUMN */
989  cob_field *foreg; /* FOREGROUND */
990  cob_field *backg; /* BACKGROUND */
991  cob_field *prompt; /* PROMPT */
992  int type; /* Structure type */
993  int occurs; /* OCCURS */
994  int attr; /* COB_SCREEN_TYPE_ATTRIBUTE */
995 } cob_screen;
996 
997 /* Module structure */
998 
999 typedef struct __cob_module {
1000  struct __cob_module *next; /* Next pointer */
1001  cob_field **cob_procedure_params; /* Arguments */
1002  const char *module_name; /* Module name */
1003  const char *module_formatted_date; /* Module full date */
1004  const char *module_source; /* Module source */
1005  cob_call_union module_entry; /* Module entry */
1006  cob_call_union module_cancel; /* Module cancel */
1007  const unsigned char *collating_sequence; /* COLLATING */
1008  cob_field *crt_status; /* CRT STATUS */
1009  cob_field *cursor_pos; /* CURSOR */
1010  unsigned int *module_ref_count; /* Module ref count */
1011  const char **module_path; /* Module path */
1012 
1013  unsigned int module_active; /* Module is active */
1014  unsigned int module_date; /* Module num date */
1015  unsigned int module_time; /* Module num time */
1016  unsigned int module_type; /* Module type */
1017  unsigned int module_param_cnt; /* Module param count */
1018  unsigned int module_returning; /* Module return type */
1019  int module_num_params; /* Module arg count */
1020 
1021  unsigned char ebcdic_sign; /* DISPLAY SIGN */
1022  unsigned char decimal_point; /* DECIMAL POINT */
1023  unsigned char currency_symbol; /* CURRENCY */
1024  unsigned char numeric_separator; /* Separator */
1025 
1026  unsigned char flag_filename_mapping; /* Mapping */
1027  unsigned char flag_binary_truncate; /* Truncation */
1028  unsigned char flag_pretty_display; /* Pretty display */
1029  unsigned char flag_host_sign; /* Host sign */
1030 
1031  unsigned char flag_no_phys_canc; /* No physical cancel */
1032  unsigned char flag_main; /* Main module */
1033  unsigned char flag_fold_call; /* Fold case */
1034  unsigned char flag_exit_program; /* Exit after CALL */
1035 } cob_module;
1036 
1037 
1038 /* User function structure */
1039 
1040 struct cob_func_loc {
1041  cob_field *ret_fld;
1044  unsigned char **data;
1046  int save_call_params;
1047  int save_num_params;
1048 };
1049 
1050 /* File connector */
1051 
1052 /* Key structure */
1053 
1054 typedef struct {
1055  cob_field *field; /* Key field */
1056  int flag; /* WITH DUPLICATES (for RELATIVE/INDEXED) */
1057  /* ASCENDING/DESCENDING (for SORT) */
1058  unsigned int offset; /* Offset of field */
1059 } cob_file_key;
1060 
1061 
1062 /* File structure */
1063 
1064 typedef struct {
1065  const char *select_name; /* Name in SELECT */
1066  unsigned char *file_status; /* FILE STATUS */
1067  cob_field *assign; /* ASSIGN TO */
1068  cob_field *record; /* Record area */
1069  cob_field *variable_record; /* Record size variable */
1070  cob_file_key *keys; /* ISAM/RANDOM/SORT keys */
1071  void *file; /* File specific pointer */
1072  void *linorkeyptr; /* LINAGE or SPLIT KEY */
1073  const unsigned char *sort_collating; /* SORT collating */
1074  void *extfh_ptr; /* For EXTFH usage */
1075  size_t record_min; /* Record min size */
1076  size_t record_max; /* Record max size */
1077  size_t nkeys; /* Number of keys */
1078  int fd; /* File descriptor */
1079 
1080  unsigned char organization; /* ORGANIZATION */
1081  unsigned char access_mode; /* ACCESS MODE */
1082  unsigned char lock_mode; /* LOCK MODE */
1083  unsigned char open_mode; /* OPEN MODE */
1084  unsigned char flag_optional; /* OPTIONAL */
1085  unsigned char last_open_mode; /* Mode given by OPEN */
1086  unsigned char flag_operation; /* File type specific */
1087  unsigned char flag_nonexistent; /* Nonexistent file */
1088 
1089  unsigned char flag_end_of_file; /* Reached end of file */
1090  unsigned char flag_begin_of_file; /* Reached start of file */
1091  unsigned char flag_first_read; /* OPEN/START read flag */
1092  unsigned char flag_read_done; /* READ successful */
1093  unsigned char flag_select_features; /* SELECT features */
1094  unsigned char flag_needs_nl; /* Needs NL at close */
1095  unsigned char flag_needs_top; /* Linage needs top */
1096  unsigned char file_version; /* File I/O version */
1097 
1098 } cob_file;
1099 
1100 
1101 /* Linage structure */
1102 
1103 typedef struct {
1104  cob_field *linage; /* LINAGE */
1105  cob_field *linage_ctr; /* LINAGE-COUNTER */
1106  cob_field *latfoot; /* LINAGE FOOTING */
1107  cob_field *lattop; /* LINAGE AT TOP */
1108  cob_field *latbot; /* LINAGE AT BOTTOM */
1109  int lin_lines; /* Current Linage */
1110  int lin_foot; /* Current Footage */
1111  int lin_top; /* Current Top */
1112  int lin_bot; /* Current Bottom */
1113 } cob_linage;
1114 
1115 
1116 /* Report structure */
1117 
1118 typedef struct {
1119  const char *report_name; /* Report name */
1120  cob_file *report_file; /* Report file */
1121  cob_field *page_counter; /* PAGE-COUNTER */
1122  cob_field *line_counter; /* LINE-COUNTER */
1123  int def_lines; /* Default lines */
1124  int def_cols; /* Default columns */
1125  int def_heading; /* Default heading */
1126  int def_first_detail; /* Default first detail */
1127  int def_last_control; /* Default last control */
1128  int def_last_detail; /* Default last detail */
1129  int def_footing; /* Default footing */
1130  int curr_page; /* Current page */
1131  int curr_lines; /* Current lines */
1132  int curr_cols; /* Current columns */
1133  int curr_status; /* Current status */
1134 } cob_report;
1135 
1136 
1137 /* Global variable structure */
1138 
1139 typedef struct __cob_global {
1140  cob_file *cob_error_file; /* Last error file */
1141  cob_module *cob_current_module; /* Current module */
1142  const char *cob_orig_statement; /* Statement */
1143  const char *cob_orig_program_id; /* Program ID */
1144  const char *cob_orig_section; /* Section */
1145  const char *cob_orig_paragraph; /* Paragraph */
1146  const char *cob_main_argv0; /* Main program */
1147  char *cob_locale; /* Program locale */
1148  char *cob_locale_orig; /* Initial locale */
1149  char *cob_locale_ctype; /* Initial locale */
1150  char *cob_locale_collate; /* Initial locale */
1151  char *cob_locale_messages; /* Initial locale */
1152  char *cob_locale_monetary; /* Initial locale */
1153  char *cob_locale_numeric; /* Initial locale */
1154  char *cob_locale_time; /* Initial locale */
1155 
1156  int cob_exception_code; /* Last exception code */
1157  int cob_call_params; /* Current arguments */
1158  int cob_initial_external; /* First external ref */
1159  unsigned int cob_orig_line; /* Program source line */
1160  unsigned int cob_got_exception; /* Exception active */
1161  unsigned int cob_screen_initialized; /* Screen initialized */
1162  unsigned int cob_unix_lf; /* Use POSIX LF */
1163  unsigned int cob_display_warn; /* Display warnings */
1164  unsigned int cob_first_init; /* First call after init */
1165  unsigned int cob_env_mangle; /* Mangle env names */
1166 
1167  /* Library routine variables */
1168 
1169  /* screenio / termio */
1170  unsigned char *cob_term_buff; /* Screen I/O buffer */
1171 
1172  unsigned int cob_disp_to_stderr; /* Redirect to stderr */
1173  unsigned int cob_beep_value; /* Bell disposition */
1174  int cob_accept_status; /* ACCEPT STATUS */
1175  int cob_timeout_scale; /* timeout scale */
1176  unsigned int cob_extended_status; /* Extended status */
1177  unsigned int cob_use_esc; /* Check ESC key */
1178  int cob_max_y; /* Screen max y */
1179  int cob_max_x; /* Screen max x */
1180 
1181 } cob_global;
1182 
1183 
1184 /* File I/O function pointer structure */
1185 struct cob_fileio_funcs {
1186  int (*open) (cob_file *, char *, const int, const int);
1187  int (*close) (cob_file *, const int);
1188  int (*start) (cob_file *, const int, cob_field *);
1189  int (*read) (cob_file *, cob_field *, const int);
1190  int (*read_next) (cob_file *, const int);
1191  int (*write) (cob_file *, const int);
1192  int (*rewrite) (cob_file *, const int);
1193  int (*fdelete) (cob_file *);
1194 };
1195 
1196 /* Low level jump structure */
1197 struct cobjmp_buf {
1198  int cbj_int[4];
1199  void *cbj_ptr[4];
1200  jmp_buf cbj_jmp_buf;
1201  void *cbj_ptr_rest[2];
1202 };
1203 
1204 /*******************************/
1205 
1206 /* Function declarations */
1207 
1208 /*******************************/
1209 /* Functions in common.c */
1210 COB_EXPIMP void print_runtime_env(void);
1211 COB_EXPIMP void print_info(void);
1212 COB_EXPIMP void print_version(void);
1213 char* cob_int_to_string(int, char*);
1214 char* cob_int_to_formatted_bytestring(int, char*);
1215 char* cob_strcat(char*, char*);
1216 char* cob_strjoin(char**, int, char*);
1217 
1218 /* General functions */
1219 
1221 
1222 COB_EXPIMP void cob_init (const int, char **);
1224  const int);
1226 
1228 DECLNORET COB_EXPIMP void cob_fatal_error (const int) COB_A_NORETURN;
1229 
1230 COB_EXPIMP void *cob_malloc (const size_t) COB_A_MALLOC;
1231 COB_EXPIMP void cob_free (void *);
1232 COB_EXPIMP void *cob_fast_malloc (const size_t) COB_A_MALLOC;
1233 COB_EXPIMP void *cob_cache_malloc (const size_t) COB_A_MALLOC;
1234 COB_EXPIMP void *cob_cache_realloc (void *, const size_t);
1235 COB_EXPIMP void cob_cache_free (void *);
1236 COB_EXPIMP void cob_set_locale (cob_field *, const int);
1237 
1238 COB_EXPIMP void cob_check_version (const char *, const char *,
1239  const int);
1240 
1241 COB_EXPIMP void *cob_save_func (cob_field **, const int,
1242  const int, ...);
1243 COB_EXPIMP void cob_restore_func (struct cob_func_loc *);
1244 
1245 COB_EXPIMP void cob_accept_arg_number (cob_field *);
1246 COB_EXPIMP void cob_accept_arg_value (cob_field *);
1247 COB_EXPIMP void cob_accept_command_line (cob_field *);
1248 COB_EXPIMP void cob_accept_date (cob_field *);
1249 COB_EXPIMP void cob_accept_date_yyyymmdd (cob_field *);
1250 COB_EXPIMP void cob_accept_day (cob_field *);
1251 COB_EXPIMP void cob_accept_day_yyyyddd (cob_field *);
1252 COB_EXPIMP void cob_accept_day_of_week (cob_field *);
1253 COB_EXPIMP void cob_accept_environment (cob_field *);
1254 COB_EXPIMP void cob_accept_exception_status (cob_field *);
1255 COB_EXPIMP void cob_accept_time (cob_field *);
1256 COB_EXPIMP void cob_accept_user_name (cob_field *);
1257 COB_EXPIMP void cob_display_command_line (cob_field *);
1258 COB_EXPIMP void cob_display_environment (const cob_field *);
1259 COB_EXPIMP void cob_display_env_value (const cob_field *);
1260 COB_EXPIMP void cob_display_arg_number (cob_field *);
1261 COB_EXPIMP void cob_get_environment (const cob_field *, cob_field *);
1262 COB_EXPIMP void cob_set_environment (const cob_field *,
1263  const cob_field *);
1264 COB_EXPIMP void cob_chain_setup (void *, const size_t,
1265  const size_t);
1266 COB_EXPIMP void cob_allocate (unsigned char **, cob_field *,
1267  cob_field *, cob_field *);
1268 COB_EXPIMP void cob_free_alloc (unsigned char **, unsigned char *);
1269 COB_EXPIMP int cob_extern_init (void);
1270 COB_EXPIMP int cob_tidy (void);
1271 COB_EXPIMP void *cob_command_line (int, int *, char ***,
1272  char ***, char **);
1273 COB_EXPIMP char *cob_getenv (const char *);
1274 COB_EXPIMP int cob_putenv (char *);
1275 
1277 COB_EXPIMP void cob_temp_name (char *, const char *);
1278 
1279 #define cobgetenv(x) cob_getenv (x)
1280 #define cobputenv(x) cob_putenv (x)
1281 #define cobtidy() cob_tidy ()
1282 #define cobinit() cob_extern_init ()
1283 #define cobexit(x) cob_stop_run (x)
1284 #define cobcommandline(v,w,x,y,z) cob_command_line (v,w,x,y,z)
1285 
1286 /* System routines */
1287 COB_EXPIMP int cob_sys_exit_proc (const void *, const void *);
1288 COB_EXPIMP int cob_sys_error_proc (const void *, const void *);
1289 COB_EXPIMP int cob_sys_system (const void *);
1290 COB_EXPIMP int cob_sys_and (const void *, void *, const int);
1291 COB_EXPIMP int cob_sys_or (const void *, void *, const int);
1292 COB_EXPIMP int cob_sys_nor (const void *, void *, const int);
1293 COB_EXPIMP int cob_sys_xor (const void *, void *, const int);
1294 COB_EXPIMP int cob_sys_imp (const void *, void *, const int);
1295 COB_EXPIMP int cob_sys_nimp (const void *, void *, const int);
1296 COB_EXPIMP int cob_sys_eq (const void *, void *, const int);
1297 COB_EXPIMP int cob_sys_not (void *, const int);
1298 COB_EXPIMP int cob_sys_xf4 (void *, const void *);
1299 COB_EXPIMP int cob_sys_xf5 (const void *, void *);
1300 COB_EXPIMP int cob_sys_x91 (void *, const void *, void *);
1301 COB_EXPIMP int cob_sys_toupper (void *, const int);
1302 COB_EXPIMP int cob_sys_tolower (void *, const int);
1303 COB_EXPIMP int cob_sys_oc_nanosleep (const void *);
1304 COB_EXPIMP int cob_sys_getpid (void);
1305 COB_EXPIMP int cob_sys_return_args (void *);
1306 COB_EXPIMP int cob_sys_parameter_size (void *);
1307 
1308 /*
1309  * cob_sys_getopt_long_long
1310  */
1311 COB_EXPIMP int cob_sys_getopt_long_long (void*, void*, void*, const int, void*, void*);
1312 typedef struct longoption_def{
1313  char name[25];
1314  char has_option;
1315  char return_value_pointer[sizeof(char*)];
1316  char return_value[4];
1317 } longoption_def;
1318 
1319 
1320 COB_EXPIMP int cob_sys_sleep (const void *);
1321 COB_EXPIMP int cob_sys_calledby (void *);
1322 COB_EXPIMP int cob_sys_justify (void *, ...);
1323 COB_EXPIMP int cob_sys_printable (void *, ...);
1324 
1325 /* Utilities */
1326 
1327 COB_EXPIMP void cob_set_location (const char *, const unsigned int,
1328  const char *, const char *,
1329  const char *);
1330 COB_EXPIMP void cob_trace_section (const char *, const char *, const int);
1331 
1332 COB_EXPIMP void *cob_external_addr (const char *, const int);
1333 COB_EXPIMP unsigned char *cob_get_pointer (const void *);
1334 COB_EXPIMP void *cob_get_prog_pointer (const void *);
1335 COB_EXPIMP void cob_ready_trace (void);
1336 COB_EXPIMP void cob_reset_trace (void);
1337 
1338 
1339 /* Registration of external handlers */
1340 COB_EXPIMP void cob_reg_sighnd (void (*sighnd) (int));
1341 
1342 /* Switch */
1343 
1344 COB_EXPIMP int cob_get_switch (const int);
1345 COB_EXPIMP void cob_set_switch (const int, const int);
1346 
1347 /* Comparison */
1348 
1349 COB_EXPIMP int cob_cmp (cob_field *, cob_field *);
1350 
1351 /* Class check */
1352 
1353 COB_EXPIMP int cob_is_omitted (const cob_field *);
1354 COB_EXPIMP int cob_is_numeric (const cob_field *);
1355 COB_EXPIMP int cob_is_alpha (const cob_field *);
1356 COB_EXPIMP int cob_is_upper (const cob_field *);
1357 COB_EXPIMP int cob_is_lower (const cob_field *);
1358 
1359 /* Table sort */
1360 
1361 COB_EXPIMP void cob_table_sort_init (const size_t, const unsigned char *);
1362 COB_EXPIMP void cob_table_sort_init_key (cob_field *, const int,
1363  const unsigned int);
1364 COB_EXPIMP void cob_table_sort (cob_field *, const int);
1365 
1366 /* Run-time error checking */
1367 
1368 COB_EXPIMP void cob_check_numeric (const cob_field *, const char *);
1369 COB_EXPIMP void cob_correct_numeric (cob_field *);
1370 COB_EXPIMP void cob_check_based (const unsigned char *,
1371  const char *);
1372 COB_EXPIMP void cob_check_odo (const int, const int,
1373  const int, const char *);
1374 COB_EXPIMP void cob_check_subscript (const int, const int,
1375  const int, const char *);
1376 COB_EXPIMP void cob_check_ref_mod (const int, const int,
1377  const int, const char *);
1378 
1379 /* Comparison functions */
1380 COB_EXPIMP int cob_numeric_cmp (cob_field *, cob_field *);
1381 
1382 /*******************************/
1383 /* Functions in strings.c */
1384 
1385 COB_EXPIMP void cob_inspect_init (cob_field *, const cob_u32_t);
1386 COB_EXPIMP void cob_inspect_start (void);
1387 COB_EXPIMP void cob_inspect_before (const cob_field *);
1388 COB_EXPIMP void cob_inspect_after (const cob_field *);
1389 COB_EXPIMP void cob_inspect_characters (cob_field *);
1390 COB_EXPIMP void cob_inspect_all (cob_field *, cob_field *);
1391 COB_EXPIMP void cob_inspect_leading (cob_field *, cob_field *);
1392 COB_EXPIMP void cob_inspect_first (cob_field *, cob_field *);
1393 COB_EXPIMP void cob_inspect_trailing (cob_field *, cob_field *);
1394 COB_EXPIMP void cob_inspect_converting (const cob_field *, const cob_field *);
1395 COB_EXPIMP void cob_inspect_finish (void);
1396 
1397 COB_EXPIMP void cob_string_init (cob_field *, cob_field *);
1398 COB_EXPIMP void cob_string_delimited (cob_field *);
1399 COB_EXPIMP void cob_string_append (cob_field *);
1400 COB_EXPIMP void cob_string_finish (void);
1401 
1402 COB_EXPIMP void cob_unstring_init (cob_field *, cob_field *, const size_t);
1403 COB_EXPIMP void cob_unstring_delimited (cob_field *, const cob_u32_t);
1404 COB_EXPIMP void cob_unstring_into (cob_field *, cob_field *, cob_field *);
1405 COB_EXPIMP void cob_unstring_tallying (cob_field *);
1406 COB_EXPIMP void cob_unstring_finish (void);
1407 
1408 /*******************************/
1409 /* Functions in move.c */
1410 
1411 COB_EXPIMP void cob_move (cob_field *, cob_field *);
1412 COB_EXPIMP void cob_set_int (cob_field *, const int);
1413 COB_EXPIMP int cob_get_int (cob_field *);
1414 COB_EXPIMP cob_s64_t cob_get_llint (cob_field *);
1415 
1416 /*******************************/
1417 /* Functions in numeric.c */
1418 
1421 COB_EXPIMP void cob_decimal_set_field (cob_decimal *, cob_field *);
1422 COB_EXPIMP int cob_decimal_get_field (cob_decimal *, cob_field *, const int);
1429 
1430 COB_EXPIMP void cob_add (cob_field *, cob_field *, const int);
1431 COB_EXPIMP void cob_sub (cob_field *, cob_field *, const int);
1432 COB_EXPIMP void cob_mul (cob_field *, cob_field *, const int);
1433 COB_EXPIMP void cob_div (cob_field *, cob_field *, const int);
1434 COB_EXPIMP int cob_add_int (cob_field *, const int, const int);
1435 COB_EXPIMP int cob_sub_int (cob_field *, const int, const int);
1436 COB_EXPIMP void cob_div_quotient (cob_field *, cob_field *,
1437  cob_field *, const int);
1438 COB_EXPIMP void cob_div_remainder (cob_field *, const int);
1439 
1440 COB_EXPIMP int cob_cmp_int (cob_field *, const int);
1441 COB_EXPIMP int cob_cmp_uint (cob_field *, const unsigned int);
1442 COB_EXPIMP int cob_cmp_llint (cob_field *, const cob_s64_t);
1443 COB_EXPIMP int cob_cmp_packed (cob_field *, const cob_s64_t);
1444 COB_EXPIMP int cob_cmp_numdisp (const unsigned char *,
1445  const size_t, const cob_s64_t,
1446  const cob_u32_t);
1447 COB_EXPIMP int cob_cmp_float (cob_field *, cob_field *);
1448 COB_EXPIMP void cob_set_packed_zero (cob_field *);
1449 COB_EXPIMP void cob_set_packed_int (cob_field *, const int);
1450 
1451 COB_EXPIMP void cob_decimal_alloc (const cob_u32_t, ...);
1452 COB_EXPIMP void cob_decimal_push (const cob_u32_t, ...);
1453 COB_EXPIMP void cob_decimal_pop (const cob_u32_t, ...);
1454 
1455 COB_EXPIMP void cob_gmp_free (void *);
1456 
1457 
1458 /*******************************/
1459 /* Functions in call.c */
1460 
1461 DECLNORET COB_EXPIMP void cob_call_error (void) COB_A_NORETURN;
1462 
1464 COB_EXPIMP void *cob_resolve (const char *);
1465 COB_EXPIMP void *cob_resolve_cobol (const char *, const int,
1466  const int);
1467 COB_EXPIMP void *cob_resolve_func (const char *);
1468 COB_EXPIMP const char *cob_resolve_error (void);
1469 COB_EXPIMP void *cob_call_field (const cob_field *,
1470  const struct cob_call_struct *,
1471  const unsigned int,
1472  const int);
1473 COB_EXPIMP void cob_cancel_field (const cob_field *,
1474  const struct cob_call_struct *);
1475 COB_EXPIMP void cob_cancel (const char *);
1476 COB_EXPIMP int cob_call (const char *, const int, void **);
1477 COB_EXPIMP int cob_func (const char *, const int, void **);
1478 COB_EXPIMP void *cob_savenv (struct cobjmp_buf *);
1479 COB_EXPIMP void *cob_savenv2 (struct cobjmp_buf *, const int);
1480 COB_EXPIMP void cob_longjmp (struct cobjmp_buf *);
1481 
1482 #define cobsetjmp(x) setjmp (cob_savenv (x))
1483 #define coblongjmp(x) cob_longjmp (x)
1484 #define cobsavenv(x) cob_savenv (x)
1485 #define cobsavenv2(x,z) cob_savenv2 (x, z)
1486 #define cobfunc(x,y,z) cob_func (x, y, z)
1487 #define cobcall(x,y,z) cob_call (x, y, z)
1488 #define cobcancel(x) cob_cancel (x)
1489 
1490 /*******************************/
1491 /* Functions in screenio.c */
1492 
1493 COB_EXPIMP void cob_screen_line_col (cob_field *, const int);
1494 COB_EXPIMP void cob_screen_display (cob_screen *, cob_field *,
1495  cob_field *);
1496 COB_EXPIMP void cob_screen_accept (cob_screen *, cob_field *,
1497  cob_field *, cob_field *);
1498 COB_EXPIMP void cob_field_display (cob_field *, cob_field *, cob_field *,
1499  cob_field *, cob_field *, cob_field *,
1500  const int);
1501 COB_EXPIMP void cob_field_accept (cob_field *, cob_field *, cob_field *,
1502  cob_field *, cob_field *, cob_field *,
1503  cob_field *, cob_field *, const int);
1504 COB_EXPIMP void cob_accept_escape_key (cob_field *);
1505 COB_EXPIMP int cob_sys_clear_screen (void);
1506 COB_EXPIMP int cob_sys_sound_bell (void);
1507 COB_EXPIMP int cob_sys_get_csr_pos (unsigned char *);
1508 COB_EXPIMP int cob_sys_get_scr_size (unsigned char *, unsigned char *);
1509 
1510 /*******************************/
1511 /* Functions in termio.c */
1512 
1513 COB_EXPIMP void cob_display (const int, const int, const int, ...);
1514 COB_EXPIMP void cob_accept (cob_field *);
1515 
1516 /*******************************/
1517 /* Functions in fileio.c */
1518 
1519 COB_EXPIMP void cob_open (cob_file *, const int, const int, cob_field *);
1520 COB_EXPIMP void cob_close (cob_file *, cob_field *, const int, const int);
1521 COB_EXPIMP void cob_read (cob_file *, cob_field *, cob_field *, const int);
1522 COB_EXPIMP void cob_read_next (cob_file *, cob_field *, const int);
1523 COB_EXPIMP void cob_rewrite (cob_file *, cob_field *, const int, cob_field *);
1524 COB_EXPIMP void cob_delete (cob_file *, cob_field *);
1525 COB_EXPIMP void cob_start (cob_file *, const int, cob_field *,
1526  cob_field *, cob_field *);
1527 COB_EXPIMP void cob_write (cob_file *, cob_field *, const int,
1528  cob_field *, const unsigned int);
1529 
1530 COB_EXPIMP void cob_delete_file (cob_file *, cob_field *);
1531 COB_EXPIMP void cob_unlock_file (cob_file *, cob_field *);
1532 COB_EXPIMP void cob_commit (void);
1533 COB_EXPIMP void cob_rollback (void);
1534 
1535 /* File system routines */
1536 COB_EXPIMP int cob_sys_open_file (unsigned char *, unsigned char *,
1537  unsigned char *, unsigned char *,
1538  unsigned char *);
1539 COB_EXPIMP int cob_sys_create_file (unsigned char *, unsigned char *,
1540  unsigned char *, unsigned char *,
1541  unsigned char *);
1542 COB_EXPIMP int cob_sys_read_file (unsigned char *, unsigned char *,
1543  unsigned char *, unsigned char *,
1544  unsigned char *);
1545 COB_EXPIMP int cob_sys_write_file (unsigned char *, unsigned char *,
1546  unsigned char *, unsigned char *,
1547  unsigned char *);
1548 COB_EXPIMP int cob_sys_close_file (unsigned char *);
1549 COB_EXPIMP int cob_sys_flush_file (unsigned char *);
1550 COB_EXPIMP int cob_sys_delete_file (unsigned char *);
1551 COB_EXPIMP int cob_sys_copy_file (unsigned char *, unsigned char *);
1552 COB_EXPIMP int cob_sys_check_file_exist (unsigned char *, unsigned char *);
1553 COB_EXPIMP int cob_sys_rename_file (unsigned char *, unsigned char *);
1554 COB_EXPIMP int cob_sys_get_current_dir (const int, const int, unsigned char *);
1555 COB_EXPIMP int cob_sys_change_dir (unsigned char *);
1556 COB_EXPIMP int cob_sys_create_dir (unsigned char *);
1557 COB_EXPIMP int cob_sys_delete_dir (unsigned char *);
1558 COB_EXPIMP int cob_sys_chdir (unsigned char *, unsigned char *);
1559 COB_EXPIMP int cob_sys_mkdir (unsigned char *);
1560 COB_EXPIMP int cob_sys_copyfile (unsigned char *, unsigned char *,
1561  unsigned char *);
1562 COB_EXPIMP int cob_sys_file_info (unsigned char *, unsigned char *);
1563 COB_EXPIMP int cob_sys_file_delete (unsigned char *, unsigned char *);
1564 
1565 /* SORT routines */
1566 COB_EXPIMP void cob_file_sort_init (cob_file *, const unsigned int,
1567  const unsigned char *,
1568  void *, cob_field *);
1569 COB_EXPIMP void cob_file_sort_init_key (cob_file *, cob_field *,
1570  const int, const unsigned int);
1573 COB_EXPIMP void cob_file_sort_giving (cob_file *, const size_t, ...);
1576 
1577 /*******************************/
1578 /* Functions in intrinsic.c */
1579 
1580 COB_EXPIMP void cob_put_indirect_field (cob_field *);
1581 COB_EXPIMP void cob_get_indirect_field (cob_field *);
1582 COB_EXPIMP cob_field *cob_switch_value (const int);
1583 COB_EXPIMP cob_field *cob_intr_binop (cob_field *, const int,
1584  cob_field *);
1585 
1586 COB_EXPIMP int cob_valid_date_format (const char *);
1587 COB_EXPIMP int cob_valid_datetime_format (const char *);
1588 COB_EXPIMP int cob_valid_time_format (const char *);
1589 
1590 COB_EXPIMP cob_field *cob_intr_current_date (const int, const int);
1591 COB_EXPIMP cob_field *cob_intr_when_compiled (const int, const int,
1592  cob_field *);
1593 COB_EXPIMP cob_field *cob_intr_module_date (void);
1594 COB_EXPIMP cob_field *cob_intr_module_time (void);
1595 COB_EXPIMP cob_field *cob_intr_module_id (void);
1596 COB_EXPIMP cob_field *cob_intr_module_caller_id (void);
1597 COB_EXPIMP cob_field *cob_intr_module_source (void);
1598 COB_EXPIMP cob_field *cob_intr_module_formatted_date (void);
1599 COB_EXPIMP cob_field *cob_intr_module_path (void);
1600 COB_EXPIMP cob_field *cob_intr_exception_file (void);
1601 COB_EXPIMP cob_field *cob_intr_exception_location (void);
1602 COB_EXPIMP cob_field *cob_intr_exception_status (void);
1603 COB_EXPIMP cob_field *cob_intr_exception_statement (void);
1604 COB_EXPIMP cob_field *cob_intr_mon_decimal_point (void);
1605 COB_EXPIMP cob_field *cob_intr_num_decimal_point (void);
1606 COB_EXPIMP cob_field *cob_intr_mon_thousands_sep (void);
1607 COB_EXPIMP cob_field *cob_intr_num_thousands_sep (void);
1608 COB_EXPIMP cob_field *cob_intr_currency_symbol (void);
1609 COB_EXPIMP cob_field *cob_intr_char (cob_field *);
1610 COB_EXPIMP cob_field *cob_intr_ord (cob_field *);
1611 COB_EXPIMP cob_field *cob_intr_stored_char_length (cob_field *);
1612 COB_EXPIMP cob_field *cob_intr_combined_datetime (cob_field *, cob_field *);
1613 COB_EXPIMP cob_field *cob_intr_date_of_integer (cob_field *);
1614 COB_EXPIMP cob_field *cob_intr_day_of_integer (cob_field *);
1615 COB_EXPIMP cob_field *cob_intr_integer_of_date (cob_field *);
1616 COB_EXPIMP cob_field *cob_intr_integer_of_day (cob_field *);
1617 COB_EXPIMP cob_field *cob_intr_test_date_yyyymmdd (cob_field *);
1618 COB_EXPIMP cob_field *cob_intr_test_day_yyyyddd (cob_field *);
1619 COB_EXPIMP cob_field *cob_intr_test_numval (cob_field *);
1620 COB_EXPIMP cob_field *cob_intr_test_numval_c (cob_field *, cob_field *);
1621 COB_EXPIMP cob_field *cob_intr_test_numval_f (cob_field *);
1622 COB_EXPIMP cob_field *cob_intr_factorial (cob_field *);
1623 
1624 COB_EXPIMP cob_field *cob_intr_pi (void);
1625 COB_EXPIMP cob_field *cob_intr_e (void);
1626 COB_EXPIMP cob_field *cob_intr_exp (cob_field *);
1627 COB_EXPIMP cob_field *cob_intr_exp10 (cob_field *);
1628 COB_EXPIMP cob_field *cob_intr_abs (cob_field *);
1629 COB_EXPIMP cob_field *cob_intr_acos (cob_field *);
1630 COB_EXPIMP cob_field *cob_intr_asin (cob_field *);
1631 COB_EXPIMP cob_field *cob_intr_atan (cob_field *);
1632 COB_EXPIMP cob_field *cob_intr_cos (cob_field *);
1633 COB_EXPIMP cob_field *cob_intr_log (cob_field *);
1634 COB_EXPIMP cob_field *cob_intr_log10 (cob_field *);
1635 COB_EXPIMP cob_field *cob_intr_sin (cob_field *);
1636 COB_EXPIMP cob_field *cob_intr_sqrt (cob_field *);
1637 COB_EXPIMP cob_field *cob_intr_tan (cob_field *);
1638 
1639 COB_EXPIMP cob_field *cob_intr_upper_case (const int, const int,
1640  cob_field *);
1641 COB_EXPIMP cob_field *cob_intr_lower_case (const int, const int,
1642  cob_field *);
1643 COB_EXPIMP cob_field *cob_intr_reverse (const int, const int,
1644  cob_field *);
1645 COB_EXPIMP cob_field *cob_intr_concatenate (const int, const int,
1646  const int, ...);
1647 COB_EXPIMP cob_field *cob_intr_substitute (const int, const int,
1648  const int, ...);
1649 COB_EXPIMP cob_field *cob_intr_substitute_case (const int, const int,
1650  const int, ...);
1651 COB_EXPIMP cob_field *cob_intr_trim (const int, const int,
1652  cob_field *, const int);
1653 COB_EXPIMP cob_field *cob_intr_length (cob_field *);
1654 COB_EXPIMP cob_field *cob_intr_byte_length (cob_field *);
1655 COB_EXPIMP cob_field *cob_intr_integer (cob_field *);
1656 COB_EXPIMP cob_field *cob_intr_integer_part (cob_field *);
1657 COB_EXPIMP cob_field *cob_intr_fraction_part (cob_field *);
1658 COB_EXPIMP cob_field *cob_intr_sign (cob_field *);
1659 COB_EXPIMP cob_field *cob_intr_lowest_algebraic (cob_field *);
1660 COB_EXPIMP cob_field *cob_intr_highest_algebraic (cob_field *);
1661 COB_EXPIMP cob_field *cob_intr_numval (cob_field *);
1662 COB_EXPIMP cob_field *cob_intr_numval_c (cob_field *, cob_field *);
1663 COB_EXPIMP cob_field *cob_intr_numval_f (cob_field *);
1664 COB_EXPIMP cob_field *cob_intr_annuity (cob_field *, cob_field *);
1665 COB_EXPIMP cob_field *cob_intr_mod (cob_field *, cob_field *);
1666 COB_EXPIMP cob_field *cob_intr_rem (cob_field *, cob_field *);
1667 COB_EXPIMP cob_field *cob_intr_sum (const int, ...);
1668 COB_EXPIMP cob_field *cob_intr_ord_min (const int, ...);
1669 COB_EXPIMP cob_field *cob_intr_ord_max (const int, ...);
1670 COB_EXPIMP cob_field *cob_intr_min (const int, ...);
1671 COB_EXPIMP cob_field *cob_intr_max (const int, ...);
1672 COB_EXPIMP cob_field *cob_intr_midrange (const int, ...);
1673 COB_EXPIMP cob_field *cob_intr_median (const int, ...);
1674 COB_EXPIMP cob_field *cob_intr_mean (const int, ...);
1675 COB_EXPIMP cob_field *cob_intr_range (const int, ...);
1676 COB_EXPIMP cob_field *cob_intr_random (const int, ...);
1677 COB_EXPIMP cob_field *cob_intr_variance (const int, ...);
1678 COB_EXPIMP cob_field *cob_intr_standard_deviation (const int, ...);
1679 COB_EXPIMP cob_field *cob_intr_present_value (const int, ...);
1680 COB_EXPIMP cob_field *cob_intr_year_to_yyyy (const int, ...);
1681 COB_EXPIMP cob_field *cob_intr_date_to_yyyymmdd (const int, ...);
1682 COB_EXPIMP cob_field *cob_intr_day_to_yyyyddd (const int, ...);
1683 COB_EXPIMP cob_field *cob_intr_locale_compare (const int, ...);
1684 COB_EXPIMP cob_field *cob_intr_locale_date (const int, const int,
1685  cob_field *, cob_field *);
1686 COB_EXPIMP cob_field *cob_intr_locale_time (const int, const int,
1687  cob_field *, cob_field *);
1688 
1689 COB_EXPIMP cob_field *cob_intr_seconds_past_midnight (void);
1690 COB_EXPIMP cob_field *cob_intr_lcl_time_from_secs (const int, const int,
1691  cob_field *, cob_field *);
1692 
1693 COB_EXPIMP cob_field *cob_intr_seconds_from_formatted_time (cob_field *,
1694  cob_field *);
1695 
1696 COB_EXPIMP cob_field *cob_intr_boolean_of_integer (cob_field *, cob_field *);
1697 COB_EXPIMP cob_field *cob_intr_char_national (cob_field *);
1698 COB_EXPIMP cob_field *cob_intr_display_of (const int, const int,
1699  const int, ...);
1700 COB_EXPIMP cob_field *cob_intr_exception_file_n (void);
1701 COB_EXPIMP cob_field *cob_intr_exception_location_n (void);
1702 COB_EXPIMP cob_field *cob_intr_formatted_current_date (const int, const int,
1703  cob_field *);
1704 COB_EXPIMP cob_field *cob_intr_formatted_date (const int, const int,
1705  cob_field *, cob_field *);
1706 COB_EXPIMP cob_field *cob_intr_formatted_datetime (const int, const int,
1707  const int, ...);
1708 COB_EXPIMP cob_field *cob_intr_formatted_time (const int, const int,
1709  const int, ...);
1710 COB_EXPIMP cob_field *cob_intr_integer_of_boolean (cob_field *);
1711 COB_EXPIMP cob_field *cob_intr_national_of (const int, const int,
1712  const int, ...);
1713 COB_EXPIMP cob_field *cob_intr_standard_compare (const int, ...);
1714 COB_EXPIMP cob_field *cob_intr_test_formatted_datetime (cob_field *, cob_field *);
1715 
1716 COB_EXPIMP cob_field *cob_intr_integer_of_formatted_date (cob_field *,
1717  cob_field *);
1718 
1719 /*******************************/
1720 
1721 #endif /* COB_COMMON_H */