GURGLE Tutorial: Other Examples

The archive has some sample functions that can be included in your definition files. These include common utiltities etc. Below is an example of a definition file using one of these archive utilities. Copy it into home3.grg or download home3.grg

%%include "chatty.grg"
%%database "phonedir.txt"
%%database "ppage.txt"
%%define MKDIR
%%define DELIM |
%%define NAMCOL
%%define TEXEXT .html
%%equate _CHATTY_FILE "NULL"
%%equate _CHATTY_PATH 1
%%equate _CHATTY_TREE "home3/"
%%equate eq_pre_record CHATTY_FILE(%FIRSTNAME+"_"+%LASTNAME)
  <DD>%ROOM, x#isprivate(%EXTENSION)</DD>
%%block HOMEPAGE
  <DD><A HREF="http://#eval(_homepage)/">#eval(_homepage)</A></DD>
%%equate eval()
%%equate dohomepage(f,l)
  "" >> _homepage
    if %FIRSTNAME = f and %LASTNAME = l then
      %HOMEPAGE >> _homepage
  if _homepage <> "" then outputs("#HOMEPAGE")
%%equate isprivate(extn)
  if extn'0 = 52 then outputs("PRIVATE")
  else outputs(extn)

You will also need to download chatty.grg, string.grg and data.grg from the archive space and save them into your working directory.

The chatty support adds progress messages to the output file generation. See the file itself for more explanation. In the definition file we include it and then override some defaults. The initial output file should be to a non-existent location. We indicate that a directory tree is being built, the root of which is home3/ and then we set the filename at the start of each record. Using the chatty support means we don't need to put the path or the extension in here now.

Now when we gurgle the definition file to produce the web pages we will get progress messages.

user% gurgle home3.grg
+ BUILD /dev/null:                                  PROCESSED: 0.000%
+ BUILD home3/Rosanne_Barr.html:                               12.50%
+ BUILD home3/Joe_Bloggs.html:                                 25.00%
+ BUILD home3/Bill_Clinton.html:                               37.50%
+ BUILD home3/Frasier_Crane.html:                              50.00%
+ BUILD home3/John_Doe.html:                                   62.50%
+ BUILD home3/Jack_Frost.html:                                 75.00%
+ BUILD home3/Jerry_Springer.html:                             87.50%
+ BUILD home3/Mike_Tyson.html:                                 100.0%