version 0.73.0

This commit is contained in:
2023-07-14 12:15:30 -03:00
parent 110d8a0419
commit 945dd1a809
1466 changed files with 374820 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
List is in alphabetic order.
Author:
David Essex <dessex@users.sourceforge.net>
Contributors:
Bernard Giroud
Ferran Pegueroles
Laura Tweedy
Keisuke Nishida
Rildo Pragana
+339
View File
@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program 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 2 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
+12
View File
@@ -0,0 +1,12 @@
The TinyCOBOL pre-processor will convert from fixed to free-form COBOL format,
and handle the COPY and REPLACE syntax.
Some of these files, are derived form what was originally part of the Cob2C
project. They were modified to create the TinyCOBOL pre-processor.
Copyright (C) 1999-2002 David Essex.
Copyright (C) 1998, 1999 Laura Tweedy.
The htcobolpp program is licensed under the GNU General Public License.
See COPYING for details.
+95
View File
@@ -0,0 +1,95 @@
# Generated automatically from Makefile.in by configure.
#
# Makefile.in for cobolpp, the COBOL pre-processor
#
SHELL=/bin/sh
prefix=/usr/local
exec_prefix=${prefix}
#INSTALL=/usr/bin/install -c
#INSTALL_DATA=${INSTALL} -m 644
INSTALL=install.exe
INSTALL_DATA=${INSTALL}
#YACC=yacc193
YACC=bison
LEX=flex
CCX=gcc
EXEEXT=.exe
RM= rm -f
MKDIR=mkdir -p
#INSTBIN=/usr/local/bin
#INSTRC=/usr/local/share/htcobol
INSTBIN=C:/TinyCOBOL
INSTRC=C:/TinyCOBOL
#
INCLUDES=-I/usr/local/include -I../lib -I../
CCXFLAGS=${INCLUDES} -g -Wall
CCXFLAGS1=${INCLUDES} -g
#LIBS=-L/usr/lib -lm
LIBS=-L/usr/local/lib -lgetopt -lm
LDFLAGS=
MAKEDEPEND=@MAKEDEPEND@
#
# Rules for compiling .c .l sources
#
.SUFFIX: .c .o .y .l
.c.o:
$(CCX) $(CCXFLAGS) -c $<
#
.y.c:
$(YACC) -dv -b parser -p pp_yy $<
#
.l.c:
$(LEX) -o$@ -Ppp_yy $<
#
SRCS = parser.tab.c scanner.c cobpp.c
OBJS = $(SRCS:.c=.o)
PROG = htcobolpp.exe
all: $(PROG)
devel: all
${PROG}: ${OBJS}
$(CCX) -o $@ ${OBJS} $(LDFLAGS) $(LIBS)
# strip $@
scanner.c: scanner.l
# $(LEX) -o$@ -Ppp_yy $<
parser.tab.c: parser.y scanner.c
$(YACC) -dv -b parser -p pp_yy $<
parser.tab.o: parser.tab.c
$(CCX) $(CCXFLAGS1) -c parser.tab.c
scanner.o: scanner.c
$(CCX) $(CCXFLAGS1) -c scanner.c
clean:
@$(RM) $(PROG) $(OBJS) scanner.c \
parser.output parser.tab.c parser.tab.h \
core
install: $(PROG)
$(MKDIR) $(INSTRC)
strip $(PROG)
${INSTALL} $(PROG) $(INSTRC)/$(PROG)
# ${INSTALL_DATA} $(PROG) $(INSTRC)/$(PROG)
+84
View File
@@ -0,0 +1,84 @@
#
# Makefile.in for cobolpp, the COBOL pre-processor
#
SHELL=/bin/sh
@SET_MAKE@
prefix=@prefix@
exec_prefix=@exec_prefix@
INSTALL=@INSTALL@
INSTALL_DATA=@INSTALL_DATA@
YACC=@YACC@
LEX=@LEX@
CCX=@CC@
EXEEXT=@exeext@
RM= rm -f
INSTBIN=@cobbin_default@
INSTRC=@cobdir_default@
#
INCLUDES=@INCLUDES@
CCXFLAGS=${INCLUDES} @CCXFLAGS@ -Wall
CCXFLAGS1=${INCLUDES} @CCXFLAGS@
LIBS=@LIBS@
LDFLAGS=@LDFLAGS@
MAKEDEPEND=@MAKEDEPEND@
#
# Rules for compiling .c .l sources
#
.SUFFIX: .c .o .y .l
.c.o:
$(CCX) $(CCXFLAGS) -c $<
#
.y.c:
$(YACC) -dv -b parser -p pp_yy $<
#
.l.c:
$(LEX) -o$@ -Ppp_yy $<
#
SRCS = parser.tab.c scanner.c cobpp.c
OBJS = $(SRCS:.c=.o)
PROG = htcobolpp@exeext@
all: $(PROG)
devel: all
${PROG}: ${OBJS}
$(CCX) -g -o $@ ${OBJS} $(LDFLAGS) $(LIBS)
# strip $@
scanner.c: scanner.l
# $(LEX) -o$@ -Ppp_yy $<
parser.tab.c: parser.y scanner.c
$(YACC) -dv -b parser -p pp_yy $<
parser.tab.o: parser.tab.c
$(CCX) $(CCXFLAGS1) -c parser.tab.c
scanner.o: scanner.c
$(CCX) $(CCXFLAGS1) -c scanner.c
clean:
@$(RM) $(PROG) $(OBJS) scanner.c \
parser.output parser.tab.c parser.tab.h \
core
install: $(PROG)
strip $(PROG)
${INSTALL} -m 755 $(PROG) $(INSTRC)/$(PROG)
# ${INSTALL_DATA} $(PROG) $(INSTRC)/$(PROG)
+95
View File
@@ -0,0 +1,95 @@
# Generated automatically from Makefile.in by configure.
#
# Makefile.in for cobolpp, the COBOL pre-processor
#
SHELL=/bin/sh
prefix=/usr/local
exec_prefix=${prefix}
#INSTALL=/usr/bin/install -c
#INSTALL_DATA=${INSTALL} -m 644
INSTALL=install.exe
INSTALL_DATA=${INSTALL}
#YACC=yacc193
YACC=bison
LEX=flex
CCX=gcc
EXEEXT=.exe
RM= rm -f
MKDIR=mkdir -p
#INSTBIN=/usr/local/bin
#INSTRC=/usr/local/share/htcobol
INSTBIN=@install_dir@
INSTRC=@install_dir@
#
INCLUDES=-I/usr/local/include -I../lib -I../
CCXFLAGS=${INCLUDES} -g -Wall
CCXFLAGS1=${INCLUDES} -g
#LIBS=-L/usr/lib -lm
LIBS=-L/usr/local/lib -lgetopt -lm
LDFLAGS=
MAKEDEPEND=@MAKEDEPEND@
#
# Rules for compiling .c .l sources
#
.SUFFIX: .c .o .y .l
.c.o:
$(CCX) $(CCXFLAGS) -c $<
#
.y.c:
$(YACC) -dv -b parser -p pp_yy $<
#
.l.c:
$(LEX) -o$@ -Ppp_yy $<
#
SRCS = parser.tab.c scanner.c cobpp.c
OBJS = $(SRCS:.c=.o)
PROG = htcobolpp.exe
all: $(PROG)
devel: all
${PROG}: ${OBJS}
$(CCX) -o $@ ${OBJS} $(LDFLAGS) $(LIBS)
# strip $@
scanner.c: scanner.l
# $(LEX) -o$@ -Ppp_yy $<
parser.tab.c: parser.y scanner.c
$(YACC) -dv -b parser -p pp_yy $<
parser.tab.o: parser.tab.c
$(CCX) $(CCXFLAGS1) -c parser.tab.c
scanner.o: scanner.c
$(CCX) $(CCXFLAGS1) -c scanner.c
clean:
@$(RM) $(PROG) $(OBJS) scanner.c \
parser.output parser.tab.c parser.tab.h \
core
install: $(PROG)
$(MKDIR) $(INSTRC)
strip $(PROG)
${INSTALL} $(PROG) $(INSTRC)/$(PROG)
# ${INSTALL_DATA} $(PROG) $(INSTRC)/$(PROG)
+107
View File
@@ -0,0 +1,107 @@
The TinyCOBOL pre-processor has been merged into the main compiler.
The pre-processor scanner and parser step will still be executed, but run
in the same process as the main compiler.
Consequently the source in the 'cobpp' directory sources are obsolete, and
will be removed at a later date.
See the 'compiler' directory for the new pre-processor sources.
-------------------------------------------------------------------------------
What the TinyCOBOL pre-processor does.
- convert from fixed to free-form COBOL format.
- Process the COPY command.
- Process the REPLACE command (not functional in current version).
Usage:
htcobolpp <options> <input_file> [-o <output_file>]
where <options> are:
-h Help (display this listing)
-V Display version and exit
-v Verbose mode
-d Turn on debugging mode
-t <num> Expand tabs to <num> space(s)
-o <output_file> Output file name (default: standard output)
-p <listing_file> Listing file name
-x <input_file> Input source is in X/Open free format
-f <input_file> Input source is in standard fixed column format
-I <copy_dir> Copybooks search directories
Note that the -t <num> command option will expand tabs found in main programs and copybooks.
If this option is not used, any tabs in programs and/or copybooks will cause an error.
The 'expand' program can be used to permanently remove these tabs as the following
example illustrates.
expand -t 8 program-name > new-program-name
-------------------------------------------------------------------------------
Copy statement usage.
COPY { Text-CopyName | Literal }
[ {IN|OFF} { Text-LibName | Literal } ]
[ REPLACING
( { Text | Literal | Pseudo-Text } BY { Text | Literal | Pseudo-Text } ) ...
]
Where:
[ ] = optional
{ | } = OR
... = repeat
Example:
COPY 'TEST02.cpy' IN TEST-LIB REPLACING
W01-COMPUTE-0 BY W01-COMPUTE-00
'W01-1XXX' BY 'W01-2'
==9(5)== BY ==9(04)== .
-------------------------------------------------------------------------------
Copybook search sequences.
The locations of copybooks can be given in the following ways.
- Using the -I path(s) command line directives.
- Using the library name.
- Using an relative or absolute path in the copybook name.
This results in an complex search sequence which is resolved as follows.
- If there is an absolute path in the copybook name (i.e. '/usr/share/tc/a.cpy'), then
command line and library name paths are ignored.
- If the library name is given then command line paths are ignored.
When the library name is given as a literal, the literal is used a the search paths.
When the library name is given as a text name, the name is used to lookup the
environment variable and if found the result is used a the search paths.
The paths are then concatenated with the copybook name and searched.
- If only the copybook name is given, then the include command line directives are
the search paths.
When the copybook name is given as a literal, the literal is used.
When the copybook name is given as a text name, suffixes are added to the name.
The default suffixes are ".cpy:.CPY:.cob:.COB:.cbl:.CBL::". The last entry indicates no suffix.
The paths are then concatenated with the copybook name and suffixes and then searched.
Notes on valid copybook and library names.
- Valid copybook names are a valid COBOL words (text) or literals.
Thus t1.cpy is not and 't1.cpy' is valid.
- Valid library names are a valid COBOL words (text) or literals.
Library name is given as a text and containing '-' are converted to '_' since
valid environment variables names can not contain the character '-'.
Examples:
- The following are equivalent.
COPY 't1.cpy' IN TEST-LIB.
COPY 't1.cpy'. - with the -I $TEST_LIB command line option.
- The text name suffix search sequence.
COPY TT1. - will search for TT1.cpy, TT1.CPY, TT1.cob, TT1.COB, TT1.cbl, TT1.CBL, TT1 files.
-------------------------------------------------------------------------------
Integration with the main compiler.
- The new pre-processor will be executed by default.
To ensure backward compatibility, the original PP has not been removed from
the main compiler.
Further integration will be done once the pre-processor is deemed to be stable.
- The main compiler does require that the full path of the pre-processor be known.
This is problematic as the test and install directories are different. To circumvent
this problem the -t command line option as been added so that the main compiler will
seek the PP in the cobpp directory.
+930
View File
@@ -0,0 +1,930 @@
/*
Copyright (C) 1999-2004 David Essex, Rildo Pragana
This program 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 2, or (at your option)
any later version.
This program 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 this software; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
TinyCOBOL Pre-Processor program used as a front end to the main compiler.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <getopt.h>
#include "cobpp.h"
#include "htconfig.h"
#include "tcppversion.h"
#include "tcpphelp.h"
#include "mwindows.h"
extern FILE *pp_yyin;
extern FILE *pp_yyout;
FILE *yylist;
extern int pp_yyparse(void);
extern char *filename;
char HTG_COPYDIR[PATHMAX3 + 2] = "";
char HTG_FNAME_SUFFIX[PATHMAX1] = "";
char fpath[PATHMAX3 + 2] = "";
char fsuffix[PATHMAX] = "";
char *prg_name;
/* #define DEBUG_COBPP_PP 1 */
#ifdef DEBUG_COBPP_PP
char errppbuf[1024*8];
void debug_pp_rtn (const char *s1, const char *s2, const char *s3, int w1, int cw);
#define DEBUG_PPRTN_STR1(msg1) debug_pp_rtn (msg1, NULL, NULL, 0, 1);
#define DEBUG_PPRTN_STR3(msg1, msg2) debug_pp_rtn (msg1, msg2, NULL, 0, 3);
#define DEBUG_PPRTN_STR7(msg1, i1) debug_pp_rtn (msg1, NULL, NULL, i1, 7);
#define DEBUG_PPRTN_STR15(msg1, msg2, msg3) debug_pp_rtn (msg1, msg2, msg3, 0, 15);
#define DEBUG_PPRTN_STR21(msg1, msg2, i1) debug_pp_rtn (msg1, msg2, NULL, i1, 21);
#define DEBUG_PPRTN_STR105(msg1, msg2, msg3, i1) debug_pp_rtn (msg1, msg2, msg3, i1, 105);
#else
#define DEBUG_PPRTN_STR1(msg1)
#define DEBUG_PPRTN_STR3(msg1, msg2)
#define DEBUG_PPRTN_STR7(msg1, i1)
#define DEBUG_PPRTN_STR15(msg1, msg2, msg3)
#define DEBUG_PPRTN_STR21(msg1, msg2, i1)
#define DEBUG_PPRTN_STR105(msg1, msg2, msg3, i1)
#endif
/* Global Env struct due to yywrap, yylex */
int main( int argc , char** argv ) {
int rc = 0;
prg_name = argv[0];
globalEnvPtr = &globalEnv;
setDefaults();
/* error, or help/version printed */
rc = setOptions(&globalEnv, argc, argv);
if (rc != 0) {
if ((rc > 0) && (rc < 100)) {
printHelp();
CleanUp();
}
return rc;
}
/* If everything is OK parse file */
filename = strdup (globalEnv.ifname);
pp_yyin = fopen(globalEnv.ifname, "r");
if ( pp_yyin == NULL ) {
fprintf(stderr, "Error opening input file: %s\n", globalEnv.ifname);
rc = 3;
return rc;
}
if (globalEnv.ofname != NULL) {
pp_yyout = fopen(globalEnv.ofname, "w");
if ( pp_yyout == NULL ) {
fprintf(stderr,
"Error opening output file: %s\n"
,globalEnv.ofname
);
fclose(pp_yyin);
rc = 9;
return rc;
}
}
else {
pp_yyout = stdout;
}
if (globalEnv.lfname != NULL) {
yylist = fopen(globalEnv.lfname, "w");
if ( yylist == NULL ) {
fprintf(stderr,
"Error opening listing file: %s\n"
,globalEnv.lfname
);
fclose(pp_yyin);
if ( pp_yyout != stdout ) {
fclose(pp_yyout);
}
rc = 11;
return rc;
}
}
setup_scanner_state();
/* pp_yylex(); */
/* rc = pp_yyparse(); */
(void) pp_yyparse();
rc = globalEnv.errFlag;
DEBUG_PPRTN_STR7("Program return code=%d\n", rc)
return rc;
}
/*
* Initalize the Env struct passed to this function
*/
void setDefaults(void) {
Env *gEnv = globalEnvPtr;
gEnv->codeFormat = -1; /* 1 is free , 0 is fixed */
gEnv->debugFlag = 0; /* debug flag */
gEnv->IncDebugLines = 0;
gEnv->verboseFlag = 0; /* set verbose flag off */
gEnv->errFlag = 0; /* no error state by default */
gEnv->tab2space = 0; /* expand tabs to 0 spaces */
gEnv->progName = NULL;
gEnv->ofname = NULL;
gEnv->ifname = NULL;
gEnv->lfname = NULL;
}
/*
* Function to clean up memory allocated in program.
*
*/
void CleanUp(void) {
Env *gEnv = globalEnvPtr;
globalEnvPtr = NULL;
if (gEnv->progName != NULL)
free(gEnv->progName);
if (gEnv->ifname != NULL)
free(gEnv->ifname);
if (gEnv->ofname != NULL)
free(gEnv->ofname);
if (gEnv->lfname != NULL)
free(gEnv->lfname);
}
/*
* Read in command line options and set up the Env struct passed in
* Alloc memory for program name string in Env struct.
*
*/
int setOptions(Env* gEnv, int argc, char** argv) {
/* Read in args for option settings. */
int r = 0, len, sw, i;
char tbuf[PATHMAX1] = "";
len = strlen(argv[0]);
gEnv->progName = malloc(len + 1);
if (gEnv->progName == NULL) {
gEnv->errFlag++;
r = 2;
return r;
}
strncpy(gEnv->progName, argv[0], len);
/*
* Check argc for number of args
*/
/* if (( argc < 2 ) || (argc > 5 )){ */
if ( argc < 2 ){
/* printHelp(); */
gEnv->errFlag++;
r = 1;
return r;
}
/* opterr = 0; */
while ((sw = getopt(argc, argv, option_list)) != EOF) {
switch (sw) {
/* Include debug lines from sources */
case TCOBPP_CMDOPT_INC_DEBUG:
gEnv->IncDebugLines = 1;
break;
/* Not currently used */
case TCOBPP_CMDOPT_DEBUG:
gEnv->debugFlag = 1;
break;
/* Set input file format to FIXED */
case TCOBPP_CMDOPT_FRM_FIXED:
if (gEnv->ifname != NULL) {
fprintf(stderr, "error: duplicate input file name '%s' ... aborting\n", optarg);
gEnv->errFlag++;
r = 20;
return r;
}
len = strlen(optarg);
/* fprintf(stderr, "cobpp debug: optarg=%s: len=%d\n", optarg, len); */
gEnv->ifname = (char*)malloc(len + 2);
if (gEnv->ifname == NULL) {
gEnv->errFlag++;
r = 21;
return r;
}
strncpy(gEnv->ifname, optarg, len+1);
/* fprintf(stderr, "cobpp debug: input file name :%s:, len=%d\n", gEnv->ifname, len); */
gEnv->codeFormat = 0; /* 1 is free, 0 is fixed */
break;
/* Add path to copybooks search path */
case TCOBPP_CMDOPT_INC_PATH:
append_include_path(optarg);
break;
/* Set output file name */
case TCOBPP_CMDOPT_OUTFILE:
if (gEnv->ofname != NULL) {
fprintf(stderr, "error: duplicate output file name '%s' ... aborting\n", optarg);
gEnv->errFlag++;
r = 40;
return r;
}
len = strlen(optarg);
gEnv->ofname = (char*)malloc(len + 2);
if (gEnv->ofname == NULL) {
gEnv->errFlag++;
r = 41;
return r;
}
strncpy(gEnv->ofname, optarg, len+1);
/* fprintf(stderr, "cobpp debug: output file name '%s', len=%d\n", gEnv->ofname, len); */
break;
/* Set output listinf file name */
case TCOBPP_CMDOPT_LIST:
if (gEnv->lfname != NULL) {
fprintf(stderr, "error: duplicate listing file name '%s' ... aborting\n", optarg);
gEnv->errFlag++;
r = 50;
return r;
}
len = strlen(optarg);
gEnv->lfname = (char*)malloc(len + 2);
if (gEnv->lfname == NULL) {
gEnv->errFlag++;
r = 51;
return r;
}
strncpy(gEnv->lfname, optarg, len+1);
/* fprintf(stderr, "cobpp debug: print file name '%s', len=%d\n", gEnv->lfname, len); */
break;
/* Set tab to space conversion length */
case TCOBPP_CMDOPT_TAB_LEN:
if (gEnv->tab2space != 0) {
fprintf(stderr, "error: duplicate tabs2space argument '%s' specified ... aborting\n", optarg);
gEnv->errFlag++;
r = 60;
return r;
}
strcpy(tbuf, optarg);
/* len = strlen(optarg); */
len = strlen(tbuf);
for (i=0; i<len; i++) {
/* if (!isdigit(optarg[i])) { */
if (!isdigit(tbuf[i])) {
/* fprintf(stderr, "error: invalid tabs2space argument '%s' specified ... aborting\n", optarg); */
fprintf(stderr, "error: invalid tabs2space argument '%s' specified ... aborting\n", tbuf);
gEnv->errFlag++;
r = 61;
return r;
}
}
/* sscanf(optarg, "%d", &gEnv->tab2space); */
sscanf(tbuf, "%d", &gEnv->tab2space);
if ((gEnv->tab2space < 1) || (gEnv->tab2space > 99)) {
fprintf(stderr, "error: invalid tabs2space argument '%s' specified, max=99 min=1 ... aborting\n", optarg);
gEnv->errFlag++;
r = 62;
return r;
}
/*
fprintf(stderr, "cobpp debug: input tab string :%s:, gEnv->tab2space=%d\n", optarg, gEnv->tab2space);
fprintf(stderr, "cobpp debug: input tab string :%s:, gEnv->tab2space=%d\n", tbuf, gEnv->tab2space);
*/
break;
/* Set input file format to FREE */
case TCOBPP_CMDOPT_FRM_FREE:
if (gEnv->ifname != NULL) {
fprintf(stderr, "error: duplicate input file name '%s' ... aborting\n", optarg);
gEnv->errFlag++;
r = 70;
return r;
}
len = strlen(optarg);
/* fprintf(stderr, "cobpp debug: optarg=%s: len=%d\n", optarg, len); */
gEnv->ifname = (char*)malloc(len + 2);
/* gEnv->ifname = malloc(len + 2); */
if (gEnv->ifname == NULL) {
gEnv->errFlag++;
r = 71;
return r;
}
strncpy(gEnv->ifname, optarg, len+1);
/* strcpy(gEnv->ifname, optarg); */
/* fprintf(stderr, "cobpp debug: input file name=%s:, len=%d\n", gEnv->ifname, len); */
gEnv->codeFormat = 1; /* 1 is free, 0 is fixed */
break;
/* Display version number */
case TCOBPP_CMDOPT_VERSION:
printVersion();
r = 197;
break;
/* Set verbose option on */
case TCOBPP_CMDOPT_VERBOSE:
gEnv->verboseFlag = 1;
break;
/* Display command line help */
case TCOBPP_CMDOPT_HELP1:
case TCOBPP_CMDOPT_HELP:
default:
r = 5;
/* printHelp(); */
break;
}
}
if (r == 0) {
if (gEnv->ifname == NULL) {
fprintf(stderr, "error: no input file name selected ... aborting\n");
gEnv->errFlag++;
r = 80;
}
}
/* If tabs not set default to 8 spaces */
if (gEnv->tab2space == 0)
gEnv->tab2space = 8;
return r;
}
/*
Print out extended help
*/
void printHelp(void){
/* fprintf (stdout, */
fprintf (stderr,
"Usage: %s %s%s",
globalEnvPtr->progName,
usage_list0,
usage_list1
);
}
/*
* Print pre-processor version and copyright
*/
void printVersion(void) {
fprintf(stdout, "%s - %s\n%s\n",
TCOBPP_TITLE,
TCOBPP_PGM_VERSION,
TCOBPP_COPYWR
);
}
int find_copybook_file (char *fname, char *lname)
{
int r = 1, len, sw = 0;
char *pt,
tpath[PATHMAX1],
fname1[PATHMAX],
lname1[PATHMAX1];
if (lname == NULL) {
if ((*fname == CHR_SQUOTE) || (*fname == CHR_DQUOTE)) {
sw = STATE_FLIT_LNONE;
strcpy(fname1, fname+1);
len = strlen(fname1);
fname1[len - 1] = CHR_EOS;
r = find_filename_literal(fname1, HTG_COPYDIR);
}
else {
sw = STATE_FNAME_LNONE;
strcpy(fname1, fname);
strcpy(HTG_FNAME_SUFFIX, STR_SEARCH_SUFFIXES);
r = find_filename_text(fname1, HTG_COPYDIR, HTG_FNAME_SUFFIX);
}
}
else {
if ((*lname == CHR_SQUOTE) || (*lname == CHR_DQUOTE)) {
strcpy(lname1, lname+1);
len = strlen(lname1);
lname1[len - 1] = CHR_EOS;
strcpy(tpath, lname1);
len = strlen(tpath);
if (len > 0) {
if (tpath[len - 1] != CHR_COLEN) {
strcat(tpath, STR_COLEN);
}
}
if ((*fname == CHR_SQUOTE) || (*fname == CHR_DQUOTE)) {
sw = STATE_FLIT_LLIT;
strcpy(fname1, fname+1);
len = strlen(fname1);
fname1[len - 1] = CHR_EOS;
r = find_filename_literal(fname1, tpath);
}
else {
sw = STATE_FNAME_LLIT;
strcpy(fname1, fname);
strcpy(HTG_FNAME_SUFFIX, STR_SEARCH_SUFFIXES);
r = find_filename_text(fname1, tpath, HTG_FNAME_SUFFIX);
}
}
else {
if ((*fname == CHR_SQUOTE) || (*fname == CHR_DQUOTE)) {
sw = STATE_FLIT_LNAME;
strcpy(fname1, fname+1);
len = strlen(fname1);
fname1[len - 1] = CHR_EOS;
strcpy(lname1, lname);
pt = find_env_variable(lname1);
if (pt != NULL) {
strcpy(tpath, pt);
}
else {
strcpy(tpath, "");
}
len = strlen(tpath);
if (len > 0) {
if (tpath[len - 1] != CHR_COLEN) {
strcat(tpath, STR_COLEN);
}
}
r = find_filename_literal(fname1, tpath);
}
else {
sw = STATE_FNAME_LNAME;
strcpy(fname1, fname);
strcpy(lname1, lname);
strcpy(HTG_FNAME_SUFFIX, STR_SEARCH_SUFFIXES);
pt = find_env_variable(lname1);
if (pt != NULL) {
strcpy(tpath, pt);
}
else {
strcpy(tpath, "");
}
len = strlen(tpath);
if (len > 0) {
if (tpath[len - 1] != CHR_COLEN) {
strcat(tpath, STR_COLEN);
}
}
r = find_filename_text(fname1, tpath, HTG_FNAME_SUFFIX);
}
}
}
return r;
}
int find_filename_literal (char *fname, char *fp)
{
int r = 1, len, sw1=0;
char *pt1;
struct stat sbuf;
strcpy(fpath, fp);
len = strlen(fpath);
if (len == 0) {
sprintf(include_full_filename, "%s", fname);
if (stat(include_full_filename, &sbuf) == 0) {
if (S_ISREG(sbuf.st_mode) &&
((S_IRUSR & sbuf.st_mode) || (S_IRGRP & sbuf.st_mode) || (S_IROTH & sbuf.st_mode))) {
r = 0;
if (globalEnvPtr->verboseFlag == 1) {
printf("found copybook name \'%s\'\n", include_full_filename);
}
}
else {
if (globalEnvPtr->verboseFlag == 1) {
printf("copybook file \'%s\' not readable\n", include_full_filename);
}
}
}
else {
if (globalEnvPtr->verboseFlag == 1) {
printf("copybook file \'%s\' not found\n", include_full_filename);
}
}
}
else {
// If filename is an absolute path ignore library path
if (*fname == CHR_SLASH) {
if (globalEnvPtr->verboseFlag == 1) {
printf("warning: ignoring other search path(s) in absolute path copybook name \'%s\'\n", fname);
}
sprintf(include_full_filename, "%s", fname);
if (stat(include_full_filename, &sbuf) == 0) {
if (S_ISREG(sbuf.st_mode) &&
((S_IRUSR & sbuf.st_mode) || (S_IRGRP & sbuf.st_mode) || (S_IROTH & sbuf.st_mode))) {
r = 0;
if (globalEnvPtr->verboseFlag == 1) {
printf("found copybook name \'%s\'\n", include_full_filename);
}
}
else {
if (globalEnvPtr->verboseFlag == 1) {
printf("copybook file \'%s\' not readable\n", include_full_filename);
}
}
}
else {
if (globalEnvPtr->verboseFlag == 1) {
printf("copybook file \'%s\' not found\n", include_full_filename);
}
}
}
else {
sw1 = 0;
strcpy(fpath, fp);
pt1 = find_token(fpath, STR_COLEN, 0);
if (pt1 == NULL) {
pt1 = fpath;
}
while (sw1 == 0) {
sprintf(include_full_filename, "%s", pt1);
if (stat(include_full_filename, &sbuf) == 0) {
if (S_ISDIR(sbuf.st_mode) &&
((S_IRUSR & sbuf.st_mode) || (S_IRGRP & sbuf.st_mode) || (S_IROTH & sbuf.st_mode))) {
if (globalEnvPtr->verboseFlag == 1) {
printf("searching directory path \'%s\'\n", include_full_filename);
}
sprintf(include_full_filename, "%s/%s", pt1, fname);
if (stat(include_full_filename, &sbuf) == 0) {
if (S_ISREG(sbuf.st_mode) &&
((S_IRUSR & sbuf.st_mode) || (S_IRGRP & sbuf.st_mode) || (S_IROTH & sbuf.st_mode))) {
r = 0;
if (globalEnvPtr->verboseFlag == 1) {
printf("found copybook name \'%s\'\n", include_full_filename);
}
sw1 = 1;
}
else {
if (globalEnvPtr->verboseFlag == 1) {
printf("copybook file \'%s\' not readable\n", include_full_filename);
}
}
}
else {
if (globalEnvPtr->verboseFlag == 1) {
printf("copybook file \'%s\' not found\n", include_full_filename);
}
}
}
else {
if (globalEnvPtr->verboseFlag == 1) {
printf("directory path \'%s\' not readable\n", include_full_filename);
}
}
}
else {
if (globalEnvPtr->verboseFlag == 1) {
printf("directory path \'%s\' not found\n", include_full_filename);
}
}
pt1 = find_token(pt1, STR_COLEN, 1);
if (pt1 == NULL) {
sw1 = 1;
}
}
}
}
return r;
}
int find_filename_text (char *fname, char *fp, char *fs)
{
int r = 1, len, sw1, sw2;
char *pt1, *pt2;
struct stat sbuf;
strcpy(fpath, fp);
strcpy(fsuffix, fs);
len = strlen(fpath);
if (len == 0) {
sw1 = 0;
pt1 = find_token(fsuffix, STR_COLEN, 0);
if (pt1 == NULL) {
pt1 = fsuffix;
}
while (sw1 == 0) {
sprintf(include_full_filename, "%s%s", fname, pt1);
if (stat(include_full_filename, &sbuf) == 0) {
if (S_ISREG(sbuf.st_mode) &&
((S_IRUSR & sbuf.st_mode) || (S_IRGRP & sbuf.st_mode) || (S_IROTH & sbuf.st_mode))) {
r = 0;
if (globalEnvPtr->verboseFlag == 1) {
printf("found copybook name \'%s\'\n", include_full_filename);
}
sw1 = 1;
}
else {
if (globalEnvPtr->verboseFlag == 1) {
printf("copybook file \'%s\' not readable\n", include_full_filename);
}
}
sw1 = 1;
}
else {
if (globalEnvPtr->verboseFlag == 1) {
printf("copybook file \'%s\' not found\n", include_full_filename);
}
}
pt1 = find_token(pt1, STR_COLEN, 1);
if (pt1 == NULL) {
sw1 = 1;
}
}
}
else {
sw1 = 0;
sw2 = 0;
strcpy(fpath, fp);
strcpy(fsuffix, fs);
pt1 = find_token(fpath, STR_COLEN, 0);
if (pt1 == NULL) {
pt1 = fpath;
}
while (sw1 == 0) {
sprintf(include_full_filename, "%s", pt1);
if (stat(include_full_filename, &sbuf) == 0) {
if (S_ISDIR(sbuf.st_mode) &&
((S_IRUSR & sbuf.st_mode) || (S_IRGRP & sbuf.st_mode) || (S_IROTH & sbuf.st_mode))) {
if (globalEnvPtr->verboseFlag == 1) {
printf("searching directory path \'%s\'\n", include_full_filename);
}
strcpy(fsuffix, fs);
sw2 = 0;
pt2 = find_token(fsuffix, STR_COLEN, 0);
while (sw2 == 0) {
sprintf(include_full_filename, "%s/%s%s", pt1, fname, pt2);
if (stat(include_full_filename, &sbuf) == 0) {
if (S_ISREG(sbuf.st_mode) &&
((S_IRUSR & sbuf.st_mode) || (S_IRGRP & sbuf.st_mode) || (S_IROTH & sbuf.st_mode))) {
r = 0;
if (globalEnvPtr->verboseFlag == 1) {
printf("found copybook name \'%s\'\n", include_full_filename);
}
sw1 = 1;
sw2 = 1;
}
else {
if (globalEnvPtr->verboseFlag == 1) {
printf("copybook file \'%s\' not readable\n", include_full_filename);
}
}
sw2 = 1;
}
else {
if (globalEnvPtr->verboseFlag == 1) {
printf("copybook file \'%s\' not found\n", include_full_filename);
}
}
pt2 = find_token(pt2, STR_COLEN, 1);
if (pt2 == NULL) {
sw2 = 1;
}
}
}
else {
if (globalEnvPtr->verboseFlag == 1) {
printf("directory path \'%s\' not readable\n", include_full_filename);
}
}
}
else {
if (globalEnvPtr->verboseFlag == 1) {
printf("directory path \'%s\' not found\n", include_full_filename);
}
}
pt1 = find_token(pt1, STR_COLEN, 1);
if (pt1 == NULL) {
sw1 = 1;
}
}
}
return r;
}
char *find_env_variable (char *ev)
{
char *pt, ev1[PATHMAX];
int i, len;
len = strlen(ev);
for (i=0; i<len; i++) {
if (*(ev+i) == STR_DASH) {
*(ev1+i) = STR_UNDERSCORE;
}
else {
*(ev1+i) = *(ev+i);
}
}
*(ev1+len) = CHR_EOS;
pt = getenv(ev1);
if (pt != NULL) {
if (globalEnvPtr->verboseFlag == 1) {
printf("envoromental variable \'%s\' found, setting search path(s) to \'%s\'\n", ev1, pt);
}
return pt;
}
if (globalEnvPtr->verboseFlag == 1) {
printf("warning: envoromental variable \'%s\' not found\n", ev1);
}
return NULL;
}
char *find_token(char *p, const char *d, int sw)
{
int i, len;
DEBUG_PPRTN_STR105("find_token trace(1): p=%s; d=%s, sw=%d\n", p, d, sw)
if (sw == 0) {
len = strlen(p);
*(p+len+1) = CHR_EOS;
for (i=0; i<len; i++) {
if (*(p+i) == *d) {
*(p+i) = CHR_EOS;
DEBUG_PPRTN_STR105("find_token trace(2): p=%s; d=%s, sw=%d\n", p, d, sw)
return p;
}
}
DEBUG_PPRTN_STR21("find_token trace(3): p=NULL; d=%s, sw=%d\n", d, sw)
return NULL;
}
else {
len = strlen(p);
p = p + len + 1;
if (*p != CHR_EOS) {
len = strlen(p);
for (i=0; i<len; i++) {
if (*(p+i) == *d) {
*(p+i) = CHR_EOS;
DEBUG_PPRTN_STR105("find_token trace(4): p=%s; d=%s, sw=%d\n", p, d, sw)
return p;
}
}
}
DEBUG_PPRTN_STR21("find_token trace(5): p=NULL; d=%s, sw=%d\n", d, sw)
return NULL;
}
}
void append_include_path(char *ap)
{
int len1, len2, len3, rc=0;
len1 = strlen(HTG_COPYDIR);
len2 = strlen(ap);
len3 = len1 + len2;
if (len1 == 0) {
if (len2 < (PATHMAX3 + 1)) {
strcpy (HTG_COPYDIR, ap);
strcat (HTG_COPYDIR, STR_COLEN);
}
else {
rc = 16;
}
}
else {
if (len3 < PATHMAX3) {
strcat (HTG_COPYDIR, ap);
strcat (HTG_COPYDIR, STR_COLEN);
}
else {
rc = 16;
}
}
if (globalEnvPtr->verboseFlag == 1) {
fprintf (stdout, "Appending '%s' to include (copybooks) search path\n", ap);
}
if (rc != 0) {
fprintf (stderr, "%s: *** Buffer overflow error while appending '%s' to include (copybooks) search path. Abort.\n", prg_name, ap);
exit(rc);
}
}
#ifdef DEBUG_COBPP_PP
void debug_pp_rtn (const char *s1, const char *s2, const char *s3, int w1, int cw)
{
switch (cw)
{
case 3:
sprintf(errppbuf, s1, s2);
break;
case 5:
sprintf(errppbuf, s1, s3);
break;
case 7:
sprintf(errppbuf, s1, w1);
break;
case 15:
sprintf(errppbuf, s1, s2, s3);
break;
case 21:
sprintf(errppbuf, s1, s2, w1);
break;
case 35:
sprintf(errppbuf, s1, s3, w1);
break;
case 105:
sprintf(errppbuf, s1, s2, s3, w1);
break;
default:
sprintf(errppbuf, "%s", s1);
break;
}
fprintf(stderr, "%s", errppbuf);
}
#endif
+137
View File
@@ -0,0 +1,137 @@
/*
Copyright (C) 1999-2004 David Essex, Rildo Pragana
This program 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 2, or (at your option)
any later version.
This program 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 this software; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
*/
#ifndef _COBPP_H
#define _COBPP_H
#include <stdlib.h>
#include <stdio.h>
#define PATHMAX 120
#define PATHMAX1 1024
#define PATHMAX2 256
#define PATHMAX3 (1024 * 4)
#define CHR_SQUOTE '\''
#define CHR_DQUOTE '"'
#define CHR_EOS '\0'
#define CHR_ASTERIX '*'
#define CHR_CR '\r'
#define CHR_LF '\n'
#define STR_DASH '-'
#define STR_UNDERSCORE '_'
#define CHR_SLASH '/'
//#define DEBUG_COBPP 1
#ifdef DEBUG_COBPP
#define DEBUG_COBPP_PP 1
#define DEBUG_COBPP_SCANNER 1
#define DEBUG_COBPP_PARSER 1
#endif
#ifndef __MINGW32__
#define STR_SEARCH_SUFFIXES ".cpy:.CPY:.cob:.COB:.cbl:.CBL::"
#define CHR_COLEN ':'
#define STR_COLEN ":"
#else
#define STR_SEARCH_SUFFIXES ".cpy;.CPY;.cob;.COB;.cbl;.CBL;;"
#define CHR_COLEN ';'
#define STR_COLEN ";"
#endif
#define FORMAT_FIXED 0
#define FORMAT_FREE 1
#define STATE_FLIT_LNONE 1
#define STATE_FNAME_LNONE 2
#define STATE_FLIT_LLIT 3
#define STATE_FLIT_LNAME 4
#define STATE_FNAME_LLIT 5
#define STATE_FNAME_LNAME 6
#define TCOBPP_CMDOPTION_LIST "f:x:o:p:t:I:vV?hdg"
#define TCOBPP_CMDOPT_FRM_FIXED 'f'
#define TCOBPP_CMDOPT_FRM_FREE 'x'
#define TCOBPP_CMDOPT_OUTFILE 'o'
#define TCOBPP_CMDOPT_LIST 'p'
#define TCOBPP_CMDOPT_TAB_LEN 't'
#define TCOBPP_CMDOPT_INC_PATH 'I'
#define TCOBPP_CMDOPT_VERBOSE 'v'
#define TCOBPP_CMDOPT_VERSION 'V'
#define TCOBPP_CMDOPT_HELP1 '?'
#define TCOBPP_CMDOPT_HELP 'h'
#define TCOBPP_CMDOPT_INC_DEBUG 'd'
#define TCOBPP_CMDOPT_DEBUG 'g'
#define TCOBPP_TITLE "TinyCOBOL pre-processor"
#define TCOBPP_COPYWR "Copyright (C) 1999-2002 David Essex"
extern char HTG_COPYDIR[];
typedef short bool;
struct s_Env {
bool codeFormat; /* 1 is free , 0 is fixed */
int debugFlag;
int IncDebugLines;
int errFlag;
int verboseFlag;
int tab2space;
char *progName;
char *ifname;
char *ofname;
char *lfname;
};
typedef struct s_Env Env;
Env globalEnv;
Env *globalEnvPtr;
/* command line options */
static char option_list[] = { TCOBPP_CMDOPTION_LIST };
/* parser.tab.c */
void yyerror(char *s);
int yyparse(void);
/* scanner.c */
int yylex(void);
int yywrap(void);
void yyrestart(FILE *input_file);
int lex_fgets(char *buf, int maxsize);
extern void setup_scanner_state();
extern char include_full_filename[];
int find_copybook_file(char *fname, char *lname);
int find_copybook_file2 (char *fname, char *lname);
int find_filename_text (char *fname, char *fp, char *fs);
int find_filename_literal (char *fname, char *fp);
char *find_env_variable (char *ev);
char *find_token(char *p, const char *d, int sw);
void append_include_path(char *ap);
int setOptions(Env*, int, char**);
void setDefaults(void);
void printVersion(void);
void printHelp(void);
void CleanUp(void);
#endif
+16
View File
@@ -0,0 +1,16 @@
* 01 W01-COMPUTE-0 PIC 9(8) VALUE 30000.
01 W01-COMPUTE PIC X(2) VALUE "**".
01 W01-COMPUTE-0 PIC 9(8) VALUE 30000.
01 W01-COMPUTE-1 PIC Z(5),Z(3).
01 W01-COMPUTE-2 PIC *Z,ZZZ,ZZZ.
01 W01-COMPUTE-3 PIC Z(3)Z(5),99.
01 W01-COMPUTE-4 PIC 9(6)V99.
01 W01-COMPUTE-5 PIC 9(5).
01 W01-COMPUTE-6 PIC X(10) VALUE 'W01-1XXX'.
COPY 'TEST02A.cpy' REPLACING
W01-COMPUTE-A0 BY W01-COMPUTE-A00
==9(8)== BY ==9(09)== .
+11
View File
@@ -0,0 +1,11 @@
* 01 W01-COMPUTE-A0 PIC 9(8) VALUE 30000.
01 W01-COMPUTE-A PIC X(2) VALUE "**".
01 W01-COMPUTE-A0 PIC 9(8) VALUE 30000.
01 W01-COMPUTE-A1 PIC Z(5),Z(3).
01 W01-COMPUTE-A2 PIC *Z,ZZZ,ZZZ.
01 W01-COMPUTE-A3 PIC Z(3)Z(5),99.
01 W01-COMPUTE-A4 PIC 9(5)V99.
COPY 'TEST02B.cpy'.
+11
View File
@@ -0,0 +1,11 @@
* 01 W01-COMPUTE-B0 PIC 9(8) VALUE 30000.
01 W01-COMPUTE-B PIC X(2) VALUE "**".
01 W01-COMPUTE-B0 PIC 9(8) VALUE 30000.
01 W01-COMPUTE-B1 PIC Z(5),Z(3).
01 W01-COMPUTE-B2 PIC *Z,ZZZ,ZZZ.
01 W01-COMPUTE-B3 PIC Z(3)Z(5).99.
01 W01-COMPUTE-B4 PIC 9(5)V99.
COPY 'TEST02C.cpy'.
+9
View File
@@ -0,0 +1,9 @@
* 01 W01-COMPUTE-C0 PIC 9(8) VALUE 30000.
01 W01-COMPUTE-C PIC X(2) VALUE "**".
01 W01-COMPUTE-C0 PIC 9(8) VALUE 30000.
01 W01-COMPUTE-C1 PIC Z(5),Z(3).
01 W01-COMPUTE-C2 PIC *Z,ZZZ,ZZZ.
01 W01-COMPUTE-C3 PIC Z(3)Z(5).99.
01 W01-COMPUTE-C4 PIC 9(5)V99.
+9
View File
@@ -0,0 +1,9 @@
* 01 W01-COMPUTE-D0 PIC 9(8) VALUE 30000.
01 W01-COMPUTE-D PIC X(2) VALUE "**".
01 W01-COMPUTE-D0 PIC 9(8) VALUE 30000.
01 W01-COMPUTE-D1 PIC Z(5),Z(3).
01 W01-COMPUTE-D2 PIC *Z,ZZZ,ZZZ.
01 W01-COMPUTE-D3 PIC Z(3)Z(5).99.
01 W01-COMPUTE-D4 PIC 9(5)V99.
+16
View File
@@ -0,0 +1,16 @@
000010 fTEST02_
000020* 01 W01-COMPUTE-0 PIC 9(8) VALUE 30000. fTEST02_
000030 01 W01-COMPUTE PIC X(2) VALUE "**". fTEST02_
000040 01 W01-COMPUTE-0 PIC 9(8) VALUE 30000. fTEST02_
000050 01 W01-COMPUTE-1 PIC Z(5),Z(3). fTEST02_
000060 01 W01-COMPUTE-2 PIC *Z,ZZZ,ZZZ. fTEST02_
000070 01 W01-COMPUTE-3 PIC Z(3)Z(5),99. fTEST02_
000080 01 W01-COMPUTE-4 PIC 9(6)V99. fTEST02_
000090 01 W01-COMPUTE-5 PIC 9(5). fTEST02_
000100 01 W01-COMPUTE-6 PIC X(10) VALUE 'W01-1XXX'. fTEST02_
000110 fTEST02_
000120 COPY 'fTEST02A.cpy' REPLACING fTEST02_
000130 W01-COMPUTE-A0 BY W01-COMPUTE-A00 fTEST02_
000140 ==9(8)== BY ==9(09)== . fTEST02_
000150 fTEST02_
000160 fTEST02_
+11
View File
@@ -0,0 +1,11 @@
000010 fTEST02A
000020* 01 W01-COMPUTE-A0 PIC 9(8) VALUE 30000. fTEST02A
000030 01 W01-COMPUTE-A PIC X(2) VALUE "**". fTEST02A
000040 01 W01-COMPUTE-A0 PIC 9(8) VALUE 30000. fTEST02A
000050 01 W01-COMPUTE-A1 PIC Z(5),Z(3). fTEST02A
000060 01 W01-COMPUTE-A2 PIC *Z,ZZZ,ZZZ. fTEST02A
000070 01 W01-COMPUTE-A3 PIC Z(3)Z(5),99. fTEST02A
000080 01 W01-COMPUTE-A4 PIC 9(5)V99. fTEST02A
000090 fTEST02A
000100 COPY 'fTEST02B.cpy'. fTEST02A
000110 fTEST02A
+11
View File
@@ -0,0 +1,11 @@
000010 fTEST02B
000020* 01 W01-COMPUTE-B0 PIC 9(8) VALUE 30000. fTEST02B
000030 01 W01-COMPUTE-B PIC X(2) VALUE "**". fTEST02B
000040 01 W01-COMPUTE-B0 PIC 9(8) VALUE 30000. fTEST02B
000050 01 W01-COMPUTE-B1 PIC Z(5),Z(3). fTEST02B
000060 01 W01-COMPUTE-B2 PIC *Z,ZZZ,ZZZ. fTEST02B
000070 01 W01-COMPUTE-B3 PIC Z(3)Z(5).99. fTEST02B
000080 01 W01-COMPUTE-B4 PIC 9(5)V99. fTEST02B
000090 fTEST02B
000100 fTEST02B
000110 COPY 'fTEST02C.cpy'. fTEST02B
+9
View File
@@ -0,0 +1,9 @@
000010 fTEST02C
000020* 01 W01-COMPUTE-C0 PIC 9(8) VALUE 30000. fTEST02C
000030 01 W01-COMPUTE-C PIC X(2) VALUE "**". fTEST02C
000040 01 W01-COMPUTE-C0 PIC 9(8) VALUE 30000. fTEST02C
000050 01 W01-COMPUTE-C1 PIC Z(5),Z(3). fTEST02C
000060 01 W01-COMPUTE-C2 PIC *Z,ZZZ,ZZZ. fTEST02C
000070 01 W01-COMPUTE-C3 PIC Z(3)Z(5).99. fTEST02C
000080 01 W01-COMPUTE-C4 PIC 9(5)V99. fTEST02C
000090 fTEST02C
+9
View File
@@ -0,0 +1,9 @@
000010 fTEST02D
000020* 01 W01-COMPUTE-D0 PIC 9(8) VALUE 30000. fTEST02D
000030 01 W01-COMPUTE-D PIC X(2) VALUE "**". fTEST02D
000040 01 W01-COMPUTE-D0 PIC 9(8) VALUE 30000. fTEST02D
000050 01 W01-COMPUTE-D1 PIC Z(5),Z(3). fTEST02D
000060 01 W01-COMPUTE-D2 PIC *Z,ZZZ,ZZZ. fTEST02D
000070 01 W01-COMPUTE-D3 PIC Z(3)Z(5).99. fTEST02D
000080 01 W01-COMPUTE-D4 PIC 9(5)V99. fTEST02D
000090 fTEST02D
+9
View File
@@ -0,0 +1,9 @@
000010 fTEST02E
000020* 01 W01-COMPUTE-D0 PIC 9(8) VALUE 30000. fTEST02E
000030 01 W01-COMPUTE-D PIC X(2) VALUE "**". fTEST02E
000040 01 W01-COMPUTE-D0 PIC 9(8) VALUE 30000. fTEST02E
000050 01 W01-COMPUTE-D1 PIC Z(5),Z(3). fTEST02E
000060 01 W01-COMPUTE-D2 PIC *Z,ZZZ,ZZZ. fTEST02E
000070 01 W01-COMPUTE-D3 PIC Z(3)Z(5).99. fTEST02E
000080 01 W01-COMPUTE-D4 PIC 9(5)V99. fTEST02E
000090 fTEST02E
+280
View File
@@ -0,0 +1,280 @@
/*
Copyright (C) 1999-2004 David Essex
This program 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 2, or (at your option)
any later version.
This program 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 this software; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
TinyCOBOL pre-processor parser
*/
%{
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <ctype.h>
#include "cobpp.h"
//#define YYDEBUG 1
/* #define DEBUG_COBPP_PARSER 1 */
extern unsigned long lineCount;
extern unsigned long columnCount;
extern int copy_state_sw;
extern int copy_start_sw;
extern int replace_state_sw;
extern int replace_start_sw;
extern int identifier_scan_sw;
//extern char *include_filename;
extern char *include_cpybook;
extern char *include_cpylib;
extern int yylex(void);
extern char *pp_yytext;
extern void add_copy_replacement(char *, char *);
extern void add_replace_replacement(char *, char *);
#ifdef DEBUG_COBPP_PARSER
char erryybuf[1024*8];
void debug_yy_rtn (const char *s1, const char *s2, const char *s3, int sw);
#define DEBUGYY_RTN_STR1(msg1) debug_yy_rtn (msg1, NULL, NULL, 1);
#define DEBUGYY_RTN_STR3(msg1, msg2) debug_yy_rtn (msg1, msg2, NULL, 3);
#define DEBUGYY_RTN_STR15(msg1, msg2, msg3) debug_yy_rtn (msg1, msg2, msg3, 15);
#else
#define DEBUGYY_RTN_STR1(msg1)
#define DEBUGYY_RTN_STR3(msg1, msg2)
#define DEBUGYY_RTN_STR15(msg1, msg2, msg3)
#endif
%}
%union {
char *str; /* string */
int ival; /* int */
}
%token <str> TOK_PSEUDO_TEXT TOK_IDENTIFIER TOK_LITERAL TOK_WORD
%token <ival> ERROR YYERROR_VERBOSE
%token TOK_COPY TOK_PERIOD TOK_OFF TOK_BY TOK_OF TOK_IN
%token TOK_REPLACING TOK_REPLACE
%token TOK_MISC TOK_COMMA
%token TOK_SOURCE_COMPUTER TOK_WITH TOK_DEBUGGING TOK_MODE
%type <str> pseudo_text identifier literal word name library_name_opt replacing_text
%%
root: statements
| /* nill */
;
statements: statement
| statements statement
;
statement: TOK_SOURCE_COMPUTER TOK_PERIOD
{
DEBUGYY_RTN_STR1("yytrace: TOK_SOURCE_COMPUTER TOK_PERIOD\n")
}
identifier_debug_mode_opt
{
identifier_scan_sw--;
}
| TOK_COPY
{
DEBUGYY_RTN_STR1("yytrace: TOK_COPY\n")
}
copy_statement TOK_PERIOD
{
copy_state_sw--;
copy_start_sw++;
identifier_scan_sw--;
}
| TOK_REPLACE replace_statement TOK_PERIOD
{
replace_state_sw--;
replace_start_sw++;
identifier_scan_sw--;
}
| TOK_REPLACE TOK_OFF TOK_PERIOD
{
replace_state_sw--;
replace_start_sw--;
identifier_scan_sw--;
}
| TOK_MODE { }
| TOK_WITH { }
| error
{
globalEnvPtr->errFlag = 11;
return 11;
}
| ERROR
{
globalEnvPtr->errFlag = 12;
return 12;
}
| YYERROR_VERBOSE
{
globalEnvPtr->errFlag = 13;
return 13;
}
;
copy_statement: name library_name_opt
{
/*include_filename = $1; */
include_cpybook = $1;
include_cpylib = $2;
DEBUGYY_RTN_STR15("yytrace: copy_statement: name=%s, lib=%s;\n", include_cpybook, include_cpylib)
}
TOK_REPLACING replacing_statement
| name library_name_opt
{
/*include_filename = $1;*/
include_cpybook = $1;
include_cpylib = $2;
DEBUGYY_RTN_STR15("yytrace: copy_statement: name=%s, lib=%s;\n", include_cpybook, include_cpylib)
}
;
replacing_statement: replacing_statements
| replacing_statements replacing_statement
;
replacing_statements: replacing_text TOK_BY replacing_text comma_delimiter_opt
{
add_copy_replacement($1,$3);
DEBUGYY_RTN_STR15("yytrace: replacing_statements: \'%s\' BY \'%s\':\n", $1, $3)
}
;
replacing_text: pseudo_text { $$=$1; }
| identifier { $$=$1; }
| literal { $$=$1; }
| word { $$=$1; }
;
library_name_opt: of_in name { $$=$2; }
| { $$=NULL; }
;
replace_statement: replace_statements
| replace_statements replace_statement
;
replace_statements: pseudo_text TOK_BY pseudo_text comma_delimiter_opt
{
add_replace_replacement($1,$3);
}
;
name: literal { $$=$1; }
| identifier { $$=$1; }
;
pseudo_text: TOK_PSEUDO_TEXT { $$=$1; }
;
identifier: TOK_IDENTIFIER
{
DEBUGYY_RTN_STR3("yytrace: identifier: \'%s\'\n", $1)
$$=$1;
}
;
literal: TOK_LITERAL { $$=$1; }
;
word: TOK_WORD { $$=$1; }
;
of_in: TOK_OF
| TOK_IN
;
comma_delimiter_opt: TOK_COMMA
| /* no comma */
;
identifier_debug_mode_opt: identifier debugging_mode_opt TOK_PERIOD
{
DEBUGYY_RTN_STR1("yytrace: identifier debugging_mode_opt TOK_PERIOD\n")
}
| /* empty */
;
debugging_mode_opt: with_opt TOK_DEBUGGING
TOK_MODE
{
globalEnv.IncDebugLines = 1;
DEBUGYY_RTN_STR1("yytrace: with_opt TOK_DEBUGGING TOK_MODE \n")
}
| /* empty */
;
with_opt: TOK_WITH
| /* no with */
;
%%
void pp_yyerror(char *s)
{
fprintf(stderr, "htcobolpp: yyerror (%lu, %lu): %s \'%s\'\n", lineCount, columnCount, s, pp_yytext);
globalEnvPtr->errFlag = 8;
/* return 0; */
}
#ifdef DEBUG_COBPP_PARSER
void debug_yy_rtn (const char *s1, const char *s2, const char *s3, int sw)
{
switch (sw)
{
case 3:
sprintf(erryybuf, s1, s2);
break;
case 5:
sprintf(erryybuf, s1, s3);
break;
case 15:
sprintf(erryybuf, s1, s2, s3);
break;
default:
sprintf(erryybuf, "%s", s1);
break;
}
fprintf(stderr, "%s", erryybuf);
}
#endif
+2161
View File
File diff suppressed because it is too large Load Diff
+118
View File
@@ -0,0 +1,118 @@
//
// Copyright (C) 2001, 2000, 1999 David Essex
//
// This program 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 2, or (at your option)
// any later version.
//
// This program 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 this software; see the file COPYING. If not, write to
// the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
// Boston, MA 02111-1307 USA
//
#ifndef _TCPPHELP_H
#define _TCPPHELP_H
#ifdef TCOBPP_LANGUAGE_en
/* Usage list */
/* Usage: %s <options> <input_file> [-o <output_file>]\n" */
static char usage_list0[] = { "<options> <input_file> [-o <output_file>]\n" };
static char usage_list1[] = { "where <options> are:\n\
-h Help (display this listing)\n\
-V Display version and exit\n\
-v Verbose mode\n\
-d Include debug lines\n\
-g Turn on debuging mode\n\
-t <num> Expand tabs to <num> space(s)\n\
-o <output_file> Output file name (default: standard output)\n\
-p <listing_file> Listing file name \n\
-x <input_file> Input source is in free form format\n\
-f <input_file> Input source is in standard fixed column format\n\
-I <copy_dir> Copybooks search directories \n\
" };
#endif
#ifdef TCOBPP_LANGUAGE_fr
static char usage_list0[] = { "<options> <fichier en entrée> [-o <fichier en sortie>]\n" };
static char usage_list1[] = { "options:\n\
-h Affiche l'aide\n\
-V Affiche la version\n\
-v Mode verbeux\n\
-d Inclut les lignes de débogage\n\
-g Positionne le mode de débogage\n\
-t <nombre> Transforme les tabulations en <nombre> d'espace(s)\n\
-o <fichier_en_sortie> Nom du fichier en sortie (défaut: sortie standard)\n\
-p <fichier_liste> Nom du fichier de liste\n\
-x <fichier_en_entre'e> Le fichier en entrée est en format libre (X/Open)\n\
-f <fichier_en_entre'e> Le fichier en entrée est en format standard (colonnage fixe)\n\
-I <répertoires_des_fichiers_d'inclusion> Répertoires de recherche des fichiers d'inclusion\n\
" };
#endif
#ifdef TCOBPP_LANGUAGE_it
static char usage_list0[] = { "<opzioni> <nome_file_da_pre-processare> [-o <nome_file_di_destinazione>]\n" };
static char usage_list1[] = { "opzioni:\n\
-h Visualizza l'aiuto\n\
-V Versione\n\
-v Modalita` prolissa\n\
-d Include le linee di debug\n\
-g Attiva la modalita` di debuging\n\
-t <num> Converte i 'tabs' in <num> spazi\n\
-o <output_file> Nome file da generare (default: standard output)\n\
-p <listing_file> Nome file del listato\n\
-x <input_file> Il sorgente in ingresso e` formattato in modalita` libera (free form)\n\
-f <input_file> Il sorgente in ingresso e` formattato in modalita` Standard\n\
-I <copy_dir> Cartella di ricerca dei files 'Copybooks'\n\
" };
#endif
#ifdef TCOBPP_LANGUAGE_pt_BR
static char usage_list0[] = { "<opcoes> <arquivo-de-entrada> [-o <arquivo-de-saida>]\n" };
static char usage_list1[] = { "opcoes:\n\
-h Mostra ajuda\n\
-V Mostra versao\n\
-v Modo verboso\n\
-d Inclui linhas de debug\n\
-g Muda para modo de debug\n\
-t <num> Expande tabs para <num> espaco(s)\n\
-o <arquivo_saida> Nome do arquivo de saida (padrao: saida padrao)\n\
-p <arquivo_listado> Nome do arquivo listado \n\
-x <arquivo_entrada> O arquivo de entrada esta no formato livre\n\
-f <arquivo_entrada> Arquivo de entrada esta em formato de coluna fixa padrao\n\
-I <diretorio_copybooks> Diretorios de procura de copybooks\n\
" };
#endif
#ifdef TCOBPP_LANGUAGE_es
/* Usage list */
/* Usage: %s <options> <input_file> [-o <output_file>]\n" */
static char usage_list0[] = { "<opciones> <fichero_entrada> [-o <fich_salida]\n" };
static char usage_list1[] = { "donde <opciones> son:\n\
-h Ayuda (muestra este listado)\n\
-V Muestra la versión y termina\n\
-v Modo detallado\n\
-d Incluye lineas de debug\n\
-g Activa el modo debug\n\
-t <num> Expandir tabulados a <num> espacios\n\
-o <fich_salida> Nombre del fichero salida (defecto: salida estándar)\n\
-p <fich_listado> Nombre del fichero listado\n\
-x <fich_entrada> El fuente de entrada está en formato libre\n\
-f <fich_entrada> El fuente está en formato estándar de cols fijas\n\
-I <dir_copy> Directorios de búsqueda para Copybooks\n\
" };
#endif
#endif
+120
View File
@@ -0,0 +1,120 @@
//
// Copyright (C) 2001, 2000, 1999 David Essex
//
// This program 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 2, or (at your option)
// any later version.
//
// This program 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 this software; see the file COPYING. If not, write to
// the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
// Boston, MA 02111-1307 USA
//
#ifndef _TCPPHELP_H
#define _TCPPHELP_H
//#define TCOBPP_LANGUAGE_@tcob_lang@ 1
#ifdef TCOBPP_LANGUAGE_en
/* Usage list */
/* Usage: %s <options> <input_file> [-o <output_file>]\n" */
static char usage_list0[] = { "<options> <input_file> [-o <output_file>]\n" };
static char usage_list1[] = { "where <options> are:\n\
-h Help (display this listing)\n\
-V Display version and exit\n\
-v Verbose mode\n\
-d Include debug lines\n\
-g Turn on debuging mode\n\
-t <num> Expand tabs to <num> space(s)\n\
-o <output_file> Output file name (default: standard output)\n\
-p <listing_file> Listing file name \n\
-x <input_file> Input source is in free form format\n\
-f <input_file> Input source is in standard fixed column format\n\
-I <copy_dir> Copybooks search directories \n\
" };
#endif
#ifdef TCOBPP_LANGUAGE_fr
static char usage_list0[] = { "<options> <fichier en entrée> [-o <fichier en sortie>]\n" };
static char usage_list1[] = { "options:\n\
-h Affiche l'aide\n\
-V Affiche la version\n\
-v Mode verbeux\n\
-d Inclut les lignes de débogage\n\
-g Positionne le mode de débogage\n\
-t <nombre> Transforme les tabulations en <nombre> d'espace(s)\n\
-o <fichier_en_sortie> Nom du fichier en sortie (défaut: sortie standard)\n\
-p <fichier_liste> Nom du fichier de liste\n\
-x <fichier_en_entre'e> Le fichier en entrée est en format libre (X/Open)\n\
-f <fichier_en_entre'e> Le fichier en entrée est en format standard (colonnage fixe)\n\
-I <répertoires_des_fichiers_d'inclusion> Répertoires de recherche des fichiers d'inclusion\n\
" };
#endif
#ifdef TCOBPP_LANGUAGE_it
static char usage_list0[] = { "<opzioni> <nome_file_da_pre-processare> [-o <nome_file_di_destinazione>]\n" };
static char usage_list1[] = { "opzioni:\n\
-h Visualizza l'aiuto\n\
-V Versione\n\
-v Modalita` prolissa\n\
-d Include le linee di debug\n\
-g Attiva la modalita` di debuging\n\
-t <num> Converte i 'tabs' in <num> spazi\n\
-o <output_file> Nome file da generare (default: standard output)\n\
-p <listing_file> Nome file del listato\n\
-x <input_file> Il sorgente in ingresso e` formattato in modalita` libera (free form)\n\
-f <input_file> Il sorgente in ingresso e` formattato in modalita` Standard\n\
-I <copy_dir> Cartella di ricerca dei files 'Copybooks'\n\
" };
#endif
#ifdef TCOBPP_LANGUAGE_pt_BR
static char usage_list0[] = { "<opcoes> <arquivo-de-entrada> [-o <arquivo-de-saida>]\n" };
static char usage_list1[] = { "opcoes:\n\
-h Mostra ajuda\n\
-V Mostra versao\n\
-v Modo verboso\n\
-d Inclui linhas de debug\n\
-g Muda para modo de debug\n\
-t <num> Expande tabs para <num> espaco(s)\n\
-o <arquivo_saida> Nome do arquivo de saida (padrao: saida padrao)\n\
-p <arquivo_listado> Nome do arquivo listado \n\
-x <arquivo_entrada> O arquivo de entrada esta no formato livre\n\
-f <arquivo_entrada> Arquivo de entrada esta em formato de coluna fixa padrao\n\
-I <diretorio_copybooks> Diretorios de procura de copybooks\n\
" };
#endif
#ifdef TCOBPP_LANGUAGE_es
/* Usage list */
/* Usage: %s <options> <input_file> [-o <output_file>]\n" */
static char usage_list0[] = { "<opciones> <fichero_entrada> [-o <fich_salida]\n" };
static char usage_list1[] = { "donde <opciones> son:\n\
-h Ayuda (muestra este listado)\n\
-V Muestra la versión y termina\n\
-v Modo detallado\n\
-d Incluye lineas de debug\n\
-g Activa el modo debug\n\
-t <num> Expandir tabulados a <num> espacios\n\
-o <fich_salida> Nombre del fichero salida (defecto: salida estándar)\n\
-p <fich_listado> Nombre del fichero listado\n\
-x <fich_entrada> El fuente de entrada está en formato libre\n\
-f <fich_entrada> El fuente está en formato estándar de cols fijas\n\
-I <dir_copy> Directorios de búsqueda para Copybooks\n\
" };
#endif
#endif
+13
View File
@@ -0,0 +1,13 @@
#ifndef _TCOBPP_VERSION_H
#define _TCOBPP_VERSION_H
#define TCOBPP_MAJOR_VERSION "0"
#define TCOBPP_MINOR_VERSION "41"
#define TCOBPP_PATCH_LEVEL "3"
#define TCOBPP_VERSION "0.41.3"
#define TCOBPP_RELEASE_DATE "2004/09/25"
#define TCOBPP_PGM_VERSION "alpha 0.41.3 (MinGW 2004/09/25)"
#endif
+13
View File
@@ -0,0 +1,13 @@
#ifndef _TCOBPP_VERSION_H
#define _TCOBPP_VERSION_H
#define TCOBPP_MAJOR_VERSION "@TCOBPP_MAJOR_VERSION@"
#define TCOBPP_MINOR_VERSION "@TCOBPP_MINOR_VERSION@"
#define TCOBPP_PATCH_LEVEL "@TCOBPP_PATCH_LEVEL@"
#define TCOBPP_VERSION "@TCOBPP_VERSION@"
#define TCOBPP_RELEASE_DATE "@TCOBPP_RELEASE_DATE@"
#define TCOBPP_PGM_VERSION "alpha @TCOBPP_VERSION@ (@host_os@ @TCOBPP_RELEASE_DATE@)"
#endif
+124
View File
@@ -0,0 +1,124 @@
#
#
#
TESTLIB=../copybooks
export TESTLIB
prefix=../../test.code
exec_prefix=../../compiler
g_includes=-I/usr/local/include
g_libraries=-L/usr/local/lib
CCX=gcc
COB=${exec_prefix}/htcobol
COBPP=../htcobolpp
ASM=as
RM=rm -f
COPYBOOKS= -I../copybooks -I.
INCLUDES= -I/usr/local/include
LIBS=${g_libraries} -L../../lib -lhtcobol -lm
LDFLAGS=
COBFLAGS=-P -c ${COPYBOOKS}
ASMFLAGS=-D
CCXFLAGS=-g ${INCLUDES}
COBPPFLAGS= -v -I ../copybooks
SRC1f = ft1.cob
SRC2f = ft2.cob
SRC3f = ft2.cob
SRC1x = t1.cob
SRC2x = t2.cob
SRC3x = t3.cob
SRC1fa = ft1-1.cob
SRC2fa = ft2-1.cob
SRC3fa = ft3-1.cob
SRC1xa = t1-1.cob
SRC2xa = t2-1.cob
SRC3xa = t3-1.cob
OBJS1fa = $(SRC1fa:.cob=.o)
OBJS2fa = $(SRC2fa:.cob=.o)
OBJS3fa = $(SRC3fa:.cob=.o)
OBJS1xa = $(SRC1xa:.cob=.o)
OBJS2xa = $(SRC2xa:.cob=.o)
OBJS3xa = $(SRC3xa:.cob=.o)
OBJS = $(OBJS1fa) $(OBJS2fa) $(OBJS3fa) $(OBJS1xa) $(OBJS2xa) $(OBJS3xa)
PROG1f = ft1
PROG2f = ft2
PROG3f = ft3
PROG1x = t1
PROG2x = t2
PROG3x = t3
#PROGS = $(PROG1f) $(PROG2f) $(PROG3f) $(PROG1x) $(PROG2x) $(PROG3x)
PROGS = $(SRC1fa) $(SRC2fa) $(SRC3fa) $(SRC1xa) $(SRC2xa) $(SRC3xa)
include ${prefix}/config/C.rules.in
#include ${prefix}/config/COB.rules.in
#
# Rules for compiling .cob sources
.SUFFIX: .cob .o
%.o: %.cob
$(COB) $(COBFLAGS) $<
# $(ASM) $(ASMFLAGS) -o $*.o -a=$*.listing.0.txt $*.s
# @grep -v 'LISTING' $*.listing.0.txt | sed '/^$$/d' >$*.s.txt
# @${RM} $*.listing.0.txt
#
all: ${PROGS}
${PROG1f}: ${OBJS1fa} ${SRC1fa}
$(CCX) -g -o $@ ${OBJS1fa} $(LDFLAGS) $(LIBS)
# strip $@
${PROG2f}: ${OBJS2fa} ${SRC2fa}
$(CCX) -g -o $@ ${OBJS2fa} $(LDFLAGS) $(LIBS)
# strip $@
${PROG3f}: ${OBJS3fa} ${SRC3fa}
$(CCX) -g -o $@ ${OBJS3fa} $(LDFLAGS) $(LIBS)
# strip $@
${PROG1x}: ${OBJS1xa} ${SRC1xa}
$(CCX) -g -o $@ ${OBJS1xa} $(LDFLAGS) $(LIBS)
# strip $@
${PROG2x}: ${OBJS2xa} ${SRC2xa}
$(CCX) -g -o $@ ${OBJS2xa} $(LDFLAGS) $(LIBS)
# strip $@
${PROG3x}: ${OBJS3xa} ${SRC3xa}
$(CCX) -g -o $@ ${OBJS3xa} $(LDFLAGS) $(LIBS)
# strip $@
${SRC1fa}:
$(COBPP) $(COBPPFLAGS) -f ${SRC1f} -o ${SRC1fa} -p ${SRC1f}.txt
${SRC2fa}:
$(COBPP) $(COBPPFLAGS) -f ${SRC2f} -o ${SRC2fa} -p ${SRC2f}.txt
${SRC3fa}:
$(COBPP) $(COBPPFLAGS) -f ${SRC3f} -o ${SRC3fa} -p ${SRC3f}.txt
${SRC1xa}:
$(COBPP) $(COBPPFLAGS) -x ${SRC1x} -o ${SRC1xa} -p ${SRC1x}.txt
${SRC2xa}:
$(COBPP) $(COBPPFLAGS) -x ${SRC2x} -o ${SRC2xa} -p ${SRC2x}.txt
${SRC3xa}:
$(COBPP) $(COBPPFLAGS) -x ${SRC3x} -o ${SRC3xa} -p ${SRC3x}.txt
clean:
@${RM} ${OBJS} $(PROGS) $(SRC1a) $(SRC2a) $(SRC3a) $(SRC4a) $(SRC5a) \
*cob.txt *.lis *.s *s.txt *.trace.txt trace*txt core \
t[0-9]-1.cob ft[0-9]-1.cob
+29
View File
@@ -0,0 +1,29 @@
TC pre-processor test COBOL programs.
How to run test program:
r.sh - will test run for all programs
or
r.sh [ -f|x(format) f=fixed x=open filename(s)] - will run selected file
The shell script will run make and create a trace files *.trace.txt.
To run type(example) - no suffix required .cob is assumed:
r.sh -f ft3
To clean type make clean.
Notes:
make program may not work.
Some copybooks require that the 'TESTLIB' environment variable be defined.
TESTLIB='../copybooks'
export TESTLIB
fixed: -f
../htcobolpp -v -d -I ../copybooks -f ft1.cob -o ft1-1.cob -p ft1.cob.txt 2>trace.ft1.2.txt
../htcobolpp -v -d -I ../copybooks -f ft2.cob -o ft2-1.cob -p ft2.cob.txt 2>trace.ft2.2.txt
../htcobolpp -v -d -I ../copybooks -f ft3.cob -o ft3-1.cob -p ft3.cob.txt 2>trace.ft3.2.txt
open: -x
../htcobolpp -v -d -I ../copybooks -x t1.cob -o t1-1.cob -p t1.cob.txt 2>trace.t1.2.txt
../htcobolpp -v -d -I ../copybooks -x t2.cob -o t2-1.cob -p t2.cob.txt 2>trace.t2.2.txt
+71
View File
@@ -0,0 +1,71 @@
000010 IDENTIFICATION DIVISION.
000020 PROGRAM-ID. fTEST1.
000030 ENVIRONMENT DIVISION.
000040 CONFIGURATION SECTION.
000045* SOURCE-COMPUTER. X86 WITH DEBUGGING MODE.
000046* SOURCE-COMPUTER.
000047* X86 WITH DEBUGGING MODE.
000048 SOURCE-COMPUTER.
000049 X86.
000050* SPECIAL-NAMES.
000060* DECIMAL-POINT IS COMMA.
000070 INPUT-OUTPUT SECTION.
000080 FILE-CONTROL.
000090 DATA DIVISION.
000100 FILE SECTION.
000110
000120 WORKING-STORAGE SECTION.
000130 01 XX.
000140 05 X1 PIC 9(4) VALUE 0.
000150 05 X2 PIC 9(4) VALUE 0.
000160 01 W01-COMPUTE-E PIC S9(5)V99 USAGE COMP VALUE 99876.
000170 01 W01-COMPUTE-X PIC X(50) VALUE "aaaaaaaaaaaaaaaaaaaaaaaaaaa
000180- "bbbbbbbbbbbbbbbbbbbbbbb".
000170 01 W01-COMPUTE-Y PIC X(54) VALUE "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
000180- "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
000180- "ccccccccccccccccccccccc".
000170 01 W01-COMPUTE-Z PIC X(54) VALUE "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
000180- "bbbbbbbbbbbbbbbbbbbbbbb".
000190
000200 CoPy 'fTEST02.cpy' IN TESTLIB REPLACING
000210* W01-COMPUTE-E BY W01-COMPUTE-EE
000280* ==9(5)== BY ==9(04)==
000280* ==9(6)== BY ==9(06)==
000280* == 02 == BY == 05 == .
000260* COPY 'fTEST02.cpy'.
000260* Copy 'fTEST02.cpy' IN "Test.lib" REPLACING
000260* COPY 'fTEST02.cpy' REPLACING
000260* COPY 'fTEST02.cpy' IN TESTLIB REPLACING
000270 W01-COMPUTE-0 BY W01-COMPUTE-00,
000270 'W01-1XXX' BY 'W01-2',
000280 ==9(5)== BY ==9(04)== . fTEST021
000290
000291 COPY 'fTEST02.cpy' IN TESTLIB REPLACING
000292 W01-COMPUTE-0 BY 000-W01-COMPUTE-000
000293 'W01-1XXX' BY 'W01-3'
000294 ==9(5)== BY ==9(07)== . fTEST022
000295
000300 PROCEDURE DIVISION.
000310
000320 A-000.
000330
000340* READY TRACE.
000345D DISPLAY "READY TRACE".
000350
000360 PERFORM A-100.
000370
000375D DISPLAY "RESET TRACE".
000380* RESET TRACE.
000390
000400 STOP RUN.
000410
000420 A-100.
000430
000440* DISPLAY "ENTER A-100".
000450
000460 MOVE 1 TO X1.
000470 ADD 1 TO X1.
000480 MOVE X1 TO X2.
000490
000500* DISPLAY "EXIT A-100".
000510
+67
View File
@@ -0,0 +1,67 @@
000010 IDENTIFICATION DIVISION. ft2_____
000020 PROGRAM-ID. fTEST2. ft2_____
000030 ENVIRONMENT DIVISION. ft2_____
000040 CONFIGURATION SECTION. ft2_____
000050* SPECIAL-NAMES. ft2_____
000060* DECIMAL-POINT IS COMMA. ft2_____
000070 INPUT-OUTPUT SECTION. ft2_____
000080 FILE-CONTROL. ft2_____
000090 DATA DIVISION. ft2_____
000100 FILE SECTION. ft2_____
000110 ft2_____
000120 WORKING-STORAGE SECTION. ft2_____
000130 01 XX. ft2_____
000140 05 X1 PIC 9(4) VALUE 0. ft2_____
000150 05 X2 PIC 9(4) VALUE 0. ft2_____
000160 01 W01-COMPUTE-E PIC S9(5)V99 USAGE COMP VALUE 99876. ft2_____
000170 01 W01-COMPUTE-X PIC X(50) VALUE "aaaaaaaaaaaaaaaaaaaaaaaaaa""'' ft2_____
000180- "bbbbbbbbbbbbbbbbbbbbbbb". ft2_____
000170 01 W01-COMPUTE-Y PIC X(54) VALUE "cccccccccccccccccccccccccccccccft2_____
000180- "ddddddddddddddddddddddddddddddddddddddddddddddddddft2_____
000180- "eeeeeeeeeeeeeeeeeeeeeee". ft2_____
000190 01 W01-COMPUTE-Z PIC X(54) VALUE 'fffffff '' """ffffffffffffffffft2_____
000200- 'ggggggggggggggggggggggg'. ft2_____
000210 ft2_____
000211 01 W01-COMPUTE-C PIC X(54) VALUE 'fffffff ' ft2_____
000212 & ft2_____
000213 'ggggggggggggggggggggggg '. ft2_____
000214 ft2_____
000220* CoPy 'fTEST02.cpy' IN TESTLIB REPLACING ft2_____
000230* W01-COMPUTE-E BY W01-COMPUTE-EE ft2_____
000240* ==9(5)== BY ==9(04)== ft2_____
000250* ==9(6)== BY ==9(06)== ft2_____
000260* == 02 == BY == 05 == . ft2_____
000270* COPY 'fTEST02.cpy'. ft2_____
000280* Copy 'fTEST02.cpy' IN "Test.lib" REPLACING ft2_____
000290* COPY 'fTEST02.cpy' REPLACING ft2_____
000300* COPY 'fTEST02.cpy' IN TESTLIB REPLACING ft2_____
000310* W01-COMPUTE-0 BY W01-COMPUTE-00 ft2_____
000320* 'W01-1XXX' BY 'W01-2' ft2_____
000330* ==9(5)== BY ==9(04)== . ft2_____
000340* ft2_____
000350* COPY 'fTEST02.cpy' IN TESTLIB REPLACING ft2_____
000360* W01-COMPUTE-0 BY W01-COMPUTE-000 ft2_____
000370* 'W01-1XXX' BY 'W01-3' ft2_____
000380* ==9(5)== BY ==9(07)== . ft2_____
000390 ft2_____
000400 PROCEDURE DIVISION. ft2_____
000410 ft2_____
000420 A-000. ft2_____
000430 ft2_____
000440* READY TRACE. ft2_____
000450 ft2_____
000460 PERFORM A-100. ft2_____
000470 ft2_____
000480* RESET TRACE. ft2_____
000490 ft2_____
000500 STOP RUN. ft2_____
000510 ft2_____
000520 A-100. ft2_____
000530 ft2_____
000540 DISPLAY "ENTER A-100". ft2_____
000550 ft2_____
000560 MOVE 1 TO X1. ft2_____
000570 ADD 1 TO X1. ft2_____
000580 MOVE X1 TO X2. ft2_____
000590 ft2_____
000600 DISPLAY "EXIT A-100". ft2_____
+69
View File
@@ -0,0 +1,69 @@
000010 IDENTIFICATION DIVISION. ft3_____
000020 PROGRAM-ID. fTEST3. ft3_____
000030 ENVIRONMENT DIVISION. ft3_____
000040 CONFIGURATION SECTION. ft3_____
000050* SPECIAL-NAMES. ft3_____
000060* DECIMAL-POINT IS COMMA. ft3_____
000070 INPUT-OUTPUT SECTION. ft3_____
000080 FILE-CONTROL. ft3_____
000090 DATA DIVISION. ft3_____
000100 FILE SECTION. ft3_____
000110 ft3_____
000120 WORKING-STORAGE SECTION. ft3_____
000130 01 XX. ft3_____
000140 05 X1 PIC 9(4) VALUE 0. ft3_____
000150 05 X2 PIC 9(4) VALUE 0. ft3_____
000151 05 X4 PIC 9(4) VALUE 66.ft3_____
000152 05 X5 PIC 9(4) VALUE 88ft3_____
000153 . ft3_____
000154 05 X6 PIC 9(4) VALUEft3_____
000155 99. ft3_____
000160 01 W01-COMPUTE-E PIC S9(5)V99 USAGE COMP VALUE 99876. ft3a____
000170 01 W01-COMPUTE-X PIC X(50) VALUE "aaaaaaaaaaaaaaaaaaaaaaaaaaa ft3b____
000180- "bbbbbbbbbbbbbbbbbbbbbbb". ft3c____
000190 01 W01-COMPUTE-Z PIC X(54) VALUE "cccccccccccccccccccccccccccccccft3d____
000200- "ddddddddddddddddddddddd". ft3e____
000210 ft3f____
000220*----------------------------------------------------------------*ft3g____
000220* CoPy 'fTEST02.cpy' IN TESTLIB REPLACING ft3g____
000230* W01-COMPUTE-E BY W01-COMPUTE-EE ft3_____
000240* ==9(5)== BY ==9(04)== ft3_____
000250* ==9(6)== BY ==9(06)== ft3_____
000260* == 02 == BY == 05 == . ft3_____
000270* COPY fTEST02C. ft3_____
000265* REPLACE ==9(5)== BY ==9(07)==. ft3_____
000270 COPY fTEST02D. ft3_____
000280* Copy 'fTEST02.cpy' IN "Test.lib". ft3_____
000280* Copy 'fTEST02.cpy' IN "Test.lib" REPLACING ft3_____
000290* COPY 'fTEST02.cpy' REPLACING ft3_____
000300* COPY 'fTEST02.cpy' IN TESTLIB REPLACING ft3_____
000310* W01-COMPUTE-0 BY W01-COMPUTE-00 ft3_____
000320* 'W01-1XXX' BY 'W01-2' ft3_____
000330* ==9(5)== BY ==9(04)== . ft3_____
000340* ft3_____
000350* COPY 'fTEST02.cpy' IN TESTLIB REPLACING ft3_____
000360* W01-COMPUTE-0 BY W01-COMPUTE-000 ft3_____
000370* 'W01-1XXX' BY 'W01-3' ft3_____
000380* ==9(5)== BY ==9(07)== . ft3_____
000390 ft3_____
000400 PROCEDURE DIVISION. ft3_____
000410 ft3_____
000420 A-000. ft3_____
000430 ft3_____
000440* READY TRACE. ft3_____
000450 ft3_____
000460 PERFORM A-100. ft3_____
000470 ft3_____
000480* RESET TRACE. ft3_____
000490 ft3_____
000500 STOP RUN. ft3_____
000510 ft3_____
000520 A-100. ft3_____
000530 ft3_____
000540 DISPLAY "ENTER A-100". ft3_____
000550 ft3_____
000560 MOVE 1 TO X1. ft3_____
000570 ADD 1 TO X1. ft3_____
000580 MOVE X1 TO X2. ft3_____
000590 ft3_____
000600 DISPLAY "EXIT A-100". ft3_____
+80
View File
@@ -0,0 +1,80 @@
#!/bin/bash -
#
# This shell script will run make and create trace.txt
# cmd: r.sh [ -f|x(format) f=fixed x=open filename(s)]
# David Essex August 1999
#
e0a="invalid number of parms..."
e0b="invalid option(s) "
e0c="This shell script will run make and create trace.txt"
e0d="cmd: r.sh [ -f|x(format) f=fixed x=open filename(s)]"
#
p_print1 ()
{
for arg in "$@"
do
echo $arg >&2
done
}
#
TESTLIB=../copybooks
export TESTLIB
#
prglst_f='ft1 ft2 ft3'
prglst_x='t1 t2 t3'
prg=''
#
p_main ()
{
ftype=$1
shift
for prg in "$@"
do
if [ \( ! -f "$prg.cob" \) -o \( ! -r "$prg.cob" \) ]
then
e1="error: filename $prg.cob not found or not readable... skipping file"
p_print1 "$e1"
else
echo "processing $prg.cob ... "
# p_print1 "$e1"
# cp1=`cat w/copypathlen_1290.txt`
# pp=/usr/local/share/htcobol/htcobolpp-0.54
# pp=/usr/local/share/htcobol/htcobolpp-0.55
pp=../htcobolpp
# pp=../htcobolpp.0
# e2="$pp -v -g -d -t 8 -I$cp1 -I.:../copybooks $ftype $prg.cob -o $prg-1.cob -p $prg.cob.txt "
# e2="$pp -v -d -t 8 -I$cp1 -I.:../copybooks $ftype $prg.cob -o $prg-1.cob -p $prg.cob.txt "
e2="$pp -v -g -d -t 8 -I.:../copybooks $ftype $prg.cob -o $prg-1.cob -p $prg.cob.txt "
# e2="$pp -v -g -t 8 -I.:../copybooks $ftype $prg.cob -o $prg-1.cob -p $prg.cob.txt "
echo "$e2"
$e2 2>$prg.run.err.trace.txt | tee -a $prg.run.trace.txt
echo "(done)"
fi
done
}
#
if [ "$#" -eq 0 ]
then
make clean
p_main -f $prglst_f
p_main -x $prglst_x
else
ft=$1
shift
#
case "$ft"
in
-f)
p_main $ft $@
;;
-x)
p_main $ft $@
;;
*)
e1="$e0b$ft ..."
p_print1 "$e1" "$e0c" "$e0d"
;;
esac
#
fi
#
+67
View File
@@ -0,0 +1,67 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. TEST1.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
* SPECIAL-NAMES.
* DECIMAL-POINT IS COMMA.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 XX.
05 X1 PIC 9(4) VALUE 0.
05 X2 PIC 9(4) VALUE 0.
01 W01-COMPUTE-E PIC S9(5)V99 USAGE COMP VALUE 99876.
01 W01-COMPUTE-E PIC S9(5)V99 USAGE COMP VALUE 99876.
01 W01-COMPUTE-X PIC X(50) VALUE "aaaaaaaaaaaaaaaaaaaaaaaaaaa
- "bbbbbbbbbbbbbbbbbbbbbbb".
01 W01-COMPUTE-Y PIC X(54) VALUE "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
- "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
- "ccccccccccccccccccccccc".
01 W01-COMPUTE-Z PIC X(54) VALUE "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
- "bbbbbbbbbbbbbbbbbbbbbbb".
* CoPy 'TEST02.cpy' IN TESTLIB REPLACING
* W01-COMPUTE-E BY W01-COMPUTE-EE
* ==9(5)== BY ==9(04)==
* ==9(6)== BY ==9(06)==
* == 02 == BY == 05 == .
* COPY 'TEST02.cpy'.
* Copy 'TEST02.cpy' IN "Test.lib" REPLACING
* COPY 'TEST02.cpy' REPLACING
COPY 'TEST02.cpy' IN TESTLIB REPLACING
W01-COMPUTE-0 BY W01-COMPUTE-00
'W01-1XXX' BY 'W01-2'
==9(5)== BY ==9(04)== .
COPY 'TEST02.cpy' IN TESTLIB REPLACING
W01-COMPUTE-0 BY 000W01-COMPUTE-000
'W01-1XXX' BY 'W01-3'
==9(5)== BY ==9(07)== .
PROCEDURE DIVISION.
A-000.
* READY TRACE.
D DISPLAY "READY TRACE".
PERFORM A-100.
D DISPLAY "RESET TRACE".
* RESET TRACE.
STOP RUN.
A-100.
DISPLAY "ENTER A-100".
MOVE 1 TO X1.
ADD 1 TO X1.
MOVE X1 TO X2.
DISPLAY "EXIT A-100".
+64
View File
@@ -0,0 +1,64 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. TEST2.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
* SPECIAL-NAMES.
* DECIMAL-POINT IS COMMA.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 XX.
05 X1 PIC 9(4) VALUE 0.
05 X2 PIC 9(4) VALUE 0.
05 X3 PIC 9(4)V99 VALUE .33.
01 W01-COMPUTE-C PIC X(54) VALUE 'fffffff '
&
'ggggggggggggggggggggggg '
&
'hhhhhhhhhhhhhhhhhhhhhhh '.
01 W01-COMPUTE-E PIC S9(5)V99 USAGE COMP VALUE 99876.
* COPY TEST02D.
* COPY TEST02E IN TEST-LIB.
* COPY 'copybooks2/TEST02F'.
* COPY 'copybooks2/TEST02F' IN TEST-LIB.
* COPY '/root/copybooks2/TEST02F' IN TEST-LIB.
* COPY '/root/copybooks2/TEST02F'.
* COPY /root/copybooks2/TEST02F.
* COPY TEST02C.cpy .
COPY TEST02C.
COPY TEST02 IN TESTLIB REPLACING
W01-COMPUTE-0 BY W01-COMPUTE-00,
'W01-1XXX' BY 'W01-2',
==9(5)== BY ==9(04)== .
COPY TEST02 IN TESTLIB REPLACING
W01-COMPUTE-0 BY W01-COMPUTE-000
'W01-1XXX' BY 'W01-3'
==9(5)== BY ==9(07)== .
PROCEDURE DIVISION.
A-000.
* READY TRACE.
PERFORM A-100.
* RESET TRACE.
STOP RUN.
A-100.
DISPLAY "ENTER A-100".
MOVE 1 TO X1.
ADD 1 TO X1.
MOVE X1 TO X2.
DISPLAY "EXIT A-100".
+54
View File
@@ -0,0 +1,54 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. TEST3.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
* SPECIAL-NAMES.
* DECIMAL-POINT IS COMMA.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
REPLACE ==9(5)== BY ==9(07)==.
01 XX.
05 X1 PIC 9(4) VALUE 0.
05 X2 PIC 9(4) VALUE 0.
05 X3 PIC 9(4)V99 VALUE .33.
01 W01-COMPUTE-E PIC S9(5)V99 USAGE COMP VALUE 99876.
01 W01-CATSTR PIC X(30) VALUE "0123456789" &
"0123456789" & *< test of in-line comment
"0123456789".
* COPY 'TEST02C.cpy' .
COPY TEST02C.
COPY TEST02 IN TESTLIB REPLACING
W01-COMPUTE-0 BY W01-COMPUTE-00,
'W01-1XXX' BY 'W01-2',
==9(5)== BY ==9(04)== .
PROCEDURE DIVISION.
A-000.
* READY TRACE.
PERFORM A-100.
* RESET TRACE.
STOP RUN.
A-100.
DISPLAY "ENTER A-100".
MOVE 1 TO X1.
ADD 1 TO X1.
MOVE X1 TO X2.
DISPLAY "EXIT A-100".