D'Arcy J.M. Cain
Generate - a file generating utility
Version 3.0Generate is a text preprocessor that I originally wrote to help me write custom accounting applications based on the Progress database product. I felt that the built in wasn't useful enough so I designed a new one and implemented it. It actually started life as a package configuration and batch file generator for DOS and mutated to a simple script interpreter to replace shar file distribution. At this point it has almost nothing in common with that first program.
The basic idea behind generate is to interpret a script which generates files. There is some simple flow control constructs but the power lies in its macro processing. I have shamelessly stolen ideas from cpp, m4, make and David Tilbrook's dtree.
There are a few extra files in the distribution which come from my personal library which you may find useful in themselves. Here is a short description of these:
- cain.h
- The header file used by generate.c as well as the extras. It prototypes my functions.
- getarg.c
- This is my replacement for getopt. It looks the same to the user but allows the programmer to allow mixing option and non-option arguments on the command line and simplifies the method of getting defaults and extra arguments from various sources.
- cgetline.c
- My unbounded line input function. Given different defines at compile time it can compile into getline(3), a simple unbounded input function, xgetline(3) which does the same except that it does comment processing, line continuation, etc. and xcat(1) which implements xgetline as a command for shell script processing.
- xstrtok.c
- A replacement for strtok(3). Because strtok is a little brain dead about multiple calls this is a modified version which carries the pertinent information in a structure. This allows more than one string to be parsed at the same time (the code is re-entrant.)
- expr.c
- This is a program written by J.T. Conklin
to do expression processing. I modified it and turned it into a callable C function. - memory.c
- Functions to handle memory allocations such that they can be extended and freed easily. There are also functions to do LILO and FILO stack functions.
- sockunix.c
- Implements sock_open for Unix systems. If anyone wants to make a DOS version I'll include it in the package.
- fatal.c
- Implements a common FATAL function. The idea is to define fatal as this with a local info string.
- Casts have been added to prevent compiler warnings.
- Allows over 10 positional parameters (Derik Barclay
) - Code cleanups and added casts.
- Add header for Posix.
- Duplicate strdup function for portability.
- Convert strdup() call to inline code for portability.
- Minor formatting changes.
- Fix FreeBSD build.
- Fix distribution pointers.
To build the distribution you should simply have to run make (GNU Make). If you need to do more (other than to change the compiler or CFLAGS) please let me know. You may want to define MANDIR and BINDIR for installation if you want to install into somewhere other than /usr/local.
The major differences between 2.1 and 2.2 are:
The major differences between 2.2 and 2.3 are:
The major differences between 2.3 and 2.4 are:
The major differences between 2.4 and 2.5 are:
The major differences between 2.5 and 2.6 are:
The major differences between 2.6 and 2.8 are:
Version 3.0 is a major rewrite. I found that it was not behaving as described in the documentation. Also, it dumped core when built on current systems (FreeBSD 14.1 e.g.) so the old version really had to go. You may need to make a few modifications to your old input files. In particular, macro expansion was not being done as described. If you want macro expansion to be done while in quotes you need to escape the quotes. That is how it was always described in the documentation.
This program may be freely distributed as long as credit is given to D'Arcy J.M. Cain, the source is included and this notice remains intact. There is specifically no restrictions on use of the program including personal or commercial. You may even charge others for this program as long as the above conditions are met.
This is not shareware and no registration fee is expected. If you like the program and want to support this method of distribution, write a program and distribute it the same way and I will feel I have been paid.
The distribution of the latest version is available as a shar file or as a compressed tar file.
Of course gifts of money, drinks and extravagant jewels are always welcome.