: "@(#): shar.sh,v 1.10 1997/06/02 21:45:00 johnl Exp $" #! /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: Tue Oct 7 11:17:55 PDT 1997 by johnl at Informix Software Ltd. # Files archived in this archive: # basedir.4gl # checkint.3j # informix.mk # interr.3j # makefile # mkfile.3j # mkfile.c # repdest.3j # report.3j # report.c # scrdump.3j # scrdump.ec # shell.3j # stdopt.3j # translog.3j # #-------------------- if [ -f basedir.4gl -a "$1" != "-c" ] then echo shar: basedir.4gl already exists else echo 'x - basedir.4gl (838 characters)' sed -e 's/^X//' >basedir.4gl <<'SHAR-EOF' X-- @(#)$Id: basedir.4gl,v 1.3 1992/10/25 12:07:25 jl Exp $ X-- @(#)JLSS Informix Tools: General Library X-- @(#)Define base directory for application X-- @(#)Author: JL X XDEFINE X baseenv CHAR(32), { Name of environment variable } X basedir CHAR(64) { Value of environment variable } X X{ Return base directory for application } XFUNCTION get_base() X X { Edit the next line for each project } X CALL set_base("BASEDIRECTORY") X X RETURN basedir X XEND FUNCTION {get_base} X X{ Set base directory for application } XFUNCTION set_base(basevar) X X DEFINE X basevar CHAR(32), X sccs CHAR(1) X X IF baseenv IS NULL OR basevar != baseenv THEN X LET baseenv = basevar X LET basedir = fgl_getenv(basevar) X IF basedir IS NULL THEN X LET basedir = "." X END IF X LET sccs = "@(#)$Id: basedir.4gl,v 1.3 1992/10/25 12:07:25 jl Exp $" X END IF X XEND FUNCTION {set_base} SHAR-EOF chmod 444 basedir.4gl if [ `wc -c checkint.3j <<'SHAR-EOF' X'\" @(#)$Id: checkint.3j,v 1.4 1989/08/02 17:04:04 john Exp $ X'\" @(#)Manual page: General Library -- Check interrupts X.ds fC "Version: $Revision: 1.4 $ ($Date: 1989/08/02 17:04:04 $) X.TH CHECKINT 3S "Sphinx Informix Tools" X.SH NAME Xcheck_interrupt \(em check whether interrupt has occured X.SH SYNOPSIS X\fBfunction check_interrupt()\fP X.SH DESCRIPTION X\fBCheck_interrupt\fP generates an error message ``Interrupt Xdetected \-\- ignored'' and resets the global variable \s-2INT_FLAG\s0 Xto zero if it is not zero. XIt is used wherever the programmer wishes to check for but ignore Xan interrupt key. X.SH AUTHOR XJonathan Leffler X.br XSphinx Ltd. X.br X26th February 1988 SHAR-EOF chmod 444 checkint.3j if [ `wc -c informix.mk <<'SHAR-EOF' X# @(#)default.mk 8.6 97/04/17 X# X# @(#)Adapted for use by plain Make (no SCCS/RCS rules) X# X# @(#):RMKVER: X# Default RMK rules X# Knows about: C, C++, Yacc, Lex, Perl, Shell, Include, Assembler X# Also knows: ISQL, I4GL, I4GL-RDS, RDSLIB and RDSLINK X# RMK knows about SCCS and RCS X############################################################################### X# Warning: X# The order of the suffixes listed in .SUFFIXES is such that if you have a X# set of rules which include files flex.l, flex.c and flex.o, RMK will always X# make flex.o from flex.l, without using the intermediate flex.c as MAKE X# would. By altering the list of suffixes so that .c precedes .l (and X# presumably .y), the behaviour can be reverted to that of MAKE. X# Also, Perl scripts are given precedence over Shell scripts. X############################################################################### X X############################################################################### X# Compilers and flags XACEPREP = saceprep # ACE report compiler XACEFLAGS = -q # Flags for ${ACEPREP} XAR = ar # Library archiving program XARFLAGS = ruv # Flags for ${AR} XAS = as # Assembler XASFLAGS = # Flags for ${AS} XC4GL = c4gl # I4GL compiler XCC = cc # C compiler XCFLAGS = -O # Flags for ${CC} XCO = co # RCS Checkout XCOFLAGS = -q # Flags for ${CO} XCP = cp # Copy command XCXX = CC # C++ compiler XCXXFLAGS = -O # Flags for ${CXX} XESQL = esql # ESQL/C compiler XFORMBUILD.4GL = form4gl # I4GL form compiler XFORMBUILD.SQL = sformbld # ISQL form compiler XFORMFLAGS = -q # FLags for ${FORMBUILD.4GL} and ${FORMBUILD.SQL} XGET = get # SCCS Checkout XGFLAGS = -s # Flags for ${GET} XLD = ld # Linker XLDFLAGS = # Flags for ${LD} XLEX = lex # Lex XLFLAGS = # Flags for ${LEX} XLN = ln # Link command XMKMESSAGE = mkmessage # Message file compiler XMSGFLAGS = # Flags for ${MKMESSAGE} XMV = mv # Move command XMX = chmod +x # Change mode to executable XRDS.COMPILER = fglpc # I4GL-RDS compiler XRDS.FLAGS = # Flags for ${RDS.COMPILER} XRDSLINK = rdslink # I4GL-RDS linker XRDSLINK- = # Flags for ${RDSLINK} XRDSLIB = rdslib # I4GL-RDS Library Tool XRM = rm -f # Delete files XYACC = yacc # Yacc XYFLAGS = # FLags for ${YACC} X############################################################################### X# Define suffixes which are recognised. X# Note unusual hierarchy for suffixes: X# -- all high level languages (I4GL, ESQL/C, Yacc, Lex) are preferred to C X# -- C is preferred to assembler X# -- assembler is preferred to an object file X# It would be possible to define a .o: rule if desired. X# NB: there are no ~ suffixes, nor any .a rules X X# Define suffix list XSUFFIXES = .o .4go .4gl .ec .cc .cpp .cxx .C .y .l .c .s .h .pl .sh \ X .arc .ace .4ge .frm .4gf .4pr .per .iem .msg .4gi X.SUFFIXES: ${SUFFIXES} X X# Used to force things to happen. Everything is out of date w.r.t. .FORCE X.FORCE: X X# Rule for extracting objects from SCCS X.SCCS_GET: X cd ${@D} ; ${GET} ${GFLAGS} ${@F} X X# Rule for extracting objects from RCS X.RCS_GET: X cd ${@D} ; ${CO} ${COFLAGS} ${@F} X X# Rule for inserting members into library X.LIBRARY: X ${AR} ${ARFLAGS} $@ $? X -${RM} $? X X# Rule for treating library members in same way as Augmented Make X.MEMBER: X ${AR} ${ARFLAGS} $@ $% X -${RM} $% X X# Rules for compiling C X.c: X ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} X.c.o: X ${CC} ${CFLAGS} -c $< X X# Rules for compiling C++ (multiple suffixes complicate this) X.cc: X ${CXX} ${CXXFLAGS} $< -o $@ ${LDFLAGS} X.cc.o: X ${CXX} ${CXXFLAGS} -c $< X.cpp: X ${CXX} ${CXXFLAGS} $< -o $@ ${LDFLAGS} X.cpp.o: X ${CXX} ${CXXFLAGS} -c $< X.cxx: X ${CXX} ${CXXFLAGS} $< -o $@ ${LDFLAGS} X.cxx.o: X ${CXX} ${CXXFLAGS} -c $< X.C: X ${CXX} ${CXXFLAGS} $< -o $@ ${LDFLAGS} X.C.o: X ${CXX} ${CXXFLAGS} -c $< X X# Rules for compiling Lex X.l: X ${LEX} ${LFLAGS} $< X ${CC} ${CFLAGS} -o $@ lex.yy.c ${LDFLAGS} X -${RM} lex.yy.[co] X.l.o: X ${LEX} ${LFLAGS} $< X ${CC} ${CFLAGS} -c lex.yy.c X ${MV} lex.yy.o $@ X -${RM} lex.yy.c X.l.c: X ${LEX} ${LFLAGS} $< X ${MV} lex.yy.c $@ X X# Rules for compiling Yacc X.y: X ${YACC} ${YFLAGS} $< X ${CC} ${CFLAGS} -o $@ y.tab.c ${LDFLAGS} X -${RM} y.tab.[co] X.y.o: X ${YACC} ${YFLAGS} $< X ${CC} ${CFLAGS} -c y.tab.c X ${MV} y.tab.o $@ X -${RM} y.tab.c X X# Rules for "compiling" shell scripts X.sh: X -${RM} $@ X ${CP} $< $@ X ${MX} $@ X X# Rules for "compiling" Perl scripts X.pl: X -${RM} $@ X ${CP} $< $@ X ${MX} $@ X X# No rules are needed for include files X X# Rules for compiling Assembler X.s: X ${AS} ${ASFLAGS} $< -o $@ ${LDFLAGS} X.s.o: X ${AS} ${ASFLAGS} -o $@ $< X X# Rules for compiling I4GL (assuming 4.12/6.00 or later) X.4gl: X ${C4GL} ${CFLAGS} $< -o $@ ${LDFLAGS} X.4gl.4ge: X ${C4GL} ${CFLAGS} -o $*.4ge $< ${LDFLAGS} X.4gl.o: X ${C4GL} ${CFLAGS} -c $< X.4gl.ec: X ${C4GL} ${CFLAGS} -e $< X.4gl.a: X ${C4GL} ${CFLAGS} -c $< X ${AR} ${ARFLAGS} $@ $% X ${RM} $*.o X X# Rules for compiling ESQL/C X.ec: X ${ESQL} ${CFLAGS} $< -o $@ ${LDFLAGS} X -${RM} $*.[co] X.ec.o: X ${ESQL} ${CFLAGS} -c $< X -${RM} $*.c X.ec.c: X ${ESQL} ${CFLAGS} -e $*.ec X.ec.a: X ${ESQL} ${CFLAGS} -c $< X ${AR} ${ARFLAGS} $@ $% X -${RM} $*.c $*.o X X# Rules for compiling SQL report files X.ace.arc: X ${ACEPREP} ${ACEFLAGS} $* X X# Rules for compiling SQL form files X.per.frm: X ${FORMBUILD.SQL} ${FORMFLAGS} $* X X# Rules for compiling message files X.msg.iem: X ${MKMESSAGE} ${MSGFLAGS} $< $@ X X# I4GL Forms with .4gf extension X.4gf.frm: X -${RM} $*.per X ${LN} $*.4gf $*.per X ${FORMBUILD.4GL} ${FORMFLAGS} $* X -${RM} $*.per X X# I4GL Forms with .4pr extension X.4pr.frm: X -${RM} $*.per X ${LN} $*.4pr $*.per X ${FORMBUILD.4GL} ${FORMFLAGS} $* X -${RM} $*.per X X# I4GL RDS compiling X.4gl.4go: X ${RDS.COMPILER} $< X.4gl.4gi: X ${RDS.COMPILER} $< X ${RDSLINK} -o $*.4gi ${RDSLINK-} $*.4go X -${RM} $*.4go SHAR-EOF chmod 444 informix.mk if [ `wc -c interr.3j <<'SHAR-EOF' X'\" @(#)$Id: interr.3j,v 1.1 1990/05/21 14:50:44 john Exp $ X'\" @(#)Manual page: Internal Error and Fatal Error X.ds fC "Version: $Revision: 1.1 $ ($Date: 1990/05/21 14:50:44 $) X.TH INTERNAL_ERROR 3S "Sphinx Informix Tools" X.SH NAME Xinternal_error \(em report recoverable internal error X.br Xfatal_error \(em report unrecoverable internal error X.SH SYNOPSIS Xcall internal_error("message") X.br Xcall fatal_error("message") X.SH DESCRIPTION XThese routines write the message supplied as an argument to the Xerror log file (using \fBlogerror\fP supplied with \*cstdopt.4gl\*d) Xand puts out a standard error message on the screen. X\fBFatal_error\fP displays the error message for 5 seconds and Xthen exits the program with status 1. X\fBInternal_error\fP displays the error message for 3 seconds and Xthen returns to the calling function. X.P XThese functions should be used whenever the program detects an internal error. XThey should not be used for 99+% of user errors. X.SH FILES Xinterr.4gl X.SH "SEE ALSO" Xstd_options(3S) X.SH AUTHOR XJonathan Leffler X.br XSphinx Ltd. X.br X21st May 1990 SHAR-EOF chmod 444 interr.3j if [ `wc -c makefile <<'SHAR-EOF' X# @(#)makefile 7.1 90/08/23 X# X# @(#)Manually hacked 1997-10-07 X# X# @(#)Built by: FGLBLD Version 6.08 (01/12/1989) (Makefile) X# X# Program: spi X X###################### X# Definitions X###################### X Xinclude informix.mk X XESQL = $(C4GL) X XRANLIB=ranlib XLIBDIR=. XLIBRARY=${LIBDIR}/libdlist.a XLDFLAGS=${LIBRARY} -s X X# Add popstr.o to the library object files if using an old (pre-4.12) X# version of I4GL. X# ${LIBRARY}(popstr.o)\ X# X XLIBOBJECT=\ X ${LIBRARY}(basedir.o)\ X ${LIBRARY}(checkint.o)\ X ${LIBRARY}(dbexpln.o)\ X ${LIBRARY}(dbtype.o)\ X ${LIBRARY}(dlist.o)\ X ${LIBRARY}(dliststr.o)\ X ${LIBRARY}(helpfile.o)\ X ${LIBRARY}(incdec.o)\ X ${LIBRARY}(interr.o)\ X ${LIBRARY}(ldint.o)\ X ${LIBRARY}(mkfile.o)\ X ${LIBRARY}(msgtext.o)\ X ${LIBRARY}(nxtfield.o)\ X ${LIBRARY}(openlog.o)\ X ${LIBRARY}(repdest.o)\ X ${LIBRARY}(report.o)\ X ${LIBRARY}(reptype.o)\ X ${LIBRARY}(scrdump.o)\ X ${LIBRARY}(scrndump.o)\ X ${LIBRARY}(security.o)\ X ${LIBRARY}(shell.o)\ X ${LIBRARY}(stdopt.o)\ X ${LIBRARY}(translog.o)\ X ${LIBRARY}(uname.o) X X# X# The complete D-list library would contain the following 4 object X# files instead of just the one listed above. X# ${LIBRARY}(dlistint.o)\ X# ${LIBRARY}(dliststr.o)\ X# ${LIBRARY}(dlistdec.o)\ X# ${LIBRARY}(dlistdbl.o)\ X# This comment is necessary on Xenix -- do not ask why X XFILES.o=\ X spig.o\ X spic.o\ X spii.o\ X spi1.o\ X spi2.o\ X spi3.o\ X spim.o\ X spir.o\ X spiw.o X XFILES.4go=${FILES.o:.o=.4go} X XSTDFILES.4go=\ X incdec.4go\ X interr.4go\ X nxtfield.4go\ X reptype.4go\ X shell.4go\ X checkint.4go\ X translog.4go\ X repdest.4go\ X scrndump.4go\ X security.4go\ X stdopt.4go X XFILES.frm=\ X spi1.frm\ X spi2.frm\ X spi3.frm\ X repdest.frm\ X scrndump.frm X XFILES.iem=\ X spi.iem X X###################### X# Rules X###################### X X.PRECIOUS: ${LIBRARY} X Xnull: rds X Xall: X @echo "Use: make -f spi.mk rds for I4GL-RDS" X @echo "Use: make -f spi.mk c4gl for I4GL-C" X Xrds: spi.4gi ${FILES.iem} ${FILES.frm} X @echo "You must use a custom runner with the D-List code etc. in it" X Xc4gl: ${LIBRARY} spi ${FILES.iem} ${FILES.frm} X Xspi.4gi: ${FILES.4go} ${STDFILES.4go} X cat ${FILES.4go} ${STDFILES.4go} >$@ X Xspi: ${FILES.o} ${LIBRARY} X ${C4GL} -o $@ ${FILES.o} ${LDFLAGS} X Xspic.4go spic.o: spig.4gl Xspii.4go spii.o: spig.4gl Xspim.4go spim.o: spig.4gl Xspir.4go spir.o: spig.4gl Xspi1.4go spi1.o: spig.4gl Xspi2.4go spi2.o: spig.4gl Xspi3.4go spi3.o: spig.4gl X X${LIBRARY}: ${LIBOBJECT} X -${RANLIB} ${LIBRARY} X Xdlist.o ${LIBRARY}(dlist.o): dlist.h Xdliststr.o ${LIBRARY}(dliststr.o): dlist.h X# ${LIBRARY}(dlistint.o): dlist.h X# ${LIBRARY}(dliststr.o): dlist.h X# ${LIBRARY}(dlistdec.o): dlist.h X# ${LIBRARY}(dlistdbl.o): dlist.h SHAR-EOF chmod 444 makefile if [ `wc -c mkfile.3j <<'SHAR-EOF' X'\" @(#)$Id: mkfile.3j,v 1.4 1989/08/02 17:04:10 john Exp $ X'\" @(#)Manual page: General Library -- Create temporary file name X.ds fC "Version: $Revision: 1.4 $ ($Date: 1989/08/02 17:04:10 $) X.TH MKFILENAME 3S "Sphinx Informix Tools" X.SH NAME Xmkfilename \(em create unique tempoarary file name X.SH SYNOPSIS X\fBfunction mkfilename(template)\fP X.br Xdefine X template char(64) X return template X.SH DESCRIPTION X\fBMkfilename\fP creates a unique file name using the template Xpassed as an argument. XThis template must include six `X's in a row, e.g. X\&``\*c/usr/tmp/trqXXXXXX.tmp\*d'' \(em these will be converted Xinto a unique name with the process number and a letter. X.P XBeware: if you call this function twice in a row with the same Xtemplate and without creating the file in between, it will Xreturn the same name twice. X.P XThis function also checks whether the template Xdoes contain six `X's and supplies a default name if it does not. XIt also uses the default if it is called with the wrong number of Xarguments. X.SH "SEE ALSO" Xmktemp(3) X.SH AUTHOR XJonathan Leffler X.br XSphinx Ltd. X.br X3rd March 1988 SHAR-EOF chmod 444 mkfile.3j if [ `wc -c mkfile.c <<'SHAR-EOF' X/* X@(#)File: $RCSfile: mkfile.c,v $ X@(#)Version: $Revision: 1.4 $ X@(#)Last changed: $Date: 1990/04/05 10:51:03 $ X@(#)Purpose: Create temporary file name in I4GL X@(#)Author: J Leffler X*/ X X/* -- Macro definitions */ X X#define NIL(x) ((x)0) X X/* -- Declarations */ X Xextern char *mktemp(); X Xstatic char *deftemplate = "/tmp/dbkpi.XXXXXX"; X X#ifndef lint Xstatic char sccs[] = "@(#)$Id: mkfile.c,v 1.4 1990/04/05 10:51:03 john Exp $"; X#endif X X/* -- Routine: mkfilename */ X/* -- I4GL: LET fname = mkfilename("/tmp/trqXXXXXX") */ X Xint mkfilename(i) Xint i; X{ X char path[65]; X char *x1; X X if (i == 1) X { X popstring(path, sizeof(path)); X if (!has6xes(path)) X strcpy(path, deftemplate); X if ((x1 = mktemp(path)) == NIL(char *)) X { X strcpy(path, deftemplate); X x1 = mktemp(path); X } X retquote(x1); X } X else X { X strcpy(path, deftemplate); X retquote(mktemp(path)); X } X return(1); X} X Xstatic int has6xes(s) Xchar *s; X{ X char *t; X X while (*s) X { X if (*s++ == 'X') X { X t = s; X while (*t == 'X') X t++; X if ((t - s) >= 6 - 1) /* s has been incremented! */ X return(1); /* OK */ X s = t; X } X } X return(0); /* Not OK */ X} SHAR-EOF chmod 444 mkfile.c if [ `wc -c repdest.3j <<'SHAR-EOF' X'\" @(#)$Id: repdest.3j,v 1.4 1989/08/02 17:04:12 john Exp $ X'\" @(#)Manual page: General Library -- Select Report Destination X.ds fC "Version: $Revision: 1.4 $ ($Date: 1989/08/02 17:04:12 $) X.TH REPDEST 3S "Sphinx Informix Tools" X.SH NAME Xreport_destination \(em select destination for report X.SH SYNOPSIS X.ft B Xfunction report_destination() X.br Xdefine X rdest integer, X rname char(80) X.br Xreturn rdest, rname X.ft R X.SH DESCRIPTION X\fBReport_destination\fP offers the user a standard menu for Xselecting the destination for a report. XThe options are ``Screen'', ``Default printer'', ``New file'', X``Append to file'', ``Pipe'' and ``Exit''. XThe function returns two values, an integer indicating the Xdestination, and a string for the name of the file or program. XThe value of the integer will be one of: X.sp X\s-2NULL\s0 Abandon report X.br X0 Send report to screen X.br X1 Send report to printer X.br X2 Send report to file X.br X3 Send report to pipe X.sp XThe string defines the file or pipe to which the report should be sent. XThe standard sequence for calling this function is: X.sp X.ft CW X.ps 10 X.vs 14 X.nf XDEFINE X rdest INTEGER, X rname CHAR(80) X XCALL report_destination() returning rdest, rname XCASE rdest XWHEN 0 X START REPORT rf_report XWHEN 1 X START REPORT rf_report TO PRINTER XWHEN 2 X START REPORT rf_report TO rname XWHEN 3 X START REPORT rf_report TO PIPE rname XOTHERWISE X RETURN # Abandon XEND CASE X.sp X.fi X.ft X.ps X.vs XThe report output section should be configured for a printer X(that is, the sizes should be printer sizes; the report Xdestination must \fInot\fP be specified in the report). XThe default specification is normally acceptable. XThe report should call the function \fBset_output()\fP in the X\s-2FIRST PAGE HEADER\s0 block (or the \s-2PAGE HEADER\s0, or Xsome other block executed early in the report). XThis will reset the output parameters correctly for the screen if Xthe report is sent to the screen. XThe \s-2PAGE TRAILER\s0 should normally have a \s-2PAUSE\s0 in it; Xthis will improve the screen handling and does not affect the Xreport when it is sent to the printer, a file or a pipe. X.SH AUTHOR XJonathan Leffler X.br XSphinx Ltd. X.br X21st April 1988 SHAR-EOF chmod 444 repdest.3j if [ `wc -c report.3j <<'SHAR-EOF' X'\" @(#)$Id: report.3j,v 1.4 1992/07/24 10:42:22 johnl Exp $ X'\" @(#)Manual page: General Library -- Report Configuration X.ds fC "@(#)$Id: report.3j,v 1.4 1992/07/24 10:42:22 johnl Exp $ X.TH REPORT 3S "JLSS Informix Tools" X.SH NAME Xset_output \(em Dynamically reconfigure dimensions of I4GL report X.SH SYNOPSIS X.ft B Xfunction set_plength(i) X.br Xdefine i integer X.sp Xfunction set_tmargin(i) X.br Xdefine i integer X.sp Xfunction set_bmargin(i) X.br Xdefine i integer X.sp Xfunction set_lmargin(i) X.br Xdefine i integer X.sp Xfunction set_rmargin(i) X.br Xdefine i integer X.sp Xfunction set_output() X.ft R X.ft B Xfunction get_plength() X.sp Xfunction get_tmargin() X.sp Xfunction get_bmargin() X.sp Xfunction get_lmargin() X.sp Xfunction get_rmargin() X.ft R X.SH DESCRIPTION XThese functions can be used to dynamically reconfigure the layout Xof the page of an Informix 4GL report. XThe example program shown below illustrates how they should be used. X.br X.ft CW X.ps 10 X.vs 12 X.nf X.so rejig.4gl X.br X.fi X.ft X.ps X.vs XThe functions \fIset_plength\fP, \fIset_tmargin\fP, X\fIset_bmargin\fP, \fIset_lmargin\fP and \fIset_rmargin\fP may be called Xanywhere inside an I4GL program. XThe function \fIset_output\fP will have no effect except within a report. XIt is recommended that \fIset_output\fP be used in the \s-2FIRST XPAGE HEADER\s0 control block, but it may be used in any control block. X.P XAfter the function \fIset_output\fP is called, it invalidates all the settings; Xto change the settings in a second report, you must call the Xset-routines again. XThere is no requirement that all the routines are called (or even any of them). X.P XThe functions \fIget_plength\fP, \fIget_tmargin\fP, X\fIget_bmargin\fP, \fIget_lmargin\fP and \fIget_rmargin\fP may be called Xanywhere inside an I4GL program. XIf page dimensions have been set using the set-routines, then the corresponding Xvalue is returned; otherwise, the corresponding default value is returned. XAfter \fIset_output\fP has been called, the values returned will be Xthe default values again; if your report needs to know what its dimensions will Xbe, it should use the get-routines before calling \fIset_output\fP. X.SH COMPILATION XIf compiling for use with compiled Informix-4GL, no special flags are needed. XIf compiling for use with I4GL-RDS, include -DI4GL_RDS on the command line. XThe details of building the functions into the \*Cfglgo\*D Xand \*Cfgldb\*D are given in the corresponding Informix manuals. XThe necessary definitions for \*cfgiusr.c\*d are: X.br X.ft CW X.ps 10 X.vs 12 X.nf X#ifdef SET_REPORT Xextern int set_output(); /* 0 */ Xextern int get_rmargin(); /* 0 */ Xextern int get_tmargin(); /* 0 */ Xextern int get_bmargin(); /* 0 */ Xextern int get_lmargin(); /* 0 */ Xextern int get_plength(); /* 0 */ Xextern int set_rmargin(); /* 1 */ Xextern int set_tmargin(); /* 1 */ Xextern int set_bmargin(); /* 1 */ Xextern int set_lmargin(); /* 1 */ Xextern int set_plength(); /* 1 */ X#endif /* SET_REPORT */ X X#ifdef SET_REPORT X { "set_output", set_output, 0 }, X { "get_rmargin", get_rmargin, 0 }, X { "get_tmargin", get_tmargin, 0 }, X { "get_bmargin", get_bmargin, 0 }, X { "get_lmargin", get_lmargin, 0 }, X { "get_plength", get_plength, 0 }, X { "set_rmargin", set_rmargin, 1 }, X { "set_tmargin", set_tmargin, 1 }, X { "set_bmargin", set_bmargin, 1 }, X { "set_lmargin", set_lmargin, 1 }, X { "set_plength", set_plength, 1 }, X#endif /* SET_REPORT */ X.br X.fi X.ft X.ps X.vs X.SH WARNINGS XThis code was designed and tested on an ATT&T 3B2/400 running XUNIX System V Release 3.0 using Informix-4GL version 1.10.00C. XIt has since been tested on a number of other environments (including Versions X1.10.03, 4.00 and 4.10) on a number of platforms, and has been found to work. XHowever, the code cannot be guaranteed on any platform or version of I4GL. XIt is completely unsupported code. X.SH BUGS XThe top margin set by \fBset_tmargin\fP does not take effect Xuntil the second page of output. X.SH AUTHOR XJonathan Leffler X.br XMarlin Prowell X.br XJLSS X.br X24th July 1992 SHAR-EOF chmod 444 report.3j if [ `wc -c report.c <<'SHAR-EOF' X/* X@(#) File: $RCSfile: report.c,v $ X@(#) Version: $Revision: 2.1 $ X@(#) Last changed: $Date: 1992/07/24 10:16:02 $ X@(#) Purpose: I4GL: Reset report output parameters (RDS & C4GL) X@(#) Author: J Leffler / M Prowell X*/ X X/*TABSTOP=4*/ X X/* X** INFORMIX-4GL Dynamic Report Output Parameters Version 2 X** C4GL code (and interface) by J Leffler. X** RDS interface by M Prowell. X** X** Compilation: X** C4GL: cc -c $RCSfile: report.c,v $ X** RDS: cc -c -DI4GL_RDS $RCSfile: report.c,v $ X*/ X X/* X** Addendum to Marlin's comments. X** -- tested on SUNOS 4.1.1 and I4GL-RDS 4.10.UC1 and it seems to work X** correctly, but it is still unsupported code. X*/ X X/* X** From: uunet!nyssa.wa7ipx.ampr.org!mbp (Marlin Prowell) X** Subject: Changing report output params in RDS (code enclosed) X** Date: 29 Apr 92 04:30:46 GMT X** To: informix-list@rmy.emory.edu X** X-Informix-List-Id: X** X** A few days ago, Jonathan Leffler posted some code for I4GL that would X** change report output parameters on the fly. The code he posted works X** only for the C compiler version, and I only have the RDS version of X** Informix. Since an Informix employee said he was unable to figure out X** a RDS version, I took that as a challenge. X** X** Below is a modified version of his report.c that works when linked into X** a customized runner. I leave the details to building the runner as an X** exercise for the reader. X** X** I used Jonathan's code as a hint on how reports work in Informix. I X** found the equivalent report pointer, and inferred the report structure X** that the interpreter uses. Since this code diddles with internal X** interpreter variables, use this code at your own risk. I use it now to X** reset the page length when output is going to the screen, and it X** *appears* to work correctly. Your mileage may vary. X** X** BTW, I am using Informix 4.00 on SCO Xenix. I haven't tested this X** anywhere else. Of course, the size of the junk variable in the repdesc X** structure may change on other machine architectures. You could write X** another C function that gets called in the ON EVERY ROW section, and X** have it print out the values in the repdesc structure. You can then X** verify that the structure definition is correct on your machine. X** X** I've wanted to do this, but after I had previously poked around in the X** interpreter for awhile, I had also given up. Thanks for the hints, Jonathan. X** X** -------------------------------------------------------------------------- X** | Marlin Prowell | There is a very thin line between ignorance | X** | (206) 676-1554 | and arrogance and I have totally obliterated | X** | mbp@nyssa.wa7ipx.ampr.org | that line. -- Dr. Science | X** -------------------------------------------------------------------------- X*/ X X#include X X#ifndef lint Xstatic char sccs[] = "@(#)$Id: report.c,v 2.1 1992/07/24 10:16:02 johnl Exp $"; X#endif X X#ifdef I4GL_RDS X X/* Structure inferred from RDS */ Xtypedef struct repdesc X{ X short junk[42]; /* unknown */ X short ln; /* Line number? */ X short pagenumber; /* Pge number */ X short plength; /* Page length */ X short tmargin; /* Top margin */ X short bmargin; /* Bottom margin */ X short lmargin; /* Left margin */ X short rmargin; /* Right margin */ X short fphlines; /* Lines in first page header */ X short phlines; /* Lines in page header */ X short ptlines; /* Lines in page trailer */ X short junktoo; /* unknown */ X short tot; X} Report; X Xextern Report *currep; /* Parameters of current report */ X X#else X X/* Structure copied from C code generated by I4GL */ Xtypedef struct repdesc X{ X long rrecordnum; /* Record number */ X short pagenumber; /* Pge number */ X short ln; /* Line number? */ X short tmargin; /* Top margin */ X short rmargin; /* Right margin */ X short lmargin; /* Left margin */ X short bmargin; /* Bottom margin */ X short phlines; /* Lines in page header */ X short fphlines; /* Lines in first page header */ X short colcount; X short tot; X short oktoinc; X FILE *outfp; /* Output channel */ X short oftype; X short plength; /* Page length */ X short ptlines; /* Lines in page trailer */ X struct aggdesc *_paggdesc; X struct value *_paggvals; X struct sortdesc *p_sortdesc; X short gotoindx; X short gotostk[5]; X short needlmarg; X} Report; X Xextern Report *c_rp; /* Parameters of current report */ X X#endif /* I4GL_RDS */ X Xstatic Report set; /* Newly set report parameters */ Xstatic int newset = 0; /* Mask of newly set parameters */ X X#define TMARGIN 0x01 X#define BMARGIN 0x02 X#define LMARGIN 0x04 X#define PLENGTH 0x08 X#define RMARGIN 0x10 X X#define DEF_TMARGIN 3 X#define DEF_BMARGIN 3 X#define DEF_LMARGIN 5 X#define DEF_PLENGTH 66 X#define DEF_RMARGIN 132 X X/* Redefine page length */ Xint set_plength(i) Xint i; X{ X if (i == 1) X { X popint(&i); X if (i > 0) X { X set.plength = i; X newset |= PLENGTH; X } X } X return(0); X} X X/* Reset top margin */ X/* This will not reset the top margin on the first page */ Xint set_tmargin(i) Xint i; X{ X if (i == 1) X { X popint(&i); X if (i >= 0) X { X set.tmargin = i; X newset |= TMARGIN; X } X } X return(0); X} X X/* Reset bottom margin */ Xint set_bmargin(i) Xint i; X{ X if (i == 1) X { X popint(&i); X if (i >= 0) X { X set.bmargin = i; X newset |= BMARGIN; X } X } X return(0); X} X X/* Reset left margin */ Xint set_lmargin(i) Xint i; X{ X if (i == 1) X { X popint(&i); X if (i >= 0) X { X set.lmargin = i; X newset |= LMARGIN; X } X } X return(0); X} X X/* Reset right margin */ Xint set_rmargin(i) Xint i; X{ X if (i == 1) X { X popint(&i); X if (i >= 0) X { X set.rmargin = i; X newset |= RMARGIN; X } X } X return(0); X} X X/* Copy reset output list into report configuration */ X/* Call in first page header block */ Xint set_output(i) Xint i; X{ X int newlen; X Report *report; X X#ifdef I4GL_RDS X report = currep; X#else X report = c_rp; X#endif /* I4GL_RDS */ X X if (i == 0 && newset && report != (Report *)0) X { X if (newset & PLENGTH) X { X report->plength = set.plength; X } X if (newset & TMARGIN) X { X newlen = report->plength X - report->ptlines X - report->phlines X - report->bmargin X - report->tmargin X - 1; X if (set.tmargin < newlen) X { X report->tmargin = set.tmargin; X } X } X if (newset & LMARGIN) X { X report->lmargin = set.lmargin; X } X if (newset & BMARGIN) X { X newlen = report->plength X - report->ptlines X - report->phlines X - report->tmargin X - report->bmargin X - 1; X if (set.bmargin < newlen) X { X report->bmargin = set.bmargin; X } X } X /* Adding report->phlines leaves the report */ X /* title at the top of the terminal screen. MP */ X report->tot = report->plength - (report->bmargin + report->ptlines X + report->phlines); X newset = 0; X } X return(0); X} X X/* Return page length */ Xint get_plength(i) Xint i; X{ X if (newset & PLENGTH) X i = set.plength; X else X i = DEF_PLENGTH; X retint(i); X return(1); X} X X/* Return top margin */ Xint get_tmargin(i) Xint i; X{ X if (newset & TMARGIN) X i = set.tmargin; X else X i = DEF_TMARGIN; X retint(i); X return(1); X} X X/* Return bottom margin */ Xint get_bmargin(i) Xint i; X{ X if (newset & BMARGIN) X i = set.bmargin; X else X i = DEF_BMARGIN; X retint(i); X return(1); X} X X/* Return left margin */ Xint get_lmargin(i) Xint i; X{ X if (newset & LMARGIN) X i = set.lmargin; X else X i = DEF_LMARGIN; X retint(i); X return(1); X} X X/* Return right margin */ Xint get_rmargin(i) Xint i; X{ X if (newset & RMARGIN) X i = set.rmargin; X else X i = DEF_RMARGIN; X retint(i); X return(1); X} SHAR-EOF chmod 444 report.c if [ `wc -c scrdump.3j <<'SHAR-EOF' X'\" @(#)$Id: scrdump.3j,v 1.3 1989/01/31 17:02:19 john Exp $ X'\" @(#)Manual page: General Library -- Report Configuration X.ds fC "Version: $Revision: 1.3 $ ($Date: 1989/01/31 17:02:19 $)" X.TH SCREEN_DUMP 3I "Sphinx Informix Tools" X.SH NAME Xscreen_dump \(em dump the screen to a file X.SH SYNOPSIS X.ft B Xfunction screen_dump(filename) X.br Xdefine filename char(256) X.ft R X.SH DESCRIPTION XThis function dumps the contents of the screen (as I4GL thinks Xthe screen looks like) to the file named by the argument. X.SH WARNINGS XThis function uses the support function \fIpopstring\fP; Xthis must be available in the library where \fIscreen_dump\fP lives. X.P XThis code was designed and tested on an AT&T 3B2/400 running XUNIX System V Release 3.0 using Informix 4GL version 1.10.00C. XIt is not guaranteed to work even in this environment, though Xtesting indicates that it does work both here and on a Compaq 386 Xrunning Xenix/386 version 2.2.2. X.SH BUGS XIf some other program has scribbled on the screen, the other Xscibbling is not shown in the screen dump. X.P XThis program actually dumps the \fIcurses\fP screen \fIstdscr\fP. XIt is assumed that this is fully refreshed when the routine is Xcalled, and the screen seems to be fully refreshed in normal use. X.SH AUTHOR XJonathan Leffler X.br XSoftware Solutions X.br XSphinx Ltd. X.br X27th July 1988 SHAR-EOF chmod 444 scrdump.3j if [ `wc -c scrdump.ec <<'SHAR-EOF' X/* X** @(#)$Id: scrdump.ec,v 2.1 1991/08/14 12:09:11 johnl Exp $ X** @(#)Informix-4GL Screen Dump X** @(#)Author: JL plus Scott Ellard X*/ X X/* X** From: davek@newjersey (David Kosenko) X** Message-Id: <9011131708.AA20100@newjersey.> X** To: tech@newjersey X** Subject: Re: Printscreen with 4GL X** X** What follows is a C function written by the legendary Scott Ellard. X** You call it from 4gl as you would any other C function, and include it in X** your compile line when compiling your 4gl program. X** X** Dave Kosenko X** X** Date: Thu, 25 Jul 91 12:43:50 CDT X** From: markj@infmxchi (Mark Jeske) X** Message-Id: <9107251743.AA19568@infmxchi.chicago> X** To: aryeh@grizzly, richm@asterix, tech@asterix X** Subject: Re: Screendumps in 4GL X** X** Dave Wable and I found a small bug with this program; it doesn't X** print the error message line if there is a current error message on X** the screen. X** X** Modified 7-9-91 Mark Jeske X** Added code to include the error message line. X** X** Modified 1991-08-14 J Leffler X** Integrated into existing (rather more primitive) version of code. X** Removed dependency on rdscurses.h. Changed extension to .ec for X** convenience when compiling. X*/ X X#include X#include X X/* BEGIN stuff taken from /s/src/sql2.10.03/color/rdsterm.h */ X X#define bool char X#define CHAR short X#define _ATTRIBUTE (0x7f00) X#define _CHARACTER (0x00ff) X#define _GRAPHMODE (0x8000) X Xtypedef struct window /* (I made this a typedef) */ X{ X short _cury; X short _curx; X short _maxy; X short _maxx; X short _begy; X short _begx; X short _flags; X bool _clear; X bool _leave; X bool _scroll; X CHAR **_y; X short *_firstch; X short *_lastch; X short _attr; X} WINDOW; X X/* END stuff taken from /s/src/sql2.10.03/color/rdsterm.h */ X Xextern _EFwindow *topwin; Xextern _EFwindow *botwin; Xextern _EFwindow *_Wscreen; Xextern WINDOW *_efbigwin; Xextern char *GB; Xextern WINDOW *errwin; Xextern int _errwclr; X X#define NIL(x) ((x)0) X X#ifndef lint Xstatic char sccs[] = "@(#)$Id: scrdump.ec,v 2.1 1991/08/14 12:09:11 johnl Exp $"; X#endif X Xstatic void scrdump(); X X/* X** I4GL Interface: CALL screendump("dumpfile") X*/ Xint screendump(i) Xint i; X{ X FILE *fp; X char filename[256]; X X if (i == 1) X { X popstring(filename, sizeof(filename)); X if ((fp = fopen(filename, "w")) != NIL(FILE *)) X { X scrdump(fp); X fclose(fp); X } X } X return(0); X} X Xstatic void scrdump(fp) XFILE *fp; X{ X register _EFwindow *scr; X register WINDOW *win; X register CHAR **line; X register CHAR *data; X register int y; X register int x; X register char c; X X if (topwin == _Wscreen) X { X /* the user is looking at the "screen" */ X win = (WINDOW *) _Wscreen->win; X } X else X { X /* the user is looking at one or more "windows" */ X win = _efbigwin; X for (scr = botwin; scr != (_EFwindow *) 0; X scr = (_EFwindow *) scr->upper) X { X overwrite((WINDOW *) scr->win, win); X } X } X if (!_errwclr) X overwrite(errwin, win); X X for (y = 0, line = win->_y; y < win->_maxy; y++, line++) X { X for (x = 0, data = *line; x < win->_maxx; x++, data++) X { X c = (char) *data & _CHARACTER; X if ((*data & _GRAPHMODE) && *GB) X { X if (c == GB[0]) X c = '+'; X else if (c == GB[1]) X c = '+'; X else if (c == GB[2]) X c = '+'; X else if (c == GB[3]) X c = '+'; X else if (c == GB[4]) X c = '-'; X else if (c == GB[5]) X c = '|'; X } X fputc(c, fp); X } X fputc('\n', fp); X } X} SHAR-EOF chmod 444 scrdump.ec if [ `wc -c shell.3j <<'SHAR-EOF' X'\" @(#)$Id: shell.3j,v 1.1 1988/09/25 22:34:26 john Exp $ X'\" @(#)Manual page: General Library -- Run a shell escape X.ds fC "Version: $Revision: 1.1 $ ($Date: 1988/09/25 22:34:26 $) X.TH SHELL 3S "Sphinx Informix Tools" X.SH NAME Xshell_escape \(em run a command as a shell escape X.SH SYNOPSIS Xfunction shell_escape() X ... X.br Xend function X.SH DESCRIPTION XThis function is normally called in an \s-2ON KEY\s0 statement. XIt prompts the user for a command (using an `!') and then executes the command, finally waiting for the user Xto hit another key before returning to the calling routine. X.SH BUGS XIt should return with the exit status of the command that was executed. X.P XIt should accept another `!' instead of any other character and loop to execute another command. X.SH AUTHOR XJonathan Leffler X.br XSphinx Ltd. X.br X25th September 1988 SHAR-EOF chmod 444 shell.3j if [ `wc -c stdopt.3j <<'SHAR-EOF' X'\" @(#)$Id: stdopt.3j,v 1.4 1989/08/02 17:04:14 john Exp $ X'\" @(#)Manual page: General Library -- Standard options etc. X.ds fC "Version: $Revision: 1.4 $ ($Date: 1989/08/02 17:04:14 $) X.TH STDOPTIONS 3S "Sphinx Informix Tools" X.SH NAME Xstd_options \(em set standard options X.br Xlogmessage \(em record general message on log file X.br Xlogerror \(em record error message on log file X.br Xidk_enable \(em enable insert and delete keys X.br Xidk_disable \(em disable insert and delete keys X.SH SYNOPSIS X\fBfunction std_options(applname, helpfile, logfile, security)\fP X.br Xdefine X applname char(8), X helpfile char(8), X logfile char(8), X security char(12) X.sp X\fBfunction logmessage(str)\fP X.br Xdefine X str char(80) X.sp X\fBfunction logerror(str)\fP X.br Xdefine X str char(80) X.sp X\fBfunction idk_enable()\fP X.sp X\fBfunction idk_disable()\fP X.SH DESCRIPTION X\fBStd_options\fP is used at the start of every program to set the Xstandard options used by the database system. XFor the purposes of this manual page, the routine looks at an environment Xvariable $BASE to find the base directory where the application is installed. XIn practice, each project uses a customised version of this code and one of the Xmain items that is customised is the name of the environment variable. XIt also opens a log file (based on the logfile variable) and a Xhelp file (based on the helpfile variable). XAll records written on the log file using \fBlogmessage\fP and X\fBlogerror\fP are branded with the \fBprogname\fP variable. X(This system allows several programs to share message and log Xfiles, but also allows the DBA to distinguish which program Xcaused any problems.) XOnly users who have been given permission to perform the action specified by Xthe security variable may use the program. XIf permission has not been granted, \fBstd_options\fP logs the error, Xtells the user `Sorry!' and sleeps for about 3 seconds, Xand then terminates the program with a non-zero exit status. X.P X\fBLogmessage\fP records a message on the log file. XI4GL puts the date and time out anyway; this routine inserts the Xuser name and program name as well as the message. X\fBLogerror\fP is similar except that the string \fI\fP is Xincluded on the log file; Xthe DBA can then look for problems with \fBgrep\fP. X.P X\fBIdk_enable\fP sets the \s-2INSERT KEY\s0 to \s-2F1\s0 and the X\s-2DELETE KEY\s0 to \s-2F2\s0 (the defaults, and the same as X\fBstd_options\fP). X\fBIdk_disable\fP sets the \s-2INSERT KEY\s0 to \s-2F35\s0 and the X\s-2DELETE KEY\s0 to \s-2F36\s0 (effectively disabling them Xexcept on a terminal with 36 or more function keys). XThese routines are used when the user is to be unable to add or Xdelete data from an \s-2INPUT ARRAY\s0 statement. X.SH FILES XMessage file: $BASE/msg/applname.iem X.br XLog file: $BASE/log/applname.log X.SH "SEE ALSO" Xgetenviron(3S), security(3S) X.SH AUTHOR XJonathan Leffler X.br XSphinx Ltd. X.br X26th February 1988 SHAR-EOF chmod 444 stdopt.3j if [ `wc -c translog.3j <<'SHAR-EOF' X'\" @(#)$Id: translog.3j,v 1.4 1989/08/02 17:04:15 john Exp $ X'\" @(#)Manual Page: General Library -- Transaction handling X.ds fC "Version: $Revision: 1.4 $ ($Date: 1989/08/02 17:04:15 $) X.TH TRANSACTIONS 3S "Sphinx Informix Tools" X.SH NAME Xbegin_work \(em start a transaction X.br Xcommit_work \(em commit a transaction X.br Xrollback_work \(em rollback a transaction X.br Xend_work \(em end a transaction X.br Xtranslog \(em is there a transaction log on the database X.SH SYNOPSIS X\fBfunction begin_work()\fP X.sp X\fBfunction commit_work()\fP X.sp X\fBfunction rollback_work()\fP X.sp X\fBfunction end_work(opstatus) X.br Xdefine X opstatus integer X.sp X\fBfunction translog()\fP X.SH DESCRIPTION X\fBBegin_work\fP tests whether there is a transaction log on the Xdatabase and executes a \s-2BEGIN WORK\s0 statement if there is Xa transaction log. X\fBCommit_work\fP tests whether there is a transaction log on the Xdatabase and executes a \s-2COMMIT WORK\s0 statement if there is Xa transaction log. X\fBRollback_work\fP tests whether there is a transaction log on the Xdatabase and executes a \s-2ROLLBACK WORK\s0 statement if there is Xa transaction log. X\fBEnd_work\fP tests whether the opstatus variable is \s-2TRUE\s0 X(non-zero) or \s-2FALSE\s0 (zero) and executes X\fBrollback_work\fP if it is non-zero and \fBcommit_work\fP Xotherwise. X.P XThese routines call on the low-level (but usable) routine X\fBtranslog\fP which tests whether there is a transaction log on Xthe database. XThe test is only done once and the result is stored so that after Xthe first test, the routine does not access the database again. X.SH AUTHOR XJonathan Leffler X.br XSphinx Ltd. X.br X26th February 1988 SHAR-EOF chmod 444 translog.3j if [ `wc -c