Skip to content

Commit 697f6de

Browse files
author
ddeclerck
committed
Merged revisions 5287, 5289, 5296, 5302, 5304, 5314, 5406, 5412 from branches/gnucobol-3.x:
........ Improve handling of partial keys * libcob/fileio.c (indexed_start_internal): improve handling of partial keys, to ensure BDB always compares keys of identical length ........ Fix STRING/UNSTRING/INSPECT bug introduced in r5302 * libcob/string.c: fix a bug where the source of STRING/UNSTRING/INSPECT is overwritten, by restoring the *_copy fields that were removed with the change on 2024-02-26 ........ [feature-requests:#474]: add runtime configuration to hide cursor for extended screenio libcob: * common.c, coblocal.h (cob_settings): added boolean COB_HIDE_CURSOR * screenio.c (cob_settings_screenio): implemented runtime config to hide the cursor config/runtime.cfg: add COB_HIDE_CURSOR ........ increase portability for Micro Focus and ACUCOBOL-GT cobc: * parser.y, config.def: rewrite `ENVIRONMENT DIVISION` parsing to allow non-standard order of `CONFIGURATION` and `INPUT-OUTPUT` sections, depending on `incorrect-conf-sec-order` dialect setting * reserved.c: make `MENU` context-sensitive * reserved.c, parser.y: added `MODAL` + `MODELESS` to acu extension windows ........ [feature-requests:#448] using state structures instead of state vars for strings libcob * coblocal.h (COB_TLS): add a new attribute for thread local static * common.h, common.c (cob_cleanup_thread): add a cleanup function for threads * strings.c: moved static variables to structures tests: * testsuite.at, testsuite.src/backcomp.at, Makefile.am: added a new test suite to test the backward compatibility of strings functions (INSPECT, STRING, UNSTRING) ........ Allow keys of different length in the BDB backend (optional, flag-controlled) libcob: * fileio.c (bdb_bt_compare, indexed_open): handle BDB keys of different length with a flag USE_BDB_KEYDIFF (passed with preparser flag CPPFLAGS) * common.c (cob_cmp_strings), coblocal.h (cob_cmp_strings): extracted from (cob_cmp_alnum) ........ Fix for bug 934 - default ROUNDED option Fixed rounding when ROUNDED phrase is present on an ADD or SUBTRACT * numeric.c (cob_add_bcd) fixed check for default ROUNDED option to resolve bug 934 ........ Fix errors caught by the Sanitizer functionality of GCC. fix errors caught by the Sanitizer functionality of GCC. This change did not resolve all of the issues found as some of them were in Berkeley DB and some were intentional in the memory corruption logic which has been implemented in the runtime. libcob: * move.c: (cob_move_display_to_packed) function was rewritten to fix the out of bounds memory addressing issues and also to make the code simpler. * numeric.c (count_leading_zeros) was changed to fix an out of bounds memory addressing issue ........
1 parent dc2da87 commit 697f6de

26 files changed

+1223
-505
lines changed

NEWS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,16 @@ Open Plans:
107107
** support the COLLATING SEQUENCE clause on indexed files
108108
(currently only with the BDB backend)
109109

110-
** Support for time profiling of modules, sections, paragraphs, entries
110+
** support for time profiling of modules, sections, paragraphs, entries
111111
and external CALLs. This feature is activated by compiling the modules
112112
to be profiled with -fprof, and then executing the code with environment
113113
variable COB_PROF_ENABLE. The output is stored in a CSV file. Further
114114
customization can be done using COB_PROF_FILE, COB_PROF_MAX_DEPTH and
115115
COB_PROF_FORMAT
116116

117+
** new runtime configuraiton COB_HIDE_CURSOR, allows to hide the cursor during
118+
extended ScreenIO operations
119+
117120
more work in progress
118121

119122
* Important Bugfixes

cobc/ChangeLog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11

2+
2024-07-26 Simon Sobisch <simonsobisch@gnu.org>
3+
4+
* parser.y, config.def: rewrite ENVIRONMENT DIVISION parsing to allow
5+
non-standard order of CONFIGURATION and INPUT-OUTPUT sections,
6+
depending on dialect setting "incorrect-conf-sec-order"
7+
* reserved.c: make MENU context-sensitive
8+
* reserved.c, parser.y: added MODAL + MODELESS to acu extension windows
9+
210
2024-06-19 David Declerck <david.declerck@ocamlpro.com>
311

412
* cobc.c (process_compile): fix MSVC build command

cobc/codegen.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,6 +1376,9 @@ output_data (cb_tree x)
13761376
output (")->data");
13771377
}
13781378
break;
1379+
case CB_TAG_DIRECT:
1380+
output ("%s", CB_DIRECT (x)->line);
1381+
break;
13791382
/* LCOV_EXCL_START */
13801383
default:
13811384
CB_TREE_TAG_UNEXPECTED_ABORT (x);

cobc/config.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ CB_CONFIG_SUPPORT (cb_numeric_value_for_edited_item, "numeric-value-for-edited-i
400400
_("numeric literals in VALUE clause of numeric-edited items"))
401401

402402
CB_CONFIG_SUPPORT (cb_incorrect_conf_sec_order, "incorrect-conf-sec-order",
403-
_("incorrect order of CONFIGURATION SECTION paragraphs")) /* OpenCOBOL/GnuCOBOL extension */
403+
_("incorrect order of CONFIGURATION SECTION and its paragraphs")) /* MF extension */
404404

405405
CB_CONFIG_SUPPORT (cb_define_constant_directive, "define-constant-directive",
406406
_("allow >> DEFINE CONSTANT var AS literal")) /* OpenCOBOL/GnuCOBOL extension */

cobc/parser.y

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2999,7 +2999,9 @@ set_record_size (cb_tree min, cb_tree max)
29992999
%token MINUS
30003000
%token MIN_VAL "MIN-VAL"
30013001
%token MNEMONIC_NAME "Mnemonic name"
3002+
%token MODAL
30023003
%token MODE
3004+
%token MODELESS
30033005
%token MODIFY
30043006
%token MODULES
30053007
%token MOVE
@@ -4183,8 +4185,21 @@ intermediate_rounding_choice:
41834185

41844186
_environment_division:
41854187
_environment_header
4186-
_configuration_section
4187-
_input_output_section
4188+
_environment_sections
4189+
;
4190+
4191+
_environment_sections:
4192+
| configuration_section _input_output_section
4193+
| input_output_section configuration_section
4194+
{
4195+
#define MESSAGE_LEN 100
4196+
char message[MESSAGE_LEN] = { '\0' };
4197+
snprintf (message, MESSAGE_LEN, _("%s incorrectly after %s"),
4198+
"CONFIGURATION SECTION", "INPUT-OUTPUT SECTION");
4199+
cb_verify (cb_incorrect_conf_sec_order, message);
4200+
#undef MESSAGE_LEN
4201+
}
4202+
| input_output_section
41884203
;
41894204

41904205
_environment_header:
@@ -4201,13 +4216,9 @@ environment_header:
42014216

42024217
/* CONFIGURATION SECTION */
42034218

4204-
_configuration_section:
4205-
_configuration_header
4206-
_configuration_paragraphs
4207-
;
4208-
4209-
_configuration_header:
4210-
| configuration_header
4219+
configuration_section:
4220+
configuration_header _configuration_paragraphs
4221+
| configuration_paragraphs
42114222
;
42124223

42134224
configuration: CONFIGURATION { check_area_a_of ("CONFIGURATION SECTION"); };
@@ -5336,15 +5347,19 @@ top_clause:
53365347
/* INPUT-OUTPUT SECTION */
53375348

53385349
_input_output_section:
5339-
_input_output_header
5340-
_file_control_header
5341-
_file_control_sequence
5342-
_i_o_control
5350+
| input_output_section
5351+
;
5352+
5353+
input_output_section:
5354+
input_output_header _file_control_header _file_control_sequence _i_o_control
5355+
| file_control_header _file_control_sequence _i_o_control
5356+
| file_control_sequence _i_o_control
5357+
| i_o_control
53435358
;
53445359

53455360
input_output: INPUT_OUTPUT { check_area_a_of ("INPUT-OUTPUT SECTION"); };
5346-
_input_output_header:
5347-
| input_output SECTION _dot
5361+
input_output_header:
5362+
input_output SECTION _dot
53485363
{
53495364
check_headers_present (COBC_HD_ENVIRONMENT_DIVISION, 0, 0, 0);
53505365
header_check |= COBC_HD_INPUT_OUTPUT_SECTION;
@@ -5354,7 +5369,10 @@ _input_output_header:
53545369
/* FILE-CONTROL paragraph */
53555370

53565371
_file_control_header:
5357-
| FILE_CONTROL _dot
5372+
| file_control_header
5373+
;
5374+
file_control_header:
5375+
FILE_CONTROL _dot
53585376
{
53595377
check_headers_present (COBC_HD_ENVIRONMENT_DIVISION,
53605378
COBC_HD_INPUT_OUTPUT_SECTION, 0, 0);
@@ -5363,7 +5381,12 @@ _file_control_header:
53635381
;
53645382

53655383
_file_control_sequence:
5366-
| _file_control_sequence file_control_entry
5384+
| file_control_sequence
5385+
;
5386+
5387+
file_control_sequence:
5388+
file_control_entry
5389+
| file_control_sequence file_control_entry
53675390
;
53685391

53695392
file_control_entry:
@@ -6266,7 +6289,11 @@ track_limit_clause:
62666289
/* I-O-CONTROL paragraph */
62676290

62686291
_i_o_control:
6269-
| i_o_control_header _i_o_control_entries
6292+
| i_o_control
6293+
;
6294+
6295+
i_o_control:
6296+
i_o_control_header _i_o_control_entries
62706297
{
62716298
cobc_cs_check = 0;
62726299
}
@@ -13690,12 +13717,18 @@ display_window_clause:
1369013717
}
1369113718
| at_line_column
1369213719
| _top_or_bottom _left_or_centered_or_right TITLE _is_equal x
13720+
| modal_modeless
1369313721
| shadow
1369413722
| boxed
1369513723
| no_scroll_wrap
1369613724
| _with disp_attr
1369713725
;
1369813726

13727+
modal_modeless:
13728+
MODAL { /* TODO: set attribute */ }
13729+
| MODELESS
13730+
;
13731+
1369913732
shadow:
1370013733
SHADOW { /* TODO: set attribute */ }
1370113734
;

cobc/reserved.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,8 +1858,8 @@ static struct cobc_reserved default_reserved_words[] = {
18581858
{ "MEMORY", 0, 1, MEMORY, /* 85 */
18591859
0, CB_CS_OBJECT_COMPUTER
18601860
},
1861-
{ "MENU", 0, 0, MENU, /* ACU extension */
1862-
0, 0 /* Checkme: likely context sensitive */
1861+
{ "MENU", 0, 1, MENU, /* ACU extension */
1862+
0, CB_CS_GRAPHICAL_CONTROL | CB_CS_INQUIRE_MODIFY | CB_CS_USAGE /* at least for MF: undocumented C/S */
18631863
},
18641864
{ "MERGE", 0, 0, MERGE, /* 2002 */
18651865
0, 0
@@ -1885,9 +1885,15 @@ static struct cobc_reserved default_reserved_words[] = {
18851885
{ "MINUS", 0, 0, MINUS, /* 2002 */
18861886
0, 0
18871887
},
1888+
{ "MODAL", 0, 1, MODAL, /* ACU extension */
1889+
0, CB_CS_DISPLAY | CB_CS_GRAPHICAL_CONTROL
1890+
},
18881891
{ "MODE", 0, 0, MODE, /* 2002 */
18891892
0, 0
18901893
},
1894+
{ "MODELESS", 0, 1, MODELESS, /* ACU extension */
1895+
0, CB_CS_DISPLAY | CB_CS_GRAPHICAL_CONTROL
1896+
},
18911897
{ "MODIFY", 1, 0, MODIFY, /* ACU extension */
18921898
CB_CS_INQUIRE_MODIFY, 0
18931899
},

config/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
* runtime.cfg: dropped not available "varfix_format",
99
see "fixrel_format" instead; minor reformatting/rewording
1010

11+
2024-08-17 Ammar Almoris <ammaralmorsi@gmail.com>
12+
13+
FR #474: add runtime configuration to hide cursor for extended screenio
14+
* runtime.cfg: add COB_HIDE_CURSOR
15+
1116
2024-07-11 David Declerck <david.declerck@ocamlpro.com>
1217

1318
* general: fix minor alignment / tab issues

config/runtime.cfg

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,13 @@
684684
# Note: also sets the cursor type (if available)
685685
# Example: insert_mode Y
686686

687+
# Environment name: COB_HIDE_CURSOR
688+
# Parameter name: hide_cursor
689+
# Purpose: hide the cursor; 0=visible, 1=hidden
690+
# Type: boolean
691+
# Default: false
692+
# Example: hide_cursor Y
693+
687694
# Environment name: COB_MOUSE_FLAGS
688695
# Parameter name: mouse_flags
689696
# Purpose: specify which mouse events will be sent as function key

libcob/ChangeLog

Lines changed: 58 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@
1717
first, close the file descriptor only if the stream is NULL
1818
(fixes assertions under MSVC debug)
1919

20+
2024-12-20 David Declerck <david.declerck@ocamlpro.com>
21+
22+
* fileio.c (indexed_start_internal)->fbdb.c: improve handling of partial
23+
keys, to ensure BDB always compares keys of identical length
24+
25+
2024-12-18 David Declerck <david.declerck@ocamlpro.com>
26+
27+
* string.c: fix a bug where the source of STRING/UNSTRING/INSPECT
28+
is overwritten, by restoring the *_copy fields that were removed
29+
with the change on 2024-02-26
30+
2031
2024-12-11 Emilien Lemaire <emilien.lemaire@ocamlpro.com>
2132

2233
* fileio.c->fbdb.c: fixed Bug #1032 by always using global thread-static variable
@@ -27,11 +38,6 @@
2738
Reverted change 2022-02-21 to integrate change
2839
from GnuCOBOL 3.1 2023-04-04
2940

30-
2024-08-04 David Declerck <david.declerck@ocamlpro.com>
31-
32-
Adjustments to merge 2020-06-20:
33-
* common.c (cob_sys_x91): activated functions 46-49
34-
3541
2024-08-28 David Declerck <david.declerck@ocamlpro.com>
3642

3743
* intrinsics.c (cob_intr_random), move.c (cob_move_display_to_packed):
@@ -43,6 +49,18 @@
4349
* common.c (DllMain) [_MSC_VER]: added calls to _CrtSetReportMode
4450
to disable Windows error popups and redirect them to stderr
4551

52+
2024-08-17 Ammar Almorsi <ammaralmorsi@gmail.com>
53+
54+
FR #474: add runtime configuration to hide cursor for extended screenio
55+
* common.c, coblocal.h (cob_settings): added boolean COB_HIDE_CURSOR
56+
* screenio.c (cob_settings_screenio): implemented runtime config to hide
57+
the cursor
58+
59+
2024-08-04 David Declerck <david.declerck@ocamlpro.com>
60+
61+
Adjustments to merge 2020-06-20:
62+
* common.c (cob_sys_x91): activated functions 46-49
63+
4664
2024-08-04 David Declerck <david.declerck@ocamlpro.com>
4765

4866
Adjustments to merge 2022-12-21:
@@ -63,6 +81,11 @@
6381
adjusted to use cob_open_mode where possible while
6482
merging 2022-10-04
6583

84+
2024-07-19 Simon Sobisch <simonsobisch@gnu.org>
85+
86+
* coblocal.h (COB_TLS): add a new attribute for thread local static.
87+
* common.h, common.c (cob_cleanup_thread): add a cleanup function for threads
88+
6689
2024-07-12 Simon Sobisch <simonsobisch@gnu.org>
6790

6891
* numeric.c (cob_decimal_set_binar): C89 fix
@@ -74,6 +97,18 @@
7497
* move.c (indirect_move) fixed C90 warnings
7598
* profiling.c (profile_setup_clock) fixed C90 warnings
7699

100+
2024-07-09 Boris Eng <boris.eng@ocamlpro.com>
101+
102+
* fileio.c (bdb_bt_compare, indexed_open)->fbdb.c: handle BDB keys of different
103+
length with a flag USE_BDB_KEYDIFF (passed with preparser flag CPPFLAGS)
104+
* common.c (cob_cmp_strings), coblocal.h (cob_cmp_strings):
105+
extracted from (cob_cmp_alnum)
106+
107+
2024-07-02 Chuck Haatvedt <chuck.haatvedt+cobol@gmail.com>
108+
109+
* numeric.c (cob_add_bcd) fixed check for default ROUNDED option
110+
to resolve bug 934
111+
77112
2024-06-10 Chuck Haatvedt <chuck.haatvedt+cobol@gmail.com>
78113

79114
* screenio.c (cob_sys_scr_dump, cob_sys_scr_restore) added new functions
@@ -86,6 +121,19 @@
86121
* fileio.c (apply_file_paths): extracted from cob_chk_file_mapping
87122
to factor out duplicated code
88123

124+
2024-05-30 Chuck Haatvedt <chuck.haatvedt+cobol@gmail.com>
125+
126+
fix errors caught by the Sanitizer functionality of GCC. This
127+
change did not resolve all of the issues found as some of them
128+
were in Berkeley DB and some were intentional in the memory
129+
corruption logic which has been implemented in the runtime.
130+
131+
* move.c (the cob_move_display_to_packed function was rewritten to
132+
fix the out of bounds memory addressing issues and also to make
133+
the code simpler.
134+
* numeric.c (the function count_leading_zeros was changed to fix
135+
an out of bounds memory addressing issue
136+
89137
2024-05-30 Chuck Haatvedt <chuck.haatvedt+cobol@gmail.com>
90138

91139
fix errors in fileio.c when building with VISAM 2.2. This issue
@@ -144,6 +192,11 @@
144192

145193
* common.c: add missing include libxml/parser.h
146194

195+
2024-02-26 Boris Eng <boris.eng@ocamlpro.com>
196+
197+
FR #488: using state structures instead of state vars for strings
198+
* strings.c: moved static variables to structures
199+
147200
2024-01-30 Ron Norman <rjn@inglenet.com>
148201

149202
* fisam.c: Updated to set index field type for 'short' & 'int'

libcob/coblocal.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@
200200
#define COB_BEEP_VALUE cobsetptr->cob_beep_value
201201
#define COB_TIMEOUT_SCALE cobsetptr->cob_timeout_scale
202202
#define COB_INSERT_MODE cobsetptr->cob_insert_mode
203+
#define COB_HIDE_CURSOR cobsetptr->cob_hide_cursor
203204
#define COB_EXTENDED_STATUS cobsetptr->cob_extended_status
204205
#define COB_MOUSE_FLAGS cobsetptr->cob_mouse_flags
205206
#define COB_MOUSE_INTERVAL cobsetptr->cob_mouse_interval
@@ -302,10 +303,10 @@ typedef struct __cob_settings {
302303
unsigned int cob_use_esc; /* Check ESC key */
303304
unsigned int cob_timeout_scale; /* timeout scale */
304305
unsigned int cob_insert_mode; /* insert toggle, 0=off, 1=on */
306+
unsigned int cob_hide_cursor; /* hide cursor, 0=visible, 1=hidden */
305307
unsigned int cob_exit_wait; /* wait on program exit if no ACCEPT came after last DISPLAY */
306308
const char *cob_exit_msg; /* message for cob_exit_wait */
307309

308-
309310
/* reportio.c */
310311
unsigned int cob_col_just_lrc; /* Justify data in column LEFT/RIGHT/CENTER */
311312

@@ -491,6 +492,9 @@ COB_HIDDEN const char *cob_get_last_exception_name (void);
491492
COB_HIDDEN void cob_parameter_check (const char *, const int);
492493
COB_EXPIMP char* cob_get_strerror (void);
493494

495+
COB_HIDDEN int cob_cmp_strings (unsigned char*, unsigned char*,
496+
size_t, size_t, const unsigned char*);
497+
494498
enum cob_case_modifier {
495499
CCM_NONE,
496500
CCM_LOWER,

0 commit comments

Comments
 (0)