Skip to content

Commit

Permalink
Merge SVN 3961
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed May 31, 2024
1 parent 9667275 commit 18626fb
Show file tree
Hide file tree
Showing 11 changed files with 236 additions and 100 deletions.
27 changes: 24 additions & 3 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,19 @@
'memcpy' to speed up the process
If size is not known until run time then emit call to cob_init_table

2020-11-20 Simon Sobisch <[email protected]>

* pplex.l (ppinput): fixed processing after "line not terminated"

2020-11-19 Simon Sobisch <[email protected]>

FR #53 TURN directive and -fno-ec=NAME/-fec=NAME - finish
* cobc.c (turn_ec_for_table): correct handling for EC-ALL
* cobc.c (cobc_turn_ec): handling EC-USER as PENDING
* cobc.c (process_command_line), cobc.h: handle -debug before all the
flags and exception options it sets, allowing to remove its internal
explicit_set flag

2020-11-18 Ron Norman <[email protected]>

* codegen.c,typeck.c: Generated code for INITIALIZE computes the actual
Expand Down Expand Up @@ -1334,6 +1347,13 @@
* cobc.c (compare_prepare): fixed bug #569: stop copying into cmp_line
when line length exceeds CB_LINE_LENGTH.

2020-06-30 Simon Sobisch <[email protected]>

FR #53 TURN directive - finished command line variant as -fno-ec/-fec
* cobc.c, flag.def, help.c: renamed -fdisable-ec/-fenable-ec
* cobc.c: removed the need to use EC- prefix in the name for -f[no-]ec
* flag.def, help.c: fixed some help output

2020-06-30 Edward Hart <[email protected]>

* typeck.c (validate_move): refactored.
Expand Down Expand Up @@ -1381,14 +1401,15 @@
2020-06-23 Edward Hart <[email protected]>

FR #53 TURN directive
* cobc.c, cobc.h: completed initial implementation on disabling ECs.
* cobc.c, cobc.h: completed initial implementation on disabling ECs
on command line with -fdisable-ec=NAME -fenable-ec=NAME
* cobc.c, cobc.h, parser.y, ppparse.y, scanner.l: completed initial
implementation of >>TURN.
implementation of >>TURN

2020-06-22 Simon Sobisch <[email protected]>

* cobc.c, cobc.h, flag.def, ppparse.y: draft work on >>TURN and
disabling exceptions (FR #53).
disabling exceptions (FR #53)

2020-06-22 Simon Sobisch <[email protected]>

Expand Down
76 changes: 35 additions & 41 deletions cobc/cobc.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,6 @@ struct list_files *cb_current_file = NULL;
struct cob_time current_compile_time = { 0 };
struct tm current_compile_tm = { 0 };

#if 0 /* RXWRXW - source format */
char *source_name = NULL;
#endif

enum cb_format cb_source_format = CB_FORMAT_FIXED;
#if 0 /* ancient OSVS registers that need special runtime handling - low priority */
enum cb_current_date current_date = CB_DATE_MDY;
Expand Down Expand Up @@ -1517,32 +1513,25 @@ turn_ec_for_table (struct cb_exception *table, const size_t table_len,
{
size_t i;

if (ec.code & 0x00FF) {
/* Set individual level-1 EC */
if (ec.code == CB_EXCEPTION_CODE (COB_EC_ALL)) {
/* EC-ALL - level-1 EC to set all ECs */
for (i = 0; i < table_len; ++i) {
if (table[i].code == ec.code) {
table[i].enable = to_on_off;
table[i].explicit_enable_val = 1;
break;
}
table[i].enable = to_on_off;
}
} else if (ec.code != 0) {
/*
Simon: ToDo: Group activation; check occurences of
EC-generation
*/
} else if ((ec.code & 0x00FF) == 0) {
/* Set all ECs subordinate to level-2 EC */
for (i = 0; i < table_len; ++i) {
if ((table[i].code & 0xFF00) == ec.code) {
table[i].enable = to_on_off;
table[i].explicit_enable_val = 1;
}
}
} else {
/* EC-ALL; set all ECs */
/* Set individual level-3 EC */
for (i = 0; i < table_len; ++i) {
table[i].enable = to_on_off;
table[i].explicit_enable_val = 1;
if (table[i].code == ec.code) {
table[i].enable = to_on_off;
break;
}
}
}
}
Expand Down Expand Up @@ -1615,11 +1604,6 @@ ec_duped (struct cb_text_list *ec_list, struct cb_text_list *ec,
return 0;
}

/*
Simon: ToDo: Move save/restore of activated exceptions before
preparse; after C generation A dynamic save (only if changed)
and restore (only if set) would be nice
*/
unsigned int
cobc_turn_ec (struct cb_text_list *ec_list, const cob_u32_t to_on_off, cb_tree loc)
{
Expand All @@ -1638,6 +1622,15 @@ cobc_turn_ec (struct cb_text_list *ec_list, const cob_u32_t to_on_off, cb_tree l
for (i = 0; i < len; ++i) {
upme[i] = cb_toupper (upme[i]);
}

/* User specified exception (always nonfatal, compared by name) */
if (!strncmp (ec->text, "EC-USER", 7)) {
/* TODO: EC-USER[NAME] not supported yet, maybe addd as table
of strings or hash into the generated program */
CB_PENDING ("EC-USER");
return 1;
}

/* extract exception code via text comparison */
ec_idx = 0;
for (i = (enum cob_exception_id)1; i < COB_EC_MAX; ++i) {
Expand All @@ -1648,7 +1641,6 @@ cobc_turn_ec (struct cb_text_list *ec_list, const cob_u32_t to_on_off, cb_tree l
}

/* Error if not a known exception name */
/* TO-DO: What about EC-USER? */
if (ec_idx == 0) {
cb_error_x (loc, _("invalid exception-name: %s"),
ec->text);
Expand All @@ -1659,7 +1651,7 @@ cobc_turn_ec (struct cb_text_list *ec_list, const cob_u32_t to_on_off, cb_tree l
return 1;
}

if (!strncmp(CB_EXCEPTION_NAME(ec_idx), "EC-I-O", 6)) {
if (!strncmp (CB_EXCEPTION_NAME(ec_idx), "EC-I-O", 6)) {
if (turn_ec_io (cb_exception_table[ec_idx], to_on_off,
loc, &ec)) {
return 1;
Expand Down Expand Up @@ -2874,7 +2866,8 @@ process_command_line (const int argc, char **argv)
}
#endif

/* First run of getopt: handle std/conf and all listing options
/* First run of getopt: handle std/conf and all listing options, along
with grouping options that should not override other entries (as --debug)
We need to postpone single configuration flags as we need
a full configuration to be loaded before */
cob_optind = 1;
Expand Down Expand Up @@ -3106,6 +3099,13 @@ process_command_line (const int argc, char **argv)
cobc_early_exit (EXIT_FAILURE);
}

/* debug: Turn on all exception conditions */
if (cobc_wants_debug) {
for (i = (enum cob_exception_id)1; i < COB_EC_MAX; ++i) {
CB_EXCEPTION_ENABLE (i) = 1;
}
}

/* dump implies extra information (may still be disabled later) */
if (cb_flag_dump != COB_DUMP_NONE) {
cb_flag_source_location = 1;
Expand Down Expand Up @@ -3837,6 +3837,13 @@ process_command_line (const int argc, char **argv)
cobc_main_free (output_name_buff);
}

/* debug: Turn on all exception conditions
-> drop note about this after hanling exit_option and general problems */
if (cobc_wants_debug && verbose_output > 1) {
fputs (_ ("all runtime checks are enabled"), stderr);
fputc ('\n', stderr);
}

/* Set relaxed syntax configuration options if requested */
/* part 1: relaxed syntax compiler configuration option */
if (cb_relaxed_syntax_checks) {
Expand Down Expand Up @@ -3941,19 +3948,6 @@ process_command_line (const int argc, char **argv)
}
#endif

/* debug: Turn on all exception conditions */
if (cobc_wants_debug) {
for (i = (enum cob_exception_id)1; i < COB_EC_MAX; ++i) {
if (!CB_EXCEPTION_EXPLICIT (i)) {
CB_EXCEPTION_ENABLE (i) = 1;
}
}
if (verbose_output > 1) {
fputs (_("all runtime checks are enabled"), stderr);
fputc ('\n', stderr);
}
}

/* If C debug, do not strip output */
if (cb_source_debugging) {
strip_output = 0;
Expand Down
14 changes: 8 additions & 6 deletions cobc/pplex.l
Original file line number Diff line number Diff line change
Expand Up @@ -1746,20 +1746,22 @@ start:
if (cb_source_format == CB_FORMAT_FREE) {
if (line_overflow == 0) {
cb_plex_warning (cb_missing_newline, newline_count + 1,
_("line not terminated by a newline"));
_("line not terminated by a newline"));
n++;
} else if (line_overflow == 2) {
cb_plex_warning (COBC_WARN_FILLER, newline_count + 1,
_("source text exceeds %d bytes, will be truncated"),
PPLEX_BUFF_LEN);
_("source text exceeds %d bytes, will be truncated"),
PPLEX_BUFF_LEN);
}
} else {
if (line_overflow == 0) {
cb_plex_warning (cb_missing_newline, newline_count,
_("line not terminated by a newline"));
_("line not terminated by a newline"));
n++;
} else if (line_overflow == 2) {
cb_plex_warning (COBC_WARN_FILLER, newline_count,
_("source text exceeds %d bytes, will be truncated"),
PPLEX_BUFF_LEN);
_("source text exceeds %d bytes, will be truncated"),
PPLEX_BUFF_LEN);
}
}
buff[n++] = '\n';
Expand Down
5 changes: 5 additions & 0 deletions libcob/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,11 @@
* fextfh.c (copy_file_to_fcd): use cob_cache_malloc instead of cob_strdup
* fsqlxfd.c: if count_components > 1 then its a composite key

2020-11-20 Simon Sobisch <[email protected]>

* common.c (cob_stack_trace_internal): early exit if no data available
* common.c (cob_check_version): test for minimal version 2.2

2020-11-18 Simon Sobisch <[email protected]>

* common.c (cob_init): skip initialization again if already done as
Expand Down
20 changes: 15 additions & 5 deletions libcob/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -3520,9 +3520,7 @@ cob_check_version (const char *prog,
app.point = 0;
lib.major = 9;
lib.minor = 9;
lib.point = 9;

/* note: to be tested with direct C call */
lib.point = 0;

nparts = sscanf (PACKAGE_VERSION, "%d.%d.%d",
&lib.major, &lib.minor, &lib.point);
Expand All @@ -3536,8 +3534,12 @@ cob_check_version (const char *prog,
if (app.version == lib.version
&& patchlev_prog <= PATCH_LEVEL)
return;
if (app.version < lib.version)
return;
if (app.version < lib.version) {
struct ver_t minimal = { 4, 0 };
if (app.version >= version_bitstring (minimal)) {
return;
}
}
}

/* TODO: when CALLed - raise exception so program can go ON EXCEPTION */
Expand Down Expand Up @@ -10015,6 +10017,14 @@ cob_stack_trace (void *target)
static void
flush_target (FILE *target)
{
/* exit early in the case of no module loaded at all,
possible to happen for example when aborted from cob_check_version of first module */
if (!COB_MODULE_PTR
|| ( COB_MODULE_PTR->module_stmt == 0
&& COB_MODULE_PTR->next == NULL)) {
return;
}

if (target == stderr
|| target == stdout) {
fflush (stdout);
Expand Down
3 changes: 1 addition & 2 deletions tests/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,9 @@

2020-11-20 Simon Sobisch <[email protected]>

* general: pass AWK, GREP, SED to the testsuite
* general: pass AWK, GREP, SED to the testsuite and use those
* atlocal.in, atlocal_valgrind, atlocal_win:
remove temporary file info.out after use
* listings-sed.sh: replace both 2 and 3-part version numbers

2020-11-12 Simon Sobisch <[email protected]>

Expand Down
22 changes: 11 additions & 11 deletions tests/testsuite.src/configuration.at
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,9 @@ AT_CHECK([$COBCRUN --runtime-conf], [0], ignore, [])
# use tr to remove newlines and spaces as the path likely is split
# into two lines
AT_CHECK([$COBCRUN --runtime-conf | tr -d '\n ' | \
grep "runtime_empty.cfg"], [0], ignore, [])
$GREP "runtime_empty.cfg"], [0], ignore, [])
AT_CHECK([COB_RUNTIME_CONFIG="" $COBCRUN --runtime-conf | tr -d '\n ' \
| grep "runtime.cfg"],
| $GREP "runtime.cfg"],
[0], ignore, [])

AT_CLEANUP
Expand All @@ -577,23 +577,23 @@ setenv COB_PHYSICAL_CANCEL=true

# verify that default for physical cancel is still "no"
AT_CHECK([$COBCRUN --runtime-conf | \
grep "COB_PHYSICAL_CANCEL" | grep "no" | grep "default"], [0], ignore, [])
$GREP "COB_PHYSICAL_CANCEL" | $GREP "no" | $GREP "default"], [0], ignore, [])

# verify that override via -c works and if include works
AT_CHECK([$COBCRUN -c test2.cfg --runtime-conf | \
grep "physical_cancel" | grep "yes"], [0], ignore, [])
$GREP "physical_cancel" | $GREP "yes"], [0], ignore, [])
AT_CHECK([$COBCRUN -c test.cfg --runtime-conf | \
grep "physical_cancel" | grep "yes"], [0], ignore, [])
$GREP "physical_cancel" | $GREP "yes"], [0], ignore, [])
AT_CHECK([$COBCRUN -c test3.cfg --runtime-conf | \
grep "COB_PHYSICAL_CANCEL" | grep "yes"], [0], ignore, [])
$GREP "COB_PHYSICAL_CANCEL" | $GREP "yes"], [0], ignore, [])

# verify that that long option works
AT_CHECK([$COBCRUN --config=test3.cfg --runtime-conf | \
grep "COB_PHYSICAL_CANCEL" | grep "yes"], [0], ignore, [])
$GREP "COB_PHYSICAL_CANCEL" | $GREP "yes"], [0], ignore, [])

# verify that that environment setting works
AT_CHECK([COB_RUNTIME_CONFIG=test3.cfg $COBCRUN --runtime-conf | \
grep "COB_PHYSICAL_CANCEL" | grep "yes"], [0], ignore, [])
$GREP "COB_PHYSICAL_CANCEL" | $GREP "yes"], [0], ignore, [])

# verify that configuration file loading with full path works
AT_CHECK([$COBCRUN -c "$(_return_path "$(pwd)/test.cfg")" --runtime-conf],
Expand Down Expand Up @@ -639,7 +639,7 @@ physical_cancel true
])

AT_CHECK([COB_PHYSICAL_CANCEL=false $COBCRUN -c test.cfg --runtime-conf | \
grep "COB_PHYSICAL_CANCEL" | grep "no"], [0], ignore, [])
$GREP "COB_PHYSICAL_CANCEL" | $GREP "no"], [0], ignore, [])

AT_CLEANUP

Expand Down Expand Up @@ -774,9 +774,9 @@ AT_CHECK([unset greet name ; \
TESTME="this is a test" \
COB_EXIT_MSG='${greet:Bye} ${name:-user}, ${TESTME}' \
$COBCRUN --runtime-conf | \
grep "COB_EXIT_MSG" | grep "Bye user, this is a test"], [0], ignore, [])
$GREP "COB_EXIT_MSG" | $GREP "Bye user, this is a test"], [0], ignore, [])
AT_CHECK([$COBCRUN --runtime-conf | \
grep "COB_EXIT_MSG" | grep "end of program, please press a key to exit"], [0], ignore, [])
$GREP "COB_EXIT_MSG" | $GREP "end of program, please press a key to exit"], [0], ignore, [])

AT_CLEANUP

Expand Down
Loading

0 comments on commit 18626fb

Please sign in to comment.