Treasure Chest

A selection of tools, mostly taken out of larger applications

Unix
4glWorks
SQSL
Informix-4gl
Perl

Unix

Shark is a shameless rewrite of Jonathan Leffler's (for those not familiar with comp.databases.informix, he is by far the most rated contributor) shar.

Over shar, shark has a number of advantages:

  • it produces code that creates all the necessary subdirectories
  • it produces code that restores links existing at shark time
  • it handles exec permissions
  • allows to specify multiple "autoexec" and "plugin" scripts
  • has two file names of special significance

    • entry
    • readme

    entry can be used to produce a custom entry message; readme to give the user last minute info at the end of the unshark process. Both files can be placed in any subdir in the argument list. Note that there can be only be entry, and it is NOT unsharked. By contrast, more than one readme is allowed.
A functionality I like to put in my 4gl apps is the ability to add/remove users from /etc/passwd and /etc/group at the same time I grant/revoke from them access to a database.
Achieving this is no big deal. You only need a couple of shell scripts you can call from the command line that alter /etc/passwd, possibly /etc/shadow, and /etc/group and create (or remove) the appropriate user directory and .profile.
Here you can download mine.
Smartbk is a simple cpio/compress frontend which I have always used for my archives and file movement. I have never considered it more than a toy, but of late it has struck me as accomplishing a lot, for circa 300 lines of awk code.
Given a set of device / directory / destination definitions, it will build and run a shell script that moves files (compressing or decompressing the archive, as appropriate) from a (any) source to a (any!) target as specified in the command line taking care of stuff like remote hosts and device sizes, asking the user for new media, whenever necessary. Extra goodies include incremental and relative operations.
OK, so GNU tar does most of that! but does it handle multi volume compressed archives?

4glWorks

4gwMail is a mail user agent / news reader based on Informix-4gl. Not Eudora pro, but definitely with more features than you'd expect (It would probably pass the USENET sanity check).
As per 4glWorks philosophy, it can be quickly fitted into existing 4glWorks applications, and making use of BSD mail folders, .newsrc newsgroup status file and full mail folders locking, it allows the user to manage their mail messages, folders and newsgroups both from within 4gl applications and using their favourite mailer.

Requires: 4glWorks 2.0b10 or above

4gwMenus is an isql menus replacement that allows quick bolting to 4gl applications of dynamic menus and custom data browsers. It caters for both external executables/scripts, with the added benefit of an expansion feature borrowed from the 4glWorks Structured Query Scripting Language interpreter, and of course SQSL scripts.
It also comes with a simple command line interpreter, capable of html output too. It is meant for usage within shell scripts, but comes handy from within the interactive interpreter as well, as can be seen from the demo.
A complete CGI interface, planned, hasn't yet made it into the distribution.

Requires: 4glWorks 2.0b13 or above

4gwEd has been ripped off from 4gwMenus above. Essentially it is a glorified dbaccess, which I have quickly bolted together as a means to run some test cases. It has proven to be more useful than I had originally anticipated, hence its presence here. Did I mention that it does html too?

Requires: 4glWorks 2.0b13 or above

SQSL

Should you wish to use any of the SQSL aware tools above against DB2, you will probably need this data source

Informix-4gl

fglpp is my precompiler for Informix-4gl. It supports #include & #define directives, cpp style. Much slower than cpp, but:

  • it tries to preserve as much as possible line numbers. In particular, #define and comments only #include files will not alter the line count of the resulting 4gl file.
  • has directory search capabilities, so you can place globals & #include files in different directories from your source code
  • directives can be included in, and are applied to globals files as well, allowing you, for instance, to have application-wide arrays whose size depends on the application being compiled, or have a primitive user defined type declaration
  • as a bonus, it simulates multiple globals files, if your 4gl doesn't support them

A word of caution: to speed up execution, fglpp uses pattern matching for substituting definitions. This is not totally secure, and, for poorly named #defines, it could lead to the wrong token being substituted (this usually leads to compile time errors - so fear not incomprehensible bugs, at least if you don't name a definition like a substring of another).
Also, no attempt has been made to avoid substitutions within comments or quoted strings.
One of these centuries, I'll write a similar tool in c. For now this is what I have to offer.

Scriba is a set of awk and shell scripts written to quickly gather and format documentation info straight from 4gl source code, much like java's javadoc tool.

I tried to put the accent on the ability to automatically update documentation whenever the code changes. The documentation extractor can keep track of the functions that have already been documented, and extracts only info from those that haven't.
Other tools can subsequently be used to merge HTML documentation files, preserving possible headers and footers, and sorting the resulting file by function name; generate a TOC from this sorted HTML file, and insert (or update) the TOC itself back in the documentation or in a main TOC file.

The core of the tool, create_man_entries, scans 4gl source files extracting FUNCTION and REPORT declarations, complete with parameter DEFINEs, as well as comments (purged from decorative lines - those full of #,=,-_+,*) found right before the declarations themselves and all the RETURNed values, the idea behind this being that such comments will give a description of the function purposes, while the RETURNed values will prove useful when manually polishing the documentation.
The tool output is, of course, already formatted and provides a pointer to the source file, the already mentioned "declaration", "purpose" and "returns" sections, as well as a "notes" and "example" section, which will have to be filled in by hand.
I have tested it against a variety of coding habits, using code mostly coming from the IIUG software archives, and except for one author (who simply doesn't put comments on top of functions or reports) it has always extracted the correct code and comments.

fglio is an input/output package for Informix-4gl. It essentially doubles stdio functionality, offering file and pipe IO, multiple IO streams, file locking, stream pointer repositioning, and a number of enancements like user defined IO streams (as a bonus, included find a simple sockets client), or input line folding at word boundaries.
Interested? have a look at the documentation
fglcgi offers a set of functions oriented towards the creation of CGI compliant executables using Informix-4gl.
The package contains also a number of utilities focussing on user validation ad suid cgi executables.
Want to know how to put blobs in reports? here's how
4gl lacks a random number generator, so I wrote one
Tired of ring menus? give pull down menus a try
Textman is a simple but effective tool to manipulate (add, change, drop, retrieve lines and substrings from ) text blobs from within 4gl applications. If the concept intrigues you, have a look at the documentation
Fglhash is a simple implementation of associative arrays based on byte variables located in memory. Find here the documentation.

Perl

DBIx-cgivalidate is a small tool which I wrote in conjunction with the DBD::Informix - Apache Howto to demonstrate user validation from within cgi scripts.

This page maintained by marco greco
(last updated Jul, 07 2005)