GnuCOBOL  2.0
A free COBOL compiler
call.c
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003-2012, 2014-2016 Free Software Foundation, Inc.
3  Written by Keisuke Nishida, Roger While, Simon Sobisch
4 
5  This file is part of GnuCOBOL.
6 
7  The GnuCOBOL 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  GnuCOBOL 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 GnuCOBOL. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 
22 #include "config.h"
23 #include "defaults.h"
24 
25 #ifndef _GNU_SOURCE
26 #define _GNU_SOURCE 1
27 #endif
28 
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <stddef.h>
32 #include <stdarg.h>
33 #include <string.h>
34 #include <ctype.h>
35 #include <sys/types.h>
36 #include <sys/stat.h>
37 #ifdef HAVE_UNISTD_H
38 #include <unistd.h>
39 #endif
40 
41 /* NOTE - The following variable should be uncommented when
42  it is known that dlopen(NULL) is borked.
43  This is known to be true for some PA-RISC HP-UX 11.11 systems.
44  This is fixed with HP patch PHSS_28871. (There are newer but this
45  fixes dlopen/dlsym problems)
46 */
47 /* #define COB_BORKED_DLOPEN */
48 
49 #ifdef _WIN32
50 
51 #define WIN32_LEAN_AND_MEAN
52 #include <windows.h>
53 
54 static HMODULE
55 lt_dlopen (const char *x)
56 {
57  if (x == NULL) {
58  return GetModuleHandle (NULL);
59  }
60  return LoadLibrary(x);
61 }
62 
63 static void *
64 lt_dlsym (HMODULE hmod, const char *p)
65 {
66  union {
67  FARPROC modaddr;
68  void *voidptr;
69  } modun;
70 
71  modun.modaddr = GetProcAddress(hmod, p);
72  return modun.voidptr;
73 }
74 
75 #if 0 /* RXWRXW - Win dlsym */
76 #define lt_dlsym(x,y) GetProcAddress(x, y)
77 #endif
78 
79 #define lt_dlclose(x) FreeLibrary(x)
80 #define lt_dlinit()
81 #define lt_dlexit()
82 #define lt_dlhandle HMODULE
83 
84 #if 0 /* RXWRXW - dlerror */
85 static char errbuf[64];
86 static char *
87 lt_dlerror (void)
88 {
89  sprintf(errbuf, _("LoadLibrary/GetProcAddress error %d"), (int)GetLastError());
90  return errbuf;
91 }
92 #endif
93 
94 #elif defined(USE_LIBDL)
95 
96 #include <dlfcn.h>
97 
98 #define lt_dlopen(x) dlopen(x, RTLD_LAZY | RTLD_GLOBAL)
99 #define lt_dlsym(x,y) dlsym(x, y)
100 #define lt_dlclose(x) dlclose(x)
101 #define lt_dlerror() dlerror()
102 #define lt_dlinit()
103 #define lt_dlexit()
104 #define lt_dlhandle void *
105 
106 #else
107 
108 #include <ltdl.h>
109 
110 #endif
111 
112 /* Force symbol exports */
113 #define COB_LIB_EXPIMP
114 
115 #include "libcob.h"
116 #include "coblocal.h"
117 
118 #define COB_MAX_COBCALL_PARMS 16
119 #define CALL_BUFF_SIZE 256U
120 #define CALL_BUFF_MAX (CALL_BUFF_SIZE - 1U)
121 
122 #define HASH_SIZE 131U
123 
124 /* Call table */
125 #if 0 /* Alternative hash structure */
126 #define COB_ALT_HASH
127 #endif
128 
129 struct call_hash {
130  struct call_hash *next; /* Linked list next pointer */
131  const char *name; /* Original called name */
132  void *func; /* Function address */
133  cob_module *module; /* Program module structure */
134  lt_dlhandle handle; /* Handle to loaded module */
135  const char *path; /* Full path of module */
136  unsigned int no_phys_cancel; /* No physical cancel */
137 };
138 
140  struct struct_handle *next; /* Linked list next pointer */
141  const char *path; /* Path of module */
142  lt_dlhandle handle; /* Handle to loaded module */
143 };
144 
145 struct system_table {
146  const char *syst_name;
148 };
149 
150 /* Local variables */
151 
152 #ifdef COB_ALT_HASH
153 static struct call_hash *call_table;
154 #else
155 static struct call_hash **call_table;
156 #endif
157 
160 
163 
164 static char **resolve_path;
165 static char *resolve_error;
166 static char *resolve_alloc;
167 static char *resolve_error_buff;
168 static void *call_buffer;
169 static char *call_filename_buff;
170 static char *call_entry_buff;
171 static unsigned char *call_entry2_buff;
172 
173 static lt_dlhandle mainhandle;
174 
175 static size_t call_lastsize;
176 static size_t resolve_size;
177 static unsigned int cob_jmp_primed;
178 
179 #undef COB_SYSTEM_GEN
180 #if 0
181 #define COB_SYSTEM_GEN(x,y,z) { x, {(void *(*)())z} },
182 #else
183 #define COB_SYSTEM_GEN(x,y,z) { x, {(void *(*)(void *))z} },
184 #endif
185 
186 static const struct system_table system_tab[] = {
187 #include "system.def"
188  { NULL, {NULL} }
189 };
190 #undef COB_SYSTEM_GEN
191 
192 static const unsigned char hexval[] = "0123456789ABCDEF";
193 
194 #ifdef HAVE_DESIGNATED_INITS
195 static const unsigned char valid_char[256] = {
196  ['0'] = 1,
197  ['1'] = 1,
198  ['2'] = 1,
199  ['3'] = 1,
200  ['4'] = 1,
201  ['5'] = 1,
202  ['6'] = 1,
203  ['7'] = 1,
204  ['8'] = 1,
205  ['9'] = 1,
206  ['A'] = 1,
207  ['B'] = 1,
208  ['C'] = 1,
209  ['D'] = 1,
210  ['E'] = 1,
211  ['F'] = 1,
212  ['G'] = 1,
213  ['H'] = 1,
214  ['I'] = 1,
215  ['J'] = 1,
216  ['K'] = 1,
217  ['L'] = 1,
218  ['M'] = 1,
219  ['N'] = 1,
220  ['O'] = 1,
221  ['P'] = 1,
222  ['Q'] = 1,
223  ['R'] = 1,
224  ['S'] = 1,
225  ['T'] = 1,
226  ['U'] = 1,
227  ['V'] = 1,
228  ['W'] = 1,
229  ['X'] = 1,
230  ['Y'] = 1,
231  ['Z'] = 1,
232  ['_'] = 1,
233  ['a'] = 1,
234  ['b'] = 1,
235  ['c'] = 1,
236  ['d'] = 1,
237  ['e'] = 1,
238  ['f'] = 1,
239  ['g'] = 1,
240  ['h'] = 1,
241  ['i'] = 1,
242  ['j'] = 1,
243  ['k'] = 1,
244  ['l'] = 1,
245  ['m'] = 1,
246  ['n'] = 1,
247  ['o'] = 1,
248  ['p'] = 1,
249  ['q'] = 1,
250  ['r'] = 1,
251  ['s'] = 1,
252  ['t'] = 1,
253  ['u'] = 1,
254  ['v'] = 1,
255  ['w'] = 1,
256  ['x'] = 1,
257  ['y'] = 1,
258  ['z'] = 1
259 };
260 #else
261 static unsigned char valid_char[256];
262 static const unsigned char pvalid_char[] =
263  "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
264 #endif
265 
266 /* Local functions */
267 
268 static void
269 set_resolve_error (const char *msg, const char *entry)
270 {
271  resolve_error_buff[CALL_BUFF_MAX] = 0;
272  snprintf (resolve_error_buff, (size_t)CALL_BUFF_MAX,
273  "%s '%s'", msg, entry);
274  resolve_error = resolve_error_buff;
276 }
277 
278 static void
279 cob_set_library_path (const char *path)
280 {
281  char *p;
282  char *pstr;
283  size_t i;
284  size_t size;
285  struct stat st;
286 
287  int flag;
288 
289  /* Clear the previous path */
290  if (resolve_path) {
291  cob_free (resolve_path);
292  cob_free (resolve_alloc);
293  }
294 
295  /* Count the number of separators */
296  i = 1;
297  size = 0;
298  for (p = (char *)path; *p; p++, size++) {
299  if (*p == PATHSEP_CHAR) {
300  i++;
301  }
302  }
303 
304  /* Build path array */
305  size++;
306  resolve_alloc = cob_malloc (size);
307  pstr = resolve_alloc;
308  for (p = (char *)path; *p; p++, pstr++) {
309 #ifdef _WIN32
310  if (*p == (unsigned char)'/') {
311  *pstr = (unsigned char)'\\';
312  continue;
313  }
314 #else
315  if (*p == (unsigned char)'\\') {
316  *pstr = (unsigned char)'/';
317  continue;
318  }
319 #endif
320  *pstr = *p;
321  }
322 
323  resolve_path = cob_malloc (sizeof (char *) * i);
324  resolve_size = 0;
325  pstr = resolve_alloc;
326  for (; ; ) {
327  p = strtok (pstr, PATHSEP_STR);
328  if (!p) {
329  break;
330  }
331  pstr = NULL;
332  if (stat (p, &st) || !(S_ISDIR (st.st_mode))) {
333  continue;
334  }
335 
336  /*
337  * look if we already have this path
338  */
339  flag = 0;
340  for (i = 0; i < resolve_size; i++) {
341  if(strcmp(resolve_path[i], p) == 0) {
342  flag = 1;
343  break;
344  }
345  }
346 
347  if (!flag) {
348  resolve_path[resolve_size++] = p;
349  }
350  }
351 }
352 
353 static void
354 do_cancel_module (struct call_hash *p, struct call_hash **base_hash,
355  struct call_hash *prev)
356 {
357  struct struct_handle *dynptr;
358  int (*cancel_func)(const int, void *, void *, void *, void *);
359  int nocancel;
360  nocancel = 0;
361 
362  if (!p->module) {
363  return;
364  }
365  if (!p->module->module_cancel.funcvoid) {
366  return;
367  }
368  if (p->module->flag_no_phys_canc) {
369  nocancel = 1;
370  }
371  /* This should be impossible */
372  if (p->module->module_active) {
373  nocancel = 1;
374  }
375  if (p->module->module_ref_count &&
376  *(p->module->module_ref_count)) {
377  nocancel = 1;
378  }
379  cancel_func = p->module->module_cancel.funcint;
380  (void)cancel_func (-1, NULL, NULL, NULL, NULL);
381  p->module = NULL;
382 
383  if (nocancel) {
384  return;
385  }
386  if (!cobsetptr->cob_physical_cancel) {
387  return;
388  }
389  if (p->no_phys_cancel) {
390  return;
391  }
392  if (!p->handle) {
393  return;
394  }
395 
396  lt_dlclose (p->handle);
397 
398  dynptr = base_dynload_ptr;
399  for (; dynptr; dynptr = dynptr->next) {
400  if (dynptr->handle == p->handle) {
401  dynptr->handle = NULL;
402  }
403  }
404 
405  if (!prev) {
406  *base_hash = p->next;
407  } else {
408  prev->next = p->next;
409  }
410  if (p->name) {
411  cob_free ((void *)(p->name));
412  }
413  if (p->path) {
414  cob_free ((void *)(p->path));
415  }
416  cob_free (p);
417 }
418 
419 static void *
420 cob_get_buff (const size_t buffsize)
421 {
422  if (buffsize > call_lastsize) {
423  call_lastsize = buffsize;
424  cob_free (call_buffer);
425  call_buffer = cob_fast_malloc (buffsize);
426  }
427  return call_buffer;
428 }
429 
430 static void
431 cache_dynload (const char *path, lt_dlhandle handle)
432 {
433  struct struct_handle *dynptr;
434 
435  for (dynptr = base_dynload_ptr; dynptr; dynptr = dynptr->next) {
436  if (!strcmp (path, dynptr->path)) {
437  if (!dynptr->handle) {
438  dynptr->handle = handle;
439  return;
440  }
441  }
442  }
443  dynptr = cob_malloc (sizeof (struct struct_handle));
444  dynptr->path = cob_strdup (path);
445  dynptr->handle = handle;
446  dynptr->next = base_dynload_ptr;
447  base_dynload_ptr = dynptr;
448 }
449 
450 static size_t
451 cache_preload (const char *path)
452 {
453  struct struct_handle *preptr;
454  lt_dlhandle libhandle;
455 
456 #if defined(_WIN32) || defined(__CYGWIN__)
457  struct struct_handle *last_elem;
458  last_elem = NULL;
459 #endif
460 
461  /* Check for duplicate */
462  for (preptr = base_preload_ptr; preptr; preptr = preptr->next) {
463  if (!strcmp (path, preptr->path)) {
464  return 1;
465  }
466 #if defined(_WIN32) || defined(__CYGWIN__)
467  /* Save last element of preload list */
468  if (!preptr->next) last_elem = preptr;
469 #endif
470  }
471 
472  if (access (path, R_OK) != 0) {
473  return 0;
474  }
475 
476  libhandle = lt_dlopen (path);
477  if (!libhandle) {
478  return 0;
479  }
480 
481  preptr = cob_malloc (sizeof (struct struct_handle));
482  preptr->path = cob_strdup (path);
483  preptr->handle = libhandle;
484 
485 #if defined(_WIN32) || defined(__CYGWIN__)
486  /*
487  * Observation: dlopen (POSIX) and lt_dlopen (UNIX) are overloading
488  * symbols with equal name. So if we load two libraries with equal
489  * named symbols, the last one wins and is loaded.
490  * LoadLibrary (Win32) ignores any equal named symbol
491  * if another library with this symbol was already loaded.
492  *
493  * In Windows (including MinGW/CYGWIN) we need to load modules
494  * in the same order as we save them to COB_PRE_LOAD due to issues
495  * if we have got two modules with equal entry points.
496  */
497  if(last_elem) {
498  last_elem->next = preptr;
499  }
500  else {
501  preptr->next = NULL;
502  base_preload_ptr = preptr;
503  }
504 #else
505  preptr->next = base_preload_ptr;
506  base_preload_ptr = preptr;
507 #endif
508 
509 
510  if(!cobsetptr->cob_preload_str) {
511  cobsetptr->cob_preload_str = cob_strdup(path);
512  }
513  else {
514  cobsetptr->cob_preload_str = cob_strcat((char*) PATHSEP_STR, cobsetptr->cob_preload_str);
515  cobsetptr->cob_preload_str = cob_strcat((char*) path, cobsetptr->cob_preload_str);
516  }
517 
518  return 1;
519 }
520 
521 #ifndef COB_ALT_HASH
522 static COB_INLINE unsigned int
523 hash (const unsigned char *s)
524 {
525  unsigned int val = 0;
526 
527  while (*s) {
528  val += *s++;
529  }
530  return val % HASH_SIZE;
531 }
532 #endif
533 
534 static void
535 insert (const char *name, void *func, lt_dlhandle handle,
536  cob_module *module, const char *path,
537  const unsigned int nocanc)
538 {
539  struct call_hash *p;
540 #ifndef COB_ALT_HASH
541  unsigned int val;
542 #endif
543 
544  p = cob_malloc (sizeof (struct call_hash));
545  p->name = cob_strdup (name);
546  p->func = func;
547  p->handle = handle;
548  p->module = module;
549  if (path) {
550 #ifdef _WIN32
551  /* Malloced path or NULL */
552  p->path = _fullpath (NULL, path, 1);
553 #elif defined(HAVE_CANONICALIZE_FILE_NAME)
554  /* Malloced path or NULL */
555  p->path = canonicalize_file_name (path);
556 #elif defined(HAVE_REALPATH)
557  char *s;
558 
559  s = cob_malloc ((size_t)COB_NORMAL_BUFF);
560  if (realpath (path, s) != NULL) {
561  p->path = cob_strdup (s);
562  }
563  cob_free (s);
564 #endif
565  if (!p->path) {
566  p->path = cob_strdup (path);
567  }
568  }
569  p->no_phys_cancel = nocanc;
570 #ifdef COB_ALT_HASH
571  p->next = call_table;
572  call_table = p;
573 #else
574  val = hash ((const unsigned char *)name);
575  p->next = call_table[val];
576  call_table[val] = p;
577 #endif
578 }
579 
580 static void *
581 lookup (const char *name)
582 {
583  struct call_hash *p;
584 
585 #ifdef COB_ALT_HASH
586  p = call_table;
587 #else
588  p = call_table[hash ((const unsigned char *)name)];
589 #endif
590  for (; p; p = p->next) {
591  if (strcmp (name, p->name) == 0) {
592  return p->func;
593  }
594  }
595  return NULL;
596 }
597 
598 static void *
599 cob_resolve_internal (const char *name, const char *dirent,
600  const int fold_case)
601 {
602  unsigned char *p;
603  const unsigned char *s;
604  void *func;
605  struct struct_handle *preptr;
606  lt_dlhandle handle;
607  size_t i;
608 
609  if (unlikely(!cobglobptr)) {
611  }
612  cob_set_exception (0);
613 
614  /* Search the cache */
615  func = lookup (name);
616  if (func) {
617  return func;
618  }
619 
620  /* Encode program name */
621  p = (unsigned char *)call_entry_buff;
622  s = (const unsigned char *)name;
623  if (unlikely(*s <= (unsigned char)'9' && *s >= (unsigned char)'0')) {
624  *p++ = (unsigned char)'_';
625  }
626  for (; *s; ++s) {
627  if (likely(valid_char[*s])) {
628  *p++ = *s;
629  } else {
630  *p++ = (unsigned char)'_';
631  if (*s == (unsigned char)'-') {
632  *p++ = (unsigned char)'_';
633  } else {
634  *p++ = hexval[*s / 16U];
635  *p++ = hexval[*s % 16U];
636  }
637  }
638  }
639  *p = 0;
640 
641  /* Check case folding */
642  switch (fold_case) {
643  case COB_FOLD_UPPER:
644  for (p = (unsigned char *)call_entry_buff; *p; p++) {
645  if (islower (*p)) {
646  *p = (cob_u8_t)toupper (*p);
647  }
648  }
649  break;
650  case COB_FOLD_LOWER:
651  for (p = (unsigned char *)call_entry_buff; *p; p++) {
652  if (isupper (*p)) {
653  *p = (cob_u8_t)tolower (*p);
654  }
655  }
656  break;
657  default:
658  break;
659  }
660 
661  /* Search the main program */
662  if (mainhandle != NULL) {
663  func = lt_dlsym (mainhandle, call_entry_buff);
664  if (func != NULL) {
665  insert (name, func, mainhandle, NULL, NULL, 1);
666  resolve_error = NULL;
667  return func;
668  }
669  }
670 
671  /* Search preloaded modules */
672  for (preptr = base_preload_ptr; preptr; preptr = preptr->next) {
673  func = lt_dlsym (preptr->handle, call_entry_buff);
674  if (func != NULL) {
675  insert (name, func, preptr->handle, NULL, preptr->path, 1);
676  resolve_error = NULL;
677  return func;
678  }
679  }
680 
681  /* Search dynamic modules */
682  for (preptr = base_dynload_ptr; preptr; preptr = preptr->next) {
683  if (!preptr->handle) {
684  continue;
685  }
686  func = lt_dlsym (preptr->handle, call_entry_buff);
687  if (func != NULL) {
688  insert (name, func, preptr->handle,
689  NULL, preptr->path, 1);
690  resolve_error = NULL;
691  return func;
692  }
693  }
694 
695 #if 0 /* RXWRXW RTLD */
696 #if defined(USE_LIBDL) && defined (RTLD_DEFAULT)
697  func = lt_dlsym (RTLD_DEFAULT, call_entry_buff);
698  if (func != NULL) {
699  insert (name, func, NULL, NULL, NULL, 1);
700  resolve_error = NULL;
701  return func;
702  }
703 #endif
704 #endif
705 
706  s = (const unsigned char *)name;
707 
708  /* Check if name needs conversion */
709  if (unlikely(cobsetptr->name_convert != 0)) {
710  if (!call_entry2_buff) {
711  call_entry2_buff = cob_malloc ((size_t)COB_SMALL_BUFF);
712  }
713  p = call_entry2_buff;
714  for (; *s; ++s, ++p) {
715  if (cobsetptr->name_convert == 1 && isupper (*s)) {
716  *p = (cob_u8_t) tolower (*s);
717  } else if (cobsetptr->name_convert == 2 && islower (*s)) {
718  *p = (cob_u8_t) toupper (*s);
719  } else {
720  *p = *s;
721  }
722  }
723  *p = 0;
724  s = (const unsigned char *)call_entry2_buff;
725  }
726 
727  /* Search external modules */
728 #ifdef __OS400__
729  strcpy (call_filename_buff, s);
730  for(p = call_filename_buff; *p; ++p) {
731  *p = (cob_u8_t)toupper(*p);
732  }
733  handle = lt_dlopen (call_filename_buff);
734  if (handle != NULL) {
735  /* Candidate for future calls */
736  cache_dynload (call_filename_buff, handle);
737  func = lt_dlsym (handle, call_entry_buff);
738  if (func != NULL) {
739  insert (name, func, handle, NULL, call_filename_buff, 0);
740  resolve_error = NULL;
741  return func;
742  }
743  }
744 #else
745  if (dirent) {
746  snprintf (call_filename_buff, (size_t)COB_NORMAL_MAX,
747  "%s%s.%s", dirent, (char *)s, COB_MODULE_EXT);
748  call_filename_buff[COB_NORMAL_MAX] = 0;
749  if (access (call_filename_buff, R_OK) != 0) {
750  set_resolve_error (_("Cannot find module"), name);
751  return NULL;
752  }
753  handle = lt_dlopen (call_filename_buff);
754  if (handle != NULL) {
755  /* Candidate for future calls */
756  cache_dynload (call_filename_buff, handle);
757  func = lt_dlsym (handle, call_entry_buff);
758  if (func != NULL) {
759  insert (name, func, handle, NULL,
760  call_filename_buff, 0);
761  resolve_error = NULL;
762  return func;
763  }
764  }
765  set_resolve_error (_("Cannot find entry point"),
766  (const char *)s);
767  return NULL;
768  }
769  for (i = 0; i < resolve_size; ++i) {
770  call_filename_buff[COB_NORMAL_MAX] = 0;
771  if (resolve_path[i] == NULL) {
772  snprintf (call_filename_buff, (size_t)COB_NORMAL_MAX,
773  "%s.%s", (char *)s, COB_MODULE_EXT);
774  } else {
775  snprintf (call_filename_buff, (size_t)COB_NORMAL_MAX,
776  "%s%c%s.%s", resolve_path[i],
777  SLASH_CHAR,
778  (char *)s,
780  }
781  call_filename_buff[COB_NORMAL_MAX] = 0;
782  if (access (call_filename_buff, R_OK) == 0) {
783  handle = lt_dlopen (call_filename_buff);
784  if (handle != NULL) {
785  /* Candidate for future calls */
786  cache_dynload (call_filename_buff, handle);
787  func = lt_dlsym (handle, call_entry_buff);
788  if (func != NULL) {
789  insert (name, func, handle, NULL,
790  call_filename_buff, 0);
791  resolve_error = NULL;
792  return func;
793  }
794  }
795  set_resolve_error (_("Cannot find entry point"),
796  (const char *)s);
797  return NULL;
798  }
799  }
800 #endif
801 
802  set_resolve_error (_("Cannot find module"), name);
803  return NULL;
804 }
805 
806 static const char *
807 cob_chk_dirp (const char *name)
808 {
809  const char *p;
810  const char *q;
811 
812  q = NULL;
813  for (p = name; *p; p++) {
814  if (*p == '/' || *p == '\\') {
815  q = p + 1;
816  }
817  }
818  if (q) {
819  return q;
820  }
821  return name;
822 }
823 
824 static char *
825 cob_chk_call_path (const char *name, char **dirent)
826 {
827  char *p;
828  char *q;
829  size_t size1;
830  size_t size2;
831 
832  *dirent = NULL;
833  q = NULL;
834  size2 = 0;
835  for (p = (char *)name, size1 = 0; *p; p++, size1++) {
836  if (*p == '/' || *p == '\\') {
837  q = p + 1;
838  size2 = size1 + 1;
839  }
840  }
841  if (q) {
842  p = cob_strdup (name);
843  p[size2] = 0;
844  *dirent = p;
845  for (; *p; p++) {
846 #ifdef _WIN32
847  if (*p == '/') {
848  *p = '\\';
849  }
850 #else
851  if (*p == '\\') {
852  *p = '/';
853  }
854 #endif
855  }
856  return q;
857  }
858  return (char *)name;
859 }
860 
861 /* Global functions */
862 
863 const char *
865 {
866  const char *p;
867 
868  if (!resolve_error) {
869  p = _("Indeterminable error in resolve of COBOL CALL");
870  } else {
871  p = resolve_error;
872  resolve_error = NULL;
873  }
874  return p;
875 }
876 
877 void
879 {
881  cob_stop_run (1);
882 }
883 
884 void
886 {
887  struct call_hash *p;
888 
889 #ifdef COB_ALT_HASH
890  p = call_table;
891 #else
892  p = call_table[hash ((const unsigned char *)(m->module_name))];
893 #endif
894  for (; p; p = p->next) {
895  if (strcmp (m->module_name, p->name) == 0) {
896  p->module = m;
897  /* Set path in program module structure */
898  if (p->path && m->module_path && !*(m->module_path)) {
899  *(m->module_path) = p->path;
900  }
901  return;
902  }
903  }
904  insert (m->module_name, m->module_entry.funcvoid, NULL, m, NULL, 1);
905 }
906 
907 void *
908 cob_resolve (const char *name)
909 {
910  void *p;
911  char *entry;
912  char *dirent;
913 
914  entry = cob_chk_call_path (name, &dirent);
915  p = cob_resolve_internal (entry, dirent, 0);
916  if (dirent) {
917  cob_free (dirent);
918  }
919  return p;
920 }
921 
922 void *
923 cob_resolve_cobol (const char *name, const int fold_case, const int errind)
924 {
925  void *p;
926  char *entry;
927  char *dirent;
928 
929  entry = cob_chk_call_path (name, &dirent);
930  p = cob_resolve_internal (entry, dirent, fold_case);
931  if (dirent) {
932  cob_free (dirent);
933  }
934  if (unlikely(!p)) {
935  if (errind) {
936  cob_call_error ();
937  }
939  }
940  return p;
941 }
942 
943 void *
944 cob_resolve_func (const char *name)
945 {
946  void *p;
947 
948  p = cob_resolve_internal (name, NULL, 0);
949  if (unlikely(!p)) {
950  cob_runtime_error (_("User FUNCTION '%s' not found"), name);
951  cob_stop_run (1);
952  }
953  return p;
954 }
955 
956 void *
957 cob_call_field (const cob_field *f, const struct cob_call_struct *cs,
958  const unsigned int errind, const int fold_case)
959 {
960  void *p;
961  const struct cob_call_struct *s;
962  const struct system_table *psyst;
963  char *buff;
964  char *entry;
965  char *dirent;
966 
967  if (unlikely(!cobglobptr)) {
969  }
970 
971  buff = cob_get_buff (f->size + 1);
972  cob_field_to_string (f, buff, f->size);
973 
974  entry = cob_chk_call_path (buff, &dirent);
975 
976  /* Check if system routine */
977  for (psyst = system_tab; psyst->syst_name; ++psyst) {
978  if (!strcmp (entry, psyst->syst_name)) {
979  if (dirent) {
980  cob_free (dirent);
981  }
982  return psyst->syst_call.funcvoid;
983  }
984  }
985 
986 
987  /* Check if contained program */
988  for (s = cs; s && s->cob_cstr_name; s++) {
989  if (!strcmp (entry, s->cob_cstr_name)) {
990  if (dirent) {
991  cob_free (dirent);
992  }
993  return s->cob_cstr_call.funcvoid;
994  }
995  }
996 
997  p = cob_resolve_internal (entry, dirent, fold_case);
998  if (dirent) {
999  cob_free (dirent);
1000  }
1001  if (unlikely(!p)) {
1002  if (errind) {
1003  cob_call_error ();
1004  } else {
1006  return NULL;
1007  }
1008  }
1009  return p;
1010 }
1011 
1012 void
1013 cob_cancel (const char *name)
1014 {
1015  const char *entry;
1016  struct call_hash *p;
1017  struct call_hash **q;
1018  struct call_hash *r;
1019 
1020  if (unlikely(!cobglobptr)) {
1022  }
1023  if (unlikely(!name)) {
1024  cob_runtime_error (_("NULL parameter passed to '%s'"), "cob_cancel");
1025  cob_stop_run (1);
1026  }
1027  entry = cob_chk_dirp (name);
1028 
1029 #ifdef COB_ALT_HASH
1030  q = &call_table;
1031  p = *q;
1032 #else
1033  q = &call_table[hash ((const unsigned char *)entry)];
1034  p = *q;
1035 #endif
1036  r = NULL;
1037  for (; p; p = p->next) {
1038  if (strcmp (entry, p->name) == 0) {
1039  do_cancel_module (p, q, r);
1040  return;
1041  }
1042  r = p;
1043  }
1044 }
1045 
1046 void
1047 cob_cancel_field (const cob_field *f, const struct cob_call_struct *cs)
1048 {
1049  char *name;
1050  const char *entry;
1051  const struct cob_call_struct *s;
1052 
1053  int (*cancel_func)(const int, void *, void *, void *, void *);
1054 
1055  if (unlikely(!cobglobptr)) {
1057  }
1058  if (!f || f->size == 0) {
1059  return;
1060  }
1061  name = cob_get_buff (f->size + 1);
1062  cob_field_to_string (f, name, f->size);
1063  entry = cob_chk_dirp (name);
1064 
1065  /* Check if contained program */
1066  for (s = cs; s && s->cob_cstr_name; s++) {
1067  if (!strcmp (entry, s->cob_cstr_name)) {
1068  if (s->cob_cstr_cancel.funcvoid) {
1069  cancel_func = s->cob_cstr_cancel.funcint;
1070  (void)cancel_func (-1, NULL, NULL, NULL,
1071  NULL);
1072  }
1073  return;
1074  }
1075  }
1076  cob_cancel (entry);
1077 }
1078 
1079 int
1080 cob_call (const char *name, const int argc, void **argv)
1081 {
1082  void **pargv;
1083  cob_call_union unifunc;
1084  int i;
1085 
1086  if (unlikely(!cobglobptr)) {
1088  }
1089  if (argc < 0 || argc > COB_MAX_FIELD_PARAMS) {
1090  cob_runtime_error (_("Invalid number of arguments to '%s'"), "cob_call");
1091  cob_stop_run (1);
1092  }
1093  if (unlikely(!name)) {
1094  cob_runtime_error (_("NULL parameter passed to '%s'"), "cob_call");
1095  cob_stop_run (1);
1096  }
1097  unifunc.funcvoid = cob_resolve_cobol (name, 0, 1);
1098  pargv = cob_malloc (COB_MAX_FIELD_PARAMS * sizeof(void *));
1099  /* Set number of parameters */
1100  cobglobptr->cob_call_params = argc;
1101  for (i = 0; i < argc; ++i) {
1102  pargv[i] = argv[i];
1103  }
1104 #if COB_MAX_FIELD_PARAMS == 16 || \
1105  COB_MAX_FIELD_PARAMS == 36 || \
1106  COB_MAX_FIELD_PARAMS == 56 || \
1107  COB_MAX_FIELD_PARAMS == 76 || \
1108  COB_MAX_FIELD_PARAMS == 96
1109 #else
1110 #error "Invalid COB_MAX_FIELD_PARAMS value"
1111 #endif
1112  i = unifunc.funcint (pargv[0], pargv[1], pargv[2], pargv[3]
1113  ,pargv[4], pargv[5], pargv[6], pargv[7]
1114  ,pargv[8], pargv[9], pargv[10], pargv[11]
1115  ,pargv[12], pargv[13], pargv[14], pargv[15]
1116 #if COB_MAX_FIELD_PARAMS > 16
1117  ,pargv[16], pargv[17], pargv[18], pargv[19]
1118  ,pargv[20], pargv[21], pargv[22], pargv[23]
1119  ,pargv[24], pargv[25], pargv[26], pargv[27]
1120  ,pargv[28], pargv[29], pargv[30], pargv[31]
1121  ,pargv[32], pargv[33], pargv[34], pargv[35]
1122 #if COB_MAX_FIELD_PARAMS > 36
1123  ,pargv[36], pargv[37], pargv[38], pargv[39]
1124  ,pargv[40], pargv[41], pargv[42], pargv[43]
1125  ,pargv[44], pargv[45], pargv[46], pargv[47]
1126  ,pargv[48], pargv[49], pargv[50], pargv[51]
1127  ,pargv[52], pargv[53], pargv[54], pargv[55]
1128 #if COB_MAX_FIELD_PARAMS > 56
1129  ,pargv[56], pargv[57], pargv[58], pargv[59]
1130  ,pargv[60], pargv[61], pargv[62], pargv[63]
1131  ,pargv[64], pargv[65], pargv[66], pargv[67]
1132  ,pargv[68], pargv[69], pargv[70], pargv[71]
1133  ,pargv[72], pargv[73], pargv[74], pargv[75]
1134 #if COB_MAX_FIELD_PARAMS > 76
1135  ,pargv[76], pargv[77], pargv[78], pargv[79]
1136  ,pargv[80], pargv[81], pargv[82], pargv[83]
1137  ,pargv[84], pargv[85], pargv[86], pargv[87]
1138  ,pargv[88], pargv[89], pargv[90], pargv[91]
1139  ,pargv[92], pargv[93], pargv[94], pargv[95]
1140 #endif
1141 #endif
1142 #endif
1143 #endif
1144  );
1145  cob_free (pargv);
1146  return i;
1147 }
1148 
1149 int
1150 cob_func (const char *name, const int argc, void **argv)
1151 {
1152  int ret;
1153 
1154  ret = cob_call (name, argc, argv);
1155  cob_cancel (name);
1156  return ret;
1157 }
1158 
1159 void *
1160 cob_savenv (struct cobjmp_buf *jbuf)
1161 {
1162  if (unlikely(!cobglobptr)) {
1164  }
1165  if (unlikely(!jbuf)) {
1166  cob_runtime_error (_("NULL parameter passed to '%s'"), "cob_savenv");
1167  cob_stop_run (1);
1168  }
1169  if (cob_jmp_primed) {
1170  cob_runtime_error (_("Multiple call to 'cob_setjmp'"));
1171  cob_stop_run (1);
1172  }
1173  cob_jmp_primed = 1;
1174  return jbuf->cbj_jmp_buf;
1175 }
1176 
1177 void *
1178 cob_savenv2 (struct cobjmp_buf *jbuf, const int jsize)
1179 {
1180  COB_UNUSED (jsize);
1181 
1182  return cob_savenv (jbuf);
1183 }
1184 
1185 void
1186 cob_longjmp (struct cobjmp_buf *jbuf)
1187 {
1188  if (unlikely(!cobglobptr)) {
1190  }
1191  if (unlikely(!jbuf)) {
1192  cob_runtime_error (_("NULL parameter passed to '%s'"), "cob_longjmp");
1193  cob_stop_run (1);
1194  }
1195  if (!cob_jmp_primed) {
1196  cob_runtime_error (_("Call to 'cob_longjmp' with no prior 'cob_setjmp'"));
1197  cob_stop_run (1);
1198  }
1199  cob_jmp_primed = 0;
1200  longjmp (jbuf->cbj_jmp_buf, 1);
1201 }
1202 
1203 void
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) {
1216  cob_free (call_filename_buff);
1217  call_filename_buff = NULL;
1218  }
1219  if (call_entry_buff) {
1220  cob_free (call_entry_buff);
1221  call_entry_buff = NULL;
1222  }
1223  if (call_entry2_buff) {
1224  cob_free (call_entry2_buff);
1225  call_entry2_buff = NULL;
1226  }
1227  if (call_buffer) {
1228  cob_free (call_buffer);
1229  call_buffer = NULL;
1230  }
1231  if (resolve_error_buff) {
1232  cob_free (resolve_error_buff);
1233  resolve_error_buff = NULL;
1234  }
1235  if (resolve_alloc) {
1236  cob_free (resolve_alloc);
1237  resolve_alloc = NULL;
1238  }
1239  if (resolve_path) {
1240  cob_free (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  }
1282  base_preload_ptr = NULL;
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  }
1294  base_dynload_ptr = NULL;
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 }
1305 
1306 void
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 
1323  base_preload_ptr = NULL;
1324  base_dynload_ptr = NULL;
1325  resolve_path = NULL;
1326  resolve_alloc = NULL;
1327  resolve_error = NULL;
1328  resolve_error_buff = NULL;
1329  mainhandle = NULL;
1330  call_buffer = NULL;
1331  call_filename_buff = NULL;
1332  call_entry_buff = NULL;
1333  call_entry2_buff = 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 */
1347  resolve_error_buff = cob_malloc ((size_t)CALL_BUFF_SIZE);
1348 
1349 #ifndef COB_ALT_HASH
1350  call_table = cob_malloc (sizeof (struct call_hash *) * HASH_SIZE);
1351 #endif
1352 
1353  call_filename_buff = cob_malloc ((size_t)COB_NORMAL_BUFF);
1354  call_entry_buff = cob_malloc ((size_t)COB_SMALL_BUFF);
1355 
1356  buff = cob_fast_malloc ((size_t)COB_MEDIUM_BUFF);
1357  if (cobsetptr->cob_library_path == NULL
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.",
1368  cobsetptr->cob_library_path, PATHSEP_CHAR);
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 
1384  p = cob_strdup (cobsetptr->cob_preload_str);
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",
1397  resolve_path[i], SLASH_CHAR, s, COB_MODULE_EXT);
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);
1411  call_buffer = cob_fast_malloc ((size_t)CALL_BUFF_SIZE);
1412  call_lastsize = CALL_BUFF_SIZE;
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
struct struct_handle * next
Definition: call.c:140
static char * resolve_alloc
Definition: call.c:166
void cob_cancel_field(const cob_field *f, const struct cob_call_struct *cs)
Definition: call.c:1047
static size_t resolve_size
Definition: call.c:176
cob_module * module
Definition: call.c:133
static size_t cache_preload(const char *path)
Definition: call.c:451
void cob_exit_call(void)
Definition: call.c:1204
static char ** resolve_path
Definition: call.c:164
static void * cob_get_buff(const size_t buffsize)
Definition: call.c:420
unsigned int module_active
Definition: common.h:1060
static struct call_hash ** call_table
Definition: call.c:155
static void insert(const char *name, void *func, lt_dlhandle handle, cob_module *module, const char *path, const unsigned int nocanc)
Definition: call.c:535
static const struct system_table system_tab[]
Definition: call.c:186
static cob_module * module
Definition: cobxref.c.l.h:14
cob_call_union syst_call
Definition: call.c:147
lt_dlhandle handle
Definition: call.c:134
static COB_INLINE unsigned int hash(const unsigned char *s)
Definition: call.c:523
static size_t call_lastsize
Definition: call.c:175
int cob_func(const char *name, const int argc, void **argv)
Definition: call.c:1150
void * cob_savenv2(struct cobjmp_buf *jbuf, const int jsize)
Definition: call.c:1178
char * cob_preload_str
Definition: coblocal.h:220
#define PATHSEP_CHAR
Definition: common.h:500
void * cob_resolve_cobol(const char *name, const int fold_case, const int errind)
Definition: call.c:923
static const char * cob_chk_dirp(const char *name)
Definition: call.c:807
static void * lookup(const char *name)
Definition: call.c:581
void * cob_resolve(const char *name)
Definition: call.c:908
#define COB_NORMAL_BUFF
Definition: common.h:541
const char * cob_resolve_error(void)
Definition: call.c:864
static void cache_dynload(const char *path, lt_dlhandle handle)
Definition: call.c:431
char * cob_library_path
Definition: coblocal.h:221
#define COB_SMALL_BUFF
Definition: common.h:540
#define COB_INLINE
Definition: common.h:354
#define COB_MEDIUM_BUFF
Definition: common.h:543
cob_call_union module_entry
Definition: common.h:1052
const char * cob_cstr_name
Definition: common.h:1021
void * func
Definition: call.c:132
static char * resolve_error_buff
Definition: call.c:167
#define COB_MODULE_EXT
Definition: defaults.h:9
lt_dlhandle handle
Definition: call.c:142
#define cob_u8_t
Definition: common.h:27
int cob_call_params
Definition: common.h:1204
void cob_cancel(const char *name)
Definition: call.c:1013
void * funcvoid
Definition: common.h:1010
static cob_settings * cobsetptr
Definition: call.c:162
void cob_longjmp(struct cobjmp_buf *jbuf)
Definition: call.c:1186
void cob_field_to_string(const cob_field *, void *, const size_t)
Definition: common.c:1492
static void do_cancel_module(struct call_hash *p, struct call_hash **base_hash, struct call_hash *prev)
Definition: call.c:354
unsigned int * module_ref_count
Definition: common.h:1057
void cob_fatal_error(const int fatal_error)
Definition: common.c:1601
void cob_runtime_error(const char *,...) COB_A_FORMAT12
Definition: common.c:1543
#define _(s)
Definition: cobcrun.c:59
const char * name
Definition: call.c:131
#define unlikely(x)
Definition: common.h:437
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_resolve_func(const char *name)
Definition: call.c:944
unsigned int no_phys_cancel
Definition: call.c:136
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
void cob_set_exception(const int id)
Definition: common.c:1212
void * cob_savenv(struct cobjmp_buf *jbuf)
Definition: call.c:1160
const char * path
Definition: call.c:141
#define COB_NORMAL_MAX
Definition: common.h:547
int(* funcint)()
Definition: common.h:1009
#define COB_FOLD_LOWER
Definition: common.h:587
struct call_hash * next
Definition: call.c:130
const char * module_name
Definition: common.h:1049
static cob_global * cobglobptr
Definition: call.c:161
void cob_set_cancel(cob_module *m)
Definition: call.c:885
static const unsigned char hexval[]
Definition: call.c:192
#define CALL_BUFF_MAX
Definition: call.c:120
#define COB_FERROR_INITIALIZED
Definition: common.h:692
size_t size
Definition: common.h:951
void cob_call_error(void)
Definition: call.c:878
static char * call_filename_buff
Definition: call.c:169
int cob_call(const char *name, const int argc, void **argv)
Definition: call.c:1080
static void set_resolve_error(const char *msg, const char *entry)
Definition: call.c:269
static unsigned char valid_char[256]
Definition: call.c:261
static char * cob_chk_call_path(const char *name, char **dirent)
Definition: call.c:825
char * cob_strdup(const char *)
Definition: common.c:1308
char * cob_strcat(char *str1, char *str2)
Definition: common.c:4270
jmp_buf cbj_jmp_buf
Definition: common.h:1238
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
const char * syst_call
Definition: codegen.c:67
void * cob_call_field(const cob_field *f, const struct cob_call_struct *cs, const unsigned int errind, const int fold_case)
Definition: call.c:957
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
cob_call_union cob_cstr_cancel
Definition: common.h:1023
static void * cob_resolve_internal(const char *name, const char *dirent, const int fold_case)
Definition: call.c:599
const char ** module_path
Definition: common.h:1058
const char * path
Definition: call.c:135
cob_call_union module_cancel
Definition: common.h:1053
void * cob_fast_malloc(const size_t size)
Definition: common.c:1296
const char * syst_name
Definition: codegen.c:66
#define R_OK
Definition: cobc.h:58
#define COB_FOLD_UPPER
Definition: common.h:586
#define COB_MAX_FIELD_PARAMS
Definition: common.h:559
#define COB_UNUSED(z)
Definition: common.h:535
#define HASH_SIZE
Definition: call.c:122
unsigned int name_convert
Definition: coblocal.h:219
void cob_init_call(cob_global *lptr, cob_settings *sptr)
Definition: call.c:1307
#define COB_MEDIUM_MAX
Definition: common.h:549
static lt_dlhandle mainhandle
Definition: call.c:173
#define likely(x)
Definition: common.h:436
unsigned char flag_no_phys_canc
Definition: common.h:1078
unsigned int cob_physical_cancel
Definition: coblocal.h:218
static struct struct_handle * base_preload_ptr
Definition: call.c:158
cob_call_union cob_cstr_call
Definition: common.h:1022
void cob_stop_run(const int status)
Definition: common.c:1524