On Thu, 2025-10-23 at 10:30 -0500, Robert Dubner wrote: > Jim and I have gone through the concerns raised about POSIX part of > the > original patch. The result is that we have eliminated > gcc/cobol/posix from > this set of changes. He's going to redesign that part of it. > > Since the rest of it raised no issues here, and it's all internal > COBOL > stuff, I have committed the resulting changes to master. > > These changes result in a compiler that runs check-cobol on an Ubuntu > x86_64-linux-gnu machine. > > Thanks very much for everybody's help.
...and right after sending my other email, I see this one, and you've fixed the "posix" stuff mentioned by Richi(?); sorry. Please can you add documentation of the new libxml2 dependency to gcc/doc/install.texi (presumably the "GCOBOL-prerequisite" item). Thanks! Dave > > ============= > > From: Robert Dubner <[email protected]> > Date: Tue, 21 Oct 2025 13:33:30 -0400 > Subject: [PATCH] cobol: Implement the XML PARSE statement. > > These changes implement the XML PARSE statement as described in the > IBM > specification. > > A repair to exception handling is included. Up until now, an > exception > after a successful file operation wasn't handled properly. > > A repair to value declarations for BINARY / COMP / COMP-4 / COMP-5 > values now allows them to have digits to the right of the implied > decimal point. Processing of the "S" PICTURE character has been > normalized as well. > > Co-Authored-By: James K. Lowden <[email protected]> > Co-Authored-By: Robert Dubner <[email protected]> > > gcc/cobol/ChangeLog: > > * Make-lang.in: Incorporate new token_names.h file. > * cdf.y: Modify tokens. > * gcobol.1: Document XML PARSE statement > * genapi.cc (parser_enter_program): Verify that every goto > has a > matching label. > (parser_end_program): Likewise. > (parser_alphabet): Refine handling codeset encodings. > (parser_alphabet_use): Likewise. > (label_fetch): Moved from later in the source code. > (parser_xml_parse): New routine for XML PARSE. > (parser_xml_on_exception): Likewise. > (parser_xml_not_exception): Likewise. > (parser_xml_end): Likewise. > (parser_label_label): Verify goto/label matching. > (parser_label_goto): Likewise. > (parser_entry): Minor change to SHOW_PARSE report. > * genapi.h (parser_alphabet): Set parameter to const. > (parser_xml_parse): Declare new function. > (parser_xml_on_exception): Likewise. > (parser_xml_not_exception): Likewise. > (parser_xml_end): Likewise. > (parser_label_addr): Likewise. > * parse.y: label_pair_t structure; locale processing; new > token > processing for alphabets and XML PARSE. > * parse_ante.h (name_of): Return field->name when initial is > NULL. > (new_tempnumeric): Make signable_e optional. > (ast_save_locale): New function. > (data_division_ready): Warning for "no alphabet". > * scan.l: Repair interpretation of BINARY, COMP, COMP-4, and > COMP-5. > * scan_ante.h (struct bint_t): Likewise. > * scan_post.h (current_tokens_t::tokenset_t::tokenset_t): > Include token_names.h. > * symbols.cc (symbols_alphabet_set): Revert to prior > alphabet > determination. > (symbol_table_init): New XML special registers. > (new_temporary): Make signable_e controllable, not fixed. > * symbols.h (__gg__encoding_iconv_valid): New declaration. > (enum cbl_label_type_t): New LblXml label type. > (struct cbl_xml_parse_t): > (struct cbl_label_t): Implement XML PARSE. > (new_temporary): Incorporate boolean for signable_e. > (symbol_elem_of): Change label field type handling. > (cbl_section_of): Likewise. > (cbl_field_of): Likewise. > (cbl_label_of): Likewise. > (cbl_special_name_of): Likewise. > (cbl_alphabet_of): Likewise. > (cbl_file_of): Likewise. > * token_names.h: New file. > * util.cc (gcc_location_set_impl): Improve location_t > calculations > when entering and leaving COPYBOOKs. > > libgcobol/ChangeLog: > > * Makefile.am: Changes for XML PARSE and POSIX functions. > * Makefile.in: Likewise. > * charmaps.cc: Augment encodings[] table with "supported" > boolean. > (__gg__encoding_iconv_name): Modify how encodings are > identified. > (encoding_descr): Likewise. > (__gg__encoding_iconv_valid): Likewise. > * common-defs.h (callback_t): Define function pointer. > * constants.cc: Use named cbl_attr_e constants instead of > magic > numbers.; New definitions for XML special registers. > * encodings.h (struct encodings_t): Declare "supported" > boolean. > * libgcobol.cc (format_for_display_internal): Use > std::ptrdiff_t. > (__gg__alphabet_use): Add case for iconv_CP1252_e. > (default_exception_handler): Repair exception handling after > a > successful file operation. > * posix/errno.cc: New file. > * posix/localtime.cc: New file. > * posix/stat.cc: New file. > * posix/stat.h: New file. > * posix/tm.h: New file. > * xmlparse.cc: New file to support XML PARSE statement. > > gcc/testsuite/ChangeLog: > > * cobol.dg/typo-1.cob: New test for squiggles and carets. > --- > gcc/cobol/Make-lang.in | 10 + > gcc/cobol/cdf.y | 16 +- > gcc/cobol/gcobol.1 | 36 + > gcc/cobol/genapi.cc | 233 ++- > gcc/cobol/genapi.h | 17 +- > gcc/cobol/parse.y | 413 +++-- > gcc/cobol/parse_ante.h | 30 +- > gcc/cobol/scan.l | 7 +- > gcc/cobol/scan_ante.h | 57 +- > gcc/cobol/scan_post.h | 9 + > gcc/cobol/symbols.cc | 76 +- > gcc/cobol/symbols.h | 55 +- > gcc/cobol/token_names.h | 660 ++++---- > gcc/cobol/util.cc | 41 +- > gcc/testsuite/cobol.dg/typo-1.cob | 15 + > libgcobol/Makefile.am | 17 +- > libgcobol/Makefile.in | 60 +- > libgcobol/charmaps.cc | 2378 +++++++++++++++------------ > -- > libgcobol/common-defs.h | 6 + > libgcobol/constants.cc | 201 ++- > libgcobol/encodings.h | 1 + > libgcobol/libgcobol.cc | 6 +- > libgcobol/posix/errno.cc | 7 + > libgcobol/posix/localtime.cc | 34 + > libgcobol/posix/stat.cc | 90 ++ > libgcobol/posix/stat.h | 15 + > libgcobol/posix/tm.h | 11 + > libgcobol/xmlparse.cc | 594 +++++++ > 28 files changed, 3346 insertions(+), 1749 deletions(-) > create mode 100644 gcc/testsuite/cobol.dg/typo-1.cob > create mode 100644 libgcobol/posix/errno.cc > create mode 100644 libgcobol/posix/localtime.cc > create mode 100644 libgcobol/posix/stat.cc > create mode 100644 libgcobol/posix/stat.h > create mode 100644 libgcobol/posix/tm.h > create mode 100644 libgcobol/xmlparse.cc >
