33 #include <sys/types.h>
44 #define WIN32_LEAN_AND_MEAN
71 #define CB_LEVEL_PREPROCESS 1
72 #define CB_LEVEL_TRANSLATE 2
73 #define CB_LEVEL_COMPILE 3
74 #define CB_LEVEL_ASSEMBLE 4
75 #define CB_LEVEL_MODULE 5
76 #define CB_LEVEL_LIBRARY 6
77 #define CB_LEVEL_EXECUTABLE 7
80 #define CB_IMSG_SIZE 24
81 #define CB_IVAL_SIZE (74 - CB_IMSG_SIZE - 4)
83 #define COBC_ADD_STR(v,x,y,z) cobc_add_str (&v, &v##_size, x, y, z);
84 #define COBC_INV_PAR _("Invalid %s parameter")
88 #define OC_C_VERSION_PRF ""
89 #define OC_C_VERSION CB_XSTRINGIFY(__VERSION__)
90 #elif defined(__xlc__)
91 #define OC_C_VERSION_PRF "(IBM) "
92 #define OC_C_VERSION CB_XSTRINGIFY(__xlc__)
93 #elif defined(_MSC_VER)
94 #define OC_C_VERSION_PRF "(Microsoft) "
95 #define OC_C_VERSION CB_XSTRINGIFY(_MSC_VER)
96 #elif defined(__BORLANDC__)
97 #define OC_C_VERSION_PRF "(Borland) "
98 #define OC_C_VERSION CB_XSTRINGIFY(__BORLANDC__)
99 #elif defined(__WATCOMC__)
100 #define OC_C_VERSION_PRF "(Watcom) "
101 #define OC_C_VERSION CB_XSTRINGIFY(__WATCOMC__)
102 #elif defined(__INTEL_COMPILER)
103 #define OC_C_VERSION_PRF "(Intel) "
104 #define OC_C_VERSION CB_XSTRINGIFY(__INTEL_COMPILER)
106 #define OC_C_VERSION_PRF ""
107 #define OC_C_VERSION "unknown"
110 #define CB_TEXT_LIST_ADD(y,z) y = cb_text_list_add (y, z)
111 #define CB_TEXT_LIST_CHK(y,z) y = cb_text_list_chk (y, z)
114 #define CB_COPT_1 " /O1"
115 #define CB_COPT_2 " /O2"
116 #define CB_COPT_S " /Os"
117 #elif defined(__BORLANDC__)
118 #define CB_COPT_1 " -O"
119 #define CB_COPT_2 " -O2"
120 #define CB_COPT_S " -O1"
121 #elif defined(__hpux) && !defined(__GNUC__)
122 #define CB_COPT_1 " -O"
123 #define CB_COPT_2 " +O2"
124 #define CB_COPT_S " +O2 +Osize"
125 #elif defined(__WATCOMC__)
126 #define CB_COPT_1 " -ot"
127 #define CB_COPT_2 " -ox"
128 #define CB_COPT_S " -os"
129 #elif defined(__SUNPRO_C)
130 #define CB_COPT_1 " -xO1"
131 #define CB_COPT_2 " -xO2"
132 #define CB_COPT_S " -xO1 -xspace"
133 #elif defined(__xlc__)
134 #define CB_COPT_1 " -O"
135 #define CB_COPT_2 " -O2"
136 #define CB_COPT_S " -O"
138 #define CB_COPT_1 " -O"
139 #define CB_COPT_2 " -O2"
140 #define CB_COPT_S " -Os"
159 char *source_name =
NULL;
185 #define COB_EXCEPTION(code,tag,name,critical) {name, 0x##code, 0},
196 #define CB_FLAG(var,pdok,name,doc) int var = 0;
197 #define CB_FLAG_RQ(var,pdok,name,def,opt,doc) int var = def;
198 #define CB_FLAG_NQ(pdok,name,opt,doc)
206 #define CB_WARNDEF(var,name,doc) int var = 0;
207 #define CB_NOWARNDEF(var,name,doc) int var = 0;
214 #if defined(HAVE_SIGNAL_H) && defined(HAVE_SIG_ATOMIC_T)
215 static volatile sig_atomic_t sig_is_handled = 0;
280 #if defined(_MSC_VER) && COB_USE_VC2005_OR_GREATER
281 static const char *manicmd;
283 static const char *manilink;
284 static size_t manilink_len;
285 #define PATTERN_DELIM '|'
293 #ifndef COB_EBCDIC_MACHINE
300 #ifdef COB_EBCDIC_MACHINE
306 #ifndef COB_EBCDIC_MACHINE
376 #ifndef COB_EBCDIC_MACHINE
388 #define COB_NUM_CSYNS sizeof(cob_csyns) / sizeof(char *)
392 #define CB_NO_ARG no_argument
393 #define CB_RQ_ARG required_argument
394 #define CB_OP_ARG optional_argument
415 {
"static",
CB_NO_ARG, &cb_flag_static_call, 1},
416 {
"dynamic",
CB_NO_ARG, &cb_flag_static_call, 0},
427 #define CB_FLAG(var,pdok,name,doc) \
428 {"f"name, CB_NO_ARG, &var, 1}, \
429 {"fno-"name, CB_NO_ARG, &var, 0},
430 #define CB_FLAG_RQ(var,pdok,name,def,opt,doc) \
431 {"f"name, CB_RQ_ARG, NULL, opt},
432 #define CB_FLAG_NQ(pdok,name,opt,doc) \
433 {"f"name, CB_RQ_ARG, NULL, opt},
441 #define CB_WARNDEF(var,name,doc) \
442 {"W"name, CB_NO_ARG, &var, 1}, \
443 {"Wno-"name, CB_NO_ARG, &var, 0},
444 #define CB_NOWARNDEF(var,name,doc) \
445 {"W"name, CB_NO_ARG, &var, 1}, \
446 {"Wno-"name, CB_NO_ARG, &var, 0},
482 for (reps = cobc_plexmem_base; reps; ) {
487 cobc_plexmem_base =
NULL;
488 for (reps = cobc_parsemem_base; reps; ) {
493 cobc_parsemem_base =
NULL;
494 for (reps = cobc_mainmem_base; reps; ) {
499 cobc_mainmem_base =
NULL;
535 return "FUNCTION CALL";
565 return "SET ATTRIBUTE";
592 vfprintf (stderr, fmt, ap);
608 cobc_abort_pr (
_(
"%s:%d Internal compiler error"), filename, linenum);
622 cobc_abort_pr (
_(
"%s:%d Invalid cast from '%s' type %s to type %s"),
630 #if !defined(__GNUC__) && defined(COB_TREE_DEBUG)
632 cobc_tree_cast_check (
const cb_tree x,
const char *
file,
647 mptr = calloc ((
size_t)1, size);
649 cobc_abort_pr (
_(
"Cannot allocate %d bytes of memory - Aborting"),
659 #ifdef COB_TREE_DEBUG
674 #ifdef COB_TREE_DEBUG
682 memcpy (p, dupstr, n);
691 mptr = realloc (prevptr, size);
693 cobc_abort_pr (
_(
"Cannot reallocate %d bytes of memory - Aborting"),
708 cobc_abort_pr (
_(
"Cannot allocate %d bytes of memory - Aborting"),
715 cobc_mainmem_base = m;
725 #ifdef COB_TREE_DEBUG
727 cobc_abort_pr (
_(
"Call to %s with NULL pointer"),
"cobc_main_strdup");
733 memcpy (p, dupstr, n);
746 cobc_abort_pr (
_(
"Cannot allocate %d bytes of memory - Aborting"),
754 for (curr = cobc_mainmem_base; curr; curr = curr->
next) {
755 if (curr->
memptr == prevptr) {
761 cobc_abort_pr (
_(
"Attempt to reallocate non-allocated memory - Aborting"));
769 cobc_mainmem_base = m;
784 for (curr = cobc_mainmem_base; curr; curr = curr->
next) {
785 if (curr->
memptr == prevptr) {
791 #ifdef COB_TREE_DEBUG
792 cobc_abort_pr (
_(
"Call to %s with invalid pointer, as it is missing in list"),
"cobc_main_free");
802 cobc_mainmem_base = curr->
next;
815 cobc_abort_pr (
_(
"Cannot allocate %d bytes of memory - Aborting"),
822 cobc_parsemem_base = m;
832 #ifdef COB_TREE_DEBUG
834 cobc_abort_pr (
_(
"Call to %s with NULL pointer"),
"cobc_parse_strdup");
840 memcpy (p, dupstr, n);
853 cobc_abort_pr (
_(
"Cannot allocate %d bytes of memory - Aborting"),
861 for (curr = cobc_parsemem_base; curr; curr = curr->
next) {
862 if (curr->
memptr == prevptr) {
868 cobc_abort_pr (
_(
"Attempt to reallocate non-allocated memory - Aborting"));
876 cobc_parsemem_base = m;
891 for (curr = cobc_parsemem_base; curr; curr = curr->
next) {
892 if (curr->
memptr == prevptr) {
898 #ifdef COB_TREE_DEBUG
899 cobc_abort_pr (
_(
"Call to %s with invalid pointer, as it is missing in list"),
"cobc_parse_free");
909 cobc_parsemem_base = curr->
next;
922 cobc_abort_pr (
_(
"Cannot allocate %d bytes of memory - Aborting"),
928 cobc_plexmem_base = m;
938 #ifdef COB_TREE_DEBUG
940 cobc_abort_pr (
_(
"Call to %s with NULL pointer"),
"cobc_plex_strdup");
946 memcpy (p, dupstr, n);
955 #ifdef COB_TREE_DEBUG
957 cobc_abort_pr (
_(
"Call to %s with NULL pointer"),
"cobc_check_string");
961 for (s = base_string; s; s = s->
next) {
962 if (!strcmp (dupstr, (
const char *)s->
val)) {
994 for (p = list; p; p = p->
next) {
995 if (!strcmp (text, p->
text)) {
1007 unsigned int dot_seen;
1008 unsigned int sign_seen;
1020 if (*value ==
'"' || *value ==
'\'') {
1021 size = strlen (value) - 1U;
1022 if (value[0] != value[size]) {
1041 if (*s ==
'+' || *s ==
'-') {
1055 if (*s >
'9' || *s <
'0') {
1061 if (*s || size <= (dot_seen + sign_seen)) {
1064 cobc_abort_pr (
_(
"Warning - Assuming literal for unquoted '%s'"),
1067 size = strlen (value);
1069 sprintf (p->
value,
"'%s'", value);
1090 tptr = (
const void **)p2;
1091 return strcmp (p1, *tptr);
1096 const unsigned int reason)
1103 s =
_(
" - Length is < 1 or > 31");
1106 s =
_(
" - Name cannot begin with space or underscore");
1109 s =
_(
" - Name cannot begin with 'cob_' or 'COB_'");
1112 s =
_(
" - Name duplicates a 'C' keyword");
1115 s =
_(
" - Name cannot contain a directory separator");
1128 cb_error (
_(
"Invalid ENTRY '%s'%s"), name, s);
1132 cb_error (
_(
"Invalid PROGRAM-ID '%s'%s"), name, s);
1147 for (p = name, len = 0; *p; p++, len++) {
1148 if (*p ==
'/' || *p ==
'\\') {
1157 if (!cb_relaxed_syntax_check && len > 31) {
1161 if (*name ==
'_' || *name ==
' ') {
1165 if (prechk && len > 3 &&
1166 (!memcmp (name,
"cob_", (
size_t)4) ||
1167 !memcmp (name,
"COB_", (
size_t)4))) {
1193 const unsigned char *s;
1202 s = (
const unsigned char *)p;
1204 if (*s ==
'"' || *s ==
'\'') {
1205 if (len != 3 || *(s + 2) != *s) {
1208 return (
int)(*(s + 1));
1210 if (*s < '0' || *s >
'9') {
1218 for (i = 0; i < len; ++i) {
1219 if (s[i] <
'0' || s[i] >
'9') {
1233 fputs (
"cobc: ", stderr);
1234 fputs (
_(
"Error: "), stderr);
1236 vfprintf (stderr, fmt, ap);
1238 putc (
'\n', stderr);
1253 s = strtok (x,
"=");
1256 for (l = list; l; l = l->
next) {
1257 if (!strcasecmp (s, l->
name)) {
1268 s = strtok (
NULL,
"");
1291 #ifdef COB_TREE_DEBUG
1293 cobc_abort_pr (
_(
"Call to %s with NULL pointer"),
"cobc_stradd_dup");
1300 memcpy (p, str1, m);
1301 memcpy (p + m, str2, n);
1311 if (!p || *p == 0 || *p ==
' ') {
1327 calcsize = strlen (*var);
1328 calcsize += strlen (s1);
1330 calcsize += strlen (s2);
1333 calcsize += strlen (s3);
1335 if (calcsize >= 131072) {
1339 if (calcsize >= *cursize) {
1340 while (*cursize <= calcsize) {
1357 if (!name || access (name,
F_OK)) {
1361 (void)unlink (name);
1371 (void)unlink (temp_buff);
1372 if (rename (name, temp_buff)) {
1373 cobc_abort_pr (
_(
"Warning - Could not move temporary file to %s"),
1413 for (fn = file_list; fn; fn = fn->
next) {
1451 for (i = 0; i < 30U; ++i) {
1476 fprintf (stderr,
"cobc: ");
1496 #ifdef HAVE_SIGNAL_H
1498 cobc_sig_handler (
int sig)
1500 #if defined(HAVE_SIGACTION) && !defined(SA_RESETHAND)
1501 struct sigaction sa;
1504 #ifdef HAVE_SIG_ATOMIC_T
1505 if (sig_is_handled) {
1516 #ifdef HAVE_SIGACTION
1517 #ifndef SA_RESETHAND
1518 memset (&sa, 0,
sizeof(sa));
1519 sa.sa_handler = SIG_DFL;
1520 (void)sigemptyset (&sa.sa_mask);
1521 (void)sigaction (sig, &sa,
NULL);
1524 (void)signal (sig, SIG_DFL);
1543 printf (
"cobc (%s) %s.%d\n",
1545 puts (
"Copyright (C) 2001-2016 Free Software Foundation, Inc.");
1546 printf (
_(
"Written by %s\n"),
"Keisuke Nishida, Roger While, Ron Norman, Simon Sobisch");
1547 puts (
_(
"This is free software; see the source for copying conditions. There is NO\n"
1548 "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."));
1565 fputs (
_(
"Executing:"), stderr);
1567 if (strlen (cmd) < 64) {
1568 fprintf (stderr,
"\t%s\n", (
char *)cmd);
1572 putc (
'\t', stderr);
1575 token = strtok (p,
" ");
1576 for (; token; token = strtok (
NULL,
" ")) {
1577 toklen = strlen (token) + 1;
1578 if ((n + toklen) > 63) {
1579 fprintf(stderr,
"\n\t\t");
1582 fprintf (stderr,
"%s%s", (n ?
" " :
""), token);
1586 putc (
'\n', stderr);
1602 printf (
" %s: ",
_(
"env"));
1604 printf (
"%-*.*s : ", lablen, lablen, msg);
1607 printf(
"%s\n", val);
1612 token = strtok (p,
" ");
1613 for (; token; token = strtok (
NULL,
" ")) {
1614 toklen = (int)strlen (token) + 1;
1622 printf (
"%s%s", (n ?
" " :
""), token);
1637 puts (
_(
"build information"));
1645 puts (
_(
"GnuCOBOL information"));
1647 if ((s = getenv (
"COB_CC")) !=
NULL) {
1651 if ((s = getenv (
"COB_CFLAGS")) !=
NULL) {
1655 if ((s = getenv (
"COB_LDFLAGS")) !=
NULL) {
1659 if ((s = getenv (
"COB_LIBS")) !=
NULL) {
1663 if ((s = getenv (
"COB_CONFIG_DIR")) !=
NULL) {
1667 if ((s = getenv (
"COB_COPY_DIR")) !=
NULL) {
1670 if ((s = getenv (
"COBCPY")) !=
NULL) {
1678 if ((s = getenv (
"COB_MSG_FORMAT")) !=
NULL) {
1682 if ((s = getenv (
"COB_LIBRARY_PATH")) !=
NULL) {
1690 #if defined(USE_LIBDL) || defined(_WIN32)
1696 #ifdef COB_PARAM_CHECK
1703 if (
sizeof (
void *) > 4U) {
1719 if ((s = getenv (
"COB_VARSEQ_FORMAT")) !=
NULL) {
1723 #ifdef WITH_SEQRA_EXTFH
1729 #if defined (WITH_INDEX_EXTFH)
1731 #elif defined (WITH_DB)
1733 #elif defined (WITH_CISAM)
1735 #elif defined (WITH_DISAM)
1737 #elif defined (WITH_VBISAM)
1743 #ifdef WITH_INDEX_EXTFH
1758 printf (
" -W%-19s %s", name, doc);
1760 fputs (
"\n\t\t\t", stdout);
1761 fputs (
_(
"- NOT set with -Wall"), stdout);
1768 const int pdok,
const int exten)
1779 snprintf (buff,
sizeof(buff),
"%s=<value>", name);
1782 printf (
" -f%-19s %s\n", bptr, doc);
1788 puts (
_(
"GnuCOBOL compiler for most COBOL dialects with lots of extensions"));
1790 printf (
_(
"usage: %s [options]... file..."), prog);
1793 puts (
_(
"options:"));
1794 puts (
_(
" -h, -help display this help and exit"));
1795 puts (
_(
" -V, -version display compiler version and exit"));
1796 puts (
_(
" -i, -info display compiler information (build/environment)"));
1797 puts (
_(
" -v, -verbose display the commands invoked by the compiler"));
1798 puts (
_(
" -vv display compiler version and the commands\n" \
1799 " invoked by the compiler"));
1800 puts (
_(
" -x build an executable program"));
1801 puts (
_(
" -m build a dynamically loadable module (default)"));
1802 puts (
_(
" -j run job, after build"));
1803 puts (
_(
" -std=<dialect> warnings/features for a specific dialect\n"
1804 " <dialect> can be one of:\n"
1805 " cobol2014, cobol2002, cobol85, default,\n"
1806 " ibm, mvs, bs2000, mf, acu;\n"
1807 " see configuration files in directory config"));
1808 puts (
_(
" -F, -free use free source format"));
1809 puts (
_(
" -free use free source format"));
1810 puts (
_(
" -fixed use fixed source format (default)"));
1811 puts (
_(
" -O, -O2, -Os enable optimization"));
1812 puts (
_(
" -g enable C compiler debug / stack check / trace"));
1813 puts (
_(
" -d, -debug enable all run-time error checking"));
1814 puts (
_(
" -o <file> place the output into <file>"));
1815 puts (
_(
" -b combine all input files into a single\n"
1816 " dynamically loadable module"));
1817 puts (
_(
" -E preprocess only; do not compile or link"));
1818 puts (
_(
" -C translation only; convert COBOL to C"));
1819 puts (
_(
" -S compile only; output assembly file"));
1820 puts (
_(
" -c compile and assemble, but do not link"));
1821 puts (
_(
" -P(=<dir or file>) generate preprocessed program listing (.lst)"));
1822 puts (
_(
" -Xref generate cross reference through 'cobxref'\n"
1823 " (V. Coen's 'cobxref' must be in path)"));
1824 puts (
_(
" -I <directory> add <directory> to copy/include search path"));
1825 puts (
_(
" -L <directory> add <directory> to library search path"));
1826 puts (
_(
" -l <lib> link the library <lib>"));
1827 puts (
_(
" -A <options> add <options> to the C compile phase"));
1828 puts (
_(
" -Q <options> add <options> to the C link phase"));
1829 puts (
_(
" -D <define> define <define> for COBOL compilation"));
1830 puts (
_(
" -K <entry> generate CALL to <entry> as static"));
1831 puts (
_(
" -conf=<file> user defined dialect configuration - See -std="));
1832 puts (
_(
" -cb_conf=<tag:value> override configuration entry"));
1833 puts (
_(
" -list-reserved display reserved words"));
1834 puts (
_(
" -list-intrinsics display intrinsic functions"));
1835 puts (
_(
" -list-mnemonics display mnemonic names"));
1836 puts (
_(
" -list-system display system routines"));
1837 puts (
_(
" -save-temps(=<dir>) save intermediate files\n"
1838 " - default: current directory"));
1839 puts (
_(
" -ext <extension> add default file extension"));
1843 puts (
_(
" -W enable ALL warnings"));
1844 puts (
_(
" -Wall enable all warnings except as noted below"));
1845 puts (
_(
" -Wno-<feature> disable warning enabled by -W or -Wall"));
1848 #define CB_WARNDEF(var,name,doc) \
1849 cobc_print_warn (name, doc, 1);
1850 #define CB_NOWARNDEF(var,name,doc) \
1851 cobc_print_warn (name, doc, 0);
1861 #define CB_FLAG(var,pdok,name,doc) \
1862 cobc_print_flag (name, doc, pdok, 0);
1863 #define CB_FLAG_RQ(var,pdok,name,def,opt,doc) \
1864 cobc_print_flag (name, doc, pdok, 1);
1865 #define CB_FLAG_NQ(pdok,name,opt,doc) \
1866 cobc_print_flag (name, doc, pdok, 1);
1878 cobc_err_exit (
_(
"Only one of options 'E', 'S', 'C', 'c' may be specified"));
1884 cobc_err_exit (
_(
"Only one of options 'm', 'x', 'b' may be specified"));
1893 if (!strcasecmp (opt,
"ALL")) {
1899 q = strtok (p,
",");
1905 q = strtok (
NULL,
",");
1918 int list_reserved = 0;
1932 while (++argnum <= argc) {
1933 if (strrchr(argv[argnum - 1],
'/') == argv[argnum - 1]) {
1934 argv[argnum - 1][0] =
'-';
1944 long_options, &idx, 1)) >= 0) {
2023 if (sub_ret != 0) conf_ret = sub_ret;
2040 if (cb_config_name ==
NULL) {
2042 fputs (
_(
"Loading standard configuration file 'default.conf'"), stderr);
2043 fputc (
'\n', stderr);
2046 if (sub_ret != 0) conf_ret = sub_ret;
2050 if (conf_ret != 0) {
2056 if (cb_flag_relaxed_syntax) {
2057 cb_relaxed_syntax_check = 1;
2058 cb_larger_redefines_ok = 1;
2059 cb_relax_level_hierarchy = 1;
2060 cb_top_level_occurs_clause =
CB_OK;
2065 long_options, &idx, 1)) >= 0) {
2132 cb_flag_implicit_init = 1;
2203 cb_flag_stack_check = 1;
2204 cb_flag_source_location = 1;
2223 if (sub_ret != 0) conf_ret = sub_ret;
2228 cb_flag_source_location = 1;
2230 cb_flag_stack_check = 1;
2239 !(S_ISDIR (st.st_mode))) {
2240 cobc_abort_pr (
_(
"Warning - '%s' is not a directory, defaulting to current directory"),
2251 if (!stat (
cob_optarg, &st) && S_ISDIR (st.st_mode)) {
2273 cobc_abort_pr (
_(
"Warning - assuming '%s' is a DEFINE - did you intend to use -debug?"),
2289 !(S_ISDIR (st.st_mode))) {
2294 #elif defined (__WATCOMC__)
2308 !(S_ISDIR (st.st_mode))) {
2361 if (n < 16 || n > 512) {
2370 if (n < 1 || n > 512) {
2380 }
else if (!strcasecmp (
cob_optarg,
"ASCII")) {
2391 }
else if (!strcasecmp (
cob_optarg,
"LOWER")) {
2402 }
else if (!strcasecmp (
cob_optarg,
"LOWER")) {
2412 if (n < 0 || n > 255) {
2415 cb_default_byte = n;
2438 #define CB_WARNDEF(var,name,doc) var = 0;
2439 #define CB_NOWARNDEF(var,name,doc) var = 0;
2450 #define CB_WARNDEF(var,name,doc) var = 1;
2451 #define CB_NOWARNDEF(var,name,doc)
2462 #define CB_WARNDEF(var,name,doc) var = 1;
2463 #define CB_NOWARNDEF(var,name,doc) var = 1;
2475 if (conf_ret != 0) {
2480 if (list_reserved) {
2492 fputs (
_(
"All runtime checks are enabled"), stderr);
2493 fputc (
'\n', stderr);
2502 if (cb_flag_traceall) {
2504 cb_flag_source_location = 1;
2518 for (; p; p = next) {
2533 if (p ==
NULL || !*p || *p ==
' ') {
2543 if (!stat (token, &st) && (S_ISDIR (st.st_mode))) {
2553 #if defined (_MSC_VER) || defined(__OS400__) || defined(__WATCOMC__) || defined(__BORLANDC__)
2555 file_stripext (
char *buff)
2559 endp = buff + strlen (buff) - 1U;
2560 while (endp > buff) {
2561 if (*endp ==
'/' || *endp ==
'\\') {
2582 "file_basename",
"filename");
2588 for (p = filename; *p; p++) {
2589 if (*p ==
'/' || *p ==
'\\') {
2600 endp = strrchr (filename,
'.');
2601 if (endp > startp) {
2602 len = endp - startp;
2604 len = strlen (startp);
2622 p = strrchr (filename,
'.');
2633 struct filename *fn;
2634 struct filename *ffn;
2640 if (strcmp(filename,
COB_DASH) == 0) {
2653 fsize = strlen (filename);
2660 if (strchr (filename,
'.') !=
NULL) {
2663 if (!file_is_stdin && access (filename,
R_OK) != 0) {
2673 if (strcmp(extension,
"lib") && strcmp(extension,
"a") &&
2689 for (ffn = file_list; ffn->
next; ffn = ffn->
next)
2697 if (strcmp (extension,
"i") == 0) {
2700 }
else if (strcmp (extension,
"c") == 0 ||
2701 strcmp (extension,
"s") == 0) {
2707 #
if defined(__OS400__)
2712 || strcmp(extension,
"lib") == 0
2714 #
if !defined(_WIN32) || defined(__MINGW32__) || defined(__MINGW64__)
2715 || strcmp(extension,
"a") == 0
2716 || strcmp(extension,
"so") == 0
2717 || strcmp(extension,
"dylib") == 0
2718 || strcmp(extension,
"sl") == 0
2784 snprintf (listptr, fsize,
"%s%c%s.lst",
2804 line_contains (
char* line_start,
char* line_end,
char* search_patterns) {
2805 int pattern_end, pattern_start, pattern_length, full_length;
2808 if (search_patterns ==
NULL)
return 0;
2811 full_length = (int)strlen (search_patterns) - 1;
2812 for (pattern_end = 0; pattern_end < (int)strlen(search_patterns); pattern_end++) {
2813 if (search_patterns[pattern_end] == PATTERN_DELIM) {
2814 pattern_length = pattern_end - pattern_start;
2815 for (line_pos = line_start; line_pos + pattern_length <= line_end; line_pos++) {
2817 if (memcmp (line_pos, search_patterns + pattern_start, pattern_length) == 0) {
2819 if (pattern_start + pattern_length == full_length) {
2826 pattern_start = pattern_end + 1;
2840 fputs (
_(
"Nothing for -j to run"), stderr);
2859 fputs (
_(
"Return status:"), stderr);
2860 fprintf (stderr,
"\t%d\n", ret);
2872 char *objname =
NULL;
2873 char *cobjname =
NULL;
2901 token = strtok (cmd,
" ");
2902 if (token !=
NULL) {
2904 token = strtok (
NULL,
" ");
2906 for (; token; token = strtok (
NULL,
" ")) {
2907 if (*token !=
'-') {
2908 len = strlen (token);
2909 if (*token ==
'"') {
2914 if (token[len-2] ==
'.' && token[len-1] ==
'c') {
2920 objs[nobjs++] = token;
2931 token = strtok (
NULL,
" ");
2933 if (*token ==
'"') {
2935 token[strlen(token) - 1] = 0;
2937 incl[nincl++] = token;
2942 token = strtok (
NULL,
" ");
2944 if (*token ==
'"') {
2946 token[strlen(token) - 1] = 0;
2948 defs[ndefs++] = token;
2952 optc[noptc++] = token;
2956 optl[noptl++] = token;
2961 token = strtok (
NULL,
" ");
2963 if (*token ==
'"') {
2965 token[strlen(token) - 1] = 0;
2972 token = strtok (
NULL,
" ");
2974 libs[nlibs++] = token;
2994 if (objname ==
NULL) {
2999 sprintf(buffptr,
"CRTCMOD MODULE(%s) SRCSTMF('%s') ",
3002 strcat (buffptr,
"INCDIR(");
3003 for (i = 0; i < nincl; ++i) {
3005 strcat (buffptr,
" ");
3007 strcat (buffptr,
"'");
3008 strcat (buffptr, incl[i]);
3009 strcat (buffptr,
"' ");
3011 strcat (buffptr,
") ");
3014 strcat (buffptr,
"DEFINE(");
3015 for (i = 0; i < ndefs; ++i) {
3017 strcat (buffptr,
" ");
3019 strcat (buffptr,
"'");
3020 strcat (buffptr, defs[i]);
3021 strcat (buffptr,
"' ");
3023 strcat (buffptr,
") ");
3025 strcat (buffptr,
"SYSIFCOPT(*IFSIO)");
3026 for (i = 0; i < noptc; ++i) {
3027 strcat (buffptr,
" ");
3028 strcat (buffptr, optc[i]);
3031 strcat (buffptr,
" OPTIMIZE(40)");
3034 strcat (buffptr,
" DBGVIEW(*ALL)");
3037 strcat (buffptr,
" OUTPUT(*PRINT)");
3042 ret = system (buffptr);
3044 fputs (
_(
"Return status:"), stderr);
3045 fprintf (stderr,
"\t%d\n", ret);
3048 if (comp_only || ret != 0) {
3053 if (objname ==
NULL) {
3056 }
else if (nobjs > 0) {
3059 objname = (
char *)
"AOUT";
3063 sprintf(buffptr,
"CRTSRVPGM SRVPGM(%s) MODULE(", objname);
3065 sprintf(buffptr,
"CRTPGM PGM(%s) MODULE(", objname);
3068 strcat (buffptr, cobjname);
3070 for (i = 0; i < nobjs; ++i) {
3071 if (i != 0 || name !=
NULL) {
3072 strcat (buffptr,
" ");
3074 strcat (buffptr, objs[i]);
3076 strcat (buffptr,
")");
3078 strcat (buffptr,
" BNDSRVPGM(");
3079 for (i = 0; i < nlibs; ++i) {
3081 strcat (buffptr,
" ");
3083 strcat (buffptr, libs[i]);
3085 strcat (buffptr,
")");
3087 for (i = 0; i < noptl; ++i) {
3088 strcat (buffptr,
" ");
3089 strcat (buffptr, optl[i]);
3092 strcat (buffptr,
" EXPORT(*ALL)");
3097 ret = system (buffptr);
3099 fputs (
_(
"Return status:"), stderr);
3100 fprintf (stderr,
"\t%d\n", ret);
3111 #elif defined(_MSC_VER)
3122 fputs (
_ (
"Return status:"), stderr);
3123 fprintf (stderr,
"\t%d\n", ret);
3130 process_filtered (
const char *cmd,
struct filename *fn)
3134 char *line_start, *line_end;
3135 char* search_pattern, *search_pattern2 =
NULL;
3136 char* output_name_temp;
3140 pipe = _popen(cmd,
"r");
3154 file_stripext(output_name_temp);
3163 sprintf(search_pattern,
"%s\n%c", fn->
translate + i, PATTERN_DELIM);
3165 search_pattern2 = (
char*)
cobc_malloc (2 * (strlen (output_name_temp) + 5) + 1);
3166 sprintf (search_pattern2,
"%s.lib%c%s.exp%c",
file_basename(output_name_temp), PATTERN_DELIM,
3174 while (line_start !=
NULL) {
3176 line_end = line_start + strlen(line_start);
3179 if (line_start == line_end
3180 || (!line_contains(line_start, line_end, search_pattern)
3181 && !line_contains(line_start, line_end, search_pattern2)))
3183 fprintf(stdout,
"%*s", (
int)(line_end - line_start + 2), line_start);
3196 return !!_pclose (pipe);
3209 buffptr = (
char *)cmd;
3211 clen = strlen (cmd) + 64U;
3216 for (; *cmd; ++cmd) {
3218 p += sprintf (p,
"\\$");
3230 ret = system (buffptr);
3237 if (WIFSIGNALED(ret)) {
3239 if (WTERMSIG(ret) == SIGINT) {
3240 cobc_sig_handler (SIGINT);
3244 if (WTERMSIG(ret) == SIGQUIT) {
3245 cobc_sig_handler (SIGQUIT);
3251 fputs (
_(
"Return status:"), stderr);
3252 fprintf (stderr,
"\t%d\n", ret);
3266 const char *sourcename;
3267 int save_source_format;
3295 fputs (
_(
"Preprocessing:"), stderr);
3296 fprintf (stderr,
"\t%s -> %s\n",
3314 save_fold_copy = cb_fold_copy;
3315 save_fold_call = cb_fold_call;
3322 cb_fold_copy = save_fold_copy;
3323 cb_fold_call = save_fold_call;
3340 for (m = cobc_plexmem_base; m; ) {
3345 cobc_plexmem_base =
NULL;
3360 fputs (
_(
"Return status:"), stderr);
3361 fprintf (stderr,
"\t%d\n", ret);
3365 fputs (
_(
"'cobxref' execution unsuccessful"),
3367 putc (
'\n', stderr);
3369 fprintf (stderr,
_(
"Check that 'cobxref' is in %s"),
3372 fprintf (stderr,
_(
"Check that 'cobxref' is in %s"),
3375 putc (
'\n', stderr);
3376 fputs (
_(
"No listing produced"),
3378 putc (
'\n', stderr);
3387 fputs (
_(
"Return status:"), stderr);
3421 fputs (
_(
"Parsing:"), stderr);
3439 fputs (
_(
"Return status:"), stderr);
3440 fprintf (stderr,
"\t%d\n", ret);
3444 if (ret || cb_flag_syntax_only) {
3478 fputs (
_(
"Translating:"), stderr);
3479 fprintf (stderr,
"\t%s -> %s (%s)\n",
3571 strcat (name,
".s");
3574 size = strlen (name);
3587 "%s /c %s %s /Od /MDd /Zi /FR /c /Fa\"%s\" /Fo\"%s\" \"%s\"" :
3588 "%s /c %s %s /MD /c /Fa\"%s\" /Fo\"%s\" \"%s\"",
3596 #elif defined(__WATCOMC__)
3629 "%s /c %s %s /Od /MDd /Zi /FR /Fo\"%s\" \"%s\"" :
3630 "%s /c %s %s /MD /Fo\"%s\" \"%s\"",
3638 #elif defined(__OS400__)
3640 if (name[0] !=
'/') {
3649 file_stripext ((
char *) fn->
object);
3658 #elif defined(__WATCOMC__)
3661 sprintf (
cobc_buffer,
"%s -c %s %s %s -fe=\"%s\" \"%s\"",
3665 sprintf (
cobc_buffer,
"%s -c %s %s -fe=\"%s\" \"%s\"",
3678 sprintf (
cobc_buffer,
"%s -c %s %s %s -o \"%s\" \"%s\"",
3683 sprintf (
cobc_buffer,
"%s -c %s %s -o \"%s\" \"%s\"",
3709 #if defined(_MSC_VER) || defined(__OS400__) || defined(__WATCOMC__) || defined(__BORLANDC__)
3710 file_stripext (name);
3719 #if !defined(_MSC_VER) && !defined(__OS400__) && !defined(__WATCOMC__) && !defined(__BORLANDC__)
3728 size = strlen (name);
3746 "%s %s %s /Od /MDd /LDd /Zi /FR /Fe\"%s\" /Fo\"%s\" \"%s\" %s %s %s %s" :
3747 "%s %s %s /MD /LD /Fe\"%s\" /Fo\"%s\" \"%s\" %s %s %s %s",
3756 #if defined(_MSC_VER) && COB_USE_VC2005_OR_GREATER
3760 "%s /manifest \"%s.manifest\" /outputresource:\"%s\";#2",
3761 manicmd, exename, exename);
3787 sprintf (
cobc_buffer,
"%s %s %s %s %s %s -fe=\"%s\" \"%s\" %s %s %s",
3792 sprintf (
cobc_buffer,
"%s %s %s %s %s %s -o \"%s\" \"%s\" %s %s %s",
3798 #ifdef COB_STRIP_CMD
3827 #if defined(_MSC_VER) || defined(__OS400__) || defined(__WATCOMC__) || defined(__BORLANDC__)
3828 file_stripext (name);
3837 #if !defined(_MSC_VER) && !defined(__OS400__) && !defined(__WATCOMC__) &&! defined(__BORLANDC__)
3846 size = strlen (name);
3859 "%s /Od /MDd /LDd /Zi /FR /Fe\"%s\" \"%s\" %s %s %s %s" :
3860 "%s /MD /LD /Fe\"%s\" \"%s\" %s %s %s %s",
3868 #if defined(_MSC_VER) && COB_USE_VC2005_OR_GREATER
3872 "%s /manifest \"%s.manifest\" /outputresource:\"%s\";#2",
3873 manicmd, exename, exename);
3887 sprintf (
cobc_buffer,
"%s %s %s %s -fe=\"%s\" \"%s\" %s %s %s",
3891 sprintf (
cobc_buffer,
"%s %s %s %s -o \"%s\" \"%s\" %s %s %s",
3896 #ifdef COB_STRIP_CMD
3926 "process_library",
"l");
3930 for (f = l; f; f = f->
next) {
3939 #if defined(_MSC_VER) || defined(__OS400__) || defined(__WATCOMC__) || defined(__BORLANDC__)
3940 file_stripext (name);
3949 #if !defined(_MSC_VER) && !defined(__OS400__) && !defined(__WATCOMC__) && !defined(__BORLANDC__)
3958 size = strlen (name);
3971 "%s /Od /MDd /LDd /Zi /FR /Fe\"%s\" %s %s %s %s %s" :
3972 "%s /MD /LD /Fe\"%s\" %s %s %s %s %s",
3980 #if defined(_MSC_VER) && COB_USE_VC2005_OR_GREATER
3984 "%s /manifest \"%s.manifest\" /outputresource:\"%s\";#2",
3985 manicmd, exename, exename);
3995 for (f = l; f; f = f->
next) {
4003 sprintf (
cobc_buffer,
"%s %s %s %s -fe=\"%s\" %s %s %s %s",
4008 sprintf (
cobc_buffer,
"%s %s %s %s -o \"%s\" %s %s %s %s",
4014 #ifdef COB_STRIP_CMD
4036 const char *exename;
4044 "process_link",
"l");
4048 for (f = l; f; f = f->
next) {
4050 file_stripext ((
char *) f->
object);
4061 #if defined(_MSC_VER) || defined(__OS400__) || defined(__WATCOMC__) || defined(__BORLANDC__)
4063 file_stripext ((
char *)name);
4078 size = strlen (name);
4091 "%s /Od /MDd /Zi /FR /Fe\"%s\" %s %s %s %s %s" :
4092 "%s /MD /Fe\"%s\" %s %s %s %s %s",
4100 #if defined(_MSC_VER) && COB_USE_VC2005_OR_GREATER
4104 "%s /manifest \"%s.manifest\" /outputresource:\"%s\";#1",
4105 manicmd, exename, exename);
4113 sprintf (
cobc_buffer,
"%s %s -fe=\"%s\" %s %s %s %s",
4117 sprintf (
cobc_buffer,
"%s %s -o \"%s\" %s %s %s %s",
4126 sprintf (
cobc_buffer,
"chatr -s +s enable \"%s%s\" 1>/dev/null 2>&1",
4132 #ifdef COB_STRIP_CMD
4158 unsigned int iparams;
4159 unsigned int local_level;
4166 #if defined(HAVE_SIGNAL_H) && defined(HAVE_SIGACTION)
4167 struct sigaction sa;
4168 struct sigaction osa;
4171 struct stat localest;
4172 const char* localedir;
4183 #ifdef HAVE_SIGNAL_H
4185 #ifdef HAVE_SIGACTION
4186 memset (&sa, 0,
sizeof(sa));
4187 sa.sa_handler = cobc_sig_handler;
4189 sa.sa_flags = SA_RESETHAND;
4194 sa.sa_flags |= SA_NOCLDSTOP;
4197 (void)sigaction (SIGINT,
NULL, &osa);
4198 if (osa.sa_handler != SIG_IGN) {
4199 (void)sigemptyset (&sa.sa_mask);
4200 (void)sigaction (SIGINT, &sa,
NULL);
4204 (void)sigaction (SIGHUP,
NULL, &osa);
4205 if (osa.sa_handler != SIG_IGN) {
4206 (void)sigemptyset (&sa.sa_mask);
4207 (void)sigaction (SIGHUP, &sa,
NULL);
4211 (void)sigaction (SIGQUIT,
NULL, &osa);
4212 if (osa.sa_handler != SIG_IGN) {
4213 (void)sigemptyset (&sa.sa_mask);
4214 (void)sigaction (SIGQUIT, &sa,
NULL);
4218 (void)sigaction (SIGTERM,
NULL, &osa);
4219 if (osa.sa_handler != SIG_IGN) {
4220 (void)sigemptyset (&sa.sa_mask);
4221 (void)sigaction (SIGTERM, &sa,
NULL);
4225 (void)sigaction (SIGPIPE,
NULL, &osa);
4226 if (osa.sa_handler != SIG_IGN) {
4227 (void)sigemptyset (&sa.sa_mask);
4228 (void)sigaction (SIGPIPE, &sa,
NULL);
4233 (void)sigemptyset (&sa.sa_mask);
4234 (void)sigaction (SIGSEGV, &sa,
NULL);
4240 if (signal (SIGINT, SIG_IGN) != SIG_IGN) {
4241 (void)signal (SIGINT, cobc_sig_handler);
4245 if (signal (SIGHUP, SIG_IGN) != SIG_IGN) {
4246 (void)signal (SIGHUP, cobc_sig_handler);
4250 if (signal (SIGQUIT, SIG_IGN) != SIG_IGN) {
4251 (void)signal (SIGQUIT, cobc_sig_handler);
4255 if (signal (SIGTERM, SIG_IGN) != SIG_IGN) {
4256 (void)signal (SIGTERM, cobc_sig_handler);
4260 if (signal (SIGPIPE, SIG_IGN) != SIG_IGN) {
4261 (void)signal (SIGPIPE, cobc_sig_handler);
4266 (void)signal (SIGSEGV, cobc_sig_handler);
4301 #ifdef COB_EBCDIC_MACHINE
4309 p = getenv (
"COB_UNIX_LF");
4310 if (p && (*p ==
'Y' || *p ==
'y' || *p ==
'1')) {
4311 (void)_setmode (_fileno (stdin), _O_BINARY);
4312 (void)_setmode (_fileno (stdout), _O_BINARY);
4313 (void)_setmode (_fileno (stderr), _O_BINARY);
4317 #ifdef HAVE_SETLOCALE
4318 setlocale (LC_ALL,
"");
4319 setlocale (LC_NUMERIC,
"C");
4323 localedir = getenv(
"LOCALEDIR");
4324 if (localedir !=
NULL
4325 && !stat (localedir, &localest)
4326 && (S_ISDIR (localest.st_mode))) {
4337 memset (month, 0,
sizeof(month));
4340 status = sscanf (__DATE__,
"%s %d %d", month, &day, &year);
4343 "%s %2.2d %4.4d %s", month, day, year, __TIME__);
4346 "%s %s", __DATE__, __TIME__);
4397 #if defined (_MSC_VER)
4398 if (p && strcasecmp(p,
"GCC") == 0) {
4404 if (p && strcasecmp(p,
"MSC") == 0) {
4412 #if defined(__GNUC__) && !defined(__clang__)
4413 cb_flag_computed_goto = 1;
4414 #elif defined(__SUNPRO_C) && __SUNPRO_C >= 0x570
4415 cb_flag_computed_goto = 1;
4416 #elif defined(__xlc__) && defined(__IBMC__) && __IBMC__ >= 700
4417 cb_flag_computed_goto = 1;
4429 #ifdef __INTEL_COMPILER
4432 #elif defined(__GNUC__)
4441 #ifdef HAVE_PSIGN_OPT
4445 #elif defined(__xlc__)
4454 #ifndef HAVE_DESIGNATED_INITS
4462 if (
iargs == argc) {
4471 #if defined(_MSC_VER) && COB_USE_VC2005_OR_GREATER
4473 manicmd =
"mt /nologo";
4474 manilink =
"/link /nologo /manifest";
4477 manilink =
"/link /manifest";
4481 manilink =
"/link /nologo";
4486 manilink_len = strlen (manilink);
4497 #if defined(__GNUC__) && !defined (__INTEL_COMPILER)
4500 " -fno-asynchronous-unwind-tables",
4501 " -U_FORTIFY_SOURCE");
4507 #ifdef HAVE_UNWIND_OPT
4531 if (!cb_flag_syntax_only) {
4556 (argc -
iargs) > 1) {
4557 cobc_err_exit (
_(
"%s option invalid in this combination"),
"-o");
4560 if (cb_flag_notrunc) {
4561 cb_binary_truncate = 0;
4562 cb_pretty_display = 0;
4566 #ifndef HAVE_DESIGNATED_INITS
4580 fputs (
_(
"Command line:"), stderr);
4581 putc (
'\t', stderr);
4582 for (i = 0; i < argc; ++i) {
4583 fprintf (stderr,
"%s ", argv[i]);
4585 putc (
'\n', stderr);
4604 while (
iargs < argc) {
4634 if (cb_compile_level < CB_LEVEL_TRANSLATE || fn->has_error) {
4642 for (mptr = cobc_parsemem_base; mptr; ) {
4647 cobc_parsemem_base =
NULL;
4699 status || cb_flag_syntax_only) {
static const char * cobc_enum_explain(const enum cb_tag tag)
struct cb_label * handler_label
struct cb_text_list * next
static size_t save_all_src
const char * cob_config_dir
void ylex_call_destroy(void)
static char * save_temps_dir
void * cobc_main_malloc(const size_t size)
#define CB_TEXT_LIST_CHK(y, z)
static size_t cobc_include_size
void cobc_abort_pr(const char *fmt,...)
static size_t cobc_objects_len
void * cobc_realloc(void *prevptr, const size_t size)
static char * cobc_stradd_dup(const char *str1, const char *str2)
static size_t cobc_ldflags_size
static struct strcache * base_string
int cob_getopt_long_long(const int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind, const int long_only)
void plex_call_destroy(void)
const char * cb_source_file
struct cb_text_list * cb_extension_list
struct cb_text_list * cb_intrinsic_list
static size_t cobc_cflags_len
struct cb_text_list * cb_include_list
static char * cobc_include
void * cobc_parse_malloc(const size_t size)
static int cobc_deciph_optarg(const char *p, const int allow_quote)
void codegen(struct cb_program *prog, const int nested)
static struct cobc_mem_struct * cobc_plexmem_base
static void cobc_free_mem(void)
struct cb_define_struct * next
unsigned int need_assemble
#define COBC_ADD_STR(v, x, y, z)
static size_t basename_len
void cobc_free(void *mptr)
static char * cobc_objects_buffer
int cb_load_conf(const char *, const int)
void cb_list_intrinsics(void)
static int process_link(struct filename *l)
char * cb_name(cb_tree x)
static void cobc_var_print(const char *msg, const char *val, const unsigned int env)
const char * cb_storage_file_name
const char * listing_file
static DECLNORET void COB_A_NORETURN cobc_terminate(const char *str)
#define CB_LEVEL_ASSEMBLE
void * cobc_plex_strdup(const char *dupstr)
void * cobc_parse_realloc(void *prevptr, const size_t size)
struct cb_intrinsic_table * lookup_intrinsic(const char *name, const int checkres, const int checkimpl)
static int process_run(const char *name)
-j run job after build
static size_t cobc_lib_paths_size
void ppparse_clear_vars(const struct cb_define_struct *)
void cb_list_mnemonics(void)
static void process_env_copy_path(const char *p)
struct nested_list * next
#define CB_TEXT_LIST_ADD(y, z)
static size_t cobc_cflags_size
#define bindtextdomain(Domainname, Dirname)
static size_t cobc_cc_len
struct local_filename * local_include
static char * cobc_list_file
void cobc_main_free(void *prevptr)
static size_t wants_nonfinal
int main(int argc, char **argv)
static struct cobc_mem_struct * cobc_mainmem_base
void plex_clear_all(void)
void * cobc_check_string(const char *dupstr)
if fold fold static computed alternate extra correct stack on syntax debugging source implicit stack syntax extension
static DECLNORET void COB_A_NORETURN cobc_err_exit(const char *fmt,...)
void cobc_abort(const char *filename, const int linenum)
void * cobc_parse_strdup(const char *dupstr)
static struct cb_text_list * cb_text_list_add(struct cb_text_list *list, const char *text)
struct cb_exception cb_exception_table[]
void ylex_clear_all(void)
const char * demangle_source
if fold fold static computed alternate extra correct stack on syntax debugging source implicit stack syntax write single recursive relax optional file
static int process_module(struct filename *fn)
unsigned int need_translate
static struct filename * file_list
static char * cobc_ldflags
void * cobc_main_realloc(void *prevptr, const size_t size)
static char * cobc_buffer
static int process_module_direct(struct filename *fn)
unsigned int cobc_gen_listing
#define CB_LEVEL_TRANSLATE
static void cobc_error_name(const char *name, const unsigned int source, const unsigned int reason)
#define textdomain(Domainname)
static char * cobc_list_dir
static int cobc_bcompare(const void *p1, const void *p2)
static int process_compile(struct filename *fn)
static size_t cobc_include_len
static int process(const char *cmd)
static size_t cobc_flag_module
static struct cb_define_struct * cb_define_list_add(struct cb_define_struct *list, const char *text)
static void cobc_deciph_funcs(const char *opt)
static const struct option long_options[]
struct local_filename * localfile
struct cb_program * nested_prog
strict implicit external value
struct cb_text_list * cb_early_exit_list
static const char * file_extension(const char *filename)
static size_t cobc_libs_size
int cb_flag_functions_all
#define CB_LEVEL_EXECUTABLE
void cobc_parse_free(void *prevptr)
static const char * cobc_cc
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
void cobc_init_scanner(void)
static size_t verbose_output
void plex_clear_vars(void)
struct cb_program * next_program
static char * file_basename(const char *filename)
struct cb_text_list * last
static char * cobc_lib_paths
static int preprocess(struct filename *fn)
int ppopen(const char *, struct cb_replace_list *)
struct cb_define_struct * last
struct cb_program * handler_prog
void cb_insert_common_prog(struct cb_program *prog, struct cb_program *comprog)
static size_t cobc_libs_len
void cb_list_reserved(void)
static int process_translate(struct filename *fn)
static int process_command_line(const int argc, char **argv)
void cb_list_system(void)
static void cobc_options_error_build(void)
void * cobc_main_strdup(const char *dupstr)
static void cobc_check_action(const char *name)
static void cobc_print_info(void)
static char * cobc_getenv(const char *env)
static struct cb_text_list * cb_text_list_chk(struct cb_text_list *list, const char *text)
void * cobc_strdup(const char *dupstr)
static size_t cob_optimize
static char * output_name
static void cobc_options_error_nonfinal(void)
void cb_error(const char *,...) COB_A_FORMAT12
static void cobc_cmd_print(const char *cmd)
static struct cb_program * program_list_reverse(struct cb_program *p)
char * cb_encode_program_id(const char *)
if fold fold static computed alternate extra correct stack on syntax debugging line
static struct cb_define_struct * cb_define_list
struct cb_program * current_program
struct nested_list * common_prog_list
static struct filename * process_filename(const char *filename)
static size_t cobc_flag_run
struct handler_struct global_handler[5]
void cb_init_constants(void)
void cob_incr_temp_iteration(void)
#define CB_EXCEPTION_ENABLE(id)
int cb_load_std(const char *)
#define CB_LEVEL_PREPROCESS
const char * demangle_name
static char * cobc_cflags
static size_t strip_output
static void cobc_print_flag(const char *name, const char *doc, const int pdok, const int exten)
void * cobc_plex_malloc(const size_t size)
void * cobc_malloc(const size_t size)
static DECLNORET void COB_A_NORETURN cobc_abort_terminate(void)
static size_t cobc_export_dyn_len
static int process_assemble(struct filename *fn)
cob_u32_t optimize_defs[COB_OPTIM_MAX]
static const char *const cob_csyns[]
static void cobc_print_version(void)
size_t cobc_check_valid_name(const char *name, const unsigned int prechk)
unsigned int need_preprocess
struct local_filename * next
cb_tree cb_list_reverse(cb_tree l)
static const char short_options[]
static unsigned int cobc_set_value(struct cb_define_struct *p, const char *value)
static char * basename_buffer
static size_t cobc_lib_paths_len
static size_t cobc_shared_opt_len
static void cobc_add_str(char **var, size_t *cursize, const char *s1, const char *s2, const char *s3)
void cobc_dumb_abort(const char *filename, const int linenum)
void cobc_too_many_errors(void)
static char * output_name_buff
static int process_library(struct filename *l)
static struct cobc_mem_struct * cobc_parsemem_base
void cobc_init_typeck(void)
static void cobc_clean_up(const int status)
static size_t cobc_buffer_size
static void cobc_print_usage(char *prog)
static void cobc_print_warn(const char *name, const char *doc, const int wall)
int cb_config_entry(char *, const char *, const int)
static unsigned int cb_compile_level
static size_t cobc_flag_library
struct cb_text_list * cb_static_call_list
void cobc_tree_cast_error(const cb_tree x, const char *filename, const int linenum, const enum cb_tag tagnum)
void cobc_init_reserved(void)
static size_t cobc_ldflags_len
void cob_temp_name(char *filename, const char *ext)
static void cobc_chk_buff_size(const size_t bufflen)
struct cobc_mem_struct * next
static size_t cobc_pic_flags_len