mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-22 03:47:02 -05:00
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.
The libgcobol is intended for use entirely and solely by executables created from COBOL source code by the GCOBOL "COBOL for GCC" front end. libgcobol.a can be staticly linked in, but it makes for very large binaries. We tend to use that for debugging the GCOBOL compiler, and not much else Many of the functions in the library are called by the executable code generated by the GCOBOL compiler through GIMPLE tags, and thus prototypes -- which are part of the C/C++ programming paradigm -- are not used. Both the calling program and the called program use the extern "C" construction so that the linker can find the functions, and they need to agree ahead of time about the meaning of passed parameters.