GnuCOBOL  2.0
A free COBOL compiler
coblocal.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  __cob_settings
 
struct  config_enum
 
struct  cob_time
 
struct  config_tbl
 

Macros

#define _(s)   s
 
#define N_(s)   s
 
#define COB_HIDDEN   extern
 
#define F_OK   0
 
#define X_OK   1
 
#define W_OK   2
 
#define R_OK   4
 
#define COB_DEPTH_LEVEL   32U
 
#define COB_DECIMAL_NAN   -32768
 
#define COB_DECIMAL_INF   -32767
 
#define COB_MPZ_DEF   1024UL
 
#define COB_MPF_PREC   2048UL
 
#define COB_MPF_CUTOFF   1024UL
 
#define COB_128_MSW(x)   x[1]
 
#define COB_128_LSW(x)   x[0]
 
#define COB_MPZ_ENDIAN   -1
 
#define COB_DEC_SPECIAL   COB_U64_C(0x7800000000000000)
 
#define COB_DEC_EXTEND   COB_U64_C(0x6000000000000000)
 
#define COB_DEC_SIGN   COB_U64_C(0x8000000000000000)
 
#define COB_64_IS_SPECIAL(x)   ((x & COB_DEC_SPECIAL) == COB_DEC_SPECIAL)
 
#define COB_128_IS_SPECIAL(x)   ((COB_128_MSW(x) & COB_DEC_SPECIAL) == COB_DEC_SPECIAL)
 
#define COB_64_IS_EXTEND(x)   ((x & COB_DEC_EXTEND) == COB_DEC_EXTEND)
 
#define COB_128_IS_EXTEND(x)   ((COB_128_MSW(x) & COB_DEC_EXTEND) == COB_DEC_EXTEND)
 
#define COB_64_EXPO_1   COB_U64_C(0x7FE0000000000000)
 
#define COB_64_SIGF_1   COB_U64_C(0x001FFFFFFFFFFFFF)
 
#define COB_64_EXPO_2   COB_U64_C(0x1FF8000000000000)
 
#define COB_64_SIGF_2   COB_U64_C(0x0007FFFFFFFFFFFF)
 
#define COB_64_OR_EXTEND   COB_U64_C(0x0020000000000000)
 
#define COB_128_EXPO_1   COB_U64_C(0x7FFE000000000000)
 
#define COB_128_SIGF_1   COB_U64_C(0x0001FFFFFFFFFFFF)
 
#define COB_128_EXPO_2   COB_U64_C(0x1FFF800000000000)
 
#define COB_128_SIGF_2   COB_U64_C(0x00007FFFFFFFFFFF)
 
#define COB_128_OR_EXTEND   COB_U64_C(0x0002000000000000)
 
#define COB_FIELD_INIT(x, y, z)
 
#define COB_ATTR_INIT(u, v, x, y, z)
 
#define COB_GET_SIGN(f)   (COB_FIELD_HAVE_SIGN (f) ? cob_real_get_sign (f) : 0)
 
#define COB_PUT_SIGN(f, s)   do { if (COB_FIELD_HAVE_SIGN (f)) cob_real_put_sign (f, s); } ONCE_COB
 
#define COB_CHK_PARMS(x, z)
 
#define _OFFSET_OF_
 
#define offsetof(s_name, m_name)   (int)(long)&(((s_name*)0))->m_name
 
#define COB_D2I(x)   ((x) & 0x0F)
 
#define COB_I2D(x)   ((x) + '0')
 
#define COB_MODULE_PTR   cobglobptr->cob_current_module
 
#define COB_TERM_BUFF   cobglobptr->cob_term_buff
 
#define COB_ACCEPT_STATUS   cobglobptr->cob_accept_status
 
#define COB_MAX_Y_COORD   cobglobptr->cob_max_y
 
#define COB_MAX_X_COORD   cobglobptr->cob_max_x
 
#define COB_DISP_TO_STDERR   cobsetptr->cob_disp_to_stderr
 
#define COB_BEEP_VALUE   cobsetptr->cob_beep_value
 
#define COB_TIMEOUT_SCALE   cobsetptr->cob_timeout_scale
 
#define COB_EXTENDED_STATUS   cobsetptr->cob_extended_status
 
#define COB_USE_ESC   cobsetptr->cob_use_esc
 
#define ENV_NOT   (1 << 1) /* Negate True/False value setting */
 
#define ENV_INT   (1 << 2) /* an 'int' */
 
#define ENV_SIZE   (1 << 3) /* size; number with K - kb, M - mb, G - GB */
 
#define ENV_BOOL   (1 << 4) /* int boolean; Yes, True, 1, No, False, 0, ... */
 
#define ENV_CHAR   (1 << 5) /* inline 'char[]' field */
 
#define ENV_STR   (1 << 6) /* a pointer to a string */
 
#define ENV_PATH   (1 << 7) /* a pointer to a file system path */
 
#define ENV_ENUM   (1 << 8) /* Value must in 'enum' list as match */
 
#define ENV_ENUMVAL   (1 << 9) /* Value must in 'enum' list as match or value */
 
#define STS_ENVSET   (1 << 15) /* value set via Env Var */
 
#define STS_CNFSET   (1 << 16) /* value set via config file */
 
#define STS_ENVCLR   (1 << 17) /* value removed from Env Var */
 
#define STS_RESET   (1 << 18) /* value was reset back to default */
 
#define STS_FNCSET   (1 << 19) /* value set via function call */
 
#define GRP_HIDE   0
 
#define GRP_CALL   1
 
#define GRP_FILE   2
 
#define GRP_SCREEN   3
 
#define GRP_MISC   4
 
#define GRP_SYSENV   5
 
#define GRP_MAX   6
 
#define SETPOS(member)   offsetof(cob_settings,member),sizeof(cobsetptr->member),0,0
 

Typedefs

typedef struct __cob_settings cob_settings
 

Functions

void cob_init_numeric (cob_global *)
 
void cob_init_termio (cob_global *, cob_settings *)
 
void cob_init_fileio (cob_global *, cob_settings *)
 
void cob_init_call (cob_global *, cob_settings *)
 
void cob_init_intrinsic (cob_global *)
 
void cob_init_strings (void)
 
void cob_init_move (cob_global *, cob_settings *)
 
void cob_init_screenio (cob_global *, cob_settings *)
 
void cob_exit_screen (void)
 
void cob_exit_numeric (void)
 
void cob_exit_fileio (void)
 
void cob_exit_call (void)
 
void cob_exit_intrinsic (void)
 
void cob_exit_strings (void)
 
char * cob_strdup (const char *)
 
int cob_real_get_sign (cob_field *)
 
void cob_real_put_sign (cob_field *, const int)
 
void cob_decimal_setget_fld (cob_field *, cob_field *, const int)
 
void cob_decimal_move_temp (cob_field *, cob_field *)
 
void cob_print_ieeedec (const cob_field *, FILE *)
 
void cob_print_realbin (const cob_field *, FILE *, const int)
 
void cob_screen_set_mode (const cob_u32_t)
 
int cob_get_exception_code (void)
 
int cob_check_env_true (char *)
 
int cob_check_env_false (char *)
 
const char * cob_get_exception_name (void)
 
void cob_field_to_string (const cob_field *, void *, const size_t)
 
void cob_parameter_check (const char *, const int)
 
void cob_runtime_error (const char *,...) COB_A_FORMAT12
 
char * cob_save_env_value (char *, char *)
 
cob_settingscob_get_settings_ptr (void)
 
int cob_ctoi (const char)
 
struct cob_time cob_get_current_date_and_time (void)
 

Macro Definition Documentation

#define _ (   s)    s

Definition at line 43 of file coblocal.h.

#define _OFFSET_OF_

Definition at line 172 of file coblocal.h.

#define COB_128_EXPO_1   COB_U64_C(0x7FFE000000000000)

Definition at line 133 of file coblocal.h.

Referenced by cob_decimal_set_ieee128dec().

#define COB_128_EXPO_2   COB_U64_C(0x1FFF800000000000)

Definition at line 137 of file coblocal.h.

Referenced by cob_decimal_set_ieee128dec().

#define COB_128_IS_EXTEND (   x)    ((COB_128_MSW(x) & COB_DEC_EXTEND) == COB_DEC_EXTEND)

Definition at line 118 of file coblocal.h.

Referenced by cob_decimal_set_ieee128dec().

#define COB_128_IS_SPECIAL (   x)    ((COB_128_MSW(x) & COB_DEC_SPECIAL) == COB_DEC_SPECIAL)

Definition at line 115 of file coblocal.h.

Referenced by cob_decimal_set_ieee128dec().

#define COB_128_LSW (   x)    x[0]

Definition at line 103 of file coblocal.h.

Referenced by cob_decimal_set_ieee128dec().

#define COB_128_MSW (   x)    x[1]

Definition at line 102 of file coblocal.h.

Referenced by cob_decimal_get_ieee128dec(), and cob_decimal_set_ieee128dec().

#define COB_128_OR_EXTEND   COB_U64_C(0x0002000000000000)

Definition at line 141 of file coblocal.h.

Referenced by cob_decimal_get_ieee128dec(), and cob_decimal_set_ieee128dec().

#define COB_128_SIGF_1   COB_U64_C(0x0001FFFFFFFFFFFF)

Definition at line 135 of file coblocal.h.

Referenced by cob_decimal_get_ieee128dec(), and cob_decimal_set_ieee128dec().

#define COB_128_SIGF_2   COB_U64_C(0x00007FFFFFFFFFFF)

Definition at line 139 of file coblocal.h.

Referenced by cob_decimal_get_ieee128dec(), and cob_decimal_set_ieee128dec().

#define COB_64_EXPO_1   COB_U64_C(0x7FE0000000000000)

Definition at line 122 of file coblocal.h.

Referenced by cob_decimal_set_ieee64dec().

#define COB_64_EXPO_2   COB_U64_C(0x1FF8000000000000)

Definition at line 126 of file coblocal.h.

Referenced by cob_decimal_set_ieee64dec().

#define COB_64_IS_EXTEND (   x)    ((x & COB_DEC_EXTEND) == COB_DEC_EXTEND)

Definition at line 117 of file coblocal.h.

Referenced by cob_decimal_set_ieee64dec().

#define COB_64_IS_SPECIAL (   x)    ((x & COB_DEC_SPECIAL) == COB_DEC_SPECIAL)

Definition at line 114 of file coblocal.h.

Referenced by cob_decimal_set_ieee64dec().

#define COB_64_OR_EXTEND   COB_U64_C(0x0020000000000000)

Definition at line 130 of file coblocal.h.

Referenced by cob_decimal_get_ieee64dec(), and cob_decimal_set_ieee64dec().

#define COB_64_SIGF_1   COB_U64_C(0x001FFFFFFFFFFFFF)

Definition at line 124 of file coblocal.h.

Referenced by cob_decimal_get_ieee64dec(), and cob_decimal_set_ieee64dec().

#define COB_64_SIGF_2   COB_U64_C(0x0007FFFFFFFFFFFF)

Definition at line 128 of file coblocal.h.

Referenced by cob_decimal_get_ieee64dec(), and cob_decimal_set_ieee64dec().

#define COB_ACCEPT_STATUS   cobglobptr->cob_accept_status

Definition at line 187 of file coblocal.h.

Referenced by cob_accept_escape_key(), cob_check_pos_status(), and cob_exit_screen().

#define COB_BEEP_VALUE   cobsetptr->cob_beep_value

Definition at line 192 of file coblocal.h.

Referenced by cob_beep(), and cob_sys_sound_bell().

#define COB_DEC_EXTEND   COB_U64_C(0x6000000000000000)

Definition at line 110 of file coblocal.h.

Referenced by cob_decimal_get_ieee128dec(), and cob_decimal_get_ieee64dec().

#define COB_DEC_SIGN   COB_U64_C(0x8000000000000000)
#define COB_DEC_SPECIAL   COB_U64_C(0x7800000000000000)

Definition at line 108 of file coblocal.h.

#define COB_DECIMAL_INF   -32767

Definition at line 83 of file coblocal.h.

Referenced by cob_decimal_print().

#define COB_DEPTH_LEVEL   32U

Definition at line 77 of file coblocal.h.

Referenced by cob_exit_intrinsic(), cob_init_intrinsic(), and make_field_entry().

#define COB_DISP_TO_STDERR   cobsetptr->cob_disp_to_stderr

Definition at line 191 of file coblocal.h.

Referenced by cob_display().

#define COB_EXTENDED_STATUS   cobsetptr->cob_extended_status

Definition at line 194 of file coblocal.h.

Referenced by cob_convert_key().

#define COB_HIDDEN   extern

Definition at line 57 of file coblocal.h.

#define COB_I2D (   x)    ((x) + '0')

Definition at line 183 of file coblocal.h.

Referenced by cob_move_binary_to_display(), cob_move_packed_to_display(), and save_status().

#define COB_MAX_X_COORD   cobglobptr->cob_max_x

Definition at line 189 of file coblocal.h.

Referenced by cob_screen_init().

#define COB_MAX_Y_COORD   cobglobptr->cob_max_y

Definition at line 188 of file coblocal.h.

Referenced by cob_screen_init().

#define COB_MODULE_PTR   cobglobptr->cob_current_module

Definition at line 185 of file coblocal.h.

Referenced by add_decimal_digits(), cob_accept(), cob_check_numdisp(), cob_check_numval(), cob_check_numval_f(), cob_check_pos_status(), cob_chk_file_mapping(), cob_cmp_all(), cob_cmp_alnum(), cob_cmp_numdisp(), cob_correct_numeric(), cob_fatal_error(), cob_file_sort_init(), cob_intr_currency_symbol(), cob_intr_formatted_current_date(), cob_intr_formatted_datetime(), cob_intr_formatted_time(), cob_intr_module_caller_id(), cob_intr_module_date(), cob_intr_module_formatted_date(), cob_intr_module_id(), cob_intr_module_path(), cob_intr_module_source(), cob_intr_module_time(), cob_intr_mon_decimal_point(), cob_intr_mon_thousands_sep(), cob_intr_num_decimal_point(), cob_intr_num_thousands_sep(), cob_intr_numval_f(), cob_intr_seconds_from_formatted_time(), cob_is_numeric(), cob_module_enter(), cob_module_leave(), cob_move_alphanum_to_display(), cob_move_display_to_edited(), cob_move_edited_to_display(), cob_real_get_sign(), cob_real_put_sign(), cob_restore_func(), cob_save_func(), cob_set_location(), cob_sys_calledby(), cob_sys_change_dir(), cob_sys_chdir(), cob_sys_check_file_exist(), cob_sys_copy_file(), cob_sys_create_dir(), cob_sys_delete_dir(), cob_sys_delete_file(), cob_sys_file_delete(), cob_sys_file_info(), cob_sys_getopt_long_long(), cob_sys_hosted(), cob_sys_justify(), cob_sys_oc_nanosleep(), cob_sys_parameter_size(), cob_sys_printable(), cob_sys_rename_file(), cob_sys_return_args(), cob_sys_sleep(), cob_sys_system(), cob_sys_x91(), cob_table_sort_init(), cob_trace_section(), display_common(), field_is_zero(), get_num_int_digits_for_no_zero_sup(), numval(), open_cbl_file(), and pretty_display_numeric().

#define COB_MPF_CUTOFF   1024UL

Definition at line 93 of file coblocal.h.

Referenced by cob_mpf_exp(), and cob_mpf_log().

#define COB_MPZ_DEF   1024UL

Definition at line 86 of file coblocal.h.

Referenced by cob_decimal_init(), cob_init_intrinsic(), and cob_init_numeric().

#define COB_MPZ_ENDIAN   -1

Definition at line 104 of file coblocal.h.

Referenced by cob_decimal_get_ieee128dec(), and cob_decimal_get_ieee64dec().

#define COB_TERM_BUFF   cobglobptr->cob_term_buff

Definition at line 186 of file coblocal.h.

Referenced by cob_accept(), display_numeric(), field_accept(), and pretty_display_numeric().

#define COB_TIMEOUT_SCALE   cobsetptr->cob_timeout_scale

Definition at line 193 of file coblocal.h.

Referenced by field_accept(), and screen_accept().

#define COB_USE_ESC   cobsetptr->cob_use_esc

Definition at line 195 of file coblocal.h.

Referenced by cob_convert_key().

#define ENV_BOOL   (1 << 4) /* int boolean; Yes, True, 1, No, False, 0, ... */

Definition at line 293 of file coblocal.h.

Referenced by get_config_val(), and set_config_val().

#define ENV_CHAR   (1 << 5) /* inline 'char[]' field */

Definition at line 294 of file coblocal.h.

Referenced by get_config_val(), and set_config_val().

#define ENV_ENUM   (1 << 8) /* Value must in 'enum' list as match */

Definition at line 297 of file coblocal.h.

Referenced by set_config_val().

#define ENV_ENUMVAL   (1 << 9) /* Value must in 'enum' list as match or value */

Definition at line 298 of file coblocal.h.

Referenced by set_config_val().

#define ENV_INT   (1 << 2) /* an 'int' */

Definition at line 291 of file coblocal.h.

Referenced by get_config_val(), and set_config_val().

#define ENV_NOT   (1 << 1) /* Negate True/False value setting */

Definition at line 290 of file coblocal.h.

Referenced by get_config_val(), and set_config_val().

#define ENV_PATH   (1 << 7) /* a pointer to a file system path */

Definition at line 296 of file coblocal.h.

Referenced by cb_config_entry(), cob_exit_common(), get_config_val(), and set_config_val().

#define ENV_SIZE   (1 << 3) /* size; number with K - kb, M - mb, G - GB */

Definition at line 292 of file coblocal.h.

Referenced by get_config_val(), and set_config_val().

#define ENV_STR   (1 << 6) /* a pointer to a string */

Definition at line 295 of file coblocal.h.

Referenced by cb_config_entry(), cob_exit_common(), get_config_val(), and set_config_val().

#define F_OK   0

Definition at line 61 of file coblocal.h.

#define GRP_CALL   1

Definition at line 307 of file coblocal.h.

#define GRP_FILE   2

Definition at line 308 of file coblocal.h.

#define GRP_HIDE   0

Definition at line 306 of file coblocal.h.

Referenced by cb_config_entry(), and cob_rescan_env_vals().

#define GRP_MAX   6

Definition at line 312 of file coblocal.h.

Referenced by print_runtime_env().

#define GRP_MISC   4

Definition at line 310 of file coblocal.h.

#define GRP_SCREEN   3

Definition at line 309 of file coblocal.h.

#define GRP_SYSENV   5

Definition at line 311 of file coblocal.h.

#define N_ (   s)    s

Definition at line 44 of file coblocal.h.

#define offsetof (   s_name,
  m_name 
)    (int)(long)&(((s_name*)0))->m_name

Definition at line 173 of file coblocal.h.

Referenced by cob_file_sort_init().

#define R_OK   4

Definition at line 73 of file coblocal.h.

#define SETPOS (   member)    offsetof(cob_settings,member),sizeof(cobsetptr->member),0,0

Definition at line 314 of file coblocal.h.

#define STS_CNFSET   (1 << 16) /* value set via config file */
#define STS_ENVCLR   (1 << 17) /* value removed from Env Var */

Definition at line 302 of file coblocal.h.

Referenced by cb_config_entry(), cob_load_config(), and print_runtime_env().

#define STS_ENVSET   (1 << 15) /* value set via Env Var */
#define STS_FNCSET   (1 << 19) /* value set via function call */

Definition at line 304 of file coblocal.h.

Referenced by print_runtime_env(), and set_config_val_by_name().

#define STS_RESET   (1 << 18) /* value was reset back to default */

Definition at line 303 of file coblocal.h.

Referenced by cb_config_entry(), and print_runtime_env().

#define W_OK   2

Definition at line 69 of file coblocal.h.

#define X_OK   1

Definition at line 65 of file coblocal.h.

Typedef Documentation

typedef struct __cob_settings cob_settings

Function Documentation

int cob_check_env_false ( char *  )

Definition at line 1086 of file common.c.

1087 {
1088  if (s) {
1089  if (strlen(s) == 1 && (*s == 'N' || *s == 'n' || *s == '0')) return 1;
1090  if (strcasecmp(s, "NO") == 0 || strcasecmp(s, "NONE") == 0 ||
1091  strcasecmp(s, "OFF") == 0 || strcasecmp(s, "FALSE") == 0) {
1092  return 1;
1093  }
1094  }
1095  return 0;
1096 }
int cob_check_env_true ( char *  )

Definition at line 1073 of file common.c.

1074 {
1075  if (s) {
1076  if (strlen(s) == 1 && (*s == 'Y' || *s == 'y' || *s == '1')) return 1;
1077  if (strcasecmp(s, "YES") == 0 || strcasecmp(s, "ON") == 0 ||
1078  strcasecmp(s, "TRUE") == 0) {
1079  return 1;
1080  }
1081  }
1082  return 0;
1083 }
int cob_ctoi ( const char  )

Definition at line 2651 of file common.c.

Referenced by cob_get_current_date_and_time(), seconds_from_formatted_time(), test_century(), test_day_of_year(), test_decade(), test_hour(), test_millenium(), test_month(), test_unit_year(), and test_week().

2652 {
2653  return (int) (digit - '0');
2654 }

Here is the caller graph for this function:

void cob_decimal_move_temp ( cob_field ,
cob_field  
)

Definition at line 3104 of file intrinsic.c.

References COB_ATTR_INIT, cob_decimal_get_field(), cob_decimal_set_field(), COB_FIELD_INIT, COB_FLAG_HAVE_SIGN, cob_move(), cob_trim_decimal(), COB_TYPE_NUMERIC_DISPLAY, make_field_entry(), NULL, cob_decimal::scale, and cob_decimal::value.

Referenced by cob_move().

3105 {
3106  short size, scale;
3107  cob_field_attr attr;
3108  cob_field field;
3109 
3110  cob_decimal_set_field (&d1, src);
3111  cob_trim_decimal (&d1);
3112 
3113  size = (short)mpz_sizeinbase (d1.value, 10);
3114  if (d1.scale > size) {
3115  size = (short)d1.scale;
3116  }
3117  scale = (short)d1.scale;
3119  scale, COB_FLAG_HAVE_SIGN, NULL);
3120  COB_FIELD_INIT (size, NULL, &attr);
3121  make_field_entry (&field);
3122  (void)cob_decimal_get_field (&d1, curr_field, 0);
3123  cob_move (curr_field, dst);
3124 }
static void make_field_entry(cob_field *f)
Definition: intrinsic.c:440
void cob_move(cob_field *, cob_field *)
Definition: move.c:1170
void cob_decimal_set_field(cob_decimal *, cob_field *)
Definition: numeric.c:1612
#define COB_ATTR_INIT(u, v, x, y, z)
Definition: coblocal.h:150
#define COB_FLAG_HAVE_SIGN
Definition: common.h:630
#define COB_FIELD_INIT(x, y, z)
Definition: coblocal.h:144
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
static void cob_trim_decimal(cob_decimal *d)
Definition: intrinsic.c:517
#define COB_TYPE_NUMERIC_DISPLAY
Definition: common.h:607
static cob_decimal d1
Definition: intrinsic.c:79
static cob_field * curr_field
Definition: intrinsic.c:105
int cob_decimal_get_field(cob_decimal *, cob_field *, const int)
Definition: numeric.c:1801
mpz_t value
Definition: common.h:985
int scale
Definition: common.h:986

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_decimal_setget_fld ( cob_field ,
cob_field ,
const int   
)

Definition at line 2007 of file numeric.c.

References cob_decimal_get_field(), and cob_decimal_set_field().

Referenced by cob_move().

2008 {
2009  cob_decimal_set_field (&cob_d1, src);
2010  (void)cob_decimal_get_field (&cob_d1, dst, opt);
2011 }
void cob_decimal_set_field(cob_decimal *d, cob_field *f)
Definition: numeric.c:1612
int cob_decimal_get_field(cob_decimal *d, cob_field *f, const int opt)
Definition: numeric.c:1801
static cob_decimal cob_d1
Definition: numeric.c:108

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_exit_call ( void  )

Definition at line 1204 of file call.c.

References call_table, cob_free(), struct_handle::handle, HASH_SIZE, call_hash::name, call_hash::next, struct_handle::next, NULL, call_hash::path, and struct_handle::path.

Referenced by cob_terminate_routines().

1205 {
1206  struct call_hash *p;
1207  struct call_hash *q;
1208  struct struct_handle *h;
1209  struct struct_handle *j;
1210 
1211 #ifndef COB_ALT_HASH
1212  size_t i;
1213 #endif
1214 
1215  if (call_filename_buff) {
1218  }
1219  if (call_entry_buff) {
1222  }
1223  if (call_entry2_buff) {
1226  }
1227  if (call_buffer) {
1229  call_buffer = NULL;
1230  }
1231  if (resolve_error_buff) {
1234  }
1235  if (resolve_alloc) {
1237  resolve_alloc = NULL;
1238  }
1239  if (resolve_path) {
1241  resolve_path = NULL;
1242  }
1243 
1244 #ifndef COB_ALT_HASH
1245  if (call_table) {
1246  for (i = 0; i < HASH_SIZE; ++i) {
1247  p = call_table[i];
1248 #else
1249  p = call_table;
1250 #endif
1251  for (; p;) {
1252  q = p;
1253  p = p->next;
1254  if (q->name) {
1255  cob_free ((void *)q->name);
1256  }
1257  if (q->path) {
1258  cob_free ((void *)q->path);
1259  }
1260  cob_free (q);
1261  }
1262 #ifndef COB_ALT_HASH
1263  }
1264  if (call_table) {
1265  cob_free (call_table);
1266  }
1267  call_table = NULL;
1268  }
1269 #endif
1270 
1271  for (h = base_preload_ptr; h;) {
1272  j = h;
1273  if (h->path) {
1274  cob_free ((void *)h->path);
1275  }
1276  if (h->handle) {
1277  lt_dlclose (h->handle);
1278  }
1279  h = h->next;
1280  cob_free (j);
1281  }
1283  for (h = base_dynload_ptr; h;) {
1284  j = h;
1285  if (h->path) {
1286  cob_free ((void *)h->path);
1287  }
1288  if (h->handle) {
1289  lt_dlclose (h->handle);
1290  }
1291  h = h->next;
1292  cob_free (j);
1293  }
1295 
1296 #if !defined(_WIN32) && !defined(USE_LIBDL)
1297  lt_dlexit ();
1298 #if 0 /* RXWRXW - ltdl leak */
1299  /* Weird - ltdl leaks mainhandle - This appears to work but .. */
1300  cob_free (mainhandle);
1301 #endif
1302 #endif
1303 
1304 }
void cob_free(void *mptr)
Definition: common.c:1284
struct struct_handle * next
Definition: call.c:140
static char * resolve_alloc
Definition: call.c:166
static char ** resolve_path
Definition: call.c:164
static struct call_hash ** call_table
Definition: call.c:155
static char * resolve_error_buff
Definition: call.c:167
lt_dlhandle handle
Definition: call.c:142
const char * name
Definition: call.c:131
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
static void * call_buffer
Definition: call.c:168
const char * path
Definition: call.c:141
struct call_hash * next
Definition: call.c:130
static char * call_filename_buff
Definition: call.c:169
static char * call_entry_buff
Definition: call.c:170
static unsigned char * call_entry2_buff
Definition: call.c:171
static struct struct_handle * base_dynload_ptr
Definition: call.c:159
const char * path
Definition: call.c:135
#define HASH_SIZE
Definition: call.c:122
static lt_dlhandle mainhandle
Definition: call.c:173
static struct struct_handle * base_preload_ptr
Definition: call.c:158

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_exit_fileio ( void  )

Definition at line 6282 of file fileio.c.

References _, cob_file::assign, cob_close(), COB_CLOSE_NORMAL, __cob_settings::cob_display_warn, cob_field_to_string(), COB_FILE_MAX, COB_FILE_SPECIAL, cob_free(), COB_OPEN_CLOSED, COB_OPEN_LOCKED, file_list::file, cob_file::flag_nonexistent, iscleanup(), file_list::next, NULL, cob_file::open_mode, runtime_buffer, and cob_file::select_name.

Referenced by cob_terminate_routines().

6283 {
6284  struct file_list *l;
6285  struct file_list *p;
6286 
6287  for (l = file_cache; l; l = l->next) {
6288  if (l->file && l->file->open_mode != COB_OPEN_CLOSED &&
6289  l->file->open_mode != COB_OPEN_LOCKED &&
6290  !l->file->flag_nonexistent) {
6291  if (COB_FILE_SPECIAL (l->file)) {
6292  continue;
6293  }
6294  cob_close (l->file, NULL, COB_CLOSE_NORMAL, 0);
6295  if (cobsetptr->cob_display_warn) {
6298  (size_t)COB_FILE_MAX);
6299  fprintf (stderr, _("WARNING - Implicit CLOSE of %s ('%s')"),
6301  putc ('\n', stderr);
6302  fflush (stderr);
6303  }
6304  }
6305  }
6306 #ifdef WITH_DB
6307  if (bdb_env) {
6308  bdb_env->lock_id_free (bdb_env, bdb_lock_id);
6309  bdb_env->close (bdb_env, 0);
6310  bdb_env = NULL;
6311  }
6312  if (record_lock_object) {
6313  cob_free (record_lock_object);
6314  record_lock_object = NULL;
6315  }
6316  if (bdb_buff) {
6317  cob_free (bdb_buff);
6318  bdb_buff = NULL;
6319  }
6320 
6321 #elif defined(WITH_ANY_ISAM)
6322 #ifndef WITH_DISAM
6323  (void)iscleanup ();
6324 #endif
6325 #endif
6326 
6327 #if defined(WITH_INDEX_EXTFH) || defined(WITH_SEQRA_EXTFH)
6328  extfh_cob_exit_fileio ();
6329 #endif
6330 
6331  if (runtime_buffer) {
6333  runtime_buffer = NULL;
6334  }
6335 
6336  for (l = file_cache; l;) {
6337  p = l;
6338  l = l->next;
6339  cob_free (p);
6340  }
6341  file_cache = NULL;
6342 }
void cob_free(void *mptr)
Definition: common.c:1284
static cob_settings * cobsetptr
Definition: fileio.c:235
static struct file_list * file_cache
Definition: fileio.c:241
#define COB_FILE_SPECIAL(x)
Definition: common.h:765
cob_field * assign
Definition: common.h:1114
unsigned int cob_display_warn
Definition: coblocal.h:204
#define COB_OPEN_CLOSED
Definition: common.h:783
void cob_field_to_string(const cob_field *, void *, const size_t)
Definition: common.c:1492
static char * runtime_buffer
Definition: fileio.c:247
#define _(s)
Definition: cobcrun.c:59
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
#define COB_OPEN_LOCKED
Definition: common.h:788
int iscleanup(void)
Definition: isopen.c:152
struct file_list * next
Definition: fileio.c:156
void cob_close(cob_file *f, cob_field *fnstatus, const int opt, const int remfil)
Definition: fileio.c:4498
cob_file * file
Definition: fileio.c:157
unsigned char open_mode
Definition: common.h:1130
#define COB_CLOSE_NORMAL
Definition: common.h:792
#define COB_FILE_MAX
Definition: common.h:548
unsigned char flag_nonexistent
Definition: common.h:1134
const char * select_name
Definition: common.h:1112

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_exit_intrinsic ( void  )

Definition at line 6521 of file intrinsic.c.

References calc_base, calc_struct::calc_field, COB_DEPTH_LEVEL, cob_free(), cob_log_half, cob_mexp, cob_mpft, cob_mpft2, cob_mpft_get, cob_mpzt, cob_pi, cob_sqrt_two, cob_u32_t, cob_field::data, and cob_decimal::value.

Referenced by cob_terminate_routines().

6522 {
6523  struct calc_struct *calc_temp;
6524  cob_u32_t i;
6525 
6526  mpf_clear (cob_log_half);
6527  mpf_clear (cob_sqrt_two);
6528  mpf_clear (cob_pi);
6529 
6530  mpf_clear (cob_mpft_get);
6531  mpf_clear (cob_mpft2);
6532  mpf_clear (cob_mpft);
6533 
6534  mpz_clear (d5.value);
6535  mpz_clear (d4.value);
6536  mpz_clear (d3.value);
6537  mpz_clear (d2.value);
6538  mpz_clear (d1.value);
6539 
6540  mpz_clear (cob_mpzt);
6541  mpz_clear (cob_mexp);
6542 
6543  if (calc_base) {
6544  calc_temp = calc_base;
6545  for (i = 0; i < COB_DEPTH_LEVEL; ++i, ++calc_temp) {
6546  if (calc_temp->calc_field.data) {
6547  cob_free (calc_temp->calc_field.data);
6548  }
6549  }
6550  cob_free (calc_base);
6551  }
6552 }
void cob_free(void *mptr)
Definition: common.c:1284
static cob_decimal d2
Definition: intrinsic.c:80
static cob_decimal d3
Definition: intrinsic.c:81
static mpz_t cob_mpzt
Definition: intrinsic.c:86
#define cob_u32_t
Definition: common.h:31
static mpf_t cob_mpft_get
Definition: intrinsic.c:90
cob_field calc_field
Definition: intrinsic.c:99
unsigned char * data
Definition: common.h:952
static mpz_t cob_mexp
Definition: intrinsic.c:85
static mpf_t cob_mpft2
Definition: intrinsic.c:89
static mpf_t cob_mpft
Definition: intrinsic.c:88
static cob_decimal d5
Definition: intrinsic.c:83
static mpf_t cob_sqrt_two
Definition: intrinsic.c:92
static struct calc_struct * calc_base
Definition: intrinsic.c:104
static mpf_t cob_pi
Definition: intrinsic.c:93
static cob_decimal d1
Definition: intrinsic.c:79
#define COB_DEPTH_LEVEL
Definition: coblocal.h:77
static cob_decimal d4
Definition: intrinsic.c:82
static mpf_t cob_log_half
Definition: intrinsic.c:91
mpz_t value
Definition: common.h:985

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_exit_numeric ( void  )

Definition at line 2637 of file numeric.c.

References cob_decimal_base, cob_free(), COB_MAX_BINARY, COB_MAX_DEC_STRUCT, cob_mexp, cob_mpft, cob_mpft_get, cob_mpz_ten16m1, cob_mpz_ten34m1, cob_mpze10, cob_mpzt, cob_mpzt2, d1, and cob_decimal::value.

Referenced by cob_terminate_routines().

2638 {
2639  cob_decimal *d1;
2640  size_t i;
2641 
2642  if (cob_decimal_base) {
2643  d1 = cob_decimal_base;
2644  for (i = 0; i < COB_MAX_DEC_STRUCT; d1++, i++) {
2645  mpz_clear (d1->value);
2646  }
2648  }
2649 
2650  mpz_clear (cob_d_remainder.value);
2651 
2652  mpz_clear (cob_d3.value);
2653  mpz_clear (cob_d2.value);
2654  mpz_clear (cob_d1.value);
2655 
2656  mpz_clear (cob_mexp);
2657  mpz_clear (cob_mpzt2);
2658  mpz_clear (cob_mpzt);
2659 
2660  mpz_clear (cob_mpz_ten34m1);
2661  mpz_clear (cob_mpz_ten16m1);
2662  for (i = 0; i < COB_MAX_BINARY; i++) {
2663  mpz_clear (cob_mpze10[i]);
2664  }
2665 
2666  mpf_clear (cob_mpft_get);
2667  mpf_clear (cob_mpft);
2668 }
static mpz_t cob_mpz_ten16m1
Definition: numeric.c:119
static mpz_t cob_mpzt2
Definition: numeric.c:117
void cob_free(void *mptr)
Definition: common.c:1284
static mpz_t cob_mpz_ten34m1
Definition: numeric.c:118
static mpz_t cob_mexp
Definition: numeric.c:115
static mpf_t cob_mpft_get
Definition: numeric.c:123
static mpz_t cob_mpze10[COB_MAX_BINARY]
Definition: numeric.c:120
cob_decimal * d1
Definition: cobxref.c.l.h:21
#define COB_MAX_DEC_STRUCT
Definition: common.h:571
static cob_decimal cob_d_remainder
Definition: numeric.c:111
static cob_decimal cob_d3
Definition: numeric.c:110
static mpz_t cob_mpzt
Definition: numeric.c:116
static mpf_t cob_mpft
Definition: numeric.c:122
static cob_decimal cob_d2
Definition: numeric.c:109
mpz_t value
Definition: common.h:985
static cob_decimal * cob_decimal_base
Definition: numeric.c:113
#define COB_MAX_BINARY
Definition: common.h:565
static cob_decimal cob_d1
Definition: numeric.c:108

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_exit_screen ( void  )

Definition at line 2401 of file screenio.c.

References COB_ACCEPT_STATUS, cob_free(), cob_move_to_beg_of_last_line(), __cob_global::cob_screen_initialized, and NULL.

Referenced by cob_runtime_error(), and cob_terminate_routines().

2402 {
2403  if (!cobglobptr) {
2404  return;
2405  }
2408  clear ();
2410  delwin (stdscr);
2411  endwin ();
2412 #ifdef HAVE_CURSES_FREEALL
2413  _nc_freeall ();
2414 #endif
2415  if (cob_base_inp) {
2417  cob_base_inp = NULL;
2418  }
2419  }
2420  COB_ACCEPT_STATUS = 0;
2421 }
void cob_free(void *mptr)
Definition: common.c:1284
static struct cob_inp_struct * cob_base_inp
Definition: screenio.c:100
static void cob_move_to_beg_of_last_line(void)
Definition: screenio.c:327
#define COB_ACCEPT_STATUS
Definition: coblocal.h:187
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
unsigned int cob_screen_initialized
Definition: common.h:1208
static cob_global * cobglobptr
Definition: screenio.c:92

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_exit_strings ( void  )

Definition at line 634 of file strings.c.

References cob_free(), figurative_ptr, figurative_size, inspect_mark, and NULL.

Referenced by cob_terminate_routines().

635 {
636  if (inspect_mark) {
638  inspect_mark = NULL;
639  }
640  if (dlm_list) {
641  cob_free (dlm_list);
642  dlm_list = NULL;
643  }
644  if (figurative_ptr) {
647  }
648  figurative_size = 0;
649 }
void cob_free(void *mptr)
Definition: common.c:1284
static int * inspect_mark
Definition: strings.c:61
static struct dlm_struct * dlm_list
Definition: strings.c:76
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
static unsigned char * figurative_ptr
Definition: strings.c:86
static size_t figurative_size
Definition: strings.c:87

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_field_to_string ( const cob_field ,
void *  ,
const size_t   
)

Definition at line 1492 of file common.c.

References cob_field::data, cob_field::size, and unlikely.

Referenced by cob_call_field(), cob_cancel_field(), cob_delete_file(), cob_display_env_value(), cob_display_environment(), cob_exit_fileio(), cob_fatal_error(), cob_get_environment(), cob_intr_locale_compare(), cob_intr_locale_date(), cob_open(), cob_set_locale(), and cob_sys_getopt_long_long().

1493 {
1494  unsigned char *s;
1495  size_t count;
1496  size_t i;
1497 
1498  count = 0;
1499  if (unlikely(f->size == 0)) {
1500  return;
1501  }
1502  i = f->size - 1;
1503  for (; ;) {
1504  if (f->data[i] && f->data[i] != (unsigned char)' ') {
1505  count = i + 1;
1506  break;
1507  }
1508  if (!i) {
1509  break;
1510  }
1511  --i;
1512  }
1513  if (count > maxsize) {
1514  count = maxsize;
1515  }
1516  s = (unsigned char *)str;
1517  for (i = 0; i < count; ++i) {
1518  s[i] = f->data[i];
1519  }
1520  s[i] = 0;
1521 }
#define unlikely(x)
Definition: common.h:437

Here is the caller graph for this function:

struct cob_time cob_get_current_date_and_time ( void  )

Definition at line 2699 of file common.c.

References cob_ctoi(), cob_time::day_of_month, cob_time::day_of_week, cob_time::hour, cob_time::minute, cob_time::month, cob_time::nanosecond, NULL, cob_time::offset_known, one_indexed_day_of_week_from_monday(), cob_time::second, set_unknown_offset(), cob_time::utc_offset, and cob_time::year.

Referenced by cob_accept_time(), cob_intr_current_date(), format_current_date(), and get_system_offset_time_ptr().

2700 {
2701 #if defined (HAVE_CLOCK_GETTIME)
2702  struct timespec time_spec;
2703 #elif defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY)
2704  struct timeval tmv;
2705 #endif
2706  time_t curtime;
2707  struct tm *tmptr;
2708  struct cob_time cb_time;
2709 #if defined(COB_STRFTIME)
2710  char iso_timezone[6] = { '\0' };
2711 #endif
2712 
2713  /* Get the current time */
2714 #if defined (HAVE_CLOCK_GETTIME)
2715  clock_gettime (CLOCK_REALTIME, &time_spec);
2716  curtime = time_spec.tv_sec;
2717 #elif defined (HAVE_SYS_TIME_H) && defined (HAVE_GETTIMEOFDAY)
2718  gettimeofday(&tmv, NULL);
2719  curtime = tmv.tv_sec;
2720 #else
2721  curtime = time (NULL);
2722 #endif
2723  tmptr = localtime (&curtime);
2724  /* Leap seconds ? */
2725  if (tmptr->tm_sec >= 60) {
2726  tmptr->tm_sec = 59;
2727  }
2728 
2729  cb_time.year = tmptr->tm_year + 1900;
2730  cb_time.month = tmptr->tm_mon + 1;
2731  cb_time.day_of_month = tmptr->tm_mday;
2732  cb_time.day_of_week = one_indexed_day_of_week_from_monday (tmptr->tm_wday);
2733  cb_time.hour = tmptr->tm_hour;
2734  cb_time.minute = tmptr->tm_min;
2735  cb_time.second = tmptr->tm_sec;
2736  cb_time.nanosecond = 0;
2737  cb_time.offset_known = 0;
2738  cb_time.utc_offset = 0;
2739 
2740  /* Get nanoseconds or microseconds, if possible */
2741 #if defined (HAVE_CLOCK_GETTIME)
2742  cb_time.nanosecond = time_spec.tv_nsec;
2743 #elif defined (HAVE_SYS_TIME_H) && defined (HAVE_GETTIMEOFDAY)
2744  cb_time.nanosecond = tmv.tv_usec * 1000;
2745 #else
2746  cb_time.nanosecond = 0;
2747 #endif
2748 
2749  /* Get the offset from UTC */
2750 #if defined (COB_STRFTIME)
2751  strftime (iso_timezone, (size_t) 6, "%z", tmptr);
2752 
2753  if (iso_timezone[0] == '0') {
2754  set_unknown_offset (&cb_time);
2755  } else {
2756  /* Convert the timezone string into minutes from UTC */
2757  cb_time.offset_known = 1;
2758  cb_time.utc_offset =
2759  cob_ctoi (iso_timezone[1]) * 60 * 10
2760  + cob_ctoi (iso_timezone[2]) * 60
2761  + cob_ctoi (iso_timezone[3]) * 10
2762  + cob_ctoi (iso_timezone[4]);
2763  if (iso_timezone[0] == '-') {
2764  cb_time.utc_offset *= -1;
2765  }
2766  }
2767 #elif defined (HAVE_TIMEZONE)
2768  cb_time.offset_known = 1;
2769  cb_time.utc_offset = timezone / 60;
2770 #else
2771  set_unknown_offset(&cb_time);
2772 #endif
2773 
2774  return cb_time;
2775 }
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
static int one_indexed_day_of_week_from_monday(int zero_indexed_from_sunday)
Definition: common.c:1147
int cob_ctoi(const char digit)
Definition: common.c:2651
static void set_unknown_offset(struct cob_time *time)
Definition: common.c:1153

Here is the call graph for this function:

Here is the caller graph for this function:

int cob_get_exception_code ( void  )

Definition at line 1193 of file common.c.

References __cob_global::cob_exception_code.

Referenced by cob_string_append(), and cob_unstring_into().

1194 {
1196 }
int cob_exception_code
Definition: common.h:1203
static cob_global * cobglobptr
Definition: common.c:130

Here is the caller graph for this function:

const char* cob_get_exception_name ( void  )

Definition at line 1199 of file common.c.

References __cob_global::cob_exception_code, cob_exception_tab_code, cob_exception_tab_name, EXCEPTION_TAB_SIZE, and NULL.

Referenced by cob_intr_exception_status().

1200 {
1201  size_t n;
1202 
1203  for (n = 0; n < EXCEPTION_TAB_SIZE; ++n) {
1205  return cob_exception_tab_name[n];
1206  }
1207  }
1208  return NULL;
1209 }
static const char *const cob_exception_tab_name[]
Definition: common.c:180
#define EXCEPTION_TAB_SIZE
Definition: common.c:196
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
int cob_exception_code
Definition: common.h:1203
static cob_global * cobglobptr
Definition: common.c:130
static const int cob_exception_tab_code[]
Definition: common.c:188

Here is the caller graph for this function:

cob_settings* cob_get_settings_ptr ( void  )

Definition at line 5384 of file common.c.

References cobsetptr.

5385 {
5386  return cobsetptr;
5387 }
static cob_settings * cobsetptr
Definition: common.c:131
void cob_init_call ( cob_global ,
cob_settings  
)

Definition at line 1307 of file call.c.

References cache_preload(), CALL_BUFF_SIZE, cob_fast_malloc(), cob_free(), COB_LIBRARY_PATH, __cob_settings::cob_library_path, cob_malloc(), COB_MEDIUM_BUFF, COB_MEDIUM_MAX, COB_MODULE_EXT, COB_NORMAL_BUFF, __cob_settings::cob_preload_str, cob_set_library_path(), COB_SMALL_BUFF, cob_strdup(), HASH_SIZE, NULL, PATHSEP_CHAR, PATHSEP_STR, resolve_size, and SLASH_CHAR.

Referenced by cob_init().

1308 {
1309  char *buff;
1310  char *s;
1311  char *p;
1312  size_t i;
1313 #ifndef HAVE_DESIGNATED_INITS
1314  const unsigned char *pv;
1315 #endif
1316 #ifdef __OS400__
1317  char *t;
1318 #endif
1319 
1320  cobglobptr = lptr;
1321  cobsetptr = sptr;
1322 
1325  resolve_path = NULL;
1326  resolve_alloc = NULL;
1327  resolve_error = NULL;
1329  mainhandle = NULL;
1330  call_buffer = NULL;
1334  call_table = NULL;
1335  call_lastsize = 0;
1336  resolve_size = 0;
1337  cob_jmp_primed = 0;
1338 
1339 #ifndef HAVE_DESIGNATED_INITS
1340  memset (valid_char, 0, sizeof(valid_char));
1341  for (pv = pvalid_char; *pv; ++pv) {
1342  valid_char[*pv] = 1;
1343  }
1344 #endif
1345 
1346  /* Big enough for anything from libdl/libltdl */
1348 
1349 #ifndef COB_ALT_HASH
1350  call_table = cob_malloc (sizeof (struct call_hash *) * HASH_SIZE);
1351 #endif
1352 
1355 
1356  buff = cob_fast_malloc ((size_t)COB_MEDIUM_BUFF);
1358  || strcmp(cobsetptr->cob_library_path, ".") == 0) {
1359  if (strcmp(COB_LIBRARY_PATH, ".") == 0) {
1360  snprintf (buff, (size_t)COB_MEDIUM_MAX, ".");
1361  } else {
1362  snprintf (buff, (size_t)COB_MEDIUM_MAX, ".%c%s",
1364  }
1365  } else {
1366  if (strcmp(COB_LIBRARY_PATH, ".") == 0) {
1367  snprintf (buff, (size_t)COB_MEDIUM_MAX, "%s%c.",
1369  } else {
1370  snprintf (buff, (size_t)COB_MEDIUM_MAX, "%s%c.%c%s",
1372  }
1373  }
1374  cob_set_library_path (buff);
1375 
1376  lt_dlinit ();
1377 
1378 #ifndef COB_BORKED_DLOPEN
1379  mainhandle = lt_dlopen (NULL);
1380 #endif
1381 
1382  if (cobsetptr->cob_preload_str != NULL) {
1383 
1385  s = strtok (p, PATHSEP_STR);
1386  for (; s; s = strtok (NULL, PATHSEP_STR)) {
1387 #ifdef __OS400__
1388  for (t = s; *t; ++t) {
1389  *t = toupper (*t);
1390  }
1391  cache_preload (t);
1392 #else
1393  for (i = 0; i < resolve_size; ++i) {
1394  buff[COB_MEDIUM_MAX] = 0;
1395  snprintf (buff, (size_t)COB_MEDIUM_MAX,
1396  "%s%c%s.%s",
1398  if (cache_preload (buff)) {
1399  break;
1400  }
1401  }
1402  /* If not found, try just using the name */
1403  if (i == resolve_size) {
1404  (void)cache_preload (s);
1405  }
1406 #endif
1407  }
1408  cob_free (p);
1409  }
1410  cob_free (buff);
1413 }
void cob_free(void *mptr)
Definition: common.c:1284
static char * resolve_error
Definition: call.c:165
static void cob_set_library_path(const char *path)
Definition: call.c:279
static char * resolve_alloc
Definition: call.c:166
static size_t resolve_size
Definition: call.c:176
static size_t cache_preload(const char *path)
Definition: call.c:451
static char ** resolve_path
Definition: call.c:164
static struct call_hash ** call_table
Definition: call.c:155
static size_t call_lastsize
Definition: call.c:175
char * cob_preload_str
Definition: coblocal.h:220
#define PATHSEP_CHAR
Definition: common.h:500
#define COB_NORMAL_BUFF
Definition: common.h:541
char * cob_library_path
Definition: coblocal.h:221
#define COB_SMALL_BUFF
Definition: common.h:540
#define COB_MEDIUM_BUFF
Definition: common.h:543
static char * resolve_error_buff
Definition: call.c:167
#define COB_MODULE_EXT
Definition: defaults.h:9
static cob_settings * cobsetptr
Definition: call.c:162
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
static const unsigned char pvalid_char[]
Definition: call.c:262
static void * call_buffer
Definition: call.c:168
#define PATHSEP_STR
Definition: common.h:501
#define CALL_BUFF_SIZE
Definition: call.c:119
#define SLASH_CHAR
Definition: common.h:505
static cob_global * cobglobptr
Definition: call.c:161
static char * call_filename_buff
Definition: call.c:169
static unsigned char valid_char[256]
Definition: call.c:261
char * cob_strdup(const char *)
Definition: common.c:1308
static char * call_entry_buff
Definition: call.c:170
static unsigned int cob_jmp_primed
Definition: call.c:177
void * cob_malloc(const size_t size)
Definition: common.c:1250
static unsigned char * call_entry2_buff
Definition: call.c:171
#define COB_LIBRARY_PATH
Definition: defaults.h:8
static struct struct_handle * base_dynload_ptr
Definition: call.c:159
void * cob_fast_malloc(const size_t size)
Definition: common.c:1296
#define HASH_SIZE
Definition: call.c:122
#define COB_MEDIUM_MAX
Definition: common.h:549
static lt_dlhandle mainhandle
Definition: call.c:173
static struct struct_handle * base_preload_ptr
Definition: call.c:158

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_init_fileio ( cob_global ,
cob_settings  
)

Definition at line 6345 of file fileio.c.

References check_eop_status, cob_fast_malloc(), COB_FILE_BUFF, cob_file_write_opt(), cob_malloc(), COB_SMALL_BUFF, __cob_settings::cob_sort_chunk, __cob_settings::cob_sort_memory, __cob_settings::cob_varseq_type, cob_vsq_len, eop_status, file_open_buff, file_open_env, file_open_name, NULL, and runtime_buffer.

Referenced by cob_init().

6346 {
6347 
6348  cobglobptr = lptr;
6349  cobsetptr = sptr;
6350  file_cache = NULL;
6351  eop_status = 0;
6352  check_eop_status = 0;
6355  }
6356 
6357  if(cobsetptr->cob_varseq_type == 3)
6358  cob_vsq_len = 2;
6359  else
6360  cob_vsq_len = 4;
6361 
6362  runtime_buffer = cob_fast_malloc ((size_t)(4 * COB_FILE_BUFF));
6366 
6367 #ifdef WITH_DB
6368  bdb_env = NULL;
6369  bdb_data_dir = NULL;
6370  join_environment ();
6371  record_lock_object = cob_malloc ((size_t)1024);
6372  bdb_buff = cob_malloc ((size_t)COB_SMALL_BUFF);
6373  rlo_size = 1024;
6374 #endif
6375 
6376 #if defined(WITH_INDEX_EXTFH) || defined(WITH_SEQRA_EXTFH)
6377  extfh_cob_init_fileio (&sequential_funcs, &lineseq_funcs,
6379 #endif
6380 }
static unsigned int eop_status
Definition: fileio.c:237
unsigned int cob_varseq_type
Definition: coblocal.h:233
static cob_settings * cobsetptr
Definition: fileio.c:235
static struct file_list * file_cache
Definition: fileio.c:241
size_t cob_sort_memory
Definition: coblocal.h:236
static const struct cob_fileio_funcs lineseq_funcs
Definition: fileio.c:317
#define COB_SMALL_BUFF
Definition: common.h:540
static const struct cob_fileio_funcs relative_funcs
Definition: fileio.c:328
size_t cob_sort_chunk
Definition: coblocal.h:237
static char * file_open_name
Definition: fileio.c:244
static const struct cob_fileio_funcs sequential_funcs
Definition: fileio.c:306
static char * runtime_buffer
Definition: fileio.c:247
#define COB_FILE_BUFF
Definition: common.h:542
static cob_global * cobglobptr
Definition: fileio.c:234
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
static size_t cob_vsq_len
Definition: fileio.c:239
static unsigned int check_eop_status
Definition: fileio.c:238
static char * file_open_buff
Definition: fileio.c:245
void * cob_malloc(const size_t size)
Definition: common.c:1250
static int cob_file_write_opt(cob_file *, const int)
Definition: fileio.c:836
static char * file_open_env
Definition: fileio.c:243
void * cob_fast_malloc(const size_t size)
Definition: common.c:1296

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_init_intrinsic ( cob_global )

Definition at line 6555 of file intrinsic.c.

References calc_base, calc_struct::calc_field, calc_struct::calc_size, COB_DEPTH_LEVEL, cob_log_half, COB_LOG_HALF_LEN, cob_log_half_str, cob_malloc(), cob_mexp, COB_MPF_PREC, cob_mpft, cob_mpft2, cob_mpft_get, COB_MPZ_DEF, cob_mpzt, cob_pi, COB_PI_LEN, cob_pi_str, cob_sqrt_two, COB_SQRT_TWO_LEN, cob_sqrt_two_str, cob_u32_t, curr_entry, cob_field::data, NULL, cob_decimal::scale, cob_field::size, and cob_decimal::value.

Referenced by cob_init().

6556 {
6557  struct calc_struct *calc_temp;
6558  cob_u32_t i;
6559 
6560  cobglobptr = lptr;
6561 
6562  move_field = NULL;
6563  curr_entry = 0;
6564  curr_field = NULL;
6565  calc_base = cob_malloc (COB_DEPTH_LEVEL * sizeof(struct calc_struct));
6566  calc_temp = calc_base;
6567  for (i = 0; i < COB_DEPTH_LEVEL; ++i, ++calc_temp) {
6568  calc_temp->calc_field.data = cob_malloc ((size_t)256);
6569  calc_temp->calc_field.size = 256;
6570  calc_temp->calc_size = 256;
6571  }
6572 
6573  mpz_init2 (cob_mexp, COB_MPZ_DEF);
6574  mpz_init2 (cob_mpzt, COB_MPZ_DEF);
6575  mpz_init2 (d1.value, 1536UL);
6576  d1.scale = 0;
6577  mpz_init2 (d2.value, 1536UL);
6578  d2.scale = 0;
6579  mpz_init2 (d3.value, 1536UL);
6580  d3.scale = 0;
6581  mpz_init2 (d4.value, 1536UL);
6582  d4.scale = 0;
6583  mpz_init2 (d5.value, 1536UL);
6584  d5.scale = 0;
6585 
6586  mpf_init2 (cob_mpft, COB_MPF_PREC);
6587  mpf_init2 (cob_mpft2, COB_MPF_PREC);
6588  mpf_init2 (cob_mpft_get, COB_MPF_PREC);
6589 
6590  mpf_init2 (cob_pi, COB_PI_LEN);
6591  mpf_set_str (cob_pi, cob_pi_str, 10);
6592 
6593  mpf_init2 (cob_sqrt_two, COB_SQRT_TWO_LEN);
6594  mpf_set_str (cob_sqrt_two, cob_sqrt_two_str, 10);
6595 
6596  mpf_init2 (cob_log_half, COB_LOG_HALF_LEN);
6597  mpf_set_str (cob_log_half, cob_log_half_str, 10);
6598 }
static cob_decimal d2
Definition: intrinsic.c:80
static cob_decimal d3
Definition: intrinsic.c:81
static cob_field * move_field
Definition: intrinsic.c:77
static mpz_t cob_mpzt
Definition: intrinsic.c:86
#define cob_u32_t
Definition: common.h:31
static const char cob_log_half_str[]
Definition: intrinsic.c:405
static mpf_t cob_mpft_get
Definition: intrinsic.c:90
#define COB_SQRT_TWO_LEN
Definition: intrinsic.c:426
cob_field calc_field
Definition: intrinsic.c:99
static cob_u32_t curr_entry
Definition: intrinsic.c:106
unsigned char * data
Definition: common.h:952
static mpz_t cob_mexp
Definition: intrinsic.c:85
#define COB_MPZ_DEF
Definition: coblocal.h:86
static mpf_t cob_mpft2
Definition: intrinsic.c:89
#define COB_PI_LEN
Definition: intrinsic.c:425
#define COB_LOG_HALF_LEN
Definition: intrinsic.c:427
static mpf_t cob_mpft
Definition: intrinsic.c:88
static cob_decimal d5
Definition: intrinsic.c:83
static cob_global * cobglobptr
Definition: intrinsic.c:71
size_t calc_size
Definition: intrinsic.c:101
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
static const char cob_pi_str[]
Definition: intrinsic.c:359
static mpf_t cob_sqrt_two
Definition: intrinsic.c:92
static struct calc_struct * calc_base
Definition: intrinsic.c:104
static mpf_t cob_pi
Definition: intrinsic.c:93
static cob_decimal d1
Definition: intrinsic.c:79
#define COB_DEPTH_LEVEL
Definition: coblocal.h:77
static cob_field * curr_field
Definition: intrinsic.c:105
size_t size
Definition: common.h:951
static cob_decimal d4
Definition: intrinsic.c:82
#define COB_MPF_PREC
Definition: coblocal.h:89
void * cob_malloc(const size_t size)
Definition: common.c:1250
static const char cob_sqrt_two_str[]
Definition: intrinsic.c:379
static mpf_t cob_log_half
Definition: intrinsic.c:91
mpz_t value
Definition: common.h:985
int scale
Definition: common.h:986

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_init_move ( cob_global ,
cob_settings  
)

Definition at line 1683 of file move.c.

Referenced by cob_init().

1684 {
1685  cobglobptr = lptr;
1686  cobsetptr = sptr;
1687 }
static cob_global * cobglobptr
Definition: move.c:42
static cob_settings * cobsetptr
Definition: move.c:43

Here is the caller graph for this function:

void cob_init_numeric ( cob_global )

Definition at line 2671 of file numeric.c.

References cob_decimal_base, cob_decimal_init(), cob_malloc(), COB_MAX_BINARY, COB_MAX_DEC_STRUCT, cob_mexp, COB_MPF_PREC, cob_mpft, cob_mpft_get, COB_MPZ_DEF, cob_mpz_ten16m1, cob_mpz_ten34m1, cob_mpze10, cob_mpzt, cob_mpzt2, cob_u32_t, cob_uli_t, d1, last_packed_val, and packed_value.

Referenced by cob_init().

2672 {
2673  cob_decimal *d1;
2674  cob_u32_t i;
2675 
2676  cobglobptr = lptr;
2677 
2678  memset (packed_value, 0, sizeof(packed_value));
2679  last_packed_val = 0;
2680 
2681  mpf_init2 (cob_mpft, COB_MPF_PREC);
2682  mpf_init2 (cob_mpft_get, COB_MPF_PREC);
2683 
2684  for (i = 0; i < COB_MAX_BINARY; i++) {
2685  mpz_init2 (cob_mpze10[i], 128UL);
2686  mpz_ui_pow_ui (cob_mpze10[i], 10UL, (cob_uli_t)i);
2687  }
2688  mpz_init_set (cob_mpz_ten16m1, cob_mpze10[16]);
2689  mpz_sub_ui (cob_mpz_ten16m1, cob_mpz_ten16m1, 1UL);
2690  mpz_init_set (cob_mpz_ten34m1, cob_mpze10[34]);
2691  mpz_sub_ui (cob_mpz_ten34m1, cob_mpz_ten34m1, 1UL);
2692 
2693  mpz_init2 (cob_mpzt, COB_MPZ_DEF);
2694  mpz_init2 (cob_mpzt2, COB_MPZ_DEF);
2695  mpz_init2 (cob_mexp, COB_MPZ_DEF);
2696 
2701 
2703  d1 = cob_decimal_base;
2704  for (i = 0; i < COB_MAX_DEC_STRUCT; d1++, i++) {
2705  cob_decimal_init (d1);
2706  }
2707 }
static mpz_t cob_mpz_ten16m1
Definition: numeric.c:119
static mpz_t cob_mpzt2
Definition: numeric.c:117
static unsigned char packed_value[20]
Definition: numeric.c:125
static mpz_t cob_mpz_ten34m1
Definition: numeric.c:118
#define cob_u32_t
Definition: common.h:31
static cob_global * cobglobptr
Definition: numeric.c:56
static mpz_t cob_mexp
Definition: numeric.c:115
static mpf_t cob_mpft_get
Definition: numeric.c:123
static cob_u64_t last_packed_val
Definition: numeric.c:126
static mpz_t cob_mpze10[COB_MAX_BINARY]
Definition: numeric.c:120
cob_decimal * d1
Definition: cobxref.c.l.h:21
#define COB_MAX_DEC_STRUCT
Definition: common.h:571
static cob_decimal cob_d_remainder
Definition: numeric.c:111
#define COB_MPZ_DEF
Definition: coblocal.h:86
static cob_decimal cob_d3
Definition: numeric.c:110
#define cob_uli_t
Definition: common.h:33
static mpz_t cob_mpzt
Definition: numeric.c:116
static mpf_t cob_mpft
Definition: numeric.c:122
#define COB_MPF_PREC
Definition: coblocal.h:89
void * cob_malloc(const size_t size)
Definition: common.c:1250
static cob_decimal cob_d2
Definition: numeric.c:109
void cob_decimal_init(cob_decimal *d)
Definition: numeric.c:321
static cob_decimal * cob_decimal_base
Definition: numeric.c:113
#define COB_MAX_BINARY
Definition: common.h:565
static cob_decimal cob_d1
Definition: numeric.c:108

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_init_screenio ( cob_global ,
cob_settings  
)

Definition at line 2567 of file screenio.c.

Referenced by cob_init().

2568 {
2569  cobglobptr = lptr;
2570  cobsetptr = sptr;
2571 }
static cob_settings * cobsetptr
Definition: screenio.c:93
static cob_global * cobglobptr
Definition: screenio.c:92

Here is the caller graph for this function:

void cob_init_strings ( void  )

Definition at line 652 of file strings.c.

References cob_field::attr, cob_malloc(), COB_NORMAL_BUFF, cob_u8_ptr, const_alpha_attr, const_strall_attr, cob_field::data, DLM_DEFAULT_NUM, dlm_list_size, figurative_ptr, figurative_size, inspect_mark, inspect_mark_size, NULL, and cob_field::size.

Referenced by cob_init().

653 {
655  dlm_list = cob_malloc (DLM_DEFAULT_NUM * sizeof(struct dlm_struct));
659  figurative_size = 0;
660  alpha_fld.size = 0;
661  alpha_fld.data = NULL;
663  str_cob_low.size = 1;
664  str_cob_low.data = (cob_u8_ptr)"\0";
666 }
static size_t inspect_mark_size
Definition: strings.c:62
#define DLM_DEFAULT_NUM
Definition: strings.c:43
static const cob_field_attr const_alpha_attr
Definition: strings.c:52
#define COB_NORMAL_BUFF
Definition: common.h:541
static cob_field str_cob_low
Definition: strings.c:90
unsigned char * data
Definition: common.h:952
static int * inspect_mark
Definition: strings.c:61
#define cob_u8_ptr
Definition: common.h:66
static struct dlm_struct * dlm_list
Definition: strings.c:76
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
static cob_field alpha_fld
Definition: strings.c:89
static size_t dlm_list_size
Definition: strings.c:79
static const cob_field_attr const_strall_attr
Definition: strings.c:54
size_t size
Definition: common.h:951
const cob_field_attr * attr
Definition: common.h:953
void * cob_malloc(const size_t size)
Definition: common.c:1250
static unsigned char * figurative_ptr
Definition: strings.c:86
static size_t figurative_size
Definition: strings.c:87

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_init_termio ( cob_global ,
cob_settings  
)

Definition at line 343 of file termio.c.

Referenced by cob_init().

344 {
345  cobglobptr = lptr;
346  cobsetptr = sptr;
347 }
static cob_settings * cobsetptr
Definition: termio.c:44
static cob_global * cobglobptr
Definition: termio.c:43

Here is the caller graph for this function:

void cob_parameter_check ( const char *  ,
const int   
)

Definition at line 1907 of file common.c.

References _, __cob_global::cob_call_params, cob_runtime_error(), and cob_stop_run().

1908 {
1909  if (cobglobptr->cob_call_params < numparms) {
1910  cob_runtime_error (_("CALL to %s requires %d parameters"),
1911  funcname, numparms);
1912  cob_stop_run (1);
1913  }
1914 }
int cob_call_params
Definition: common.h:1204
#define _(s)
Definition: cobcrun.c:59
static cob_global * cobglobptr
Definition: common.c:130
void cob_runtime_error(const char *fmt,...)
Definition: common.c:1543
void cob_stop_run(const int status)
Definition: common.c:1524

Here is the call graph for this function:

void cob_print_ieeedec ( const cob_field ,
FILE *   
)

Definition at line 1647 of file numeric.c.

References cob_decimal_print(), cob_decimal_set_double(), cob_decimal_set_ieee128dec(), cob_decimal_set_ieee64dec(), COB_FIELD_TYPE, COB_TYPE_NUMERIC_DOUBLE, COB_TYPE_NUMERIC_FLOAT, COB_TYPE_NUMERIC_FP_DEC128, COB_TYPE_NUMERIC_FP_DEC64, and cob_field::data.

Referenced by display_common().

1648 {
1649  union {
1650  double dval;
1651  float fval;
1652  } uval;
1653 
1654  switch (COB_FIELD_TYPE (f)) {
1657  break;
1660  break;
1662  memcpy ((void *)&uval.fval, f->data, sizeof(float));
1663  cob_decimal_set_double (&cob_d3, (double)uval.fval);
1664  break;
1666  memcpy ((void *)&uval.dval, f->data, sizeof(double));
1667  cob_decimal_set_double (&cob_d3, uval.dval);
1668  break;
1669  default:
1670  return;
1671  }
1672  cob_decimal_print (&cob_d3, fp);
1673 }
static void cob_decimal_set_double(cob_decimal *d, const double v)
Definition: numeric.c:821
#define COB_FIELD_TYPE(f)
Definition: common.h:662
static cob_decimal cob_d3
Definition: numeric.c:110
static void cob_decimal_set_ieee64dec(cob_decimal *d, const cob_field *f)
Definition: numeric.c:551
#define COB_TYPE_NUMERIC_FP_DEC64
Definition: common.h:613
#define COB_TYPE_NUMERIC_FLOAT
Definition: common.h:610
#define COB_TYPE_NUMERIC_DOUBLE
Definition: common.h:611
static void cob_decimal_print(cob_decimal *d, FILE *fp)
Definition: numeric.c:364
#define COB_TYPE_NUMERIC_FP_DEC128
Definition: common.h:614
static void cob_decimal_set_ieee128dec(cob_decimal *d, const cob_field *f)
Definition: numeric.c:688

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_print_realbin ( const cob_field ,
FILE *  ,
const int   
)

Definition at line 1676 of file numeric.c.

References CB_FMT_PLLD, CB_FMT_PLLU, cob_binary_get_sint64(), cob_binary_get_uint64(), COB_FIELD_HAVE_SIGN, cob_s64_t, and cob_u64_t.

Referenced by display_common().

1677 {
1678  union {
1679  cob_u64_t uval;
1680  cob_s64_t val;
1681  } llval;
1682 
1683  if (COB_FIELD_HAVE_SIGN (f)) {
1684  llval.val = cob_binary_get_sint64 (f);
1685  fprintf (fp, CB_FMT_PLLD, size, size, llval.val);
1686  return;
1687  }
1688  llval.uval = cob_binary_get_uint64 (f);
1689  fprintf (fp, CB_FMT_PLLU, size, size, llval.uval);
1690 }
#define CB_FMT_PLLD
Definition: common.h:58
#define cob_s64_t
Definition: common.h:51
#define CB_FMT_PLLU
Definition: common.h:59
#define COB_FIELD_HAVE_SIGN(f)
Definition: common.h:643
#define cob_u64_t
Definition: common.h:52
static COB_INLINE COB_A_INLINE cob_u64_t cob_binary_get_uint64(const cob_field *const f)
Definition: numeric.c:263
static COB_INLINE COB_A_INLINE cob_s64_t cob_binary_get_sint64(const cob_field *const f)
Definition: numeric.c:237

Here is the call graph for this function:

Here is the caller graph for this function:

int cob_real_get_sign ( cob_field )

Definition at line 2205 of file common.c.

References COB_FIELD_NO_SIGN_NIBBLE, COB_FIELD_SIGN_LEADING, COB_FIELD_SIGN_SEPARATE, COB_FIELD_TYPE, cob_get_sign_ascii(), cob_get_sign_ebcdic(), COB_MODULE_PTR, COB_TYPE_NUMERIC_DISPLAY, COB_TYPE_NUMERIC_PACKED, cob_field::data, cob_field::size, and unlikely.

2206 {
2207  unsigned char *p;
2208 
2209  switch (COB_FIELD_TYPE (f)) {
2211  /* Locate sign */
2212  if (unlikely(COB_FIELD_SIGN_LEADING (f))) {
2213  p = f->data;
2214  } else {
2215  p = f->data + f->size - 1;
2216  }
2217 
2218  /* Get sign */
2219  if (unlikely(COB_FIELD_SIGN_SEPARATE (f))) {
2220  return (*p == '-') ? -1 : 1;
2221  }
2222  if (*p >= (unsigned char)'0' && *p <= (unsigned char)'9') {
2223  return 1;
2224  }
2225  if (*p == ' ') {
2226 #if 0 /* RXWRXW - Space sign */
2227  *p = (unsigned char)'0';
2228 #endif
2229  return 1;
2230  }
2231  if (unlikely(COB_MODULE_PTR->ebcdic_sign)) {
2232  return cob_get_sign_ebcdic (p);
2233  }
2234  return cob_get_sign_ascii (p);
2236  if (COB_FIELD_NO_SIGN_NIBBLE (f)) {
2237  return 1;
2238  }
2239  p = f->data + f->size - 1;
2240  return ((*p & 0x0F) == 0x0D) ? -1 : 1;
2241  }
2242  return 0;
2243 }
#define COB_TYPE_NUMERIC_PACKED
Definition: common.h:609
#define COB_FIELD_TYPE(f)
Definition: common.h:662
static int cob_get_sign_ascii(unsigned char *p)
Definition: common.c:651
#define COB_FIELD_SIGN_SEPARATE(f)
Definition: common.h:644
#define COB_FIELD_NO_SIGN_NIBBLE(f)
Definition: common.h:651
#define unlikely(x)
Definition: common.h:437
#define COB_TYPE_NUMERIC_DISPLAY
Definition: common.h:607
#define COB_MODULE_PTR
Definition: coblocal.h:185
static int cob_get_sign_ebcdic(unsigned char *p)
Definition: common.c:747
#define COB_FIELD_SIGN_LEADING(f)
Definition: common.h:645

Here is the call graph for this function:

void cob_real_put_sign ( cob_field ,
const int   
)

Definition at line 2246 of file common.c.

References COB_FIELD_NO_SIGN_NIBBLE, COB_FIELD_SIGN_LEADING, COB_FIELD_SIGN_SEPARATE, COB_FIELD_TYPE, COB_MODULE_PTR, cob_put_sign_ascii(), cob_put_sign_ebcdic(), COB_TYPE_NUMERIC_DISPLAY, COB_TYPE_NUMERIC_PACKED, cob_u8_t, cob_field::data, cob_field::size, and unlikely.

2247 {
2248  unsigned char *p;
2249  unsigned char c;
2250 
2251  switch (COB_FIELD_TYPE (f)) {
2253  /* Locate sign */
2254  if (unlikely(COB_FIELD_SIGN_LEADING (f))) {
2255  p = f->data;
2256  } else {
2257  p = f->data + f->size - 1;
2258  }
2259 
2260  /* Put sign */
2261  if (unlikely(COB_FIELD_SIGN_SEPARATE (f))) {
2262  c = (sign < 0) ? (cob_u8_t)'-' : (cob_u8_t)'+';
2263  if (*p != c) {
2264  *p = c;
2265  }
2266  } else if (unlikely(COB_MODULE_PTR->ebcdic_sign)) {
2268  } else if (sign < 0) {
2269  cob_put_sign_ascii (p);
2270  }
2271  return;
2273  if (COB_FIELD_NO_SIGN_NIBBLE (f)) {
2274  return;
2275  }
2276  p = f->data + f->size - 1;
2277  if (sign < 0) {
2278  *p = (*p & 0xF0) | 0x0D;
2279  } else {
2280  *p = (*p & 0xF0) | 0x0C;
2281  }
2282  return;
2283  }
2284 }
static void cob_put_sign_ebcdic(unsigned char *p, const int sign)
Definition: common.c:821
#define COB_TYPE_NUMERIC_PACKED
Definition: common.h:609
#define COB_FIELD_TYPE(f)
Definition: common.h:662
#define cob_u8_t
Definition: common.h:27
#define COB_FIELD_SIGN_SEPARATE(f)
Definition: common.h:644
#define COB_FIELD_NO_SIGN_NIBBLE(f)
Definition: common.h:651
#define unlikely(x)
Definition: common.h:437
if sign
Definition: flag.def:42
#define COB_TYPE_NUMERIC_DISPLAY
Definition: common.h:607
#define COB_MODULE_PTR
Definition: coblocal.h:185
static void cob_put_sign_ascii(unsigned char *p)
Definition: common.c:699
#define COB_FIELD_SIGN_LEADING(f)
Definition: common.h:645

Here is the call graph for this function:

void cob_runtime_error ( const char *  ,
  ... 
)

Definition at line 1543 of file common.c.

References _, cob_exit_screen(), cob_free(), cob_source_file, cob_source_line, hdlrs, handlerlist::next, NULL, handlerlist::proc, and runtime_err_str.

Referenced by cob_call(), cob_call_error(), cob_cancel(), cob_check_based(), cob_check_linkage(), cob_check_numeric(), cob_check_odo(), cob_check_ref_mod(), cob_check_subscript(), cob_check_version(), cob_command_line(), cob_external_addr(), cob_fatal_error(), cob_get_sort_tempfile(), cob_longjmp(), cob_parameter_check(), cob_resolve_func(), cob_savenv(), cob_screen_init(), cob_sys_check_file_exist(), cob_sys_file_info(), cob_sys_getopt_long_long(), and cob_sys_system().

1544 {
1545  struct handlerlist *h;
1546  struct handlerlist *hp;
1547  char *p;
1548  va_list ap;
1549 
1550 #if 1 /* RXWRXW - Exit screen */
1551  /* Exit screen mode early */
1552  cob_exit_screen ();
1553 #endif
1554 
1555  if (hdlrs != NULL) {
1556  if (runtime_err_str) {
1557  p = runtime_err_str;
1558  if (cob_source_file) {
1559  sprintf (runtime_err_str, "%s: %u: ",
1561  p = runtime_err_str + strlen (runtime_err_str);
1562  }
1563  va_start (ap, fmt);
1564  vsprintf (p, fmt, ap);
1565  va_end (ap);
1566  }
1567  h = hdlrs;
1568  while (h != NULL) {
1569  if (runtime_err_str) {
1570  h->proc (runtime_err_str);
1571  } else {
1572  h->proc ((char *)_("Malloc error"));
1573  }
1574  hp = h;
1575  h = h->next;
1576  cob_free (hp);
1577  }
1578  hdlrs = NULL;
1579  }
1580 
1581  /* Prefix */
1582  if (cob_source_file) {
1583  fprintf (stderr, "%s: ", cob_source_file);
1584  if (cob_source_line) {
1585  fprintf (stderr, "%u: ", cob_source_line);
1586  }
1587  }
1588  fputs ("libcob: ", stderr);
1589 
1590  /* Body */
1591  va_start (ap, fmt);
1592  vfprintf (stderr, fmt, ap);
1593  va_end (ap);
1594 
1595  /* Postfix */
1596  putc ('\n', stderr);
1597  fflush (stderr);
1598 }
void cob_free(void *mptr)
Definition: common.c:1284
int(* proc)(char *s)
Definition: common.c:212
static unsigned int cob_source_line
Definition: common.c:156
static struct handlerlist * hdlrs
#define _(s)
Definition: cobcrun.c:59
struct handlerlist * next
Definition: common.c:211
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
void cob_exit_screen(void)
Definition: screenio.c:2401
static const char * cob_source_file
Definition: common.c:153
static char * runtime_err_str
Definition: common.c:133

Here is the call graph for this function:

Here is the caller graph for this function:

char* cob_save_env_value ( char *  ,
char *   
)

Definition at line 4319 of file common.c.

References cob_fast_malloc(), cob_free(), and NULL.

4320 {
4321  if (!env_val) return NULL;
4322 
4323  if (env_var) cob_free(env_var);
4324  env_var = (char*) cob_fast_malloc(strlen(env_val) + 1);
4325  strcpy(env_var, env_val);
4326 
4327  return env_var;
4328 }
void cob_free(void *mptr)
Definition: common.c:1284
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
void * cob_fast_malloc(const size_t size)
Definition: common.c:1296

Here is the call graph for this function:

void cob_screen_set_mode ( const cob_u32_t  )

Definition at line 2388 of file screenio.c.

Referenced by cob_sys_system().

2389 {
2390  if (!smode) {
2391  refresh ();
2392  def_prog_mode ();
2393  endwin ();
2394  } else {
2395  reset_prog_mode ();
2396  refresh ();
2397  }
2398 }

Here is the caller graph for this function:

char* cob_strdup ( const char *  )

Definition at line 1308 of file common.c.

References cob_malloc().

Referenced by cache_dynload(), cache_preload(), cob_chk_call_path(), cob_chk_file_env(), cob_chk_file_mapping(), cob_expand_env_string(), cob_getenv(), cob_gettmpdir(), cob_init(), cob_init_call(), cob_putenv(), cob_set_locale(), cob_set_location(), cob_strcat(), cob_trace_section(), indexed_open(), insert(), and var_print().

1309 {
1310  char *mptr;
1311  size_t len;
1312 
1313  len = strlen (p);
1314  mptr = (char *) cob_malloc (len + 1U);
1315  memcpy (mptr, p, len);
1316  return mptr;
1317 }
void * cob_malloc(const size_t size)
Definition: common.c:1250

Here is the call graph for this function:

Here is the caller graph for this function: