This bumps the libgcobol SONAME for GCC 16 since compared to GCC 15
there are removed symbols and key data structures have changed.
PR cobol/122803
libgcobol/
* configure.ac (LIBGCOBOL_VERSION): Bump to 2:0:0.
* configure: Re-generate.
Update lagging libgcobol/Makefile.am to match libgcobol/Makefile.in.
libgcobol/ChangeLog:
PR cobol/122702
* Makefile.am: Include posix/udf/posix-open.cbl.
Set libgcobol/Makefile.am to define libdir and libsubdir the way libada does.
Reorganize libgcobol/compat directory to group by emulation, not component.
Move orphan gcc/udf/stored-char-length.cbl to the compat directory.
Introduce new POSIX bindings.
gcc/cobol/ChangeLog:
PR cobol/122702
* Make-lang.in: Move stored-char-length.cbl to libgcobol.
libgcobol/ChangeLog:
PR cobol/122702
* Makefile.am: Set libdir and libsubdir per libada example.
* Makefile.in: Regenerate.
* compat/README.md: Revise per new directory structure.
* compat/gnu/lib/CBL_ALLOC_MEM.cbl: Moved from compat/lib/gnu.
* compat/gnu/lib/CBL_CHECK_FILE_EXIST.cbl: Moved from compat/lib/gnu.
* compat/gnu/lib/CBL_DELETE_FILE.cbl: Moved from compat/lib/gnu.
* compat/gnu/lib/CBL_FREE_MEM.cbl: Moved from compat/lib/gnu.
* compat/gnu/udf/stored-char-length.cbl: New file.
* compat/lib/gnu/CBL_ALLOC_MEM.cbl: Moved to compat/gnu/lib.
* compat/lib/gnu/CBL_CHECK_FILE_EXIST.cbl: Moved to compat/gnu/lib.
* compat/lib/gnu/CBL_DELETE_FILE.cbl: Moved to compat/gnu/lib.
* compat/lib/gnu/CBL_FREE_MEM.cbl: Moved to compat/gnu/lib.
* posix/cpy/psx-open.cpy: New file.
* posix/shim/open.cc: New file.
* posix/shim/stat.h: Add mode & flag bits for open.cc
* posix/udf/posix-lseek.cbl: New file.
* posix/udf/posix-open.cbl: New file.
* posix/udf/posix-read.cbl: New file.
* posix/udf/posix-write.cbl: New file.
* xmlparse.cc: Quell context_t initialization-order warning.
Install COBOL UDFs in a target directory that includes the GCC version
in its path, to permit side-by-side installation. Support compat
library with COBOL POSIX bindings; support those binding with C
functions in libgcobol as needed.
Changes to the compiler to support POSIX binding and testing.
Include developer conveniences -- Makefiles, bin/ and t/ directories --
to ensure UDFs compile and return reasonable results. These are
not installed and do not affect how libgcobol is built.
gcc/cobol/ChangeLog:
* cdf.y: Install literals in symbol table.
* genapi.cc (parser_alphabet): Use std::string for currency.
(initialize_the_data): Rely on constructor.
(parser_file_add): Better #pragma message.
(parser_exception_file): Return early if not generating code.
* parse.y: Allow library programs to act as functions.
* parse_ante.h (dialect_proscribed): Standardize message.
(intrinsic_call_2): Correct s/fund/func/ misspelling.
* scan.l: Comment.
* symbols.cc (symbols_update): Add unreachable assertion.
(symbol_field_parent_set): Reduce error to debug message.
(cdf_literalize): Declare.
(symbol_table_init): Insert CDF constants as literals.
* symbols.h (cbl_dialect_str): Provide string values for enum.
(is_working_storage): Remove function.
(struct cbl_field_data_t): Add manhandle_initial for Numeric Edited.
(struct cbl_field_t): Initialize name to zeros.
(struct cbl_section_t): Delete unused attr() function.
(symbol_unique_index): Declare.
* token_names.h: Regenerate.
* util.cc (cdf_literalize): Construct a cbl_field_t from a CDF literal.
(symbol_unique_index): Supply "globally" unique number for a program.
libgcobol/ChangeLog:
* Makefile.am: Move UDF-support to posix/shim, add install targets
* Makefile.in: Regenerate
* charmaps.cc (__gg__currency_signs): Use std::string.
* charmaps.h: Include string and vector headers.
(class charmap_t): Use std::string and vector for currency.
* config.h.in: Regenerate.
* configure: Regenerate.
* configure.ac: Check for libxml2.
* intrinsic.cc (numval_c): Constify.
* libgcobol.cc (struct program_state): Use std::string and vector.
(__gg__inspect_format_2): Add debug messages.
* libgcobol.h (__gg__get_default_currency_string): Constify.
* valconv.cc (expand_picture): Use std::string and vector.
(__gg__string_to_numeric_edited): Use std::string and vector.
(__gg__currency_sign_init): Use std::string and vector.
(__gg__currency_sign): Use std::string and vector.
* xmlparse.cc (xml_push_parse): Reformat.
* posix/stat.cc: Removed.
* posix/stat.h: Removed.
* .gitignore: New file.
* compat/README.md: New file.
* compat/lib/gnu/CBL_ALLOC_MEM.cbl: New file.
* compat/lib/gnu/CBL_CHECK_FILE_EXIST.cbl: New file.
* compat/lib/gnu/CBL_DELETE_FILE.cbl: New file.
* compat/lib/gnu/CBL_FREE_MEM.cbl: New file.
* compat/t/Makefile: New file.
* compat/t/smoke.cbl: New file.
* posix/README.md: New file.
* posix/bin/Makefile: New file for UDF-developer.
* posix/bin/headers: New file.
* posix/bin/scrape.awk: New file.
* posix/bin/sizeofs.c: New file.
* posix/bin/udf-gen: New file.
* posix/cpy/posix-errno.cbl: New file.
* posix/cpy/statbuf.cpy: New file.
* posix/cpy/tm.cpy: New file.
* posix/errno.cc: Removed.
* posix/localtime.cc: Removed.
* posix/shim/stat.cc: New file.
* posix/shim/stat.h: New file.
* posix/t/Makefile: New file.
* posix/t/errno.cbl: New file.
* posix/t/exit.cbl: New file.
* posix/t/localtime.cbl: New file.
* posix/t/stat.cbl: New file.
* posix/tm.h: Removed.
* posix/udf/posix-exit.cbl: New file.
* posix/udf/posix-localtime.cbl: New file.
* posix/udf/posix-mkdir.cbl: New file.
* posix/udf/posix-stat.cbl: New file.
* posix/udf/posix-unlink.cbl: New file.
We expanded our extended testing regime to execute many testcases in
EBCDIC mode as well as in ASCII. This exposed hundreds of problems in
both compilation (where conversions must be made between the ASCII
source code and the EBCDIC execution environment) and in run-time
functionality, where results from calls to system routines and internal
calculations that must be done in ASCII have to be converted to EBCDIC.
These changes also switch to using FIXED_WIDE_INT(128) instead of
REAL_VALUE_TYPE when initializing fixed-point COBOL variable types.
This provides for accurate initialization up to 37 digits, instead of
losing accuracy after 33 digits.
These changes also support the implementation of the COBOL DELETE FILE
(Format 2) statement.
These changes also introduce expanded support for specifying character
encodings, including support for locales.
co-authored-by: Robert Dubner <rdubner@symas.com>
co-authored-by: James K. Lowden <jklowden@cobolworx.com>
gcc/cobol/ChangeLog:
* Make-lang.in: Repair documentation generation.
* cdf.y: Changes to tokens.
* cobol1.cc (cobol_langhook_handle_option): Add comment.
* genapi.cc (function_pointer_from_name): Use data.original() for
function name.
(parser_initialize_programs): Likewise.
(cobol_compare): Make sure encodings of comparands are the same.
(move_tree): Change name of DEFAULT_SOURCE_ENCODING macro.
(parser_enter_program): Typo.
(psa_FldLiteralN): Break out dirty_to_binary() support routine.
(dirty_to_binary): Likewise.
(parser_alphabet): Rename 'alphabet' to 'collation_sequence'.
(parser_allocate): Change wsclear() to be uint32_t instead of char.
(parser_label_label): Formatting.
(parser_label_goto): Likewise.
(get_the_filename): Breakout get_the_filename(), which handles
encoding.
(parser_file_open): Likewise.
(set_up_delete_file_label): Implement DELETE FILE (Format 2).
(parser_file_delete_file): Likewise.
(parser_file_delete_on_exception): Likewise.
(parser_file_delete_not_exception): Likewise.
(parser_file_delete_end): Likewise.
(parser_call): Use data.original().
(parser_entry): Use data.original().
(mh_source_is_literalN): Convert from
sourceref.field->codeset.encoding.
(binary_initial_from_float128): Change to "binary_initial".
(binary_initial): Calculate in FIXED_WIDE_INT(128) instead of
REAL_VALUE_TYPE.
(digits_from_int128): New routine uses binary_initial.
(digits_from_float128): Removed. Kept as comment for reference.
(initial_from_initial): Use binary_initial.
(actually_create_the_static_field): Use correct encoding.
(parser_symbol_add): Likewise.
* genapi.h (parser_file_delete_file): Implement FILE DELETE.
(parser_file_delete_on_exception): Implement FILE DELETE.
(parser_file_delete_not_exception): Implement FILE DELETE.
(parser_file_delete_end): Implement FILE DELETE.
* genmath.cc: Include charmaps.h.
* genutil.cc (get_literal_string): Change name of
DEFAULT_SOURCE_ENCODING macro.
* parse.y: Token changes; numerous changes in support of encoding;
support for DELETE FILE.
* parse_ante.h (name_of): Use data.original().
(class prog_descr_t): Support of locales.
(current_options): Formatting.
(current_encoding): Formatting.
(current_program_index): Formatting.
(current_section): Formatting.
(current_paragraph): Formatting.
(is_integer_literal): Use correct encoding.
(value_encoding_check): Handle encoding changes.
(alphabet_add): Likewise.
(data_division_ready): Likewise.
* scan.l: Use data.original().
* show_parse.h: Use correct encoding.
* symbols.cc (elementize): Likewise.
(symbol_elem_cmp): Handle locale.
(struct symbol_elem_t): Likewise.
(symbol_locale): Likewise.
(field_str): Change DEFAULT_SOURCE_ENCODING macro name.
(symbols_alphabet_set): Formatting.
(symbols_update): Modify consistency checks.
(symbol_locale_add): Locale support.
(cbl_locale_t::cbl_locale_t): Locale support.
(cbl_alphabet_t::cbl_alphabet_t): New structure.
(cbl_alphabet_t::reencode): Formatting.
(cbl_alphabet_t::assign): Change name of collation_sequence.
(cbl_alphabet_t::also): Likewise.
(new_literal_add): Anticipate the need for four-byte characters.
(guess_encoding): Eliminate.
(cbl_field_t::internalize): Refine conversion of data.initial to
specified encoding.
* symbols.h (enum symbol_type_t): Add SymLocale.
(struct cbl_field_data_t): Incorporate data.orig.
(struct cbl_field_t): Likewise.
(struct cbl_delete_file_t): New structure.
(struct cbl_label_t): Incorporate cbl_delete_file_t.
(struct cbl_locale_t): Support for locale.
(hex_decode): Comment.
(struct cbl_alphabet_t): Incorporate locale; change variable name
to collation_sequence.
(struct symbol_elem_t): Incorporate locale.
(cbl_locale_of): Likewise.
(cbl_alphabet_of): Likewise.
(symbol_locale_add): Likewise.
(wsclear): Type is now uint32_t instead of char.
* util.cc (symbol_type_str): Incorporate locale.
(cbl_field_t::report_invalid_initial_value): Change test so that
pure PIC A() variables are limited to [a-zA-Z] and space.
(valid_move): Use DEFAULT_SOURCE_ENCODING macro.
(cobol_filename): Formatting.
libgcobol/ChangeLog:
* charmaps.cc (__gg__encoding_iconv_type): Eliminate trailing
'/' characters from encoding names.
(__gg__get_charmap): Switch to DEFAULT_SOURCE_ENCODING macro name.
* charmaps.h (DEFAULT_CHARMAP_SOURCE): Likewise.
(DEFAULT_SOURCE_ENCODING): Likewise.
(class charmap_t): Enhance constructor.
* encodings.h (valid_encoding): New routine.
* gcobolio.h (enum cblc_file_prior_op_t): Support DELETE FILE.
* gfileio.cc (get_filename): Likewise.
(__io__file_remove): Likewise.
(__gg__file_reopen): Likewise.
(__io__file_open): Likewise.
(gcobol_fileops): Likewise.
(__gg__file_delete): Likewise.
(__gg__file_remove): Likewise.
* intrinsic.cc (get_all_time): Switch to DEFAULT_SOURCE_ENCODING
macro name.
(ftime_replace): Support ASCII/EBCDIC encoding.
(__gg__current_date): Likewise.
(__gg__max): Likewise.
(__gg__lower_case): Likewise.
(numval): Likewise.
(numval_c): Likewise.
(__gg__upper_case): Likewise.
(__gg__when_compiled): Likewise.
(gets_int): Likewise.
(gets_nanoseconds): Likewise.
(fill_cobol_tm): Likewise.
(floating_format_tester): Likewise.
(__gg__numval_f): Likewise.
(__gg__test_numval_f): Likewise.
(iscasematch): Likewise.
(strcasestr): Likewise.
(strcaselaststr): Likewise.
(__gg__substitute): Likewise.
(__gg__locale_compare): Support for locale.
(__gg__locale_date): Likewise.
(__gg__locale_time): Likewise.
(__gg__locale_time_from_seconds): Likewise.
* libgcobol.cc (class ec_status_t): Support for encoding.
(int128_to_field): Likewise.
(__gg__dirty_to_float): Likewise.
(format_for_display_internal): Likewise.
(get_float128): Likewise.
(compare_field_class): Likewise.
(__gg__compare_2): Likewise.
(init_var_both): Likewise.
(__gg__move): Likewise.
(display_both): Likewise.
(is_numeric_display_numeric): Likewise.
(accept_envar): Likewise.
(__gg__get_argv): Likewise.
(__gg__unstring): Likewise.
(__gg__check_fatal_exception): Likewise.
(__gg__adjust_encoding): Likewise.
(__gg__func_exception_location): Likewise.
(__gg__func_exception_statement): Likewise.
(__gg__func_exception_status): Likewise.
(__gg__func_exception_file): Likewise.
(__gg__just_mangle_name): Likewise.
(__gg__function_handle_from_name): Likewise.
(get_the_byte): Likewise.
(__gg__module_name): Likewise.
(__gg__accept_arg_value): Likewise.
* xmlparse.cc (fatalError): Formatting.
(setDocumentLocator): Formatting.
(xmlchar_of): Formatting.
(xmlParserErrors_str): Formatting.
Followup to r16-4668-g374ec67294fc4f. I'd assumed the build got past
this point but it turned out it hadn't.
libgcobol/ChangeLog:
PR cobol/122451
* xmlparse.cc (context_t): Make 'ctxt' public.
(xml_push_parse): Fix xmlCtxtGetVersion argument.
Annotate unused parameters. Do not compile some functions that might
not be needed. Consistent with libgcobol, log errors via syslog(3).
Introduce push-parser as experiment.
libgcobol/ChangeLog: Correct warnings and errors in xmlparse.cc.
* xmlparse.cc (CTX): Macro for unused user-context parameter.
(attributeDecl): Mark unused parameters.
(cdataBlock): Same.
(characters): Same.
(comment): Same.
(elementDecl): Same.
(endDocument): Same.
(endElementNs): Same.
(endElement): Same.
(entityDecl): Same.
(error): Same.
(externalSubset): Same.
(fatalError): Same.
(getEntity): Eliminate via preprocessor until needed.
(getParameterEntity): Same.
(hasExternalSubset): Mark unused parameters.
(hasInternalSubset): Same.
(ignorableWhitespace): Same.
(internalSubset): Same.
(isStandalone): Eliminate via preprocessor until needed.
(notationDecl): Mark unused parameters.
(processingInstruction): Same.
(reference): Same.
(resolveEntity): Eliminate via preprocessor until needed.
(setDocumentLocator): Mark unused parameters.
(startDocument): Same.
(startElementNs): Same.
(startElement): Same.
(unparsedEntityDecl): Same.
(warning): Same.
(xmlchar_of): Utility cast function.
(xmlParserErrors_str): Message string for libxml2 errors.
(xmlerror_str): Macro to include textual form of libxml2 error.
(context_t): Push-parser context class.
(xml_push_parse): Use push-parser.
(__gg__xml_parse_done): Signify end-of-input to XML push-parser.
(__gg__xml_parse): Mark unused parameters.
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.
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 <jklowden@cobolworx.com>
Co-Authored-By: Robert Dubner <rdubner@symas.com>
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.
The prior set of changes largely eliminated the assumption that the
internal codeset was either ascii or ebcdic. These changes remove the
last vestiges of that assumption.
These changes also implement the COBOL ENTRY statement, which allows a
program-id to have more than one externally callable entry point. Since
GCC assumes the existence of an ABI that is not, repeat *not* capable of
that, it is implemented here by creating a separate function with the
name specified by the ENTRY statement. That function sets up global
variables which cause control to be transferred to the ENTRY point when
the parent function is called re-entrantly, and then executes that call.
gcc/cobol/ChangeLog:
* genapi.cc (move_tree): Formatting.
(parser_enter_file): Incorporate global __gg__entry_label.
(enter_program_common): Remove calls to alphabet overrides.
(parser_alphabet): Change cbl_alphabet_e handling.
(parser_alphabet_use): Likewise.
(initialize_the_data): Likewise.
(establish_using): Process passed parameters in a subroutine.
(parser_division): Remove in-line parameter processing;
call establish_using() instead. Check for __gg__entry_label.
(parser_file_add): Temporary workaround for charset encoding.
(parser_file_open): Likewise.
(create_and_call): Push/pop program state around call to external.
(parser_entry): Implement new ENTRY statement feature.
(mh_source_is_literalN): Formatting.
* genapi.h (parser_entry): New ENTRY statement.
* gengen.cc (gg_create_goto_pair): Formatting.
(gg_goto_label_decl): Remove.
* gengen.h (gg_goto_label_decl): Remove.
* genutil.cc (internal_codeset_is_ebcdic): Remove.
* genutil.h (internal_codeset_is_ebcdic): Remove.
* symbols.cc (symbols_alphabet_set): Restrict alphabet scan to
program.
* symbols.h (is_elementary): Use defined constants instead of
explicit 'A'and 'N'
libgcobol/ChangeLog:
* charmaps.cc (__gg__set_internal_codeset): Eliminate ascii/ebcdic.
(__gg__text_conversion_override): Remove.
* charmaps.h (enum text_device_t): Eliminate ascii/ebcdic.
(enum text_codeset_t): Remove.
(__gg__set_internal_codeset): Remove.
(__gg__text_conversion_override): Remove.
* gfileio.cc: Anticipate cbl_encoding_t fixes.
* libgcobol.cc (struct program_state): Incorporate
__gg__entry_label.
(__gg__pop_program_state): Eliminate unused defines.
(__gg__alphabet_use): Eliminate ascii/ebcdic dichotomy.
* valconv.cc (__gg__alphabet_create): Likewise.
COBOL Special Registers (e.g., RETURN-CODE; DEBUG-ITEM) are implemented as
global variables. These changes define them with the prefix "__ggsr__" in
their variable names so that the GDB-COBOL debugger can identify them.
The creation and handling of such variables has been streamlined with the
introduction of the "register_e" cbl_field_t::attr bit.
gcc/cobol/ChangeLog:
* genapi.cc (trace1_init): Prepend two internal variables with
underscore.
(initialize_variable_internal): Use new register_e attribute.
(psa_global): Use "__ggsr__" prefix to identify special registers
(parser_symbol_add): Use new register_e attribute.
* symbols.cc (cbl_field_attr_str): Likewise.
(symbol_table_init): Likewise.
(is_register_field): Eliminated in favor of (attr & register_e).
* symbols.h (is_register_field): Likewise.
libgcobol/ChangeLog:
* common-defs.h (enum cbl_field_attr_t): Define register_e.
* constants.cc (struct cblc_field_t): Define special registers with
"__ggsr__" prefix.
Use autoconf 2.69 to regenerate libgcobol/configure
Fixes: 9992c0a0e1 ("cobol: Bring EBCDIC NumericDisplay variables into IBM compliance.")
libgcobol/ChangeLog:
* configure: Regenerate.
The new routine uses table lookups more effectively, and avoids __int128
arithmetic until necessary.
gcc/cobol/ChangeLog:
* genutil.cc (get_binary_value): Use the new routine.
libgcobol/ChangeLog:
* libgcobol.cc (get_binary_value_local): Use the new routine.
* stringbin.cc (int_from_string): Removed.
(__gg__packed_to_binary): Implement new routine.
* stringbin.h (__gg__packed_to_binary): Likewise.
Replace " value *= 10; value += digit" routines with a new one that does two
digits at a time and avoids __int128 calculations until they are necessary.
These changes also clean up the conversion behavior when a digit is not valid.
gcc/cobol/ChangeLog:
* genutil.cc (get_binary_value): Use the new routine.
libgcobol/ChangeLog:
* libgcobol.cc (int128_to_field): Use the new routine.
(get_binary_value_local): Use the new routine.
(format_for_display_internal): Formatting.
(__gg__get_file_descriptor): Likewise.
* stringbin.cc (string_from_combined): Formatting.
(packed_from_combined): Likewise.
(int_from_string): New routine.
(__gg__numeric_display_to_binary): Likewise.
* stringbin.h (__gg__numeric_display_to_binary): Likewise.
The legacy routine for converting a binary integer to a packed-decimal
representaion peeled two digits at a time from the bottom of an _int128 value.
These changes replace that routine with a divide-and-conquer algorithm that
runs about ten times faster.
libgcobol/ChangeLog:
* libgcobol.cc (int128_to_field): Switch to the new routine.
* stringbin.cc (packed_from_combined): Implement the new routine.
(__gg__binary_to_packed): Likewise.
* stringbin.h (__gg__binary_to_packed): Likewise.
COBOL often requires the conversion of binary integers to string of characters.
These changes replace a naive routine that peels decimal digits from a binary
value one digit at a time, with a divide-and-conquer algorithm that is twice as
fast even for a couple of digits, and is about eight times faster past ten
digits.
Included here are some minor fixes to the lexer and parser.
gcc/cobol/ChangeLog:
* cbldiag.h (location_dump): Source code formatting.
* parse.y: error_msg formatting.
* scan.l: Remove UTF-8 character from regex pattern.
* scan_ante.h (numstr_of): error_msg formatting.
* show_parse.h (class ANALYZE): Suppress cppcheck error.
* util.cc (cbl_field_t::report_invalid_initial_value):
error_msg formatting.
libgcobol/ChangeLog:
* Makefile.am: Include new stringbin.cc file.
* Makefile.in: Regenerated.
* libgcobol.cc (__gg__power_of_ten): Improve error message.
(__gg__binary_to_string): Deleted.
(__gg__binary_to_string_internal): Deleted.
(int128_to_field): Use new conversion routine.
(__gg__move): Use new conversion routine.
* stringbin.cc: New file. Implements new conversion routine.
* stringbin.h: New file. Likewise.
This collection of changes reflects development by both Jim Lowden and Bob
Dubner. It includes fixes to the cobcd script; refinements to the multiple-
period syntax; changes to the parser; implementation of DISPLAY/ACCEPT to and
from ENVIRONMENT-NAME, ENVIRONMENT-VALUE, ARGUMENT-NUMBER, ARGUMENT-VALUE and
minor changes to genapi.cc to cut down on the number of cppcheck warnings.
Co-authored-by: James K. Lowden <jklowden@cobolworx.com>
Co-authored-by: Robert Dubner <rdubner@symas.com>
gcc/cobol/ChangeLog:
PR cobol/120765
PR cobol/119337
PR cobol/120794
* Make-lang.in: Take control of the .cc.o rule.
* cbldiag.h (error_msg_direct): New declaration.
(gcc_location_dump): Forward declaration.
(location_dump): Use gcc_location_dump.
* cdf.y: Change some tokens.
* gcobc: Change dialect handling.
* genapi.cc (parser_call_targets_dump): Temporarily remove from service.
(parser_compile_dcls): Combine temporary arrays.
(get_binary_value_from_float): Apply const to one parameter.
(depending_on_value): Localize a boolean variable.
(normal_normal_compare): Likewise.
(cobol_compare): Eliminate cppcheck warning.
(combined_name): Apply const to an input parameter.
(parser_perform): Apply const to a variable.
(parser_accept): Improve handling of special_name_t parameter and
the exception conditions.
(parser_display): Improve handling of speciat_name_t parameter; use the
os_filename[] string when appropriate.
(program_end_stuff): Rename shadowing variable.
(parser_division): Consolidate temporary char[] arrays.
(parser_file_start): Apply const to a parameter.
(inspect_replacing): Likewise.
(parser_program_hierarchy): Rename shadowing variable.
(mh_identical): Apply const to parameters.
(float_type_of): Likewise.
(picky_memcpy): Likewise.
(mh_numeric_display): Likewise.
(mh_little_endian): Likewise.
(mh_source_is_group): Apply static to a variable it.
(move_helper): Quiet a cppcheck warning.
* genapi.h (parser_accept): Add exceptions to declaration.
(parser_accept_under_discussion): Add declaration.
(parser_display): Change to std::vector; add exceptions to declaration.
* lexio.cc (cdf_source_format): Improve source code location handling.
(source_format_t::infer): Likewise.
(is_fixed_format): Likewise.
(is_reference_format): Likewise.
(left_margin): Likewise.
(right_margin): Likewise.
(cobol_set_indicator_column): Likewise.
(include_debug): Likewise.
(continues_at): Likewise.
(indicated): Likewise.
(check_source_format_directive): Likewise.
(cdftext::free_form_reference_format): Likewise.
* parse.y: Tokens; program and function names; DISPLAY and ACCEPT
handling.
* parse_ante.h (class tokenset_t): Removed.
(class current_tokens_t): Removed.
(field_of): Removed.
* scan.l: Token handling.
* scan_ante.h (level_found): Comment.
* scan_post.h (start_condition_str): Remove cast author_state:.
* symbols.cc (symbols_update): Change error message.
(symbol_table_init): Correct and reorder entries.
(symbol_unresolved_file_key): New function definition.
(cbl_file_key_t::deforward): Change error message.
* symbols.h (symbol_unresolved_file_key): New declaration.
(keyword_tok): New function.
(redefined_token): New function.
(class current_tokens_t): New class.
* symfind.cc (symbol_match): Revise error message.
* token_names.h: Reorder and change numbers in comments.
* util.cc (class cdf_directives_t): New class.
(cobol_set_indicator_column): New function.
(cdf_source_format): New function.
(gcc_location_set_impl): Improve column handling in token_location.
(gcc_location_dump): New function.
(class temp_loc_t): Modify constructor.
(error_msg_direct): New function.
* util.h (class source_format_t): New class.
libgcobol/ChangeLog:
* libgcobol.cc (__gg__accept_envar): ACCEPT/DISPLAY environment variables.
(accept_envar): Likewise.
(default_exception_handler): Refine system log entries.
(open_syslog): Likewise.
(__gg__set_env_name): ACCEPT/DISPLAY environment variables.
(__gg__get_env_name): ACCEPT/DISPLAY environment variables.
(__gg__get_env_value): ACCEPT/DISPLAY environment variables.
(__gg__set_env_value): ACCEPT/DISPLAY environment variables.
(__gg__fprintf_stderr): Adjust __attribute__ for printf.
(__gg__set_arg_num): ACCEPT/DISPLAY command-line arguments.
(__gg__accept_arg_value): ACCEPT/DISPLAY command-line arguments.
(__gg__get_file_descriptor): DISPLAY on os_filename[] /dev device.