|  | 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"
| 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, runtime_env *runtimeptr) | 
| Variables | |
| static struct call_hash ** | call_table | 
| static struct struct_handle * | base_preload_ptr | 
| static char * | cob_preload_env | 
| static char * | cob_preload_resolved | 
| static struct struct_handle * | base_dynload_ptr | 
| static cob_global * | cobglobptr | 
| static char ** | resolve_path | 
| static char * | cob_library_path_env | 
| 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 | name_convert | 
| static char * | name_convert_env | 
| static unsigned int | cob_jmp_primed | 
| static unsigned int | physical_cancel | 
| static char * | physical_cancel_env | 
| static struct system_table | system_tab [] | 
| static const unsigned char | hexval [] = "0123456789ABCDEF" | 
| static unsigned char | valid_char [256] | 
| static const unsigned char | pvalid_char [] | 
| #define _GNU_SOURCE 1 | 
| #define CALL_BUFF_MAX (CALL_BUFF_SIZE - 1U) | 
Referenced by set_resolve_error().
| #define CALL_BUFF_SIZE 256U | 
Referenced by cob_init_call().
| #define COB_LIB_EXPIMP | 
| #define COB_MAX_COBCALL_PARMS 16 | 
| #define COB_SYSTEM_GEN | ( | x, | |
| y, | |||
| z | |||
| ) | { x, {(void *(*)(void *))z} }, | 
| #define HASH_SIZE 131U | 
Referenced by cob_exit_call(), cob_init_call(), and hash().
| 
 | static | 
References base_dynload_ptr, cob_malloc(), cob_strdup(), struct_handle::handle, struct_handle::next, and struct_handle::path.
Referenced by cob_resolve_internal().
| 
 | static | 
References base_preload_ptr, cob_malloc(), cob_strcat(), cob_strdup(), struct_handle::handle, struct_handle::next, NULL, struct_handle::path, PATHSEPS, and R_OK.
Referenced by cob_init_call().
| int cob_call | ( | const char * | name, | 
| const int | argc, | ||
| void ** | argv | ||
| ) | 
| void cob_call_error | ( | void | ) | 
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 | ||
| ) | 
References cob_call_error(), cob_chk_call_path(), cob_call_struct::cob_cstr_call, cob_call_struct::cob_cstr_name, 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, p, cob_field::size, system_table::syst_call, system_table::syst_name, and unlikely.
| void cob_cancel | ( | const char * | name | ) | 
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, p, and unlikely.
Referenced by cob_cancel_field(), and cob_func().
| void cob_cancel_field | ( | const cob_field * | f, | 
| const struct cob_call_struct * | cs | ||
| ) | 
| 
 | static | 
References cob_strdup(), NULL, and p.
Referenced by cob_call_field(), cob_resolve(), and cob_resolve_cobol().
| 
 | static | 
Referenced by cob_cancel(), and cob_cancel_field().
| void cob_exit_call | ( | void | ) | 
References call_table, cob_free(), struct_handle::handle, HASH_SIZE, call_hash::name, call_hash::next, struct_handle::next, NULL, p, call_hash::path, and struct_handle::path.
Referenced by cob_terminate_routines().
| int cob_func | ( | const char * | name, | 
| const int | argc, | ||
| void ** | argv | ||
| ) | 
References cob_call(), and cob_cancel().
| 
 | static | 
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, | 
| runtime_env * | runtimeptr | ||
| ) | 
References cache_preload(), CALL_BUFF_SIZE, cob_fast_malloc(), cob_free(), COB_LIBRARY_PATH, cob_library_path_env, runtime_env::cob_library_path_env, cob_malloc(), COB_MEDIUM_BUFF, COB_MEDIUM_MAX, COB_MODULE_EXT, COB_NORMAL_BUFF, cob_preload_env, runtime_env::cob_preload_env, runtime_env::cob_preload_resolved, cob_save_env_value(), cob_set_library_path(), COB_SMALL_BUFF, cob_strdup(), HASH_SIZE, name_convert, runtime_env::name_convert, name_convert_env, runtime_env::name_convert_env, NULL, p, PATHSEPS, physical_cancel, runtime_env::physical_cancel, physical_cancel_env, runtime_env::physical_cancel_env, resolve_path, runtime_env::resolve_path, resolve_size, runtime_env::resolve_size, and SLASH_STR.
Referenced by cob_init().
| void cob_longjmp | ( | struct cobjmp_buf * | jbuf | ) | 
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 | ) | 
| void* cob_resolve_cobol | ( | const char * | name, | 
| const int | fold_case, | ||
| const int | errind | ||
| ) | 
References cob_call_error(), cob_chk_call_path(), cob_free(), cob_resolve_internal(), cob_set_exception(), p, and unlikely.
Referenced by cob_call().
| const char* cob_resolve_error | ( | void | ) | 
| void* cob_resolve_func | ( | const char * | name | ) | 
References _, cob_resolve_internal(), cob_runtime_error(), cob_stop_run(), NULL, p, and unlikely.
| 
 | static | 
References _, cache_dynload(), call_entry2_buff, call_entry_buff, cob_fatal_error(), COB_FERROR_INITIALIZED, __cob_global::cob_first_init, 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(), struct_handle::next, NULL, p, struct_handle::path, R_OK, resolve_size, set_resolve_error(), SLASH_STR, and unlikely.
Referenced by cob_call_field(), cob_resolve(), cob_resolve_cobol(), and cob_resolve_func().
| void* cob_savenv | ( | struct cobjmp_buf * | jbuf | ) | 
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 | ||
| ) | 
References cob_savenv(), and COB_UNUSED.
| void cob_set_cancel | ( | cob_module * | m | ) | 
| 
 | static | 
References cob_free(), cob_malloc(), NULL, p, PATHSEPC, PATHSEPS, resolve_alloc, and resolve_size.
Referenced by cob_init_call().
| 
 | static | 
References base_dynload_ptr, cob_free(), __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 | 
| 
 | static | 
References call_table, cob_free(), cob_malloc(), COB_NORMAL_BUFF, cob_strdup(), call_hash::func, call_hash::handle, hash(), call_hash::module, call_hash::name, call_hash::next, call_hash::no_phys_cancel, NULL, p, and call_hash::path.
Referenced by cob_resolve_internal(), and cob_set_cancel().
| 
 | static | 
References call_table, call_hash::func, hash(), call_hash::name, call_hash::next, NULL, and p.
Referenced by cob_resolve_internal().
| 
 | static | 
References CALL_BUFF_MAX, __cob_global::cob_first_init, cob_set_exception(), and resolve_error_buff.
Referenced by cob_resolve_internal().
| 
 | static | 
Referenced by cache_dynload(), and do_cancel_module().
| 
 | static | 
Referenced by cache_preload().
| 
 | static | 
Referenced by cob_get_buff().
| 
 | static | 
Referenced by cob_resolve_internal().
| 
 | static | 
Referenced by cob_resolve_internal().
| 
 | static | 
| 
 | static | 
| 
 | static | 
Referenced by cob_cancel(), cob_exit_call(), cob_set_cancel(), insert(), and lookup().
| 
 | static | 
| 
 | static | 
Referenced by cob_init_call().
| 
 | static | 
Referenced by cob_init_call().
| 
 | static | 
| 
 | static | 
| 
 | static | 
| 
 | static | 
| 
 | static | 
Referenced by cob_init_call().
| 
 | static | 
Referenced by cob_init_call().
| 
 | static | 
Referenced by cob_init_call().
| 
 | static | 
Referenced by cob_init_call().
| 
 | static | 
| 
 | static | 
Referenced by cob_set_library_path().
| 
 | static | 
Referenced by cob_resolve_error().
| 
 | static | 
Referenced by set_resolve_error().
| 
 | static | 
Referenced by cob_init_call().
| 
 | static | 
Referenced by cob_init_call(), cob_resolve_internal(), and cob_set_library_path().
| 
 | static | 
| 
 | static |