]> git.ipfire.org Git - thirdparty/gcc.git/commit
cobol: Corrected FUNCTION CHAR and FUNCTION ORD.
authorRobert Dubner <rdubner@symas.com>
Thu, 23 Oct 2025 18:18:41 +0000 (14:18 -0400)
committerRobert Dubner <rdubner@symas.com>
Thu, 23 Oct 2025 18:51:16 +0000 (14:51 -0400)
commite9757133bba0ca0865d9b690b53d31483cc7ef27
tree50b51006aad37e9ce1089af12ef33e71b553c9a5
parenta4e033fb51d566019f8605d132f81bf66037b811
cobol: Corrected FUNCTION CHAR and FUNCTION ORD.

The functions CHAR and ORD have been changed to correctly report on
character positions within the collation sequence.

The use of the LOW-VALUE and HIGH-VALUE figurative constants has been
corrected.

Some establishment of DISPLAY and NATIONAL encodings has been done
in anticipation of changes soon to come.

Some new testsuite tests have been added.

gcc/cobol/ChangeLog:

* genapi.cc (parser_alphabet): Alphabet encoding.
(parser_alphabet_use): Likewise.
(parser_xml_parse): Use correct debugging macro; encoding.
(parser_xml_on_exception): Likewise.
(parser_xml_not_exception): Likewise.
(parser_xml_end): Likewise.
(initialize_the_data): Encoding.
(parser_label_label): Debugging macros.
(parser_label_goto): Likewise.
(parser_file_add): Encoding.
(parser_intrinsic_call_1): Special handling for __gg__char.
(parser_intrinsic_call_2): Formatting.
* parse.y: Response from FUNCTION ORD is flagged "unsigned".
* symbols.cc (cbl_alphabet_t::reencode): Establish
low_char & high_char.
* symbols.h (struct cbl_alphabet_t): Likewise.

libgcobol/ChangeLog:

* charmaps.cc: Encoding.
* charmaps.h (class charmap_t): Encoding.
* intrinsic.cc (__gg__char): Report the character at the
collation position.
(__gg__ord): Report the collation position of a character.
* libgcobol.cc (struct program_state): Add encodings;
Remove obsolete defines.
(__gg__current_collation): New function for encoding/collation.
(__gg__pop_program_state): Encoding.
(__gg__init_program_state): Encoding.
(format_for_display_internal): Handle LOW-VALUE and HIGH-VALUE.
(__gg__compare_2): Encoding.
(__gg__alphabet_use): Likewise.
* libgcobol.h (__gg__current_collation): New declaration.
* xmlparse.cc (__gg__xml_parse): Make a parameter const.

gcc/testsuite/ChangeLog:

* cobol.dg/group2/Length_overflow__2_.out: Updated test result.
* cobol.dg/group2/Length_overflow_with_offset__1_.out: Likewise.
* cobol.dg/group2/Offset_overflow.out: Likewise.
* cobol.dg/group2/CALL_with_OCCURS_DEPENDING_ON.cob: New test.
* cobol.dg/group2/CALL_with_OCCURS_DEPENDING_ON.out: New test.
* cobol.dg/group2/CHAR_and_ORD_with_COLLATING_sequence_-_ASCII.cob: New test.
* cobol.dg/group2/CHAR_and_ORD_with_COLLATING_sequence_-_ASCII.out: New test.
* cobol.dg/group2/CHAR_and_ORD_with_COLLATING_sequence_-_EBCDIC.cob: New test.
* cobol.dg/group2/CHAR_and_ORD_with_COLLATING_sequence_-_EBCDIC.out: New test.
* cobol.dg/group2/EC-BOUND-REF-MOD_checking_process_termination.cob: New test.
* cobol.dg/group2/EC-BOUND-REF-MOD_checking_process_termination.out: New test.
* cobol.dg/group2/Intrinsics_without_FUNCTION_keyword__3_.cob: New test.
* cobol.dg/group2/Occurs_DEPENDING_ON__source_and_dest.cob: New test.
* cobol.dg/group2/Occurs_DEPENDING_ON__source_and_dest.out: New test.
* cobol.dg/group2/Recursive_subscripts.cob: New test.
* cobol.dg/group2/Recursive_subscripts.out: New test.
* cobol.dg/group2/SEARCH_ALL_with_OCCURS_DEPENDING_ON.cob: New test.
* cobol.dg/group2/SEARCH_ALL_with_OCCURS_DEPENDING_ON.out: New test.
* cobol.dg/group2/Subscript_by_arithmetic_expression.cob: New test.
* cobol.dg/group2/Subscript_out_of_bounds__1_.cob: New test.
* cobol.dg/group2/Subscript_out_of_bounds__1_.out: New test.
* cobol.dg/group2/Subscript_out_of_bounds__2_.cob: New test.
* cobol.dg/group2/Subscript_out_of_bounds__2_.out: New test.
* cobol.dg/group2/Subscripted_refmods.cob: New test.
* cobol.dg/group2/Subscripted_refmods.out: New test.
* cobol.dg/group2/length_of_ODO_Rules_7__8A__and_8B.cob: New test.
* cobol.dg/group2/length_of_ODO_Rules_7__8A__and_8B.out: New test.
* cobol.dg/group2/length_of_ODO_w_-_reference_modification.cob: New test.
38 files changed:
gcc/cobol/genapi.cc
gcc/cobol/parse.y
gcc/cobol/symbols.cc
gcc/cobol/symbols.h
gcc/testsuite/cobol.dg/group2/CALL_with_OCCURS_DEPENDING_ON.cob [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/CALL_with_OCCURS_DEPENDING_ON.out [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/CHAR_and_ORD_with_COLLATING_sequence_-_ASCII.cob [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/CHAR_and_ORD_with_COLLATING_sequence_-_ASCII.out [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/CHAR_and_ORD_with_COLLATING_sequence_-_EBCDIC.cob [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/CHAR_and_ORD_with_COLLATING_sequence_-_EBCDIC.out [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/EC-BOUND-REF-MOD_checking_process_termination.cob [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/EC-BOUND-REF-MOD_checking_process_termination.out [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/Intrinsics_without_FUNCTION_keyword__3_.cob [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/Length_overflow__2_.out
gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__1_.out
gcc/testsuite/cobol.dg/group2/Occurs_DEPENDING_ON__source_and_dest.cob [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/Occurs_DEPENDING_ON__source_and_dest.out [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/Offset_overflow.out
gcc/testsuite/cobol.dg/group2/Recursive_subscripts.cob [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/Recursive_subscripts.out [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/SEARCH_ALL_with_OCCURS_DEPENDING_ON.cob [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/SEARCH_ALL_with_OCCURS_DEPENDING_ON.out [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/Subscript_by_arithmetic_expression.cob [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/Subscript_out_of_bounds__1_.cob [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/Subscript_out_of_bounds__1_.out [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/Subscript_out_of_bounds__2_.cob [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/Subscript_out_of_bounds__2_.out [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/Subscripted_refmods.cob [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/Subscripted_refmods.out [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/length_of_ODO_Rules_7__8A__and_8B.cob [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/length_of_ODO_Rules_7__8A__and_8B.out [new file with mode: 0644]
gcc/testsuite/cobol.dg/group2/length_of_ODO_w_-_reference_modification.cob [new file with mode: 0644]
libgcobol/charmaps.cc
libgcobol/charmaps.h
libgcobol/intrinsic.cc
libgcobol/libgcobol.cc
libgcobol/libgcobol.h
libgcobol/xmlparse.cc