More freebies
Posted in 1994
I enclose a shell archive containing the source to an alternative I4GL compilation system (which I call j4gl), designed for use with make and friends. The attached makefile contains a minimal set of suffix rules for compiling the program, which can be made for use with c-code (default) or p-code. To build the p-code version, type "make rds"; for the c-code version, type either "make" or "make c4gl". As you can see from the SCCS versions, the only thing which has changed in the last two years is the makefile. You only need to install the j4gl shell script somewhere on your path; it is designed to find the forms where you compile them. There is no manual for j4gl (oops!), but it should be self-explanatory. I trust this is of some help to someone. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> : "@(#)shar.sh 1.11 94/10/04" #! /bin/sh # # This is a shell archive. # Remove everything above this line and run sh on the resulting file. # If this archive is complete, you will see this message at the end: # "All files extracted" # # Created: Wed Nov 30 13:52:55 PST 1994 by johnl at Informix Software Inc # Files archived in this archive: # access.c # checkint.4gl # fgiusr.c # findstr.4gl # getopt.4gl # instring.4gl # j4gl.sh # j4glfile.4gl # j4glform.4gl # j4glglob.4gl # j4glinpt.4gf # j4glmain.4gl # j4glopts.4gf # makefile # popstr.c # shell.4gl # #-------------------- if [ -f access.c -a "$1" != "-c" ] then echo shar: access.c already exists else echo 'x - access.c (464 characters)' sed -e 's/^X//' >access.c <<'SHAR-EOF' X/* X@(#) File: access.c X@(#) Version: 1.1 X@(#) Last changed: 88/09/26 X@(#) Purpose: I4GL interface to access(2) X@(#) Author: J Leffler X*/ X X#define I4GL_C int /* Interface to C from I4GL */ X X#ifndef lint Xstatic char sccs[] = "@(#)access.c 1.1 88/09/26"; X#endif X XI4GL_C file_access(n) Xint n; X{ X char file[512]; X int mode; X X if (n != 2) X { X retint(-1); X return(1); X } X popint(&mode); X popstring(file, sizeof(file)); X retint(access(file, mode)); X return(1); X} SHAR-EOF chmod 444 access.c if [ `wc -c <access.c` -ne 464 ] then echo shar: access.c unpacked with wrong size fi # end of overwriting check fi #-------------------- if [ -f checkint.4gl -a "$1" != "-c" ] then echo shar: checkint.4gl already exists else echo 'x - checkint.4gl (397 characters)' sed -e 's/^X//' >checkint.4gl <<'SHAR-EOF' X{ X @(#)checkint.4gl 2.4 90/04/05 X @(#)JLSS - Informix Tools: General Library X @(#)Interrupt checker X @(#)Author: JL X} X X{ Warn about ignored interrupt if interrupt has occurred } XFUNCTION check_interrupt() X X DEFINE X sccs CHAR(1) X X IF int_flag != 0 THEN X LET sccs = "@(#)checkint.4gl 2.4 90/04/05" X ERROR "Interrupt detected -- ignored" X LET int_flag = 0 X END IF X XEND FUNCTION {check_interrupt} SHAR-EOF chmod 444 checkint.4gl if [ `wc -c <checkint.4gl` -ne 397 ] then echo shar: checkint.4gl unpacked with wrong size fi # end of overwriting check fi #-------------------- if [ -f fgiusr.c -a "$1" != "-c" ] then echo shar: fgiusr.c already exists else echo 'x - fgiusr.c (1714 characters)' sed -e 's/^X//' >fgiusr.c <<'SHAR-EOF' X/*************************************************************************** X * X * INFORMIX SOFTWARE, INC. X * X * PROPRIETARY DATA X * X * THIS DOCUMENT CONTAINS TRADE SECRET DATA WHICH IS THE PROPERTY OF X * INFORMIX SOFTWARE, INC. THIS DOCUMENT IS SUBMITTED TO RECIPIENT IN X * CONFIDENCE. INFORMATION CONTAINED HEREIN MAY NOT BE USED, COPIED OR X * DISCLOSED IN WHOLE OR IN PART EXCEPT AS PERMITTED BY WRITTEN AGREEMENT X * SIGNED BY AN OFFICER OF INFORMIX SOFTWARE, INC. X * X * THIS MATERIAL IS ALSO COPYRIGHTED AS AN UNPUBLISHED WORK UNDER X * SECTIONS 104 AND 408 OF TITLE 17 OF THE UNITED STATES CODE. X * UNAUTHORIZED USE, COPYING OR OTHER REPRODUCTION IS PROHIBITED BY LAW. X * X * X * Title: fgiusr.c X * Sccsid: @(#)fgiusr.c 10.1 1/16/94 22:41:53 X * Description: X * definition of user C functions X * X *************************************************************************** X */ X X/*************************************************************************** X * X * This table is for user-defined C functions. X * X * Each initializer has the form: X * X * "name", name, nargs, X * X * Variable # of arguments: X * X * set nargs to -(maximum # args) X * X * Be sure to declare name before the table and to leave the X * line of 0's at the end of the table. X * X * Example: X * X * You want to call your C function named "mycfunc" and it expects X * 2 arguments. You must declare it: X * X * int mycfunc(); X * X * and then insert an initializer for it in the table: X * X * "mycfunc", mycfunc, 2, X * X *************************************************************************** X */ X X#include "fgicfunc.h" X Xextern int file_access(); X Xcfunc_t usrcfuncs[] = X { X "file_access", file_access, 2, X 0, 0, 0 X }; SHAR-EOF chmod 444 fgiusr.c if [ `wc -c <fgiusr.c` -ne 1714 ] then echo shar: fgiusr.c unpacked with wrong size fi # end of overwriting check fi #-------------------- if [ -f findstr.4gl -a "$1" != "-c" ] then echo shar: findstr.4gl already exists else echo 'x - findstr.4gl (839 characters)' sed -e 's/^X//' >findstr.4gl <<'SHAR-EOF' X{ X @(#)findstr.4gl 1.1 90/08/14 X @(#)JLSS - Informix Tools: General Library X @(#)Find index of where string occurs in string X @(#)Author: JL X} X XFUNCTION find_string(str, s) X X DEFINE X str CHAR(80), { String to be searched } X s CHAR(80), { String to be found (more than 1 char please) } X c CHAR(1), X sccs CHAR(1), X l1 INTEGER, X l2 INTEGER, X f INTEGER, X i INTEGER, X j INTEGER, X k INTEGER X X LET l1 = length(str) X LET l2 = length(s) X LET c = s[1] X X FOR i = 1 TO l1 - l2 + 1 X IF str[i] = c THEN X LET k = i + 1 X LET j = 2 X LET f = TRUE X WHILE j <= l2 X IF str[k] != s[j] THEN X LET f = FALSE X EXIT WHILE X END IF X LET j = j + 1 X LET k = k + 1 X END WHILE X IF f = TRUE THEN X RETURN i X END IF X END IF X END FOR X X RETURN 0 X X LET sccs = "@(#)findstr.4gl 1.1 90/08/14" X XEND FUNCTION {find_string} SHAR-EOF chmod 444 findstr.4gl if [ `wc -c <findstr.4gl` -ne 839 ] then echo shar: findstr.4gl unpacked with wrong size fi # end of overwriting check fi #-------------------- if [ -f getopt.4gl -a "$1" != "-c" ] then e