GnuCOBOL
2.0
A free COBOL compiler
|
#include "config.h"
#include "defaults.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <ltdl.h>
#include "libcob.h"
#include "coblocal.h"
#include "system.def"
Go to the source code of this file.
Data Structures | |
struct | call_hash |
struct | struct_handle |
struct | system_table |
Macros | |
#define | _GNU_SOURCE 1 |
#define | COB_LIB_EXPIMP |
#define | COB_MAX_COBCALL_PARMS 16 |
#define | CALL_BUFF_SIZE 256U |
#define | CALL_BUFF_MAX (CALL_BUFF_SIZE - 1U) |
#define | HASH_SIZE 131U |
#define | COB_SYSTEM_GEN(x, y, z) { x, {(void *(*)(void *))z} }, |
Functions | |
static void | set_resolve_error (const char *msg, const char *entry) |
static void | cob_set_library_path (const char *path) |
static void | do_cancel_module (struct call_hash *p, struct call_hash **base_hash, struct call_hash *prev) |
static void * | cob_get_buff (const size_t buffsize) |
static void | cache_dynload (const char *path, lt_dlhandle handle) |
static size_t | cache_preload (const char *path) |
static COB_INLINE unsigned int | hash (const unsigned char *s) |
static void | insert (const char *name, void *func, lt_dlhandle handle, cob_module *module, const char *path, const unsigned int nocanc) |
static void * | lookup (const char *name) |
static void * | cob_resolve_internal (const char *name, const char *dirent, const int fold_case) |
static const char * | cob_chk_dirp (const char *name) |
static char * | cob_chk_call_path (const char *name, char **dirent) |
const char * | cob_resolve_error (void) |
void | cob_call_error (void) |
void | cob_set_cancel (cob_module *m) |
void * | cob_resolve (const char *name) |
void * | cob_resolve_cobol (const char *name, const int fold_case, const int errind) |
void * | cob_resolve_func (const char *name) |
void * | cob_call_field (const cob_field *f, const struct cob_call_struct *cs, const unsigned int errind, const int fold_case) |
void | cob_cancel (const char *name) |
void | cob_cancel_field (const cob_field *f, const struct cob_call_struct *cs) |
int | cob_call (const char *name, const int argc, void **argv) |
int | cob_func (const char *name, const int argc, void **argv) |
void * | cob_savenv (struct cobjmp_buf *jbuf) |
void * | cob_savenv2 (struct cobjmp_buf *jbuf, const int jsize) |
void | cob_longjmp (struct cobjmp_buf *jbuf) |
void | cob_exit_call (void) |
void | cob_init_call (cob_global *lptr, cob_settings *sptr) |
Variables | |
static struct call_hash ** | call_table |
static struct struct_handle * | base_preload_ptr |
static struct struct_handle * | base_dynload_ptr |
static cob_global * | cobglobptr |
static cob_settings * | cobsetptr |
static char ** | resolve_path |
static char * | resolve_error |
static char * | resolve_alloc |
static char * | resolve_error_buff |
static void * | call_buffer |
static char * | call_filename_buff |
static char * | call_entry_buff |
static unsigned char * | call_entry2_buff |
static lt_dlhandle | mainhandle |
static size_t | call_lastsize |
static size_t | resolve_size |
static unsigned int | cob_jmp_primed |
static const struct system_table | system_tab [] |
static const unsigned char | hexval [] = "0123456789ABCDEF" |
static unsigned char | valid_char [256] |
static const unsigned char | pvalid_char [] |
#define CALL_BUFF_MAX (CALL_BUFF_SIZE - 1U) |
Definition at line 120 of file call.c.
Referenced by set_resolve_error().
#define CALL_BUFF_SIZE 256U |
Definition at line 119 of file call.c.
Referenced by cob_init_call().
#define COB_SYSTEM_GEN | ( | x, | |
y, | |||
z | |||
) | { x, {(void *(*)(void *))z} }, |
#define HASH_SIZE 131U |
Definition at line 122 of file call.c.
Referenced by cob_exit_call(), cob_init_call(), and hash().
|
static |
Definition at line 431 of file call.c.
References base_dynload_ptr, cob_malloc(), cob_strdup(), struct_handle::handle, struct_handle::next, and struct_handle::path.
Referenced by cob_resolve_internal().
|
static |
Definition at line 451 of file call.c.
References base_preload_ptr, cob_malloc(), __cob_settings::cob_preload_str, cob_strcat(), cob_strdup(), struct_handle::handle, struct_handle::next, NULL, struct_handle::path, PATHSEP_STR, and R_OK.
Referenced by cob_init_call().
int cob_call | ( | const char * | name, |
const int | argc, | ||
void ** | argv | ||
) |
Definition at line 1080 of file call.c.
References _, __cob_global::cob_call_params, cob_fatal_error(), COB_FERROR_INITIALIZED, cob_free(), cob_malloc(), COB_MAX_FIELD_PARAMS, cob_resolve_cobol(), cob_runtime_error(), cob_stop_run(), cob_call_union::funcint, cob_call_union::funcvoid, and unlikely.
Referenced by cob_func().
void cob_call_error | ( | void | ) |
Definition at line 878 of file call.c.
References cob_resolve_error(), cob_runtime_error(), and cob_stop_run().
Referenced by cob_call_field(), cob_resolve_cobol(), and main().
void* cob_call_field | ( | const cob_field * | f, |
const struct cob_call_struct * | cs, | ||
const unsigned int | errind, | ||
const int | fold_case | ||
) |
Definition at line 957 of file call.c.
References cob_call_error(), cob_chk_call_path(), cob_call_struct::cob_cstr_call, cob_call_struct::cob_cstr_name, COB_EC_PROGRAM_NOT_FOUND, cob_fatal_error(), COB_FERROR_INITIALIZED, cob_field_to_string(), cob_free(), cob_get_buff(), cob_resolve_internal(), cob_set_exception(), cob_call_union::funcvoid, NULL, cob_field::size, system_table::syst_call, system_table::syst_name, and unlikely.
void cob_cancel | ( | const char * | name | ) |
Definition at line 1013 of file call.c.
References _, call_table, cob_chk_dirp(), cob_fatal_error(), COB_FERROR_INITIALIZED, cob_runtime_error(), cob_stop_run(), do_cancel_module(), hash(), call_hash::name, call_hash::next, NULL, and unlikely.
Referenced by cob_cancel_field(), and cob_func().
void cob_cancel_field | ( | const cob_field * | f, |
const struct cob_call_struct * | cs | ||
) |
Definition at line 1047 of file call.c.
References cob_cancel(), cob_chk_dirp(), cob_call_struct::cob_cstr_cancel, cob_call_struct::cob_cstr_name, cob_fatal_error(), COB_FERROR_INITIALIZED, cob_field_to_string(), cob_get_buff(), cob_call_union::funcint, cob_call_union::funcvoid, call_hash::name, NULL, cob_field::size, and unlikely.
|
static |
Definition at line 825 of file call.c.
References cob_strdup(), and NULL.
Referenced by cob_call_field(), cob_resolve(), and cob_resolve_cobol().
|
static |
Definition at line 807 of file call.c.
References NULL.
Referenced by cob_cancel(), and cob_cancel_field().
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().
int cob_func | ( | const char * | name, |
const int | argc, | ||
void ** | argv | ||
) |
Definition at line 1150 of file call.c.
References cob_call(), and cob_cancel().
|
static |
Definition at line 420 of file call.c.
References call_buffer, cob_fast_malloc(), and cob_free().
Referenced by cob_call_field(), and cob_cancel_field().
void cob_init_call | ( | cob_global * | lptr, |
cob_settings * | sptr | ||
) |
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().
void cob_longjmp | ( | struct cobjmp_buf * | jbuf | ) |
Definition at line 1186 of file call.c.
References _, cobjmp_buf::cbj_jmp_buf, cob_fatal_error(), COB_FERROR_INITIALIZED, cob_runtime_error(), cob_stop_run(), and unlikely.
void* cob_resolve | ( | const char * | name | ) |
Definition at line 908 of file call.c.
References cob_chk_call_path(), cob_free(), and cob_resolve_internal().
Referenced by main().
void* cob_resolve_cobol | ( | const char * | name, |
const int | fold_case, | ||
const int | errind | ||
) |
Definition at line 923 of file call.c.
References cob_call_error(), cob_chk_call_path(), COB_EC_PROGRAM_NOT_FOUND, cob_free(), cob_resolve_internal(), cob_set_exception(), and unlikely.
Referenced by cob_call(), cobxref_(), and GCic_().
const char* cob_resolve_error | ( | void | ) |
Definition at line 864 of file call.c.
References _, NULL, and resolve_error.
Referenced by cob_call_error().
void* cob_resolve_func | ( | const char * | name | ) |
Definition at line 944 of file call.c.
References _, cob_resolve_internal(), cob_runtime_error(), cob_stop_run(), NULL, and unlikely.
|
static |
Definition at line 599 of file call.c.
References _, cache_dynload(), call_entry2_buff, call_entry_buff, cob_fatal_error(), COB_FERROR_INITIALIZED, COB_FOLD_LOWER, COB_FOLD_UPPER, cob_malloc(), COB_MODULE_EXT, COB_NORMAL_MAX, cob_set_exception(), COB_SMALL_BUFF, cob_u8_t, call_hash::func, struct_handle::handle, insert(), likely, lookup(), __cob_settings::name_convert, struct_handle::next, NULL, struct_handle::path, R_OK, resolve_size, set_resolve_error(), SLASH_CHAR, and unlikely.
Referenced by cob_call_field(), cob_resolve(), cob_resolve_cobol(), and cob_resolve_func().
void* cob_savenv | ( | struct cobjmp_buf * | jbuf | ) |
Definition at line 1160 of file call.c.
References _, cobjmp_buf::cbj_jmp_buf, cob_fatal_error(), COB_FERROR_INITIALIZED, cob_runtime_error(), cob_stop_run(), and unlikely.
Referenced by cob_savenv2().
void* cob_savenv2 | ( | struct cobjmp_buf * | jbuf, |
const int | jsize | ||
) |
Definition at line 1178 of file call.c.
References cob_savenv(), and COB_UNUSED.
void cob_set_cancel | ( | cob_module * | m | ) |
Definition at line 885 of file call.c.
References call_table, cob_call_union::funcvoid, hash(), insert(), call_hash::module, __cob_module::module_entry, __cob_module::module_name, __cob_module::module_path, call_hash::name, call_hash::next, NULL, and call_hash::path.
Referenced by CHECKSRC_(), cobxref_(), GCic_(), get__reserved__lists_(), and LISTING_().
|
static |
Definition at line 279 of file call.c.
References cob_free(), cob_malloc(), NULL, PATHSEP_CHAR, PATHSEP_STR, resolve_alloc, and resolve_size.
Referenced by cob_init_call().
|
static |
Definition at line 354 of file call.c.
References base_dynload_ptr, cob_free(), __cob_settings::cob_physical_cancel, __cob_module::flag_no_phys_canc, cob_call_union::funcint, cob_call_union::funcvoid, call_hash::handle, struct_handle::handle, call_hash::module, __cob_module::module_active, __cob_module::module_cancel, __cob_module::module_ref_count, call_hash::name, call_hash::next, struct_handle::next, call_hash::no_phys_cancel, NULL, and call_hash::path.
Referenced by cob_cancel().
|
static |
Definition at line 523 of file call.c.
References HASH_SIZE.
Referenced by cob_cancel(), cob_set_cancel(), insert(), and lookup().
|
static |
Definition at line 535 of file call.c.
References call_table, cob_free(), cob_malloc(), COB_NORMAL_BUFF, cob_strdup(), call_hash::func, call_hash::handle, hash(), module, call_hash::module, call_hash::name, call_hash::next, call_hash::no_phys_cancel, NULL, and call_hash::path.
Referenced by cob_resolve_internal(), and cob_set_cancel().
|
static |
Definition at line 581 of file call.c.
References call_table, call_hash::func, hash(), call_hash::name, call_hash::next, and NULL.
Referenced by cob_resolve_internal().
|
static |
Definition at line 269 of file call.c.
References CALL_BUFF_MAX, COB_EC_PROGRAM_NOT_FOUND, cob_set_exception(), and resolve_error_buff.
Referenced by cob_resolve_internal().
|
static |
Definition at line 159 of file call.c.
Referenced by cache_dynload(), and do_cancel_module().
|
static |
Definition at line 158 of file call.c.
Referenced by cache_preload().
|
static |
Definition at line 168 of file call.c.
Referenced by cob_get_buff().
|
static |
Definition at line 171 of file call.c.
Referenced by cob_resolve_internal().
|
static |
Definition at line 170 of file call.c.
Referenced by cob_resolve_internal().
|
static |
Definition at line 155 of file call.c.
Referenced by cob_cancel(), cob_exit_call(), cob_set_cancel(), insert(), and lookup().
|
static |
|
static |
|
static |
|
static |
Definition at line 166 of file call.c.
Referenced by cob_set_library_path().
|
static |
Definition at line 165 of file call.c.
Referenced by cob_resolve_error().
|
static |
Definition at line 167 of file call.c.
Referenced by set_resolve_error().
|
static |
Definition at line 176 of file call.c.
Referenced by cob_init_call(), cob_resolve_internal(), and cob_set_library_path().
|
static |