home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / z3doc / tlib.lbr / TLIB.DZC / TLIB.DOC
Encoding:
Text File  |  1993-06-07  |  16.8 KB  |  350 lines

  1. TLIB.DOC
  2.   by Rick Charnes, San Francisco, November 18, 1986      
  3.  
  4.       This is my second, and favorite, ALIAS I've written
  5. that can be used to type out member files within a library -
  6. straight ASCII, squeezed, or crunched.  (The other was TLF.COM) 
  7. They both came into being when I realized that with the growing
  8. popularity of Steven Greenberg's CRUNCH file compression
  9. algorighm NULU could no longer be relied upon to deal with
  10. libraries, missing as it is a capability to deal with files of
  11. this sort.
  12.  
  13.       Syntax is simple.  Make sure TLIB.COM, TLIB2.COM, and
  14. EXIT.COM are all on your disk, and type:
  15.  
  16.                   TLIB [DU:] <libraryname> 
  17.  
  18. VERY IMPORTANT:
  19. (NOTE NECESSARY SPACE BETWEEN OPTIONAL DU: AND <LIBRARYNAME>
  20.  
  21. (note also: until Master Greenberg comes up with a full Z-System
  22. version of TYPELZ that supports named directories, [DU:] here can
  23. only be drive/user and not an NDR.)
  24.  
  25.       When an exit is desired, type 'BYE' at the "FILE TO TYPE"
  26. prompt.
  27.  
  28.      --> Some changing of terminal escape sequences in TLIB.COM, 
  29. TLIB2.COM, and EXIT.COM may be necessary.  My apologies for 
  30. releasing something with non-standardized elements.  In TLIB.COM 
  31. I use ESC ) for half intensity, ESC ( for normaly intensity.  In 
  32. TLIB2.COM I use <ESC>G8 for underlining and <ESC>G0 turns it off, 
  33. and in EXIT.COM <ESC>G4 turns on reverse video and this also 
  34. turns off with <ES>G0.  You should set your own or change it to 
  35. whatever you like -- blink, reverse video, dim, etc.  These
  36. changes are best done with BALIAS.  <ESC> is created by hitting
  37. CTL-P, then the ESC key.  See (way) below for more info.
  38.  
  39.         A program of this nature is most important when dealing
  40. with *.LBR's containing a large number of crunched files in that
  41. TLIB returns you a directory of the library after you've
  42. finished reading each file.  Hence you're not continually having
  43. to do a DIR or otherwise listing the contents within the library
  44. when moving from reading one file to another.  I very much enjoy
  45. some of the new library "shell" programs coming out for their
  46. advanced features and ease of use.   But, e.g., I recently
  47. downloaded a library of 12 (!) text files, all crunched.  I
  48. DEFINITELY want to have displayed for me in this situation a
  49. directory of all the files immediately and automatically after
  50. reading each member.
  51.  
  52.         For a long time I was using NULU in its regular "NULU 
  53. mode", and I would be faced with the same problem --- having to 
  54. constantly do a "-L" to list out the files in the library so that 
  55. I could choose which I wanted to read or otherwise act upon.  
  56. Then I discovered its "F"=Filesweep mode which operates like 
  57. NSWP.  Here you essentially have a listing/directory of the files 
  58. in front of you, and you choose your command to act on each as 
  59. you prefer.  This of course is ideal.  But until that happy day, 
  60. programs like TLIB are, for me at least, crucial. How do other 
  61. people deal with libraries of many members, all crunched, without 
  62. extracting them?
  63.  
  64.  
  65.  ***************************************************************
  66.  *                                                             *
  67.  *  What follows is more of an excursion into my own learning  *
  68.  *  process in writing this, complete with appropriate         *
  69.  *  philosophical commentary where appropriate than a true,    *
  70.  *  minimalist doc file, so you're welcome to proceed at your  *  
  71.  *  own risk -- uh, speed.            - Rick Charnes           *
  72.  *                                                             *
  73.  ***************************************************************
  74.  
  75.  
  76.  
  77. One learns best when answering one's own questions...
  78.  
  79.                       *      *       *
  80.  
  81.      "Could someone explain VALIAS' "recursive" mode to me?  
  82.      I just don't get it."
  83.  
  84.         Thus went the message I sent to Z-Node Central perhaps two
  85. weeks ago, and as sadly is too often the case on 8-bit BBS's in
  86. these days of the dominance of the IBM behemoth, it went
  87. unanswered.  So...encouraged by accidentally stumbling across the
  88. VALIAS doc file --- I'm not really sure how I ever missed it
  89. before -- I taught myself about VALIAS recursion, and it has
  90. greatly fueled my Z-imagination.  No doubt had I learned from
  91. someone else the power of it all wouldn't have hit so well.  Many
  92. thanks to VALIAS author Jay Sage, who has actually returned phone
  93. messages to San Franciso I have left with his family for his
  94. generosity, friendliness, warmth, and overall good Samaritanship
  95. in providing the emotional support and software tools to make
  96. being a beginning Z3-er like myself an overwhelmingly pleasurable
  97. and exciting experience.
  98.  
  99.       All this by way of introduction to my release of my alias
  100. TLIB.COM, an example of the use of VALIAS' recursive mode.  TLIB,
  101. continuing in the tradition started by Echelon's GLF, is a way of
  102. entering a library and then viewing multiple files inside it, 
  103. especially valuable if they are crunched and not otherwise 
  104. accessible via ordinary tools.  Until NULU is updated to include 
  105. the capacity to uncrunch library members, we need to rely on 
  106. aliases like this or Terry Carroll's ZLBR10A.COM.  I have too 
  107. often entered a library with NULU only to find the DOC file 
  108. and/or source file is crunched, thus precluding the use of NULU.
  109.  
  110.       TLIB is similar to my previous TLF.COM, except that the
  111. libary directory automatically and by default displays after you 
  112. have finished reading a library member.  Since TLF, I have still 
  113. been slightly annoyed with the way you had to hit <CR> to get the 
  114. library directory displayed back on your screen after viewing a 
  115. file within a library.  TLF returns you to the CMD.COM prompt at 
  116. which point you can exit the ALIAS with SHCTRL P, or anything 
  117. else to see the directory again.  But I always wanted to the 
  118. directory to come up IMMEDIATELY after the viewing of a library 
  119. member without my having to do anything; I wanted it to be the 
  120. default.
  121.  
  122.       I'm sure there are umpteen ways to do this, but I always
  123. try to take the path by which I will learn the most, and VALIAS'
  124. recursive mode seemed to be a very good teacher.  Briefly, this
  125. mode permits you in a sense a "GOTO START" label within an alias.
  126. It permits you to loop indefinitely back to the beginning without
  127. overloading the multiple command buffer.  Or it can be used
  128. in the same vein as I have here to loop back and forth between
  129. several different ALIASes, again without the looping causing the
  130. dread command buffer overflow.  It "cleans out" all superfluous
  131. commands.  So I figured it would be a perfect way to immediately
  132. come back to display the library directory after typing a file.
  133.  
  134.       But then there always arises the question of how to exit
  135. the loop when you wish to.  Unfortunately, one cannot exit from
  136. TLIB with a CTL-C like you can from a ZEX script.  So, studying 
  137. and re-studying my RESOLVE documentation, I put my bet on a long 
  138. shot: what were the chances RESOLVE could properly deal with a 
  139. flow command? I wasn't sure, but I tried it:
  140.  
  141.                         
  142.                          TLIB2.COM (the body of the program)
  143.                          ----------
  144.  
  145. ECHO ])G8 * DIRECTORY OF $1.LBR *  G0
  146.  
  147. LLF $2$1                      ;Displays the library directory.
  148. GETVAR TLIB FILE TO TYPE?     ;Gets the variable, names it %TLF.
  149. RESOLVE IF %TLIB=BYE          ;WOULD THIS WORK? If the user 
  150.                               ;enters 'BYE', then go to ....
  151. EXIT                          ;ANOTHER Alias, called EXIT, which 
  152.                               ;exits the user back to ZCPR3.
  153. ELSE
  154. RESOLVE TYPELZ $2$1 %TLIB     ;..or else type the library file.
  155. TLIB2 $1 $2                   ;Here's the recursion.  Return to
  156.                               ;initial ALIAS TLIB.COM, display 
  157.                               ;a directory, and pass the 
  158.                               ;parameters, please
  159. FI
  160.  
  161.  
  162.       It worked!  RESOLVE.COM properly resolves the IF/%TLF
  163. combination.   If the user replies 'BYE' at the "FILE TO TYPE?"
  164. prompt, s/he is then sent to the alias EXIT.COM which exits the
  165. entire alias network and returns the user to the friendly skies
  166. of ZCPR3.
  167.  
  168.       I made TLIB a 3-alias network for an important and
  169. necessary reason.  The initial TLIB alias does nothing but set
  170. the quiet flag then send the user to TLIB2, the body of the
  171. thing.  Deferring to the noble and time-honored ZCPR3 alias
  172. tradition, I have also added the classical help file/syntax
  173. format (IF NULL $1 and IF $1=//) with some pretty dim/normal
  174. intensity graphics included therein.  Terribly sorry if your
  175. terminal doesn't take "ESC-)" for dim intensity; this program,
  176. like so many others, started out as something to play around
  177. with for myself that looked nice.  I know releasing something
  178. non-standard like this is not kosher.  I've always thought,
  179. however, the art of public domain programming is to do as many
  180. non-kosher things as you possibly can and need to in order to
  181. have fun and learn as much as possible.  I know I passed that
  182. test with this.  Please change it to your terminal's sequences.
  183.  
  184.                               TLIB.COM:
  185.                               --------
  186.                               QUIET S
  187.                               TLIB2 $1 $2
  188.  
  189. The reason I made a separate ALIAS for this - besides needing 
  190. room in the MCL buffer for the syntax scripts - is that if I set 
  191. the command line 'QUIET S' in the same alias as the rest of the 
  192. commands the alias would forever be coming across this line and 
  193. setting the quiet flag on each pass.  This is of course totally 
  194. unnecessary and a waste of time, so I'm letting it do it once and 
  195. then forget about it.  And of course EXIT.COM, the third in the 
  196. trio, resets quiet. This use of an "multi-alias network" is the 
  197. best substitute I can figure out for the 'GOTO <label>' 
  198. capability I _wish_ ALIASes had.
  199.  
  200.       By the way, it's instructive to try these files out setting
  201. them in normal, rather than recursive, mode just to see what
  202. happens.  At some point, usually after about the third file
  203. you've asked TLIB to type, you're *BEEP*ed, sent into EXIT.COM,
  204. and exited out of the program.  What's going on is that, just as
  205. Jay Sage says will happen, the MCL (what? you don't yet know that
  206. ZCPR lingo for 'multiple command line'?) buffer fills up past
  207. that magic 204 character capacity, the flow control network gets
  208. all confused, the ZCPR3 God throws up his hands, and says, "Out,
  209. infidel!"
  210.  
  211.       Comments on why I _start_ TLIB2.COM with "FI" rather than
  212. ending it that way, as is the usual:  
  213.  
  214.       I had initally made "FI" the second to last command in the
  215. alias, just before the recursive "TLIB2 $1 $2" command which
  216. should be the last command in the alias.  This "FI" should be
  217. there of course to flush the IF level to 0, before the alias runs
  218. again.  But for some reason that PERHAPS God knows, when I did
  219. that, and then I'd enter 'BYE' I would be given the "RETURNING TO
  220. ZCPR3..." message ---- AND THE ALIAS WOULD START AGAIN!!  Don't
  221. ask me what's going on.  So I figured maybe it's because the IF
  222. LEVEL is not getting flushed (set back to 0).  So I went into
  223. EXIT.COM and put in an 'XIF' command --- to no avail.  The alias
  224. would still repeat when I tried to exit.
  225.  
  226.       So then I put "FI" as the very last command and that worked
  227. fine.  Until I realized that upon exit from the whole alias
  228. network the IF level was set to a number corresponding to how
  229. many files had been viewed.  And of course --- the 'FI' was never
  230. being reached to reset the level back to 0.
  231.  
  232.       So I put it at the beginning, it gets reset each time
  233. before it even starts, and everyone's happy.
  234.  
  235.       IF levels are a trip.  I hope people have fun using
  236. IFSTAT.COM.  I like to abort ZEX scripts and the like in the
  237. middle and otherwise deliberately set the IF level to
  238. some ridiculously high level just to watch what goes on.  There's 
  239. something philosophically amusing about thinking of something 
  240. existing in a state of (trombones here...) "IF LEVEL 6."  One can 
  241. pity a ZCPR3 system having to go through an experience like that. 
  242. I mean can YOU imagine living at an IF level of 6?   The _awful_ 
  243. sense of insecurity..."Um, if this,,,,and if that....and if the 
  244. other thing, and if, if, if, and if ...."
  245.  
  246.       Speaking of slowing things down, the only reason I have to
  247. use a separate alias for the EXIT is because as of the present
  248. state of ZCPR3 flow control, the syntax "~=" (does not equals) is
  249. not implemented.  If that were possible, I could have done:
  250.  
  251.      RESOLVE IF %TLIB~=BYE            
  252.      RESOLVE TYPELZ $1 %TLIB
  253.      TLIB2 $1 $2
  254.      FI
  255.  
  256. and then if %TLIB _did_ equal 'BYE' it would just ignore the IF
  257. loop and you'd be happily booted out right away.  The alias would
  258. be shorter and run much quicker.
  259.  
  260.       I think my method of allowing DU: designation on the
  261. command line is kind of ingenious.  Aw, come on, give me a break: 
  262. when you're a beginner in this stuff and something works it 
  263. always feels ingenious.  I make you use two parameters, though.  
  264. You just have to make sure you put a space between the DU: and 
  265. the library name, so the alias understands them as two 
  266. parameters. If you don't enter a DU: that's OK too and TLIB 
  267. doesn't mind. It just ignores any reference to $2 in the command 
  268. line and uses $1 as the library name.  If you enter both, $1 is 
  269. the DU: and $2 becomes the library name.
  270.  
  271.  
  272.                   *            *            *
  273.  
  274.  
  275.       I'd like also to draw fellow Z enthusasiasts' attention to
  276. my use of the ECHO command to send terminal attribute escape and
  277. other sequences to the terminal to create attractive displays. 
  278. This is something I've been doing quite a bit of, and am very
  279. pleased with this capability of ZCPR3.  Now of course each
  280. terminal's codes will be different.  <ESC G 8> sets underlining
  281. on my Qume 102A, and <ESC G 0> turns it off, but you should set
  282. it according to yours.  Also nice is reverse video with <ESC G 4>
  283. My command line
  284.  
  285.             ECHO ])G8 * DIRECTORY OF $1.LBR *  G0
  286.  
  287. underlines the text, but it also does something else.  My
  288. terminal uses standard (what? standards in 8-bit machines?) ADM-
  289. 3A-type cursor coordinate addressing, so I use ECHO again, this 
  290. time to send an escape sequence to position the cursor more 
  291. towards the center of the screen.   The sequence
  292.  
  293.                          <ESC> ] )
  294.  
  295. tells my terminal to position the cursor to column 10 on the
  296. current line.  ")" here equals "10" in terminal code.  If I
  297. wanted ZCPR3 to display some text on line 6, column 24, I would
  298. do
  299.                      ECHO <ESC>=%7this is my text
  300.  
  301. The way you get VALIAS or BALIAS to insert an <ESCAPE> code is by
  302. pressing CTL-P first, then hit your escape key.  It will appear
  303. on your screen as a dim video "]" when using BALIAS, and as "^]"
  304. in VALIAS.  You can also send line feeds and carriage returns in
  305. your ECHO text by, again, pressing CTL-P first, then CTL-J and/or
  306. CTL-M.  I often do this if I want to space my text with nice
  307. clean blank lines.  I did this in TLIB.COM for the help/syntax 
  308. message.  This will only work, however, in BALIAS and not in 
  309. VALIAS.  VALIAS doesn't seem to have a "literal" mode for 
  310. carriage return and line feed with CTL-P.  So to change TLIB.COM, 
  311. perhaps to change the intensity attributes, you'll have to use 
  312. BALIAS (I've never used TALIAS).  Once you've put ^J's into an 
  313. alias, VALIAS' line numbering gets all screwed up and you 
  314. shouldn't even hope to try to use it.
  315.  
  316.      Also in VALIAS only, when you do your CTL-P's to enter an 
  317. <ESC> code, be prepared to have your printer turned on as a side 
  318. effect.  No problem --- just do a second CTL-P to turn it off.  
  319. This second CTL-P won't get entered into your alias.
  320.  
  321.       I do a lot of this cursor positioning and find it an 
  322. excellent way to pretty up otherwise drab program display.
  323.  
  324.       One thing I forgot about VALIAS' recursive mode.  I don't
  325. know about other folks, but I will often switch back and forth
  326. between VALIAS and BALIAS in the course of a creating, working
  327. on, and editing an alias.  Each does a certain set of things
  328. best.  If, however, you're using VALIAS to create a recursive
  329. alias, if you then go and edit it with BALIAS, this will "de-
  330. recursify" it.  It apparently takes out or resets the flag or
  331. byte with which VALIAS had previously set it.  If you do this ---
  332. and I often find I must -- that's ok.  Just make sure that the
  333. very last thing you do before you're ready to run the alias is to
  334. edit it in VALIAS and set the recursive flag.  Any changes that
  335. BALIAS did to it will be remedied.
  336.  
  337.       Have fun with TLIB and leave me a message if you have any 
  338. comments.
  339.  
  340. Rick Charnes, San Francisco, California
  341. President, Bay Area (Morrow) Micro Decision Users Association
  342.  
  343. Home BBS'es:
  344. Z-Node Central 415/489-9005
  345. BAMDUA BBS 415/654-3882
  346. ent, Bay Area (Morrow) Micro Decision Users Association
  347.  
  348. Home BBS'es:
  349. Z-Node Central 415/489-9005
  350. BAMDUA BBS