This is, ostensibly, the 'iedit' editor, a simple informix-based editor
(though it could be called from anything, it uses Informix's bizarre keys
like ^D for delete-to-end-of-line, etc. -- see your 4gl docs under "input array"
for what keys it uses). However, after I made the mistake of saying it
did wordwrap (which I thought I could hack into it in 30 seconds), I found
that 4gl's input-array + wordwrap didn't work as I was anticipating -- so,
ah, it doesn't do wordwrap. For my penance I've included various util
functions I've written that maybe someone will find useful.
To build, check "CPP" in the Makefile and do "make". (I hope. Works for me.
It wasn't really written to be portable to any environment except ours, which is
kludged up to work around informix's limitations.) I've included the .4gl
file built from the .4 just in case.
To use: iedit filename
Questions to: aburt@du.edu
All work herein without other ownership information is hereby placed into
the public domain. As is, no warranty, use as you want, etc.
As I have it set, all of the C functions get compiled into the new runner.
Most aren't needed, but I don't have time to weed out which, sorry.
Also, I use a hacked cfglgo and cfgldb script because of some silly
problems using esql code in a runner; you shouldn't need it if you avoid
the .ec files (which aren't used in the editor); and if you do want
to use the .ec, you'll probably have to hack these scripts to work locally. :-(
I would put a copy in, but, er, the ugly "trade secret" stuff at the top
makes me think better of it. This isn't as clean as I'd like, but time
precludes a cleanup.
Another possibly useful goodie is the Makefile and its use of cpp to
allow @define, @include in 4gl (which I call ".4" files, that get cpp'd to
produce .4gl files). '#' as comment makes it a bit awkward, but workable.
(Watch out for literal "#" in your strings -- "\#" does the trick.)
Some very half-hearted five minute documentation:
C functions usable in 4gl:
isnumeric
true if string passed only contains numerics
strchar
strchar(string, "!@$") true if string contains any of !@$, etc.
preclip
Removes leading blanks
re_start
Compiles a pattern, returns an int to pass to re_match.
re_match
Takes int from re_start and string, true of matches that compiled pat.
re_sub
Takes int from re_start and substitution request, returns sub'd value
re_end
Cleans up from re_start.
See the substitute() and matchre() functions in util.4 for an example.
makelist
unmakelist
add2list
push2list
isonlist
del1stonlist
startlist
nextlist
listsize
creates a linked list, adds to it at end or front, tests if value is
on the list, removes from list, walks through list, destroys list.
qlnode2rec
mkqlist
del1stonqlist
startqlist
nextqlist
unmakeqlist
Turns a query into a linked list of values
fopen_if
fclose_if
fgetline
fputline
Standard I/O access (4gl name is w/o "_if")
mktmpf
Unix make-temp-file function
fdelete
Remove file
faccess
Unix access() function
filesize
Size of file in bytes
system_if
System() function
getpid_if
Unix getpid()
delzero
Deletes leading 0's
/* misc application specific */
chk_allocarea
get_allocarea
set_allocarea
log_allocarea
clr_allocarea
The infamous -4518 bug routines. Mainly in here for calling
clr_allocarea. We ended up replacing the fgl_alloc functions
after having irreconcilable differences with Informix about
solving the -4518, and have a non-supported replacement for it,
but that we can't give out.
dl.c has a set of generic doubly-linked list functions for C. I've tossed
in dl.man and dltst.c for your enjoyment. They aren't necessary for iedit.
The stuff in the 're' subdir are off the net, Henry Spencer's regexp code for C.
4gl functions from util.4:
Some of these are used in iedit (and are incorporated into iedit.4)
function oopse(s)
Display s as "error".
function oopsw(s)
Display s as "warning".
function oops(msg, s)
Display s as msg.
function start_wait(msg)
Start a box saying "wait" (flashing) msg.
function end_wait()
Clean up the wait box.
function min(a, b)
min of a,b
function ok(msg1, msg2, msg3)
prints msg1/2/3 with yes/no choice after msg3
function substitute(pat, repl, text)
returns 'text' replaced per 'repl' based on 'pat'.
function matchre(text, pat)
true/false whether text matches pat.
function more(fname, title)
Displays fname in a box with title at top. F10/escape to quit.
function smallmore(fname, title)
Small box, uses return to quit.
function print_file(f)
prints file via whatever program you tell it to use.
function preview(fname)
cleans up fname for screen display, based on your idea of 'clean'.
function init_acckey(key)
function push_acckey(key)
function pop_acckey()
function set_acckey(key)
These set up a stack for the accept key. See iedit.4 for example
of use. I.e., you can do "set accept key" in 4gl, but you can't
then go *back* to what it was before you set it; with this you
can. (You push a new one, then pop back to the old key.)