]> git.ipfire.org Git - thirdparty/gcc.git/commit
cobol: Introduce vendor-compatibility layer as user-defined functions.
authorJames K. Lowden <jklowden@cobolworx.com>
Wed, 12 Nov 2025 22:48:34 +0000 (17:48 -0500)
committerJames K. Lowden <jklowden@cobolworx.com>
Thu, 13 Nov 2025 00:49:39 +0000 (19:49 -0500)
commit08e9df25462097cb5f0bf8d5156fa059d1bd7ec5
tree033142960dd4ac0ff6eaaa1185bb3cd09e399e68
parenta784ed8dad0733c81d79e841e054ab48d2202daa
cobol: Introduce vendor-compatibility layer as user-defined functions.

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.
55 files changed:
gcc/cobol/cdf.y
gcc/cobol/genapi.cc
gcc/cobol/parse.y
gcc/cobol/parse_ante.h
gcc/cobol/scan.l
gcc/cobol/symbols.cc
gcc/cobol/symbols.h
gcc/cobol/token_names.h
gcc/cobol/util.cc
libgcobol/.gitignore [new file with mode: 0644]
libgcobol/Makefile.am
libgcobol/Makefile.in
libgcobol/charmaps.cc
libgcobol/charmaps.h
libgcobol/compat/README.md [new file with mode: 0644]
libgcobol/compat/lib/gnu/CBL_ALLOC_MEM.cbl [new file with mode: 0644]
libgcobol/compat/lib/gnu/CBL_CHECK_FILE_EXIST.cbl [new file with mode: 0644]
libgcobol/compat/lib/gnu/CBL_DELETE_FILE.cbl [new file with mode: 0644]
libgcobol/compat/lib/gnu/CBL_FREE_MEM.cbl [new file with mode: 0644]
libgcobol/compat/t/Makefile [new file with mode: 0644]
libgcobol/compat/t/smoke.cbl [new file with mode: 0644]
libgcobol/config.h.in
libgcobol/configure
libgcobol/configure.ac
libgcobol/intrinsic.cc
libgcobol/libgcobol.cc
libgcobol/libgcobol.h
libgcobol/posix/README.md [new file with mode: 0644]
libgcobol/posix/bin/Makefile [new file with mode: 0644]
libgcobol/posix/bin/headers [new file with mode: 0644]
libgcobol/posix/bin/scrape.awk [new file with mode: 0755]
libgcobol/posix/bin/sizeofs.c [new file with mode: 0644]
libgcobol/posix/bin/udf-gen [new file with mode: 0755]
libgcobol/posix/cpy/posix-errno.cbl [new file with mode: 0644]
libgcobol/posix/cpy/statbuf.cpy [new file with mode: 0644]
libgcobol/posix/cpy/tm.cpy [new file with mode: 0644]
libgcobol/posix/shim/errno.cc [moved from libgcobol/posix/errno.cc with 100% similarity]
libgcobol/posix/shim/localtime.cc [moved from libgcobol/posix/localtime.cc with 100% similarity]
libgcobol/posix/shim/stat.cc [new file with mode: 0644]
libgcobol/posix/shim/stat.h [new file with mode: 0644]
libgcobol/posix/shim/tm.h [moved from libgcobol/posix/tm.h with 100% similarity]
libgcobol/posix/stat.cc [deleted file]
libgcobol/posix/stat.h [deleted file]
libgcobol/posix/t/Makefile [new file with mode: 0644]
libgcobol/posix/t/errno.cbl [new file with mode: 0644]
libgcobol/posix/t/exit.cbl [new file with mode: 0644]
libgcobol/posix/t/localtime.cbl [new file with mode: 0644]
libgcobol/posix/t/stat.cbl [new file with mode: 0644]
libgcobol/posix/udf/posix-exit.cbl [new file with mode: 0644]
libgcobol/posix/udf/posix-localtime.cbl [new file with mode: 0644]
libgcobol/posix/udf/posix-mkdir.cbl [new file with mode: 0644]
libgcobol/posix/udf/posix-stat.cbl [new file with mode: 0644]
libgcobol/posix/udf/posix-unlink.cbl [new file with mode: 0644]
libgcobol/valconv.cc
libgcobol/xmlparse.cc