From 37b77de366b7e100505ff27ea154ac1749782314 Mon Sep 17 00:00:00 2001 From: Boris Eng Date: Mon, 19 Feb 2024 13:53:51 +0100 Subject: [PATCH] Add multithreaded version for string functions and remove static variables --- cobc/ChangeLog | 12 + cobc/Makefile | 1071 +++ cobc/codegen.c | 23 + cobc/parser.y | 30 +- cobc/ppparse.output | 3526 ++++++++++ cobc/tree.c | 9 + cobc/tree.h | 6 + cobc/typeck.c | 95 +- libcob/ChangeLog | 9 + libcob/Makefile | 1005 +++ libcob/coblocal.h | 5 +- libcob/common.h | 75 +- libcob/strings.c | 742 +- tests/ChangeLog | 6 + tests/Makefile.am | 3 +- tests/testsuite.at | 4 + tests/testsuite.src/backcomp.at | 10939 ++++++++++++++++++++++++++++++ 17 files changed, 17231 insertions(+), 329 deletions(-) create mode 100644 cobc/Makefile create mode 100644 cobc/ppparse.output create mode 100644 libcob/Makefile create mode 100644 tests/testsuite.src/backcomp.at diff --git a/cobc/ChangeLog b/cobc/ChangeLog index f95300de1..2f2d4764f 100644 --- a/cobc/ChangeLog +++ b/cobc/ChangeLog @@ -18,6 +18,18 @@ * codegen.c: handle profiling code generation under the cb_flag_prof guard +2024-02-26 Boris Eng + + * codegen.c (output_strings_states, codegen_internal): + added structures for the data used by strings functions as local variables + in the C generated code + * parser.y (examine_format_variant, inspect_region): + function calls of strings functions have been replaced by calls to + thread-safe versions (using state structures instead of static variables) + * typeck.c: a lot of functions have been changed in that file in order to + make them coherent with the above changes and all those changes are + omitted for more concision + 2024-02-19 Boris Eng * parser.y (screen_value_clause): replaced basic literals by literals diff --git a/cobc/Makefile b/cobc/Makefile new file mode 100644 index 000000000..af4f84a20 --- /dev/null +++ b/cobc/Makefile @@ -0,0 +1,1071 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# cobc/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +# +# Makefile gnucobol/cobc +# +# Copyright (C) 2003-2012, 2014-2021 Free Software Foundation, Inc. +# Written by Keisuke Nishida, Roger While, Simon Sobisch +# +# This file is part of GnuCOBOL. +# +# The GnuCOBOL compiler is free software: you can redistribute it +# and/or modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# GnuCOBOL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GnuCOBOL. If not, see . + +# aminclude_static.am generated automatically by Autoconf +# from AX_AM_MACROS_STATIC on Thu Feb 1 13:31:38 CET 2024 + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/gnucobol +pkgincludedir = $(includedir)/gnucobol +pkglibdir = $(libdir)/gnucobol +pkglibexecdir = $(libexecdir)/gnucobol +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +bin_PROGRAMS = cobc$(EXEEXT) +subdir = cobc +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ + $(top_srcdir)/m4/ax_ac_define_resolved.m4 \ + $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ + $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ + $(top_srcdir)/m4/ax_am_macros_static.m4 \ + $(top_srcdir)/m4/ax_check_define.m4 \ + $(top_srcdir)/m4/ax_check_gnu_make.m4 \ + $(top_srcdir)/m4/ax_code_coverage.m4 \ + $(top_srcdir)/m4/ax_file_escapes.m4 \ + $(top_srcdir)/m4/ax_prog_bison.m4 \ + $(top_srcdir)/m4/ax_prog_flex.m4 $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(SHELL) $(top_srcdir)/build_aux/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +PROGRAMS = $(bin_PROGRAMS) +am_cobc_OBJECTS = cobc.$(OBJEXT) ppparse.$(OBJEXT) pplex.$(OBJEXT) \ + parser.$(OBJEXT) scanner.$(OBJEXT) config.$(OBJEXT) \ + reserved.$(OBJEXT) error.$(OBJEXT) tree.$(OBJEXT) \ + field.$(OBJEXT) typeck.$(OBJEXT) codegen.$(OBJEXT) \ + help.$(OBJEXT) codeoptim.$(OBJEXT) replace.$(OBJEXT) +cobc_OBJECTS = $(am_cobc_OBJECTS) +am__DEPENDENCIES_1 = +cobc_DEPENDENCIES = $(top_builddir)/libcob/libcob.la \ + $(top_builddir)/lib/libsupport.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build_aux/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/cobc.Po ./$(DEPDIR)/codegen.Po \ + ./$(DEPDIR)/codeoptim.Po ./$(DEPDIR)/config.Po \ + ./$(DEPDIR)/error.Po ./$(DEPDIR)/field.Po ./$(DEPDIR)/help.Po \ + ./$(DEPDIR)/parser.Po ./$(DEPDIR)/pplex.Po \ + ./$(DEPDIR)/ppparse.Po ./$(DEPDIR)/replace.Po \ + ./$(DEPDIR)/reserved.Po ./$(DEPDIR)/scanner.Po \ + ./$(DEPDIR)/tree.Po ./$(DEPDIR)/typeck.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +am__yacc_c2h = sed -e s/cc$$/hh/ -e s/cpp$$/hpp/ -e s/cxx$$/hxx/ \ + -e s/c++$$/h++/ -e s/c$$/h/ +YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS) +LTYACCCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(YACC) $(AM_YFLAGS) $(YFLAGS) +AM_V_YACC = $(am__v_YACC_$(V)) +am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY)) +am__v_YACC_0 = @echo " YACC " $@; +am__v_YACC_1 = +YLWRAP = $(top_srcdir)/build_aux/ylwrap +SOURCES = $(cobc_SOURCES) +DIST_SOURCES = $(cobc_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(dist_man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \ + $(top_srcdir)/aminclude_static.am \ + $(top_srcdir)/build_aux/depcomp \ + $(top_srcdir)/build_aux/mkinstalldirs \ + $(top_srcdir)/build_aux/ylwrap ChangeLog parser.c ppparse.c +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} '/home/engboris/gnucobol/build_aux/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AS = as +AUTOCONF = ${SHELL} '/home/engboris/gnucobol/build_aux/missing' autoconf +AUTOHEADER = ${SHELL} '/home/engboris/gnucobol/build_aux/missing' autoheader +AUTOMAKE = ${SHELL} '/home/engboris/gnucobol/build_aux/missing' automake-1.16 +AWK = mawk +BDB_CFLAGS = +BDB_LIBS = +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -O0 -ggdb3 -fasynchronous-unwind-tables -pipe -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k +CJSON_CFLAGS = +CJSON_LIBS = -lcjson +COBC_CPPFLAGS = +COB_BIGENDIAN = no +COB_CC = gcc +COB_CFLAGS = -pipe -I/usr/local/gnucobol/include -Wno-unused -fsigned-char -Wno-pointer-sign +COB_CONFIG_DIR = ${datarootdir}/gnucobol/config +COB_COPY_DIR = ${datarootdir}/gnucobol/copy +COB_ENABLE_DEBUG = yes +COB_EXE_EXT = +COB_FIX_LIBTOOL = +COB_HAS_64_BIT_POINTER = yes +COB_HAS_CURSES = yes +COB_HAS_ISAM = db +COB_HAS_JSON = no +COB_HAS_XML2 = yes +COB_LDFLAGS = +COB_LIBRARY_PATH = ${exec_prefix}/lib/gnucobol +COB_LIBS = -L${exec_prefix}/lib -lcob +COB_MODULE_EXT = so +COB_OBJECT_EXT = o +COB_PATCH_LEVEL = 0 +CODE_COVERAGE_CFLAGS = +CODE_COVERAGE_CPPFLAGS = +CODE_COVERAGE_CXXFLAGS = +CODE_COVERAGE_ENABLED = no +CODE_COVERAGE_LIBS = +CPP = +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CURSES_LIBS = -lncursesw +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DIFF_FLAGS = --strip-trailing-cr +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +GCOV = +GENHTML = +GETTEXT_MACRO_VERSION = 0.20 +GMP_CFLAGS = +GMP_LIBS = -lgmp +GMSGFMT = : +GMSGFMT_015 = : +GREP = /usr/bin/grep +HELP2MAN = ${SHELL} '/home/engboris/gnucobol/build_aux/missing' help2man +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +INTLLIBS = +INTL_MACOSX_LIBS = +JSON_C_CFLAGS = +JSON_C_LIBS = -ljson-c +LCOV = +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = -Wl,-z,relro,-z,now,-O1 +LEX = ${SHELL} '/home/engboris/gnucobol/build_aux/missing' flex +LEXLIB = +LEX_OUTPUT_ROOT = +LIBCOB_CPPFLAGS = -I/usr/include/libxml2 +LIBCOB_LIBS = -lgmp -lxml2 -lncursesw -ldb-5.3 +LIBICONV = -liconv +LIBINTL = +LIBOBJS = +LIBS = +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBICONV = -liconv +LTLIBINTL = +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAKE = make +MAKEINFO = ${SHELL} '/home/engboris/gnucobol/build_aux/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +MPIR_CFLAGS = +MPIR_LIBS = +MSGFMT = : +MSGMERGE = : +MSGMERGE_FOR_MSGFMT_OPTION = --no-location --quiet +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = gnucobol +PACKAGE_BUGREPORT = bug-gnucobol@gnu.org +PACKAGE_NAME = GnuCOBOL +PACKAGE_STRING = GnuCOBOL 3.3-dev +PACKAGE_TARNAME = gnucobol +PACKAGE_URL = https://www.gnu.org/software/gnucobol/ +PACKAGE_VERSION = 3.3-dev +PATH_SEPARATOR = : +PERL = perl +PKG_CONFIG = /usr/bin/pkg-config +PKG_CONFIG_LIBDIR = +PKG_CONFIG_PATH = +POSUB = po +PROGRAMS_LIBS = +QUOTE_INCLUDE_FLAG = +RANLIB = ranlib +RC = +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +USE_NLS = yes +VERSION = 3.3-dev +XGETTEXT = : +XGETTEXT_015 = : +XGETTEXT_EXTRA_OPTIONS = +XML2_CFLAGS = -I/usr/include/libxml2 +XML2_CONFIG = +XML2_LIBS = -lxml2 +YACC = yacc +YFLAGS = +abs_builddir = /home/engboris/gnucobol/cobc +abs_srcdir = /home/engboris/gnucobol/cobc +abs_top_builddir = /home/engboris/gnucobol +abs_top_srcdir = /home/engboris/gnucobol +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +configured_make = make +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +ifGNUmake = +ifnGNUmake = +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/engboris/gnucobol/build_aux/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /usr/local/gnucobol +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../ +top_builddir = .. +top_srcdir = .. +cobc_SOURCES = cobc.c cobc.h ppparse.y pplex.c parser.y scanner.c config.c \ + reserved.c error.c tree.c tree.h field.c typeck.c codegen.c help.c \ + config.def flag.def warning.def codeoptim.def ppparse.def \ + codeoptim.c replace.c + + +#cobc_SOURCES = cobc.c cobc.h ppparse.y pplex.l parser.y scanner.l config.c +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)/lib -I$(top_srcdir)/lib \ + $(COBC_CPPFLAGS) + +AM_CFLAGS = $(CODE_COVERAGE_CFLAGS) +cobc_LDADD = $(top_builddir)/libcob/libcob.la \ + $(top_builddir)/lib/libsupport.la \ + $(PROGRAMS_LIBS) $(CODE_COVERAGE_LIBS) + +dist_man_MANS = cobc.1 +COBC = cobc$(EXEEXT) + +# sources that needs to be built *before* any other file +# note: we actually want their header files... +BUILT_SOURCES = ppparse.c parser.c +EXTRA_DIST = pplex.l scanner.l ppparse.h parser.h +MAINTAINERCLEANFILES = pplex.c scanner.c ppparse.h parser.h cobc.1 +CLEANFILES = parser.output ppparse.output +#GITIGNOREFILES := $(GITIGNOREFILES) $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY) +#code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V)) +#code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY)) +#code_coverage_v_lcov_cap_0 = @echo " LCOV --capture" $(CODE_COVERAGE_OUTPUT_FILE); +#code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V)) +#code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY)) +#code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN); +#code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V)) +#code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY)) +#code_coverage_v_genhtml_0 = @echo " GEN " "$(CODE_COVERAGE_OUTPUT_DIRECTORY)"; +#code_coverage_quiet = $(code_coverage_quiet_$(V)) +#code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY)) +#code_coverage_quiet_0 = --quiet + +# sanitizes the test-name: replaces with underscores: dashes and dots +#code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1))) +#AM_DISTCHECK_CONFIGURE_FLAGS := $(AM_DISTCHECK_CONFIGURE_FLAGS) --disable-code-coverage +CODE_COVERAGE_BRANCH_COVERAGE = 1 +CODE_COVERAGE_LCOV_OPTIONS = --no-external +HELPSOURCES = help.c config.def flag.def warning.def $(top_srcdir)/configure.ac +HELP2MAN_OPTS = --info-page=$(PACKAGE) +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .l .lo .o .obj .y +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/aminclude_static.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu cobc/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu cobc/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/aminclude_static.am $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +cobc$(EXEEXT): $(cobc_OBJECTS) $(cobc_DEPENDENCIES) $(EXTRA_cobc_DEPENDENCIES) + @rm -f cobc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(cobc_OBJECTS) $(cobc_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/cobc.Po # am--include-marker +include ./$(DEPDIR)/codegen.Po # am--include-marker +include ./$(DEPDIR)/codeoptim.Po # am--include-marker +include ./$(DEPDIR)/config.Po # am--include-marker +include ./$(DEPDIR)/error.Po # am--include-marker +include ./$(DEPDIR)/field.Po # am--include-marker +include ./$(DEPDIR)/help.Po # am--include-marker +include ./$(DEPDIR)/parser.Po # am--include-marker +include ./$(DEPDIR)/pplex.Po # am--include-marker +include ./$(DEPDIR)/ppparse.Po # am--include-marker +include ./$(DEPDIR)/replace.Po # am--include-marker +include ./$(DEPDIR)/reserved.Po # am--include-marker +include ./$(DEPDIR)/scanner.Po # am--include-marker +include ./$(DEPDIR)/tree.Po # am--include-marker +include ./$(DEPDIR)/typeck.Po # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ $< + +.c.obj: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: + $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# $(AM_V_CC)source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $< + +.y.c: + $(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h `echo $@ | $(am__yacc_c2h)` y.output $*.output -- $(YACCCOMPILE) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(dist_man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(dist_man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(PROGRAMS) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -rm -f parser.c + -rm -f ppparse.c + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool clean-local \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/cobc.Po + -rm -f ./$(DEPDIR)/codegen.Po + -rm -f ./$(DEPDIR)/codeoptim.Po + -rm -f ./$(DEPDIR)/config.Po + -rm -f ./$(DEPDIR)/error.Po + -rm -f ./$(DEPDIR)/field.Po + -rm -f ./$(DEPDIR)/help.Po + -rm -f ./$(DEPDIR)/parser.Po + -rm -f ./$(DEPDIR)/pplex.Po + -rm -f ./$(DEPDIR)/ppparse.Po + -rm -f ./$(DEPDIR)/replace.Po + -rm -f ./$(DEPDIR)/reserved.Po + -rm -f ./$(DEPDIR)/scanner.Po + -rm -f ./$(DEPDIR)/tree.Po + -rm -f ./$(DEPDIR)/typeck.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/cobc.Po + -rm -f ./$(DEPDIR)/codegen.Po + -rm -f ./$(DEPDIR)/codeoptim.Po + -rm -f ./$(DEPDIR)/config.Po + -rm -f ./$(DEPDIR)/error.Po + -rm -f ./$(DEPDIR)/field.Po + -rm -f ./$(DEPDIR)/help.Po + -rm -f ./$(DEPDIR)/parser.Po + -rm -f ./$(DEPDIR)/pplex.Po + -rm -f ./$(DEPDIR)/ppparse.Po + -rm -f ./$(DEPDIR)/replace.Po + -rm -f ./$(DEPDIR)/reserved.Po + -rm -f ./$(DEPDIR)/scanner.Po + -rm -f ./$(DEPDIR)/tree.Po + -rm -f ./$(DEPDIR)/typeck.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: all check install install-am install-exec install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-binPROGRAMS clean-generic clean-libtool clean-local \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-man \ + uninstall-man1 + +.PRECIOUS: Makefile + + +# Code coverage +# +# Optional: +# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting. +# Multiple directories may be specified, separated by whitespace. +# (Default: $(top_builddir)) +# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated +# by lcov for code coverage. (Default: +# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info) +# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage +# reports to be created. (Default: +# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage) +# - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage, +# set to 0 to disable it and leave empty to stay with the default. +# (Default: empty) +# - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov +# instances. (Default: based on ) +# - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov +# instances. (Default: ) +# - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov +# - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the +# collecting lcov instance. (Default: ) +# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov +# instance. (Default: ) +# - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering +# lcov instance. (Default: empty) +# - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov +# instance. (Default: ) +# - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the +# genhtml instance. (Default: based on ) +# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml +# instance. (Default: ) +# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore +# +# The generated report will be titled using the $(PACKAGE_NAME) and +# $(PACKAGE_VERSION). In order to add the current git hash to the title, +# use the git-version-gen script, available online. +# Optional variables +# run only on top dir +# ifeq ($(abs_builddir), $(abs_top_builddir)) +#CODE_COVERAGE_DIRECTORY ?= $(top_builddir) +#CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info +#CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage + +#CODE_COVERAGE_BRANCH_COVERAGE ?= +#CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),--rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) +#CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) +#CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)" +#CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) +#CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) +#CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?= +#CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) +#CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=$(if $(CODE_COVERAGE_BRANCH_COVERAGE),--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) +#CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) +#CODE_COVERAGE_IGNORE_PATTERN ?= + +# Use recursive makes in order to ignore errors during check +#check-code-coverage: +# -$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check +# $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture + +# Capture code coverage data +#code-coverage-capture: code-coverage-capture-hook +# $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS) +# $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS) +# -@rm -f "$(CODE_COVERAGE_OUTPUT_FILE).tmp" +# $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS) +# @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" + +#code-coverage-clean: +# -$(LCOV) --directory $(top_builddir) -z +# -rm -rf "$(CODE_COVERAGE_OUTPUT_FILE)" "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" +# -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete + +#code-coverage-dist-clean: +# else # ifneq ($(abs_builddir), $(abs_top_builddir)) +#check-code-coverage: + +#code-coverage-capture: code-coverage-capture-hook + +#code-coverage-clean: + +#code-coverage-dist-clean: +# endif # ifeq ($(abs_builddir), $(abs_top_builddir)) +# Use recursive makes in order to ignore errors during check +check-code-coverage: + @echo "Need to reconfigure with --enable-code-coverage" +# Capture code coverage data +code-coverage-capture: code-coverage-capture-hook + @echo "Need to reconfigure with --enable-code-coverage" + +code-coverage-clean: + +code-coverage-dist-clean: + +# Hook rule executed before code-coverage-capture, overridable by the user +code-coverage-capture-hook: + +.PHONY: check-code-coverage code-coverage-capture code-coverage-dist-clean code-coverage-clean code-coverage-capture-hook + +# Add rules for code-coverage testing, as provided by AX_CODE_COVERAGE + +clean-local: code-coverage-clean +dist-clean-local: code-coverage-dist-clean + +cobc.1: $(HELPSOURCES) | $(COBC) + "$(top_builddir)/pre-inst-env" $(HELP2MAN) --output=$@ $(HELP2MAN_OPTS) $(COBC) +#cobc.1: $(HELPSOURCES) +# "$(top_builddir)/pre-inst-env" $(HELP2MAN) --output=$@ $(HELP2MAN_OPTS) $(COBC) + +.l.c: + LC_CTYPE=C $(LEX) -o$@ $< + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/cobc/codegen.c b/cobc/codegen.c index 2dd0c7520..6c2f7f929 100644 --- a/cobc/codegen.c +++ b/cobc/codegen.c @@ -2506,6 +2506,28 @@ output_nonlocal_field_cache (void) output_storage ("\n/* End of fields */\n\n"); } +/* Strings states */ + +static void +output_strings_states (struct cb_program *prog) +{ + unsigned int strings_used = + prog->flag_inspect_used || + prog->flag_string_used || + prog->flag_unstring_used; + + // if (strings_used) + output_local ("/* States of string statements */\n"); + // if (prog->flag_inspect_used) + output_local ("struct cob_inspect_state *inspect_st = NULL;\n"); + // if (prog->flag_string_used) + output_local ("struct cob_string_state *string_st = NULL;\n"); + // if (prog->flag_unstring_used) + output_local ("struct cob_unstring_state *unstring_st = NULL;\n"); + // if (strings_used) + output_newline (); +} + /* Literals, figurative constants and user-defined constants */ static void @@ -14053,6 +14075,7 @@ codegen_internal (struct cb_program *prog, const int subsequent_call) output_call_parameter_stack_pointers (prog); output_frame_stack (prog); output_dynamic_field_function_id_pointers (); + output_strings_states (prog); if (prog->report_storage) { output_target = prog->local_include->local_fp; diff --git a/cobc/parser.y b/cobc/parser.y index 6cb5fd120..9b01d5fc4 100644 --- a/cobc/parser.y +++ b/cobc/parser.y @@ -14944,7 +14944,11 @@ examine_format_variant: t = cb_build_tallying_value (x, r); break; case EXAMINE_TAL_UNTIL_FIRST: - r = cb_list_add (r, CB_BUILD_FUNCALL_1 ("cob_inspect_before", x)); + r = cb_list_add (r, CB_BUILD_FUNCALL_2 ( + "cob_inspect_before_mt", + current_program->inspect_st_ref, + x + )); t = cb_build_tallying_characters (r); break; /* LCOV_EXCL_START */ @@ -14965,7 +14969,11 @@ examine_format_variant: t = cb_build_replacing_leading (x, replacing_to, r); break; case EXAMINE_TAL_UNTIL_FIRST: - r = cb_list_add (r, CB_BUILD_FUNCALL_1 ("cob_inspect_before", x)); + r = cb_list_add (r, CB_BUILD_FUNCALL_2 ( + "cob_inspect_before_mt", + current_program->inspect_st_ref, + x + )); t = cb_build_replacing_characters (replacing_to, r); break; } @@ -14988,7 +14996,11 @@ examine_format_variant: t = cb_build_replacing_first (from, to, r); break; case EXAMINE_REP_UNTIL_FIRST: - r = cb_list_add (r, CB_BUILD_FUNCALL_1 ("cob_inspect_before", from)); + r = cb_list_add (r, CB_BUILD_FUNCALL_2 ( + "cob_inspect_before_mt", + current_program->inspect_st_ref, + from + )); t = cb_build_replacing_characters (to, r); break; /* LCOV_EXCL_START */ @@ -15202,14 +15214,22 @@ inspect_region: inspect_before: BEFORE _initial x { - $$ = CB_BUILD_FUNCALL_1 ("cob_inspect_before", $3); + $$ = CB_BUILD_FUNCALL_2 ( + "cob_inspect_before_mt", + current_program->inspect_st_ref, + $3 + ); } ; inspect_after: AFTER _initial x { - $$ = CB_BUILD_FUNCALL_1 ("cob_inspect_after", $3); + $$ = CB_BUILD_FUNCALL_2 ( + "cob_inspect_after_mt", + current_program->inspect_st_ref, + $3 + ); } ; diff --git a/cobc/ppparse.output b/cobc/ppparse.output new file mode 100644 index 000000000..53d4a1c42 --- /dev/null +++ b/cobc/ppparse.output @@ -0,0 +1,3526 @@ +Terminaux inutilisés dans la grammaire + + "word" + + +Grammaire + + 0 $accept: program_structure "end of file" + + 1 program_structure: "CONTROL DIVISION" "." program_with_control_division + 2 | statement_list + + 3 program_with_control_division: statement_list + 4 | control_division_no_replace statement_no_replace statement_list + 5 | control_division_no_replace + 6 | control_division_with_replace "." statement_no_replace_list + + 7 control_division_no_replace: "SUBSTITUTION SECTION" "." + + 8 control_division_with_replace: "SUBSTITUTION SECTION" "." replace_statement + + 9 statement_list: ε + 10 | statement_list statement + + 11 statement_no_replace_list: ε + 12 | statement_no_replace_list statement_no_replace + + 13 statement: statement_no_replace + 14 | replace_statement_with_dot + + 15 statement_no_replace: copy_statement + 16 | directive "end of line" + 17 | listing_statement + 18 | CONTROL_STATEMENT control_options _dot "end of line" + + 19 directive: SOURCE_DIRECTIVE source_directive + 20 | DEFINE_DIRECTIVE define_directive + 21 | COBOL_WORDS_DIRECTIVE cobol_words_directive + 22 | SET_DIRECTIVE set_directive + 23 | REFMOD_DIRECTIVE refmod_directive + 24 | TURN_DIRECTIVE turn_directive + 25 | LISTING_DIRECTIVE listing_directive + 26 | LEAP_SECOND_DIRECTIVE leap_second_directive + + 27 $@1: ε + + 28 directive: IF_DIRECTIVE $@1 if_directive_if + + 29 $@2: ε + + 30 directive: ELIF_DIRECTIVE $@2 if_directive_elif + 31 | ELSE_DIRECTIVE + 32 | ENDIF_DIRECTIVE + + 33 $@3: ε + + 34 directive: CALL_DIRECTIVE $@3 call_directive + + 35 if_directive_if: if_directive + 36 | error + + 37 if_directive_elif: if_directive + 38 | error + + 39 set_directive: set_choice + 40 | set_directive set_choice + + 41 set_choice: CONSTANT "Variable" "Literal" + 42 | "Variable" set_options + 43 | ADDRSV alnum_list + 44 | ADDSYN alnum_equality + 45 | AREACHECK + 46 | ASSIGN unquoted_literal + 47 | BOUND + 48 | CALLFH unquoted_literal + 49 | CALLFH + 50 | CHECKNUM + 51 | COMP1 unquoted_literal + 52 | "DPC-IN-DATA" unquoted_literal + 53 | FOLDCOPYNAME _as unquoted_literal + 54 | MAKESYN alnum_equality + 55 | NOAREACHECK + 56 | NOBOUND + 57 | NOCHECKNUM + 58 | "NODPC-IN-DATA" + 59 | NOFOLDCOPYNAME + 60 | NOODOSLIDE + 61 | NOSPZERO + 62 | NOSSRANGE + 63 | ODOSLIDE + 64 | OVERRIDE alnum_equality_list + 65 | REMOVE alnum_list + 66 | SOURCEFORMAT _as unquoted_literal + 67 | SOURCEFORMAT _as error + 68 | SPZERO + 69 | SSRANGE _literal + + 70 alnum_list: "Literal" + 71 | alnum_list "Literal" + + 72 alnum_equality_list: alnum_equality + 73 | alnum_equality_list alnum_equality + + 74 alnum_equality: "Literal" "=" "Literal" + + 75 alnum_with_list: alnum_with + 76 | alnum_with_list alnum_with + + 77 alnum_with: "Literal" WITH "Literal" + + 78 alnum_by_list: alnum_by + 79 | alnum_by_list alnum_by + + 80 alnum_by: "Literal" BY "Literal" + + 81 set_options: ε + 82 | _as "Literal" + + 83 refmod_directive: _on + 84 | OFF + + 85 source_directive: _format _is "Variable" + 86 | _format _is "Literal" + + 87 _literal: ε + 88 | "Literal" + + 89 define_directive: "Variable" _as "Literal" _override + 90 | "Variable" _as PARAMETER _override + 91 | "Variable" _as OFF + 92 | CONSTANT "Variable" _as "Literal" _override + 93 | variable_or_literal + + 94 cobol_words_directive: EQUATE alnum_with_list + 95 | UNDEFINE alnum_list + 96 | SUBSTITUTE alnum_by_list + 97 | RESERVE alnum_list + + 98 listing_directive: ε + 99 | ON + 100 | OFF + + 101 listing_statement: LISTING_STATEMENT + 102 | TITLE_STATEMENT "Literal" _dot "end of line" + + 103 control_options: control_option + 104 | control_options control_option + + 105 control_option: SOURCE + 106 | NOSOURCE + 107 | LIST + 108 | NOLIST + 109 | MAP + 110 | NOMAP + + 111 _dot: ε + 112 | "." + + 113 leap_second_directive: ε + 114 | ON + 115 | OFF + + 116 turn_directive: ec_list CHECKING on_or_off + + 117 ec_list: "Variable" + 118 | ec_list "Variable" + + 119 on_or_off: on_with_loc + 120 | ON + 121 | OFF + + 122 on_with_loc: ON with_loc + 123 | with_loc + + 124 with_loc: WITH LOCATION + 125 | LOCATION + + 126 call_directive: call_choice + 127 | call_directive call_choice + + 128 call_choice: COBOL + 129 | "EXTERN" + 130 | STDCALL + 131 | STATIC + + 132 if_directive: "Variable" _is _not DEFINED + 133 | "Variable" _is _not SET + 134 | "Variable" _is _not condition_clause object_id + 135 | "Literal" _is _not condition_clause object_id + 136 | garbage + + 137 garbage: variable_or_literal + 138 | garbage variable_or_literal + 139 | garbage error + + 140 variable_or_literal: "Variable" + 141 | "Literal" + + 142 object_id: "Literal" + 143 | "Variable" + + 144 condition_clause: GREATER _than OR EQUAL _to + 145 | GREATER _than + 146 | LESS _than OR EQUAL _to + 147 | LESS _than + 148 | EQUAL _to + 149 | ">=" + 150 | ">" + 151 | "<=" + 152 | "<" + 153 | "=" + 154 | "<>" + + 155 copy_statement: COPY copy_source _copy_in _copy_suppress _copy_replacing "." + 156 | COPY error "." + + 157 copy_source: "Word or Literal" + 158 | "Text-Name" + + 159 _copy_in: ε + 160 | in_or_of copy_source + + 161 in_or_of: IN + 162 | OF + + 163 _copy_suppress: ε + 164 | SUPPRESS _printing + + 165 _copy_replacing: ε + 166 | REPLACING replacing_list + + 167 replace_statement_with_dot: replace_statement "." + 168 | replace_statement error "." + + 169 replace_statement: REPLACE _also replacing_list + 170 | REPLACE _last OFF + + 171 replacing_list: text_src BY text_dst + 172 | lead_trail text_partial_src BY text_partial_dst + 173 | replacing_list text_src BY text_dst + 174 | replacing_list lead_trail text_partial_src BY text_partial_dst + + 175 text_src: "==" token_list "==" + 176 | identifier + + 177 text_dst: "==" "==" + 178 | "==" token_list "==" + 179 | identifier + 180 | IN + 181 | OF + + 182 text_partial_src: "==" "Word or Literal" "==" + 183 | "Word or Literal" + + 184 text_partial_dst: "==" "==" + 185 | "==" "Word or Literal" "==" + 186 | "Word or Literal" + + 187 token_list: "Word or Literal" + 188 | token_list "Word or Literal" + + 189 identifier: "Word or Literal" + 190 | identifier IN "Word or Literal" + 191 | identifier OF "Word or Literal" + 192 | identifier '(' subscripts ')' + + 193 subscripts: "Word or Literal" + 194 | subscripts "Word or Literal" + + 195 lead_trail: LEADING + 196 | TRAILING + + 197 unquoted_literal: "Literal" + + 198 _override: ε + 199 | OVERRIDE + + 200 _not: ε + 201 | NOT + + 202 _also: ε + 203 | ALSO + + 204 _last: ε + 205 | LAST + + 206 _as: ε + 207 | AS + + 208 _format: ε + 209 | FORMAT + + 210 _is: ε + 211 | IS + + 212 _printing: ε + 213 | PRINTING + + 214 _on: ε + 215 | ON + + 216 _than: ε + 217 | THAN + + 218 _to: ε + 219 | TO + + +Terminaux, suivis des règles où ils apparaissent + + "end of file" (0) 0 + '(' (40) 192 + ')' (41) 192 + error (256) 36 38 67 139 156 168 + ALSO (258) 203 + BY (259) 80 171 172 173 174 + COPY (260) 155 156 + "==" (261) 175 177 178 182 184 185 + IN (262) 161 180 190 + LAST (263) 205 + LEADING (264) 195 + OF (265) 162 181 191 + OFF (266) 84 91 100 115 121 170 + PRINTING (267) 213 + REPLACE (268) 169 170 + REPLACING (269) 166 + SUPPRESS (270) 164 + TRAILING (271) 196 + "." (272) 1 6 7 8 112 155 156 167 168 + "word" (273) + LISTING_DIRECTIVE (274) 25 + LISTING_STATEMENT (275) 101 + TITLE_STATEMENT (276) 102 + COBOL_WORDS_DIRECTIVE (277) 21 + EQUATE (278) 94 + UNDEFINE (279) 95 + SUBSTITUTE (280) 96 + RESERVE (281) 97 + CONTROL_STATEMENT (282) 18 + SOURCE (283) 105 + NOSOURCE (284) 106 + LIST (285) 107 + NOLIST (286) 108 + MAP (287) 109 + NOMAP (288) 110 + LEAP_SECOND_DIRECTIVE (289) 26 + "CONTROL DIVISION" (290) 1 + "SUBSTITUTION SECTION" (291) 7 8 + SOURCE_DIRECTIVE (292) 19 + FORMAT (293) 209 + IS (294) 211 + CALL_DIRECTIVE (295) 34 + COBOL (296) 128 + "EXTERN" (297) 129 + STDCALL (298) 130 + STATIC (299) 131 + DEFINE_DIRECTIVE (300) 20 + AS (301) 207 + PARAMETER (302) 90 + OVERRIDE (303) 64 199 + REFMOD_DIRECTIVE (304) 23 + SET_DIRECTIVE (305) 22 + ADDRSV (306) 43 + ADDSYN (307) 44 + AREACHECK (308) 45 + NOAREACHECK (309) 55 + ASSIGN (310) 46 + BOUND (311) 47 + CALLFH (312) 48 49 + CHECKNUM (313) 50 + COMP1 (314) 51 + CONSTANT (315) 41 92 + "DPC-IN-DATA" (316) 52 + FOLDCOPYNAME (317) 53 + MAKESYN (318) 54 + NOBOUND (319) 56 + NOCHECKNUM (320) 57 + "NODPC-IN-DATA" (321) 58 + NOFOLDCOPYNAME (322) 59 + NOODOSLIDE (323) 60 + NOSPZERO (324) 61 + NOSSRANGE (325) 62 + ODOSLIDE (326) 63 + REMOVE (327) 65 + SOURCEFORMAT (328) 66 67 + SPZERO (329) 68 + SSRANGE (330) 69 + IF_DIRECTIVE (331) 28 + ELSE_DIRECTIVE (332) 31 + ENDIF_DIRECTIVE (333) 32 + ELIF_DIRECTIVE (334) 30 + ">=" (335) 149 + "<=" (336) 151 + "<" (337) 152 + ">" (338) 150 + "=" (339) 74 153 + "<>" (340) 154 + NOT (341) 201 + THAN (342) 217 + TO (343) 219 + OR (344) 144 146 + EQUAL (345) 144 146 148 + GREATER (346) 144 145 + LESS (347) 146 147 + SET (348) 133 + DEFINED (349) 132 + TURN_DIRECTIVE (350) 24 + ON (351) 99 114 120 122 215 + CHECKING (352) 116 + WITH (353) 77 124 + LOCATION (354) 124 125 + "end of line" (355) 16 18 102 + "Word or Literal" (356) 157 182 183 185 186 187 188 189 190 191 193 194 + "Text-Name" (357) 158 + "Variable" (358) 41 42 85 89 90 91 92 117 118 132 133 134 140 143 + "Literal" (359) 41 70 71 74 77 80 82 86 88 89 92 102 135 141 142 197 + + +Non-terminaux, suivis des règles où ils apparaissent + + $accept (107) + à gauche: 0 + program_structure (108) + à gauche: 1 2 + à droite: 0 + program_with_control_division (109) + à gauche: 3 4 5 6 + à droite: 1 + control_division_no_replace (110) + à gauche: 7 + à droite: 4 5 + control_division_with_replace (111) + à gauche: 8 + à droite: 6 + statement_list (112) + à gauche: 9 10 + à droite: 2 3 4 10 + statement_no_replace_list (113) + à gauche: 11 12 + à droite: 6 12 + statement (114) + à gauche: 13 14 + à droite: 10 + statement_no_replace (115) + à gauche: 15 16 17 18 + à droite: 4 12 13 + directive (116) + à gauche: 19 20 21 22 23 24 25 26 28 30 31 32 34 + à droite: 16 + $@1 (117) + à gauche: 27 + à droite: 28 + $@2 (118) + à gauche: 29 + à droite: 30 + $@3 (119) + à gauche: 33 + à droite: 34 + if_directive_if (120) + à gauche: 35 36 + à droite: 28 + if_directive_elif (121) + à gauche: 37 38 + à droite: 30 + set_directive (122) + à gauche: 39 40 + à droite: 22 40 + set_choice (123) + à gauche: 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 + à droite: 39 40 + alnum_list (124) + à gauche: 70 71 + à droite: 43 65 71 95 97 + alnum_equality_list (125) + à gauche: 72 73 + à droite: 64 73 + alnum_equality (126) + à gauche: 74 + à droite: 44 54 72 73 + alnum_with_list (127) + à gauche: 75 76 + à droite: 76 94 + alnum_with (128) + à gauche: 77 + à droite: 75 76 + alnum_by_list (129) + à gauche: 78 79 + à droite: 79 96 + alnum_by (130) + à gauche: 80 + à droite: 78 79 + set_options (131) + à gauche: 81 82 + à droite: 42 + refmod_directive (132) + à gauche: 83 84 + à droite: 23 + source_directive (133) + à gauche: 85 86 + à droite: 19 + _literal (134) + à gauche: 87 88 + à droite: 69 + define_directive (135) + à gauche: 89 90 91 92 93 + à droite: 20 + cobol_words_directive (136) + à gauche: 94 95 96 97 + à droite: 21 + listing_directive (137) + à gauche: 98 99 100 + à droite: 25 + listing_statement (138) + à gauche: 101 102 + à droite: 17 + control_options (139) + à gauche: 103 104 + à droite: 18 104 + control_option (140) + à gauche: 105 106 107 108 109 110 + à droite: 103 104 + _dot (141) + à gauche: 111 112 + à droite: 18 102 + leap_second_directive (142) + à gauche: 113 114 115 + à droite: 26 + turn_directive (143) + à gauche: 116 + à droite: 24 + ec_list (144) + à gauche: 117 118 + à droite: 116 118 + on_or_off (145) + à gauche: 119 120 121 + à droite: 116 + on_with_loc (146) + à gauche: 122 123 + à droite: 119 + with_loc (147) + à gauche: 124 125 + à droite: 122 123 + call_directive (148) + à gauche: 126 127 + à droite: 34 127 + call_choice (149) + à gauche: 128 129 130 131 + à droite: 126 127 + if_directive (150) + à gauche: 132 133 134 135 136 + à droite: 35 37 + garbage (151) + à gauche: 137 138 139 + à droite: 136 138 139 + variable_or_literal (152) + à gauche: 140 141 + à droite: 93 137 138 + object_id (153) + à gauche: 142 143 + à droite: 134 135 + condition_clause (154) + à gauche: 144 145 146 147 148 149 150 151 152 153 154 + à droite: 134 135 + copy_statement (155) + à gauche: 155 156 + à droite: 15 + copy_source (156) + à gauche: 157 158 + à droite: 155 160 + _copy_in (157) + à gauche: 159 160 + à droite: 155 + in_or_of (158) + à gauche: 161 162 + à droite: 160 + _copy_suppress (159) + à gauche: 163 164 + à droite: 155 + _copy_replacing (160) + à gauche: 165 166 + à droite: 155 + replace_statement_with_dot (161) + à gauche: 167 168 + à droite: 14 + replace_statement (162) + à gauche: 169 170 + à droite: 8 167 168 + replacing_list (163) + à gauche: 171 172 173 174 + à droite: 166 169 173 174 + text_src

(164) + à gauche: 175 176 + à droite: 171 173 + text_dst (165) + à gauche: 177 178 179 180 181 + à droite: 171 173 + text_partial_src

(166) + à gauche: 182 183 + à droite: 172 174 + text_partial_dst (167) + à gauche: 184 185 186 + à droite: 172 174 + token_list (168) + à gauche: 187 188 + à droite: 175 178 188 + identifier (169) + à gauche: 189 190 191 192 + à droite: 176 179 190 191 192 + subscripts (170) + à gauche: 193 194 + à droite: 192 194 + lead_trail (171) + à gauche: 195 196 + à droite: 172 174 + unquoted_literal (172) + à gauche: 197 + à droite: 46 48 51 52 53 66 + _override (173) + à gauche: 198 199 + à droite: 89 90 92 + _not (174) + à gauche: 200 201 + à droite: 132 133 134 135 + _also (175) + à gauche: 202 203 + à droite: 169 + _last (176) + à gauche: 204 205 + à droite: 170 + _as (177) + à gauche: 206 207 + à droite: 53 66 67 82 89 90 91 92 + _format (178) + à gauche: 208 209 + à droite: 85 86 + _is (179) + à gauche: 210 211 + à droite: 85 86 132 133 134 135 + _printing (180) + à gauche: 212 213 + à droite: 164 + _on (181) + à gauche: 214 215 + à droite: 83 + _than (182) + à gauche: 216 217 + à droite: 144 145 146 147 + _to (183) + à gauche: 218 219 + à droite: 144 146 148 + + +État 0 + + 0 $accept: • program_structure "end of file" + + "CONTROL DIVISION" décalage et aller à l'état 1 + + $défaut réduction par utilisation de la règle 9 (statement_list) + + program_structure aller à l'état 2 + statement_list aller à l'état 3 + + +État 1 + + 1 program_structure: "CONTROL DIVISION" • "." program_with_control_division + + "." décalage et aller à l'état 4 + + +État 2 + + 0 $accept: program_structure • "end of file" + + "end of file" décalage et aller à l'état 5 + + +État 3 + + 2 program_structure: statement_list • + 10 statement_list: statement_list • statement + + COPY décalage et aller à l'état 6 + REPLACE décalage et aller à l'état 7 + LISTING_DIRECTIVE décalage et aller à l'état 8 + LISTING_STATEMENT décalage et aller à l'état 9 + TITLE_STATEMENT décalage et aller à l'état 10 + COBOL_WORDS_DIRECTIVE décalage et aller à l'état 11 + CONTROL_STATEMENT décalage et aller à l'état 12 + LEAP_SECOND_DIRECTIVE décalage et aller à l'état 13 + SOURCE_DIRECTIVE décalage et aller à l'état 14 + CALL_DIRECTIVE décalage et aller à l'état 15 + DEFINE_DIRECTIVE décalage et aller à l'état 16 + REFMOD_DIRECTIVE décalage et aller à l'état 17 + SET_DIRECTIVE décalage et aller à l'état 18 + IF_DIRECTIVE décalage et aller à l'état 19 + ELSE_DIRECTIVE décalage et aller à l'état 20 + ENDIF_DIRECTIVE décalage et aller à l'état 21 + ELIF_DIRECTIVE décalage et aller à l'état 22 + TURN_DIRECTIVE décalage et aller à l'état 23 + + $défaut réduction par utilisation de la règle 2 (program_structure) + + statement aller à l'état 24 + statement_no_replace aller à l'état 25 + directive aller à l'état 26 + listing_statement aller à l'état 27 + copy_statement aller à l'état 28 + replace_statement_with_dot aller à l'état 29 + replace_statement aller à l'état 30 + + +État 4 + + 1 program_structure: "CONTROL DIVISION" "." • program_with_control_division + + "SUBSTITUTION SECTION" décalage et aller à l'état 31 + + $défaut réduction par utilisation de la règle 9 (statement_list) + + program_with_control_division aller à l'état 32 + control_division_no_replace aller à l'état 33 + control_division_with_replace aller à l'état 34 + statement_list aller à l'état 35 + + +État 5 + + 0 $accept: program_structure "end of file" • + + $défaut accepter + + +État 6 + + 155 copy_statement: COPY • copy_source _copy_in _copy_suppress _copy_replacing "." + 156 | COPY • error "." + + error décalage et aller à l'état 36 + "Word or Literal" décalage et aller à l'état 37 + "Text-Name" décalage et aller à l'état 38 + + copy_source aller à l'état 39 + + +État 7 + + 169 replace_statement: REPLACE • _also replacing_list + 170 | REPLACE • _last OFF + + ALSO décalage et aller à l'état 40 + LAST décalage et aller à l'état 41 + + OFF réduction par utilisation de la règle 204 (_last) + $défaut réduction par utilisation de la règle 202 (_also) + + _also aller à l'état 42 + _last aller à l'état 43 + + +État 8 + + 25 directive: LISTING_DIRECTIVE • listing_directive + + OFF décalage et aller à l'état 44 + ON décalage et aller à l'état 45 + + $défaut réduction par utilisation de la règle 98 (listing_directive) + + listing_directive aller à l'état 46 + + +État 9 + + 101 listing_statement: LISTING_STATEMENT • + + $défaut réduction par utilisation de la règle 101 (listing_statement) + + +État 10 + + 102 listing_statement: TITLE_STATEMENT • "Literal" _dot "end of line" + + "Literal" décalage et aller à l'état 47 + + +État 11 + + 21 directive: COBOL_WORDS_DIRECTIVE • cobol_words_directive + + EQUATE décalage et aller à l'état 48 + UNDEFINE décalage et aller à l'état 49 + SUBSTITUTE décalage et aller à l'état 50 + RESERVE décalage et aller à l'état 51 + + cobol_words_directive aller à l'état 52 + + +État 12 + + 18 statement_no_replace: CONTROL_STATEMENT • control_options _dot "end of line" + + SOURCE décalage et aller à l'état 53 + NOSOURCE décalage et aller à l'état 54 + LIST décalage et aller à l'état 55 + NOLIST décalage et aller à l'état 56 + MAP décalage et aller à l'état 57 + NOMAP décalage et aller à l'état 58 + + control_options aller à l'état 59 + control_option aller à l'état 60 + + +État 13 + + 26 directive: LEAP_SECOND_DIRECTIVE • leap_second_directive + + OFF décalage et aller à l'état 61 + ON décalage et aller à l'état 62 + + $défaut réduction par utilisation de la règle 113 (leap_second_directive) + + leap_second_directive aller à l'état 63 + + +État 14 + + 19 directive: SOURCE_DIRECTIVE • source_directive + + FORMAT décalage et aller à l'état 64 + + $défaut réduction par utilisation de la règle 208 (_format) + + source_directive aller à l'état 65 + _format aller à l'état 66 + + +État 15 + + 34 directive: CALL_DIRECTIVE • $@3 call_directive + + $défaut réduction par utilisation de la règle 33 ($@3) + + $@3 aller à l'état 67 + + +État 16 + + 20 directive: DEFINE_DIRECTIVE • define_directive + + CONSTANT décalage et aller à l'état 68 + "Variable" décalage et aller à l'état 69 + "Literal" décalage et aller à l'état 70 + + define_directive aller à l'état 71 + variable_or_literal aller à l'état 72 + + +État 17 + + 23 directive: REFMOD_DIRECTIVE • refmod_directive + + OFF décalage et aller à l'état 73 + ON décalage et aller à l'état 74 + + $défaut réduction par utilisation de la règle 214 (_on) + + refmod_directive aller à l'état 75 + _on aller à l'état 76 + + +État 18 + + 22 directive: SET_DIRECTIVE • set_directive + + OVERRIDE décalage et aller à l'état 77 + ADDRSV décalage et aller à l'état 78 + ADDSYN décalage et aller à l'état 79 + AREACHECK décalage et aller à l'état 80 + NOAREACHECK décalage et aller à l'état 81 + ASSIGN décalage et aller à l'état 82 + BOUND décalage et aller à l'état 83 + CALLFH décalage et aller à l'état 84 + CHECKNUM décalage et aller à l'état 85 + COMP1 décalage et aller à l'état 86 + CONSTANT décalage et aller à l'état 87 + "DPC-IN-DATA" décalage et aller à l'état 88 + FOLDCOPYNAME décalage et aller à l'état 89 + MAKESYN décalage et aller à l'état 90 + NOBOUND décalage et aller à l'état 91 + NOCHECKNUM décalage et aller à l'état 92 + "NODPC-IN-DATA" décalage et aller à l'état 93 + NOFOLDCOPYNAME décalage et aller à l'état 94 + NOODOSLIDE décalage et aller à l'état 95 + NOSPZERO décalage et aller à l'état 96 + NOSSRANGE décalage et aller à l'état 97 + ODOSLIDE décalage et aller à l'état 98 + REMOVE décalage et aller à l'état 99 + SOURCEFORMAT décalage et aller à l'état 100 + SPZERO décalage et aller à l'état 101 + SSRANGE décalage et aller à l'état 102 + "Variable" décalage et aller à l'état 103 + + set_directive aller à l'état 104 + set_choice aller à l'état 105 + + +État 19 + + 28 directive: IF_DIRECTIVE • $@1 if_directive_if + + $défaut réduction par utilisation de la règle 27 ($@1) + + $@1 aller à l'état 106 + + +État 20 + + 31 directive: ELSE_DIRECTIVE • + + $défaut réduction par utilisation de la règle 31 (directive) + + +État 21 + + 32 directive: ENDIF_DIRECTIVE • + + $défaut réduction par utilisation de la règle 32 (directive) + + +État 22 + + 30 directive: ELIF_DIRECTIVE • $@2 if_directive_elif + + $défaut réduction par utilisation de la règle 29 ($@2) + + $@2 aller à l'état 107 + + +État 23 + + 24 directive: TURN_DIRECTIVE • turn_directive + + "Variable" décalage et aller à l'état 108 + + turn_directive aller à l'état 109 + ec_list aller à l'état 110 + + +État 24 + + 10 statement_list: statement_list statement • + + $défaut réduction par utilisation de la règle 10 (statement_list) + + +État 25 + + 13 statement: statement_no_replace • + + $défaut réduction par utilisation de la règle 13 (statement) + + +État 26 + + 16 statement_no_replace: directive • "end of line" + + "end of line" décalage et aller à l'état 111 + + +État 27 + + 17 statement_no_replace: listing_statement • + + $défaut réduction par utilisation de la règle 17 (statement_no_replace) + + +État 28 + + 15 statement_no_replace: copy_statement • + + $défaut réduction par utilisation de la règle 15 (statement_no_replace) + + +État 29 + + 14 statement: replace_statement_with_dot • + + $défaut réduction par utilisation de la règle 14 (statement) + + +État 30 + + 167 replace_statement_with_dot: replace_statement • "." + 168 | replace_statement • error "." + + error décalage et aller à l'état 112 + "." décalage et aller à l'état 113 + + +État 31 + + 7 control_division_no_replace: "SUBSTITUTION SECTION" • "." + 8 control_division_with_replace: "SUBSTITUTION SECTION" • "." replace_statement + + "." décalage et aller à l'état 114 + + +État 32 + + 1 program_structure: "CONTROL DIVISION" "." program_with_control_division • + + $défaut réduction par utilisation de la règle 1 (program_structure) + + +État 33 + + 4 program_with_control_division: control_division_no_replace • statement_no_replace statement_list + 5 | control_division_no_replace • + + COPY décalage et aller à l'état 6 + LISTING_DIRECTIVE décalage et aller à l'état 8 + LISTING_STATEMENT décalage et aller à l'état 9 + TITLE_STATEMENT décalage et aller à l'état 10 + COBOL_WORDS_DIRECTIVE décalage et aller à l'état 11 + CONTROL_STATEMENT décalage et aller à l'état 12 + LEAP_SECOND_DIRECTIVE décalage et aller à l'état 13 + SOURCE_DIRECTIVE décalage et aller à l'état 14 + CALL_DIRECTIVE décalage et aller à l'état 15 + DEFINE_DIRECTIVE décalage et aller à l'état 16 + REFMOD_DIRECTIVE décalage et aller à l'état 17 + SET_DIRECTIVE décalage et aller à l'état 18 + IF_DIRECTIVE décalage et aller à l'état 19 + ELSE_DIRECTIVE décalage et aller à l'état 20 + ENDIF_DIRECTIVE décalage et aller à l'état 21 + ELIF_DIRECTIVE décalage et aller à l'état 22 + TURN_DIRECTIVE décalage et aller à l'état 23 + + $défaut réduction par utilisation de la règle 5 (program_with_control_division) + + statement_no_replace aller à l'état 115 + directive aller à l'état 26 + listing_statement aller à l'état 27 + copy_statement aller à l'état 28 + + +État 34 + + 6 program_with_control_division: control_division_with_replace • "." statement_no_replace_list + + "." décalage et aller à l'état 116 + + +État 35 + + 3 program_with_control_division: statement_list • + 10 statement_list: statement_list • statement + + COPY décalage et aller à l'état 6 + REPLACE décalage et aller à l'état 7 + LISTING_DIRECTIVE décalage et aller à l'état 8 + LISTING_STATEMENT décalage et aller à l'état 9 + TITLE_STATEMENT décalage et aller à l'état 10 + COBOL_WORDS_DIRECTIVE décalage et aller à l'état 11 + CONTROL_STATEMENT décalage et aller à l'état 12 + LEAP_SECOND_DIRECTIVE décalage et aller à l'état 13 + SOURCE_DIRECTIVE décalage et aller à l'état 14 + CALL_DIRECTIVE décalage et aller à l'état 15 + DEFINE_DIRECTIVE décalage et aller à l'état 16 + REFMOD_DIRECTIVE décalage et aller à l'état 17 + SET_DIRECTIVE décalage et aller à l'état 18 + IF_DIRECTIVE décalage et aller à l'état 19 + ELSE_DIRECTIVE décalage et aller à l'état 20 + ENDIF_DIRECTIVE décalage et aller à l'état 21 + ELIF_DIRECTIVE décalage et aller à l'état 22 + TURN_DIRECTIVE décalage et aller à l'état 23 + + $défaut réduction par utilisation de la règle 3 (program_with_control_division) + + statement aller à l'état 24 + statement_no_replace aller à l'état 25 + directive aller à l'état 26 + listing_statement aller à l'état 27 + copy_statement aller à l'état 28 + replace_statement_with_dot aller à l'état 29 + replace_statement aller à l'état 30 + + +État 36 + + 156 copy_statement: COPY error • "." + + "." décalage et aller à l'état 117 + + +État 37 + + 157 copy_source: "Word or Literal" • + + $défaut réduction par utilisation de la règle 157 (copy_source) + + +État 38 + + 158 copy_source: "Text-Name" • + + $défaut réduction par utilisation de la règle 158 (copy_source) + + +État 39 + + 155 copy_statement: COPY copy_source • _copy_in _copy_suppress _copy_replacing "." + + IN décalage et aller à l'état 118 + OF décalage et aller à l'état 119 + + $défaut réduction par utilisation de la règle 159 (_copy_in) + + _copy_in aller à l'état 120 + in_or_of aller à l'état 121 + + +État 40 + + 203 _also: ALSO • + + $défaut réduction par utilisation de la règle 203 (_also) + + +État 41 + + 205 _last: LAST • + + $défaut réduction par utilisation de la règle 205 (_last) + + +État 42 + + 169 replace_statement: REPLACE _also • replacing_list + + "==" décalage et aller à l'état 122 + LEADING décalage et aller à l'état 123 + TRAILING décalage et aller à l'état 124 + "Word or Literal" décalage et aller à l'état 125 + + replacing_list aller à l'état 126 + text_src aller à l'état 127 + identifier aller à l'état 128 + lead_trail aller à l'état 129 + + +État 43 + + 170 replace_statement: REPLACE _last • OFF + + OFF décalage et aller à l'état 130 + + +État 44 + + 100 listing_directive: OFF • + + $défaut réduction par utilisation de la règle 100 (listing_directive) + + +État 45 + + 99 listing_directive: ON • + + $défaut réduction par utilisation de la règle 99 (listing_directive) + + +État 46 + + 25 directive: LISTING_DIRECTIVE listing_directive • + + $défaut réduction par utilisation de la règle 25 (directive) + + +État 47 + + 102 listing_statement: TITLE_STATEMENT "Literal" • _dot "end of line" + + "." décalage et aller à l'état 131 + + $défaut réduction par utilisation de la règle 111 (_dot) + + _dot aller à l'état 132 + + +État 48 + + 94 cobol_words_directive: EQUATE • alnum_with_list + + "Literal" décalage et aller à l'état 133 + + alnum_with_list aller à l'état 134 + alnum_with aller à l'état 135 + + +État 49 + + 95 cobol_words_directive: UNDEFINE • alnum_list + + "Literal" décalage et aller à l'état 136 + + alnum_list aller à l'état 137 + + +État 50 + + 96 cobol_words_directive: SUBSTITUTE • alnum_by_list + + "Literal" décalage et aller à l'état 138 + + alnum_by_list aller à l'état 139 + alnum_by aller à l'état 140 + + +État 51 + + 97 cobol_words_directive: RESERVE • alnum_list + + "Literal" décalage et aller à l'état 136 + + alnum_list aller à l'état 141 + + +État 52 + + 21 directive: COBOL_WORDS_DIRECTIVE cobol_words_directive • + + $défaut réduction par utilisation de la règle 21 (directive) + + +État 53 + + 105 control_option: SOURCE • + + $défaut réduction par utilisation de la règle 105 (control_option) + + +État 54 + + 106 control_option: NOSOURCE • + + $défaut réduction par utilisation de la règle 106 (control_option) + + +État 55 + + 107 control_option: LIST • + + $défaut réduction par utilisation de la règle 107 (control_option) + + +État 56 + + 108 control_option: NOLIST • + + $défaut réduction par utilisation de la règle 108 (control_option) + + +État 57 + + 109 control_option: MAP • + + $défaut réduction par utilisation de la règle 109 (control_option) + + +État 58 + + 110 control_option: NOMAP • + + $défaut réduction par utilisation de la règle 110 (control_option) + + +État 59 + + 18 statement_no_replace: CONTROL_STATEMENT control_options • _dot "end of line" + 104 control_options: control_options • control_option + + "." décalage et aller à l'état 131 + SOURCE décalage et aller à l'état 53 + NOSOURCE décalage et aller à l'état 54 + LIST décalage et aller à l'état 55 + NOLIST décalage et aller à l'état 56 + MAP décalage et aller à l'état 57 + NOMAP décalage et aller à l'état 58 + + $défaut réduction par utilisation de la règle 111 (_dot) + + control_option aller à l'état 142 + _dot aller à l'état 143 + + +État 60 + + 103 control_options: control_option • + + $défaut réduction par utilisation de la règle 103 (control_options) + + +État 61 + + 115 leap_second_directive: OFF • + + $défaut réduction par utilisation de la règle 115 (leap_second_directive) + + +État 62 + + 114 leap_second_directive: ON • + + $défaut réduction par utilisation de la règle 114 (leap_second_directive) + + +État 63 + + 26 directive: LEAP_SECOND_DIRECTIVE leap_second_directive • + + $défaut réduction par utilisation de la règle 26 (directive) + + +État 64 + + 209 _format: FORMAT • + + $défaut réduction par utilisation de la règle 209 (_format) + + +État 65 + + 19 directive: SOURCE_DIRECTIVE source_directive • + + $défaut réduction par utilisation de la règle 19 (directive) + + +État 66 + + 85 source_directive: _format • _is "Variable" + 86 | _format • _is "Literal" + + IS décalage et aller à l'état 144 + + $défaut réduction par utilisation de la règle 210 (_is) + + _is aller à l'état 145 + + +État 67 + + 34 directive: CALL_DIRECTIVE $@3 • call_directive + + COBOL décalage et aller à l'état 146 + "EXTERN" décalage et aller à l'état 147 + STDCALL décalage et aller à l'état 148 + STATIC décalage et aller à l'état 149 + + call_directive aller à l'état 150 + call_choice aller à l'état 151 + + +État 68 + + 92 define_directive: CONSTANT • "Variable" _as "Literal" _override + + "Variable" décalage et aller à l'état 152 + + +État 69 + + 89 define_directive: "Variable" • _as "Literal" _override + 90 | "Variable" • _as PARAMETER _override + 91 | "Variable" • _as OFF + 140 variable_or_literal: "Variable" • + + AS décalage et aller à l'état 153 + + "end of line" réduction par utilisation de la règle 140 (variable_or_literal) + $défaut réduction par utilisation de la règle 206 (_as) + + _as aller à l'état 154 + + +État 70 + + 141 variable_or_literal: "Literal" • + + $défaut réduction par utilisation de la règle 141 (variable_or_literal) + + +État 71 + + 20 directive: DEFINE_DIRECTIVE define_directive • + + $défaut réduction par utilisation de la règle 20 (directive) + + +État 72 + + 93 define_directive: variable_or_literal • + + $défaut réduction par utilisation de la règle 93 (define_directive) + + +État 73 + + 84 refmod_directive: OFF • + + $défaut réduction par utilisation de la règle 84 (refmod_directive) + + +État 74 + + 215 _on: ON • + + $défaut réduction par utilisation de la règle 215 (_on) + + +État 75 + + 23 directive: REFMOD_DIRECTIVE refmod_directive • + + $défaut réduction par utilisation de la règle 23 (directive) + + +État 76 + + 83 refmod_directive: _on • + + $défaut réduction par utilisation de la règle 83 (refmod_directive) + + +État 77 + + 64 set_choice: OVERRIDE • alnum_equality_list + + "Literal" décalage et aller à l'état 155 + + alnum_equality_list aller à l'état 156 + alnum_equality aller à l'état 157 + + +État 78 + + 43 set_choice: ADDRSV • alnum_list + + "Literal" décalage et aller à l'état 136 + + alnum_list aller à l'état 158 + + +État 79 + + 44 set_choice: ADDSYN • alnum_equality + + "Literal" décalage et aller à l'état 155 + + alnum_equality aller à l'état 159 + + +État 80 + + 45 set_choice: AREACHECK • + + $défaut réduction par utilisation de la règle 45 (set_choice) + + +État 81 + + 55 set_choice: NOAREACHECK • + + $défaut réduction par utilisation de la règle 55 (set_choice) + + +État 82 + + 46 set_choice: ASSIGN • unquoted_literal + + "Literal" décalage et aller à l'état 160 + + unquoted_literal aller à l'état 161 + + +État 83 + + 47 set_choice: BOUND • + + $défaut réduction par utilisation de la règle 47 (set_choice) + + +État 84 + + 48 set_choice: CALLFH • unquoted_literal + 49 | CALLFH • + + "Literal" décalage et aller à l'état 160 + + $défaut réduction par utilisation de la règle 49 (set_choice) + + unquoted_literal aller à l'état 162 + + +État 85 + + 50 set_choice: CHECKNUM • + + $défaut réduction par utilisation de la règle 50 (set_choice) + + +État 86 + + 51 set_choice: COMP1 • unquoted_literal + + "Literal" décalage et aller à l'état 160 + + unquoted_literal aller à l'état 163 + + +État 87 + + 41 set_choice: CONSTANT • "Variable" "Literal" + + "Variable" décalage et aller à l'état 164 + + +État 88 + + 52 set_choice: "DPC-IN-DATA" • unquoted_literal + + "Literal" décalage et aller à l'état 160 + + unquoted_literal aller à l'état 165 + + +État 89 + + 53 set_choice: FOLDCOPYNAME • _as unquoted_literal + + AS décalage et aller à l'état 153 + + $défaut réduction par utilisation de la règle 206 (_as) + + _as aller à l'état 166 + + +État 90 + + 54 set_choice: MAKESYN • alnum_equality + + "Literal" décalage et aller à l'état 155 + + alnum_equality aller à l'état 167 + + +État 91 + + 56 set_choice: NOBOUND • + + $défaut réduction par utilisation de la règle 56 (set_choice) + + +État 92 + + 57 set_choice: NOCHECKNUM • + + $défaut réduction par utilisation de la règle 57 (set_choice) + + +État 93 + + 58 set_choice: "NODPC-IN-DATA" • + + $défaut réduction par utilisation de la règle 58 (set_choice) + + +État 94 + + 59 set_choice: NOFOLDCOPYNAME • + + $défaut réduction par utilisation de la règle 59 (set_choice) + + +État 95 + + 60 set_choice: NOODOSLIDE • + + $défaut réduction par utilisation de la règle 60 (set_choice) + + +État 96 + + 61 set_choice: NOSPZERO • + + $défaut réduction par utilisation de la règle 61 (set_choice) + + +État 97 + + 62 set_choice: NOSSRANGE • + + $défaut réduction par utilisation de la règle 62 (set_choice) + + +État 98 + + 63 set_choice: ODOSLIDE • + + $défaut réduction par utilisation de la règle 63 (set_choice) + + +État 99 + + 65 set_choice: REMOVE • alnum_list + + "Literal" décalage et aller à l'état 136 + + alnum_list aller à l'état 168 + + +État 100 + + 66 set_choice: SOURCEFORMAT • _as unquoted_literal + 67 | SOURCEFORMAT • _as error + + AS décalage et aller à l'état 153 + + $défaut réduction par utilisation de la règle 206 (_as) + + _as aller à l'état 169 + + +État 101 + + 68 set_choice: SPZERO • + + $défaut réduction par utilisation de la règle 68 (set_choice) + + +État 102 + + 69 set_choice: SSRANGE • _literal + + "Literal" décalage et aller à l'état 170 + + $défaut réduction par utilisation de la règle 87 (_literal) + + _literal aller à l'état 171 + + +État 103 + + 42 set_choice: "Variable" • set_options + + AS décalage et aller à l'état 153 + + "Literal" réduction par utilisation de la règle 206 (_as) + $défaut réduction par utilisation de la règle 81 (set_options) + + set_options aller à l'état 172 + _as aller à l'état 173 + + +État 104 + + 22 directive: SET_DIRECTIVE set_directive • + 40 set_directive: set_directive • set_choice + + OVERRIDE décalage et aller à l'état 77 + ADDRSV décalage et aller à l'état 78 + ADDSYN décalage et aller à l'état 79 + AREACHECK décalage et aller à l'état 80 + NOAREACHECK décalage et aller à l'état 81 + ASSIGN décalage et aller à l'état 82 + BOUND décalage et aller à l'état 83 + CALLFH décalage et aller à l'état 84 + CHECKNUM décalage et aller à l'état 85 + COMP1 décalage et aller à l'état 86 + CONSTANT décalage et aller à l'état 87 + "DPC-IN-DATA" décalage et aller à l'état 88 + FOLDCOPYNAME décalage et aller à l'état 89 + MAKESYN décalage et aller à l'état 90 + NOBOUND décalage et aller à l'état 91 + NOCHECKNUM décalage et aller à l'état 92 + "NODPC-IN-DATA" décalage et aller à l'état 93 + NOFOLDCOPYNAME décalage et aller à l'état 94 + NOODOSLIDE décalage et aller à l'état 95 + NOSPZERO décalage et aller à l'état 96 + NOSSRANGE décalage et aller à l'état 97 + ODOSLIDE décalage et aller à l'état 98 + REMOVE décalage et aller à l'état 99 + SOURCEFORMAT décalage et aller à l'état 100 + SPZERO décalage et aller à l'état 101 + SSRANGE décalage et aller à l'état 102 + "Variable" décalage et aller à l'état 103 + + $défaut réduction par utilisation de la règle 22 (directive) + + set_choice aller à l'état 174 + + +État 105 + + 39 set_directive: set_choice • + + $défaut réduction par utilisation de la règle 39 (set_directive) + + +État 106 + + 28 directive: IF_DIRECTIVE $@1 • if_directive_if + + error décalage et aller à l'état 175 + "Variable" décalage et aller à l'état 176 + "Literal" décalage et aller à l'état 177 + + if_directive_if aller à l'état 178 + if_directive aller à l'état 179 + garbage aller à l'état 180 + variable_or_literal aller à l'état 181 + + +État 107 + + 30 directive: ELIF_DIRECTIVE $@2 • if_directive_elif + + error décalage et aller à l'état 182 + "Variable" décalage et aller à l'état 176 + "Literal" décalage et aller à l'état 177 + + if_directive_elif aller à l'état 183 + if_directive aller à l'état 184 + garbage aller à l'état 180 + variable_or_literal aller à l'état 181 + + +État 108 + + 117 ec_list: "Variable" • + + $défaut réduction par utilisation de la règle 117 (ec_list) + + +État 109 + + 24 directive: TURN_DIRECTIVE turn_directive • + + $défaut réduction par utilisation de la règle 24 (directive) + + +État 110 + + 116 turn_directive: ec_list • CHECKING on_or_off + 118 ec_list: ec_list • "Variable" + + CHECKING décalage et aller à l'état 185 + "Variable" décalage et aller à l'état 186 + + +État 111 + + 16 statement_no_replace: directive "end of line" • + + $défaut réduction par utilisation de la règle 16 (statement_no_replace) + + +État 112 + + 168 replace_statement_with_dot: replace_statement error • "." + + "." décalage et aller à l'état 187 + + +État 113 + + 167 replace_statement_with_dot: replace_statement "." • + + $défaut réduction par utilisation de la règle 167 (replace_statement_with_dot) + + +État 114 + + 7 control_division_no_replace: "SUBSTITUTION SECTION" "." • + 8 control_division_with_replace: "SUBSTITUTION SECTION" "." • replace_statement + + REPLACE décalage et aller à l'état 7 + + $défaut réduction par utilisation de la règle 7 (control_division_no_replace) + + replace_statement aller à l'état 188 + + +État 115 + + 4 program_with_control_division: control_division_no_replace statement_no_replace • statement_list + + $défaut réduction par utilisation de la règle 9 (statement_list) + + statement_list aller à l'état 189 + + +État 116 + + 6 program_with_control_division: control_division_with_replace "." • statement_no_replace_list + + $défaut réduction par utilisation de la règle 11 (statement_no_replace_list) + + statement_no_replace_list aller à l'état 190 + + +État 117 + + 156 copy_statement: COPY error "." • + + $défaut réduction par utilisation de la règle 156 (copy_statement) + + +État 118 + + 161 in_or_of: IN • + + $défaut réduction par utilisation de la règle 161 (in_or_of) + + +État 119 + + 162 in_or_of: OF • + + $défaut réduction par utilisation de la règle 162 (in_or_of) + + +État 120 + + 155 copy_statement: COPY copy_source _copy_in • _copy_suppress _copy_replacing "." + + SUPPRESS décalage et aller à l'état 191 + + $défaut réduction par utilisation de la règle 163 (_copy_suppress) + + _copy_suppress aller à l'état 192 + + +État 121 + + 160 _copy_in: in_or_of • copy_source + + "Word or Literal" décalage et aller à l'état 37 + "Text-Name" décalage et aller à l'état 38 + + copy_source aller à l'état 193 + + +État 122 + + 175 text_src: "==" • token_list "==" + + "Word or Literal" décalage et aller à l'état 194 + + token_list aller à l'état 195 + + +État 123 + + 195 lead_trail: LEADING • + + $défaut réduction par utilisation de la règle 195 (lead_trail) + + +État 124 + + 196 lead_trail: TRAILING • + + $défaut réduction par utilisation de la règle 196 (lead_trail) + + +État 125 + + 189 identifier: "Word or Literal" • + + $défaut réduction par utilisation de la règle 189 (identifier) + + +État 126 + + 169 replace_statement: REPLACE _also replacing_list • + 173 replacing_list: replacing_list • text_src BY text_dst + 174 | replacing_list • lead_trail text_partial_src BY text_partial_dst + + "==" décalage et aller à l'état 122 + LEADING décalage et aller à l'état 123 + TRAILING décalage et aller à l'état 124 + "Word or Literal" décalage et aller à l'état 125 + + $défaut réduction par utilisation de la règle 169 (replace_statement) + + text_src aller à l'état 196 + identifier aller à l'état 128 + lead_trail aller à l'état 197 + + +État 127 + + 171 replacing_list: text_src • BY text_dst + + BY décalage et aller à l'état 198 + + +État 128 + + 176 text_src: identifier • + 190 identifier: identifier • IN "Word or Literal" + 191 | identifier • OF "Word or Literal" + 192 | identifier • '(' subscripts ')' + + IN décalage et aller à l'état 199 + OF décalage et aller à l'état 200 + '(' décalage et aller à l'état 201 + + $défaut réduction par utilisation de la règle 176 (text_src) + + +État 129 + + 172 replacing_list: lead_trail • text_partial_src BY text_partial_dst + + "==" décalage et aller à l'état 202 + "Word or Literal" décalage et aller à l'état 203 + + text_partial_src aller à l'état 204 + + +État 130 + + 170 replace_statement: REPLACE _last OFF • + + $défaut réduction par utilisation de la règle 170 (replace_statement) + + +État 131 + + 112 _dot: "." • + + $défaut réduction par utilisation de la règle 112 (_dot) + + +État 132 + + 102 listing_statement: TITLE_STATEMENT "Literal" _dot • "end of line" + + "end of line" décalage et aller à l'état 205 + + +État 133 + + 77 alnum_with: "Literal" • WITH "Literal" + + WITH décalage et aller à l'état 206 + + +État 134 + + 76 alnum_with_list: alnum_with_list • alnum_with + 94 cobol_words_directive: EQUATE alnum_with_list • + + "Literal" décalage et aller à l'état 133 + + $défaut réduction par utilisation de la règle 94 (cobol_words_directive) + + alnum_with aller à l'état 207 + + +État 135 + + 75 alnum_with_list: alnum_with • + + $défaut réduction par utilisation de la règle 75 (alnum_with_list) + + +État 136 + + 70 alnum_list: "Literal" • + + $défaut réduction par utilisation de la règle 70 (alnum_list) + + +État 137 + + 71 alnum_list: alnum_list • "Literal" + 95 cobol_words_directive: UNDEFINE alnum_list • + + "Literal" décalage et aller à l'état 208 + + $défaut réduction par utilisation de la règle 95 (cobol_words_directive) + + +État 138 + + 80 alnum_by: "Literal" • BY "Literal" + + BY décalage et aller à l'état 209 + + +État 139 + + 79 alnum_by_list: alnum_by_list • alnum_by + 96 cobol_words_directive: SUBSTITUTE alnum_by_list • + + "Literal" décalage et aller à l'état 138 + + $défaut réduction par utilisation de la règle 96 (cobol_words_directive) + + alnum_by aller à l'état 210 + + +État 140 + + 78 alnum_by_list: alnum_by • + + $défaut réduction par utilisation de la règle 78 (alnum_by_list) + + +État 141 + + 71 alnum_list: alnum_list • "Literal" + 97 cobol_words_directive: RESERVE alnum_list • + + "Literal" décalage et aller à l'état 208 + + $défaut réduction par utilisation de la règle 97 (cobol_words_directive) + + +État 142 + + 104 control_options: control_options control_option • + + $défaut réduction par utilisation de la règle 104 (control_options) + + +État 143 + + 18 statement_no_replace: CONTROL_STATEMENT control_options _dot • "end of line" + + "end of line" décalage et aller à l'état 211 + + +État 144 + + 211 _is: IS • + + $défaut réduction par utilisation de la règle 211 (_is) + + +État 145 + + 85 source_directive: _format _is • "Variable" + 86 | _format _is • "Literal" + + "Variable" décalage et aller à l'état 212 + "Literal" décalage et aller à l'état 213 + + +État 146 + + 128 call_choice: COBOL • + + $défaut réduction par utilisation de la règle 128 (call_choice) + + +État 147 + + 129 call_choice: "EXTERN" • + + $défaut réduction par utilisation de la règle 129 (call_choice) + + +État 148 + + 130 call_choice: STDCALL • + + $défaut réduction par utilisation de la règle 130 (call_choice) + + +État 149 + + 131 call_choice: STATIC • + + $défaut réduction par utilisation de la règle 131 (call_choice) + + +État 150 + + 34 directive: CALL_DIRECTIVE $@3 call_directive • + 127 call_directive: call_directive • call_choice + + COBOL décalage et aller à l'état 146 + "EXTERN" décalage et aller à l'état 147 + STDCALL décalage et aller à l'état 148 + STATIC décalage et aller à l'état 149 + + $défaut réduction par utilisation de la règle 34 (directive) + + call_choice aller à l'état 214 + + +État 151 + + 126 call_directive: call_choice • + + $défaut réduction par utilisation de la règle 126 (call_directive) + + +État 152 + + 92 define_directive: CONSTANT "Variable" • _as "Literal" _override + + AS décalage et aller à l'état 153 + + $défaut réduction par utilisation de la règle 206 (_as) + + _as aller à l'état 215 + + +État 153 + + 207 _as: AS • + + $défaut réduction par utilisation de la règle 207 (_as) + + +État 154 + + 89 define_directive: "Variable" _as • "Literal" _override + 90 | "Variable" _as • PARAMETER _override + 91 | "Variable" _as • OFF + + OFF décalage et aller à l'état 216 + PARAMETER décalage et aller à l'état 217 + "Literal" décalage et aller à l'état 218 + + +État 155 + + 74 alnum_equality: "Literal" • "=" "Literal" + + "=" décalage et aller à l'état 219 + + +État 156 + + 64 set_choice: OVERRIDE alnum_equality_list • + 73 alnum_equality_list: alnum_equality_list • alnum_equality + + "Literal" décalage et aller à l'état 155 + + $défaut réduction par utilisation de la règle 64 (set_choice) + + alnum_equality aller à l'état 220 + + +État 157 + + 72 alnum_equality_list: alnum_equality • + + $défaut réduction par utilisation de la règle 72 (alnum_equality_list) + + +État 158 + + 43 set_choice: ADDRSV alnum_list • + 71 alnum_list: alnum_list • "Literal" + + "Literal" décalage et aller à l'état 208 + + $défaut réduction par utilisation de la règle 43 (set_choice) + + +État 159 + + 44 set_choice: ADDSYN alnum_equality • + + $défaut réduction par utilisation de la règle 44 (set_choice) + + +État 160 + + 197 unquoted_literal: "Literal" • + + $défaut réduction par utilisation de la règle 197 (unquoted_literal) + + +État 161 + + 46 set_choice: ASSIGN unquoted_literal • + + $défaut réduction par utilisation de la règle 46 (set_choice) + + +État 162 + + 48 set_choice: CALLFH unquoted_literal • + + $défaut réduction par utilisation de la règle 48 (set_choice) + + +État 163 + + 51 set_choice: COMP1 unquoted_literal • + + $défaut réduction par utilisation de la règle 51 (set_choice) + + +État 164 + + 41 set_choice: CONSTANT "Variable" • "Literal" + + "Literal" décalage et aller à l'état 221 + + +État 165 + + 52 set_choice: "DPC-IN-DATA" unquoted_literal • + + $défaut réduction par utilisation de la règle 52 (set_choice) + + +État 166 + + 53 set_choice: FOLDCOPYNAME _as • unquoted_literal + + "Literal" décalage et aller à l'état 160 + + unquoted_literal aller à l'état 222 + + +État 167 + + 54 set_choice: MAKESYN alnum_equality • + + $défaut réduction par utilisation de la règle 54 (set_choice) + + +État 168 + + 65 set_choice: REMOVE alnum_list • + 71 alnum_list: alnum_list • "Literal" + + "Literal" décalage et aller à l'état 208 + + $défaut réduction par utilisation de la règle 65 (set_choice) + + +État 169 + + 66 set_choice: SOURCEFORMAT _as • unquoted_literal + 67 | SOURCEFORMAT _as • error + + error décalage et aller à l'état 223 + "Literal" décalage et aller à l'état 160 + + unquoted_literal aller à l'état 224 + + +État 170 + + 88 _literal: "Literal" • + + $défaut réduction par utilisation de la règle 88 (_literal) + + +État 171 + + 69 set_choice: SSRANGE _literal • + + $défaut réduction par utilisation de la règle 69 (set_choice) + + +État 172 + + 42 set_choice: "Variable" set_options • + + $défaut réduction par utilisation de la règle 42 (set_choice) + + +État 173 + + 82 set_options: _as • "Literal" + + "Literal" décalage et aller à l'état 225 + + +État 174 + + 40 set_directive: set_directive set_choice • + + $défaut réduction par utilisation de la règle 40 (set_directive) + + +État 175 + + 36 if_directive_if: error • + + $défaut réduction par utilisation de la règle 36 (if_directive_if) + + +État 176 + + 132 if_directive: "Variable" • _is _not DEFINED + 133 | "Variable" • _is _not SET + 134 | "Variable" • _is _not condition_clause object_id + 140 variable_or_literal: "Variable" • + + IS décalage et aller à l'état 144 + + error réduction par utilisation de la règle 140 (variable_or_literal) + "end of line" réduction par utilisation de la règle 140 (variable_or_literal) + "Variable" réduction par utilisation de la règle 140 (variable_or_literal) + "Literal" réduction par utilisation de la règle 140 (variable_or_literal) + $défaut réduction par utilisation de la règle 210 (_is) + + _is aller à l'état 226 + + +État 177 + + 135 if_directive: "Literal" • _is _not condition_clause object_id + 141 variable_or_literal: "Literal" • + + IS décalage et aller à l'état 144 + + error réduction par utilisation de la règle 141 (variable_or_literal) + "end of line" réduction par utilisation de la règle 141 (variable_or_literal) + "Variable" réduction par utilisation de la règle 141 (variable_or_literal) + "Literal" réduction par utilisation de la règle 141 (variable_or_literal) + $défaut réduction par utilisation de la règle 210 (_is) + + _is aller à l'état 227 + + +État 178 + + 28 directive: IF_DIRECTIVE $@1 if_directive_if • + + $défaut réduction par utilisation de la règle 28 (directive) + + +État 179 + + 35 if_directive_if: if_directive • + + $défaut réduction par utilisation de la règle 35 (if_directive_if) + + +État 180 + + 136 if_directive: garbage • + 138 garbage: garbage • variable_or_literal + 139 | garbage • error + + error décalage et aller à l'état 228 + "Variable" décalage et aller à l'état 229 + "Literal" décalage et aller à l'état 70 + + "end of line" réduction par utilisation de la règle 136 (if_directive) + + variable_or_literal aller à l'état 230 + + +État 181 + + 137 garbage: variable_or_literal • + + $défaut réduction par utilisation de la règle 137 (garbage) + + +État 182 + + 38 if_directive_elif: error • + + $défaut réduction par utilisation de la règle 38 (if_directive_elif) + + +État 183 + + 30 directive: ELIF_DIRECTIVE $@2 if_directive_elif • + + $défaut réduction par utilisation de la règle 30 (directive) + + +État 184 + + 37 if_directive_elif: if_directive • + + $défaut réduction par utilisation de la règle 37 (if_directive_elif) + + +État 185 + + 116 turn_directive: ec_list CHECKING • on_or_off + + OFF décalage et aller à l'état 231 + ON décalage et aller à l'état 232 + WITH décalage et aller à l'état 233 + LOCATION décalage et aller à l'état 234 + + on_or_off aller à l'état 235 + on_with_loc aller à l'état 236 + with_loc aller à l'état 237 + + +État 186 + + 118 ec_list: ec_list "Variable" • + + $défaut réduction par utilisation de la règle 118 (ec_list) + + +État 187 + + 168 replace_statement_with_dot: replace_statement error "." • + + $défaut réduction par utilisation de la règle 168 (replace_statement_with_dot) + + +État 188 + + 8 control_division_with_replace: "SUBSTITUTION SECTION" "." replace_statement • + + $défaut réduction par utilisation de la règle 8 (control_division_with_replace) + + +État 189 + + 4 program_with_control_division: control_division_no_replace statement_no_replace statement_list • + 10 statement_list: statement_list • statement + + COPY décalage et aller à l'état 6 + REPLACE décalage et aller à l'état 7 + LISTING_DIRECTIVE décalage et aller à l'état 8 + LISTING_STATEMENT décalage et aller à l'état 9 + TITLE_STATEMENT décalage et aller à l'état 10 + COBOL_WORDS_DIRECTIVE décalage et aller à l'état 11 + CONTROL_STATEMENT décalage et aller à l'état 12 + LEAP_SECOND_DIRECTIVE décalage et aller à l'état 13 + SOURCE_DIRECTIVE décalage et aller à l'état 14 + CALL_DIRECTIVE décalage et aller à l'état 15 + DEFINE_DIRECTIVE décalage et aller à l'état 16 + REFMOD_DIRECTIVE décalage et aller à l'état 17 + SET_DIRECTIVE décalage et aller à l'état 18 + IF_DIRECTIVE décalage et aller à l'état 19 + ELSE_DIRECTIVE décalage et aller à l'état 20 + ENDIF_DIRECTIVE décalage et aller à l'état 21 + ELIF_DIRECTIVE décalage et aller à l'état 22 + TURN_DIRECTIVE décalage et aller à l'état 23 + + $défaut réduction par utilisation de la règle 4 (program_with_control_division) + + statement aller à l'état 24 + statement_no_replace aller à l'état 25 + directive aller à l'état 26 + listing_statement aller à l'état 27 + copy_statement aller à l'état 28 + replace_statement_with_dot aller à l'état 29 + replace_statement aller à l'état 30 + + +État 190 + + 6 program_with_control_division: control_division_with_replace "." statement_no_replace_list • + 12 statement_no_replace_list: statement_no_replace_list • statement_no_replace + + COPY décalage et aller à l'état 6 + LISTING_DIRECTIVE décalage et aller à l'état 8 + LISTING_STATEMENT décalage et aller à l'état 9 + TITLE_STATEMENT décalage et aller à l'état 10 + COBOL_WORDS_DIRECTIVE décalage et aller à l'état 11 + CONTROL_STATEMENT décalage et aller à l'état 12 + LEAP_SECOND_DIRECTIVE décalage et aller à l'état 13 + SOURCE_DIRECTIVE décalage et aller à l'état 14 + CALL_DIRECTIVE décalage et aller à l'état 15 + DEFINE_DIRECTIVE décalage et aller à l'état 16 + REFMOD_DIRECTIVE décalage et aller à l'état 17 + SET_DIRECTIVE décalage et aller à l'état 18 + IF_DIRECTIVE décalage et aller à l'état 19 + ELSE_DIRECTIVE décalage et aller à l'état 20 + ENDIF_DIRECTIVE décalage et aller à l'état 21 + ELIF_DIRECTIVE décalage et aller à l'état 22 + TURN_DIRECTIVE décalage et aller à l'état 23 + + $défaut réduction par utilisation de la règle 6 (program_with_control_division) + + statement_no_replace aller à l'état 238 + directive aller à l'état 26 + listing_statement aller à l'état 27 + copy_statement aller à l'état 28 + + +État 191 + + 164 _copy_suppress: SUPPRESS • _printing + + PRINTING décalage et aller à l'état 239 + + $défaut réduction par utilisation de la règle 212 (_printing) + + _printing aller à l'état 240 + + +État 192 + + 155 copy_statement: COPY copy_source _copy_in _copy_suppress • _copy_replacing "." + + REPLACING décalage et aller à l'état 241 + + $défaut réduction par utilisation de la règle 165 (_copy_replacing) + + _copy_replacing aller à l'état 242 + + +État 193 + + 160 _copy_in: in_or_of copy_source • + + $défaut réduction par utilisation de la règle 160 (_copy_in) + + +État 194 + + 187 token_list: "Word or Literal" • + + $défaut réduction par utilisation de la règle 187 (token_list) + + +État 195 + + 175 text_src: "==" token_list • "==" + 188 token_list: token_list • "Word or Literal" + + "==" décalage et aller à l'état 243 + "Word or Literal" décalage et aller à l'état 244 + + +État 196 + + 173 replacing_list: replacing_list text_src • BY text_dst + + BY décalage et aller à l'état 245 + + +État 197 + + 174 replacing_list: replacing_list lead_trail • text_partial_src BY text_partial_dst + + "==" décalage et aller à l'état 202 + "Word or Literal" décalage et aller à l'état 203 + + text_partial_src aller à l'état 246 + + +État 198 + + 171 replacing_list: text_src BY • text_dst + + "==" décalage et aller à l'état 247 + IN décalage et aller à l'état 248 + OF décalage et aller à l'état 249 + "Word or Literal" décalage et aller à l'état 125 + + text_dst aller à l'état 250 + identifier aller à l'état 251 + + +État 199 + + 190 identifier: identifier IN • "Word or Literal" + + "Word or Literal" décalage et aller à l'état 252 + + +État 200 + + 191 identifier: identifier OF • "Word or Literal" + + "Word or Literal" décalage et aller à l'état 253 + + +État 201 + + 192 identifier: identifier '(' • subscripts ')' + + "Word or Literal" décalage et aller à l'état 254 + + subscripts aller à l'état 255 + + +État 202 + + 182 text_partial_src: "==" • "Word or Literal" "==" + + "Word or Literal" décalage et aller à l'état 256 + + +État 203 + + 183 text_partial_src: "Word or Literal" • + + $défaut réduction par utilisation de la règle 183 (text_partial_src) + + +État 204 + + 172 replacing_list: lead_trail text_partial_src • BY text_partial_dst + + BY décalage et aller à l'état 257 + + +État 205 + + 102 listing_statement: TITLE_STATEMENT "Literal" _dot "end of line" • + + $défaut réduction par utilisation de la règle 102 (listing_statement) + + +État 206 + + 77 alnum_with: "Literal" WITH • "Literal" + + "Literal" décalage et aller à l'état 258 + + +État 207 + + 76 alnum_with_list: alnum_with_list alnum_with • + + $défaut réduction par utilisation de la règle 76 (alnum_with_list) + + +État 208 + + 71 alnum_list: alnum_list "Literal" • + + $défaut réduction par utilisation de la règle 71 (alnum_list) + + +État 209 + + 80 alnum_by: "Literal" BY • "Literal" + + "Literal" décalage et aller à l'état 259 + + +État 210 + + 79 alnum_by_list: alnum_by_list alnum_by • + + $défaut réduction par utilisation de la règle 79 (alnum_by_list) + + +État 211 + + 18 statement_no_replace: CONTROL_STATEMENT control_options _dot "end of line" • + + $défaut réduction par utilisation de la règle 18 (statement_no_replace) + + +État 212 + + 85 source_directive: _format _is "Variable" • + + $défaut réduction par utilisation de la règle 85 (source_directive) + + +État 213 + + 86 source_directive: _format _is "Literal" • + + $défaut réduction par utilisation de la règle 86 (source_directive) + + +État 214 + + 127 call_directive: call_directive call_choice • + + $défaut réduction par utilisation de la règle 127 (call_directive) + + +État 215 + + 92 define_directive: CONSTANT "Variable" _as • "Literal" _override + + "Literal" décalage et aller à l'état 260 + + +État 216 + + 91 define_directive: "Variable" _as OFF • + + $défaut réduction par utilisation de la règle 91 (define_directive) + + +État 217 + + 90 define_directive: "Variable" _as PARAMETER • _override + + OVERRIDE décalage et aller à l'état 261 + + $défaut réduction par utilisation de la règle 198 (_override) + + _override aller à l'état 262 + + +État 218 + + 89 define_directive: "Variable" _as "Literal" • _override + + OVERRIDE décalage et aller à l'état 261 + + $défaut réduction par utilisation de la règle 198 (_override) + + _override aller à l'état 263 + + +État 219 + + 74 alnum_equality: "Literal" "=" • "Literal" + + "Literal" décalage et aller à l'état 264 + + +État 220 + + 73 alnum_equality_list: alnum_equality_list alnum_equality • + + $défaut réduction par utilisation de la règle 73 (alnum_equality_list) + + +État 221 + + 41 set_choice: CONSTANT "Variable" "Literal" • + + $défaut réduction par utilisation de la règle 41 (set_choice) + + +État 222 + + 53 set_choice: FOLDCOPYNAME _as unquoted_literal • + + $défaut réduction par utilisation de la règle 53 (set_choice) + + +État 223 + + 67 set_choice: SOURCEFORMAT _as error • + + $défaut réduction par utilisation de la règle 67 (set_choice) + + +État 224 + + 66 set_choice: SOURCEFORMAT _as unquoted_literal • + + $défaut réduction par utilisation de la règle 66 (set_choice) + + +État 225 + + 82 set_options: _as "Literal" • + + $défaut réduction par utilisation de la règle 82 (set_options) + + +État 226 + + 132 if_directive: "Variable" _is • _not DEFINED + 133 | "Variable" _is • _not SET + 134 | "Variable" _is • _not condition_clause object_id + + NOT décalage et aller à l'état 265 + + $défaut réduction par utilisation de la règle 200 (_not) + + _not aller à l'état 266 + + +État 227 + + 135 if_directive: "Literal" _is • _not condition_clause object_id + + NOT décalage et aller à l'état 265 + + $défaut réduction par utilisation de la règle 200 (_not) + + _not aller à l'état 267 + + +État 228 + + 139 garbage: garbage error • + + $défaut réduction par utilisation de la règle 139 (garbage) + + +État 229 + + 140 variable_or_literal: "Variable" • + + $défaut réduction par utilisation de la règle 140 (variable_or_literal) + + +État 230 + + 138 garbage: garbage variable_or_literal • + + $défaut réduction par utilisation de la règle 138 (garbage) + + +État 231 + + 121 on_or_off: OFF • + + $défaut réduction par utilisation de la règle 121 (on_or_off) + + +État 232 + + 120 on_or_off: ON • + 122 on_with_loc: ON • with_loc + + WITH décalage et aller à l'état 233 + LOCATION décalage et aller à l'état 234 + + $défaut réduction par utilisation de la règle 120 (on_or_off) + + with_loc aller à l'état 268 + + +État 233 + + 124 with_loc: WITH • LOCATION + + LOCATION décalage et aller à l'état 269 + + +État 234 + + 125 with_loc: LOCATION • + + $défaut réduction par utilisation de la règle 125 (with_loc) + + +État 235 + + 116 turn_directive: ec_list CHECKING on_or_off • + + $défaut réduction par utilisation de la règle 116 (turn_directive) + + +État 236 + + 119 on_or_off: on_with_loc • + + $défaut réduction par utilisation de la règle 119 (on_or_off) + + +État 237 + + 123 on_with_loc: with_loc • + + $défaut réduction par utilisation de la règle 123 (on_with_loc) + + +État 238 + + 12 statement_no_replace_list: statement_no_replace_list statement_no_replace • + + $défaut réduction par utilisation de la règle 12 (statement_no_replace_list) + + +État 239 + + 213 _printing: PRINTING • + + $défaut réduction par utilisation de la règle 213 (_printing) + + +État 240 + + 164 _copy_suppress: SUPPRESS _printing • + + $défaut réduction par utilisation de la règle 164 (_copy_suppress) + + +État 241 + + 166 _copy_replacing: REPLACING • replacing_list + + "==" décalage et aller à l'état 122 + LEADING décalage et aller à l'état 123 + TRAILING décalage et aller à l'état 124 + "Word or Literal" décalage et aller à l'état 125 + + replacing_list aller à l'état 270 + text_src aller à l'état 127 + identifier aller à l'état 128 + lead_trail aller à l'état 129 + + +État 242 + + 155 copy_statement: COPY copy_source _copy_in _copy_suppress _copy_replacing • "." + + "." décalage et aller à l'état 271 + + +État 243 + + 175 text_src: "==" token_list "==" • + + $défaut réduction par utilisation de la règle 175 (text_src) + + +État 244 + + 188 token_list: token_list "Word or Literal" • + + $défaut réduction par utilisation de la règle 188 (token_list) + + +État 245 + + 173 replacing_list: replacing_list text_src BY • text_dst + + "==" décalage et aller à l'état 247 + IN décalage et aller à l'état 248 + OF décalage et aller à l'état 249 + "Word or Literal" décalage et aller à l'état 125 + + text_dst aller à l'état 272 + identifier aller à l'état 251 + + +État 246 + + 174 replacing_list: replacing_list lead_trail text_partial_src • BY text_partial_dst + + BY décalage et aller à l'état 273 + + +État 247 + + 177 text_dst: "==" • "==" + 178 | "==" • token_list "==" + + "==" décalage et aller à l'état 274 + "Word or Literal" décalage et aller à l'état 194 + + token_list aller à l'état 275 + + +État 248 + + 180 text_dst: IN • + + $défaut réduction par utilisation de la règle 180 (text_dst) + + +État 249 + + 181 text_dst: OF • + + $défaut réduction par utilisation de la règle 181 (text_dst) + + +État 250 + + 171 replacing_list: text_src BY text_dst • + + $défaut réduction par utilisation de la règle 171 (replacing_list) + + +État 251 + + 179 text_dst: identifier • + 190 identifier: identifier • IN "Word or Literal" + 191 | identifier • OF "Word or Literal" + 192 | identifier • '(' subscripts ')' + + IN décalage et aller à l'état 199 + OF décalage et aller à l'état 200 + '(' décalage et aller à l'état 201 + + $défaut réduction par utilisation de la règle 179 (text_dst) + + +État 252 + + 190 identifier: identifier IN "Word or Literal" • + + $défaut réduction par utilisation de la règle 190 (identifier) + + +État 253 + + 191 identifier: identifier OF "Word or Literal" • + + $défaut réduction par utilisation de la règle 191 (identifier) + + +État 254 + + 193 subscripts: "Word or Literal" • + + $défaut réduction par utilisation de la règle 193 (subscripts) + + +État 255 + + 192 identifier: identifier '(' subscripts • ')' + 194 subscripts: subscripts • "Word or Literal" + + "Word or Literal" décalage et aller à l'état 276 + ')' décalage et aller à l'état 277 + + +État 256 + + 182 text_partial_src: "==" "Word or Literal" • "==" + + "==" décalage et aller à l'état 278 + + +État 257 + + 172 replacing_list: lead_trail text_partial_src BY • text_partial_dst + + "==" décalage et aller à l'état 279 + "Word or Literal" décalage et aller à l'état 280 + + text_partial_dst aller à l'état 281 + + +État 258 + + 77 alnum_with: "Literal" WITH "Literal" • + + $défaut réduction par utilisation de la règle 77 (alnum_with) + + +État 259 + + 80 alnum_by: "Literal" BY "Literal" • + + $défaut réduction par utilisation de la règle 80 (alnum_by) + + +État 260 + + 92 define_directive: CONSTANT "Variable" _as "Literal" • _override + + OVERRIDE décalage et aller à l'état 261 + + $défaut réduction par utilisation de la règle 198 (_override) + + _override aller à l'état 282 + + +État 261 + + 199 _override: OVERRIDE • + + $défaut réduction par utilisation de la règle 199 (_override) + + +État 262 + + 90 define_directive: "Variable" _as PARAMETER _override • + + $défaut réduction par utilisation de la règle 90 (define_directive) + + +État 263 + + 89 define_directive: "Variable" _as "Literal" _override • + + $défaut réduction par utilisation de la règle 89 (define_directive) + + +État 264 + + 74 alnum_equality: "Literal" "=" "Literal" • + + $défaut réduction par utilisation de la règle 74 (alnum_equality) + + +État 265 + + 201 _not: NOT • + + $défaut réduction par utilisation de la règle 201 (_not) + + +État 266 + + 132 if_directive: "Variable" _is _not • DEFINED + 133 | "Variable" _is _not • SET + 134 | "Variable" _is _not • condition_clause object_id + + ">=" décalage et aller à l'état 283 + "<=" décalage et aller à l'état 284 + "<" décalage et aller à l'état 285 + ">" décalage et aller à l'état 286 + "=" décalage et aller à l'état 287 + "<>" décalage et aller à l'état 288 + EQUAL décalage et aller à l'état 289 + GREATER décalage et aller à l'état 290 + LESS décalage et aller à l'état 291 + SET décalage et aller à l'état 292 + DEFINED décalage et aller à l'état 293 + + condition_clause aller à l'état 294 + + +État 267 + + 135 if_directive: "Literal" _is _not • condition_clause object_id + + ">=" décalage et aller à l'état 283 + "<=" décalage et aller à l'état 284 + "<" décalage et aller à l'état 285 + ">" décalage et aller à l'état 286 + "=" décalage et aller à l'état 287 + "<>" décalage et aller à l'état 288 + EQUAL décalage et aller à l'état 289 + GREATER décalage et aller à l'état 290 + LESS décalage et aller à l'état 291 + + condition_clause aller à l'état 295 + + +État 268 + + 122 on_with_loc: ON with_loc • + + $défaut réduction par utilisation de la règle 122 (on_with_loc) + + +État 269 + + 124 with_loc: WITH LOCATION • + + $défaut réduction par utilisation de la règle 124 (with_loc) + + +État 270 + + 166 _copy_replacing: REPLACING replacing_list • + 173 replacing_list: replacing_list • text_src BY text_dst + 174 | replacing_list • lead_trail text_partial_src BY text_partial_dst + + "==" décalage et aller à l'état 122 + LEADING décalage et aller à l'état 123 + TRAILING décalage et aller à l'état 124 + "Word or Literal" décalage et aller à l'état 125 + + $défaut réduction par utilisation de la règle 166 (_copy_replacing) + + text_src aller à l'état 196 + identifier aller à l'état 128 + lead_trail aller à l'état 197 + + +État 271 + + 155 copy_statement: COPY copy_source _copy_in _copy_suppress _copy_replacing "." • + + $défaut réduction par utilisation de la règle 155 (copy_statement) + + +État 272 + + 173 replacing_list: replacing_list text_src BY text_dst • + + $défaut réduction par utilisation de la règle 173 (replacing_list) + + +État 273 + + 174 replacing_list: replacing_list lead_trail text_partial_src BY • text_partial_dst + + "==" décalage et aller à l'état 279 + "Word or Literal" décalage et aller à l'état 280 + + text_partial_dst aller à l'état 296 + + +État 274 + + 177 text_dst: "==" "==" • + + $défaut réduction par utilisation de la règle 177 (text_dst) + + +État 275 + + 178 text_dst: "==" token_list • "==" + 188 token_list: token_list • "Word or Literal" + + "==" décalage et aller à l'état 297 + "Word or Literal" décalage et aller à l'état 244 + + +État 276 + + 194 subscripts: subscripts "Word or Literal" • + + $défaut réduction par utilisation de la règle 194 (subscripts) + + +État 277 + + 192 identifier: identifier '(' subscripts ')' • + + $défaut réduction par utilisation de la règle 192 (identifier) + + +État 278 + + 182 text_partial_src: "==" "Word or Literal" "==" • + + $défaut réduction par utilisation de la règle 182 (text_partial_src) + + +État 279 + + 184 text_partial_dst: "==" • "==" + 185 | "==" • "Word or Literal" "==" + + "==" décalage et aller à l'état 298 + "Word or Literal" décalage et aller à l'état 299 + + +État 280 + + 186 text_partial_dst: "Word or Literal" • + + $défaut réduction par utilisation de la règle 186 (text_partial_dst) + + +État 281 + + 172 replacing_list: lead_trail text_partial_src BY text_partial_dst • + + $défaut réduction par utilisation de la règle 172 (replacing_list) + + +État 282 + + 92 define_directive: CONSTANT "Variable" _as "Literal" _override • + + $défaut réduction par utilisation de la règle 92 (define_directive) + + +État 283 + + 149 condition_clause: ">=" • + + $défaut réduction par utilisation de la règle 149 (condition_clause) + + +État 284 + + 151 condition_clause: "<=" • + + $défaut réduction par utilisation de la règle 151 (condition_clause) + + +État 285 + + 152 condition_clause: "<" • + + $défaut réduction par utilisation de la règle 152 (condition_clause) + + +État 286 + + 150 condition_clause: ">" • + + $défaut réduction par utilisation de la règle 150 (condition_clause) + + +État 287 + + 153 condition_clause: "=" • + + $défaut réduction par utilisation de la règle 153 (condition_clause) + + +État 288 + + 154 condition_clause: "<>" • + + $défaut réduction par utilisation de la règle 154 (condition_clause) + + +État 289 + + 148 condition_clause: EQUAL • _to + + TO décalage et aller à l'état 300 + + $défaut réduction par utilisation de la règle 218 (_to) + + _to aller à l'état 301 + + +État 290 + + 144 condition_clause: GREATER • _than OR EQUAL _to + 145 | GREATER • _than + + THAN décalage et aller à l'état 302 + + $défaut réduction par utilisation de la règle 216 (_than) + + _than aller à l'état 303 + + +État 291 + + 146 condition_clause: LESS • _than OR EQUAL _to + 147 | LESS • _than + + THAN décalage et aller à l'état 302 + + $défaut réduction par utilisation de la règle 216 (_than) + + _than aller à l'état 304 + + +État 292 + + 133 if_directive: "Variable" _is _not SET • + + $défaut réduction par utilisation de la règle 133 (if_directive) + + +État 293 + + 132 if_directive: "Variable" _is _not DEFINED • + + $défaut réduction par utilisation de la règle 132 (if_directive) + + +État 294 + + 134 if_directive: "Variable" _is _not condition_clause • object_id + + "Variable" décalage et aller à l'état 305 + "Literal" décalage et aller à l'état 306 + + object_id aller à l'état 307 + + +État 295 + + 135 if_directive: "Literal" _is _not condition_clause • object_id + + "Variable" décalage et aller à l'état 305 + "Literal" décalage et aller à l'état 306 + + object_id aller à l'état 308 + + +État 296 + + 174 replacing_list: replacing_list lead_trail text_partial_src BY text_partial_dst • + + $défaut réduction par utilisation de la règle 174 (replacing_list) + + +État 297 + + 178 text_dst: "==" token_list "==" • + + $défaut réduction par utilisation de la règle 178 (text_dst) + + +État 298 + + 184 text_partial_dst: "==" "==" • + + $défaut réduction par utilisation de la règle 184 (text_partial_dst) + + +État 299 + + 185 text_partial_dst: "==" "Word or Literal" • "==" + + "==" décalage et aller à l'état 309 + + +État 300 + + 219 _to: TO • + + $défaut réduction par utilisation de la règle 219 (_to) + + +État 301 + + 148 condition_clause: EQUAL _to • + + $défaut réduction par utilisation de la règle 148 (condition_clause) + + +État 302 + + 217 _than: THAN • + + $défaut réduction par utilisation de la règle 217 (_than) + + +État 303 + + 144 condition_clause: GREATER _than • OR EQUAL _to + 145 | GREATER _than • + + OR décalage et aller à l'état 310 + + $défaut réduction par utilisation de la règle 145 (condition_clause) + + +État 304 + + 146 condition_clause: LESS _than • OR EQUAL _to + 147 | LESS _than • + + OR décalage et aller à l'état 311 + + $défaut réduction par utilisation de la règle 147 (condition_clause) + + +État 305 + + 143 object_id: "Variable" • + + $défaut réduction par utilisation de la règle 143 (object_id) + + +État 306 + + 142 object_id: "Literal" • + + $défaut réduction par utilisation de la règle 142 (object_id) + + +État 307 + + 134 if_directive: "Variable" _is _not condition_clause object_id • + + $défaut réduction par utilisation de la règle 134 (if_directive) + + +État 308 + + 135 if_directive: "Literal" _is _not condition_clause object_id • + + $défaut réduction par utilisation de la règle 135 (if_directive) + + +État 309 + + 185 text_partial_dst: "==" "Word or Literal" "==" • + + $défaut réduction par utilisation de la règle 185 (text_partial_dst) + + +État 310 + + 144 condition_clause: GREATER _than OR • EQUAL _to + + EQUAL décalage et aller à l'état 312 + + +État 311 + + 146 condition_clause: LESS _than OR • EQUAL _to + + EQUAL décalage et aller à l'état 313 + + +État 312 + + 144 condition_clause: GREATER _than OR EQUAL • _to + + TO décalage et aller à l'état 300 + + $défaut réduction par utilisation de la règle 218 (_to) + + _to aller à l'état 314 + + +État 313 + + 146 condition_clause: LESS _than OR EQUAL • _to + + TO décalage et aller à l'état 300 + + $défaut réduction par utilisation de la règle 218 (_to) + + _to aller à l'état 315 + + +État 314 + + 144 condition_clause: GREATER _than OR EQUAL _to • + + $défaut réduction par utilisation de la règle 144 (condition_clause) + + +État 315 + + 146 condition_clause: LESS _than OR EQUAL _to • + + $défaut réduction par utilisation de la règle 146 (condition_clause) diff --git a/cobc/tree.c b/cobc/tree.c index a49d8aaf0..bfb5e9727 100644 --- a/cobc/tree.c +++ b/cobc/tree.c @@ -2248,6 +2248,15 @@ cb_build_program (struct cb_program *last_program, const int nest_level) p->flag_recursive = 1; } } + + /* state structure for strings */ + p->inspect_st_ref = cb_build_direct ("inspect_st", 0); + p->string_st_ref = cb_build_direct ("string_st", 0); + p->unstring_st_ref = cb_build_direct ("unstring_st", 0); + p->flag_inspect_used = 0; + p->flag_string_used = 0; + p->flag_unstring_used = 0; + return p; } diff --git a/cobc/tree.h b/cobc/tree.h index 5b1be1ba6..5d57c5997 100644 --- a/cobc/tree.h +++ b/cobc/tree.h @@ -1897,6 +1897,9 @@ struct cb_program { const char *extfh; /* CALLFH for this program */ int last_source_line; /* Line of (implicit) END PROGRAM/FUNCTION */ + cb_tree inspect_st_ref; + cb_tree string_st_ref; + cb_tree unstring_st_ref; /* Internal variables */ int loop_counter; /* Loop counters */ @@ -1945,6 +1948,9 @@ struct cb_program { unsigned int flag_void : 1; /* void return for subprogram */ unsigned int flag_decimal_comp : 1; /* program group has decimal computations */ unsigned int flag_prototype : 1; /* Is a prototype */ + unsigned int flag_inspect_used : 1; + unsigned int flag_string_used : 1; + unsigned int flag_unstring_used : 1; }; #define CB_PROGRAM(x) (CB_TREE_CAST (CB_TAG_PROGRAM, struct cb_program, x)) diff --git a/cobc/typeck.c b/cobc/typeck.c index 7a7c5434c..ed1c3dd03 100644 --- a/cobc/typeck.c +++ b/cobc/typeck.c @@ -10330,6 +10330,8 @@ emit_invalid_target_error (const enum cb_inspect_clause clause) void cb_emit_inspect (cb_tree var, cb_tree body, const enum cb_inspect_clause clause) { + cb_tree st = cb_build_direct ("inspect_st", 0); + switch (CB_TREE_TAG (var)) { case CB_TAG_REFERENCE: break; @@ -10359,13 +10361,23 @@ cb_emit_inspect (cb_tree var, cb_tree body, const enum cb_inspect_clause clause) { const cb_tree replacing_flag = clause == REPLACING_CLAUSE ? cb_int1 : cb_int0; if (clause == CONVERTING_CLAUSE || clause == TRANSFORM_STATEMENT) { - cb_emit (CB_BUILD_FUNCALL_1 ("cob_inspect_init_converting", var)); + cb_emit (CB_BUILD_FUNCALL_2 ( + "cob_inspect_init_converting_mt", + cb_build_direct ("&inspect_st", 0), + var + )); cb_emit_list (body); /* no finish here */ } else { - cb_emit (CB_BUILD_FUNCALL_2 ("cob_inspect_init", var, replacing_flag)); + current_program->flag_inspect_used = 1; + cb_emit (CB_BUILD_FUNCALL_3 ( + "cob_inspect_init_mt", + cb_build_direct ("&inspect_st", 0), + var, + replacing_flag + )); cb_emit_list (body); - cb_emit (CB_BUILD_FUNCALL_0 ("cob_inspect_finish")); + cb_emit (CB_BUILD_FUNCALL_1 ("cob_inspect_finish_mt", st)); } } return; @@ -10391,12 +10403,13 @@ cb_build_tallying_data (cb_tree x) cb_tree cb_build_tallying_characters (cb_tree l) { + cb_tree st = cb_build_direct ("inspect_st", 0); if (inspect_data == NULL) { cb_error_x (CB_TREE (current_statement), _("data name expected before %s"), "CHARACTERS"); } inspect_func = NULL; - return cb_list_add (l, CB_BUILD_FUNCALL_1 ("cob_inspect_characters", inspect_data)); + return cb_list_add (l, CB_BUILD_FUNCALL_2 ("cob_inspect_characters_mt", st, inspect_data)); } cb_tree @@ -10406,7 +10419,7 @@ cb_build_tallying_all (void) cb_error_x (CB_TREE (current_statement), _("data name expected before %s"), "ALL"); } - inspect_func = "cob_inspect_all"; + inspect_func = "cob_inspect_all_mt"; return NULL; } @@ -10417,7 +10430,7 @@ cb_build_tallying_leading (void) cb_error_x (CB_TREE (current_statement), _("data name expected before %s"), "LEADING"); } - inspect_func = "cob_inspect_leading"; + inspect_func = "cob_inspect_leading_mt"; return NULL; } @@ -10428,55 +10441,61 @@ cb_build_tallying_trailing (void) cb_error_x (CB_TREE (current_statement), _("data name expected before %s"), "TRAILING"); } - inspect_func = "cob_inspect_trailing"; + inspect_func = "cob_inspect_trailing_mt"; return NULL; } cb_tree cb_build_tallying_value (cb_tree x, cb_tree l) { + cb_tree st = cb_build_direct ("inspect_st", 0); if (inspect_func == NULL) { cb_error_x (x, _("ALL, LEADING or TRAILING expected before '%s'"), cb_name (x)); } - return cb_list_add (l, CB_BUILD_FUNCALL_2 (inspect_func, inspect_data, x)); + return cb_list_add (l, CB_BUILD_FUNCALL_3 (inspect_func, st, inspect_data, x)); } cb_tree cb_build_replacing_characters (cb_tree x, cb_tree l) { + cb_tree st = cb_build_direct ("inspect_st", 0); if (CB_LITERAL_P (x) && CB_LITERAL(x)->size != 1) { cb_error_x (CB_TREE (current_statement), _("operand has wrong size")); } - return cb_list_add (l, CB_BUILD_FUNCALL_1 ("cob_inspect_characters", x)); + return cb_list_add (l, CB_BUILD_FUNCALL_2 ("cob_inspect_characters_mt", st, x)); } cb_tree cb_build_replacing_all (cb_tree x, cb_tree y, cb_tree l) { + cb_tree st = cb_build_direct ("inspect_st", 0); (void) validate_inspect (x, y, 1); - return cb_list_add (l, CB_BUILD_FUNCALL_2 ("cob_inspect_all", y, x)); + return cb_list_add (l, CB_BUILD_FUNCALL_3 ("cob_inspect_all_mt", st, y, x)); } cb_tree cb_build_replacing_leading (cb_tree x, cb_tree y, cb_tree l) { + cb_tree st = cb_build_direct ("inspect_st", 0); (void) validate_inspect (x, y, 1); - return cb_list_add (l, CB_BUILD_FUNCALL_2 ("cob_inspect_leading", y, x)); + return cb_list_add (l, CB_BUILD_FUNCALL_3 ("cob_inspect_leading_mt", st, y, x)); } cb_tree cb_build_replacing_first (cb_tree x, cb_tree y, cb_tree l) { + cb_tree st = cb_build_direct ("inspect_st", 0); (void) validate_inspect (x, y, 1); - return cb_list_add (l, CB_BUILD_FUNCALL_2 ("cob_inspect_first", y, x)); + return cb_list_add (l, CB_BUILD_FUNCALL_3 ("cob_inspect_first_mt", st, y, x)); } cb_tree cb_build_replacing_trailing (cb_tree x, cb_tree y, cb_tree l) { + cb_tree st = cb_build_direct ("inspect_st", 0); (void) validate_inspect (x, y, 1); - return cb_list_add (l, CB_BUILD_FUNCALL_2 ("cob_inspect_trailing", y, x)); + return cb_list_add (l, CB_BUILD_FUNCALL_3 ("cob_inspect_trailing_mt", st, y, x)); } /* pre-filled conversion table */ @@ -10504,6 +10523,7 @@ cb_build_converting (cb_tree x, cb_tree y, cb_tree l) { const enum cb_tag tag_x = CB_TREE_TAG (x); const enum cb_tag tag_y = CB_TREE_TAG (y); + cb_tree st = cb_build_direct ("inspect_st", 0); const int ret = validate_inspect (x, y, 2); if (ret) { @@ -10511,7 +10531,7 @@ cb_build_converting (cb_tree x, cb_tree y, cb_tree l) /* identical FROM/TO - we still need the func call if the variable is signed-numeric and not sign separate, but don't need to convert anything */ /* FIXME: add test case ! */ - return cb_list_add (l, CB_BUILD_FUNCALL_0 ("cob_inspect_finish")); + return cb_list_add (l, CB_BUILD_FUNCALL_1 ("cob_inspect_finish_mt", st)); } #if 0 /* Simon: unfinished prototype, get back to it later */ @@ -10545,7 +10565,7 @@ cb_build_converting (cb_tree x, cb_tree y, cb_tree l) for the call - possibly a new type that will be used with an own prefix for generating general collation, too */ return cb_list_add (l, - CB_BUILD_FUNCALL_1 ("cob_inspect_translating", + CB_BUILD_FUNCALL_2 ("cob_inspect_translating_mt", st, cb_build_alphanumeric_literal (conv_tab, 256))); } break; @@ -10562,7 +10582,7 @@ cb_build_converting (cb_tree x, cb_tree y, cb_tree l) && alph_x->alphabet_type == CB_ALPHABET_ASCII)) { /* use the existing and configurable translation table */ return cb_list_add (l, - CB_BUILD_FUNCALL_1 ("cob_inspect_translating", CB_TREE (alph_y))); + CB_BUILD_FUNCALL_2 ("cob_inspect_translating_mt", st, CB_TREE (alph_y))); } else { // TODO: create conversion tab @@ -10599,7 +10619,7 @@ cb_build_converting (cb_tree x, cb_tree y, cb_tree l) } } return cb_list_add (l, - CB_BUILD_FUNCALL_1 ("cob_inspect_translating", CB_TREE (alph_conv))); + CB_BUILD_FUNCALL_2 ("cob_inspect_translating_mt", st, CB_TREE (alph_conv))); } } @@ -10612,13 +10632,14 @@ cb_build_converting (cb_tree x, cb_tree y, cb_tree l) } #endif - return cb_list_add (l, CB_BUILD_FUNCALL_2 ("cob_inspect_converting", x, y)); + return cb_list_add (l, CB_BUILD_FUNCALL_3 ("cob_inspect_converting_mt", st, x, y)); } cb_tree cb_build_inspect_region_start (void) { - return CB_LIST_INIT (CB_BUILD_FUNCALL_0 ("cob_inspect_start")); + cb_tree st = cb_build_direct ("inspect_st", 0); + return CB_LIST_INIT (CB_BUILD_FUNCALL_1 ("cob_inspect_start_mt", st)); } /* MOVE statement */ @@ -14389,6 +14410,7 @@ cb_emit_string (cb_tree items, cb_tree into, cb_tree pointer) cb_tree l; cb_tree end; cb_tree dlm; + cb_tree st = cb_build_direct ("string_st", 0); int nat,nfld; struct cb_field *f; @@ -14402,7 +14424,12 @@ cb_emit_string (cb_tree items, cb_tree into, cb_tree pointer) } start = items; - cb_emit (CB_BUILD_FUNCALL_2 ("cob_string_init", into, pointer)); + current_program->flag_string_used = 1; + cb_emit (CB_BUILD_FUNCALL_3 ( + "cob_string_init_mt", + cb_build_direct ("&string_st", 0), + into, pointer + )); while (start) { /* Find next DELIMITED item */ for (end = start; end; end = CB_CHAIN (end)) { @@ -14420,7 +14447,7 @@ cb_emit_string (cb_tree items, cb_tree into, cb_tree pointer) return; } } - cb_emit (CB_BUILD_FUNCALL_1 ("cob_string_delimited", dlm)); + cb_emit (CB_BUILD_FUNCALL_2 ("cob_string_delimited_mt", st, dlm)); nat = nfld = 0; /* generate cob_string_append for all entries until delimiter */ @@ -14444,7 +14471,7 @@ cb_emit_string (cb_tree items, cb_tree into, cb_tree pointer) default: break; } - cb_emit (CB_BUILD_FUNCALL_1 ("cob_string_append", cur)); + cb_emit (CB_BUILD_FUNCALL_2 ("cob_string_append_mt", st, cur)); } if (nat > 0 && nat != nfld) cb_error_x (CB_TREE (current_statement), @@ -14452,7 +14479,7 @@ cb_emit_string (cb_tree items, cb_tree into, cb_tree pointer) start = end ? CB_CHAIN (end) : NULL; } - cb_emit (CB_BUILD_FUNCALL_0 ("cob_string_finish")); + cb_emit (CB_BUILD_FUNCALL_1 ("cob_string_finish_mt", st)); } /* UNLOCK statement */ @@ -14476,6 +14503,8 @@ void cb_emit_unstring (cb_tree name, cb_tree delimited, cb_tree into, cb_tree pointer, cb_tree tallying) { + cb_tree st = cb_build_direct ("unstring_st", 0); + if (cb_validate_one (name) || cb_validate_one (tallying) || cb_validate_list (delimited) @@ -14486,28 +14515,36 @@ cb_emit_unstring (cb_tree name, cb_tree delimited, cb_tree into, validate_pointer_clause (pointer, name); } - cb_emit (CB_BUILD_FUNCALL_3 ("cob_unstring_init", name, pointer, - cb_int ((int)cb_list_length (delimited)))); + current_program->flag_unstring_used = 1; + cb_emit (CB_BUILD_FUNCALL_4 ( + "cob_unstring_init_mt", + cb_build_direct ("&unstring_st", 0), + name, + pointer, + cb_int ((int)cb_list_length (delimited)) + )); cb_emit_list (delimited); cb_emit_list (into); if (tallying) { - cb_emit (CB_BUILD_FUNCALL_1 ("cob_unstring_tallying", tallying)); + cb_emit (CB_BUILD_FUNCALL_2 ("cob_unstring_tallying_mt", st, tallying)); } - cb_emit (CB_BUILD_FUNCALL_0 ("cob_unstring_finish")); + cb_emit (CB_BUILD_FUNCALL_1 ("cob_unstring_finish_mt", st)); } cb_tree cb_build_unstring_delimited (cb_tree all, cb_tree value) { + cb_tree st = cb_build_direct ("unstring_st", 0); if (cb_validate_one (value)) { return cb_error_node; } - return CB_BUILD_FUNCALL_2 ("cob_unstring_delimited", value, all); + return CB_BUILD_FUNCALL_3 ("cob_unstring_delimited_mt", st, value, all); } cb_tree cb_build_unstring_into (cb_tree name, cb_tree delimiter, cb_tree count) { + cb_tree st = cb_build_direct ("unstring_st", 0); if (cb_validate_one (name)) { return cb_error_node; } @@ -14518,7 +14555,7 @@ cb_build_unstring_into (cb_tree name, cb_tree delimiter, cb_tree count) || error_if_not_int_field_or_has_pic_p ("COUNT", count)) { count = cb_int0; } - return CB_BUILD_FUNCALL_3 ("cob_unstring_into", name, delimiter, count); + return CB_BUILD_FUNCALL_4 ("cob_unstring_into_mt", st, name, delimiter, count); } /* WRITE statement */ diff --git a/libcob/ChangeLog b/libcob/ChangeLog index d5333b6e7..751a15a5f 100644 --- a/libcob/ChangeLog +++ b/libcob/ChangeLog @@ -14,6 +14,15 @@ * fileio.c (cob_path_to_absolute): extracted from insert and cob_set_main_argv0 +2024-02-26 Boris Eng + + * coblocal.h (cob_exit_strings_mt): add multithreaded version of + cob_exit_strings + * common.h (cob_inspect_state, cob_string_state, cob_unstring_state), + strings.c: moved static variables to structures + * strings.c, common.h: add thread-safe variant for all functions related to + strings + 2024-01-25 David Declerck FR #459: support COLLATING SEQUENCE clause on SELECT / INDEXED files diff --git a/libcob/Makefile b/libcob/Makefile new file mode 100644 index 000000000..460a43571 --- /dev/null +++ b/libcob/Makefile @@ -0,0 +1,1005 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# libcob/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +# +# Makefile gnucobol/libcob +# +# Copyright (C) 2003-2012, 2014, 2017-2020, 2022-2023 Free Software Foundation, Inc. +# Written by Keisuke Nishida, Roger While, Simon Sobisch +# +# This file is part of GnuCOBOL. +# +# The GnuCOBOL compiler is free software: you can redistribute it +# and/or modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# GnuCOBOL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GnuCOBOL. If not, see . + +# aminclude_static.am generated automatically by Autoconf +# from AX_AM_MACROS_STATIC on Thu Feb 1 13:31:38 CET 2024 + + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/gnucobol +pkglibdir = $(libdir)/gnucobol +pkglibexecdir = $(libexecdir)/gnucobol +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-pc-linux-gnu +host_triplet = x86_64-pc-linux-gnu +subdir = libcob +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ + $(top_srcdir)/m4/ax_ac_define_resolved.m4 \ + $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ + $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ + $(top_srcdir)/m4/ax_am_macros_static.m4 \ + $(top_srcdir)/m4/ax_check_define.m4 \ + $(top_srcdir)/m4/ax_check_gnu_make.m4 \ + $(top_srcdir)/m4/ax_code_coverage.m4 \ + $(top_srcdir)/m4/ax_file_escapes.m4 \ + $(top_srcdir)/m4/ax_prog_bison.m4 \ + $(top_srcdir)/m4/ax_prog_flex.m4 $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(pkginclude_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(SHELL) $(top_srcdir)/build_aux/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgincludedir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libcob_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_libcob_la_OBJECTS = common.lo move.lo numeric.lo strings.lo \ + fileio.lo call.lo intrinsic.lo termio.lo screenio.lo \ + reportio.lo cobgetopt.lo mlio.lo cconv.lo +#nodist_libcob_la_OBJECTS = cJSON.lo +libcob_la_OBJECTS = $(am_libcob_la_OBJECTS) \ + $(nodist_libcob_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am__v_lt_1 = +libcob_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libcob_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I. -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build_aux/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/cJSON.Plo ./$(DEPDIR)/call.Plo \ + ./$(DEPDIR)/cconv.Plo ./$(DEPDIR)/cobgetopt.Plo \ + ./$(DEPDIR)/common.Plo ./$(DEPDIR)/fileio.Plo \ + ./$(DEPDIR)/intrinsic.Plo ./$(DEPDIR)/mlio.Plo \ + ./$(DEPDIR)/move.Plo ./$(DEPDIR)/numeric.Plo \ + ./$(DEPDIR)/reportio.Plo ./$(DEPDIR)/screenio.Plo \ + ./$(DEPDIR)/strings.Plo ./$(DEPDIR)/termio.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libcob_la_SOURCES) $(nodist_libcob_la_SOURCES) +DIST_SOURCES = $(libcob_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(pkginclude_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(top_srcdir)/aminclude_static.am \ + $(top_srcdir)/build_aux/depcomp \ + $(top_srcdir)/build_aux/mkinstalldirs ChangeLog +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +pkgincludedir = $(includedir)/libcob +ACLOCAL = ${SHELL} '/home/engboris/gnucobol/build_aux/missing' aclocal-1.16 +AMTAR = $${TAR-tar} +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AS = as +AUTOCONF = ${SHELL} '/home/engboris/gnucobol/build_aux/missing' autoconf +AUTOHEADER = ${SHELL} '/home/engboris/gnucobol/build_aux/missing' autoheader +AUTOMAKE = ${SHELL} '/home/engboris/gnucobol/build_aux/missing' automake-1.16 +AWK = mawk +BDB_CFLAGS = +BDB_LIBS = +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -O0 -ggdb3 -fasynchronous-unwind-tables -pipe -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k +CJSON_CFLAGS = +CJSON_LIBS = -lcjson +COBC_CPPFLAGS = +COB_BIGENDIAN = no +COB_CC = gcc +COB_CFLAGS = -pipe -I/usr/local/gnucobol/include -Wno-unused -fsigned-char -Wno-pointer-sign +COB_CONFIG_DIR = ${datarootdir}/gnucobol/config +COB_COPY_DIR = ${datarootdir}/gnucobol/copy +COB_ENABLE_DEBUG = yes +COB_EXE_EXT = +COB_FIX_LIBTOOL = +COB_HAS_64_BIT_POINTER = yes +COB_HAS_CURSES = yes +COB_HAS_ISAM = db +COB_HAS_JSON = no +COB_HAS_XML2 = yes +COB_LDFLAGS = +COB_LIBRARY_PATH = ${exec_prefix}/lib/gnucobol +COB_LIBS = -L${exec_prefix}/lib -lcob +COB_MODULE_EXT = so +COB_OBJECT_EXT = o +COB_PATCH_LEVEL = 0 +CODE_COVERAGE_CFLAGS = +CODE_COVERAGE_CPPFLAGS = +CODE_COVERAGE_CXXFLAGS = +CODE_COVERAGE_ENABLED = no +CODE_COVERAGE_LIBS = +CPP = +CPPFLAGS = +CSCOPE = cscope +CTAGS = ctags +CURSES_LIBS = -lncursesw +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DIFF_FLAGS = --strip-trailing-cr +DLLTOOL = false +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +ETAGS = etags +EXEEXT = +FGREP = /usr/bin/grep -F +GCOV = +GENHTML = +GETTEXT_MACRO_VERSION = 0.20 +GMP_CFLAGS = +GMP_LIBS = -lgmp +GMSGFMT = : +GMSGFMT_015 = : +GREP = /usr/bin/grep +HELP2MAN = ${SHELL} '/home/engboris/gnucobol/build_aux/missing' help2man +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +INTLLIBS = +INTL_MACOSX_LIBS = +JSON_C_CFLAGS = +JSON_C_LIBS = -ljson-c +LCOV = +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = -Wl,-z,relro,-z,now,-O1 +LEX = ${SHELL} '/home/engboris/gnucobol/build_aux/missing' flex +LEXLIB = +LEX_OUTPUT_ROOT = +LIBCOB_CPPFLAGS = -I/usr/include/libxml2 +LIBCOB_LIBS = -lgmp -lxml2 -lncursesw -ldb-5.3 +LIBICONV = -liconv +LIBINTL = +LIBOBJS = +LIBS = +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIPO = +LN_S = ln -s +LTLIBICONV = -liconv +LTLIBINTL = +LTLIBOBJS = +LT_SYS_LIBRARY_PATH = +MAKE = make +MAKEINFO = ${SHELL} '/home/engboris/gnucobol/build_aux/missing' makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +MPIR_CFLAGS = +MPIR_LIBS = +MSGFMT = : +MSGMERGE = : +MSGMERGE_FOR_MSGFMT_OPTION = --no-location --quiet +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = gnucobol +PACKAGE_BUGREPORT = bug-gnucobol@gnu.org +PACKAGE_NAME = GnuCOBOL +PACKAGE_STRING = GnuCOBOL 3.3-dev +PACKAGE_TARNAME = gnucobol +PACKAGE_URL = https://www.gnu.org/software/gnucobol/ +PACKAGE_VERSION = 3.3-dev +PATH_SEPARATOR = : +PERL = perl +PKG_CONFIG = /usr/bin/pkg-config +PKG_CONFIG_LIBDIR = +PKG_CONFIG_PATH = +POSUB = po +PROGRAMS_LIBS = +QUOTE_INCLUDE_FLAG = +RANLIB = ranlib +RC = +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/bash +STRIP = strip +USE_NLS = yes +VERSION = 3.3-dev +XGETTEXT = : +XGETTEXT_015 = : +XGETTEXT_EXTRA_OPTIONS = +XML2_CFLAGS = -I/usr/include/libxml2 +XML2_CONFIG = +XML2_LIBS = -lxml2 +YACC = yacc +YFLAGS = +abs_builddir = /home/engboris/gnucobol/libcob +abs_srcdir = /home/engboris/gnucobol/libcob +abs_top_builddir = /home/engboris/gnucobol +abs_top_srcdir = /home/engboris/gnucobol +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-pc-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = pc +builddir = . +configured_make = make +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +host = x86_64-pc-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +ifGNUmake = +ifnGNUmake = +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/engboris/gnucobol/build_aux/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /usr/local/gnucobol +program_transform_name = s,x,x, +psdir = ${docdir} +runstatedir = ${localstatedir}/run +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../ +top_builddir = .. +top_srcdir = .. +lib_LTLIBRARIES = libcob.la +libcob_la_SOURCES = common.c move.c numeric.c strings.c \ + fileio.c call.c intrinsic.c termio.c screenio.c reportio.c cobgetopt.c \ + mlio.c coblocal.h cconv.c system.def + +#nodist_libcob_la_SOURCES = cJSON.c +#DISTCLEANFILES = cJSON.c cJSON.h + +#ToDo Man Page +#dist_man_MANS = libcob.3 +#COBCRUN = cobcrun$(EXEEXT) +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)/lib -I$(top_srcdir)/lib \ + $(LIBCOB_CPPFLAGS) -DLOCALEDIR=\"$(localedir)\" + +AM_CFLAGS = $(CODE_COVERAGE_CFLAGS) +# note: currently misses libsupport... +libcob_la_LIBADD = $(LIBCOB_LIBS) $(CODE_COVERAGE_LIBS) +libcob_la_LDFLAGS = $(COB_FIX_LIBTOOL) -version-info 6:0:2 -no-undefined +AM_LDFLAGS = $(COB_FIX_LIB) +pkginclude_HEADERS = common.h version.h cobgetopt.h \ + exception.def exception-io.def statement.def + +#GITIGNOREFILES := $(GITIGNOREFILES) $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY) +#code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V)) +#code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY)) +#code_coverage_v_lcov_cap_0 = @echo " LCOV --capture" $(CODE_COVERAGE_OUTPUT_FILE); +#code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V)) +#code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY)) +#code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN); +#code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V)) +#code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY)) +#code_coverage_v_genhtml_0 = @echo " GEN " "$(CODE_COVERAGE_OUTPUT_DIRECTORY)"; +#code_coverage_quiet = $(code_coverage_quiet_$(V)) +#code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY)) +#code_coverage_quiet_0 = --quiet + +# sanitizes the test-name: replaces with underscores: dashes and dots +#code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1))) +#AM_DISTCHECK_CONFIGURE_FLAGS := $(AM_DISTCHECK_CONFIGURE_FLAGS) --disable-code-coverage +CODE_COVERAGE_BRANCH_COVERAGE = 1 +CODE_COVERAGE_LCOV_OPTIONS = --no-external +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/aminclude_static.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libcob/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu libcob/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; +$(top_srcdir)/aminclude_static.am $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libcob.la: $(libcob_la_OBJECTS) $(libcob_la_DEPENDENCIES) $(EXTRA_libcob_la_DEPENDENCIES) + $(AM_V_CCLD)$(libcob_la_LINK) -rpath $(libdir) $(libcob_la_OBJECTS) $(libcob_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/cJSON.Plo # am--include-marker +include ./$(DEPDIR)/call.Plo # am--include-marker +include ./$(DEPDIR)/cconv.Plo # am--include-marker +include ./$(DEPDIR)/cobgetopt.Plo # am--include-marker +include ./$(DEPDIR)/common.Plo # am--include-marker +include ./$(DEPDIR)/fileio.Plo # am--include-marker +include ./$(DEPDIR)/intrinsic.Plo # am--include-marker +include ./$(DEPDIR)/mlio.Plo # am--include-marker +include ./$(DEPDIR)/move.Plo # am--include-marker +include ./$(DEPDIR)/numeric.Plo # am--include-marker +include ./$(DEPDIR)/reportio.Plo # am--include-marker +include ./$(DEPDIR)/screenio.Plo # am--include-marker +include ./$(DEPDIR)/strings.Plo # am--include-marker +include ./$(DEPDIR)/termio.Plo # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ $< + +.c.obj: + $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# $(AM_V_CC)source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: + $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +# $(AM_V_CC)source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pkgincludeHEADERS: $(pkginclude_HEADERS) + @$(NORMAL_INSTALL) + @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ + done + +uninstall-pkgincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgincludedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/cJSON.Plo + -rm -f ./$(DEPDIR)/call.Plo + -rm -f ./$(DEPDIR)/cconv.Plo + -rm -f ./$(DEPDIR)/cobgetopt.Plo + -rm -f ./$(DEPDIR)/common.Plo + -rm -f ./$(DEPDIR)/fileio.Plo + -rm -f ./$(DEPDIR)/intrinsic.Plo + -rm -f ./$(DEPDIR)/mlio.Plo + -rm -f ./$(DEPDIR)/move.Plo + -rm -f ./$(DEPDIR)/numeric.Plo + -rm -f ./$(DEPDIR)/reportio.Plo + -rm -f ./$(DEPDIR)/screenio.Plo + -rm -f ./$(DEPDIR)/strings.Plo + -rm -f ./$(DEPDIR)/termio.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pkgincludeHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/cJSON.Plo + -rm -f ./$(DEPDIR)/call.Plo + -rm -f ./$(DEPDIR)/cconv.Plo + -rm -f ./$(DEPDIR)/cobgetopt.Plo + -rm -f ./$(DEPDIR)/common.Plo + -rm -f ./$(DEPDIR)/fileio.Plo + -rm -f ./$(DEPDIR)/intrinsic.Plo + -rm -f ./$(DEPDIR)/mlio.Plo + -rm -f ./$(DEPDIR)/move.Plo + -rm -f ./$(DEPDIR)/numeric.Plo + -rm -f ./$(DEPDIR)/reportio.Plo + -rm -f ./$(DEPDIR)/screenio.Plo + -rm -f ./$(DEPDIR)/strings.Plo + -rm -f ./$(DEPDIR)/termio.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES uninstall-pkgincludeHEADERS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libLTLIBRARIES clean-libtool clean-local \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-libLTLIBRARIES \ + install-man install-pdf install-pdf-am \ + install-pkgincludeHEADERS install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-libLTLIBRARIES uninstall-pkgincludeHEADERS + +.PRECIOUS: Makefile + + +# Code coverage +# +# Optional: +# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting. +# Multiple directories may be specified, separated by whitespace. +# (Default: $(top_builddir)) +# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated +# by lcov for code coverage. (Default: +# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info) +# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage +# reports to be created. (Default: +# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage) +# - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage, +# set to 0 to disable it and leave empty to stay with the default. +# (Default: empty) +# - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov +# instances. (Default: based on ) +# - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov +# instances. (Default: ) +# - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov +# - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the +# collecting lcov instance. (Default: ) +# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov +# instance. (Default: ) +# - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering +# lcov instance. (Default: empty) +# - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov +# instance. (Default: ) +# - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the +# genhtml instance. (Default: based on ) +# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml +# instance. (Default: ) +# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore +# +# The generated report will be titled using the $(PACKAGE_NAME) and +# $(PACKAGE_VERSION). In order to add the current git hash to the title, +# use the git-version-gen script, available online. +# Optional variables +# run only on top dir +# ifeq ($(abs_builddir), $(abs_top_builddir)) +#CODE_COVERAGE_DIRECTORY ?= $(top_builddir) +#CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info +#CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage + +#CODE_COVERAGE_BRANCH_COVERAGE ?= +#CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),--rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) +#CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) +#CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)" +#CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) +#CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) +#CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?= +#CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) +#CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=$(if $(CODE_COVERAGE_BRANCH_COVERAGE),--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) +#CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) +#CODE_COVERAGE_IGNORE_PATTERN ?= + +# Use recursive makes in order to ignore errors during check +#check-code-coverage: +# -$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check +# $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture + +# Capture code coverage data +#code-coverage-capture: code-coverage-capture-hook +# $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS) +# $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS) +# -@rm -f "$(CODE_COVERAGE_OUTPUT_FILE).tmp" +# $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS) +# @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" + +#code-coverage-clean: +# -$(LCOV) --directory $(top_builddir) -z +# -rm -rf "$(CODE_COVERAGE_OUTPUT_FILE)" "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" +# -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete + +#code-coverage-dist-clean: +# else # ifneq ($(abs_builddir), $(abs_top_builddir)) +#check-code-coverage: + +#code-coverage-capture: code-coverage-capture-hook + +#code-coverage-clean: + +#code-coverage-dist-clean: +# endif # ifeq ($(abs_builddir), $(abs_top_builddir)) +# Use recursive makes in order to ignore errors during check +check-code-coverage: + @echo "Need to reconfigure with --enable-code-coverage" +# Capture code coverage data +code-coverage-capture: code-coverage-capture-hook + @echo "Need to reconfigure with --enable-code-coverage" + +code-coverage-clean: + +code-coverage-dist-clean: + +# Hook rule executed before code-coverage-capture, overridable by the user +code-coverage-capture-hook: + +.PHONY: check-code-coverage code-coverage-capture code-coverage-dist-clean code-coverage-clean code-coverage-capture-hook + +# Add rules for code-coverage testing, as provided by AX_CODE_COVERAGE + +clean-local: code-coverage-clean +dist-clean-local: code-coverage-dist-clean + +#HELPSOURCES = $(top_srcdir)/bin/cobcrun.c $(top_srcdir)/configure.ac +#HELP2MAN_OPTS = --info-page=$(PACKAGE) -specialflag +#if MAKE_HAS_PREREQ_ONLY +#libcob.3: $(HELPSOURCES) | $(COBCRUN) +# "$(top_builddir)/pre-inst-env" $(HELP2MAN) --output=$@ $(HELP2MAN_OPTS) $(COBCRUN) +#else +#libcob.3: $(HELPSOURCES) +# "$(top_builddir)/pre-inst-env" $(HELP2MAN) --output=$@ $(HELP2MAN_OPTS) $(COBCRUN) +#endif + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libcob/coblocal.h b/libcob/coblocal.h index 46dfcc576..150d1c746 100644 --- a/libcob/coblocal.h +++ b/libcob/coblocal.h @@ -324,7 +324,6 @@ typedef struct __cob_settings { unsigned int cob_exit_wait; /* wait on program exit if no ACCEPT came after last DISPLAY */ const char *cob_exit_msg; /* message for cob_exit_wait */ - /* reportio.c */ unsigned int cob_col_just_lrc; /* Justify data in column LEFT/RIGHT/CENTER */ @@ -494,6 +493,10 @@ COB_HIDDEN const char *cob_get_last_exception_name (void); COB_HIDDEN void cob_parameter_check (const char *, const int); COB_HIDDEN char* cob_get_strerror (void); +/* string.c */ +COB_HIDDEN void cob_str_memcpy (cob_field*, unsigned char*, const int size); +COB_HIDDEN void alloc_figurative (const cob_field*, const cob_field*); + enum cob_case_modifier { CCM_NONE, CCM_LOWER, diff --git a/libcob/common.h b/libcob/common.h index b49d78f89..c52f20872 100644 --- a/libcob/common.h +++ b/libcob/common.h @@ -1248,6 +1248,51 @@ typedef struct __cob_screen { int attr; /* COB_SCREEN_TYPE_ATTRIBUTE */ } cob_screen; +/* String structure */ +struct cob_inspect_state { + cob_field *var; + unsigned char *data; + unsigned char *start; + unsigned char *end; + unsigned char *mark; /* buffer to marker only: 0/1 */ + size_t mark_size; /* size of internal marker elements, increased up to + the maximum needed (biggest target field size) */ + size_t mark_min; /* min. position of the marker set by the last initialize */ + size_t mark_max; /* max. position of the marker set by the last initialize */ + unsigned char *repdata; /* contains data for REPLACING which is applied at end */ + size_t repdata_size; /* size of internal repdata buffer, increased up to + the maximum needed (biggest target field size) */ + size_t size; + cob_u32_t replacing; /* marker about current operation being INSPECT REPLACING */ + int sign; + cob_field var_copy; +}; + +struct cob_string_state { + cob_field *dst; + cob_field *ptr; + cob_field *dlm; + cob_field dst_copy; + cob_field ptr_copy; + cob_field dlm_copy; + int offset; +}; + +struct cob_unstring_state { + struct dlm_struct *dlm_list; + cob_field *src; + cob_field *ptr; + size_t dlm_list_size; /* size of internal delimiter elements, increased up to + the maximum needed (amount of DELIMITED BY), + actual size of dlm_list is calculated by + dlm_list_size * sizeof(dlm_struct) */ + cob_field src_copy; + cob_field ptr_copy; + int offset; + int count; + int ndlms; +}; + /* Module structure */ enum cob_module_type { COB_MODULE_TYPE_PROGRAM = 0, @@ -1336,7 +1381,6 @@ typedef struct __cob_module { const char *section_name; /* name of current active section */ const char *paragraph_name; /* name of current active pagagraph */ enum cob_statement statement; /* statement currently executed */ - } cob_module; @@ -1940,6 +1984,35 @@ COB_EXPIMP int cob_bcd_cmp_zero (cob_field *); /*******************************/ /* Functions in strings.c */ +/* Thread-safe inspect */ +void cob_inspect_init_mt (struct cob_inspect_state **, cob_field *, const cob_u32_t); +void cob_inspect_init_converting_mt (struct cob_inspect_state **, cob_field *); +COB_EXPIMP void cob_inspect_start_mt (struct cob_inspect_state *); +COB_EXPIMP void cob_inspect_before_mt (struct cob_inspect_state *, const cob_field *); +COB_EXPIMP void cob_inspect_after_mt (struct cob_inspect_state *, const cob_field *); +COB_EXPIMP void cob_inspect_characters_mt (struct cob_inspect_state *, cob_field *); +COB_EXPIMP void cob_inspect_all_mt (struct cob_inspect_state *, cob_field *, cob_field *); +COB_EXPIMP void cob_inspect_leading_mt (struct cob_inspect_state *, cob_field *, cob_field *); +COB_EXPIMP void cob_inspect_first_mt (struct cob_inspect_state *, cob_field *, cob_field *); +COB_EXPIMP void cob_inspect_trailing_mt (struct cob_inspect_state *, cob_field *, cob_field *); +COB_EXPIMP void cob_inspect_converting_mt (struct cob_inspect_state *, const cob_field *, const cob_field *); +COB_EXPIMP void cob_inspect_translating_mt (struct cob_inspect_state *, const unsigned char *); +COB_EXPIMP void cob_inspect_finish_mt (struct cob_inspect_state *); + +/* Thread-safe string */ +void cob_string_init_mt (struct cob_string_state **, cob_field *, cob_field *); +COB_EXPIMP void cob_string_delimited_mt (struct cob_string_state *, cob_field *); +COB_EXPIMP void cob_string_append_mt (struct cob_string_state *, cob_field *); +COB_EXPIMP void cob_string_finish_mt (struct cob_string_state *); + +/* Thread-safe unstring */ +void cob_unstring_init_mt (struct cob_unstring_state **, cob_field *, cob_field *, const size_t); +COB_EXPIMP void cob_unstring_delimited_mt (struct cob_unstring_state *, cob_field *, const cob_u32_t); +COB_EXPIMP void cob_unstring_into_mt (struct cob_unstring_state *, cob_field *, cob_field *, cob_field *); +COB_EXPIMP void cob_unstring_tallying_mt (struct cob_unstring_state *, cob_field *); +COB_EXPIMP void cob_unstring_finish_mt (struct cob_unstring_state *); + +/* Compat-only functions for old programs */ COB_EXPIMP void cob_inspect_init (cob_field *, const cob_u32_t); COB_EXPIMP void cob_inspect_init_converting (cob_field *); COB_EXPIMP void cob_inspect_start (void); diff --git a/libcob/strings.c b/libcob/strings.c index ef61e56c2..266876ab7 100644 --- a/libcob/strings.c +++ b/libcob/strings.c @@ -55,53 +55,25 @@ static const cob_field_attr const_alpha_attr = static const cob_field_attr const_strall_attr = {COB_TYPE_ALPHANUMERIC_ALL, 0, 0, 0, NULL}; -static cob_field *inspect_var; -static unsigned char *inspect_data; -static unsigned char *inspect_start; -static unsigned char *inspect_end; -static unsigned char *inspect_mark; /* buffer to marker only: 0/1 */ -static size_t inspect_mark_size; /* size of internal marker elements, increased up to - the maximum needed (biggest target field size) */ -static size_t inspect_mark_min; /* min. position of the marker set by the last initialize */ -static size_t inspect_mark_max; /* max. position of the marker set by the last initialize */ -static unsigned char *inspect_repdata; /* contains data for REPLACING which is applied at end */ -static size_t inspect_repdata_size; /* size of internal repdata buffer, increased up to - the maximum needed (biggest target field size) */ -static size_t inspect_size; -static cob_u32_t inspect_replacing; /* marker about current operation being INSPECT REPLACING */ -static int inspect_sign; -static cob_field inspect_var_copy; - -static cob_field *string_dst; -static cob_field *string_ptr; -static cob_field *string_dlm; -static cob_field string_dst_copy; -static cob_field string_ptr_copy; -static cob_field string_dlm_copy; -static int string_offset; - -static struct dlm_struct *dlm_list; -static cob_field *unstring_src; -static cob_field *unstring_ptr; -static size_t dlm_list_size; /* size of internal delimiter elements, increased up to - the maximum needed (amount of DELIMITED BY), - actual size of dlm_list is calculated by - dlm_list_size * sizeof(dlm_struct) */ -static cob_field unstring_src_copy; -static cob_field unstring_ptr_copy; -static int unstring_offset; -static int unstring_count; -static int unstring_ndlms; - -static unsigned char *figurative_ptr; -static size_t figurative_size; - -static cob_field alpha_fld; -static cob_field str_cob_low; +/* Static structures for backward compatibility */ +static struct cob_inspect_state share_inspect_state; +static struct cob_string_state share_string_state; +static struct cob_unstring_state share_unstring_state; +static struct cob_inspect_state *pshare_inspect_state = + &share_inspect_state; +static struct cob_string_state *pshare_string_state = + &share_string_state; +static struct cob_unstring_state *pshare_unstring_state = + &share_unstring_state; + +unsigned char *figurative_ptr; +size_t figurative_size; +cob_field alpha_fld; +cob_field str_cob_low; /* Local functions */ -static void +void cob_str_memcpy (cob_field *dst, unsigned char *src, const int size) { cob_field temp; @@ -112,7 +84,7 @@ cob_str_memcpy (cob_field *dst, unsigned char *src, const int size) cob_move (&temp, dst); } -static void +void alloc_figurative (const cob_field *f1, const cob_field *f2) { const size_t size2 = f2->size; @@ -169,41 +141,43 @@ alloc_figurative (const cob_field *f1, const cob_field *f2) This is a must-have for REPLACING as the original data may not be changed to correctly handle multiple replacements with BEFORE/AFTER clauses */ -static COB_INLINE COB_A_INLINE void -setup_repdata (void) +COB_INLINE COB_A_INLINE void +setup_repdata (struct cob_inspect_state *st) { /* implementation note: - A version that memcpy'd the complete inspect_data to inspect_repdata + A version that memcpy'd the complete data to repdata on first use, then memcpy back in cob_inspect_finish was tested but dropped. While it has the benefit that memory breakpoints in the COBOL data are only triggered once and always shows the result-to-be and uses an optimized memcpy instead of a manual loop it involves much more memory operations than commonly necessary - because normally only a small percentage of the data is actually replaced. - A version that used inspect_repdata for CONVERTING was also dropped as + A version that used repdata for CONVERTING was also dropped as we don't need the additional memory there. */ - if (inspect_size > inspect_repdata_size) { - if (inspect_repdata) { - cob_free (inspect_repdata); - inspect_repdata_size = inspect_size; - } else if (inspect_size < COB_NORMAL_BUFF) { - inspect_repdata_size = COB_NORMAL_BUFF; - } else { - inspect_repdata_size = inspect_size; + if (st->size > st->repdata_size) { + if (st->repdata) { + cob_free (st->repdata); + st->repdata_size = st->size; + } + else if (st->size < COB_NORMAL_BUFF) { + st->repdata_size = COB_NORMAL_BUFF; + } + else { + st->repdata_size = st->size; } /* data content does not matter as we only used marked positions at end */ - inspect_repdata = cob_fast_malloc (inspect_repdata_size + 1); + st->repdata = cob_fast_malloc (st->repdata_size + 1); } } static COB_INLINE COB_A_INLINE unsigned char * -inspect_find_data (const cob_field *str) +inspect_find_data (struct cob_inspect_state *st, const cob_field *str) { const unsigned char *data = str->data; const size_t len = str->size; - register unsigned char *p = inspect_start; - unsigned char *const end_p = inspect_end - len + 1; + register unsigned char *p = st->start; + unsigned char *const end_p = st->end - len + 1; if (p > end_p) { return NULL; @@ -219,32 +193,36 @@ inspect_find_data (const cob_field *str) } static COB_INLINE COB_A_INLINE void -set_inspect_mark (const size_t pos, const size_t length) +set_inspect_mark ( + struct cob_inspect_state *st, + const size_t pos, + const size_t length +) { const size_t pos_end = pos + length - 1; - memset (inspect_mark + pos, 1, length); - if ((inspect_mark_min == 0 && inspect_mark[inspect_mark_min] == 0) - || pos < inspect_mark_min) { - inspect_mark_min = pos; + memset (st->mark + pos, 1, length); + if ((st->mark_min == 0 && st->mark[st->mark_min] == 0) + || pos < st->mark_min) { + st->mark_min = pos; } - if (pos_end > inspect_mark_max) { - inspect_mark_max = pos_end; + if (pos_end > st->mark_max) { + st->mark_max = pos_end; } } /* check for an area in the marker to be non-zero */ static COB_INLINE COB_A_INLINE int -is_marked (size_t pos, size_t length) +is_marked (struct cob_inspect_state *st, size_t pos, size_t length) { /* no need to check further if there's no mark or no possible overlap ... */ - if (inspect_mark[inspect_mark_min] == 0 - || inspect_mark_max < pos - || inspect_mark_min >= pos + length) { + if (st->mark[st->mark_min] == 0 + || st->mark_max < pos + || st->mark_min >= pos + length) { return 0; } /* ... or if the minimal/max mark are within the range to check */ - if (inspect_mark_min >= pos - || inspect_mark_max < pos + length) { + if (st->mark_min >= pos + || st->mark_max < pos + length) { return 1; } @@ -253,7 +231,7 @@ is_marked (size_t pos, size_t length) register size_t i; for (i = 0; i < length; ++i) { - if (inspect_mark[pos + i] != 0) { + if (st->mark[pos + i] != 0) { return 1; } } @@ -262,20 +240,26 @@ is_marked (size_t pos, size_t length) } static void -inspect_common_no_replace (cob_field *f1, cob_field *f2, - const enum inspect_type type, const size_t pos, const size_t inspect_len) +inspect_common_no_replace ( + struct cob_inspect_state *st, + cob_field *f1, + cob_field *f2, + const enum inspect_type type, + const size_t pos, + const size_t len +) { register size_t i; int n = 0; if (type == INSPECT_TRAILING) { - const size_t i_max = inspect_len - f2->size; /* no + 1 here */ + const size_t i_max = len - f2->size; /* no + 1 here */ size_t first_marker = 0; for (i = i_max; ; --i) { /* Find matching substring */ - if (memcmp (i + inspect_start, f2->data, f2->size) == 0) { + if (memcmp (i + st->start, f2->data, f2->size) == 0) { /* when not marked yet: count, mark and skip handled positions */ - if (!is_marked (pos + i, f2->size)) { + if (!is_marked (st, pos + i, f2->size)) { n++; first_marker = i; i -= f2->size - 1; @@ -289,16 +273,16 @@ inspect_common_no_replace (cob_field *f1, cob_field *f2, } /* set the marker so we won't iterate over this area again */ if (n) { - set_inspect_mark (pos + first_marker, inspect_len - first_marker); + set_inspect_mark (st, pos + first_marker, len - first_marker); } } else if (type == INSPECT_LEADING) { - const size_t i_max = inspect_len - f2->size + 1; + const size_t i_max = len - f2->size + 1; size_t last_marker = 0; for (i = 0; i < i_max; ++i) { /* Find matching substring */ - if (memcmp (i + inspect_start, f2->data, f2->size) == 0) { + if (memcmp (i + st->start, f2->data, f2->size) == 0) { /* when not marked yet: count, skip handled positions and set mark pos */ - if (!is_marked (pos + i, f2->size)) { + if (!is_marked (st, pos + i, f2->size)) { n++; i += f2->size - 1; last_marker = i; @@ -309,21 +293,21 @@ inspect_common_no_replace (cob_field *f1, cob_field *f2, } /* set the marker so we won't iterate over this area again */ if (n) { - set_inspect_mark (pos, last_marker); + set_inspect_mark (st, pos, last_marker); } /* note: same code as for LEADING, moved out as we don't need to check LEADING for _every_ byte in that tight loop */ } else { - const size_t i_max = inspect_len - f2->size + 1; + const size_t i_max = len - f2->size + 1; for (i = 0; i < i_max; ++i) { /* Find matching substring */ - if (memcmp (i + inspect_start, f2->data, f2->size) == 0) { + if (memcmp (i + st->start, f2->data, f2->size) == 0) { const size_t checked_pos = pos + i; /* when not marked yet: count, mark and skip handled positions */ - if (!is_marked (checked_pos, f2->size)) { + if (!is_marked (st, checked_pos, f2->size)) { n++; /* set the marker so we won't iterate over this area again */ - set_inspect_mark (checked_pos, f2->size); + set_inspect_mark (st, checked_pos, f2->size); if (type == INSPECT_FIRST) { break; } @@ -339,37 +323,48 @@ inspect_common_no_replace (cob_field *f1, cob_field *f2, } static COB_INLINE COB_A_INLINE int -do_mark (const size_t pos, const size_t length, unsigned char *replace_data) +do_mark ( + struct cob_inspect_state *st, + const size_t pos, + const size_t length, + unsigned char *replace_data +) { - if (is_marked (pos, length)) { + if (is_marked (st, pos, length)) { return 0; /* it is, nothing to do here */ } /* nothing done there yet, so: */ /* 1 - handle possible replacing */ - setup_repdata (); - memcpy (inspect_repdata + pos, replace_data, length); + setup_repdata (st); + memcpy (st->repdata + pos, replace_data, length); /* 2 - set the marker so we won't iterate over this area again */ - set_inspect_mark (pos, length); + set_inspect_mark (st, pos, length); /* 3 - let the caller handle pos adjustment */ return 1; } static void -inspect_common_replacing (cob_field *f1, cob_field *f2, - const enum inspect_type type, const size_t pos, const size_t inspect_len) +inspect_common_replacing ( + struct cob_inspect_state *st, + cob_field *f1, + cob_field *f2, + const enum inspect_type type, + const size_t pos, + const size_t len +) { register size_t i; if (type == INSPECT_TRAILING) { - const size_t i_max = inspect_len - f2->size; /* no + 1 here */ + const size_t i_max = len - f2->size; /* no + 1 here */ for (i = i_max; ; --i) { /* Find matching substring */ - if (memcmp (i + inspect_start, f2->data, f2->size) == 0) { + if (memcmp (i + st->start, f2->data, f2->size) == 0) { /* when not marked yet: count, mark and skip handled positions */ - if (do_mark (pos + i, f2->size, f1->data)) { + if (do_mark (st, pos + i, f2->size, f1->data)) { i -= f2->size - 1; } if (i == 0) { @@ -380,12 +375,12 @@ inspect_common_replacing (cob_field *f1, cob_field *f2, } } } else if (type == INSPECT_LEADING) { - const size_t i_max = inspect_len - f2->size + 1; + const size_t i_max = len - f2->size + 1; for (i = 0; i < i_max; ++i) { /* Find matching substring */ - if (memcmp (i + inspect_start, f2->data, f2->size) == 0) { + if (memcmp (i + st->start, f2->data, f2->size) == 0) { /* when not marked yet: count, mark and skip handled positions */ - if (do_mark (pos + i, f2->size, f1->data)) { + if (do_mark (st, pos + i, f2->size, f1->data)) { i += f2->size - 1; } } else { @@ -395,12 +390,12 @@ inspect_common_replacing (cob_field *f1, cob_field *f2, /* note: same code as for LEADING, moved out as we don't need to check LEADING for _every_ byte in that tight loop */ } else { - const size_t i_max = inspect_len - f2->size + 1; + const size_t i_max = len - f2->size + 1; for (i = 0; i < i_max; ++i) { /* Find matching substring */ - if (memcmp (i + inspect_start, f2->data, f2->size) == 0) { + if (memcmp (i + st->start, f2->data, f2->size) == 0) { /* when not marked yet: count, mark and skip handled positions */ - if (do_mark (pos + i, f2->size, f1->data)) { + if (do_mark (st, pos + i, f2->size, f1->data)) { if (type == INSPECT_FIRST) { break; } @@ -412,12 +407,17 @@ inspect_common_replacing (cob_field *f1, cob_field *f2, } static void -inspect_common (cob_field *f1, cob_field *f2, const enum inspect_type type) +inspect_common ( + struct cob_inspect_state *st, + cob_field *f1, + cob_field *f2, + const enum inspect_type type +) { - const size_t pos = inspect_start - inspect_data; - const size_t inspect_len = inspect_end - inspect_start; + const size_t pos = st->start - st->data; + const size_t len = st->end - st->start; - if (inspect_len == 0) { + if (len == 0) { /* inspecting either a zero-length field or AFTER ... has not found a place to start the conversion */ return; @@ -434,11 +434,11 @@ inspect_common (cob_field *f1, cob_field *f2, const enum inspect_type type) of its code; still moved out as this allows for further optimizations; only optimization left: separate entry function and codegen for single target as this does not need a marker at all */ - if (!inspect_replacing) { - if (f2->size > inspect_len) { + if (!st->replacing) { + if (f2->size > len) { return; } - inspect_common_no_replace (f1, f2, type, pos, inspect_len); + inspect_common_no_replace (st, f1, f2, type, pos, len); } else { if (f1->size != f2->size) { if (COB_FIELD_TYPE (f1) == COB_TYPE_ALPHANUMERIC_ALL) { @@ -449,10 +449,10 @@ inspect_common (cob_field *f1, cob_field *f2, const enum inspect_type type) return; } } - if (f2->size > inspect_len) { + if (f2->size > len) { return; } - inspect_common_replacing (f1, f2, type, pos, inspect_len); + inspect_common_replacing (st, f1, f2, type, pos, len); } } @@ -462,122 +462,158 @@ inspect_common (cob_field *f1, cob_field *f2, const enum inspect_type type) /* an INSPECT is split into multiple parts: one-time cob_inspect_init (setting up memory and markers) multiple: - cob_inspect_start (setting inspect_start/end) - cob_inspect_before (optional, adjusting inspect_end) - cob_inspect_after (optional, adjusting inspect_start) + cob_inspect_start (setting start/end) + cob_inspect_before (optional, adjusting end) + cob_inspect_after (optional, adjusting start) one of: cob_inspect_characters/cob_inspect_converting (until 3.2)/cob_inspect_all/ cob_inspect_leading/cob_inspect_trailing/cob_inspect_first one-time cob_inspect_finish (copying the REPLACING characters back) */ static COB_INLINE COB_A_INLINE void -cob_inspect_init_common (cob_field *var) +cob_inspect_init_common_mt (struct cob_inspect_state **pst, cob_field *var) { + if (*pst == NULL) { + *pst = malloc (sizeof(struct cob_inspect_state)); + (*pst)->mark = NULL; + (*pst)->repdata = NULL; + } + struct cob_inspect_state *st = *pst; + if (COB_FIELD_HAVE_SIGN (var) && !COB_FIELD_SIGN_SEPARATE(var)) { /* it is allowed to TRANSFORM / INSPECT a numeric display signed element; if it isn't stored separately we need to "remove" it here and add it back in inspect_finish; note: we only handle NUMERIC DISPLAY here */ - inspect_var_copy = *var; - inspect_var = &inspect_var_copy; - inspect_sign = cob_real_get_sign (var, 0); + st->var_copy = *var; + st->var = &st->var_copy; + st->sign = cob_real_get_sign (var, 0); } else { - inspect_var = NULL; + st->var = NULL; } - inspect_size = COB_FIELD_SIZE (var); - inspect_data = COB_FIELD_DATA (var); - inspect_start = NULL; - inspect_end = NULL; + st->size = COB_FIELD_SIZE (var); + st->data = COB_FIELD_DATA (var); + st->start = NULL; + st->end = NULL; + st->mark_size = 0; + st->repdata_size = 0; cobglobptr->cob_exception_code = 0; } void -cob_inspect_init (cob_field *var, const cob_u32_t replacing) +cob_inspect_init_mt (struct cob_inspect_state **pst, cob_field *var, const cob_u32_t replacing) { - cob_inspect_init_common (var); - inspect_replacing = replacing; - - if (inspect_size > inspect_mark_size) { - if (inspect_mark) { - cob_free (inspect_mark); - inspect_mark_size = inspect_size; - } else if (inspect_size < COB_NORMAL_BUFF) { - inspect_mark_size = COB_NORMAL_BUFF; - } else { - inspect_mark_size = inspect_size; + cob_inspect_init_common_mt (pst, var); + struct cob_inspect_state *st = *pst; + st->replacing = replacing; + + if (st->size > st->mark_size) { + if (st->mark) { + cob_free (st->mark); + st->mark_size = st->size; + } + else if (st->size < COB_NORMAL_BUFF) { + st->mark_size = COB_NORMAL_BUFF; + } + else { + st->mark_size = st->size; } /* initialize to zero */ - inspect_mark = cob_malloc (inspect_mark_size + 1); - } else if (inspect_mark_size != 0 && inspect_mark[inspect_mark_min] != 0) { - const size_t init_len = inspect_mark_max - inspect_mark_min + 1; - memset (inspect_mark + inspect_mark_min, 0, init_len); + st->mark = cob_malloc (st->mark_size + 1); + } else if (st->mark_size != 0 && st->mark[st->mark_min] != 0) { + const size_t init_len = st->mark_max - st->mark_min + 1; + memset (st->mark + st->mark_min, 0, init_len); } - inspect_mark_min = inspect_mark_max = 0; + st->mark_min = st->mark_max = 0; +} +void +cob_inspect_init (cob_field *var, const cob_u32_t replacing) +{ + cob_inspect_init_mt (&pshare_inspect_state, var, replacing); } /* an INSPECT CONVERTING / TRANSFORM is split into multiple parts: one-time cob_inspect_init_converting --> cob_inspect_init_common (setting up memory) multiple: - cob_inspect_start (setting inspect_start/end) - cob_inspect_before (optional, adjusting inspect_end) - cob_inspect_after (optional, adjusting inspect_start) + cob_inspect_start (setting start/end) + cob_inspect_before (optional, adjusting end) + cob_inspect_after (optional, adjusting start) one-time cob_inspect_converting/cob_inspect_translating (actual converstion) */ +void +cob_inspect_init_converting_mt (struct cob_inspect_state **pst, cob_field *var) +{ + cob_inspect_init_common_mt (pst, var); + struct cob_inspect_state *st = *pst; + st->replacing = 0; /* only set for pre 3.2 compat because of cob_inspect_finish */ +} void cob_inspect_init_converting (cob_field *var) { - cob_inspect_init_common (var); - inspect_replacing = 0; /* only set for pre 3.2 compat because of cob_inspect_finish */ + cob_inspect_init_converting_mt (&pshare_inspect_state, var); } +void +cob_inspect_start_mt (struct cob_inspect_state *st) +{ + st->start = st->data; + st->end = st->data + st->size; +} void cob_inspect_start (void) { - inspect_start = inspect_data; - inspect_end = inspect_data + inspect_size; + cob_inspect_start_mt (&share_inspect_state); } +void +cob_inspect_before_mt (struct cob_inspect_state *st, const cob_field *str) +{ + unsigned char *data_pos = inspect_find_data (st, str); + if (data_pos) + st->end = data_pos; +} void cob_inspect_before (const cob_field *str) { - unsigned char *data_pos = inspect_find_data (str); - if (data_pos) { - inspect_end = data_pos; - } + cob_inspect_before_mt (&share_inspect_state, str); } +void +cob_inspect_after_mt (struct cob_inspect_state *st, const cob_field *str) +{ + unsigned char *data_pos = inspect_find_data (st, str); + if (data_pos) + st->start = data_pos + str->size; + else + st->start = st->end; +} void cob_inspect_after (const cob_field *str) { - unsigned char *data_pos = inspect_find_data (str); - if (data_pos) { - inspect_start = data_pos + str->size; - } else { - inspect_start = inspect_end; - } + cob_inspect_after_mt (&share_inspect_state, str); } void -cob_inspect_characters (cob_field *f1) +cob_inspect_characters_mt (struct cob_inspect_state *st, cob_field *f1) { - const size_t pos = inspect_start - inspect_data; - const size_t inspect_len = inspect_end - inspect_start; - const unsigned char *mark_pos = inspect_mark + pos; - const unsigned char * const mark_end = mark_pos + inspect_len; + const size_t pos = st->start - st->data; + const size_t len = st->end - st->start; + const unsigned char *mark_pos = st->mark + pos; + const unsigned char * const mark_end = mark_pos + len; - if (inspect_len == 0) { + if (len == 0) { /* inspecting either a zero-length field or AFTER ... has not found a place to start the conversion */ return; } - if (inspect_replacing) { + if (st->replacing) { /* INSPECT REPLACING CHARACTERS BY f1 (= size 1) */ const unsigned char repl_by = *f1->data; unsigned char *repdata; - setup_repdata (); - repdata = inspect_repdata + pos; - if (is_marked (pos, inspect_len)) { + setup_repdata (st); + repdata = st->repdata + pos; + if (is_marked (st, pos, len)) { /* at least a partial marking - so iterate */ while (mark_pos != mark_end) { /* replace all positions in the original data where @@ -589,11 +625,11 @@ cob_inspect_characters (cob_field *f1) } } else { /* that area is "free to go", so memset */ - memset (repdata, repl_by, inspect_len); + memset (repdata, repl_by, len); } } else { /* INSPECT TALLYING f1 CHARACTERS */ - if (is_marked (pos, inspect_len)) { + if (is_marked (st, pos, len)) { /* at least a partial marking - so iterate */ int n = 0; /* Note: field->size and therefore INSPECT target's size are @@ -608,42 +644,71 @@ cob_inspect_characters (cob_field *f1) } } else { /* common case: no markers in the length to check */ - cob_add_int (f1, (int)inspect_len, 0); + cob_add_int (f1, (int)len, 0); } } - set_inspect_mark (pos, inspect_len); + set_inspect_mark (st, pos, len); +} +void +cob_inspect_characters (cob_field *f1) +{ + cob_inspect_characters_mt(&share_inspect_state, f1); } +void +cob_inspect_all_mt (struct cob_inspect_state *st, cob_field *f1, cob_field *f2) +{ + inspect_common (st, f1, f2, INSPECT_ALL); +} void cob_inspect_all (cob_field *f1, cob_field *f2) { - inspect_common (f1, f2, INSPECT_ALL); + inspect_common (&share_inspect_state, f1, f2, INSPECT_ALL); } +void +cob_inspect_leading_mt (struct cob_inspect_state *st, cob_field *f1, cob_field *f2) +{ + inspect_common (st, f1, f2, INSPECT_LEADING); +} void cob_inspect_leading (cob_field *f1, cob_field *f2) { - inspect_common (f1, f2, INSPECT_LEADING); + inspect_common (&share_inspect_state, f1, f2, INSPECT_LEADING); } +void +cob_inspect_first_mt (struct cob_inspect_state *st, cob_field *f1, cob_field *f2) +{ + inspect_common (st, f1, f2, INSPECT_FIRST); +} void cob_inspect_first (cob_field *f1, cob_field *f2) { - inspect_common (f1, f2, INSPECT_FIRST); + inspect_common (&share_inspect_state, f1, f2, INSPECT_FIRST); } +void +cob_inspect_trailing_mt (struct cob_inspect_state *st, cob_field *f1, cob_field *f2) +{ + inspect_common (st, f1, f2, INSPECT_TRAILING); +} void cob_inspect_trailing (cob_field *f1, cob_field *f2) { - inspect_common (f1, f2, INSPECT_TRAILING); + inspect_common (&share_inspect_state, f1, f2, INSPECT_TRAILING); } void -cob_inspect_converting (const cob_field *f1, const cob_field *f2) +cob_inspect_converting_mt ( + struct cob_inspect_state *st, + const cob_field *f1, + const cob_field *f2 +) { - const size_t inspect_len = inspect_end - inspect_start; + const size_t len = st->end - st->start; - if (inspect_len == 0) { + if (len == 0) { /* our task is to convert either a zero-length field or AFTER ... has not found a place to start the conversion */ goto end; @@ -668,8 +733,8 @@ cob_inspect_converting (const cob_field *f1, const cob_field *f2) /* test _all_ positions of the inspect target against all entries of CONVERTING position by position */ { - unsigned char * cur_data = inspect_data + (inspect_start - inspect_data); - unsigned char * const cur_data_end = cur_data + inspect_len; + unsigned char * cur_data = st->data + (st->start - st->data); + unsigned char * const cur_data_end = cur_data + len; #if 1 /* table-approach, _much faster_, _should_ be portable */ /* pre-filled conversion table */ @@ -738,28 +803,33 @@ cob_inspect_converting (const cob_field *f1, const cob_field *f2) end: /* note: copied here for 3.2+ as cob_inspect_finish is not generated for TRANSFORM/INSPECT CONVERTING any more */ - if (inspect_var) { + if (st->var) { /* FIXME: needs test cases for all "goto end" cases above, ideally with a SIGN SEPARATE variable */ - cob_real_put_sign (inspect_var, inspect_sign); + cob_real_put_sign (st->var, st->sign); } } +void +cob_inspect_converting (const cob_field *f1, const cob_field *f2) +{ + cob_inspect_converting_mt (&share_inspect_state, f1, f2); +} /* note: currently not used by cobc (disabled unfinished prototype) */ void -cob_inspect_translating (const unsigned char *conv_table) +cob_inspect_translating_mt (struct cob_inspect_state *st, const unsigned char *conv_table) { - const size_t inspect_len = inspect_end - inspect_start; + const size_t len = st->end - st->start; - if (inspect_len == 0) { + if (len == 0) { /* our task is to convert either a zero-length field or AFTER ... has not found a place to start the conversion --> nothing to do here */ } else { /* directly convert _all_ positions of the inspect target using the pre-generated conversion table */ - unsigned char * cur_data = inspect_data + (inspect_start - inspect_data); - unsigned char * const cur_data_end = cur_data + inspect_len; + unsigned char * cur_data = st->data + (st->start - st->data); + unsigned char * const cur_data_end = cur_data + len; /* iterate over target converting with full table */ while (cur_data < cur_data_end) { @@ -768,40 +838,51 @@ cob_inspect_translating (const unsigned char *conv_table) } } - if (inspect_var) { - cob_real_put_sign (inspect_var, inspect_sign); + if (st->var) { + cob_real_put_sign (st->var, st->sign); } } +void +cob_inspect_translating (const unsigned char* conv_table) +{ + cob_inspect_translating_mt (&share_inspect_state, conv_table); +} void -cob_inspect_finish (void) +cob_inspect_finish_mt (struct cob_inspect_state *st) { /* Note: this is not called any more for TRANSFORM/INSPECT CONVERTING since GnuCOBOL 3.2 codegen (only for "old modules")! */ - if (inspect_replacing - && inspect_repdata_size != 0 /* check for first INSPECT REPLACING having zero length */ - && inspect_mark[inspect_mark_min] != 0) { + if (st->replacing + && st->repdata_size != 0 /* check for first INSPECT REPLACING having zero length */ + && st->mark[st->mark_min] != 0) { /* copy over replace data from first to last changed position */ size_t i; - for (i = inspect_mark_min; i <= inspect_mark_max; ++i) { - if (inspect_mark[i] != 0) { - inspect_data[i] = inspect_repdata[i]; + for (i = st->mark_min; i <= st->mark_max; ++i) { + if (st->mark[i] != 0) { + st->data[i] = st->repdata[i]; } } #if 0 /* drop data copy because of security issues [may only be done upon request]; if not active and that contains sensitive data do an INSPECT against a field of the same size to overwrite the buffer */ - memset (inspect_repdata + inspect_mark_min, 0, - inspect_mark_max - inspect_mark_min + 1); + memset (st->repdata + st->mark_min, 0, + st->mark_max - st->mark_min + 1); #endif } - if (inspect_var) { - cob_real_put_sign (inspect_var, inspect_sign); + if (st->var) { + cob_real_put_sign (st->var, st->sign); } } +void +cob_inspect_finish (void) +{ + cob_inspect_finish_mt (&share_inspect_state); +} + /* STRING */ /* a STRING is split into multiple parts: @@ -813,40 +894,54 @@ cob_inspect_finish (void) one-time cob_string_finish (setting the string pointer) */ void -cob_string_init (cob_field *dst, cob_field *ptr) +cob_string_init_mt (struct cob_string_state **pst, cob_field *dst, cob_field *ptr) { - string_dst_copy = *dst; - string_dst = &string_dst_copy; - string_ptr = NULL; + if (*pst == NULL) + *pst = malloc (sizeof(struct cob_string_state)); + struct cob_string_state *st = *pst; + + st->dst_copy = *dst; + st->dst = &st->dst_copy; + st->ptr = NULL; if (ptr) { - string_ptr_copy = *ptr; - string_ptr = &string_ptr_copy; + st->ptr_copy = *ptr; + st->ptr = &st->ptr_copy; } - string_offset = 0; + st->offset = 0; cobglobptr->cob_exception_code = 0; - if (string_ptr) { - string_offset = cob_get_int (string_ptr) - 1; - if (string_offset < 0 - || string_offset >= (int)string_dst->size) { + if (st->ptr) { + st->offset = cob_get_int (st->ptr) - 1; + if (st->offset < 0 + || st->offset >= (int)st->dst->size) { cob_set_exception (COB_EC_OVERFLOW_STRING); } } } +void +cob_string_init (cob_field *dst, cob_field *ptr) +{ + cob_string_init_mt (&pshare_string_state, dst, ptr); +} void -cob_string_delimited (cob_field *dlm) +cob_string_delimited_mt (struct cob_string_state *st, cob_field *dlm) { if (dlm) { - string_dlm_copy = *dlm; - string_dlm = &string_dlm_copy; + st->dlm_copy = *dlm; + st->dlm = &st->dlm_copy; } else { - string_dlm = NULL; + st->dlm = NULL; } } +void +cob_string_delimited (cob_field *dlm) +{ + cob_string_delimited_mt (&share_string_state, dlm); +} void -cob_string_append (cob_field *src) +cob_string_append_mt (struct cob_string_state *st, cob_field *src) { size_t src_size; int i; @@ -860,35 +955,45 @@ cob_string_append (cob_field *src) if (!src_size) { return; } - if (string_dlm) { - size = (int)(src_size - string_dlm->size + 1); + if (st->dlm) { + size = (int)(src_size - st->dlm->size + 1); for (i = 0; i < size; ++i) { - if (memcmp (src->data + i, string_dlm->data, - string_dlm->size) == 0) { + if (memcmp (src->data + i, st->dlm->data, + st->dlm->size) == 0) { src_size = i; break; } } } - if (src_size <= string_dst->size - string_offset) { - memcpy (string_dst->data + string_offset, src->data, src_size); - string_offset += (int) src_size; + if (src_size <= st->dst->size - st->offset) { + memcpy (st->dst->data + st->offset, src->data, src_size); + st->offset += (int) src_size; } else { - size = (int)(string_dst->size - string_offset); - memcpy (string_dst->data + string_offset, src->data, (size_t)size); - string_offset += size; + size = (int)(st->dst->size - st->offset); + memcpy (st->dst->data + st->offset, src->data, (size_t)size); + st->offset += size; cob_set_exception (COB_EC_OVERFLOW_STRING); } } +void +cob_string_append (cob_field *src) +{ + cob_string_append_mt (&share_string_state, src); +} void -cob_string_finish (void) +cob_string_finish_mt (struct cob_string_state *st) { - if (string_ptr) { - cob_set_int (string_ptr, string_offset + 1); + if (st->ptr) { + cob_set_int (st->ptr, st->offset + 1); } } +void +cob_string_finish (void) +{ + cob_string_finish_mt (&share_string_state); +} /* UNSTRING */ /* an UNSTRING is split into multiple parts: @@ -903,50 +1008,81 @@ cob_string_finish (void) one-time cob_unstring_finish (setting the string pointer / overflow exception) */ void -cob_unstring_init (cob_field *src, cob_field *ptr, const size_t num_dlm) +cob_unstring_init_mt ( + struct cob_unstring_state **pst, + cob_field *src, + cob_field *ptr, + const size_t num_dlm +) { - unstring_src_copy = *src; - unstring_src = &unstring_src_copy; - unstring_ptr = NULL; + if (*pst == NULL) { + *pst = malloc (sizeof(struct cob_unstring_state)); + (*pst)->dlm_list = NULL; + } + struct cob_unstring_state *st = *pst; + + st->src_copy = *src; + st->src = &st->src_copy; + st->ptr = NULL; if (ptr) { - unstring_ptr_copy = *ptr; - unstring_ptr = &unstring_ptr_copy; + st->ptr_copy = *ptr; + st->ptr = &st->ptr_copy; } - unstring_offset = 0; - unstring_count = 0; - unstring_ndlms = 0; + st->offset = 0; + st->count = 0; + st->ndlms = 0; + st->dlm_list_size = 0; cobglobptr->cob_exception_code = 0; - if (num_dlm > dlm_list_size) { - if (dlm_list) { - cob_free (dlm_list); - dlm_list_size = num_dlm; + if (num_dlm > st->dlm_list_size) { + if (st->dlm_list) { + cob_free (st->dlm_list); + st->dlm_list_size = num_dlm; } else if (num_dlm < DLM_DEFAULT_NUM) { - dlm_list_size = DLM_DEFAULT_NUM; + st->dlm_list_size = DLM_DEFAULT_NUM; } else { - dlm_list_size = num_dlm; + st->dlm_list_size = num_dlm; } - dlm_list = cob_malloc (dlm_list_size * sizeof(struct dlm_struct)); + st->dlm_list = cob_malloc (st->dlm_list_size * sizeof(struct dlm_struct)); } - if (unstring_ptr) { - unstring_offset = cob_get_int (unstring_ptr) - 1; - if (unstring_offset < 0 || unstring_offset >= (int)unstring_src->size) { + if (st->ptr) { + st->offset = cob_get_int (st->ptr) - 1; + if (st->offset < 0 || st->offset >= (int)st->src->size) { cob_set_exception (COB_EC_OVERFLOW_UNSTRING); } } } +void +cob_unstring_init ( + cob_field *src, + cob_field *ptr, + const size_t num_dlm +) +{ + cob_unstring_init_mt (&pshare_unstring_state, src, ptr, num_dlm); +} +void +cob_unstring_delimited_mt (struct cob_unstring_state *st, cob_field *dlm, const cob_u32_t all) +{ + st->dlm_list[st->ndlms].uns_dlm = *dlm; + st->dlm_list[st->ndlms].uns_all = all; + st->ndlms++; +} void cob_unstring_delimited (cob_field *dlm, const cob_u32_t all) { - dlm_list[unstring_ndlms].uns_dlm = *dlm; - dlm_list[unstring_ndlms].uns_all = all; - unstring_ndlms++; + cob_unstring_delimited_mt (&share_unstring_state, dlm, all); } void -cob_unstring_into (cob_field *dst, cob_field *dlm, cob_field *cnt) +cob_unstring_into_mt ( + struct cob_unstring_state *st, + cob_field *dst, + cob_field *dlm, + cob_field *cnt +) { unsigned char *dlm_data; unsigned char *start; @@ -961,45 +1097,45 @@ cob_unstring_into (cob_field *dst, cob_field *dlm, cob_field *cnt) return; } - if (unstring_offset >= (int)unstring_src->size) { + if (st->offset >= (int)st->src->size) { /* overflow from the last iteration (multiple INTO targets) */ return; } dlm_data = NULL; - start = unstring_src->data + unstring_offset; + start = st->src->data + st->offset; /* no delimiter - just split into DELIMITED BY SIZE */ - if (unstring_ndlms == 0) { + if (st->ndlms == 0) { /* necessary for correct unstring offset: minimal size */ /* Note: field->size and therefore offset are guaranteed to be < INT_MAX by cobc */ match_size = cob_min_int ((int)COB_FIELD_SIZE (dst), - (int)unstring_src->size - unstring_offset); + (int)st->src->size - st->offset); cob_str_memcpy (dst, start, match_size); - unstring_offset += match_size; + st->offset += match_size; /* DELIMITED BY [ALL] x [.. OR [ALL] z] */ } else { - const int srsize = (int)unstring_src->size; + const int srsize = (int)st->src->size; unsigned char *p; unsigned char *dp; int found = 0; /* note: duplicate code for performance as most cases have either none or a single delimiter */ - if (unstring_ndlms == 1) { - const struct dlm_struct dlms = dlm_list[0]; + if (st->ndlms == 1) { + const struct dlm_struct dlms = st->dlm_list[0]; const int dlsize = (int) dlms.uns_dlm.size; - const unsigned char *s = unstring_src->data + srsize - dlsize + 1; + const unsigned char *s = st->src->data + srsize - dlsize + 1; dp = dlms.uns_dlm.data; for (p = start; p < s; ++p) { if (!memcmp (p, dp, (size_t)dlsize)) { /* delimiter matches */ match_size = (int)(p - start); /* count in */ cob_str_memcpy (dst, start, match_size); /* into */ - unstring_offset += match_size + dlsize; /* with pointer */ + st->offset += match_size + dlsize; /* with pointer */ dlm_data = dp; dlm_size = dlsize; if (dlms.uns_all) { /* delimited by all */ @@ -1007,7 +1143,7 @@ cob_unstring_into (cob_field *dst, cob_field *dlm, cob_field *cnt) if (memcmp (p, dp, (size_t)dlsize)) { break; } - unstring_offset += dlsize; + st->offset += dlsize; } } found = 1; @@ -1015,11 +1151,11 @@ cob_unstring_into (cob_field *dst, cob_field *dlm, cob_field *cnt) } } } else { - const unsigned char *s = unstring_src->data + srsize; + const unsigned char *s = st->src->data + srsize; int i; for (p = start; p < s; ++p) { - for (i = 0; i < unstring_ndlms; ++i) { - const struct dlm_struct dlms = dlm_list[i]; + for (i = 0; i < st->ndlms; ++i) { + const struct dlm_struct dlms = st->dlm_list[i]; const int dlsize = (int)dlms.uns_dlm.size; const unsigned char *s2 = s - dlsize + 1; if (p > s2) { @@ -1029,7 +1165,7 @@ cob_unstring_into (cob_field *dst, cob_field *dlm, cob_field *cnt) if (!memcmp (p, dp, (size_t)dlsize)) { /* delimiter matches */ match_size = (int)(p - start); /* count in */ cob_str_memcpy (dst, start, match_size); /* into */ - unstring_offset += match_size + dlsize; /* with pointer */ + st->offset += match_size + dlsize; /* with pointer */ dlm_data = dp; dlm_size = dlsize; if (dlms.uns_all) { /* delimited by all */ @@ -1037,7 +1173,7 @@ cob_unstring_into (cob_field *dst, cob_field *dlm, cob_field *cnt) if (memcmp (p, dp, (size_t)dlsize)) { break; } - unstring_offset += dlsize; + st->offset += dlsize; } } found = 1; @@ -1052,12 +1188,12 @@ cob_unstring_into (cob_field *dst, cob_field *dlm, cob_field *cnt) /* if none of the delimiters matched, match to end */ if (!found) { - match_size = (int)(unstring_src->size - unstring_offset); + match_size = (int)(st->src->size - st->offset); cob_str_memcpy (dst, start, match_size); - unstring_offset = (int) unstring_src->size; + st->offset = (int) st->src->size; } } - unstring_count++; + st->count++; /* note: per any known dialect both DELIMITER IN and COUNT IN are only allowed if there is a DELIMITED BY phrase; the GnuCOBOL parser @@ -1079,47 +1215,69 @@ cob_unstring_into (cob_field *dst, cob_field *dlm, cob_field *cnt) cob_set_int (cnt, match_size); } } +void +cob_unstring_into ( + cob_field *dst, + cob_field *dlm, + cob_field *cnt +) +{ + cob_unstring_into_mt (&share_unstring_state, dst, dlm, cnt); +} +void +cob_unstring_tallying_mt (struct cob_unstring_state *st, cob_field *f) +{ + cob_add_int (f, st->count, 0); +} void cob_unstring_tallying (cob_field *f) { - cob_add_int (f, unstring_count, 0); + cob_unstring_tallying_mt (&share_unstring_state, f); } void -cob_unstring_finish (void) +cob_unstring_finish_mt (struct cob_unstring_state *st) { - if (unstring_offset < (int)unstring_src->size) { + if (st->offset < (int)st->src->size) { /* overflow from any iteration -> overflow exception */ cob_set_exception (COB_EC_OVERFLOW_UNSTRING); } - if (unstring_ptr) { - cob_set_int (unstring_ptr, unstring_offset + 1); + if (st->ptr) { + cob_set_int (st->ptr, st->offset + 1); } } +void +cob_unstring_finish (void) +{ + cob_unstring_finish_mt (&share_unstring_state); +} /* Initialization/Termination */ void -cob_exit_strings (void) +cob_exit_strings () { - if (inspect_mark) { - cob_free (inspect_mark); - inspect_mark = NULL; + struct cob_inspect_state *sti = &share_inspect_state; + struct cob_unstring_state *stu = &share_unstring_state; + + if (sti->mark) { + cob_free (sti->mark); + sti->mark = NULL; } - inspect_mark_size = inspect_mark_min = inspect_mark_max = 0; - if (inspect_repdata) { - cob_free (inspect_repdata); - inspect_repdata = NULL; + sti->mark_size = sti->mark_min = sti->mark_max = 0; + if (sti->repdata) { + cob_free (sti->repdata); + sti->repdata = NULL; } - inspect_repdata_size = 0; + sti->repdata_size = 0; - if (dlm_list) { - cob_free (dlm_list); - dlm_list = NULL; + if (stu->dlm_list) { + cob_free (stu->dlm_list); + stu->dlm_list = NULL; } - dlm_list_size = 0; + stu->dlm_list_size = 0; if (figurative_ptr) { cob_free (figurative_ptr); diff --git a/tests/ChangeLog b/tests/ChangeLog index aa1608f63..d64a60242 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,4 +1,10 @@ +2024-02-26 Boris Eng + + * testsuite.at: added a new test suite to test the backward compatibility + of strings functions (INSPECT, STRING, UNSTRING) for versions of compilers + not using thread-safe functions for strings + 2023-07-10 Simon Sobisch * atlocal_win: updated to current atlocal.in diff --git a/tests/Makefile.am b/tests/Makefile.am index c4acdbff9..1f6027245 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -64,7 +64,8 @@ testsuite_sources = \ testsuite.src/data_packed.at \ testsuite.src/data_pointer.at \ testsuite.src/numeric-dump.cob \ - testsuite.src/numeric-display.cob + testsuite.src/numeric-display.cob \ + testsuite.src/backcomp.at testsuite_manual_sources = \ testsuite.src/run_manual_screen.at diff --git a/tests/testsuite.at b/tests/testsuite.at index 1b1c2baf7..a40cc5e67 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -81,3 +81,7 @@ m4_include([data_binary.at]) # USAGE BINARY m4_include([data_display.at]) # USAGE DISPLAY m4_include([data_packed.at]) # USAGE PACKED-DECIMAL m4_include([data_pointer.at]) # USAGE POINTER + +## Test for backward compatibility +AT_BANNER([Backward compatibility]) +m4_include([backcomp.at]) diff --git a/tests/testsuite.src/backcomp.at b/tests/testsuite.src/backcomp.at new file mode 100644 index 000000000..980351e96 --- /dev/null +++ b/tests/testsuite.src/backcomp.at @@ -0,0 +1,10939 @@ +## Copyright (C) 2014-2023 Free Software Foundation, Inc. +## Written by Boris Eng +## +## This file is part of GnuCOBOL. +## +## The GnuCOBOL compiler is free software: you can redistribute it +## and/or modify it under the terms of the GNU General Public License +## as published by the Free Software Foundation, either version 3 of the +## License, or (at your option) any later version. +## +## GnuCOBOL is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with GnuCOBOL. If not, see . + +### GnuCOBOL Test Suite + + +AT_SETUP([INSPECT REPLACING LEADING ZEROS BY SPACES]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 15 2024 16:57:49 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 15 2024 16:57:49" +#define COB_MODULE_DATE 20240415 +#define COB_MODULE_TIME 165749 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 15 2024 16:57:49 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; + +static const cob_field_attr cob_all_attr = {0x22, 0, 0, 0, NULL}; + + +/* Constants */ +static const cob_field c_1 = {25, (cob_u8_ptr)"Should be ' 1' but is '", &a_2}; +static const cob_field c_2 = {1, (cob_u8_ptr)"'", &a_2}; + +static cob_field cob_all_space = {1, (cob_u8_ptr)" ", &cob_all_attr}; +static cob_field cob_all_zero = {1, (cob_u8_ptr)"0", &cob_all_attr}; + + /* Decimal constants */ + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 15 2024 16:57:49 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[4] __attribute__((aligned)); /* X */ + + /* End of data storage */ + + + /* Fields */ + static cob_field f_6 = {4, b_6, &a_1}; /* X */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 7 : Entry prog : prog.cob */ + l_2:; + + /* Line: 7 : INSPECT : prog.cob */ + cob_inspect_init (&f_6, 1); + cob_inspect_start (); + cob_inspect_leading (&cob_all_space, &cob_all_zero); + cob_inspect_finish (); + + /* Line: 8 : IF : prog.cob */ + if (((int)memcmp (b_6, (cob_u8_ptr)" 1", 4) != 0)) + { + + /* Line: 9 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_1, &f_6, &c_2); + } + + /* Line: 10 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memcpy (b_6, "0001", 4); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + +AT_SETUP([INSPECT: no repeat conversion]) +AT_KEYWORDS([runmisc INSPECT]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 15 2024 16:59:17 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 15 2024 16:59:17" +#define COB_MODULE_DATE 20240415 +#define COB_MODULE_TIME 165917 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 15 2024 16:59:17 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; + + +/* Constants */ +static const cob_field c_1 = {3, (cob_u8_ptr)"ABC", &a_2}; +static const cob_field c_2 = {3, (cob_u8_ptr)"BCD", &a_2}; +static const cob_field c_3 = {3, (cob_u8_ptr)"X: ", &a_2}; +static const cob_field c_4 = {3, (cob_u8_ptr)"Y: ", &a_2}; + + /* Decimal constants */ + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 15 2024 16:59:17 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[3] __attribute__((aligned)); /* X */ + static cob_u8_t b_7[6] __attribute__((aligned)); /* Y */ + + /* End of data storage */ + + + /* Fields */ + static cob_field f_6 = {3, b_6, &a_1}; /* X */ + static cob_field f_7 = {6, b_7, &a_1}; /* Y */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 8 : Entry prog : prog.cob */ + l_2:; + + /* Line: 8 : INSPECT : prog.cob */ + cob_inspect_init (&f_6, 0); + cob_inspect_start (); + cob_inspect_converting ((cob_field *)&c_1, (cob_field *)&c_2); + cob_inspect_finish (); + + /* Line: 9 : IF : prog.cob */ + if (((int)memcmp (b_6, (cob_u8_ptr)"CDB", 3) != 0)) + { + + /* Line: 10 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_3, &f_6); + } + + /* Line: 11 : INSPECT : prog.cob */ + cob_inspect_init (&f_7, 0); + cob_inspect_start (); + cob_inspect_converting ((cob_field *)&c_1, (cob_field *)&c_2); + cob_inspect_finish (); + + /* Line: 12 : IF : prog.cob */ + if (((int)memcmp (b_7, (cob_u8_ptr)" CDB", 6) != 0)) + { + + /* Line: 13 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_4, &f_7); + } + + /* Line: 14 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memcpy (b_6, "BCA", 3); + memcpy (b_7, " BCA", 6); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + +AT_SETUP([TRANSFORM statement]) +AT_KEYWORDS([runmisc CONVERTING ALPHABET]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 3.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 17 2024 11:48:41 */ +/* GnuCOBOL build date Apr 17 2024 11:34:39 */ +/* GnuCOBOL package date Jul 28 2023 17:02:56 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include /* for memcpy, memcmp and friends */ +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "3.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 17 2024 11:48:41" +#define COB_MODULE_DATE 20240417 +#define COB_MODULE_TIME 114841 + +/* Global variables */ +/* Generated by cobc 3.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 17 2024 11:48:41 */ +/* GnuCOBOL build date Apr 17 2024 11:34:39 */ +/* GnuCOBOL package date Jul 28 2023 17:02:56 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; + + +/* Constants */ +static const cob_field c_1 = {3, (cob_u8_ptr)"ABC", &a_2}; +static const cob_field c_2 = {3, (cob_u8_ptr)"BCD", &a_2}; +static const cob_field c_3 = {3, (cob_u8_ptr)"CDB", &a_2}; +static const cob_field c_4 = {3, (cob_u8_ptr)"X: ", &a_2}; + + +/* NATIVE table */ +static const unsigned char cob_native[256] = { + 0000, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, +}; +static cob_field f_native = { 256, (cob_u8_ptr)cob_native, &a_1 }; + + +/* ASCII to EBCDIC table */ +static const unsigned char cob_ascii_ebcdic[256] = { + 0000, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, + 0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, + 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, + 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, + 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, + 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, + 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, + 0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d, + 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, + 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, + 0xa7, 0xa8, 0xa9, 0xc0, 0x6a, 0xd0, 0xa1, 0x07, + 0x68, 0xdc, 0x51, 0x42, 0x43, 0x44, 0x47, 0x48, + 0x52, 0x53, 0x54, 0x57, 0x56, 0x58, 0x63, 0x67, + 0x71, 0x9c, 0x9e, 0xcb, 0xcc, 0xcd, 0xdb, 0xdd, + 0xdf, 0xec, 0xfc, 0xb0, 0xb1, 0xb2, 0x3e, 0xb4, + 0x45, 0x55, 0xce, 0xde, 0x49, 0x69, 0x9a, 0x9b, + 0xab, 0x9f, 0xba, 0xb8, 0xb7, 0xaa, 0x8a, 0x8b, + 0xb6, 0xb5, 0x62, 0x4f, 0x64, 0x65, 0x66, 0x20, + 0x21, 0x22, 0x70, 0x23, 0x72, 0x73, 0x74, 0xbe, + 0x76, 0x77, 0x78, 0x80, 0x24, 0x15, 0x8c, 0x8d, + 0x8e, 0x41, 0x06, 0x17, 0x28, 0x29, 0x9d, 0x2a, + 0x2b, 0x2c, 0x09, 0x0a, 0xac, 0x4a, 0xae, 0xaf, + 0x1b, 0x30, 0x31, 0xfa, 0x1a, 0x33, 0x34, 0x35, + 0x36, 0x59, 0x08, 0x38, 0xbc, 0x39, 0xa0, 0xbf, + 0xca, 0x3a, 0xfe, 0x3b, 0x04, 0xcf, 0xda, 0x14, + 0xe1, 0x8f, 0x46, 0x75, 0xfd, 0xeb, 0xee, 0xed, + 0x90, 0xef, 0xb3, 0xfb, 0xb9, 0xea, 0xbb, 0xff, +}; +static cob_field f_ascii_ebcdic = { 256, (cob_u8_ptr)cob_ascii_ebcdic, &a_1 }; + + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); +static void prog_module_init (cob_module *module); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +static void gc_module_so_init () __attribute__ ((constructor)); +static void gc_module_so_init () +{ + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); +} + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 3.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 17 2024 11:48:41 */ + /* GnuCOBOL build date Apr 17 2024 11:34:39 */ + /* GnuCOBOL package date Jul 28 2023 17:02:56 UTC */ + /* Compile command /opt/gnucobol/gnucobol-3.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* LINKAGE SECTION (Items not referenced by USING clause) */ + static unsigned char *b_9 = NULL; /* XML-NAMESPACE */ + static unsigned char *b_10 = NULL; /* XML-NAMESPACE-PREFIX */ + static unsigned char *b_11 = NULL; /* XML-NNAMESPACE */ + static unsigned char *b_12 = NULL; /* XML-NNAMESPACE-PREFIX */ + static unsigned char *b_13 = NULL; /* XML-NTEXT */ + static unsigned char *b_14 = NULL; /* XML-TEXT */ + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_17[3] __attribute__((aligned)); /* X */ + + /* End of local data storage */ + + + /* Fields (local) */ + static cob_field f_17 = {3, b_17, &a_1}; /* X */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -10) + goto P_dump; + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 15 : Entry prog : prog.cob */ + l_2:; + + /* Line: 15 : TRANSFORM : prog.cob */ + cob_inspect_init_converting (&f_17); + cob_inspect_start (); + cob_inspect_converting ((cob_field *)&c_1, (cob_field *)&c_2); + + /* Line: 16 : IF : prog.cob */ + if (((int)cob_cmp (&f_17, (cob_field *)&c_3) != 0)) + { + + /* Line: 17 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_4, &f_17); + } + + /* Line: 19 : TRANSFORM : prog.cob */ + cob_inspect_init_converting (&f_17); + cob_inspect_start (); + cob_inspect_converting (&f_native, &f_ascii_ebcdic); + + /* Line: 21 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + P_cgerror: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + prog_module_init (module); + + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->xml_code = NULL; + module->xml_event = NULL; + module->xml_information = NULL; + module->xml_namespace = NULL; + module->xml_namespace_prefix = NULL; + module->xml_nnamespace = NULL; + module->xml_nnamespace_prefix = NULL; + module->xml_ntext = NULL; + module->xml_text = NULL; + module->json_code = NULL; + module->json_status = NULL; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + /* initialize field RETURN-CODE */ + b_2 = 0; + + /* initialize field X */ + memcpy (b_17, "BCA", 3); + + + if (0 == 1) goto P_cgerror; + initialized = 1; + goto P_ret_initialize; + + P_dump: + return 0; + + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) + return 0; + if (module && module->module_active) + cob_fatal_error (COB_FERROR_CANCEL); + + initialized = 0; + + P_clear_decimal: + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* Initialize module structure for prog */ +static void prog_module_init (cob_module *module) +{ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->gc_version = COB_PACKAGE_VERSION; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + module->flag_debug_trace = 0; + module->flag_dump_ready = 0; + module->xml_mode = 1; + module->module_stmt = 0; + module->module_sources = NULL; +} + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + +AT_SETUP([INSPECT CONVERTING alphabet]) +AT_KEYWORDS([runmisc ASCII EBCDIC]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 3.1.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 17 2024 11:53:20 */ +/* GnuCOBOL build date Apr 17 2024 11:33:59 */ +/* GnuCOBOL package date Dec 23 2020 12:04:58 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.1/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "3.1.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 17 2024 11:53:20" +#define COB_MODULE_DATE 20240417 +#define COB_MODULE_TIME 115320 + +/* Global variables */ +/* Generated by cobc 3.1.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 17 2024 11:53:20 */ +/* GnuCOBOL build date Apr 17 2024 11:33:59 */ +/* GnuCOBOL package date Dec 23 2020 12:04:58 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.1/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; + + +/* Constants */ +static const cob_field c_1 = {12, (cob_u8_ptr)"Converted: \"", &a_2}; +static const cob_field c_2 = {1, (cob_u8_ptr)"\"", &a_2}; + + +/* ASCII to EBCDIC table */ +static const unsigned char cob_ascii_ebcdic[256] = { + 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, + 0x16, 0x05, 0x25, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, + 0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F, + 0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, + 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, + 0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F, + 0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, + 0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, + 0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, + 0xE7, 0xE8, 0xE9, 0xAD, 0xE0, 0xBD, 0x5F, 0x6D, + 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, + 0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, + 0xA7, 0xA8, 0xA9, 0xC0, 0x6A, 0xD0, 0xA1, 0x07, + 0x68, 0xDC, 0x51, 0x42, 0x43, 0x44, 0x47, 0x48, + 0x52, 0x53, 0x54, 0x57, 0x56, 0x58, 0x63, 0x67, + 0x71, 0x9C, 0x9E, 0xCB, 0xCC, 0xCD, 0xDB, 0xDD, + 0xDF, 0xEC, 0xFC, 0xB0, 0xB1, 0xB2, 0x3E, 0xB4, + 0x45, 0x55, 0xCE, 0xDE, 0x49, 0x69, 0x9A, 0x9B, + 0xAB, 0x9F, 0xBA, 0xB8, 0xB7, 0xAA, 0x8A, 0x8B, + 0xB6, 0xB5, 0x62, 0x4F, 0x64, 0x65, 0x66, 0x20, + 0x21, 0x22, 0x70, 0x23, 0x72, 0x73, 0x74, 0xBE, + 0x76, 0x77, 0x78, 0x80, 0x24, 0x15, 0x8C, 0x8D, + 0x8E, 0x41, 0x06, 0x17, 0x28, 0x29, 0x9D, 0x2A, + 0x2B, 0x2C, 0x09, 0x0A, 0xAC, 0x4A, 0xAE, 0xAF, + 0x1B, 0x30, 0x31, 0xFA, 0x1A, 0x33, 0x34, 0x35, + 0x36, 0x59, 0x08, 0x38, 0xBC, 0x39, 0xA0, 0xBF, + 0xCA, 0x3A, 0xFE, 0x3B, 0x04, 0xCF, 0xDA, 0x14, + 0xE1, 0x8F, 0x46, 0x75, 0xFD, 0xEB, 0xEE, 0xED, + 0x90, 0xEF, 0xB3, 0xFB, 0xB9, 0xEA, 0xBB, 0xFF +}; +static cob_field f_ascii_ebcdic = { 256, (cob_u8_ptr)cob_ascii_ebcdic, &a_1 }; + + +/* NATIVE table */ +static const unsigned char cob_native[256] = { + 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255 +}; +static cob_field f_native = { 256, (cob_u8_ptr)cob_native, &a_1 }; + + + +/* Function prototypes */ + +static int charset (); +static int charset_ (const int); +static void charset_module_init (cob_module *module); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (charset ()); +} + +/* Functions */ + +/* PROGRAM-ID 'charset' */ + +/* ENTRY 'charset' */ + +static int +charset () +{ + return charset_ (0); +} + +static int +charset_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 3.1.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 17 2024 11:53:20 */ + /* GnuCOBOL build date Apr 17 2024 11:33:59 */ + /* GnuCOBOL package date Dec 23 2020 12:04:58 UTC */ + /* Compile command /opt/gnucobol/gnucobol-3.1/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'charset' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_8[10] __attribute__((aligned)); /* TESTHEX */ + + /* End of local data storage */ + + + /* Fields (local) */ + static cob_field f_8 = {10, b_8, &a_1}; /* TESTHEX */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -10) + goto P_dump; + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 15 : Entry charset : prog.cob */ + l_2:; + + /* Line: 16 : Paragraph sample-main : prog.cob */ + + /* Line: 18 : INSPECT : prog.cob */ + cob_inspect_init (&f_8, 0); + cob_inspect_start (); + cob_inspect_converting (&f_ascii_ebcdic, &f_native); + cob_inspect_finish (); + + /* Line: 19 : DISPLAY : prog.cob */ + cob_display (0, 0, 3, &c_1, &f_8, &c_2); + + /* Line: 21 : GOBACK : prog.cob */ + goto exit_program; + + /* Program exit */ + + exit_program: + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + P_cgerror: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + charset_module_init (module); + + module->crt_status = NULL; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memcpy (b_8, "\301{\326\362\360\361\370@jZ", 10); + + if (0 == 1) goto P_cgerror; + initialized = 1; + goto P_ret_initialize; + + P_dump: + return 0; + + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) + return 0; + if (module && module->module_active) + cob_fatal_error (COB_FERROR_CANCEL); + + initialized = 0; + + P_clear_decimal: + return 0; + +} + +/* End PROGRAM-ID 'charset' */ + +/* Initialize module structure for charset */ +static void charset_module_init (cob_module *module) +{ + module->module_name = "charset"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())charset; + module->module_cancel.funcptr = (void *(*)())charset_; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + module->flag_debug_trace = 0; + module->flag_dump_ready = 0; + module->module_stmt = 0; + module->module_sources = NULL; +} + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], +[Converted: "A#O2018 |!"], []) + +AT_DATA([prog.c], [[ +/* Generated by cobc 3.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 17 2024 12:01:07 */ +/* GnuCOBOL build date Apr 17 2024 11:34:39 */ +/* GnuCOBOL package date Jul 28 2023 17:02:56 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.2/bin/cobc -Cx -febcdic-table=ebcdic500_ascii7bit -fno-computed-goto prog.cob */ + +#include /* for memcpy, memcmp and friends */ +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "3.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 17 2024 12:01:07" +#define COB_MODULE_DATE 20240417 +#define COB_MODULE_TIME 120107 + +/* Global variables */ +/* Generated by cobc 3.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 17 2024 12:01:07 */ +/* GnuCOBOL build date Apr 17 2024 11:34:39 */ +/* GnuCOBOL package date Jul 28 2023 17:02:56 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.2/bin/cobc -Cx -febcdic-table=ebcdic500_ascii7bit -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; + + +/* Constants */ +static const cob_field c_1 = {12, (cob_u8_ptr)"Converted: \"", &a_2}; +static const cob_field c_2 = {1, (cob_u8_ptr)"\"", &a_2}; + + +/* NATIVE table */ +static const unsigned char cob_native[256] = { + 0000, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, +}; +static cob_field f_native = { 256, (cob_u8_ptr)cob_native, &a_1 }; + + +/* ASCII to EBCDIC table */ +static const unsigned char cob_ascii_ebcdic[256] = { + 0000, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, + 0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, + 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, + 0x40, 0x4f, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, + 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, + 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, + 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, + 0xe7, 0xe8, 0xe9, 0x4a, 0xe0, 0x5a, 0x5f, 0x6d, + 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, + 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, + 0xa7, 0xa8, 0xa9, 0xc0, 0x6a, 0xd0, 0xa1, 0x07, + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, +}; +static cob_field f_ascii_ebcdic = { 256, (cob_u8_ptr)cob_ascii_ebcdic, &a_1 }; + + + +/* Function prototypes */ + +static int charset (); +static int charset_ (const int); +static void charset_module_init (cob_module *module); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (charset ()); +} + +/* Functions */ + +static void gc_module_so_init () __attribute__ ((constructor)); +static void gc_module_so_init () +{ + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); +} + +/* PROGRAM-ID 'charset' */ + +/* ENTRY 'charset' */ + +static int +charset () +{ + return charset_ (0); +} + +static int +charset_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 3.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 17 2024 12:01:07 */ + /* GnuCOBOL build date Apr 17 2024 11:34:39 */ + /* GnuCOBOL package date Jul 28 2023 17:02:56 UTC */ + /* Compile command /opt/gnucobol/gnucobol-3.2/bin/cobc -Cx -febcdic-table=ebcdic500_ascii7bit -fno-computed-goto prog.cob */ + + /* Program local variables for 'charset' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* LINKAGE SECTION (Items not referenced by USING clause) */ + static unsigned char *b_9 = NULL; /* XML-NAMESPACE */ + static unsigned char *b_10 = NULL; /* XML-NAMESPACE-PREFIX */ + static unsigned char *b_11 = NULL; /* XML-NNAMESPACE */ + static unsigned char *b_12 = NULL; /* XML-NNAMESPACE-PREFIX */ + static unsigned char *b_13 = NULL; /* XML-NTEXT */ + static unsigned char *b_14 = NULL; /* XML-TEXT */ + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_17[10] __attribute__((aligned)); /* TESTHEX */ + + /* End of local data storage */ + + + /* Fields (local) */ + static cob_field f_17 = {10, b_17, &a_1}; /* TESTHEX */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -10) + goto P_dump; + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 16 : Entry charset : prog.cob */ + l_2:; + + /* Line: 16 : Paragraph sample-main : prog.cob */ + + /* Line: 18 : INSPECT : prog.cob */ + cob_inspect_init_converting (&f_17); + cob_inspect_start (); + cob_inspect_converting (&f_ascii_ebcdic, &f_native); + + /* Line: 19 : DISPLAY : prog.cob */ + cob_display (0, 0, 3, &c_1, &f_17, &c_2); + + /* Line: 21 : GOBACK : prog.cob */ + goto exit_program; + + /* Program exit */ + + exit_program: + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + P_cgerror: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + charset_module_init (module); + + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->xml_code = NULL; + module->xml_event = NULL; + module->xml_information = NULL; + module->xml_namespace = NULL; + module->xml_namespace_prefix = NULL; + module->xml_nnamespace = NULL; + module->xml_nnamespace_prefix = NULL; + module->xml_ntext = NULL; + module->xml_text = NULL; + module->json_code = NULL; + module->json_status = NULL; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + /* initialize field RETURN-CODE */ + b_2 = 0; + + /* initialize field TESTHEX */ + memcpy (b_17, "\301{\326\362\360\361\370@jZ", 10); + + + if (0 == 1) goto P_cgerror; + initialized = 1; + goto P_ret_initialize; + + P_dump: + return 0; + + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) + return 0; + if (module && module->module_active) + cob_fatal_error (COB_FERROR_CANCEL); + + initialized = 0; + + P_clear_decimal: + return 0; + +} + +/* End PROGRAM-ID 'charset' */ + +/* Initialize module structure for charset */ +static void charset_module_init (cob_module *module) +{ + module->module_name = "charset"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->gc_version = COB_PACKAGE_VERSION; + module->module_entry.funcptr = (void *(*)())charset; + module->module_cancel.funcptr = (void *(*)())charset_; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + module->flag_debug_trace = 0; + module->flag_dump_ready = 0; + module->xml_mode = 1; + module->module_stmt = 0; + module->module_sources = NULL; +} + +/* End functions */ + + +]]) + +# For characters above IBM (with irregularities) and GCOS should match: +AT_CHECK([$COMPILE prog.c -febcdic-table=ebcdic500_ascii7bit -o prog-ibm], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog-ibm], [0], +[Converted: "A#O2018 |@:>@"], []) # prefix is actually "|]" (escaped for m4 preproc) + +AT_DATA([prog.c], [[ +/* Generated by cobc 3.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 17 2024 12:03:28 */ +/* GnuCOBOL build date Apr 17 2024 11:34:39 */ +/* GnuCOBOL package date Jul 28 2023 17:02:56 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.2/bin/cobc -Cx -febcdic-table=ebcdic500_ascii8bit -fno-computed-goto prog.cob */ + +#include /* for memcpy, memcmp and friends */ +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "3.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 17 2024 12:03:28" +#define COB_MODULE_DATE 20240417 +#define COB_MODULE_TIME 120328 + +/* Global variables */ +/* Generated by cobc 3.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 17 2024 12:03:28 */ +/* GnuCOBOL build date Apr 17 2024 11:34:39 */ +/* GnuCOBOL package date Jul 28 2023 17:02:56 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.2/bin/cobc -Cx -febcdic-table=ebcdic500_ascii8bit -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; + + +/* Constants */ +static const cob_field c_1 = {12, (cob_u8_ptr)"Converted: \"", &a_2}; +static const cob_field c_2 = {1, (cob_u8_ptr)"\"", &a_2}; + + +/* NATIVE table */ +static const unsigned char cob_native[256] = { + 0000, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, +}; +static cob_field f_native = { 256, (cob_u8_ptr)cob_native, &a_1 }; + + +/* ASCII to EBCDIC table */ +static const unsigned char cob_ascii_ebcdic[256] = { + 0000, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, + 0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, + 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, + 0x40, 0x4f, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, + 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, + 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, + 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, + 0xe7, 0xe8, 0xe9, 0x4a, 0xe0, 0x5a, 0x5f, 0x6d, + 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, + 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, + 0xa7, 0xa8, 0xa9, 0xc0, 0x6a, 0xd0, 0xa1, 0x07, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x15, 0x06, 0x17, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x1b, + 0x30, 0x31, 0x1a, 0x33, 0x34, 0x35, 0x36, 0x08, + 0x38, 0x39, 0x3a, 0x3b, 0x04, 0x14, 0x3e, 0xe1, + 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, + 0x49, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, + 0x76, 0x77, 0x78, 0x80, 0x8a, 0x8b, 0x8c, 0x8d, + 0x8e, 0x8f, 0x90, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, + 0x9f, 0xa0, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xda, 0xdb, + 0xdc, 0xdd, 0xde, 0xdf, 0xea, 0xeb, 0xec, 0xed, + 0xee, 0xef, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, +}; +static cob_field f_ascii_ebcdic = { 256, (cob_u8_ptr)cob_ascii_ebcdic, &a_1 }; + + + +/* Function prototypes */ + +static int charset (); +static int charset_ (const int); +static void charset_module_init (cob_module *module); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (charset ()); +} + +/* Functions */ + +static void gc_module_so_init () __attribute__ ((constructor)); +static void gc_module_so_init () +{ + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); +} + +/* PROGRAM-ID 'charset' */ + +/* ENTRY 'charset' */ + +static int +charset () +{ + return charset_ (0); +} + +static int +charset_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 3.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 17 2024 12:03:28 */ + /* GnuCOBOL build date Apr 17 2024 11:34:39 */ + /* GnuCOBOL package date Jul 28 2023 17:02:56 UTC */ + /* Compile command /opt/gnucobol/gnucobol-3.2/bin/cobc -Cx -febcdic-table=ebcdic500_ascii8bit -fno-computed-goto prog.cob */ + + /* Program local variables for 'charset' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* LINKAGE SECTION (Items not referenced by USING clause) */ + static unsigned char *b_9 = NULL; /* XML-NAMESPACE */ + static unsigned char *b_10 = NULL; /* XML-NAMESPACE-PREFIX */ + static unsigned char *b_11 = NULL; /* XML-NNAMESPACE */ + static unsigned char *b_12 = NULL; /* XML-NNAMESPACE-PREFIX */ + static unsigned char *b_13 = NULL; /* XML-NTEXT */ + static unsigned char *b_14 = NULL; /* XML-TEXT */ + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_17[10] __attribute__((aligned)); /* TESTHEX */ + + /* End of local data storage */ + + + /* Fields (local) */ + static cob_field f_17 = {10, b_17, &a_1}; /* TESTHEX */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -10) + goto P_dump; + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 16 : Entry charset : prog.cob */ + l_2:; + + /* Line: 16 : Paragraph sample-main : prog.cob */ + + /* Line: 18 : INSPECT : prog.cob */ + cob_inspect_init_converting (&f_17); + cob_inspect_start (); + cob_inspect_converting (&f_ascii_ebcdic, &f_native); + + /* Line: 19 : DISPLAY : prog.cob */ + cob_display (0, 0, 3, &c_1, &f_17, &c_2); + + /* Line: 21 : GOBACK : prog.cob */ + goto exit_program; + + /* Program exit */ + + exit_program: + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + P_cgerror: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + charset_module_init (module); + + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->xml_code = NULL; + module->xml_event = NULL; + module->xml_information = NULL; + module->xml_namespace = NULL; + module->xml_namespace_prefix = NULL; + module->xml_nnamespace = NULL; + module->xml_nnamespace_prefix = NULL; + module->xml_ntext = NULL; + module->xml_text = NULL; + module->json_code = NULL; + module->json_status = NULL; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + /* initialize field RETURN-CODE */ + b_2 = 0; + + /* initialize field TESTHEX */ + memcpy (b_17, "\301{\326\362\360\361\370@jZ", 10); + + + if (0 == 1) goto P_cgerror; + initialized = 1; + goto P_ret_initialize; + + P_dump: + return 0; + + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) + return 0; + if (module && module->module_active) + cob_fatal_error (COB_FERROR_CANCEL); + + initialized = 0; + + P_clear_decimal: + return 0; + +} + +/* End PROGRAM-ID 'charset' */ + +/* Initialize module structure for charset */ +static void charset_module_init (cob_module *module) +{ + module->module_name = "charset"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->gc_version = COB_PACKAGE_VERSION; + module->module_entry.funcptr = (void *(*)())charset; + module->module_cancel.funcptr = (void *(*)())charset_; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + module->flag_debug_trace = 0; + module->flag_dump_ready = 0; + module->xml_mode = 1; + module->module_stmt = 0; + module->module_sources = NULL; +} + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c -febcdic-table=ebcdic500_ascii8bit -o prog-gcos], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog-gcos], [0], +[Converted: "A#O2018 |@:>@"], []) # prefix is actually "|]" (escaped for m4 preproc) + +# FIXME: This really does not convert to anything close to ASCII; +# what's this table supposed to encode? +# AT_CHECK([$COMPILE prog.c -febcdic-table=RESTRICTED-GC -o prog-rgc], [0], [], []) +# AT_CHECK([$COBCRUN_DIRECT ./prog-rgc], [0], []) + +AT_CLEANUP + + +AT_SETUP([INSPECT CONVERTING TO figurative constant]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 10:57:28 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 10:57:28" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 105728 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 10:57:28 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; + +static const cob_field_attr cob_all_attr = {0x22, 0, 0, 0, NULL}; + + +/* Constants */ +static const cob_field c_1 = {3, (cob_u8_ptr)"ABC", &a_2}; + +static cob_field cob_all_space = {1, (cob_u8_ptr)" ", &cob_all_attr}; + + /* Decimal constants */ + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 10:57:28 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[3] __attribute__((aligned)); /* X */ + + /* End of data storage */ + + + /* Fields */ + static cob_field f_6 = {3, b_6, &a_1}; /* X */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 7 : Entry prog : prog.cob */ + l_2:; + + /* Line: 7 : INSPECT : prog.cob */ + cob_inspect_init (&f_6, 0); + cob_inspect_start (); + cob_inspect_converting ((cob_field *)&c_1, &cob_all_space); + cob_inspect_finish (); + + /* Line: 8 : IF : prog.cob */ + if (((int)cob_cmp (&f_6, &cob_all_space) != 0)) + { + + /* Line: 9 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &f_6); + } + + /* Line: 10 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memcpy (b_6, "BCA", 3); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + + +AT_SETUP([INSPECT CONVERTING NULL]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:02:55 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:02:55" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 110255 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:02:55 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; + + +/* Constants */ +static const cob_field c_1 = {1, (cob_u8_ptr)"A", &a_2}; + + /* Decimal constants */ + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 11:02:55 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[3] __attribute__((aligned)); /* X */ + + /* End of data storage */ + + + /* Fields */ + static cob_field f_6 = {3, b_6, &a_1}; /* X */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 7 : Entry prog : prog.cob */ + l_2:; + + /* Line: 7 : INSPECT : prog.cob */ + cob_inspect_init (&f_6, 0); + cob_inspect_start (); + cob_inspect_converting (0, (cob_field *)&c_1); + cob_inspect_finish (); + + /* Line: 8 : IF : prog.cob */ + if (((int)memcmp (b_6, (cob_u8_ptr)"AAA", 3) != 0)) + { + + /* Line: 9 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &f_6); + } + + /* Line: 10 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memset (b_6, 0, 3); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + + +AT_SETUP([INSPECT CONVERTING TO NULL]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:04:28 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:04:28" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 110428 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:04:28 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; + +static const cob_field_attr cob_all_attr = {0x22, 0, 0, 0, NULL}; + + +/* Constants */ +static const cob_field c_1 = {1, (cob_u8_ptr)"A", &a_2}; +static const cob_field c_2 = {2, (cob_u8_ptr)"NG", &a_2}; + +static cob_field cob_all_low = {1, (cob_u8_ptr)"\0", &cob_all_attr}; + + /* Decimal constants */ + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 11:04:28 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[3] __attribute__((aligned)); /* X */ + + /* End of data storage */ + + + /* Fields */ + static cob_field f_6 = {3, b_6, &a_1}; /* X */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 7 : Entry prog : prog.cob */ + l_2:; + + /* Line: 7 : INSPECT : prog.cob */ + cob_inspect_init (&f_6, 0); + cob_inspect_start (); + cob_inspect_converting ((cob_field *)&c_1, 0); + cob_inspect_finish (); + + /* Line: 8 : IF : prog.cob */ + if (((int)cob_cmp (&f_6, &cob_all_low) != 0)) + { + + /* Line: 9 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_2); + } + + /* Line: 10 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memset (b_6, 65, 3); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + + +AT_SETUP([INSPECT CONVERTING complex]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:06:22 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:06:22" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 110622 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:06:22 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; + +static const cob_field_attr cob_all_attr = {0x22, 0, 0, 0, NULL}; + + +/* Constants */ +static const cob_field c_1 = {4, (cob_u8_ptr)"ABZC", &a_2}; +static const cob_field c_2 = {4, (cob_u8_ptr)"ZY0X", &a_2}; +static const cob_field c_3 = {4, (cob_u8_ptr)"1 - ", &a_2}; +static const cob_field c_4 = {1, (cob_u8_ptr)"E", &a_2}; +static const cob_field c_5 = {1, (cob_u8_ptr)"D", &a_2}; +static const cob_field c_6 = {2, (cob_u8_ptr)"XD", &a_2}; +static const cob_field c_7 = {4, (cob_u8_ptr)"2 - ", &a_2}; + +static cob_field cob_all_space = {1, (cob_u8_ptr)" ", &cob_all_attr}; + + /* Decimal constants */ + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 11:06:22 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[12] __attribute__((aligned)); /* X */ + + /* End of data storage */ + + + /* Fields */ + static cob_field f_6 = {12, b_6, &a_1}; /* X */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 7 : Entry prog : prog.cob */ + l_2:; + + /* Line: 7 : INSPECT : prog.cob */ + cob_inspect_init (&f_6, 0); + cob_inspect_start (); + cob_inspect_converting ((cob_field *)&c_1, (cob_field *)&c_2); + cob_inspect_finish (); + + /* Line: 8 : IF : prog.cob */ + if (((int)memcmp (b_6, (cob_u8_ptr)"Z0ZYYXDXXEXX", 12) != 0)) + { + + /* Line: 9 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_3, &f_6); + + /* Line: 10 : MOVE : prog.cob */ + memcpy (b_6, "Z0ZYYXDXXEXX", 12); + } + + /* Line: 12 : INSPECT : prog.cob */ + cob_inspect_init (&f_6, 0); + cob_inspect_start (); + cob_inspect_before ((cob_field *)&c_4); + cob_inspect_after ((cob_field *)&c_5); + cob_inspect_converting ((cob_field *)&c_6, &cob_all_space); + cob_inspect_finish (); + + /* Line: 14 : IF : prog.cob */ + if (((int)memcmp (b_6, (cob_u8_ptr)"Z0ZYYXD EXX", 12) != 0)) + { + + /* Line: 15 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_7, &f_6); + + /* Line: 16 : MOVE : prog.cob */ + memcpy (b_6, "Z0ZYYXD EXX", 12); + } + + /* Line: 18 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memcpy (b_6, "AZABBCDCCECC", 12); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) +AT_CLEANUP + + +AT_SETUP([INSPECT numeric signed]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 3.1.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 16:13:22 */ +/* GnuCOBOL build date Apr 17 2024 11:33:59 */ +/* GnuCOBOL package date Dec 23 2020 12:04:58 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.1/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "3.1.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 16:13:22" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 161322 + +/* Global variables */ +/* Generated by cobc 3.1.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 16:13:22 */ +/* GnuCOBOL build date Apr 17 2024 11:33:59 */ +/* GnuCOBOL package date Dec 23 2020 12:04:58 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.1/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x10, 1, 0, 0x1000, NULL}; +static const cob_field_attr a_2 = {0x11, 9, 0, 0x0041, NULL}; +static const cob_field_attr a_3 = {0x10, 2, 0, 0x0007, NULL}; +static const cob_field_attr a_4 = {0x21, 0, 0, 0x1000, NULL}; +static const cob_field_attr a_5 = {0x10, 2, 0, 0x0003, NULL}; +static const cob_field_attr a_6 = {0x10, 2, 0, 0x0001, NULL}; + + +/* Constants */ +static const cob_field c_1 = {1, (cob_u8_ptr)"0", &a_1}; +static const cob_field c_2 = {1, (cob_u8_ptr)"1", &a_4}; +static const cob_field c_3 = {5, (cob_u8_ptr)"T1 - ", &a_4}; +static const cob_field c_4 = {5, (cob_u8_ptr)"T2 - ", &a_4}; +static const cob_field c_5 = {5, (cob_u8_ptr)"T3 - ", &a_4}; +static const cob_field c_6 = {5, (cob_u8_ptr)"T4 - ", &a_4}; +static const cob_field c_7 = {5, (cob_u8_ptr)"T5 - ", &a_4}; +static const cob_field c_8 = {5, (cob_u8_ptr)"T6 - ", &a_4}; +static const cob_field c_9 = {5, (cob_u8_ptr)"T7 - ", &a_4}; +static const cob_field c_10 = {5, (cob_u8_ptr)"T8 - ", &a_4}; +static const cob_field c_11 = {3, (cob_u8_ptr)"123", &a_4}; +static const cob_field c_12 = {3, (cob_u8_ptr)"234", &a_4}; +static const cob_field c_13 = {5, (cob_u8_ptr)"C1 - ", &a_4}; +static const cob_field c_14 = {3, (cob_u8_ptr)"-22", &a_3}; +static const cob_field c_15 = {5, (cob_u8_ptr)"C2 - ", &a_4}; +static const cob_field c_16 = {3, (cob_u8_ptr)"+22", &a_3}; +static const cob_field c_17 = {5, (cob_u8_ptr)"C3 - ", &a_4}; +static const cob_field c_18 = {5, (cob_u8_ptr)"C4 - ", &a_4}; +static const cob_field c_19 = {5, (cob_u8_ptr)"C5 - ", &a_4}; +static const cob_field c_20 = {5, (cob_u8_ptr)"C6 - ", &a_4}; +static const cob_field c_21 = {5, (cob_u8_ptr)"C7 - ", &a_4}; +static const cob_field c_22 = {5, (cob_u8_ptr)"C8 - ", &a_4}; +static const cob_field c_23 = {1, (cob_u8_ptr)"2", &a_4}; +static const cob_field c_24 = {1, (cob_u8_ptr)"3", &a_4}; +static const cob_field c_25 = {1, (cob_u8_ptr)"4", &a_4}; +static const cob_field c_26 = {5, (cob_u8_ptr)"R1 - ", &a_4}; +static const cob_field c_27 = {3, (cob_u8_ptr)"-33", &a_3}; +static const cob_field c_28 = {5, (cob_u8_ptr)"R2 - ", &a_4}; +static const cob_field c_29 = {3, (cob_u8_ptr)"+33", &a_3}; +static const cob_field c_30 = {5, (cob_u8_ptr)"R3 - ", &a_4}; +static const cob_field c_31 = {5, (cob_u8_ptr)"R4 - ", &a_4}; +static const cob_field c_32 = {5, (cob_u8_ptr)"R5 - ", &a_4}; +static const cob_field c_33 = {5, (cob_u8_ptr)"R6 - ", &a_4}; +static const cob_field c_34 = {5, (cob_u8_ptr)"R7 - ", &a_4}; +static const cob_field c_35 = {5, (cob_u8_ptr)"R8 - ", &a_4}; +static const cob_field c_36 = {3, (cob_u8_ptr)"-11", &a_3}; +static const cob_field c_37 = {3, (cob_u8_ptr)"+11", &a_3}; + + +static COB_INLINE COB_A_INLINE int +cob_cmp_s32 (const void *p, const cob_s64_t n) +{ + int val; + void *x; + x = &val; + optim_memcpy (x, p, 4); + return (val < n) ? -1 : (val > n); +} + + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); +static void prog_module_init (cob_module *module); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 3.1.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 16:13:22 */ + /* GnuCOBOL build date Apr 17 2024 11:33:59 */ + /* GnuCOBOL package date Dec 23 2020 12:04:58 UTC */ + /* Compile command /opt/gnucobol/gnucobol-3.1/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_8[3] __attribute__((aligned)); /* SEPARATE1 */ + static cob_u8_t b_9[3] __attribute__((aligned)); /* SEPARATE2 */ + static cob_u8_t b_10[3] __attribute__((aligned)); /* TSEPARATE1 */ + static cob_u8_t b_11[3] __attribute__((aligned)); /* TSEPARATE2 */ + static cob_u8_t b_12[2] __attribute__((aligned)); /* NSEPARATE1 */ + static cob_u8_t b_13[2] __attribute__((aligned)); /* NSEPARATE2 */ + static cob_u8_t b_14[2] __attribute__((aligned)); /* TRAILING1 */ + static cob_u8_t b_15[2] __attribute__((aligned)); /* TRAILING2 */ + static cob_u8_t b_16[4] __attribute__((aligned)); /* CNT */ + + /* End of local data storage */ + + + /* Fields (local) */ + static cob_field f_8 = {3, b_8, &a_3}; /* SEPARATE1 */ + static cob_field f_9 = {3, b_9, &a_3}; /* SEPARATE2 */ + static cob_field f_10 = {3, b_10, &a_5}; /* TSEPARATE1 */ + static cob_field f_11 = {3, b_11, &a_5}; /* TSEPARATE2 */ + static cob_field f_12 = {2, b_12, &a_6}; /* NSEPARATE1 */ + static cob_field f_13 = {2, b_13, &a_6}; /* NSEPARATE2 */ + static cob_field f_14 = {2, b_14, &a_6}; /* TRAILING1 */ + static cob_field f_15 = {2, b_15, &a_6}; /* TRAILING2 */ + static cob_field f_16 = {4, b_16, &a_2}; /* CNT */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -10) + goto P_dump; + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 14 : Entry prog : prog.cob */ + l_2:; + + /* Line: 15 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_1, &f_16); + + /* Line: 16 : INSPECT : prog.cob */ + cob_inspect_init (&f_8, 0); + cob_inspect_start (); + cob_inspect_all (&f_16, (cob_field *)&c_2); + cob_inspect_finish (); + + /* Line: 17 : IF : prog.cob */ + if (((int)cob_cmp_s32 (b_16, 2LL) != 0)) + { + + /* Line: 18 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_3, &f_16); + } + + /* Line: 19 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_1, &f_16); + + /* Line: 20 : INSPECT : prog.cob */ + cob_inspect_init (&f_9, 0); + cob_inspect_start (); + cob_inspect_all (&f_16, (cob_field *)&c_2); + cob_inspect_finish (); + + /* Line: 21 : IF : prog.cob */ + if (((int)cob_cmp_s32 (b_16, 2LL) != 0)) + { + + /* Line: 22 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_4, &f_16); + } + + /* Line: 23 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_1, &f_16); + + /* Line: 24 : INSPECT : prog.cob */ + cob_inspect_init (&f_10, 0); + cob_inspect_start (); + cob_inspect_all (&f_16, (cob_field *)&c_2); + cob_inspect_finish (); + + /* Line: 25 : IF : prog.cob */ + if (((int)cob_cmp_s32 (b_16, 2LL) != 0)) + { + + /* Line: 26 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_5, &f_16); + } + + /* Line: 27 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_1, &f_16); + + /* Line: 28 : INSPECT : prog.cob */ + cob_inspect_init (&f_11, 0); + cob_inspect_start (); + cob_inspect_all (&f_16, (cob_field *)&c_2); + cob_inspect_finish (); + + /* Line: 29 : IF : prog.cob */ + if (((int)cob_cmp_s32 (b_16, 2LL) != 0)) + { + + /* Line: 30 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_6, &f_16); + } + + /* Line: 31 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_1, &f_16); + + /* Line: 32 : INSPECT : prog.cob */ + cob_inspect_init (&f_12, 0); + cob_inspect_start (); + cob_inspect_all (&f_16, (cob_field *)&c_2); + cob_inspect_finish (); + + /* Line: 33 : IF : prog.cob */ + if (((int)cob_cmp_s32 (b_16, 2LL) != 0)) + { + + /* Line: 34 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_7, &f_16); + } + + /* Line: 35 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_1, &f_16); + + /* Line: 36 : INSPECT : prog.cob */ + cob_inspect_init (&f_13, 0); + cob_inspect_start (); + cob_inspect_all (&f_16, (cob_field *)&c_2); + cob_inspect_finish (); + + /* Line: 37 : IF : prog.cob */ + if (((int)cob_cmp_s32 (b_16, 2LL) != 0)) + { + + /* Line: 38 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_8, &f_16); + } + + /* Line: 39 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_1, &f_16); + + /* Line: 40 : INSPECT : prog.cob */ + cob_inspect_init (&f_14, 0); + cob_inspect_start (); + cob_inspect_all (&f_16, (cob_field *)&c_2); + cob_inspect_finish (); + + /* Line: 41 : IF : prog.cob */ + if (((int)cob_cmp_s32 (b_16, 2LL) != 0)) + { + + /* Line: 42 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_9, &f_16); + } + + /* Line: 43 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_1, &f_16); + + /* Line: 44 : INSPECT : prog.cob */ + cob_inspect_init (&f_15, 0); + cob_inspect_start (); + cob_inspect_all (&f_16, (cob_field *)&c_2); + cob_inspect_finish (); + + /* Line: 45 : IF : prog.cob */ + if (((int)cob_cmp_s32 (b_16, 2LL) != 0)) + { + + /* Line: 46 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_10, &f_16); + } + + /* Line: 48 : INSPECT : prog.cob */ + cob_inspect_init (&f_8, 0); + cob_inspect_start (); + cob_inspect_converting ((cob_field *)&c_11, (cob_field *)&c_12); + cob_inspect_finish (); + + /* Line: 49 : IF : prog.cob */ + if (((int)cob_cmp_llint (&f_8, -22LL) != 0)) + { + + /* Line: 50 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_13, &f_8); + + /* Line: 51 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_14, &f_8); + } + + /* Line: 52 : INSPECT : prog.cob */ + cob_inspect_init (&f_9, 0); + cob_inspect_start (); + cob_inspect_converting ((cob_field *)&c_11, (cob_field *)&c_12); + cob_inspect_finish (); + + /* Line: 53 : IF : prog.cob */ + if (((int)cob_cmp_llint (&f_9, 22LL) != 0)) + { + + /* Line: 54 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_15, &f_9); + + /* Line: 55 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_16, &f_9); + } + + /* Line: 56 : INSPECT : prog.cob */ + cob_inspect_init (&f_10, 0); + cob_inspect_start (); + cob_inspect_converting ((cob_field *)&c_11, (cob_field *)&c_12); + cob_inspect_finish (); + + /* Line: 57 : IF : prog.cob */ + if (((int)cob_cmp_llint (&f_10, -22LL) != 0)) + { + + /* Line: 58 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_17, &f_10); + + /* Line: 59 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_14, &f_10); + } + + /* Line: 60 : INSPECT : prog.cob */ + cob_inspect_init (&f_11, 0); + cob_inspect_start (); + cob_inspect_converting ((cob_field *)&c_11, (cob_field *)&c_12); + cob_inspect_finish (); + + /* Line: 61 : IF : prog.cob */ + if (((int)cob_cmp_llint (&f_11, 22LL) != 0)) + { + + /* Line: 62 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_18, &f_11); + + /* Line: 63 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_16, &f_11); + } + + /* Line: 64 : INSPECT : prog.cob */ + cob_inspect_init (&f_12, 0); + cob_inspect_start (); + cob_inspect_converting ((cob_field *)&c_11, (cob_field *)&c_12); + cob_inspect_finish (); + + /* Line: 65 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_12, 2, -22LL, 1) != 0)) + { + + /* Line: 66 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_19, &f_12); + + /* Line: 67 : MOVE : prog.cob */ + memcpy (b_12, "2r", 2); + } + + /* Line: 68 : INSPECT : prog.cob */ + cob_inspect_init (&f_13, 0); + cob_inspect_start (); + cob_inspect_converting ((cob_field *)&c_11, (cob_field *)&c_12); + cob_inspect_finish (); + + /* Line: 69 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_13, 2, 22LL, 1) != 0)) + { + + /* Line: 70 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_20, &f_13); + + /* Line: 71 : MOVE : prog.cob */ + memset (b_13, 50, 2); + } + + /* Line: 72 : INSPECT : prog.cob */ + cob_inspect_init (&f_14, 0); + cob_inspect_start (); + cob_inspect_converting ((cob_field *)&c_11, (cob_field *)&c_12); + cob_inspect_finish (); + + /* Line: 73 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_14, 2, -22LL, 1) != 0)) + { + + /* Line: 74 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_21, &f_14); + + /* Line: 75 : MOVE : prog.cob */ + memcpy (b_14, "2r", 2); + } + + /* Line: 76 : INSPECT : prog.cob */ + cob_inspect_init (&f_15, 0); + cob_inspect_start (); + cob_inspect_converting ((cob_field *)&c_11, (cob_field *)&c_12); + cob_inspect_finish (); + + /* Line: 77 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_15, 2, 22LL, 1) != 0)) + { + + /* Line: 78 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_22, &f_15); + + /* Line: 79 : MOVE : prog.cob */ + memset (b_15, 50, 2); + } + + /* Line: 81 : INSPECT : prog.cob */ + cob_inspect_init (&f_8, 1); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_23, (cob_field *)&c_2); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_24, (cob_field *)&c_23); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_25, (cob_field *)&c_24); + cob_inspect_finish (); + + /* Line: 84 : IF : prog.cob */ + if (((int)cob_cmp_llint (&f_8, -33LL) != 0)) + { + + /* Line: 85 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_26, &f_8); + + /* Line: 86 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_27, &f_8); + } + + /* Line: 87 : INSPECT : prog.cob */ + cob_inspect_init (&f_9, 1); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_23, (cob_field *)&c_2); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_24, (cob_field *)&c_23); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_25, (cob_field *)&c_24); + cob_inspect_finish (); + + /* Line: 90 : IF : prog.cob */ + if (((int)cob_cmp_llint (&f_9, 33LL) != 0)) + { + + /* Line: 91 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_28, &f_9); + + /* Line: 92 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_29, &f_9); + } + + /* Line: 93 : INSPECT : prog.cob */ + cob_inspect_init (&f_10, 1); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_23, (cob_field *)&c_2); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_24, (cob_field *)&c_23); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_25, (cob_field *)&c_24); + cob_inspect_finish (); + + /* Line: 96 : IF : prog.cob */ + if (((int)cob_cmp_llint (&f_10, -33LL) != 0)) + { + + /* Line: 97 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_30, &f_10); + + /* Line: 98 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_27, &f_10); + } + + /* Line: 99 : INSPECT : prog.cob */ + cob_inspect_init (&f_11, 1); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_23, (cob_field *)&c_2); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_24, (cob_field *)&c_23); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_25, (cob_field *)&c_24); + cob_inspect_finish (); + + /* Line: 102 : IF : prog.cob */ + if (((int)cob_cmp_llint (&f_11, 33LL) != 0)) + { + + /* Line: 103 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_31, &f_11); + + /* Line: 104 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_29, &f_11); + } + + /* Line: 105 : INSPECT : prog.cob */ + cob_inspect_init (&f_12, 1); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_23, (cob_field *)&c_2); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_24, (cob_field *)&c_23); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_25, (cob_field *)&c_24); + cob_inspect_finish (); + + /* Line: 108 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_12, 2, -33LL, 1) != 0)) + { + + /* Line: 109 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_32, &f_12); + + /* Line: 110 : MOVE : prog.cob */ + memcpy (b_12, "3s", 2); + } + + /* Line: 111 : INSPECT : prog.cob */ + cob_inspect_init (&f_13, 1); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_23, (cob_field *)&c_2); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_24, (cob_field *)&c_23); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_25, (cob_field *)&c_24); + cob_inspect_finish (); + + /* Line: 114 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_13, 2, 33LL, 1) != 0)) + { + + /* Line: 115 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_33, &f_13); + + /* Line: 116 : MOVE : prog.cob */ + memset (b_13, 51, 2); + } + + /* Line: 117 : INSPECT : prog.cob */ + cob_inspect_init (&f_14, 1); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_23, (cob_field *)&c_2); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_24, (cob_field *)&c_23); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_25, (cob_field *)&c_24); + cob_inspect_finish (); + + /* Line: 120 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_14, 2, -33LL, 1) != 0)) + { + + /* Line: 121 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_34, &f_14); + + /* Line: 122 : MOVE : prog.cob */ + memcpy (b_14, "3s", 2); + } + + /* Line: 123 : INSPECT : prog.cob */ + cob_inspect_init (&f_15, 1); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_23, (cob_field *)&c_2); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_24, (cob_field *)&c_23); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_25, (cob_field *)&c_24); + cob_inspect_finish (); + + /* Line: 126 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_15, 2, 33LL, 1) != 0)) + { + + /* Line: 127 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_35, &f_15); + + /* Line: 128 : MOVE : prog.cob */ + memset (b_15, 51, 2); + } + + /* Line: 130 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + P_cgerror: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + prog_module_init (module); + + module->crt_status = NULL; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + cob_move ((cob_field *)&c_36, &f_8); + cob_move ((cob_field *)&c_37, &f_9); + cob_move ((cob_field *)&c_36, &f_10); + cob_move ((cob_field *)&c_37, &f_11); + memcpy (b_12, "1q", 2); + memset (b_13, 49, 2); + memcpy (b_14, "1q", 2); + memset (b_15, 49, 2); + memset (b_16, 0, 4); + + if (0 == 1) goto P_cgerror; + initialized = 1; + goto P_ret_initialize; + + P_dump: + return 0; + + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) + return 0; + if (module && module->module_active) + cob_fatal_error (COB_FERROR_CANCEL); + + initialized = 0; + + P_clear_decimal: + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* Initialize module structure for prog */ +static void prog_module_init (cob_module *module) +{ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + module->flag_debug_trace = 0; + module->flag_dump_ready = 0; + module->module_stmt = 0; + module->module_sources = NULL; +} + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) +AT_CLEANUP + + +AT_SETUP([INSPECT TALLYING BEFORE]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:13:12 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:13:12" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 111312 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:13:12 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; +static const cob_field_attr a_3 = {0x10, 3, 0, 0x0000, NULL}; + + +/* Constants */ +static const cob_field c_1 = {1, (cob_u8_ptr)" ", &a_2}; +static const cob_field c_2 = {22, (cob_u8_ptr)"1: should be 3 but is ", &a_2}; +static const cob_field c_3 = {22, (cob_u8_ptr)"2: should be 0 but is ", &a_2}; + + /* Decimal constants */ + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 11:13:12 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[4] __attribute__((aligned)); /* X */ + static cob_u8_t b_7[3] __attribute__((aligned)); /* TAL */ + + /* End of data storage */ + + + /* Fields */ + static cob_field f_6 = {4, b_6, &a_1}; /* X */ + static cob_field f_7 = {3, b_7, &a_3}; /* TAL */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 8 : Entry prog : prog.cob */ + l_2:; + + /* Line: 8 : MOVE : prog.cob */ + memset (b_7, 48, 3); + + /* Line: 9 : INSPECT : prog.cob */ + cob_inspect_init (&f_6, 0); + cob_inspect_start (); + cob_inspect_before ((cob_field *)&c_1); + cob_inspect_characters (&f_7); + cob_inspect_finish (); + + /* Line: 11 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_7, 3, 3LL, 0) != 0)) + { + + /* Line: 12 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_2, &f_7); + } + + /* Line: 14 : MOVE : prog.cob */ + memset (b_7, 48, 3); + + /* Line: 15 : MOVE : prog.cob */ + memcpy (b_6, " ABC", 4); + + /* Line: 16 : INSPECT : prog.cob */ + cob_inspect_init (&f_6, 0); + cob_inspect_start (); + cob_inspect_before ((cob_field *)&c_1); + cob_inspect_characters (&f_7); + cob_inspect_finish (); + + /* Line: 18 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_7, 3, 0LL, 0) != 0)) + { + + /* Line: 19 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_3, &f_7); + } + + /* Line: 21 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memcpy (b_6, "ABC ", 4); + memset (b_7, 48, 3); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + + +AT_SETUP([INSPECT TALLYING AFTER]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:14:34 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:14:34" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 111434 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:14:34 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; +static const cob_field_attr a_3 = {0x10, 3, 0, 0x0000, NULL}; + + +/* Constants */ +static const cob_field c_1 = {1, (cob_u8_ptr)" ", &a_2}; + + /* Decimal constants */ + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 11:14:34 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[4] __attribute__((aligned)); /* X */ + static cob_u8_t b_7[3] __attribute__((aligned)); /* TAL */ + + /* End of data storage */ + + + /* Fields */ + static cob_field f_6 = {4, b_6, &a_1}; /* X */ + static cob_field f_7 = {3, b_7, &a_3}; /* TAL */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 8 : Entry prog : prog.cob */ + l_2:; + + /* Line: 8 : MOVE : prog.cob */ + memset (b_7, 48, 3); + + /* Line: 9 : INSPECT : prog.cob */ + cob_inspect_init (&f_6, 0); + cob_inspect_start (); + cob_inspect_after ((cob_field *)&c_1); + cob_inspect_characters (&f_7); + cob_inspect_finish (); + + /* Line: 11 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_7, 3, 0LL, 0) != 0)) + { + + /* Line: 12 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &f_7); + } + + /* Line: 14 : MOVE : prog.cob */ + memset (b_7, 48, 3); + + /* Line: 15 : MOVE : prog.cob */ + memcpy (b_6, " ABC", 4); + + /* Line: 16 : INSPECT : prog.cob */ + cob_inspect_init (&f_6, 0); + cob_inspect_start (); + cob_inspect_after ((cob_field *)&c_1); + cob_inspect_characters (&f_7); + cob_inspect_finish (); + + /* Line: 18 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_7, 3, 3LL, 0) != 0)) + { + + /* Line: 19 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &f_7); + } + + /* Line: 21 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memcpy (b_6, "ABC ", 4); + memset (b_7, 48, 3); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + + +AT_SETUP([INSPECT TALLYING BEFORE and AFTER]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:16:00 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:16:00" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 111600 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:16:00 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; +static const cob_field_attr a_3 = {0x10, 3, 0, 0x0000, NULL}; + + +/* Constants */ +static const cob_field c_1 = {1, (cob_u8_ptr)" ", &a_2}; +static const cob_field c_2 = {22, (cob_u8_ptr)"1: should be 0 but is ", &a_2}; +static const cob_field c_3 = {1, (cob_u8_ptr)"<", &a_2}; +static const cob_field c_4 = {2, (cob_u8_ptr)"cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 9 : Entry prog : prog.cob */ + l_2:; + + /* Line: 9 : MOVE : prog.cob */ + memset (b_7, 48, 3); + + /* Line: 10 : INSPECT : prog.cob */ + cob_inspect_init (&f_6, 0); + cob_inspect_start (); + cob_inspect_before ((cob_field *)&c_1); + cob_inspect_after ((cob_field *)&c_1); + cob_inspect_characters (&f_7); + cob_inspect_finish (); + + /* Line: 13 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_7, 3, 0LL, 0) != 0)) + { + + /* Line: 14 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_2, &f_7); + } + + /* Line: 17 : MOVE : prog.cob */ + memset (b_7, 48, 3); + + /* Line: 18 : INSPECT : prog.cob */ + cob_inspect_init (&f_8, 0); + cob_inspect_start (); + cob_inspect_after ((cob_field *)&c_3); + cob_inspect_before ((cob_field *)&c_4); + cob_inspect_characters (&f_7); + cob_inspect_finish (); + + /* Line: 21 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_7, 3, 0LL, 0) != 0)) + { + + /* Line: 22 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_5, &f_7); + } + + /* Line: 24 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memcpy (b_6, "ABC ", 4); + memset (b_7, 48, 3); + memset (b_8, 32, 256); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* End functions */ + + +]]) +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + + +AT_SETUP([INSPECT TALLYING REPLACING BEFORE and AFTER]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 3.1.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 16:21:59 */ +/* GnuCOBOL build date Apr 17 2024 11:33:59 */ +/* GnuCOBOL package date Dec 23 2020 12:04:58 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.1/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "3.1.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 16:21:59" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 162159 + +/* Global variables */ +/* Generated by cobc 3.1.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 16:21:59 */ +/* GnuCOBOL build date Apr 17 2024 11:33:59 */ +/* GnuCOBOL package date Dec 23 2020 12:04:58 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.1/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; +static const cob_field_attr a_3 = {0x11, 4, 0, 0x0820, NULL}; +static const cob_field_attr a_4 = {0x10, 3, 0, 0x1000, NULL}; +static const cob_field_attr a_5 = {0x10, 1, 0, 0x1000, NULL}; + + +/* Constants */ +static const cob_field c_1 = {1, (cob_u8_ptr)"H", &a_2}; +static const cob_field c_2 = {1, (cob_u8_ptr)"B", &a_2}; +static const cob_field c_3 = {1, (cob_u8_ptr)"F", &a_2}; +static const cob_field c_4 = {1, (cob_u8_ptr)"Q", &a_2}; +static const cob_field c_5 = {1, (cob_u8_ptr)"1", &a_2}; +static const cob_field c_6 = {1, (cob_u8_ptr)"A", &a_2}; +static const cob_field c_7 = {1, (cob_u8_ptr)"Y", &a_2}; +static const cob_field c_8 = {1, (cob_u8_ptr)"2", &a_2}; +static const cob_field c_9 = {8, (cob_u8_ptr)"Failed <", &a_2}; +static const cob_field c_10 = {6, (cob_u8_ptr)"> != <", &a_2}; +static const cob_field c_11 = {26, (cob_u8_ptr)"A22222111111111122222222YZ", &a_2}; +static const cob_field c_12 = {1, (cob_u8_ptr)">", &a_2}; +static const cob_field c_13 = {10, (cob_u8_ptr)"> != <107>", &a_2}; +static const cob_field c_14 = {9, (cob_u8_ptr)"> != <19>", &a_2}; +static const cob_field c_15 = {3, (cob_u8_ptr)"100", &a_4}; +static const cob_field c_16 = {1, (cob_u8_ptr)"0", &a_5}; + + +static COB_INLINE COB_A_INLINE int +cob_cmpswp_u16 (const void *p, const cob_s64_t n) +{ + void *x; + unsigned short val; + if (unlikely(n < 0)) { + return 1; + } + x = &val; + optim_memcpy (x, p, 2); + val = COB_BSWAP_16 (val); + return (val < n) ? -1 : (val > n); +} + + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); +static void prog_module_init (cob_module *module); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 3.1.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 16:21:59 */ + /* GnuCOBOL build date Apr 17 2024 11:33:59 */ + /* GnuCOBOL package date Dec 23 2020 12:04:58 UTC */ + /* Compile command /opt/gnucobol/gnucobol-3.1/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_8[26] __attribute__((aligned)); /* INSP-STRING */ + static cob_u8_t b_10[2] __attribute__((aligned)); /* RES-IDX */ + static cob_u8_t b_11[2] __attribute__((aligned)); /* RES-IDX-1 */ + + /* End of local data storage */ + + + /* Fields (local) */ + static cob_field f_8 = {26, b_8, &a_1}; /* INSP-STRING */ + static cob_field f_10 = {2, b_10, &a_3}; /* RES-IDX */ + static cob_field f_11 = {2, b_11, &a_3}; /* RES-IDX-1 */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -10) + goto P_dump; + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 9 : Entry prog : prog.cob */ + l_2:; + + /* Line: 11 : INSPECT : prog.cob */ + cob_inspect_init (&f_8, 0); + cob_inspect_start (); + cob_inspect_before ((cob_field *)&c_1); + cob_inspect_characters (&f_10); + cob_inspect_start (); + cob_inspect_after ((cob_field *)&c_2); + cob_inspect_characters (&f_11); + cob_inspect_finish (); + cob_inspect_init (&f_8, 1); + cob_inspect_start (); + cob_inspect_after ((cob_field *)&c_3); + cob_inspect_before ((cob_field *)&c_4); + cob_inspect_characters ((cob_field *)&c_5); + cob_inspect_start (); + cob_inspect_after ((cob_field *)&c_6); + cob_inspect_before ((cob_field *)&c_7); + cob_inspect_characters ((cob_field *)&c_8); + cob_inspect_finish (); + + /* Line: 18 : IF : prog.cob */ + if (((int)memcmp (b_8, (cob_u8_ptr)"A22222111111111122222222YZ", 26) != 0)) + { + + /* Line: 19 : DISPLAY : prog.cob */ + cob_display (0, 1, 5, &c_9, &f_8, &c_10, &c_11, &c_12); + } + + /* Line: 20 : IF : prog.cob */ + if (((int)cob_cmpswp_u16 (b_10, 107LL) != 0)) + { + + /* Line: 21 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_9, &f_10, &c_13); + } + + /* Line: 22 : IF : prog.cob */ + if (((int)cob_cmpswp_u16 (b_11, 19LL) != 0)) + { + + /* Line: 23 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_9, &f_11, &c_14); + } + + /* Line: 25 : GOBACK : prog.cob */ + goto exit_program; + + /* Program exit */ + + exit_program: + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + P_cgerror: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + prog_module_init (module); + + module->crt_status = NULL; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memcpy (b_8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 26); + cob_move ((cob_field *)&c_15, &f_10); + cob_move ((cob_field *)&c_16, &f_11); + + if (0 == 1) goto P_cgerror; + initialized = 1; + goto P_ret_initialize; + + P_dump: + return 0; + + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) + return 0; + if (module && module->module_active) + cob_fatal_error (COB_FERROR_CANCEL); + + initialized = 0; + + P_clear_decimal: + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* Initialize module structure for prog */ +static void prog_module_init (cob_module *module) +{ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + module->flag_debug_trace = 0; + module->flag_dump_ready = 0; + module->module_stmt = 0; + module->module_sources = NULL; +} + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + + +AT_SETUP([INSPECT REPLACING figurative constant]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:17:41 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:17:41" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 111741 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:17:41 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; + +static const cob_field_attr cob_all_attr = {0x22, 0, 0, 0, NULL}; + + +/* Constants */ +static const cob_field c_1 = {2, (cob_u8_ptr)"BC", &a_2}; + +static cob_field cob_all_space = {1, (cob_u8_ptr)" ", &cob_all_attr}; + + /* Decimal constants */ + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 11:17:41 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[3] __attribute__((aligned)); /* X */ + + /* End of data storage */ + + + /* Fields */ + static cob_field f_6 = {3, b_6, &a_1}; /* X */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 7 : Entry prog : prog.cob */ + l_2:; + + /* Line: 7 : INSPECT : prog.cob */ + cob_inspect_init (&f_6, 1); + cob_inspect_start (); + cob_inspect_all (&cob_all_space, (cob_field *)&c_1); + cob_inspect_finish (); + + /* Line: 8 : IF : prog.cob */ + if (((int)memcmp (b_6, (cob_u8_ptr)" A", 3) != 0)) + { + + /* Line: 9 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &f_6); + } + + /* Line: 10 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memcpy (b_6, "BCA", 3); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + + +AT_SETUP([STRING with subscript reference]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:18:58 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:18:58" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 111858 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:18:58 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; + + +/* Constants */ +static const cob_field c_1 = {3, (cob_u8_ptr)"abc", &a_2}; + + /* Decimal constants */ + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 11:18:58 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Local cob_field items */ + cob_field f0; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[9] __attribute__((aligned)); /* G */ + + /* End of data storage */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 8 : Entry prog : prog.cob */ + l_2:; + + /* Line: 8 : MOVE : prog.cob */ + memset (b_6, 32, 9); + + /* Line: 9 : STRING : prog.cob */ + cob_string_init (COB_SET_FLD(f0, 3, b_6 + 3 * 1, &a_1), NULL); + cob_string_delimited (NULL); + cob_string_append ((cob_field *)&c_1); + cob_string_finish (); + + /* Line: 11 : IF : prog.cob */ + if (((int)memcmp (b_6, (cob_u8_ptr)" abc ", 9) != 0)) + { + + /* Line: 12 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, COB_SET_FLD(f0, 3, b_6 + 3 * 0, &a_1)); + } + + /* Line: 14 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memset (b_6, 32, 9); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + + +AT_SETUP([STRING WITH POINTER ON OVERFLOW with DELIMITER]) +AT_KEYWORDS([runmisc exceptions]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:21:18 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:21:18" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 112118 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:21:18 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x10, 2, 0, 0x0000, NULL}; +static const cob_field_attr a_3 = {0x21, 0, 0, 0x1000, NULL}; + +static const cob_field_attr cob_all_attr = {0x22, 0, 0, 0, NULL}; + + +/* Constants */ +static const cob_field c_1 = {1, (cob_u8_ptr)"A", &a_3}; +static const cob_field c_2 = {1, (cob_u8_ptr)"B", &a_3}; +static const cob_field c_3 = {1, (cob_u8_ptr)"C", &a_3}; +static const cob_field c_4 = {27, (cob_u8_ptr)"Case A: Should not overflow", &a_3}; +static const cob_field c_5 = {16, (cob_u8_ptr)"A: TRTG-STRING <", &a_3}; +static const cob_field c_6 = {10, (cob_u8_ptr)"> != ", &a_3}; +static const cob_field c_7 = {16, (cob_u8_ptr)"A: STR-POINTER <", &a_3}; +static const cob_field c_8 = {9, (cob_u8_ptr)"> != <04>", &a_3}; +static const cob_field c_9 = {23, (cob_u8_ptr)"Case B: Should overflow", &a_3}; +static const cob_field c_10 = {16, (cob_u8_ptr)"B: TRTG-STRING <", &a_3}; +static const cob_field c_11 = {11, (cob_u8_ptr)"> != SPACES", &a_3}; +static const cob_field c_12 = {16, (cob_u8_ptr)"B: STR-POINTER <", &a_3}; +static const cob_field c_13 = {9, (cob_u8_ptr)"> != <00>", &a_3}; +static const cob_field c_14 = {23, (cob_u8_ptr)"Case C: Should overflow", &a_3}; +static const cob_field c_15 = {16, (cob_u8_ptr)"C: TRTG-STRING <", &a_3}; +static const cob_field c_16 = {16, (cob_u8_ptr)"C: STR-POINTER <", &a_3}; +static const cob_field c_17 = {3, (cob_u8_ptr)"1|2", &a_3}; +static const cob_field c_18 = {3, (cob_u8_ptr)"A|B", &a_3}; +static const cob_field c_19 = {3, (cob_u8_ptr)"C|D", &a_3}; +static const cob_field c_20 = {16, (cob_u8_ptr)"D: TRGT-STRING <", &a_3}; +static const cob_field c_21 = {10, (cob_u8_ptr)"> != <1AC>", &a_3}; + +static cob_field cob_all_space = {1, (cob_u8_ptr)" ", &cob_all_attr}; + + /* Decimal constants */ + + +/* Function prototypes */ + +static int StringTest (); +static int StringTest_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (StringTest ()); +} + +/* Functions */ + +/* PROGRAM-ID 'StringTest' */ + +/* ENTRY 'StringTest' */ + +static int +StringTest () +{ + return StringTest_ (0); +} + +static int +StringTest_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 11:21:18 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'StringTest' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[3] __attribute__((aligned)); /* TRGT-STRING */ + static cob_u8_t b_7[2] __attribute__((aligned)); /* STR-POINTER */ + static cob_u8_t b_8[1] __attribute__((aligned)); /* SRC-DELIM */ + + /* End of data storage */ + + + /* Fields */ + static cob_field f_6 = {3, b_6, &a_1}; /* TRGT-STRING */ + static cob_field f_7 = {2, b_7, &a_2}; /* STR-POINTER */ + static cob_field f_8 = {1, b_8, &a_1}; /* SRC-DELIM */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 21 : Entry StringTest : prog.cob */ + l_2:; + + /* Line: 21 : MOVE : prog.cob */ + memcpy (b_7, "01", 2); + + /* Line: 22 : STRING : prog.cob */ + cob_glob_ptr->cob_exception_code = 0; + cob_string_init (&f_6, &f_7); + cob_string_delimited (NULL); + cob_string_append ((cob_field *)&c_1); + cob_string_append ((cob_field *)&c_2); + cob_string_append ((cob_field *)&c_3); + cob_string_finish (); + if (unlikely ((cob_glob_ptr->cob_exception_code & 0xff00) == 0x0a00)) + { + + /* Line: 26 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_4); + } + + /* Line: 28 : IF : prog.cob */ + if (((int)memcmp (b_6, (cob_u8_ptr)"ABC", 3) != 0)) + { + + /* Line: 29 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_5, &f_6, &c_6); + } + + /* Line: 30 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_7, 2, 4LL, 0) != 0)) + { + + /* Line: 31 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_7, &f_7, &c_8); + } + + /* Line: 34 : MOVE : prog.cob */ + memset (b_7, 48, 2); + + /* Line: 35 : MOVE : prog.cob */ + memset (b_6, 32, 3); + + /* Line: 36 : STRING : prog.cob */ + cob_glob_ptr->cob_exception_code = 0; + cob_string_init (&f_6, &f_7); + cob_string_delimited (NULL); + cob_string_append ((cob_field *)&c_1); + cob_string_append ((cob_field *)&c_2); + cob_string_append ((cob_field *)&c_3); + cob_string_finish (); + if (!cob_glob_ptr->cob_exception_code) + { + + /* Line: 40 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_9); + } + + /* Line: 42 : IF : prog.cob */ + if (((int)cob_cmp (&f_6, &cob_all_space) != 0)) + { + + /* Line: 43 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_10, &f_6, &c_11); + } + + /* Line: 44 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_7, 2, 0LL, 0) != 0)) + { + + /* Line: 45 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_12, &f_7, &c_13); + } + + /* Line: 48 : MOVE : prog.cob */ + memcpy (b_7, "04", 2); + + /* Line: 49 : MOVE : prog.cob */ + memset (b_6, 32, 3); + + /* Line: 50 : STRING : prog.cob */ + cob_glob_ptr->cob_exception_code = 0; + cob_string_init (&f_6, &f_7); + cob_string_delimited (NULL); + cob_string_append ((cob_field *)&c_1); + cob_string_append ((cob_field *)&c_2); + cob_string_append ((cob_field *)&c_3); + cob_string_finish (); + if (!cob_glob_ptr->cob_exception_code) + { + + /* Line: 54 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_14); + } + + /* Line: 56 : IF : prog.cob */ + if (((int)cob_cmp (&f_6, &cob_all_space) != 0)) + { + + /* Line: 57 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_15, &f_6, &c_11); + } + + /* Line: 58 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_7, 2, 4LL, 0) != 0)) + { + + /* Line: 59 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_16, &f_7, &c_8); + } + + /* Line: 62 : MOVE : prog.cob */ + memcpy (b_7, "01", 2); + + /* Line: 63 : MOVE : prog.cob */ + *(b_8) = 124; + + /* Line: 64 : MOVE : prog.cob */ + memset (b_6, 32, 3); + + /* Line: 65 : STRING : prog.cob */ + cob_string_init (&f_6, &f_7); + cob_string_delimited (&f_8); + cob_string_append ((cob_field *)&c_17); + cob_string_append ((cob_field *)&c_18); + cob_string_append ((cob_field *)&c_19); + cob_string_finish (); + + /* Line: 69 : IF : prog.cob */ + if (((int)memcmp (b_6, (cob_u8_ptr)"1AC", 3) != 0)) + { + + /* Line: 70 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_20, &f_6, &c_21); + } + + /* Line: 72 : GOBACK : prog.cob */ + goto exit_program; + + /* Program exit */ + + exit_program: + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "StringTest"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())StringTest; + module->module_cancel.funcptr = (void *(*)())StringTest_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memset (b_6, 32, 3); + memset (b_7, 48, 2); + *(cob_u8_ptr)(b_8) = 32; + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'StringTest' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + + +AT_SETUP([STRING / UNSTRING [[NOT]] ON OVERFLOW]) +AT_KEYWORDS([runmisc exceptions]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 3.1.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 16:23:05 */ +/* GnuCOBOL build date Apr 17 2024 11:33:59 */ +/* GnuCOBOL package date Dec 23 2020 12:04:58 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.1/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "3.1.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 16:23:05" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 162305 + +/* Global variables */ +/* Generated by cobc 3.1.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 16:23:05 */ +/* GnuCOBOL build date Apr 17 2024 11:33:59 */ +/* GnuCOBOL package date Dec 23 2020 12:04:58 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.1/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; + + +/* Constants */ +static const cob_field c_1 = {4, (cob_u8_ptr)"data", &a_2}; +static const cob_field c_2 = {15, (cob_u8_ptr)"STRING OVERFLOW", &a_2}; +static const cob_field c_3 = {8, (cob_u8_ptr)"1 failed", &a_2}; +static const cob_field c_4 = {8, (cob_u8_ptr)"1 passed", &a_2}; +static const cob_field c_5 = {19, (cob_u8_ptr)"STRING ERROR (1): \"", &a_2}; +static const cob_field c_6 = {1, (cob_u8_ptr)"\"", &a_2}; +static const cob_field c_7 = {23, (cob_u8_ptr)"data is too big here...", &a_2}; +static const cob_field c_8 = {8, (cob_u8_ptr)"2 passed", &a_2}; +static const cob_field c_9 = {8, (cob_u8_ptr)"2 failed", &a_2}; +static const cob_field c_10 = {16, (cob_u8_ptr)"missing OVERFLOW", &a_2}; +static const cob_field c_11 = {19, (cob_u8_ptr)"STRING ERROR (2): \"", &a_2}; +static const cob_field c_12 = {17, (cob_u8_ptr)"UNSTRING OVERFLOW", &a_2}; +static const cob_field c_13 = {8, (cob_u8_ptr)"3 failed", &a_2}; +static const cob_field c_14 = {8, (cob_u8_ptr)"3 passed", &a_2}; +static const cob_field c_15 = {21, (cob_u8_ptr)"UNSTRING ERROR (1): \"", &a_2}; +static const cob_field c_16 = {8, (cob_u8_ptr)"4 passed", &a_2}; +static const cob_field c_17 = {8, (cob_u8_ptr)"4 failed", &a_2}; +static const cob_field c_18 = {21, (cob_u8_ptr)"UNSTRING ERROR (2): \"", &a_2}; + + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); +static void prog_module_init (cob_module *module); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 3.1.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 16:23:05 */ + /* GnuCOBOL build date Apr 17 2024 11:33:59 */ + /* GnuCOBOL package date Dec 23 2020 12:04:58 UTC */ + /* Compile command /opt/gnucobol/gnucobol-3.1/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_8[20] __attribute__((aligned)); /* simple-str */ + static cob_u8_t b_9[50] __attribute__((aligned)); /* err-str */ + + /* End of local data storage */ + + + /* Fields (local) */ + static cob_field f_8 = {20, b_8, &a_1}; /* simple-str */ + static cob_field f_9 = {50, b_9, &a_1}; /* err-str */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -10) + goto P_dump; + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 8 : Entry prog : prog.cob */ + l_2:; + + /* Line: 10 : MOVE : prog.cob */ + memset (b_8, 32, 20); + + /* Line: 11 : STRING : prog.cob */ + cob_glob_ptr->cob_exception_code = 0; + cob_string_init (&f_8, NULL); + cob_string_delimited (NULL); + cob_string_append ((cob_field *)&c_1); + cob_string_finish (); + if (unlikely ((cob_glob_ptr->cob_exception_code & 0xff00) == 0x0a00)) + { + + /* Line: 15 : MOVE : prog.cob */ + memset (b_9, 32, 50); + + /* Line: 16 : STRING : prog.cob */ + cob_string_init (&f_9, NULL); + cob_string_delimited (NULL); + cob_string_append ((cob_field *)&c_2); + cob_string_finish (); + + /* Line: 20 : DISPLAY : prog.cob */ + cob_display (1, 1, 1, &f_9); + + /* Line: 22 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_3); + } + else + { + + /* Line: 25 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_4); + } + + /* Line: 28 : IF : prog.cob */ + if (((int)cob_cmp (&f_8, (cob_field *)&c_1) != 0)) + { + + /* Line: 29 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_5, &f_8, &c_6); + } + + /* Line: 33 : MOVE : prog.cob */ + memset (b_8, 32, 20); + + /* Line: 34 : STRING : prog.cob */ + cob_glob_ptr->cob_exception_code = 0; + cob_string_init (&f_8, NULL); + cob_string_delimited (NULL); + cob_string_append ((cob_field *)&c_7); + cob_string_finish (); + if (unlikely ((cob_glob_ptr->cob_exception_code & 0xff00) == 0x0a00)) + { + + /* Line: 38 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_8); + } + else + { + + /* Line: 41 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_9); + + /* Line: 43 : MOVE : prog.cob */ + memset (b_9, 32, 50); + + /* Line: 44 : STRING : prog.cob */ + cob_string_init (&f_9, NULL); + cob_string_delimited (NULL); + cob_string_append ((cob_field *)&c_10); + cob_string_finish (); + + /* Line: 48 : DISPLAY : prog.cob */ + cob_display (1, 1, 1, &f_9); + } + + /* Line: 51 : IF : prog.cob */ + if (((int)memcmp (b_8, (cob_u8_ptr)"data is too big here", 20) != 0)) + { + + /* Line: 52 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_11, &f_8, &c_6); + } + + /* Line: 57 : MOVE : prog.cob */ + memset (b_8, 32, 20); + + /* Line: 58 : UNSTRING : prog.cob */ + cob_glob_ptr->cob_exception_code = 0; + cob_unstring_init ((cob_field *)&c_1, NULL, 0); + cob_unstring_into (&f_8, 0, 0); + cob_unstring_finish (); + if (unlikely ((cob_glob_ptr->cob_exception_code & 0xff00) == 0x0a00)) + { + + /* Line: 61 : MOVE : prog.cob */ + memset (b_9, 32, 50); + + /* Line: 62 : UNSTRING : prog.cob */ + cob_unstring_init ((cob_field *)&c_12, NULL, 0); + cob_unstring_into (&f_9, 0, 0); + cob_unstring_finish (); + + /* Line: 65 : DISPLAY : prog.cob */ + cob_display (1, 1, 1, &f_9); + + /* Line: 67 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_13); + } + else + { + + /* Line: 70 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_14); + } + + /* Line: 73 : IF : prog.cob */ + if (((int)cob_cmp (&f_8, (cob_field *)&c_1) != 0)) + { + + /* Line: 74 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_15, &f_8, &c_6); + } + + /* Line: 78 : MOVE : prog.cob */ + memset (b_8, 32, 20); + + /* Line: 79 : UNSTRING : prog.cob */ + cob_glob_ptr->cob_exception_code = 0; + cob_unstring_init ((cob_field *)&c_7, NULL, 0); + cob_unstring_into (&f_8, 0, 0); + cob_unstring_finish (); + if (unlikely ((cob_glob_ptr->cob_exception_code & 0xff00) == 0x0a00)) + { + + /* Line: 82 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_16); + } + else + { + + /* Line: 85 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_17); + + /* Line: 87 : MOVE : prog.cob */ + memset (b_9, 32, 50); + + /* Line: 88 : STRING : prog.cob */ + cob_string_init (&f_9, NULL); + cob_string_delimited (NULL); + cob_string_append ((cob_field *)&c_10); + cob_string_finish (); + + /* Line: 92 : DISPLAY : prog.cob */ + cob_display (1, 1, 1, &f_9); + } + + /* Line: 95 : IF : prog.cob */ + if (((int)memcmp (b_8, (cob_u8_ptr)"data is too big here", 20) != 0)) + { + + /* Line: 96 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_18, &f_8, &c_6); + } + + /* Line: 100 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + P_cgerror: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + prog_module_init (module); + + module->crt_status = NULL; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memset (b_8, 32, 20); + memset (b_9, 32, 50); + + if (0 == 1) goto P_cgerror; + initialized = 1; + goto P_ret_initialize; + + P_dump: + return 0; + + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) + return 0; + if (module && module->module_active) + cob_fatal_error (COB_FERROR_CANCEL); + + initialized = 0; + + P_clear_decimal: + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* Initialize module structure for prog */ +static void prog_module_init (cob_module *module) +{ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + module->flag_debug_trace = 0; + module->flag_dump_ready = 0; + module->module_stmt = 0; + module->module_sources = NULL; +} + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], +[1 passed +2 passed +3 passed +4 passed +], []) + +AT_CLEANUP + + +AT_SETUP([UNSTRING DELIMITED ALL LOW-VALUE]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:23:06 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:23:06" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 112306 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:23:06 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x01, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x0000, NULL}; + +static const cob_field_attr cob_all_attr = {0x22, 0, 0, 0, NULL}; + + +/* Constants */ + +static cob_field cob_all_low = {1, (cob_u8_ptr)"\0", &cob_all_attr}; + + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 11:23:06 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[8] __attribute__((aligned)); /* G */ + static cob_u8_t b_10[3] __attribute__((aligned)); /* A */ + static cob_u8_t b_11[3] __attribute__((aligned)); /* B */ + + /* End of data storage */ + + + /* Fields */ + static cob_field f_6 = {8, b_6, &a_1}; /* G */ + static cob_field f_10 = {3, b_10, &a_2}; /* A */ + static cob_field f_11 = {3, b_11, &a_2}; /* B */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 12 : Entry prog : prog.cob */ + l_2:; + + /* Line: 12 : UNSTRING : prog.cob */ + cob_unstring_init (&f_6, NULL, 1); + cob_unstring_delimited (&cob_all_low, 1); + cob_unstring_into (&f_10, 0, 0); + cob_unstring_into (&f_11, 0, 0); + cob_unstring_finish (); + + /* Line: 15 : IF : prog.cob */ + if (((int)memcmp (b_10, (cob_u8_ptr)"ABC", 3) != 0)) + { + + /* Line: 16 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &f_10); + } + + /* Line: 17 : IF : prog.cob */ + if (((int)memcmp (b_11, (cob_u8_ptr)"DEF", 3) != 0)) + { + + /* Line: 18 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &f_11); + } + + /* Line: 19 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memcpy (b_6, "ABC", 3); + memset (b_6 + 3, 0, 2); + memcpy (b_6 + 5, "DEF", 3); + memset (b_10, 32, 3); + memset (b_11, 32, 3); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + + +AT_SETUP([UNSTRING DELIMITED ALL SPACE-2]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:24:04 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:24:04" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 112404 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:24:04 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; +static const cob_field_attr a_3 = {0x10, 2, 0, 0x0000, NULL}; +static const cob_field_attr a_4 = {0x01, 0, 0, 0x0000, NULL}; + +static const cob_field_attr cob_all_attr = {0x22, 0, 0, 0, NULL}; + + +/* Constants */ +static const cob_field c_1 = {21, (cob_u8_ptr)"Expected space - Got ", &a_2}; +static const cob_field c_2 = {17, (cob_u8_ptr)"Expected 5 - Got ", &a_2}; +static const cob_field c_3 = {10, (cob_u8_ptr)"ABC AND DE", &a_2}; +static const cob_field c_4 = {26, (cob_u8_ptr)"Expected ABC AND DE - Got ", &a_2}; +static const cob_field c_5 = {18, (cob_u8_ptr)"Expected 21 - Got ", &a_2}; +static const cob_field c_6 = {11, (cob_u8_ptr)" FG AND HIJ", &a_2}; +static const cob_field c_7 = {27, (cob_u8_ptr)"Expected FG AND HIJ - Got ", &a_2}; +static const cob_field c_8 = {18, (cob_u8_ptr)"Expected 40 - Got ", &a_2}; + +static cob_field cob_all_space = {1, (cob_u8_ptr)" ", &cob_all_attr}; + + /* Decimal constants */ + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 11:24:04 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[39] __attribute__((aligned)); /* WS-RECORD */ + static cob_u8_t b_12[2] __attribute__((aligned)); /* SPACE-2 */ + static cob_u8_t b_13[15] __attribute__((aligned)); /* WS-DUMMY */ + static cob_u8_t b_14[2] __attribute__((aligned)); /* WS-POINTER */ + + /* End of data storage */ + + + /* Fields */ + static cob_field f_6 = {39, b_6, &a_4}; /* WS-RECORD */ + static cob_field f_12 = {2, b_12, &a_1}; /* SPACE-2 */ + static cob_field f_13 = {15, b_13, &a_1}; /* WS-DUMMY */ + static cob_field f_14 = {2, b_14, &a_3}; /* WS-POINTER */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 16 : Entry prog : prog.cob */ + l_2:; + + /* Line: 16 : MOVE : prog.cob */ + memcpy (b_14, "01", 2); + + /* Line: 18 : PERFORM : prog.cob */ + /* PERFORM 0001-SUB */ + frame_ptr++; + frame_ptr->perform_through = 5; + frame_ptr->return_address_num = 0; + goto l_5; + l_6: + frame_ptr--; + + /* Line: 19 : IF : prog.cob */ + if (((int)cob_cmp (&f_13, &cob_all_space) != 0)) + { + + /* Line: 20 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_1, &f_13); + } + + /* Line: 21 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_14, 2, 5LL, 0) != 0)) + { + + /* Line: 22 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_2, &f_14); + } + + /* Line: 24 : PERFORM : prog.cob */ + /* PERFORM 0001-SUB */ + frame_ptr++; + frame_ptr->perform_through = 5; + frame_ptr->return_address_num = 1; + goto l_5; + l_7: + frame_ptr--; + + /* Line: 25 : IF : prog.cob */ + if (((int)cob_cmp (&f_13, (cob_field *)&c_3) != 0)) + { + + /* Line: 26 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_4, &f_13); + } + + /* Line: 27 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_14, 2, 21LL, 0) != 0)) + { + + /* Line: 28 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_5, &f_14); + } + + /* Line: 30 : PERFORM : prog.cob */ + /* PERFORM 0001-SUB */ + frame_ptr++; + frame_ptr->perform_through = 5; + frame_ptr->return_address_num = 2; + goto l_5; + l_8: + frame_ptr--; + + /* Line: 31 : IF : prog.cob */ + if (((int)cob_cmp (&f_13, (cob_field *)&c_6) != 0)) + { + + /* Line: 32 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_7, &f_13); + } + + /* Line: 33 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_14, 2, 40LL, 0) != 0)) + { + + /* Line: 34 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_8, &f_14); + } + + /* Line: 35 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Line: 36 : Paragraph 0001-SUB : prog.cob */ + l_5:; + + /* Line: 37 : UNSTRING : prog.cob */ + cob_unstring_init (&f_6, &f_14, 1); + cob_unstring_delimited (&f_12, 1); + cob_unstring_into (&f_13, 0, 0); + cob_unstring_finish (); + + /* Implicit PERFORM return */ + if (frame_ptr->perform_through == 5) + goto P_switch; + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + switch (frame_ptr->return_address_num) { + case 2: + goto l_8; + case 1: + goto l_7; + case 0: + goto l_6; + } + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memset (b_6, 32, 4); + memcpy (b_6 + 4, "ABC AND DE", 10); + memset (b_6 + 14, 32, 7); + memcpy (b_6 + 21, "FG AND HIJ", 10); + memset (b_6 + 31, 32, 8); + memset (b_12, 32, 2); + memset (b_13, 32, 15); + memset (b_14, 48, 2); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + + +AT_SETUP([UNSTRING DELIMITED POINTER]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:30:26 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:30:26" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 113026 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:30:26 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x1000, NULL}; +static const cob_field_attr a_2 = {0x10, 2, 0, 0x0000, NULL}; +static const cob_field_attr a_3 = {0x21, 0, 0, 0x0000, NULL}; + + +/* Constants */ +static const cob_field c_1 = {18, (cob_u8_ptr)"Expected 48 - Got ", &a_1}; +static const cob_field c_2 = {18, (cob_u8_ptr)"Expected 62 - Got ", &a_1}; +static const cob_field c_3 = {18, (cob_u8_ptr)"Expected 63 - Got ", &a_1}; +static const cob_field c_4 = {5, (cob_u8_ptr)" PIC ", &a_1}; +static const cob_field c_5 = {7, (cob_u8_ptr)" COMP-3", &a_1}; +static const cob_field c_6 = {1, (cob_u8_ptr)".", &a_1}; + + /* Decimal constants */ + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 11:30:26 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[66] __attribute__((aligned)); /* WS-LAY-RECORD */ + static cob_u8_t b_7[50] __attribute__((aligned)); /* WS-DUMMY */ + static cob_u8_t b_8[32] __attribute__((aligned)); /* WS-KEYWORD */ + static cob_u8_t b_9[2] __attribute__((aligned)); /* WS-POINTER */ + + /* End of data storage */ + + + /* Fields */ + static cob_field f_6 = {66, b_6, &a_3}; /* WS-LAY-RECORD */ + static cob_field f_7 = {50, b_7, &a_3}; /* WS-DUMMY */ + static cob_field f_8 = {32, b_8, &a_3}; /* WS-KEYWORD */ + static cob_field f_9 = {2, b_9, &a_2}; /* WS-POINTER */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 11 : Entry prog : prog.cob */ + l_2:; + + /* Line: 11 : MOVE : prog.cob */ + memcpy (b_6, " 10 AF-RECORD-TYPE-SEQUENCE-04 PIC 9(05) COMP-3. ", 66); + + /* Line: 14 : MOVE : prog.cob */ + memcpy (b_9, "01", 2); + + /* Line: 15 : PERFORM : prog.cob */ + /* PERFORM 0001-SUB */ + frame_ptr++; + frame_ptr->perform_through = 5; + frame_ptr->return_address_num = 0; + goto l_5; + l_6: + frame_ptr--; + + /* Line: 16 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_9, 2, 48LL, 0) != 0)) + { + + /* Line: 17 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_1, &f_9); + } + + /* Line: 18 : ADD : prog.cob */ + cob_add_int (&f_9, 7, 0); + + /* Line: 20 : PERFORM : prog.cob */ + /* PERFORM 0001-SUB */ + frame_ptr++; + frame_ptr->perform_through = 5; + frame_ptr->return_address_num = 1; + goto l_5; + l_7: + frame_ptr--; + + /* Line: 21 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_9, 2, 62LL, 0) != 0)) + { + + /* Line: 22 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_2, &f_9); + } + + /* Line: 23 : PERFORM : prog.cob */ + /* PERFORM 0001-SUB */ + frame_ptr++; + frame_ptr->perform_through = 5; + frame_ptr->return_address_num = 2; + goto l_5; + l_8: + frame_ptr--; + + /* Line: 24 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_9, 2, 63LL, 0) != 0)) + { + + /* Line: 25 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_3, &f_9); + } + + /* Line: 26 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Line: 27 : Paragraph 0001-SUB : prog.cob */ + l_5:; + + /* Line: 28 : UNSTRING : prog.cob */ + cob_unstring_init (&f_6, &f_9, 3); + cob_unstring_delimited ((cob_field *)&c_4, 0); + cob_unstring_delimited ((cob_field *)&c_5, 0); + cob_unstring_delimited ((cob_field *)&c_6, 0); + cob_unstring_into (&f_7, &f_8, 0); + cob_unstring_finish (); + + /* Implicit PERFORM return */ + if (frame_ptr->perform_through == 5) + goto P_switch; + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + switch (frame_ptr->return_address_num) { + case 2: + goto l_8; + case 1: + goto l_7; + case 0: + goto l_6; + } + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memset (b_6, 32, 66); + memset (b_7, 32, 50); + memset (b_8, 32, 32); + memset (b_9, 48, 2); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + + +AT_SETUP([UNSTRING DELIMITER IN]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:31:00 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:31:00" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 113100 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:31:00 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; + + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 11:31:00 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Local cob_field items */ + cob_field f0; + cob_field f1; + cob_field f2; + cob_field f3; + cob_field f4; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[8] __attribute__((aligned)); /* WK-CMD */ + static cob_u8_t b_7[2] __attribute__((aligned)); /* WK-SIGNS */ + static cob_u8_t b_10[2] __attribute__((aligned)); /* WK-DELIM */ + static cob_u8_t b_11[6] __attribute__((aligned)); /* WK-DATA */ + + /* End of data storage */ + + + /* Fields */ + static cob_field f_6 = {8, b_6, &a_1}; /* WK-CMD */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 13 : Entry prog : prog.cob */ + l_2:; + + /* Line: 13 : UNSTRING : prog.cob */ + cob_unstring_init (&f_6, NULL, 2); + cob_unstring_delimited (COB_SET_FLD(f0, 1, b_7 + 0, &a_1), 0); + cob_unstring_delimited (COB_SET_FLD(f0, 1, b_7 + 1, &a_1), 0); + cob_unstring_into (COB_SET_FLD(f0, 2, b_11 + 2 * 0, &a_1), COB_SET_FLD(f1, 1, b_10 + 0, &a_1), 0); + cob_unstring_into (COB_SET_FLD(f0, 2, b_11 + 2 * 1, &a_1), COB_SET_FLD(f1, 1, b_10 + 1, &a_1), 0); + cob_unstring_into (COB_SET_FLD(f0, 2, b_11 + 2 * 2, &a_1), 0, 0); + cob_unstring_finish (); + + /* Line: 18 : IF : prog.cob */ + if (((((((int)memcmp (b_11 + 2 * 0, (cob_u8_ptr)"WW", 2) != 0) || + ((int)memcmp (b_11 + 2 * 1, (cob_u8_ptr)"DD", 2) != 0)) || + ((int)memcmp (b_11 + 2 * 2, (cob_u8_ptr)"CC", 2) != 0)) || + ((int)(int)(*(b_10 + 0) - 65) != 0)) || + ((int)(int)(*(b_10 + 1) - 66) != 0))) + { + + /* Line: 23 : DISPLAY : prog.cob */ + cob_display (0, 1, 5, COB_SET_FLD(f0, 2, b_11 + 2 * 0, &a_1), COB_SET_FLD(f1, 2, b_11 + 2 * 1, &a_1), COB_SET_FLD(f2, 2, b_11 + 2 * 2, &a_1), COB_SET_FLD(f3, 1, b_10 + 0, &a_1), COB_SET_FLD(f4, 1, b_10 + 1, &a_1)); + } + + /* Line: 30 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memcpy (b_6, "WWADDBCC", 8); + memcpy (b_7, "AB", 2); + memset (b_10, 32, 2); + memset (b_11, 32, 3); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE -ftop-level-occurs-clause=ok prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + + +AT_SETUP([UNSTRING combined]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:31:55 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:31:55" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 113155 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:31:55 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x10, 2, 0, 0x0000, NULL}; +static const cob_field_attr a_3 = {0x21, 0, 0, 0x1000, NULL}; + + +/* Constants */ +static const cob_field c_1 = {1, (cob_u8_ptr)"|", &a_3}; +static const cob_field c_2 = {44, (cob_u8_ptr)"Unstring tallying case 1 should not OVERFLOW", &a_3}; +static const cob_field c_3 = {1, (cob_u8_ptr)"-", &a_3}; +static const cob_field c_4 = {41, (cob_u8_ptr)"Unstring tallying case 2 should OVERFLOW", &a_3}; +static const cob_field c_5 = {4, (cob_u8_ptr)"ABC1", &a_3}; +static const cob_field c_6 = {15, (cob_u8_ptr)"A: RES-TRGT-1 <", &a_3}; +static const cob_field c_7 = {11, (cob_u8_ptr)"> != ", &a_3}; +static const cob_field c_8 = {16, (cob_u8_ptr)"A: RES-DELIM-1 <", &a_3}; +static const cob_field c_9 = {8, (cob_u8_ptr)"> != <|>", &a_3}; +static const cob_field c_10 = {16, (cob_u8_ptr)"A: RES-COUNT-1 <", &a_3}; +static const cob_field c_11 = {8, (cob_u8_ptr)"> != <4>", &a_3}; +static const cob_field c_12 = {8, (cob_u8_ptr)"DEF--GHI", &a_3}; +static const cob_field c_13 = {15, (cob_u8_ptr)"A: RES-TRGT-2 <", &a_3}; +static const cob_field c_14 = {15, (cob_u8_ptr)"> != ", &a_3}; +static const cob_field c_15 = {15, (cob_u8_ptr)"A: RES-DELIM2 <", &a_3}; +static const cob_field c_16 = {10, (cob_u8_ptr)"> != SPACE", &a_3}; +static const cob_field c_17 = {8, (cob_u8_ptr)"> != <8>", &a_3}; +static const cob_field c_18 = {16, (cob_u8_ptr)"A: STR-POINTER <", &a_3}; +static const cob_field c_19 = {9, (cob_u8_ptr)"> != <14>", &a_3}; +static const cob_field c_20 = {14, (cob_u8_ptr)"A: RES-TALLY <", &a_3}; +static const cob_field c_21 = {8, (cob_u8_ptr)"> != <2>", &a_3}; +static const cob_field c_22 = {15, (cob_u8_ptr)"B: RES-TRGT-1 <", &a_3}; +static const cob_field c_23 = {16, (cob_u8_ptr)"B: RES-DELIM-1 <", &a_3}; +static const cob_field c_24 = {16, (cob_u8_ptr)"B: RES-COUNT-1 <", &a_3}; +static const cob_field c_25 = {3, (cob_u8_ptr)"DEF", &a_3}; +static const cob_field c_26 = {15, (cob_u8_ptr)"B: RES-TRGT-2 <", &a_3}; +static const cob_field c_27 = {10, (cob_u8_ptr)"> != ", &a_3}; +static const cob_field c_28 = {15, (cob_u8_ptr)"B: RES-DELIM2 <", &a_3}; +static const cob_field c_29 = {8, (cob_u8_ptr)"> != <->", &a_3}; +static const cob_field c_30 = {8, (cob_u8_ptr)"> != <3>", &a_3}; +static const cob_field c_31 = {16, (cob_u8_ptr)"B: STR-POINTER <", &a_3}; +static const cob_field c_32 = {9, (cob_u8_ptr)"> != <11>", &a_3}; +static const cob_field c_33 = {14, (cob_u8_ptr)"B: RES-TALLY <", &a_3}; + + /* Decimal constants */ + + +/* Function prototypes */ + +static int UnstringTest (); +static int UnstringTest_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (UnstringTest ()); +} + +/* Functions */ + +/* PROGRAM-ID 'UnstringTest' */ + +/* ENTRY 'UnstringTest' */ + +static int +UnstringTest () +{ + return UnstringTest_ (0); +} + +static int +UnstringTest_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 11:31:55 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'UnstringTest' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[13] __attribute__((aligned)); /* INP-STRING */ + static cob_u8_t b_7[2] __attribute__((aligned)); /* STR-POINTER */ + static cob_u8_t b_8[48] __attribute__((aligned)); /* RES-DATA */ + + /* End of data storage */ + + + /* Fields */ + static cob_field f_6 = {13, b_6, &a_1}; /* INP-STRING */ + static cob_field f_7 = {2, b_7, &a_2}; /* STR-POINTER */ + static cob_field f_9 = {20, b_8, &a_1}; /* RES-TRGT-1 */ + static cob_field f_10 = {1, b_8 + 20, &a_1}; /* RES-DELIM-1 */ + static cob_field f_11 = {2, b_8 + 21, &a_2}; /* RES-COUNT-1 */ + static cob_field f_12 = {20, b_8 + 23, &a_1}; /* RES-TRGT-2 */ + static cob_field f_13 = {1, b_8 + 43, &a_1}; /* RES-DELIM-2 */ + static cob_field f_14 = {2, b_8 + 44, &a_2}; /* RES-COUNT-2 */ + static cob_field f_15 = {2, b_8 + 46, &a_2}; /* RES-TALLY */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 26 : Entry UnstringTest : prog.cob */ + l_2:; + + /* Line: 26 : INITIALIZE : prog.cob */ + memset (b_8, 32, 21); + memset (b_8 + 21, 48, 2); + memset (b_8 + 23, 32, 21); + memset (b_8 + 44, 48, 4); + + /* Line: 27 : MOVE : prog.cob */ + memcpy (b_7, "01", 2); + + /* Line: 29 : UNSTRING : prog.cob */ + cob_glob_ptr->cob_exception_code = 0; + cob_unstring_init (&f_6, &f_7, 1); + cob_unstring_delimited ((cob_field *)&c_1, 0); + cob_unstring_into (&f_9, &f_10, &f_11); + cob_unstring_into (&f_12, &f_13, &f_14); + cob_unstring_tallying (&f_15); + cob_unstring_finish (); + if (unlikely ((cob_glob_ptr->cob_exception_code & 0xff00) == 0x0a00)) + { + + /* Line: 38 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_2); + } + + /* Line: 42 : PERFORM : prog.cob */ + /* PERFORM TEST-CASE-1-RESULT */ + frame_ptr++; + frame_ptr->perform_through = 5; + frame_ptr->return_address_num = 0; + goto l_5; + l_7: + frame_ptr--; + + /* Line: 45 : INITIALIZE : prog.cob */ + memset (b_8, 32, 21); + memset (b_8 + 21, 48, 2); + memset (b_8 + 23, 32, 21); + memset (b_8 + 44, 48, 4); + + /* Line: 46 : MOVE : prog.cob */ + memcpy (b_7, "01", 2); + + /* Line: 48 : UNSTRING : prog.cob */ + cob_glob_ptr->cob_exception_code = 0; + cob_unstring_init (&f_6, &f_7, 2); + cob_unstring_delimited ((cob_field *)&c_1, 0); + cob_unstring_delimited ((cob_field *)&c_3, 1); + cob_unstring_into (&f_9, &f_10, &f_11); + cob_unstring_into (&f_12, &f_13, &f_14); + cob_unstring_tallying (&f_15); + cob_unstring_finish (); + if (!cob_glob_ptr->cob_exception_code) + { + + /* Line: 57 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_4); + } + + /* Line: 61 : PERFORM : prog.cob */ + /* PERFORM TEST-CASE-2-RESULT */ + frame_ptr++; + frame_ptr->perform_through = 6; + frame_ptr->return_address_num = 1; + goto l_6; + l_8: + frame_ptr--; + + /* Line: 63 : GOBACK : prog.cob */ + goto exit_program; + + /* Line: 66 : Paragraph TEST-CASE-1-RESULT : prog.cob */ + l_5:; + + /* Line: 68 : IF : prog.cob */ + if (((int)cob_cmp (&f_9, (cob_field *)&c_5) != 0)) + { + + /* Line: 69 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_6, &f_9, &c_7); + } + + /* Line: 70 : IF : prog.cob */ + if (((int)(int)(*(b_8 + 20) - 124) != 0)) + { + + /* Line: 71 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_8, &f_10, &c_9); + } + + /* Line: 72 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_8 + 21, 2, 4LL, 0) != 0)) + { + + /* Line: 73 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_10, &f_11, &c_11); + } + + /* Line: 74 : IF : prog.cob */ + if (((int)cob_cmp (&f_12, (cob_field *)&c_12) != 0)) + { + + /* Line: 75 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_13, &f_12, &c_14); + } + + /* Line: 76 : IF : prog.cob */ + if (((int)(int)(*(b_8 + 43) - ' ') != 0)) + { + + /* Line: 77 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_15, &f_13, &c_16); + } + + /* Line: 78 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_8 + 44, 2, 8LL, 0) != 0)) + { + + /* Line: 79 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_10, &f_14, &c_17); + } + + /* Line: 80 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_7, 2, 14LL, 0) != 0)) + { + + /* Line: 81 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_18, &f_7, &c_19); + } + + /* Line: 82 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_8 + 46, 2, 2LL, 0) != 0)) + { + + /* Line: 83 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_20, &f_15, &c_21); + } + + /* Implicit PERFORM return */ + if (frame_ptr->perform_through == 5) + goto P_switch; + + /* Line: 85 : Paragraph TEST-CASE-2-RESULT : prog.cob */ + l_6:; + + /* Line: 87 : IF : prog.cob */ + if (((int)cob_cmp (&f_9, (cob_field *)&c_5) != 0)) + { + + /* Line: 88 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_22, &f_9, &c_7); + } + + /* Line: 89 : IF : prog.cob */ + if (((int)(int)(*(b_8 + 20) - 124) != 0)) + { + + /* Line: 90 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_23, &f_10, &c_9); + } + + /* Line: 91 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_8 + 21, 2, 4LL, 0) != 0)) + { + + /* Line: 92 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_24, &f_11, &c_11); + } + + /* Line: 93 : IF : prog.cob */ + if (((int)cob_cmp (&f_12, (cob_field *)&c_25) != 0)) + { + + /* Line: 94 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_26, &f_12, &c_27); + } + + /* Line: 95 : IF : prog.cob */ + if (((int)(int)(*(b_8 + 43) - 45) != 0)) + { + + /* Line: 96 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_28, &f_13, &c_29); + } + + /* Line: 97 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_8 + 44, 2, 3LL, 0) != 0)) + { + + /* Line: 98 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_24, &f_14, &c_30); + } + + /* Line: 99 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_7, 2, 11LL, 0) != 0)) + { + + /* Line: 100 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_31, &f_7, &c_32); + } + + /* Line: 101 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_8 + 46, 2, 2LL, 0) != 0)) + { + + /* Line: 102 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_33, &f_15, &c_21); + } + + /* Implicit PERFORM return */ + if (frame_ptr->perform_through == 6) + goto P_switch; + + /* Program exit */ + + exit_program: + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + switch (frame_ptr->return_address_num) { + case 1: + goto l_8; + case 0: + goto l_7; + } + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "UnstringTest"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())UnstringTest; + module->module_cancel.funcptr = (void *(*)())UnstringTest_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memcpy (b_6, "ABC1|DEF--GHI", 13); + memset (b_7, 48, 2); + memset (b_8, 32, 21); + memset (b_8 + 21, 48, 2); + memset (b_8 + 23, 32, 21); + memset (b_8 + 44, 48, 4); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'UnstringTest' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + + +AT_SETUP([UNSTRING with FUNCTION / literal]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:33:04 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:33:04" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 113304 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:33:04 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x1000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x0000, NULL}; + + +/* Constants */ +static const cob_field c_1 = {19, (cob_u8_ptr)"The,Quick,Brown,Fox", &a_1}; +static const cob_field c_2 = {1, (cob_u8_ptr)",", &a_1}; +static const cob_field c_3 = {10, (cob_u8_ptr)"PRM(1) is ", &a_1}; +static const cob_field c_4 = {1, (cob_u8_ptr)":", &a_1}; +static const cob_field c_5 = {10, (cob_u8_ptr)"PRM(2) is ", &a_1}; +static const cob_field c_6 = {10, (cob_u8_ptr)"PRM(3) is ", &a_1}; +static const cob_field c_7 = {10, (cob_u8_ptr)"PRM(4) is ", &a_1}; +static const cob_field c_8 = {20, (cob_u8_ptr)"Now using UPPER-CASE", &a_1}; +static const cob_field c_9 = {25, (cob_u8_ptr)"Daddy,was,a,Rolling stone", &a_1}; +static const cob_field c_10 = {17, (cob_u8_ptr)"Now using Literal", &a_1}; +static const cob_field c_11 = {30, (cob_u8_ptr)"Now using Literal + LOWER-CASE", &a_1}; + + /* Decimal constants */ + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 11:33:04 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Local cob_field items */ + cob_field f0; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[543] __attribute__((aligned)); /* FILLER 1 */ + + /* End of data storage */ + + + /* Fields */ + static cob_field f_7 = {479, b_6, &a_2}; /* TSTUNS */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 9 : Entry prog : prog.cob */ + l_2:; + + /* Line: 9 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_1, &f_7); + + /* Line: 10 : UNSTRING : prog.cob */ + cob_unstring_init (&f_7, NULL, 1); + cob_unstring_delimited ((cob_field *)&c_2, 0); + cob_unstring_into (COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 0, &a_2), 0, 0); + cob_unstring_into (COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 1, &a_2), 0, 0); + cob_unstring_into (COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 2, &a_2), 0, 0); + cob_unstring_into (COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 3, &a_2), 0, 0); + cob_unstring_finish (); + + /* Line: 12 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_3, COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 0, &a_2), &c_4); + + /* Line: 13 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_5, COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 1, &a_2), &c_4); + + /* Line: 14 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_6, COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 2, &a_2), &c_4); + + /* Line: 15 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_7, COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 3, &a_2), &c_4); + + /* Line: 16 : UNSTRING : prog.cob */ + cob_unstring_init (cob_intr_upper_case (0, 0, &f_7), NULL, 1); + cob_unstring_delimited ((cob_field *)&c_2, 0); + cob_unstring_into (COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 0, &a_2), 0, 0); + cob_unstring_into (COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 1, &a_2), 0, 0); + cob_unstring_into (COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 2, &a_2), 0, 0); + cob_unstring_into (COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 3, &a_2), 0, 0); + cob_unstring_finish (); + + /* Line: 18 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_8); + + /* Line: 19 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_3, COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 0, &a_2), &c_4); + + /* Line: 20 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_5, COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 1, &a_2), &c_4); + + /* Line: 21 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_6, COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 2, &a_2), &c_4); + + /* Line: 22 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_7, COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 3, &a_2), &c_4); + + /* Line: 23 : UNSTRING : prog.cob */ + cob_unstring_init ((cob_field *)&c_9, NULL, 1); + cob_unstring_delimited ((cob_field *)&c_2, 0); + cob_unstring_into (COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 0, &a_2), 0, 0); + cob_unstring_into (COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 1, &a_2), 0, 0); + cob_unstring_into (COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 2, &a_2), 0, 0); + cob_unstring_into (COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 3, &a_2), 0, 0); + cob_unstring_finish (); + + /* Line: 25 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_10); + + /* Line: 26 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_3, COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 0, &a_2), &c_4); + + /* Line: 27 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_5, COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 1, &a_2), &c_4); + + /* Line: 28 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_6, COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 2, &a_2), &c_4); + + /* Line: 29 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_7, COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 3, &a_2), &c_4); + + /* Line: 30 : UNSTRING : prog.cob */ + cob_unstring_init (cob_intr_lower_case (0, 0, (cob_field *)&c_9), NULL, 1); + cob_unstring_delimited ((cob_field *)&c_2, 0); + cob_unstring_into (COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 0, &a_2), 0, 0); + cob_unstring_into (COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 1, &a_2), 0, 0); + cob_unstring_into (COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 2, &a_2), 0, 0); + cob_unstring_into (COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 3, &a_2), 0, 0); + cob_unstring_finish (); + + /* Line: 33 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_11); + + /* Line: 34 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_3, COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 0, &a_2), &c_4); + + /* Line: 35 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_5, COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 1, &a_2), &c_4); + + /* Line: 36 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_6, COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 2, &a_2), &c_4); + + /* Line: 37 : DISPLAY : prog.cob */ + cob_display (0, 1, 3, &c_7, COB_SET_FLD(f0, 16, b_6 + 479 + 16 * 3, &a_2), &c_4); + + /* Line: 38 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memset (b_6, 32, 543); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], +[PRM(1) is The : +PRM(2) is Quick : +PRM(3) is Brown : +PRM(4) is Fox : +Now using UPPER-CASE +PRM(1) is THE : +PRM(2) is QUICK : +PRM(3) is BROWN : +PRM(4) is FOX : +Now using Literal +PRM(1) is Daddy : +PRM(2) is was : +PRM(3) is a : +PRM(4) is Rolling stone : +Now using Literal + LOWER-CASE +PRM(1) is daddy : +PRM(2) is was : +PRM(3) is a : +PRM(4) is rolling stone : +], []) + +AT_CLEANUP + + +AT_SETUP([INSPECT TRAILING]) # Note: TRAILING is an extension +AT_KEYWORDS([extensions]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 3.1.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 16:28:18 */ +/* GnuCOBOL build date Apr 17 2024 11:33:59 */ +/* GnuCOBOL package date Dec 23 2020 12:04:58 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.1/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "3.1.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 16:28:18" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 162818 + +/* Global variables */ +/* Generated by cobc 3.1.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 16:28:18 */ +/* GnuCOBOL build date Apr 17 2024 11:33:59 */ +/* GnuCOBOL package date Dec 23 2020 12:04:58 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.1/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x10, 1, 0, 0x1000, NULL}; +static const cob_field_attr a_2 = {0x11, 4, 0, 0x0820, NULL}; +static const cob_field_attr a_3 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_4 = {0x21, 0, 0, 0x1000, NULL}; + +static const cob_field_attr cob_all_attr = {0x22, 0, 0, 0, NULL}; + + +/* Constants */ +static const cob_field c_1 = {1, (cob_u8_ptr)"0", &a_1}; +static const cob_field c_2 = {38, (cob_u8_ptr)"Bad Result for Inspect Trailing Case 1", &a_4}; +static const cob_field c_3 = {1, (cob_u8_ptr)"A", &a_4}; +static const cob_field c_4 = {38, (cob_u8_ptr)"Bad Result for Inspect Trailing Case 2", &a_4}; +static const cob_field c_5 = {1, (cob_u8_ptr)"B", &a_4}; +static const cob_field c_6 = {38, (cob_u8_ptr)"Bad Result for Inspect Trailing Case 3", &a_4}; +static const cob_field c_7 = {38, (cob_u8_ptr)"Bad Result for Inspect Trailing Case 4", &a_4}; +static const cob_field c_8 = {38, (cob_u8_ptr)"Bad Result for Inspect Trailing Case 5", &a_4}; + +static cob_field cob_all_space = {1, (cob_u8_ptr)" ", &cob_all_attr}; + + +static COB_INLINE COB_A_INLINE int +cob_cmpswp_u16 (const void *p, const cob_s64_t n) +{ + void *x; + unsigned short val; + if (unlikely(n < 0)) { + return 1; + } + x = &val; + optim_memcpy (x, p, 2); + val = COB_BSWAP_16 (val); + return (val < n) ? -1 : (val > n); +} + + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); +static void prog_module_init (cob_module *module); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 3.1.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 16:28:18 */ + /* GnuCOBOL build date Apr 17 2024 11:33:59 */ + /* GnuCOBOL package date Dec 23 2020 12:04:58 UTC */ + /* Compile command /opt/gnucobol/gnucobol-3.1/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_8[20] __attribute__((aligned)); /* W01-STRING */ + static cob_u8_t b_9[2] __attribute__((aligned)); /* W01-INDEX */ + + /* End of local data storage */ + + + /* Fields (local) */ + static cob_field f_8 = {20, b_8, &a_3}; /* W01-STRING */ + static cob_field f_9 = {2, b_9, &a_2}; /* W01-INDEX */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -10) + goto P_dump; + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 10 : Entry prog : prog.cob */ + l_2:; + + /* Line: 12 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_1, &f_9); + + /* Line: 13 : INSPECT : prog.cob */ + cob_inspect_init (&f_8, 0); + cob_inspect_start (); + cob_inspect_trailing (&f_9, &cob_all_space); + cob_inspect_finish (); + + /* Line: 15 : IF : prog.cob */ + if (((int)cob_cmpswp_u16 (b_9, 10LL) != 0)) + { + + /* Line: 17 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_2); + } + + /* Line: 20 : INSPECT : prog.cob */ + cob_inspect_init (&f_8, 1); + cob_inspect_start (); + cob_inspect_trailing ((cob_field *)&c_3, &cob_all_space); + cob_inspect_finish (); + + /* Line: 21 : IF : prog.cob */ + if (((int)memcmp (b_8, (cob_u8_ptr)"0123456789AAAAAAAAAA", 20) != 0)) + { + + /* Line: 23 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_4); + } + + /* Line: 26 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_1, &f_9); + + /* Line: 27 : INSPECT : prog.cob */ + cob_inspect_init (&f_8, 0); + cob_inspect_start (); + cob_inspect_trailing (&f_9, &cob_all_space); + cob_inspect_finish (); + cob_inspect_init (&f_8, 1); + cob_inspect_start (); + cob_inspect_trailing ((cob_field *)&c_5, (cob_field *)&c_3); + cob_inspect_finish (); + + /* Line: 31 : IF : prog.cob */ + if (((int)memcmp (b_8, (cob_u8_ptr)"0123456789BBBBBBBBBB", 20) != 0)) + { + + /* Line: 33 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &c_6); + } + + /* Line: 36 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_1, &f_9); + + /* Line: 37 : MOVE : prog.cob */ + memset (b_8, 32, 20); + + /* Line: 38 : INSPECT : prog.cob */ + cob_inspect_init (&f_8, 0); + cob_inspect_start (); + cob_inspect_trailing (&f_9, (cob_field *)&c_3); + cob_inspect_finish (); + + /* Line: 41 : IF : prog.cob */ + if (((int)cob_cmpswp_u16 (b_9, 0LL) != 0)) + { + + /* Line: 43 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_7, &f_9); + } + + /* Line: 47 : MOVE : prog.cob */ + cob_move ((cob_field *)&c_1, &f_9); + + /* Line: 48 : MOVE : prog.cob */ + memset (b_8, 32, 20); + + /* Line: 49 : INSPECT : prog.cob */ + cob_inspect_init (&f_8, 0); + cob_inspect_start (); + cob_inspect_trailing (&f_9, &cob_all_space); + cob_inspect_finish (); + + /* Line: 52 : IF : prog.cob */ + if (((int)cob_cmpswp_u16 (b_9, 20LL) != 0)) + { + + /* Line: 54 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_8, &f_9); + } + + /* Line: 58 : GOBACK : prog.cob */ + goto exit_program; + + /* Program exit */ + + exit_program: + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + P_cgerror: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + prog_module_init (module); + + module->crt_status = NULL; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memcpy (b_8, "0123456789", 10); + memset (b_8 + 10, 32, 10); + memset (b_9, 0, 2); + + if (0 == 1) goto P_cgerror; + initialized = 1; + goto P_ret_initialize; + + P_dump: + return 0; + + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) + return 0; + if (module && module->module_active) + cob_fatal_error (COB_FERROR_CANCEL); + + initialized = 0; + + P_clear_decimal: + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* Initialize module structure for prog */ +static void prog_module_init (cob_module *module) +{ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + module->flag_debug_trace = 0; + module->flag_dump_ready = 0; + module->module_stmt = 0; + module->module_sources = NULL; +} + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + +AT_SETUP([INSPECT REPLACING TRAILING ZEROS BY SPACES]) +AT_KEYWORDS([runmisc figurative constant]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:49:12 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:49:12" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 114912 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:49:12 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; + +static const cob_field_attr cob_all_attr = {0x22, 0, 0, 0, NULL}; + + +/* Constants */ + +static cob_field cob_all_space = {1, (cob_u8_ptr)" ", &cob_all_attr}; +static cob_field cob_all_zero = {1, (cob_u8_ptr)"0", &cob_all_attr}; + + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 11:49:12 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[4] __attribute__((aligned)); /* X */ + + /* End of data storage */ + + + /* Fields */ + static cob_field f_6 = {4, b_6, &a_1}; /* X */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 7 : Entry prog : prog.cob */ + l_2:; + + /* Line: 7 : INSPECT : prog.cob */ + cob_inspect_init (&f_6, 1); + cob_inspect_start (); + cob_inspect_trailing (&cob_all_space, &cob_all_zero); + cob_inspect_finish (); + + /* Line: 8 : IF : prog.cob */ + if (((int)memcmp (b_6, (cob_u8_ptr)"1 ", 4) != 0)) + { + + /* Line: 9 : DISPLAY : prog.cob */ + cob_display (0, 1, 1, &f_6); + } + + /* Line: 10 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memcpy (b_6, "1", 1); + memset (b_6 + 1, 48, 3); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + +AT_SETUP([INSPECT REPLACING complex]) +AT_KEYWORDS([runmisc CHARACTERS TRAILING]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:50:30 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + +#include +#include +#include +#include +#include +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "2.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:50:30" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 115030 + +/* Global variables */ +/* Generated by cobc 2.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:50:30 */ +/* GnuCOBOL build date Apr 10 2024 16:39:16 */ +/* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ +/* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; + +static const cob_field_attr cob_all_attr = {0x22, 0, 0, 0, NULL}; + + +/* Constants */ +static const cob_field c_1 = {1, (cob_u8_ptr)"Z", &a_2}; +static const cob_field c_2 = {1, (cob_u8_ptr)"A", &a_2}; +static const cob_field c_3 = {1, (cob_u8_ptr)"Y", &a_2}; +static const cob_field c_4 = {1, (cob_u8_ptr)"B", &a_2}; +static const cob_field c_5 = {1, (cob_u8_ptr)"0", &a_2}; +static const cob_field c_6 = {1, (cob_u8_ptr)"X", &a_2}; +static const cob_field c_7 = {1, (cob_u8_ptr)"C", &a_2}; +static const cob_field c_8 = {4, (cob_u8_ptr)"1 - ", &a_2}; +static const cob_field c_9 = {1, (cob_u8_ptr)"E", &a_2}; +static const cob_field c_10 = {4, (cob_u8_ptr)"2 - ", &a_2}; + +static cob_field cob_all_space = {1, (cob_u8_ptr)" ", &cob_all_attr}; +static cob_field cob_all_zero = {1, (cob_u8_ptr)"0", &cob_all_attr}; + + /* Decimal constants */ + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 2.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 11:50:30 */ + /* GnuCOBOL build date Apr 10 2024 16:39:16 */ + /* GnuCOBOL package date Sep 06 2017 18:45:29 UTC */ + /* Compile command /opt/gnucobol/gnucobol-2.2/bin/cobc -Cx -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_6[12] __attribute__((aligned)); /* X */ + + /* End of data storage */ + + + /* Fields */ + static cob_field f_6 = {12, b_6, &a_1}; /* X */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 7 : Entry prog : prog.cob */ + l_2:; + + /* Line: 7 : INSPECT : prog.cob */ + cob_inspect_init (&f_6, 1); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_1, (cob_field *)&c_2); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_3, (cob_field *)&c_4); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_5, (cob_field *)&c_1); + cob_inspect_start (); + cob_inspect_trailing ((cob_field *)&c_6, (cob_field *)&c_7); + cob_inspect_finish (); + + /* Line: 12 : IF : prog.cob */ + if (((int)memcmp (b_6, (cob_u8_ptr)"Z0ZYYCDCCEXX", 12) != 0)) + { + + /* Line: 13 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_8, &f_6); + } + + /* Line: 15 : INSPECT : prog.cob */ + cob_inspect_init (&f_6, 1); + cob_inspect_start (); + cob_inspect_before ((cob_field *)&c_7); + cob_inspect_after ((cob_field *)&c_5); + cob_inspect_characters (&cob_all_space); + cob_inspect_start (); + cob_inspect_before ((cob_field *)&c_9); + cob_inspect_after ((cob_field *)&c_7); + cob_inspect_characters (&cob_all_zero); + cob_inspect_finish (); + + /* Line: 20 : IF : prog.cob */ + if (((int)memcmp (b_6, (cob_u8_ptr)"Z0 C000EXX", 12) != 0)) + { + + /* Line: 21 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_10, &f_6); + } + + /* Line: 23 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + /* Initialize module structure */ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->module_returning = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + b_2 = 0; + memcpy (b_6, "AZABBCDCCECC", 12); + + initialized = 1; + goto P_ret_initialize; + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) { + return 0; + } + if (module->module_active) { + cob_fatal_error (COB_FERROR_CANCEL); + } + + initialized = 0; + + P_clear_decimal: + + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) +AT_CLEANUP + + +# Note: EXAMINE was dropped with COBOL85, but some dialects +# still support that + +AT_SETUP([EXAMINE TALLYING]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 3.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:56:21 */ +/* GnuCOBOL build date Apr 17 2024 11:34:39 */ +/* GnuCOBOL package date Jul 28 2023 17:02:56 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.2/bin/cobc -Cx -freserved=EXAMINE -fno-computed-goto prog.cob */ + +#include /* for memcpy, memcmp and friends */ +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "3.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:56:21" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 115621 + +/* Global variables */ +/* Generated by cobc 3.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:56:21 */ +/* GnuCOBOL build date Apr 17 2024 11:34:39 */ +/* GnuCOBOL package date Jul 28 2023 17:02:56 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.2/bin/cobc -Cx -freserved=EXAMINE -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Data storage */ + +/* PROGRAM-ID : prog */ +static cob_u8_t b_4[4] __attribute__((aligned)); /* TALLY */ + +/* End of data storage */ + + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x1b, 5, 0, 0x0820, NULL}; +static const cob_field_attr a_3 = {0x21, 0, 0, 0x1000, NULL}; +static const cob_field_attr a_4 = {0x10, 7, 2, 0x0001, NULL}; +static const cob_field_attr a_5 = {0x10, 1, 0, 0x1000, NULL}; +static const cob_field_attr a_6 = {0x10, 7, 2, 0x0007, NULL}; + + +/* Fields */ + +/* PROGRAM-ID : prog */ +static cob_field f_4 = {4, b_4, &a_2}; /* TALLY */ + +/* End of fields */ + + +/* Constants */ +static const cob_field c_1 = {1, (cob_u8_ptr)"A", &a_3}; +static const cob_field c_2 = {19, (cob_u8_ptr)"Should be 4 but is ", &a_3}; +static const cob_field c_3 = {19, (cob_u8_ptr)"Should be 2 but is ", &a_3}; +static const cob_field c_4 = {1, (cob_u8_ptr)"C", &a_3}; +static const cob_field c_5 = {19, (cob_u8_ptr)"Should be 5 but is ", &a_3}; +static const cob_field c_6 = {1, (cob_u8_ptr)"Z", &a_3}; +static const cob_field c_7 = {26, (cob_u8_ptr)"Should be ZZBZBCZB but is ", &a_3}; +static const cob_field c_8 = {26, (cob_u8_ptr)"Should be AABZBCZB but is ", &a_3}; +static const cob_field c_9 = {1, (cob_u8_ptr)"X", &a_3}; +static const cob_field c_10 = {26, (cob_u8_ptr)"Should be XXXXXCZB but is ", &a_3}; +static const cob_field c_11 = {1, (cob_u8_ptr)"Y", &a_3}; +static const cob_field c_12 = {19, (cob_u8_ptr)"Should be 8 but is ", &a_3}; +static const cob_field c_13 = {26, (cob_u8_ptr)"Should be YYYYYYYY but is ", &a_3}; +static const cob_field c_14 = {1, (cob_u8_ptr)"5", &a_5}; +static const cob_field c_15 = {1, (cob_u8_ptr)"8", &a_5}; +static const cob_field c_16 = {8, (cob_u8_ptr)"-8888855", &a_6}; +static const cob_field c_17 = {27, (cob_u8_ptr)"Should be -88888.55 but is ", &a_3}; + + +static COB_INLINE COB_A_INLINE int +cob_cmpswp_u32 (const void *p, const cob_s64_t n) +{ + void *x; + unsigned int val; + if (unlikely(n < 0)) { + return 1; + } + x = &val; + optim_memcpy (x, p, 4); + val = COB_BSWAP_32 (val); + return (val < n) ? -1 : (val > n); +} + + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); +static void prog_module_init (cob_module *module); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +static void gc_module_so_init () __attribute__ ((constructor)); +static void gc_module_so_init () +{ + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); +} + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 3.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 11:56:21 */ + /* GnuCOBOL build date Apr 17 2024 11:34:39 */ + /* GnuCOBOL package date Jul 28 2023 17:02:56 UTC */ + /* Compile command /opt/gnucobol/gnucobol-3.2/bin/cobc -Cx -freserved=EXAMINE -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* LINKAGE SECTION (Items not referenced by USING clause) */ + static unsigned char *b_9 = NULL; /* XML-NAMESPACE */ + static unsigned char *b_10 = NULL; /* XML-NAMESPACE-PREFIX */ + static unsigned char *b_11 = NULL; /* XML-NNAMESPACE */ + static unsigned char *b_12 = NULL; /* XML-NNAMESPACE-PREFIX */ + static unsigned char *b_13 = NULL; /* XML-NTEXT */ + static unsigned char *b_14 = NULL; /* XML-TEXT */ + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_17[8] __attribute__((aligned)); /* X */ + static cob_u8_t b_18[7] __attribute__((aligned)); /* N */ + static cob_u8_t b_19[10] __attribute__((aligned)); /* T */ + + /* End of local data storage */ + + + /* Fields (local) */ + static cob_field f_17 = {8, b_17, &a_1}; /* X */ + static cob_field f_18 = {7, b_18, &a_4}; /* N */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -10) + goto P_dump; + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 9 : Entry prog : prog.cob */ + l_2:; + + /* Line: 9 : EXAMINE : prog.cob */ + memset (/* TALLY */b_4, 0, (int)f_4.size); + cob_inspect_init (&f_17, 0); + cob_inspect_start (); + cob_inspect_all (&f_4, (cob_field *)&c_1); + cob_inspect_finish (); + + /* Line: 10 : IF : prog.cob */ + if (((int)cob_cmpswp_u32 (b_4, 4LL) != 0)) + { + + /* Line: 11 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_2, &f_4); + } + + /* Line: 12 : EXAMINE : prog.cob */ + memset (/* TALLY */b_4, 0, (int)f_4.size); + cob_inspect_init (&f_17, 0); + cob_inspect_start (); + cob_inspect_leading (&f_4, (cob_field *)&c_1); + cob_inspect_finish (); + + /* Line: 13 : IF : prog.cob */ + if (((int)cob_cmpswp_u32 (b_4, 2LL) != 0)) + { + + /* Line: 14 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_3, &f_4); + } + + /* Line: 15 : EXAMINE : prog.cob */ + memset (/* TALLY */b_4, 0, (int)f_4.size); + cob_inspect_init (&f_17, 0); + cob_inspect_start (); + cob_inspect_before ((cob_field *)&c_4); + cob_inspect_characters (&f_4); + cob_inspect_finish (); + + /* Line: 16 : IF : prog.cob */ + if (((int)cob_cmpswp_u32 (b_4, 5LL) != 0)) + { + + /* Line: 17 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_5, &f_4); + } + + /* Line: 18 : EXAMINE : prog.cob */ + memset (/* TALLY */b_4, 0, (int)f_4.size); + cob_inspect_init (&f_17, 0); + cob_inspect_start (); + cob_inspect_all (&f_4, (cob_field *)&c_1); + cob_inspect_finish (); + cob_inspect_init (&f_17, 1); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_6, (cob_field *)&c_1); + cob_inspect_finish (); + + /* Line: 19 : IF : prog.cob */ + if (((int)cob_cmpswp_u32 (b_4, 4LL) != 0)) + { + + /* Line: 20 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_2, &f_4); + } + + /* Line: 21 : IF : prog.cob */ + if (((int)memcmp (b_17, (cob_u8_ptr)"ZZBZBCZB", 8) != 0)) + { + + /* Line: 22 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_7, &f_17); + } + + /* Line: 23 : EXAMINE : prog.cob */ + memset (/* TALLY */b_4, 0, (int)f_4.size); + cob_inspect_init (&f_17, 0); + cob_inspect_start (); + cob_inspect_leading (&f_4, (cob_field *)&c_6); + cob_inspect_finish (); + cob_inspect_init (&f_17, 1); + cob_inspect_start (); + cob_inspect_leading ((cob_field *)&c_1, (cob_field *)&c_6); + cob_inspect_finish (); + + /* Line: 24 : IF : prog.cob */ + if (((int)cob_cmpswp_u32 (b_4, 2LL) != 0)) + { + + /* Line: 25 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_3, &f_4); + } + + /* Line: 26 : IF : prog.cob */ + if (((int)memcmp (b_17, (cob_u8_ptr)"AABZBCZB", 8) != 0)) + { + + /* Line: 27 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_8, &f_17); + } + + /* Line: 28 : EXAMINE : prog.cob */ + memset (/* TALLY */b_4, 0, (int)f_4.size); + cob_inspect_init (&f_17, 0); + cob_inspect_start (); + cob_inspect_before ((cob_field *)&c_4); + cob_inspect_characters (&f_4); + cob_inspect_finish (); + cob_inspect_init (&f_17, 1); + cob_inspect_start (); + cob_inspect_before ((cob_field *)&c_4); + cob_inspect_characters ((cob_field *)&c_9); + cob_inspect_finish (); + + /* Line: 29 : IF : prog.cob */ + if (((int)cob_cmpswp_u32 (b_4, 5LL) != 0)) + { + + /* Line: 30 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_5, &f_4); + } + + /* Line: 31 : IF : prog.cob */ + if (((int)memcmp (b_17, (cob_u8_ptr)"XXXXXCZB", 8) != 0)) + { + + /* Line: 32 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_10, &f_17); + } + + /* Line: 33 : EXAMINE : prog.cob */ + memset (/* TALLY */b_4, 0, (int)f_4.size); + cob_inspect_init (&f_17, 0); + cob_inspect_start (); + cob_inspect_before ((cob_field *)&c_11); + cob_inspect_characters (&f_4); + cob_inspect_finish (); + cob_inspect_init (&f_17, 1); + cob_inspect_start (); + cob_inspect_before ((cob_field *)&c_11); + cob_inspect_characters ((cob_field *)&c_11); + cob_inspect_finish (); + + /* Line: 34 : IF : prog.cob */ + if (((int)cob_cmpswp_u32 (b_4, 8LL) != 0)) + { + + /* Line: 35 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_12, &f_4); + } + + /* Line: 36 : IF : prog.cob */ + if (((int)memcmp (b_17, (cob_u8_ptr)"YYYYYYYY", 8) != 0)) + { + + /* Line: 37 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_13, &f_17); + } + + /* Line: 38 : EXAMINE : prog.cob */ + memset (/* TALLY */b_4, 0, (int)f_4.size); + cob_inspect_init (&f_18, 0); + cob_inspect_start (); + cob_inspect_before ((cob_field *)&c_14); + cob_inspect_characters (&f_4); + cob_inspect_finish (); + cob_inspect_init (&f_18, 1); + cob_inspect_start (); + cob_inspect_before ((cob_field *)&c_14); + cob_inspect_characters ((cob_field *)&c_15); + cob_inspect_finish (); + + /* Line: 39 : IF : prog.cob */ + if (((int)cob_cmp (&f_18, (cob_field *)&c_16) != 0)) + { + + /* Line: 40 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_17, &f_18); + } + + /* Line: 45 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + P_cgerror: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + prog_module_init (module); + + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->xml_code = NULL; + module->xml_event = NULL; + module->xml_information = NULL; + module->xml_namespace = NULL; + module->xml_namespace_prefix = NULL; + module->xml_nnamespace = NULL; + module->xml_nnamespace_prefix = NULL; + module->xml_ntext = NULL; + module->xml_text = NULL; + module->json_code = NULL; + module->json_status = NULL; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + /* initialize field RETURN-CODE */ + b_2 = 0; + + /* initialize field TALLY */ + memset (b_4, 0, 4); + + /* initialize field X */ + memcpy (b_17, "AABABCAB", 8); + + /* initialize field N */ + memcpy (b_18, "111225u", 7); + + /* initialize field T */ + memcpy (b_19, " 8 ", 10); + + + if (0 == 1) goto P_cgerror; + initialized = 1; + goto P_ret_initialize; + + P_dump: + return 0; + + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) + return 0; + if (module && module->module_active) + cob_fatal_error (COB_FERROR_CANCEL); + + initialized = 0; + + P_clear_decimal: + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* Initialize module structure for prog */ +static void prog_module_init (cob_module *module) +{ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->gc_version = COB_PACKAGE_VERSION; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + module->flag_debug_trace = 0; + module->flag_dump_ready = 0; + module->xml_mode = 1; + module->module_stmt = 0; + module->module_sources = NULL; +} + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE -freserved=EXAMINE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP + +AT_SETUP([EXAMINE REPLACING]) +AT_KEYWORDS([runmisc]) + +AT_DATA([prog.c], [[ +/* Generated by cobc 3.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:57:18 */ +/* GnuCOBOL build date Apr 17 2024 11:34:39 */ +/* GnuCOBOL package date Jul 28 2023 17:02:56 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.2/bin/cobc -Cx -freserved=EXAMINE -fno-computed-goto prog.cob */ + +#include /* for memcpy, memcmp and friends */ +#define COB_KEYWORD_INLINE __inline +#include + +#define COB_SOURCE_FILE "prog.cob" +#define COB_PACKAGE_VERSION "3.2" +#define COB_PATCH_LEVEL 0 +#define COB_MODULE_FORMATTED_DATE "avril 23 2024 11:57:18" +#define COB_MODULE_DATE 20240423 +#define COB_MODULE_TIME 115718 + +/* Global variables */ +/* Generated by cobc 3.2.0 */ +/* Generated from prog.cob */ +/* Generated at avril 23 2024 11:57:18 */ +/* GnuCOBOL build date Apr 17 2024 11:34:39 */ +/* GnuCOBOL package date Jul 28 2023 17:02:56 UTC */ +/* Compile command /opt/gnucobol/gnucobol-3.2/bin/cobc -Cx -freserved=EXAMINE -fno-computed-goto prog.cob */ + + +/* Module path */ +static const char *cob_module_path = NULL; + +/* Number of call parameters */ +static int cob_call_params = 0; + +/* Attributes */ + +static const cob_field_attr a_1 = {0x21, 0, 0, 0x0000, NULL}; +static const cob_field_attr a_2 = {0x21, 0, 0, 0x1000, NULL}; +static const cob_field_attr a_3 = {0x10, 5, 0, 0x0001, NULL}; +static const cob_field_attr a_4 = {0x10, 1, 0, 0x1000, NULL}; + + +/* Constants */ +static const cob_field c_1 = {1, (cob_u8_ptr)"X", &a_2}; +static const cob_field c_2 = {1, (cob_u8_ptr)"A", &a_2}; +static const cob_field c_3 = {26, (cob_u8_ptr)"Should be XXBXBCXB but is ", &a_2}; +static const cob_field c_4 = {1, (cob_u8_ptr)"Y", &a_2}; +static const cob_field c_5 = {26, (cob_u8_ptr)"Should be YYBXBCXB but is ", &a_2}; +static const cob_field c_6 = {1, (cob_u8_ptr)"C", &a_2}; +static const cob_field c_7 = {1, (cob_u8_ptr)"B", &a_2}; +static const cob_field c_8 = {26, (cob_u8_ptr)"Should be YYCXBCXB but is ", &a_2}; +static const cob_field c_9 = {1, (cob_u8_ptr)"Z", &a_2}; +static const cob_field c_10 = {26, (cob_u8_ptr)"Should be ZZZZBCXB but is ", &a_2}; +static const cob_field c_11 = {1, (cob_u8_ptr)"3", &a_4}; +static const cob_field c_12 = {1, (cob_u8_ptr)"1", &a_4}; +static const cob_field c_13 = {24, (cob_u8_ptr)"Should be -33322 but is ", &a_2}; + + + +/* Function prototypes */ + +static int prog (); +static int prog_ (const int); +static void prog_module_init (cob_module *module); + +/* Main function */ +int +main (int argc, char **argv) +{ + cob_init (argc, argv); + cob_stop_run (prog ()); +} + +/* Functions */ + +static void gc_module_so_init () __attribute__ ((constructor)); +static void gc_module_so_init () +{ + cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL); +} + +/* PROGRAM-ID 'prog' */ + +/* ENTRY 'prog' */ + +static int +prog () +{ + return prog_ (0); +} + +static int +prog_ (const int entry) +{ + /* Program local variables */ + /* Generated by cobc 3.2.0 */ + /* Generated from prog.cob */ + /* Generated at avril 23 2024 11:57:18 */ + /* GnuCOBOL build date Apr 17 2024 11:34:39 */ + /* GnuCOBOL package date Jul 28 2023 17:02:56 UTC */ + /* Compile command /opt/gnucobol/gnucobol-3.2/bin/cobc -Cx -freserved=EXAMINE -fno-computed-goto prog.cob */ + + /* Program local variables for 'prog' */ + + /* Module initialization indicator */ + static unsigned int initialized = 0; + + /* Module structure pointer */ + static cob_module *module = NULL; + + /* Global variable pointer */ + cob_global *cob_glob_ptr; + + + /* LINKAGE SECTION (Items not referenced by USING clause) */ + static unsigned char *b_9 = NULL; /* XML-NAMESPACE */ + static unsigned char *b_10 = NULL; /* XML-NAMESPACE-PREFIX */ + static unsigned char *b_11 = NULL; /* XML-NNAMESPACE */ + static unsigned char *b_12 = NULL; /* XML-NNAMESPACE-PREFIX */ + static unsigned char *b_13 = NULL; /* XML-NTEXT */ + static unsigned char *b_14 = NULL; /* XML-TEXT */ + + + /* Call parameters */ + cob_field *cob_procedure_params[1]; + + /* Perform frame stack */ + struct cob_frame *frame_ptr; + struct cob_frame frame_stack[255]; + + + /* Data storage */ + static int b_2; /* RETURN-CODE */ + static cob_u8_t b_17[8] __attribute__((aligned)); /* X */ + static cob_u8_t b_18[1] __attribute__((aligned)); /* Y */ + static cob_u8_t b_19[5] __attribute__((aligned)); /* N */ + + /* End of local data storage */ + + + /* Fields (local) */ + static cob_field f_17 = {8, b_17, &a_1}; /* X */ + static cob_field f_19 = {5, b_19, &a_3}; /* N */ + + /* End of fields */ + + + + /* Start of function code */ + + /* CANCEL callback */ + if (unlikely(entry < 0)) { + if (entry == -10) + goto P_dump; + if (entry == -20) + goto P_clear_decimal; + goto P_cancel; + } + + /* Check initialized, check module allocated, */ + /* set global pointer, */ + /* push module stack, save call parameter count */ + if (cob_module_global_enter (&module, &cob_glob_ptr, 0, entry, 0)) + return -1; + + /* Set address of module parameter list */ + module->cob_procedure_params = cob_procedure_params; + + /* Set frame stack pointer */ + frame_ptr = frame_stack; + frame_ptr->perform_through = 0; + + /* Initialize rest of program */ + if (unlikely(initialized == 0)) { + goto P_initialize; + } + P_ret_initialize: + + /* Increment module active */ + module->module_active++; + + /* Entry dispatch */ + goto l_2; + + /* PROCEDURE DIVISION */ + + /* Line: 9 : Entry prog : prog.cob */ + l_2:; + + /* Line: 9 : EXAMINE : prog.cob */ + cob_inspect_init (&f_17, 1); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_1, (cob_field *)&c_2); + cob_inspect_finish (); + + /* Line: 10 : IF : prog.cob */ + if (((int)memcmp (b_17, (cob_u8_ptr)"XXBXBCXB", 8) != 0)) + { + + /* Line: 11 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_3, &f_17); + } + + /* Line: 12 : EXAMINE : prog.cob */ + cob_inspect_init (&f_17, 1); + cob_inspect_start (); + cob_inspect_leading ((cob_field *)&c_4, (cob_field *)&c_1); + cob_inspect_finish (); + + /* Line: 13 : IF : prog.cob */ + if (((int)memcmp (b_17, (cob_u8_ptr)"YYBXBCXB", 8) != 0)) + { + + /* Line: 14 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_5, &f_17); + } + + /* Line: 15 : EXAMINE : prog.cob */ + cob_inspect_init (&f_17, 1); + cob_inspect_start (); + cob_inspect_first ((cob_field *)&c_6, (cob_field *)&c_7); + cob_inspect_finish (); + + /* Line: 16 : IF : prog.cob */ + if (((int)memcmp (b_17, (cob_u8_ptr)"YYCXBCXB", 8) != 0)) + { + + /* Line: 17 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_8, &f_17); + } + + /* Line: 18 : EXAMINE : prog.cob */ + cob_inspect_init (&f_17, 1); + cob_inspect_start (); + cob_inspect_before ((cob_field *)&c_7); + cob_inspect_characters ((cob_field *)&c_9); + cob_inspect_finish (); + + /* Line: 19 : IF : prog.cob */ + if (((int)memcmp (b_17, (cob_u8_ptr)"ZZZZBCXB", 8) != 0)) + { + + /* Line: 20 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_10, &f_17); + } + + /* Line: 21 : EXAMINE : prog.cob */ + cob_inspect_init (&f_19, 1); + cob_inspect_start (); + cob_inspect_all ((cob_field *)&c_11, (cob_field *)&c_12); + cob_inspect_finish (); + + /* Line: 22 : IF : prog.cob */ + if (((int)cob_cmp_numdisp (b_19, 5, -33322LL, 1) != 0)) + { + + /* Line: 23 : DISPLAY : prog.cob */ + cob_display (0, 1, 2, &c_13, &f_19); + } + + /* Line: 24 : STOP RUN : prog.cob */ + cob_stop_run (b_2); + + /* Program exit */ + + /* Decrement module active count */ + if (module->module_active) { + module->module_active--; + } + + /* Pop module stack */ + cob_module_leave (module); + + /* Program return */ + return b_2; + + /* Frame stack jump table */ + P_switch: + P_cgerror: + cob_fatal_error (COB_FERROR_CODEGEN); + + + /* Program initialization */ + P_initialize: + + cob_module_path = cob_glob_ptr->cob_main_argv0; + + prog_module_init (module); + + module->collating_sequence = NULL; + module->crt_status = NULL; + module->cursor_pos = NULL; + module->xml_code = NULL; + module->xml_event = NULL; + module->xml_information = NULL; + module->xml_namespace = NULL; + module->xml_namespace_prefix = NULL; + module->xml_nnamespace = NULL; + module->xml_nnamespace_prefix = NULL; + module->xml_ntext = NULL; + module->xml_text = NULL; + module->json_code = NULL; + module->json_status = NULL; + + /* Initialize cancel callback */ + cob_set_cancel (module); + + /* Initialize WORKING-STORAGE */ + /* initialize field RETURN-CODE */ + b_2 = 0; + + /* initialize field X */ + memcpy (b_17, "AABABCAB", 8); + + /* initialize field Y */ + *(cob_u8_ptr)(b_18) = (unsigned char)'Y'; + + /* initialize field N */ + memcpy (b_19, "1112r", 5); + + + if (0 == 1) goto P_cgerror; + initialized = 1; + goto P_ret_initialize; + + P_dump: + return 0; + + + /* CANCEL callback handling */ + P_cancel: + + if (!initialized) + return 0; + if (module && module->module_active) + cob_fatal_error (COB_FERROR_CANCEL); + + initialized = 0; + + P_clear_decimal: + return 0; + +} + +/* End PROGRAM-ID 'prog' */ + +/* Initialize module structure for prog */ +static void prog_module_init (cob_module *module) +{ + module->module_name = "prog"; + module->module_formatted_date = COB_MODULE_FORMATTED_DATE; + module->module_source = COB_SOURCE_FILE; + module->gc_version = COB_PACKAGE_VERSION; + module->module_entry.funcptr = (void *(*)())prog; + module->module_cancel.funcptr = (void *(*)())prog_; + module->module_ref_count = NULL; + module->module_path = &cob_module_path; + module->module_active = 0; + module->module_date = COB_MODULE_DATE; + module->module_time = COB_MODULE_TIME; + module->module_type = 0; + module->module_param_cnt = 0; + module->ebcdic_sign = 0; + module->decimal_point = '.'; + module->currency_symbol = '$'; + module->numeric_separator = ','; + module->flag_filename_mapping = 1; + module->flag_binary_truncate = 1; + module->flag_pretty_display = 1; + module->flag_host_sign = 0; + module->flag_no_phys_canc = 1; + module->flag_main = 1; + module->flag_fold_call = 0; + module->flag_exit_program = 0; + module->flag_debug_trace = 0; + module->flag_dump_ready = 0; + module->xml_mode = 1; + module->module_stmt = 0; + module->module_sources = NULL; +} + +/* End functions */ + + +]]) + +AT_CHECK([$COMPILE -freserved=EXAMINE prog.c], [0], [], []) +AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) + +AT_CLEANUP