version 0.73.0
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
#
|
||||
# Makefile (MinGW) for htcobrun
|
||||
#
|
||||
|
||||
prefix=C:/TinyCOBOL
|
||||
exec_prefix=${prefix}
|
||||
|
||||
INSTALL=install.exe
|
||||
INSTALL_DATA=${INSTALL}
|
||||
|
||||
INSTBIN=${prefix}
|
||||
#INSTBIN=${prefix}/bin
|
||||
INSTRC=${prefix}/share/htcobol
|
||||
|
||||
tc_library=../lib/libhtcobol.a
|
||||
|
||||
RM=rm -f
|
||||
|
||||
CCX=gcc
|
||||
|
||||
INCLUDES=-I../lib -I..
|
||||
LIBS=-L/usr/local/lib -L../lib -lhtcobol
|
||||
LIBS1=-L/usr/local/lib -L../lib -ldb -lpdcurses
|
||||
LIBS2=-L/usr/local/lib -L../lib -lhtcobol -ldb
|
||||
#LIBS2=-L/usr/local/lib -L../lib -lhtcobol -ldb -lpdcurses
|
||||
CCXFLAGS=${INCLUDES}
|
||||
LDFLAGS=
|
||||
|
||||
SRC1 = htcobrun.c
|
||||
SRC2 = htcobrun.c
|
||||
|
||||
OBJ1 = $(SRC1:.c=.o)
|
||||
OBJ2 = $(SRC2:.c=.o)
|
||||
|
||||
PROG1 = htcobrun2
|
||||
PROG2 = htcobrun
|
||||
PROG3 = htcobrun.sh
|
||||
|
||||
#
|
||||
# Rules for compiling C sources
|
||||
#
|
||||
.SUFFIX: .c .o .lo
|
||||
.c.o:
|
||||
$(CCX) $(CCXFLAGS) -c $<
|
||||
|
||||
|
||||
all: ${PROG2}
|
||||
#all: ${PROG1} ${PROG2}
|
||||
|
||||
# This will not compile and link on Win32 for some reason
|
||||
${PROG1}:
|
||||
${CCX} ${SRC1} -Wl,-export-dynamic -o ${PROG1} \
|
||||
${INCLUDES} -Wl,-whole-archive ${tc_library} \
|
||||
-Wl,-no-whole-archive $(LIBS1)
|
||||
|
||||
${PROG2}: ${OBJ2}
|
||||
$(CCX) -o $@ ${OBJ2} $(LDFLAGS) $(LIBS2)
|
||||
|
||||
clean:
|
||||
@${RM} ${OBJ1} ${OBJ2} ${PROG1}.exe ${PROG2}.exe \
|
||||
*.exe *.def *.o *.lis *.i *.s core
|
||||
|
||||
#install: $(PROG1) $(PROG2)
|
||||
install: $(PROG2)
|
||||
# strip $(PROG1)
|
||||
# ${INSTALL} -m 755 $(PROG1) $(INSTBIN)/$(PROG1)
|
||||
strip $(PROG2).exe
|
||||
${INSTALL} $(PROG2).exe $(INSTBIN)/$(PROG2).exe
|
||||
# ${INSTALL} -m 755 $(PROG3) $(INSTBIN)/$(PROG3)
|
||||
@@ -0,0 +1,70 @@
|
||||
#
|
||||
# Makefile for htcobrun
|
||||
#
|
||||
|
||||
SHELL=/bin/sh
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
|
||||
INSTALL=@INSTALL@
|
||||
INSTALL_DATA=@INSTALL_DATA@
|
||||
|
||||
INSTBIN=@cobbin_default@
|
||||
INSTRC=@cobdir_default@
|
||||
|
||||
tc_library=../lib/libhtcobol.a
|
||||
|
||||
RM=rm -f
|
||||
|
||||
CCX=@CC@
|
||||
|
||||
INCLUDES=-I../lib -I../
|
||||
LIBS=
|
||||
LIBS1=-lncurses -ldb -lm -ldl
|
||||
LIBS2=-L../lib -lhtcobol -lncurses -ldb -lm -ldl
|
||||
LDFLAGS=
|
||||
CCXFLAGS=${INCLUDES}
|
||||
|
||||
|
||||
SRC1 = htcobrun.c
|
||||
SRC2 = htcobrun.c
|
||||
|
||||
OBJ1 = $(SRC1:.c=.o)
|
||||
OBJ2 = $(SRC2:.c=.o)
|
||||
|
||||
PROG1 = htcobrun
|
||||
PROG2 = htcobrun2
|
||||
PROG3 = htcobrun.sh
|
||||
|
||||
#
|
||||
# Rules for compiling .c sources
|
||||
#
|
||||
.SUFFIX: .c .o
|
||||
.c.o:
|
||||
$(CCX) $(CCXFLAGS) -c $<
|
||||
|
||||
|
||||
#all: ${PROG1} ${PROG2}
|
||||
all: ${PROG1}
|
||||
|
||||
# Static library version
|
||||
${PROG1}:
|
||||
${CCX} ${SRC1} -Wl,-export-dynamic -o ${PROG1} \
|
||||
${INCLUDES} -Wl,-whole-archive ${tc_library} \
|
||||
-Wl,-no-whole-archive $(LIBS1)
|
||||
|
||||
# Shared library version
|
||||
${PROG2}: ${OBJ2}
|
||||
$(CCX) -o $@ ${OBJ2} $(LDFLAGS1) $(LIBS2)
|
||||
|
||||
clean:
|
||||
@${RM} ${OBJ1} ${OBJ2} ${PROG1} ${PROG2} *.o *.s core
|
||||
|
||||
#install: $(PROG1) $(PROG2)
|
||||
install: $(PROG1)
|
||||
strip $(PROG1)
|
||||
${INSTALL} -m 755 $(PROG1) $(INSTBIN)/$(PROG1)
|
||||
# strip $(PROG2)
|
||||
# ${INSTALL} -m 755 $(PROG2) $(INSTBIN)/$(PROG2)
|
||||
# ${INSTALL} -m 755 $(PROG3) $(INSTBIN)/$(PROG3)
|
||||
@@ -0,0 +1,69 @@
|
||||
#
|
||||
# Makefile (MinGW) for htcobrun
|
||||
#
|
||||
|
||||
prefix=@install_dir@
|
||||
exec_prefix=${prefix}
|
||||
|
||||
INSTALL=install.exe
|
||||
INSTALL_DATA=${INSTALL}
|
||||
|
||||
INSTBIN=${prefix}
|
||||
#INSTBIN=${prefix}/bin
|
||||
INSTRC=${prefix}/share/htcobol
|
||||
|
||||
tc_library=../lib/libhtcobol.a
|
||||
|
||||
RM=rm -f
|
||||
|
||||
CCX=gcc
|
||||
|
||||
INCLUDES=-I../lib -I..
|
||||
LIBS=-L/usr/local/lib -L../lib -lhtcobol
|
||||
LIBS1=-L/usr/local/lib -L../lib -ldb -lpdcurses
|
||||
LIBS2=-L/usr/local/lib -L../lib -lhtcobol -ldb
|
||||
#LIBS2=-L/usr/local/lib -L../lib -lhtcobol -ldb -lpdcurses
|
||||
CCXFLAGS=${INCLUDES}
|
||||
LDFLAGS=
|
||||
|
||||
SRC1 = htcobrun.c
|
||||
SRC2 = htcobrun.c
|
||||
|
||||
OBJ1 = $(SRC1:.c=.o)
|
||||
OBJ2 = $(SRC2:.c=.o)
|
||||
|
||||
PROG1 = htcobrun2
|
||||
PROG2 = htcobrun
|
||||
PROG3 = htcobrun.sh
|
||||
|
||||
#
|
||||
# Rules for compiling C sources
|
||||
#
|
||||
.SUFFIX: .c .o .lo
|
||||
.c.o:
|
||||
$(CCX) $(CCXFLAGS) -c $<
|
||||
|
||||
|
||||
all: ${PROG2}
|
||||
#all: ${PROG1} ${PROG2}
|
||||
|
||||
# This will not compile and link on Win32 for some reason
|
||||
${PROG1}:
|
||||
${CCX} ${SRC1} -Wl,-export-dynamic -o ${PROG1} \
|
||||
${INCLUDES} -Wl,-whole-archive ${tc_library} \
|
||||
-Wl,-no-whole-archive $(LIBS1)
|
||||
|
||||
${PROG2}: ${OBJ2}
|
||||
$(CCX) -o $@ ${OBJ2} $(LDFLAGS) $(LIBS2)
|
||||
|
||||
clean:
|
||||
@${RM} ${OBJ1} ${OBJ2} ${PROG1}.exe ${PROG2}.exe \
|
||||
*.exe *.def *.o *.lis *.i *.s core
|
||||
|
||||
#install: $(PROG1) $(PROG2)
|
||||
install: $(PROG2)
|
||||
# strip $(PROG1)
|
||||
# ${INSTALL} -m 755 $(PROG1) $(INSTBIN)/$(PROG1)
|
||||
strip $(PROG2).exe
|
||||
${INSTALL} $(PROG2).exe $(INSTBIN)/$(PROG2).exe
|
||||
# ${INSTALL} -m 755 $(PROG3) $(INSTBIN)/$(PROG3)
|
||||
@@ -0,0 +1,73 @@
|
||||
#
|
||||
# Makefile for htcobrun
|
||||
#
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=${prefix}
|
||||
|
||||
INSTALL=@INSTALL@
|
||||
INSTALL_DATA=@INSTALL_DATA@
|
||||
|
||||
INSTBIN=@cobbin_default@
|
||||
INSTRC=@cobdir_default@
|
||||
|
||||
tc_library=..\lib\libhtcobol.a
|
||||
|
||||
RM=@RM@
|
||||
|
||||
EXEEXT=@exeext@
|
||||
|
||||
CCX=@CC@
|
||||
|
||||
INCLUDES=@INCLUDES@
|
||||
LIBS=@LIBS@ @htg_ld_args_htcobol@ @htg_ld_args_db@ @htg_ld_args_curses@
|
||||
LIBS1=@LIBS@ @htg_ld_args_db@ @htg_ld_args_curses@
|
||||
LIBS2=@LIBS@ @htg_ld_args_htcobol@
|
||||
LDFLAGS=
|
||||
CCXFLAGS=${INCLUDES}
|
||||
|
||||
|
||||
SRC1 = htcobrun.c
|
||||
|
||||
OBJ1 = $(SRC1:.c=.o)
|
||||
|
||||
PROG1 = htcobrun1$(EXEEXT)
|
||||
PROG2 = htcobrun$(EXEEXT)
|
||||
|
||||
|
||||
#
|
||||
# Rules for compiling .c sources
|
||||
#
|
||||
.SUFFIX: .c .o
|
||||
.c.o:
|
||||
$(CCX) $(CCXFLAGS) -c $<
|
||||
|
||||
|
||||
all: ${PROG2}
|
||||
#all: ${PROG1} ${PROG2}
|
||||
|
||||
# This program does not properly initialize the RTL on Win32
|
||||
# Does not display the COMMAND-LINE
|
||||
${PROG1}: ${OBJ1} ${tc_library}
|
||||
${CCX} ${OBJ1} -Wl,-export-dynamic -o ${PROG1} \
|
||||
${INCLUDES} -Wl,-whole-archive ${tc_library} \
|
||||
-Wl,-no-whole-archive $(LIBS1)
|
||||
|
||||
${PROG2}: ${OBJ1}
|
||||
$(CCX) -o $@ ${OBJ1} $(LDFLAGS) $(LIBS2)
|
||||
|
||||
clean:
|
||||
@${RM} ${OBJ1} ${PROG1}.exe ${PROG2}.exe \
|
||||
*.exe *.def *.o *.lis *.i *.s core
|
||||
|
||||
install: install-prog
|
||||
|
||||
install-prog: $(PROG2)
|
||||
strip $(PROG2)
|
||||
${INSTALL} $(PROG2) $(INSTBIN)\$(PROG2)
|
||||
|
||||
uninstall: uninstall-prog
|
||||
|
||||
uninstall-prog:
|
||||
${RM} $(INSTBIN)\$(PROG2)
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
Abstract:
|
||||
|
||||
Program (htcobrun) to enable TC COBOL (sub)programs, or modules,
|
||||
compiled with TC as shared libraries (DLL's), to be dynamically loaded
|
||||
and run.
|
||||
|
||||
The shared library files, which can contain one or more modules, are generally
|
||||
stored in a directory.
|
||||
|
||||
The TC run-time will use the 'TCOB_LD_LIBRARY_PATH' and 'LD_LIBRARY_PATH'
|
||||
environment variables, to locate the requested (sub)program or module name.
|
||||
|
||||
Note that the (sub)programs, or module name, is the 'PROGRAM-ID' name, not
|
||||
the actual shared library file name.
|
||||
The actual file (shared library) may contain one or more modules.
|
||||
|
||||
|
||||
Why use 'htcobrun':
|
||||
|
||||
The 'htcobrun' program can be compiled to fully include the full run-time
|
||||
(static) library (Not available on MinGW version).
|
||||
This approach yields substantial runtime performance improvements.
|
||||
|
||||
The COBOL (sub)programs can be built as shared libraries, which may contain
|
||||
one or more modules, and are loaded and run dynamically.
|
||||
|
||||
Problems in using this approach:
|
||||
Currently, there is no support for passing 'LINKAGE SECTION' parameters to
|
||||
sub-programs.
|
||||
|
||||
>---------------------------------------------------------------------------<
|
||||
|
||||
How to build the program:
|
||||
make
|
||||
Modify the 'htcobrun.sh' as required.
|
||||
make install (su required)
|
||||
|
||||
>---------------------------------------------------------------------------<
|
||||
|
||||
How to run an application:
|
||||
|
||||
You can use the 'htcobrun' program directly or use the sample
|
||||
shell script 'htcobrun.sh' provided.
|
||||
|
||||
To use the 'htcobrun' program directly, first set the modules location(s).
|
||||
|
||||
Example:
|
||||
$LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
|
||||
$TCOB_LD_LIBRARY_PATH=.
|
||||
$export TCOB_LD_LIBRARY_PATH LD_LIBRARY_PATH
|
||||
$htcobrun dyntest
|
||||
|
||||
To use the sample shell script 'htcobrun.sh', edit the script and set
|
||||
the modules location(s).
|
||||
|
||||
Example:
|
||||
$edit tcobrun.sh
|
||||
...
|
||||
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
|
||||
TCOB_LD_LIBRARY_PATH=.
|
||||
export TCOB_LD_LIBRARY_PATH LD_LIBRARY_PATH
|
||||
...
|
||||
$htcobrun.sh dyntest
|
||||
|
||||
>---------------------------------------------------------------------------<
|
||||
|
||||
Notes:
|
||||
|
||||
The current version of TC will substitute a 'main' entry point, for the
|
||||
name of the COBOL program, if it does not detect a 'USING' clause in
|
||||
the 'PROCEDURE DIVISION'.
|
||||
|
||||
Also the 'ACCEPT identifier FROM COMMAND-LINE' statement, will not work when
|
||||
when COBOL programs are compiled as modules.
|
||||
|
||||
These problems will be corrected in the future
|
||||
|
||||
The MinGW version can only be compiled and run using the TC run-time as a
|
||||
DLL (not static).
|
||||
|
||||
>---------------------------------------------------------------------------<
|
||||
|
||||
Original OpenCOBOL mailing-list posting:
|
||||
|
||||
Subject: [open-cobol-list] Open Cobol Optimization
|
||||
Date: Sun, 16 Nov 2003 17:16:22 +0100
|
||||
|
||||
Keisuke asked me to post this info - so here it is.
|
||||
Note - Applies to Linux
|
||||
|
||||
In an effort to get the same performance as MF, I noticed
|
||||
that we are heavily bouncing in and out of the shared libs.
|
||||
So I came up with this. "cobcrun" is a driver prog used to
|
||||
call the Cobol prog.
|
||||
(This is equivalent to MF's "cobrun" and ACU's "runcbl").
|
||||
It pulls in the complete static versions of libcob and libgmp.
|
||||
|
||||
The difference in runtime performance is astounding !
|
||||
|
||||
This also has a useful side effect in that all Cobol progs
|
||||
can be compiled as modules.
|
||||
(And therefore we do not need to work out which are main progs
|
||||
and which are sub-progs for the compile)
|
||||
(Note in cobcrun, that I move out argv0, otherwise we would
|
||||
have to do some fancy checking for the command line accept)
|
||||
(Note this is a quick and dirty, must do more checking)
|
||||
|
||||
In addition, with GCC > 3, you can tweak a bit more by passing
|
||||
CFLAGS="-march=pentium3 -minline-all-stringops" (for P3 - arch=pentium4 for P4)
|
||||
into the Open Cobol configure and also into the program compiles.
|
||||
|
||||
Here's cobcrun.c :
|
||||
#include <stdio.h>
|
||||
extern void *cob_resolve (const char *name);
|
||||
extern void cob_call_error (void);
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int ret;
|
||||
int (*func)();
|
||||
char *argn[64];
|
||||
|
||||
if ( argc <= 1 ) {
|
||||
fprintf(stderr, "No parameters specified\n");
|
||||
return 1;
|
||||
}
|
||||
for ( ret = 1; ret < argc; ret++ ) {
|
||||
argn[ret - 1] = argv[ret];
|
||||
}
|
||||
cob_init (argc - 1, argn);
|
||||
func = cob_resolve (argn[0]);
|
||||
if (func == NULL) {
|
||||
cob_call_error ();
|
||||
} else {
|
||||
ret = func ();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
And here's the compile/link for it :
|
||||
gcc -rdynamic -Wl,-export-dynamic -O2 -o cobcrun \
|
||||
cobcrun.c -Wl,-whole-archive /usr/local/lib/libcob.a \
|
||||
/usr/lib/libgmp.a -Wl,-no-whole-archive -lltdl -ldb -lncurses -lm
|
||||
|
||||
Keisuke has indicated that something like this will be included in the next
|
||||
release.
|
||||
|
||||
Comments welcome.
|
||||
|
||||
Regards
|
||||
|
||||
Roger While
|
||||
Binary file not shown.
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// Copyright (C) 2004-2005 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
|
||||
//
|
||||
// HTCOBRUN is a program to load and run TinyCOBOL modules (shared-libraries)
|
||||
//
|
||||
// This source is derived from a posting on the OpenCOBOL mailing-list by Roger While.
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
#include "htcoblib.h"
|
||||
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
int r;
|
||||
int (*func)();
|
||||
char modname[255], *argn[64];
|
||||
struct fld_desc fds;
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "ERROR: Module parameter not specified\n");
|
||||
r = 1;
|
||||
}
|
||||
else {
|
||||
if (argc > 65) {
|
||||
fprintf(stderr, "ERROR: Number of parameter specified is %d, max is 64\n");
|
||||
r = 2;
|
||||
}
|
||||
else {
|
||||
for (r = 1; r < argc; r++) {
|
||||
argn[r - 1] = argv[r];
|
||||
}
|
||||
tcob_init(argc - 1, argn);
|
||||
strcpy(modname, argv[1]);
|
||||
fds.len = strlen(argv[1]);
|
||||
func = tcob_resolve_subr(&fds, modname, 0);
|
||||
if (func == NULL) {
|
||||
fprintf(stderr, "ERROR: Failed to resolve module \'%s\'\n", modname);
|
||||
r = 3;
|
||||
}
|
||||
else {
|
||||
r = func();
|
||||
// If it returns then a 'STOP RUN" was not executed,
|
||||
// and the run-time elements need to be cleaned.
|
||||
tcob_stop_run();
|
||||
}
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Shell script to load and run TC (sub)programs or modules
|
||||
# cmd: htcobrun.sh module [ arg1 ... argN ]
|
||||
# David Essex April 2005
|
||||
#
|
||||
prg=../htcobrun
|
||||
#prg=../htcobrun2
|
||||
#
|
||||
# Add the shared library paths to search
|
||||
# for the (sub)programs or modules
|
||||
#
|
||||
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
|
||||
TCOB_LD_LIBRARY_PATH=.
|
||||
export TCOB_LD_LIBRARY_PATH LD_LIBRARY_PATH
|
||||
#
|
||||
$prg $@
|
||||
#
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// Copyright (C) 2004-2005 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 _TCOBRUNHELP_H
|
||||
#define _TCOBRUNHELP_H
|
||||
|
||||
//#ifdef TCOBPP_LANGUAGE_en
|
||||
//#ifdef TCOBPP_LANGUAGE_fr
|
||||
//#ifdef TCOBPP_LANGUAGE_it
|
||||
//#ifdef TCOBPP_LANGUAGE_pt_BR
|
||||
//#endif
|
||||
|
||||
/* Usage list */
|
||||
/* Usage: %s [options] cobol-module [command-line-parms]\n" */
|
||||
static char usage_list0[] = { "[options] cobol-module [command-line-parms]\n" };
|
||||
static char usage_list1[] = { "where [options] are:\n\
|
||||
-h Help (display this listing)\n\
|
||||
-V Display version and exit\n\
|
||||
" };
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef _TCOBRUN_VERSION_H
|
||||
#define _TCOBRUN_VERSION_H
|
||||
|
||||
#define TCOBRUN_MAJOR_VERSION "@TCOBRUN_MAJOR_VERSION@"
|
||||
#define TCOBRUN_MINOR_VERSION "@TCOBRUN_MINOR_VERSION@"
|
||||
#define TCOBRUN_PATCH_LEVEL "@TCOBRUN_PATCH_LEVEL@"
|
||||
#define TCOBRUN_VERSION "@TCOBRUN_VERSION@"
|
||||
#define TCOBRUN_RELEASE_DATE "@TCOBRUN_RELEASE_DATE@"
|
||||
|
||||
#define TCOBRUN_PGM_VERSION "alpha @TCOBRUN_VERSION@ (@host_os@ @TCOBRUN_RELEASE_DATE@)"
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,4 @@
|
||||
TCOBRUN_MAJOR_VERSION=0
|
||||
TCOBRUN_MINOR_VERSION=7
|
||||
TCOBRUN_PATCH_LEVEL=1
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
#
|
||||
prefix=..
|
||||
exec_prefix=${prefix}/share/htcobol
|
||||
g_includes=-I../lib -I../
|
||||
g_libraries=-L../lib
|
||||
tc_library=../lib
|
||||
|
||||
lib_name1=dyntest
|
||||
lib_name2=subrots
|
||||
|
||||
CCX=gcc -g
|
||||
#COB=${exec_prefix}/htcobol
|
||||
COB=htcobol
|
||||
RM=rm -f
|
||||
|
||||
COPYBOOKS= -I../copybooks -I.
|
||||
INCLUDES= ${g_includes}
|
||||
LIBS=
|
||||
#LIBS=-lncurses -ldb -lm -ldl
|
||||
#LIBS=${g_libraries} -lhtcobol -lncurses -ldb -lm -ldl
|
||||
LDFLAGS=
|
||||
COBFLAGS=-P -M none ${COPYBOOKS}
|
||||
CCXFLAGS=${INCLUDES}
|
||||
|
||||
SHARED_LIB1=${lib_name1}.so
|
||||
SHARED_LIB2=${lib_name2}.so
|
||||
|
||||
SHARED_LIBS=${SHARED_LIB2} ${SHARED_LIB1}
|
||||
|
||||
SRC3 = dyntest.cob
|
||||
SRC4 = subrots.cob
|
||||
|
||||
OBJ3 = $(SRC3:.cob=.o)
|
||||
OBJ4 = $(SRC4:.cob=.o)
|
||||
|
||||
|
||||
#include ${prefix}/config/C.rules.in
|
||||
#include ${prefix}/config/COB.rules.in
|
||||
#
|
||||
# Rules for compiling .c .s sources
|
||||
#
|
||||
.SUFFIX: .c .o
|
||||
.c.o:
|
||||
$(CCX) $(CCXFLAGS) -c $<
|
||||
|
||||
#
|
||||
# Rules for compiling COBOL sources
|
||||
.SUFFIX: .cob .cbl .o
|
||||
|
||||
%.o: %.cob
|
||||
$(COB) -c $(COBFLAGS) $<
|
||||
# $(COB) $(COBFLAGS) $<
|
||||
|
||||
|
||||
%.o: %.cbl
|
||||
$(COB) -c $(COBFLAGS) $<
|
||||
# $(COB) $(COBFLAGS) $<
|
||||
#
|
||||
|
||||
|
||||
all: ${SHARED_LIB1} ${SHARED_LIB2}
|
||||
|
||||
|
||||
${SHARED_LIB1}: ${OBJ3}
|
||||
gcc -shared -Wl,-soname,${SHARED_LIB1} -o ${SHARED_LIB1} $(OBJ3) $(LIBS)
|
||||
|
||||
${SHARED_LIB2}: ${OBJ4}
|
||||
gcc -shared -Wl,-soname,${SHARED_LIB2} -o ${SHARED_LIB2} $(OBJ4) $(LIBS)
|
||||
|
||||
clean:
|
||||
@${RM} ${OBJ3} ${OBJ4} ${SHARED_LIB1} ${SHARED_LIB2} \
|
||||
*.o *.lis *.i *.s core
|
||||
@@ -0,0 +1,71 @@
|
||||
|
||||
prefix=..
|
||||
exec_prefix=${prefix}/share/htcobol
|
||||
g_includes=-I../lib -I../
|
||||
g_libraries=-L/usr/local/lib -L../lib
|
||||
tc_library=../lib
|
||||
|
||||
lib_name1=dyntest
|
||||
lib_name2=subrots
|
||||
|
||||
CCX=gcc
|
||||
#COB=${exec_prefix}/htcobol
|
||||
COB=htcobol
|
||||
RM=rm -f
|
||||
|
||||
COPYBOOKS= -I../copybooks -I.
|
||||
INCLUDES= ${g_includes}
|
||||
LIBS=${g_libraries} -lhtcobol
|
||||
#LIBS=${g_libraries} -ldb -lpdcurses
|
||||
#LIBS=${g_libraries} -lhtcobol -ldb -lpdcurses
|
||||
COBFLAGS=-P -M none ${COPYBOOKS}
|
||||
CCXFLAGS=${INCLUDES}
|
||||
LDFLAGS=
|
||||
|
||||
SHARED_LIB1=${lib_name1}.dll
|
||||
SHARED_LIB2=${lib_name2}.dll
|
||||
|
||||
SHARED_LIBS=${lib_name1}.dll ${lib_name2}.dll
|
||||
|
||||
SRC3 = dyntest.cob
|
||||
SRC4 = subrots.cob
|
||||
|
||||
OBJ3 = $(SRC3:.cob=.o)
|
||||
OBJ4 = $(SRC4:.cob=.o)
|
||||
|
||||
|
||||
#include ${prefix}/config/C.rules.in
|
||||
#include ${prefix}/config/COB.rules.in
|
||||
|
||||
#
|
||||
# Rules for compiling C sources
|
||||
#
|
||||
.SUFFIX: .c .o
|
||||
.c.o:
|
||||
$(CCX) $(CCXFLAGS) -c $<
|
||||
|
||||
#
|
||||
# Rules for compiling COBOL sources
|
||||
#
|
||||
.SUFFIX: .cob .cbl .o
|
||||
%.o: %.cob
|
||||
$(COB) -c $(COBFLAGS) $<
|
||||
|
||||
|
||||
%.o: %.cbl
|
||||
$(COB) -c $(COBFLAGS) $<
|
||||
|
||||
|
||||
all: ${SHARED_LIB1} ${SHARED_LIB2}
|
||||
|
||||
|
||||
${SHARED_LIB1}: ${OBJ3}
|
||||
${CCX} -shared -Wl,--out-implib,${lib_name1}.dll.a,--output-def,${lib_name1}.def -o ${SHARED_LIB1} $(OBJ3) ${LIBS}
|
||||
|
||||
${SHARED_LIB2}: ${OBJ4}
|
||||
${CCX} -shared -Wl,--out-implib,${lib_name2}.dll.a,--output-def,${lib_name2}.def -o ${SHARED_LIB2} $(OBJ4) ${LIBS}
|
||||
|
||||
clean:
|
||||
@${RM} ${OBJ3} ${OBJ4} ${SHARED_LIB1} ${SHARED_LIB2} \
|
||||
*.exe *.def *.o *.lis *.i *.s core
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
Abstract:
|
||||
|
||||
Sample application on how to build and run (sub)programs or modules,
|
||||
using the 'htcobrun' program.
|
||||
|
||||
Note:
|
||||
The (sub)programs or module name is the 'PROGRAM-ID' name, not the actual
|
||||
file name.
|
||||
The actual file (shared library) may contain one or more modules.
|
||||
|
||||
>---------------------------------------------------------------------------<
|
||||
|
||||
How to build the sample application:
|
||||
make
|
||||
|
||||
>---------------------------------------------------------------------------<
|
||||
|
||||
How to run an application:
|
||||
|
||||
You can use the 'htcobrun' program directly or use the sample
|
||||
shell script 'tcobrun.sh' provided.
|
||||
|
||||
To use the 'htcobrun' program directly, first set the modules location(s).
|
||||
|
||||
Example:
|
||||
$LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
|
||||
$TCOB_LD_LIBRARY_PATH=.
|
||||
$export TCOB_LD_LIBRARY_PATH LD_LIBRARY_PATH
|
||||
$htcobrun dyntest
|
||||
|
||||
To use the sample shell script 'tcobrun.sh', edit the script and set
|
||||
the modules location(s).
|
||||
|
||||
Example:
|
||||
$edit tcobrun.sh
|
||||
...
|
||||
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
|
||||
TCOB_LD_LIBRARY_PATH=.
|
||||
export TCOB_LD_LIBRARY_PATH LD_LIBRARY_PATH
|
||||
...
|
||||
$tcobrun.sh dyntest
|
||||
|
||||
>---------------------------------------------------------------------------<
|
||||
|
||||
Notes:
|
||||
|
||||
The current version of TC will substitute a 'main' entry point, for the
|
||||
name of the COBOL program, if it does not detect a 'USING' clause in
|
||||
the 'PROCEDURE DIVISION'.
|
||||
|
||||
Also the 'ACCEPT identifier FROM COMMAND-LINE' statement, will not work when
|
||||
when COBOL programs are compiled as modules.
|
||||
|
||||
These problems will be corrected in the future
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. dyntest.
|
||||
*
|
||||
ENVIRONMENT DIVISION.
|
||||
DATA DIVISION.
|
||||
*
|
||||
WORKING-STORAGE SECTION.
|
||||
01 VAR-1 PIC X(10) VALUE '*ARGUMENT*'.
|
||||
01 VAR-2 PIC X(10) VALUE 'RILDO'.
|
||||
01 VAR-3 PIC X(10) VALUE 'Pragana'.
|
||||
01 VAR-4 PIC X(10) VALUE 'Recife'.
|
||||
01 SUBR-NAME.
|
||||
05 SUBR-PREFIX PIC X(4) VALUE "subr".
|
||||
05 SUBR-NUMBER PIC 9(2) VALUE zeros.
|
||||
|
||||
LINKAGE SECTION.
|
||||
01 DUMMY-VAR PIC X(10).
|
||||
|
||||
* PROCEDURE DIVISION USING DUMMY-VAR.
|
||||
PROCEDURE DIVISION.
|
||||
|
||||
* Win32 Only: Load DLL so that sub-programs can be found
|
||||
* CALL-LOADLIB "subrots.dll".
|
||||
** CALL-LOADLIB "dyntest.dll".
|
||||
|
||||
MOVE 1 TO SUBR-NUMBER
|
||||
CALL SUBR-NAME USING VAR-1.
|
||||
* call several times to see if it was registered
|
||||
* (not a benchmark, but it may be interesting to have one)
|
||||
CALL SUBR-NAME USING VAR-1.
|
||||
CALL SUBR-NAME USING VAR-1.
|
||||
CALL SUBR-NAME USING VAR-1.
|
||||
|
||||
ADD 1 TO SUBR-NUMBER
|
||||
* CALL SUBR-NAME USING VAR-2.
|
||||
* CALL SUBR-NAME USING VAR-2
|
||||
CALL SUBR-NAME
|
||||
ON EXCEPTION PERFORM C-100
|
||||
NOT ON EXCEPTION PERFORM D-100.
|
||||
|
||||
ADD 1 TO SUBR-NUMBER
|
||||
CALL SUBR-NAME USING VAR-3.
|
||||
|
||||
* the following subr does not exists and should give us an error
|
||||
ADD 1 TO SUBR-NUMBER
|
||||
CALL SUBR-NAME USING VAR-4.
|
||||
|
||||
ADD 1 TO SUBR-NUMBER.
|
||||
CALL SUBR-NAME USING VAR-4
|
||||
ON OVERFLOW PERFORM E-100.
|
||||
|
||||
ADD 1 TO SUBR-NUMBER.
|
||||
CALL SUBR-NAME USING VAR-4
|
||||
ON EXCEPTION PERFORM C-100.
|
||||
|
||||
MOVE 22 TO RETURN-CODE.
|
||||
|
||||
STOP RUN.
|
||||
|
||||
C-100.
|
||||
|
||||
DISPLAY "EXCEPTION condition has occured in calling program SUBR-NAME=" SUBR-NAME.
|
||||
|
||||
D-100.
|
||||
|
||||
DISPLAY "EXCEPTION condition has NOT occured in calling program SUBR-NAME=" SUBR-NAME.
|
||||
|
||||
E-100.
|
||||
|
||||
DISPLAY "OVERFLOW condition has occured in calling program SUBR-NAME=" SUBR-NAME.
|
||||
|
||||
END PROGRAM dyntest.
|
||||
|
||||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. subr03.
|
||||
*
|
||||
ENVIRONMENT DIVISION.
|
||||
DATA DIVISION.
|
||||
*
|
||||
WORKING-STORAGE SECTION.
|
||||
|
||||
LINKAGE SECTION.
|
||||
01 VAR PIC X(10).
|
||||
|
||||
PROCEDURE DIVISION USING VAR.
|
||||
DISPLAY "IN subr03, received: " VAR.
|
||||
DISPLAY "This subroutine (subr03) is inside the main module."
|
||||
EXIT PROGRAM.
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. subr01.
|
||||
*
|
||||
ENVIRONMENT DIVISION.
|
||||
DATA DIVISION.
|
||||
*
|
||||
WORKING-STORAGE SECTION.
|
||||
|
||||
LINKAGE SECTION.
|
||||
01 VAR PIC X(10).
|
||||
|
||||
PROCEDURE DIVISION USING VAR.
|
||||
DISPLAY "IN subr01, received: " VAR.
|
||||
EXIT PROGRAM.
|
||||
END PROGRAM subr01.
|
||||
|
||||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. subr02.
|
||||
*
|
||||
ENVIRONMENT DIVISION.
|
||||
DATA DIVISION.
|
||||
*
|
||||
WORKING-STORAGE SECTION.
|
||||
01 CMDLINE-PARMS PIC X(50).
|
||||
|
||||
* LINKAGE SECTION.
|
||||
* 01 VAR PIC X(10).
|
||||
|
||||
* PROCEDURE DIVISION USING VAR.
|
||||
PROCEDURE DIVISION.
|
||||
* DISPLAY "IN subr02, received: " VAR.
|
||||
DISPLAY "IN subr02".
|
||||
ACCEPT CMDLINE-PARMS FROM COMMAND-LINE.
|
||||
DISPLAY "IN subr02, COMMAND-LINE=" CMDLINE-PARMS.
|
||||
MOVE 2 TO RETURN-CODE.
|
||||
EXIT PROGRAM.
|
||||
END PROGRAM subr02.
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Shell script to run htcobrun modules (programs)
|
||||
# cmd: tcobrun.sh module [ arg1 ... argN ]
|
||||
# David Essex April 2005
|
||||
#
|
||||
prg=../htcobrun
|
||||
#prg=../htcobrun2
|
||||
#
|
||||
# Export shared library paths
|
||||
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
|
||||
TCOB_LD_LIBRARY_PATH=.
|
||||
export TCOB_LD_LIBRARY_PATH LD_LIBRARY_PATH
|
||||
#
|
||||
#echo "$prg $@"
|
||||
#$prg dyntest
|
||||
$prg $@
|
||||
#
|
||||
echo "return code=$?"
|
||||
#
|
||||
Reference in New Issue
Block a user