; CFG2 SCRIPT FOR GENERATING CAPTAIN CHAOS' WEB SITE
; TSECFGEXPR '{\<\%HEAD}|{\#send}'
; TSECFGOPTS 'ix'
;===========================================================================
; 20020504 MSD 035 The TELLTALE related stuff wasn't displaying TELLTALE's
; 035 version number because "TT_VER" was being cited instead of
; 035 "TELLTALE_VER".
; 20020410 MSD 034 Altered CFG2 to be LINUX/GCC friendly. Add the CFG2
; 034 *source* ZIP file.
; 20010603 MSD 033 Added the TELLTALE program to the utilities.
; 20010531 MSD 032 Updated the PNR related items.
; 20010406 MSD 031 Cosmetics and typos.
; 20010324 MSD 030 Extend the version numbering scheme so that a seperate
; 030 version number is kept for each application throughout
; 030 the generation process. This means that the version
; 030 numbers can be used in the application-specific pages as
; 030 well as in the home page.
; 20010324 MSD 029 Add a bit to point out that it is the CCU program that
; 029 converts all local files to lower-case after the web site
; 029 files are generated.
; 20010324 MSD 028 The ChAoS web site takes CFG2 five or six seconds to
; 028 generate. Since CFG2 always takes the *current* date
; 028 and/or time when asked, I've noticed that the dates and
; 028 times *very* on the site pages depending upon their
; 028 generation order. Hence, this modification: to change
; 028 the system so that CFG2 is asked for the date and time
; 028 which is then saved in a #DEFINEd variable and used for
; 028 all subsequent time stamps.
; 20010322 MSD 027 Correct a small typo relating to the diskette sanity check
; 027 script of CDU.
; 20010314 MSD 026 Adopt latest version of PNR. The main change was to add the
; 026 "look at the end of the file for the changes log" text.
; 20010312 MSD 025 Adopt latest version of CDU. (Including an appeal for beta
; 025 testers with version *three* INT13ex APIs.)
; 20010311 MSD 024 make use of the new "standard" version numbering scheme to
; 024 allow the web pages to show some of the latest version
; 024 numbers.
; 20010306 MSD 023 Adopt the new CDU HTML documentation files.
; 20010305 MSD 022 A couple of cosmetic changes and a slight improvement to the
; 022 ABI2, PNR and PROBE2 pages.
; 20010227 MSD 021 I went searching for a Windows, command-line application
; 021 that would rename all my files to lower-case. I found any
; 021 number that were *GUI* apps (sigh) and only a couple that
; 021 were console apps. These both "suffered from being crap"
; 021 (more sighs) and I ended up writing a Noddy little app, CCU,
; 021 myself. Hence this alteration: removed the text that said
; 021 this was done by hand as this is no longer true.
; 20010226 MSD 020 Cosmetic changes to bring this into line with the way I do
; 020 things in the new CFG2 documentation.
; 20010224 MSD 019 Added code for the new CFG2 documentation and a link to the
; 019 corresponding CFG2 script file.
; 20010223 MSD 018 Make sure that the address of the web site is on each page.
; 20010214 MSD 017 (a) Adopt latest CFG2 (1.1.177) that allows a zero width
; 017 margin.
; 017 Also, take account of some file name changes.
; 20010211 MSD 016 (a) Turned on blank-line generation so that the generated
; 016 HTML is somewhat more readable with a text editor.
; 016 (b) Use the new "#SEND
This is version %%VERSION%% of the web site generated by
%CFG2PROGNAME% on %%DATIM_STRING%%. Problems? Suggestions?
Email the webmaster.
%RAWSITE%
%VERSION% of %DATIM_NUMERIC%
This is the home page of the ChAoS Programmer's Utilities. Included in these utilities are a couple of low-level disk utilities, a
serial comms datascope program and a configuration file generator. In
addition, there is a Windows-based program launcher. These utilities have been written mainly by Mark Davis with
contributions from Mark Edmunds and Stephen Coul. Usually, we write a
utility because we either can't buy what we want or there are
commercial products available but they are too expensive or don't do
exactly what we want. Most of these programs are available for download. In addition,
some of the program sources are also provided. If you are desperate
to "play" with something that is not available, you can chivvy things along
a bit by contacting me (Mark Davis) on
the normal email address. Click on the thumb-nail sketches, below, to learn more about each
program. Each small section has the utility's current download "status".
If you do download one of the utilities, especially if you
find it useful, can you please email us at the
new user address. This allows us to get a rough idea of the number of
users out there.
THE AUTHORS OF THE CHAOS UTILITIES SPECIFICALLY DISCLAIM ALL
WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO
EVENT SHALL WE BE LIABLE FOR ANY DAMAGE THE UTILITIES MAY CAUSE, INCLUDING
BUT NOT LIMITED TO SPECIAL, INCIDENTAL, CONSEQUENTIAL OR OTHER DAMAGES. We are fans of Terry Pratchett's "Discworld" novels. A character in his
book "Soul Music" is called "Glod" and we thought that it'd be neat to use
it in a domain name. If you want to learn more, why not visit the
Discworld fan site?
ABI2 is an MSdos/TurboVision based sector-level disk editor and viewing
utility. It can view and, via a write-to-disk facility, edit disk data at
the sector level. It can also do track-by-track disk copying.
In fact, in conjunction with removal disk "caddies", we used to use ABI2
to duplicate our hard disk data for backup purposes - the reason that we
don't still do that is that we find CDU
somewhat more convenient to use for this purpose.
#define CODE_END
;===========================================================================
; Specifying this switch will create a de-Curtised directory. That is, it's
; the equivalent of a "MAKE CLEAN" on a development project that uses "MAKE".
; In fact, I've now changed the system so that it generates all of the files
; that should appear in a *separate* directory. This allows them to be
; cleaned up (that is, deleted) all in one go. Still, this switch is left in
; so that you can try CFG2 out on this script and clean up easily afterwards.
#switch !MAKECLEAN
;===========================================================================
#file INDEXhtml index.htm ; Root page of the web site.
#file UpTime uptime.txt ; Allows "uptime" monitoring.
; These are the application files - each one describes a particular ChAoS
; application.
#file ABI2html wabi2.htm
#file CFG2html wcfg2.htm
#file PNRhtml wpnr.htm
#file TThtml wtt.htm
#file PROBE2html wprobe2.htm
#file CDUhtml wcdu.htm
;===========================================================================
; The following file is a temporary file *generated* by this CFG2 script and,
; at a later time, read back *in* by CFG2. The idea is to generate a file
; that, with the use of defined variables, will allow the generation of
; similar HTML sections.
; In this case, it's used to make the "thumbnail" descriptions, pictures and
; links for each application. Hence, for each application, the defines are
; defined and this file is included.
; Note that this file is *deleted* at the end of this script so, if all goes
; well, you shouldn't actually *see* the resulting file.
; By the way, the reason that there's *two* definitions of the file is that
; one is used when the file *generated* and the other when it is *included*.
; The way that this works may change in later version of CFG2 - but probably
; not...
#file THUMBhtmlGEN wapp.htm
#source THUMBhtmlINC wapp.htm
;===========================================================================
; This file is similar to the thumb-nail link generator, above, except that
; it is used to generate the button-filled header and trailer HTML source for
; each generated HTML file.
; As before, this file is *deleted* at the end of this script.
#file BUTTONhtmlGEN wbut.htm
#source BUTTONhtmlINC wbut.htm
;===========================================================================
; Another small file that is included by this script. This time, this one
; contains the list of meta tags that go before the non-common ones.
; As always, this file is *deleted* at the end of this script.
#file METAhtmlGEN wmet.htm
#source METAhtmlINC wmet.htm
;===========================================================================
; As well as switching file output on and off via a #IF construct, CFG2 can
; do so using a line-by-line facility. Do this this, a "margin" is defined
; and, any text found *in* this margin, is "evaluated" (see the CFG2 source
; code) and, if the result is "true", the text is written out to the
; relevant file.
; In this case, however, we have no real need for this facility. Now, I
; *could* have set the margin to zero. However, if one does this, there is a
; small problem lurking: consider an attempt to generate a CFG2 source file
; from *within* this source. With a zero-based margin, all "special" words
; (for example, a #FILE directive) would be *executed* rather than being sent
; to the output file. With a margin of *one*, this isn't a problem because
; the leading space on the text that has to be sent to the source file will
; stop it being recognised as a "special" line. The line of text, however,
; will have the margin width *removed* before it's sent to the file, so when
; the file is read back *in*, the special lines *are* executed properly.
; Hence, in this instance, we set the margin width to "one" until all
; temporary source files have been generated. Thereafter, we set the margin
; width to "zero" thus making full use of the screen's width.
#margin 1
;---------------------------------------------------------------------------
; I might as well make the generated HTML easily readable in a text editor
; since difference in load time probably won't be noticeable. Also, if a user
; *doesn't* have an HTML viewer, they'll *still* be able to read the
; documentation. In the case of my web site files, of course, this is a bit
; academic. However, I hope to convert all program *documentation* files to
; "lucid" format, soon.
; The following command will force empty (that is, blank) lines to passed
; through unchanged. This saves the over-use of the CFG2 special character
; that will force the generation of an empty line.
#empty 1
; Note that, on occasion, I've used a single semi-colon (comment) character
; in the very first column of a line for no apparent reason. This is just a
; symptom of my fussiness - without the comment line, an extra (unwanted)
; blank line would be produced. For example, consider this example:
; File line one.
; ; A comment taking up two
; ; regular lines of input text.
; File line two.
; Under normal circumstances, with #EMPTY lines enabled, this would produce
; *two* blank lines between the first and second desired lines of text. The
; following would *not*:
; File line one.
; ; A comment taking up two
; ; regular lines of input text.
;
; File line two.
; Note the comment in the "first" column (ignoring spurious indentation) of
; the line before the second required text line. This is sufficient to
; inhibit the second blank line between the two required lines of text. (I
; *did* say I was being fussy, here...)
; Likewise, single-character comment lines appear immediately after the
; #SEND and before the #CLOSE of the "temporary HTML files. This is so that
; they neither start nor end with a blank line. Since blanks line are put
; around the corresponding #INCLUD lines to make the CFG2 source easier to
; read, blank lines in the #INCLUDed files would only generate too many blank
; lines. (To see what I mean, try taking them out.)
;===========================================================================
; This bit of code generates an thumb-nail "template" file that will, at a
; later stage, be read in to generate the thumbnail views and text for each
; application in turn.
; Note that lines between the #SEND and #CLOSE are *data* and are *not*
; "executed" until the file is #INCLUDed during the generation of the main
; HTML index page.
; In particular, note the "escaping" of all percent characters by using two
; at a time. (We want the percent characters to come out in the output file;
; we do *not* want them expanded before the text is output.)
; The following defines are here really as "documentation". They detail the
; items that must be defined before including the following template "source"
; file. But note that they must be #DEFINEd before they can be #REDEFined
; later - the #REDEF will *not* accept a variable name that hasn't already
; been defined. Likewise, the #SWITCHes must be declared so that they can
; be #SET before this file is #INCLUDed.
#define APPTITLE ; Name of each application in the set.
#define APPFILE ; Lower-case name of application files.
#define APPDESC ; Current application description.
#switch APPEXE ; True if the executable is available for download.
#switch APPSRC ; True if the source is available for download.
#switch APPVER ; True if the util has a "standard" version number file.
#define APPROOT ; Root of development directory.
#define PVERSION ; Pre-define the util's common "C" version macro name.
#say Generating thumb-nail link template HTML file.
#send THUMBhtmlGEN
;
<%HEADINGSUB%>
%%APPTITLE%%
#if APPVER
#source %%APPTITLE%%VER %%APPROOT%%\%%APPTITLE%%\VERSION.INI
#includ %%APPTITLE%%VER
#define %%APPTITLE%%_VER %%PVERSION%%
%%PVERSION%%
#endif
%HEADINGSUB%>
%%APPDESC%%
Status: executable is
#if APPEXE
available;;;;
#else
not available;;;;
#endif
;
source is
#if APPSRC
available.
#else
not available.
#endif
;
#close THUMBhtmlGEN
;===========================================================================
; This generates the HTML header and footer HTML text.
; As far as I can see, there is no difference between using WINDOW.LOCATION
; instead of LOCATION.HREF in the following "snippet" of code.
;---------------------------------------------------------------------------
; I *used* to use this to generate a row of BUTTONs at the head ; and foot
; of each page:
;
; However, besides depending upon the correct interpretation of the ONCLICK
; command, these also don't get rendered correctly on a *text* web browser.
; Hence, I have ditched them in favour of plain ol' anchors and HREFs.
;---------------------------------------------------------------------------
; I used to use the following little bit of JavaScript to generate the
; site's datim string. However, it depends, like the code fragment above,
; on correct interpretation by the browser and also generates the file's
; *upload* time to my web site provider rather than the datim that the file
; was *generated*. Since I have altered CFG2 to be able to generate its
; *own* datim strings, I now use *those*, instead.
;
;---------------------------------------------------------------------------
#switch ATTOP ; True if this call is from a "header".
#say Generating header and footer template HTML file.
#send BUTTONhtmlGEN
;
#if ATTOP
#else
#else
#endif
;
#close BUTTONhtmlGEN
;===========================================================================
; This generates the common meta tag text.
#say Generating META tag HTML file.
#send METAhtmlGEN
;
;
#close METAhtmlGEN
;===========================================================================
; All temporary files have been generated. We now revert to a zero-based
; margin to make full use of the line length.
#margin 0
;===========================================================================
; It might be nice to place a heading comment in all the generated HTML
; files detailing *how* they were made. This section does that. In addition,
; it adds the (required) DOCTYPE entry.
; This next #SEND command will send to all main HTML files. Note that the
; "temporary" HTML files, that is, the ones generated and then deleted at the
; end of run, will be *excluded* because their file tags do not *end* with the
; characters "HTML".
#send *html
;
#close *
;===========================================================================
#say Generating index HTML file.
#send INDEXhtml
<%HEADINGSUB%> Disclaimer %HEADINGSUB%>
<%HEADINGSUB%> Why "Glod"? %HEADINGSUB%>
Note that the latest version of ABI2 has on-the-fly compression built in - it can generate GZIP-compatible files as it reads data from the disk. This much reduces disk space requirements. (If it could not do this, one would have to read the data off and then compress it. During this latter compression, of course, you'd have to have two copies of the data on your storage device.)
We have included the current version of the documentation for ABI2 so that you can get an idea of the program's capabilities.
#set !ATTOP #includ BUTTONhtmlINC #close ABI2html ;=========================================================================== #say Generating PROBE2 application HTML file. #send PROBE2htmlPROBE2 is an MSdos/TurboVision based serial data-scope with limited terminal emulator facilities. It can (currently) handle up to four serial ports and the user can configure the usual things such as baud rate, data bits, stop bits, etc. In addition, one can cope with non-standard serial port hardware by specifying the UART's crystal speed.
It is programmable via an in-built Forth-like interpreter.
Its main feature, however, is the "scope window" whereby the user can display input from the serial channels much in the manner of a "data-scope".
It requires an MSdos compatible operating system in order to run but can be used under Win95, although a "real" MSdos system is recommended. (Time to break out all those old '486 and P100 systems that are clogging up your office...)
PROBE2 can capture to text files and the user can trigger events based upon received data, change of busy channel, time outs and so on.
In order that you can get a better idea of PROBE2's capabilities and method of operation, We have placed a few of the issued files on this site.
PROBE2 holds its settings in a text file that is not dissimilar to Windows' configuration files.
In common with most software, PROBE2 comes with a "read me" file. In addition, we provide a FAQ and a tutorial. Different versions of PROBE2 are detailed in the change log.
As mentioned above, PROBE2 has an in-built script language. At present, this is a dialect of Forth. We have provided a number of scripts including a system header file that should be included in all user-generated scripts and a script used in PROBE2's tutorial.
Finally, we present a slightly frivolous application - in this case, the requirement was to emulate a GPS device by generating a set of NMEA 0183 "sentences".
#set !ATTOP #includ BUTTONhtmlINC #close PROBE2html ;=========================================================================== #say Generating PNR application HTML file. #send PNRhtmlPNR is a Windows-based program launcher.
The intention was to write an equivalent of MSdos "batch files". Thus, one could create a link (ie, a "short-cut") to a PNR command-line that would run a user-specified command on files picked from a standard Windows "open file" dialogue box.
The dialogue box, below, shows an example PNR pick box. In this example, PNR has been used to generate a pick box which allows the user to pick one or more files. When they have selected their file(s), then a small menu is displayed from which the user can indicate which action they wish to carry out.
In this instance, the short-cut used to invoke PNR looked like this:
%CODE_START% pnr.exe @website@ %CODE_END%The text bracketed by "at" signs makes PNR read a reponse file into the command-line. Here, this file is being used to provide the entire PNR command-line. The WEBSITE.PNR file (the .PNR extension is implicit) contains this text:
%CODE_START% -du -cg -dh -dm*.htm;*.txt "-dtEdit Or View Web Site File" "-df HTML Files ! *.htm" "-df Text Files ! *.txt" "-df JPEG Files ! *.jpg" "-df All Files ! *.*" -mnNotePad "-mcNOTEPAD %1" -mnWordPad "-mcC:\PROGRA~1\ACCESS~1\WORDPAD.EXE %1" -mnBrowse "-mcC:\PROGRA~1\INTERN~2\IEXPLORE.EXE %1" %CODE_END%In this file, the "-dh" stops the PNR help button from appearing on the open file dialogue box. The "-du" allows multiple files to be selected. The "-cg" makes PNR invoke the cited program with all selected files on a single command-line rather than the default action of invoking the cited program once for each selected file.
The "-dm" parameter sets the files that will be "seen" when the pick box starts up. Here, we want .HTM and .TXT files to be displayed - other files can be selected by using the "files of type" drop down box.
The "-dt" option merely sets the title text of the generated pick box. This shows, by the way, that it is possible to invoke PNR from a program via a CREATEPROCESS() function call and have PNR disguise the fact that is a separate program. Note that parameters that contain spaces should be enclosed in quotes.
Each "-df" parameter adds an extra file type extension and descriptive text to one of the drop down text boxes that appear in the pick box. In this case, the catch all entry of "*.*" has been added in case the user wants to select a file of a type different to those named.
Finally, the last three lines are used to build the items of the menu that appears after the files have been picked from the file dialogue. The "-mn" parameter sets the menu item text and the "-mc" specifies the corresponding executable command-line text. Note that if these menu lines are replaced by a simple command ("start %1", for example), then no menu will be displayed and PNR would simply execute the cited command.
So, here is the pick box generated by the above PNR command-line:
If no menu-building parameters are specified, PNR accrues parameters until it comes across an item that is not preceded by a minus-sign. It generates the appropriate dialogue box and displays it. When the dialogue box is accepted, PNR initiates the remainder of its command-line using the command processor after doing file name replacement. It does this for each file selected by the user.
If menu items are specified, the process is very similar except that PNR waits for the user to pick which command-line should be executed. The name replacement processing and so on is, of course, the same.
At present, PNR does not have separate documentation - when the pick box is displayed, PNR's help is displayed if one clicks the pick box's "help" button. (This can be inhibited, as has already been stated, by using PNR's "-dh" parameter.) Look at the end of the help text for the log of program changes.
#set !ATTOP #includ BUTTONhtmlINC #close PNRhtml ;=========================================================================== #say Generating CFG2 application HTML file. #send CFG2htmlCFG2 is an MSdos or LINUX based configuration text file generator.
The idea was to write a program that could, when the user configured the program via "switches", automagically generate such things as the AUTOEXEC.BAT file, the CONFIG.SYS file, compiler "make" files, program configuration .INI files and so on. It has even been used to generate high-level program source files.
CFG2 is a command-line utility and we have made the full text of this program's help page available. CFG2 comes with a "read me" file, FAQ, tutorial, change log and reference manual.
CFG2 is used to generate the HTML source files for this web site. In order to allow you to see the sorts of things that CFG2 can do, we have left the CFG2 script file on this web site. In this file, many of the "special" words shown in the CFG2's help page can be seen in actual use. In addition, some of the ChAoS Utilities come with HTML documentation files that have been generated using CFG2 as well. These represent good examples of large CFG2 scripts. Therefore, it may be worth having a look at the CFG2 script for PROBE2's HTML, the script for CFG2's HTML, the script for CDU's HTML and the script for TELLTALE's HTML. (These scripts are not intended to be CFG2 tutorials so they're not as heavily commented as the CFG2 example scripts.)
For completeness, we present the batch file that is used to drive CFG2 in order to generate the web site files and to clean up afterwards. (Note that while the generated files work under Windows, in order to work in the real world, the files must be renamed to all lower-case letters. This is the task that is performed by the call of the CCU program in the batch file.)
#set !ATTOP #includ BUTTONhtmlINC #close CFG2html ;=========================================================================== #say Generating CDU application HTML file. #send CDUhtmlPLEASE NOTE THAT CDU IS STILL IN BETA-TEST. Although the CDU is now available, it is still in beta-test. We have decided to make it available because it is very useful even if all the little "funnies" haven't been ironed out. For the most part, these may very well not go away - they are not simply programming bugs but are due to API inadequacies, our ignorance of the APIs and so on. We have a very small number of beta-testers and things progress slowly so, if you think you can help improve CDU, we'd very much like to have you aboard as a CDU beta-tester - system programming "techies" are particularly sought after. If you're interested in becoming a CDU beta-tester, please contact us at the CDU email address.
In particular, CDU now displays the INT13ex API version number if something like "CDU VERBOSE PROBE" is used. We would be very interested in input from beta testers with version three APIs. For example, this machine has a version one API (the "0x01" bit):
%CODE_START% Drive HD0 INT13ex version 0x01 API bits 0x03 %CODE_END%CDU is an MSdos-based, command-line, sector-level disk editor and viewing utility.
The capabilities are very similar to those of ABI2, except that CDU is not an interactive program and that it can access drives that ABI2 can't handle. ABI2 can handle drives up to the CHS/BIOS limit of eight gigabytes whereas CDU is only limited by the extended INT13 interface.
CDU is a command-line utility and we have made available the full text of CDU's help page. CDU comes with a "read me" file, FAQ, tutorial, change log and reference manual.
CDU operates using a concept of "streams". Each command requires one or two streams to be cited and, for the most part, commands operate the same regardless of the type of stream being used. Thus, one can copy a complete disk image to a compressed file but, since CDU is stream based, another file can be used as the source, as well. Examples of stream types are hard drives, files, GZIP archives, character values and MSdos volumes.
In addition to the documentation, CDU comes with a few heavily-commented example script files. There's one that captures a floppy's contents, one that will write an image file to a floppy and one that will sanity check a newly-formatted floppy.
#set !ATTOP #includ BUTTONhtmlINC #close CDUhtml ;=========================================================================== #say Generating TELLTALE application HTML file. #send TThtmlTELLTALE is a Windows-based program that displays status indicators.
With many batch processes, a large amount of "clutter" means that it's not always obvious whether the procedure has succeeded or not. TELLTALE allows you to add a few simple lines to your batch file and have the results of the process displayed in a clear manner.
In addition, these tell-tales can be set via the in-built PING facility thus allowing the user to monitor the "health" of several host computers at a time.
For example, the following tell-tales are the result of three invocations of a batch file detailed in the TELLTALE tutorial:
TELLTALE comes with a "read me" file, FAQ, tutorial, change log and small reference manual.
#set !ATTOP #includ BUTTONhtmlINC #close TThtml ;=========================================================================== ; We have now finished with these template files. #delete BUTTONhtmlGEN #delete METAhtmlGEN ;=========================================================================== ; For details of this free web page "uptime" monitoring service, see ; http://uptime.arsdigita.com/uptime/ ; The idea is that you put a file on your site that contains the single word ; "success". The uptime monitor tries to access the site every quarter of ; an hour or so. If it can't access your site, the uptime software emails you ; with a message to that effect. It also emails you when the site comes back ; up again. ; I'm not sure that the trailing carriage-return / line-feed pair *must* be ; suppressed but I did so the first time I tried it and it seemed to be happy ; so I left it that way... #say Generating uptime monitor file. #send UpTime success_ ; Trailing under-line to inhibit trailing CR-LF pair. #close * ;=========================================================================== #if MAKECLEAN #say #say Making clean - all generated files will be deleted. #delete * #say Making clean - complete. #endif