#!/bin/sh # # This is a shell archive. To extract its contents, # execute this file with /bin/sh to create the file(s): # # fgiusr.c readme vertlib.c vertmenu.4gl # # This shell archive created: Mon May 19 09:57:51 EDT 1997 # echo "Extracting file fgiusr.c" sed -e 's/^X//' <<\SHAR_EOF > fgiusr.c X/* X X fgiusr.c - sample fgiusr.c for vertlib.c X X Marco Greco (marcog@ctonline.it), Catania, Italy X X Initial release: Nov 92 X Current release: Apr 96 X X*/ X#include "fgicfunc.h" X Xint help_ok(); Xint readkey(); X Xcfunc_t usrcfuncs[] = X { X "help_ok", help_ok, 0, X "readkey", readkey, 0, X 0, 0, 0 X }; SHAR_EOF if [ `wc -c < fgiusr.c` -ne 307 ] then echo "Lengths do not match -- Bad Copy of fgiusr.c" fi echo "Extracting file readme" sed -e 's/^X//' <<\SHAR_EOF > readme XVertmenu 30 secs documentation: X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ XContents: fgiusr.c - sample fgiusr.c file for vertlib.c X readme - this readme file X vertlib.c - c functions needed by vertmenu X vertmenu.4gl - the tool X XAuthor: Marco Greco (marcog@ctonline.it), Catania, Italy X XInitial release: Nov 92 XCurrent release: Dec 96 X XUsage: X X# X# vertical menu initialization X# Xcall mnv_start(help_message_number, text_col, text_row) X XNote: text_col & text_row indicate the top-left corner where X the text (and *NOT* the border) should be placed X X# X# insert item in vertical menu X# Xlet option_index=mnv_opt(description, quick_key) X XNote: option_index is null if the array holding the options X is full X X# X# menu display & option selection X# Xlet selected_option_index=mnv_get() X XNote: selected_option_index is null is the user hits the interrupt key X XA quick example: X Xcall mnv_start(1, 2, 2) Xlet i=mnv_put("Option 1", "O") Xlet i=mnv_put("oPtion 2", "P") Xlet i=mnv_get() Xcase X when i is null X ... X when i=1 X ... X when i=2 X ... Xend case SHAR_EOF if [ `wc -c < readme` -ne 1036 ] then echo "Lengths do not match -- Bad Copy of readme" fi echo "Extracting file vertlib.c" sed -e 's/^X//' <<\SHAR_EOF > vertlib.c X/* X X vertlib.c - c functions used by Vertmenu.4gl X X Marco Greco (marcog@ctonline.it), Catania, Italy X X Initial release: Nov 92 X Current release: Dec 96 X X NOTICE X Permission to use, copy, modify, and distribute this software X and its documentation for any purpose is hereby granted without X fee, provided that X X - all copies of the software and related documentation contain this X notice and authorship information, UNMODIFIED X X - no fee is charged for the physical act of redistributing this X software or modified copies thereof X X THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, X EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY X WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. X X IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INCIDENTAL, X INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER X RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED X OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING X OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. X X ALL RISKS CONNECTED TO THE USE OF THIS SOFTWARE OR IMPOSSIBILITY X THEREOF LIE SOLELY ON YOU. X USE OF THIS SOFTWARE CONSTITUES AGREEMENT WITH THE ABOVE TERMS X AND CONDITIONS. X*/ Xextern int efcode; Xextern short eflastkey; Xextern short _acckey; Xextern short _inskey; Xextern short _delkey; Xextern short _nxtkey; Xextern short _prvkey; Xextern short _hlpkey; X X/* X** tests for "missing help message" error X*/ Xhelp_ok(nargs) Xint nargs; X{ X int r; X r=(efcode==0); X efcode=0; X retint(r); X return(1); X} X X/* X** gets next key hit from keyboard X*/ Xreadkey(nargs) Xint nargs; X{ X char c[1]; X X eflastkey=rgetkey(); X c[0]=0; X/* X** in different releases rgetkey may or may not return some of the values X** below, so the comapatison may or may not be needed. YMMV X*/ X if (eflastkey==_acckey) X eflastkey=2016; X else if (eflastkey==_inskey) X eflastkey=2014; X else if (eflastkey==_delkey) X eflastkey=2015; X else if (eflastkey==_nxtkey) X eflastkey=2005; X else if (eflastkey==_prvkey) X eflastkey=2006; X else if (eflastkey==_hlpkey) X eflastkey=2008; X else if (eflastkey<128) X c[0]=eflastkey; X clrmsg(); X retquote(c); X return(1); X} SHAR_EOF if [ `wc -c < vertlib.c` -ne 2258 ] then echo "Lengths do not match -- Bad Copy of vertlib.c" fi echo "Extracting file vertmenu.4gl" sed -e 's/^X//' <<\SHAR_EOF > vertmenu.4gl X# vertmenu.4gl - Vertical menu routines X# X# Marco Greco (marcog@ctonline.it), Catania, Italy X# X# Initial release: Nov 92 X# Current release: Dec 96 X# X# NOTICE X# Permission to use, copy, modify and redistribute this software and X# its documentation is hereby granted without fee provided that X# X# - all copies of the software and related documentation contain this X# notice and authorship information, UNMODIFIED X# X# - no fee is charged for the physical act of redistributing this X# software or modified copies thereof X# X# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, X# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY X# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. X# X# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INCIDENTAL, X# INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER X# RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED X# OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING X# OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. X# X# ALL RISKS CONNECTED TO THE USE OF THIS SOFTWARE OR IMPOSSIBILITY X# THEREOF LIE SOLELY ON YOU. X# USE OF THIS SOFTWARE CONSTITUES AGREEMENT WITH THE ABOVE TERMS X# AND CONDITIONS. X# X Xdefine X firstcol, X firstrow, X maxwidth, X maxlines, X help_msg smallint, X p_mnv array[50] of record X desc_mnv char(25), X quickkey char(1), X ambigue integer X end record X X# X# vertical menu initialization X# Xfunction mnv_start(hm, c, r) X define hm, c, r smallint X X# X# please put a whenever error, here X# X let maxlines=0 X let maxwidth=0 X let firstcol=c X let firstrow=r X let help_msg=hm Xend function X# X# insert item in vertical menu X# Xfunction mnv_opt(dm, qk) X define dm char(25), X qk char(1), X i smallint X X if maxlines=50 X then X return false X end if X let maxlines=maxlines+1 X let p_mnv[maxlines].desc_mnv=dm X let p_mnv[maxlines].quickkey=qk X let p_mnv[maxlines].ambigue=false X if length(dm)>maxwidth X then X let maxwidth=length(dm) X end if X for i=1 to maxlines-1 X if (p_mnv[i].quickkey=qk) X then X let p_mnv[i].ambigue=true X let p_mnv[maxlines].ambigue=true X end if X end for X return maxlines Xend function X# X# menu display & option selection X# Xfunction mnv_get() X define i, j, k, l smallint, X linenum, X oldline, X firstline, X pglen, X rdwop smallint, X getit integer, X keyhit char(1) X X let int_flag=false X let linenum=1 X let firstline=0 X case maxlines X when 0 X error "No options available, sorry!" X return "" X when 1 X return 1 X end case X let maxwidth=maxwidth+2 X case X when firstcol<3 X let firstcol=3 X when firstcol>80-maxwidth X let firstcol=80-maxwidth X end case X case X when firstrow<2 X let firstrow=2 X when firstrow>21 X let firstrow=21 X end case X if (maxlines>23-firstrow) X then X let pglen=23-firstrow X else X let pglen=maxlines X end if X open window mnv_win at firstrow, firstcol with pglen rows, maxwidth columns X attribute (border, form line first, comment line last, X prompt line last, message line last) X let rdwop=1 X let getit=true X while getit X case X when rdwop!=0 X let l=1 X let j=firstline+pglen X if (j>maxlines) X then X let j=maxlines X end if X for k=firstline+1 to j X if (k!=linenum) X then X display " ", p_mnv[k].desc_mnv X at l, 1 attribute (normal) X else X display " ", p_mnv[k].desc_mnv at l, 1 X attribute (reverse) X end if X let l=l+1 X end for X if (rdwop<0) X then X for k=l to pglen X display "" at k, 1 attribute (normal) X end for X end if X when (oldline!=linenum) X if (oldline>0) X then X let l=oldline-firstline X display " ", p_mnv[oldline].desc_mnv X at l, 1 attribute (normal) X end if X let l=linenum-firstline X display " ", p_mnv[linenum].desc_mnv at l, 1 X attribute (reverse) X end case X let rdwop=0 X let oldline=linenum X let l=linenum-firstline X display "" at l, maxwidth X let keyhit=readkey() X let i=fgl_lastkey() X case X when int_flag X let getit=false X when i=fgl_keyval("help") X if (help_msg is not null) X then X call showhelp(help_msg) X# X# a word of caution here: X# 4GL sets a global variable named efcode (which can't be used within X# 4GL code) instead of setting status, the result of this being that the X# poor programmer has no way of knowing about (or trapping, for that matter) X# a "missing message" error. X# To make things worse, on entry menus, inputs, etc copy efcode value into X# status so that the poor programmer gets a "no help message" error miles X# away from where the error happened! X# as a workaround help_ok checks & clears efcode X# X if not help_ok() X then X error "Sorry, no help available" X end if X end if X let int_flag=false X when i=13 X let getit=false X when i=fgl_keyval("nextpage") X case X when (linenum+pglen-1=pglen-1) X let linenum=linenum-pglen+1 X let firstline=firstline-pglen+1 X let rdwop=1 X when (firstline>0) and (linenum>pglen-1) X let firstline=0 X let linenum=linenum-pglen+1 X let rdwop=-1 X when (firstline>0) X let firstline=0 X let linenum=1 X let rdwop=-1 X when (linenum>1) X let linenum=1 X end case X when i=fgl_keyval("F1") X case X when (linenum=1) X when (firstline=0) X let linenum=1 X otherwise X let linenum=1 X let firstline=0 X let rdwop=-1 X end case X when i=fgl_keyval("up") X case X when (linenum-firstline>1) X let linenum=linenum-1 X when (linenum>1) X let rdwop=-1 X let linenum=linenum-1 X let firstline=firstline-1 X otherwise X case X when (linenum>=maxlines) X when (linenum-firstline=maxlines) X case X when (linenum=1) X when (firstline=0) X let linenum=1 X otherwise X let linenum=1 X let firstline=0 X let rdwop=-1 X end case X when (linenum-firstline=maxlines) X when (linenum-firstlinefirstline+pglen) X then X let firstline=linenum-1 X let rdwop=-1 X end if X error "Ambigue key hit. Hit to choose option" X exit while X otherwise X let linenum=i X let getit=false X exit while X end case X let j=j-1 X end while X end case X end while X close window mnv_win X if int_flag X then X error "Operation aborted" X let int_flag=false X return "" X else X return linenum X end if Xend function SHAR_EOF if [ `wc -c < vertmenu.4gl` -ne 7778 ] then echo "Lengths do not match -- Bad Copy of vertmenu.4gl" fi echo "Done." exit 0