diff --git a/gcc/cobol/Make-lang.in b/gcc/cobol/Make-lang.in index e5de584412607198a0156a0a5ebbc07d8a5cfc8a..310f968d9b2d404d899345b72333671483e873bc 100644 --- a/gcc/cobol/Make-lang.in +++ b/gcc/cobol/Make-lang.in @@ -49,12 +49,15 @@ BINCLUDE ?= ./gcc LIB_INCLUDE ?= $(srcdir)/../libgcobol LIB_SOURCE ?= $(srcdir)/../libgcobol +EXTRA_DIST = parse.h parse.c cdf.h cdf.c \ + gcobol.html gcobol-io.html \ + gcobol.pdf gcobol-io.pdf + # # At this point, as of 2022-10-21, CPPFLAGS is an empty string and can be # altered. CFLAGS and CXXFLAGS are being established upstream, and thus # cannot, at this point, be changed. # - CPPFLAGS = \ -std=c++17 \ $(MAX_ERRORS) \ @@ -76,8 +79,7 @@ LFLAGS = -d -Ca # # These are the object files for creating the cobol1.exe compiler: # - -cobol_one_OBJS = \ +cobol1_OBJS = \ cobol/cdf.o \ cobol/cdf-copy.o \ cobol/cobol1.o \ @@ -124,22 +126,19 @@ GCOBOL_D_OBJS = $(GCC_OBJS) cobol/gcobolspec.o # Makefile.in code that looks like this: # ALL_HOST_FRONTEND_OBJS = $(foreach v,$(CONFIG_LANGUAGES),$($(v)_OBJS)) # - cobol_OBJS = \ - $(cobol_one_OBJS) \ + $(cobol1_OBJS) \ cobol/gcobolspec.o \ $(END) # # Frankly, I can't figure out what this does: # - CFLAGS-cobol/gcobolspec.o += $(DRIVER_DEFINES) # # This controls the build of the gcobol.exe "driver" # - gcobol$(exeext): \ $(GCOBOL_D_OBJS) \ $(EXTRA_GCC_OBJS) \ @@ -164,7 +163,7 @@ gcobol$(exeext): \ # postprocessed: the files are one per line, used "realpath # --relative-to=$PWD" to rationalize them, and sorted. We include # parse.c in the list for scan.o because that's the one make(1) knows about. - +# cobol/parse.c: cobol/parse.y $(BISON) -o $@ $(YFLAGS) \ --defines=cobol/parse.h \ @@ -252,9 +251,9 @@ cobol/scan.o: cobol/scan.c \ # And the cobol1.exe front end -cobol1$(exeext): $(cobol_one_OBJS) $(BACKEND) $(LIBDEPS) attribs.o +cobol1$(exeext): $(cobol1_OBJS) $(BACKEND) $(LIBDEPS) attribs.o +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) attribs.o -o $@ \ - $(cobol_one_OBJS) $(BACKEND) $(LIBS) $(BACKENDLIBS) + $(cobol1_OBJS) $(BACKEND) $(LIBS) $(BACKENDLIBS) # FIXME cobol.all.cross: @@ -264,13 +263,11 @@ cobol.start.encap: gcobol$(exeext) cobol.rest.encap: cobol.install-common: installdirs - $(INSTALL_PROGRAM) gcobol$(exeext) cobol1$(exeext) \ - $(DESTDIR)$(bindir)/ - $(INSTALL) -m 755 $(srcdir)/cobol/gcobc \ - $(DESTDIR)$(bindir)/ + $(INSTALL_PROGRAM) gcobol$(exeext) $(DESTDIR)$(bindir)/ + $(INSTALL_PROGRAM) cobol1$(exeext) $(DESTDIR)$(libexecsubdir)/ + $(INSTALL) -m 755 $(srcdir)/cobol/gcobc $(DESTDIR)$(bindir)/ mkdir -p $(DESTDIR)$(datadir)/gcobol/udf - $(INSTALL_DATA) $(srcdir)/cobol/udf/* \ - $(DESTDIR)$(datadir)/gcobol/udf/ + $(INSTALL_DATA) $(srcdir)/cobol/udf/* $(DESTDIR)$(datadir)/gcobol/udf/ cobol.install-man: installdirs $(INSTALL_DATA) $(srcdir)/cobol/gcobol.1 $(DESTDIR)$(man1dir)/ @@ -278,36 +275,56 @@ cobol.install-man: installdirs cobol.install-info: -cobol.install-pdf: +cobol.install-pdf: installdirs gcobol.pdf gcobol-io.pdf + mkdir -p $(DESTDIR)$(datadir)/gcobol/pdf + $(INSTALL_DATA) gcobol.pdf gcobol-io.pdf $(DESTDIR)$(datadir)/gcobol/pdf/ cobol.install-plugin: -cobol.install-html: +cobol.install-html: installdirs gcobol.html gcobol-io.html + mkdir -p $(DESTDIR)$(datadir)/gcobol/html + $(INSTALL_DATA) gcobol.html gcobol-io.html $(DESTDIR)$(datadir)/gcobol/html/ cobol.info: cobol.dvi: -cobol.pdf: +cobol.pdf: gcobol.pdf gcobol-io.pdf + +gcobol.pdf: gcobol.1 + groff -mdoc -T pdf $^ > $@~ + @mv $@~ $@ +gcobol-io.pdf: gcobol.3 + groff -mdoc -T pdf $^ > $@~ + @mv $@~ $@ -cobol.html: +cobol.html: gcobol.html gcobol-io.html +gcobol.html: $(srcdir)/cobol/gcobol.1 + mandoc $^ -T html > $@ + @mv $@~ $@ +gcobol-io.html: $(srcdir)/cobol/gcobol.3 + mandoc $^ -T html > $@ + @mv $@~ $@ + +# "make uninstall" is not expected to work. It's not clear how to name +# the installed location of the cobol1 compiler. cobol.uninstall: rm -rf $(DESTDIR)$(bindir)/$(gcobol_INSTALL_NAME)$(exeext) \ - $(DESTDIR)$(bindir)/$(cobol1_INSTALL_NAME)$(exeext) \ $(DESTDIR)$(bindir)/gcobc \ - $(DESTDIR)$(datadir)/gcobol/udf/ \ + $(DESTDIR)$(datadir)/gcobol/ \ $(DESTDIR)$(man1dir)/gcobol.1 \ $(DESTDIR)$(man3dir)/gcobol.3 + cobol.man: cobol.mostlyclean: -cobol.clean: - rm -fr cobol1 cobol/* \ - ../*/libgcobol/* \ - $(srcdir)/cobol/charmaps-dupe.cc \ - $(srcdir)/cobol/valconv-dupe.cc \ +cobol.clean: \ + rm -fr gcobol cobol1 cobol/* \ + ../*/libgcobol/* \ + $(srcdir)/cobol/charmaps-dupe.cc \ + $(srcdir)/cobol/valconv-dupe.cc cobol.distclean: diff --git a/gcc/cobol/gcobol.1 b/gcc/cobol/gcobol.1 index 583d24935d714e193b20c6848136a437966b601e..169f0a478c6d1e810e7ef8aa25766445786b8d1b 100644 --- a/gcc/cobol/gcobol.1 +++ b/gcc/cobol/gcobol.1 @@ -712,19 +712,20 @@ argument, the target is set to The system command line parameters can also be accessed through the LINKAGE SECTION in the program where execution starts. The data structure looks like this: - +.Bd -literal linkage section. 01 argc pic 999. 01 argv. 02 argv-table occurs 1 to 100 times depending on argc. 03 argv-element pointer. 01 argv-string pic x(100) . - +.Ed and the code to access the third parameter looks like this - +.Bd -literal procedure division using by value argc by reference argv. set address of argv-string to argv-element(3) display argv-string +.Ed . .Ss #line directive The parser accepts lines in the form @@ -1199,7 +1200,7 @@ VARIANCE WHEN_COMPILED .It YEAR_TO_YYYY -.Bl +.El . .Ss Binary floating point DISPLAY How the DISPLAY presents binary floating point numbers depends on the value. @@ -1292,7 +1293,7 @@ an arithmetic statement: DISPLAY "The result of MOVE COMP2 TO PICV999 is " PICV999 ADD COMP2 to ZERO GIVING PICV999 ROUNDED DISPLAY "The result of ADD COMP2 to ZERO GIVING PICV999 ROUNDED is " PICV999 - +.sp The result of MOVE 0001.001 TO COMP2 is 1.00099999999999989 The result of MOVE COMP2 TO PICV999 is 0001.000 The result of ADD COMP2 to ZERO GIVING PICV999 ROUNDED is 0001.001 @@ -1319,7 +1320,7 @@ For example: PROCEDURE DIVISION. DISPLAY "COMPARE " COMP1 " with " COMP2 IF COMP1 EQUAL COMP2 DISPLAY "Equal" ELSE DISPLAY "Not equal" END-IF - +.sp MOVE COMP1 to COMP2 DISPLAY "COMPARE " COMP1 " with " COMP2 IF COMP1 EQUAL COMP2 DISPLAY "Equal" ELSE DISPLAY "Not equal" END-IF @@ -1603,6 +1604,7 @@ features in December 2022. .It "Robert Dubner" (rdubner@cobolworx.com) is responsible for producing the GIMPLE tree, which is input to the GCC back-end. +.El . .Sh CAVEATS .Bl -bullet -compact diff --git a/gcc/cobol/gcobol.3 b/gcc/cobol/gcobol.3 index 6d3e20c50e5066543628c41bbc9505ef51973be8..a9bed854c820d8efb4fb51c795f115fe42c22cf2 100644 --- a/gcc/cobol/gcobol.3 +++ b/gcc/cobol/gcobol.3 @@ -15,12 +15,10 @@ .In gcobolio.h . .Ft gcobol_io_t Fn gcobol_fileops -.sp +.Bd -literal class gcobol_io_t { -.br public: static const char constexpr marquee[64]; -. typedef void (open_t)( cblc_file_t *file, char *filename, int mode_char, @@ -43,7 +41,6 @@ public: size_t length, bool is_random ); typedef void (delete_t)( cblc_file_t *file, bool is_random ); -. open_t *Open; close_t *Close; start_t *Start; @@ -51,10 +48,9 @@ public: write_t *Write; rewrite_t *Rewrite; delete_t *Delete; -. -\&... -.br +\0\0... }; +.Ed . .Sh DESCRIPTION .Nm