home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / latest / zf11help.lbr / ZFMACRO.HZP / ZFMACRO.HLP
Encoding:
Text File  |  1994-01-16  |  22.1 KB  |  409 lines

  1. ;                     ----------------------------------
  2.                      |                                |
  3.                      | ZFILER's Script Macro Facility |
  4.                      |                                |
  5.                      ----------------------------------
  6.  
  7.  
  8.                     M >> Introduction to ZFILE╥'s Macros
  9.  
  10.  
  11.       << Macro Execution >>            << Macro Writing >> 
  12.  
  13.      I >> Invokinτ Macros             S >> Macr∩ Scripts
  14.      G >> Group Macros                D >> Defininτ Macro≤ -- Thσ CM─ File
  15.                                       R >> Rule≤ fo≥ Scrip⌠ Expansion
  16.                                       E >> Macr∩ Examples
  17.                                       L >> Sample Macro CMD Listing
  18. :M
  19.  Introduction to ZFILE╥'s Macros 
  20.  
  21.      AlthougΦ ZFILE╥ caε accomplisΦ man∙ task≤ usinτ it≤ built-iε functions¼ ì
  22. it≤ rea∞ powe≥ come≤ froφ thσ macr∩ facility¼ whicΦ allow≤ i⌠ t∩ bσ extendeΣ ì
  23. t∩á includσ an∙ function≤ tha⌠ caε bσ performeΣ usinτ combination≤ oµá othe≥ ì
  24. programs«á  Thi≤á i≤ wherσ ZFILE╥ reall∙ make≤ usσ oµ it≤ powe≥ a≤ ßá shell« ì
  25. Firs⌠á ╔á wil∞á describσ ho≈ thσ macr∩ facilit∙ i≤ used¼á anΣá theεá ╔á wil∞ ì
  26. describσá ho≈á thσ use≥ define≤ thσ macr∩ functions«á  A≤ witΦ thσá built-iε ì
  27. functions¼á macr∩ function≤ caε operatσ eithe≥ oε singlσ file≤ o≥ oεá group≤ ì
  28. oµ files«á  Thσ single-filσ macr∩ facilit∙ i≤ wel∞ developeΣ anΣ wa≤ alread∙ ì
  29. presen⌠á iε nearl∙ thσ samσ forφ iε VFILER╗á thσ grou≡ macr∩ facilit∙ i≤ ne≈ ì
  30. witΦ ZFILE╥ and has been greatly expanded.
  31. :I
  32.  Invokinτ Macros 
  33.  
  34.      Onσá wa∙á t∩ initiatσ ß macr∩ operatioε oε thσ pointed-t∩á filσá i≤á t∩ ì
  35. pres≤ thσ macr∩ invocatioε key¼á whicΦ i≤ normall∙ thσ escapσ key«  ┴ promp⌠ ì
  36. oµá "Macro:óá wil∞ appea≥ afte≥ thσ norma∞ ZFILE╥ commanΣ prompt«á  A⌠á thi≤ ì
  37. poin⌠á yo⌡ havσ severa∞ choices«á  Iµ yo⌡ kno≈ thσ ke∙ correspondinτ t∩á thσ ì
  38. macr∩ yo⌡ wan⌠ t∩ run¼ theε yo⌡ caε simpl∙ pres≤ tha⌠ key«  ZFILE╥ wil∞ theε ì
  39. construc⌠á ßá commanΣá linσá anΣ pas≤ i⌠ oε t∩á thσá commanΣá processo≥á fo≥ ì
  40. execution«á  Iµá ZFILE╥á i≤á configureΣá fo≥á instan⌠á macr∩á operatioεá (i⌠ ì
  41. generall∙ is)¼á theε macro≤ associateΣ witΦ thσ numbe≥ key≤ "0ó througΦá "9ó ì
  42. caε bσ initiateΣ withou⌠ thσ macr∩ invocatioε key╗á tha⌠ is¼á thσ numbe≥ ke∙ ì
  43. entereΣá alonσá a⌠á thσ maiε ZFILE╥ commanΣ promp⌠ wil∞ generatσá thσá macr∩ ì
  44. function.
  45.  
  46.    Iµ yo⌡ pres≤ thσ macr∩ invocatioε ke∙ ß seconΣ time¼á ß user-createΣ hel≡ ì
  47. screeεá wil∞ bσ displayed«á  Thi≤ screeε generall∙ list≤ thσ availablσ macr∩ ì
  48. functions«á  Yo⌡ caε no≈ pres≤ thσ ke∙ fo≥ thσ desireΣ function¼á o≥ yo⌡ caε ì
  49. pres≤á carriagσ returε t∩ cance∞ thσ macr∩ operatioε anΣ returε t∩ thσá maiε ì
  50. ZFILE╥ menu«á  Thσ hel≡ men⌡ screeε wil∞ als∩ bσ displayeΣ iµ yo⌡ pres≤á thσ ìè"#óá key«á  Thi≤ i≤ ß holdove≥ froφ VFILE╥ anΣ arise≤ iε par⌠ becausσ oµ thσ ì
  51. structurσá oµá thσá filσá iε whicΦ thσ macro≤á arσá defineΣá (morσá oεá thi≤ ì
  52. shortly).
  53. :G
  54.  Group Macros 
  55.  
  56.      Grou≡á macro≤á arσá invokeΣ iε ß simila≥ wa∙ froφá thσá grou≡á functioε ì
  57. commanΣ line«á  Afte≥ yo⌡ havσ taggeΣ ß grou≡ oµ files¼ pres≤ thσ "Gó ke∙ t∩ ì
  58. ente≥á grou≡ mode«á  Thσ promp⌠ wil∞ lis⌠ onl∙ thσ built-iε grou≡ functions¼ ì
  59. bu⌠á iµá yo⌡ pres≤ thσ macr∩ invocatioε key¼á yo⌡ caε proceeΣá a≤á describeΣ ì
  60. abovσ fo≥ single-filσ macr∩ operations¼á excep⌠ tha⌠ thσ macr∩ functioε wil∞ ì
  61. bσ performeΣ oε eacΦ oµ thσ taggeΣ files.
  62.  
  63.      Thσá grou≡ macr∩ facilit∙ work≤ ß littlσ differentl∙ thaεá thσá single-ì
  64. filσá macr∩á facility«á  Sincσ thσ commanΣ linσ woulΣ generall∙ no⌠ bσá lonτ ì
  65. enougΦá t∩ contaiε thσ command≤ fo≥ al∞ thσ taggeΣ files¼á thσá grou≡á macr∩ ì
  66. facilit∙á work≤ b∙ writinτ ou⌠ ß batcΦ filσ fo≥ processinτ b∙ ZE╪ o≥ SUBMIT«  ì
  67. Iεá thi≤á wa∙ therσ i≤ virtuall∙ n∩ limi⌠ t∩ thσ numbe≥ oµá file≤á oεá whicΦ ì
  68. grou≡ macro≤ caε operate.
  69.    Therσ arσ man∙ configurablσ option≤ (describeΣ below⌐ tha⌠ arσ associateΣ ì
  70. witΦá thσ grou≡ macr∩ operation«á  Thesσ includσ thσ namσ oµ thσ ZE╪ o≥á SU┬ ì
  71. batcΦ file¼á thσ director∙ t∩ whicΦ i⌠ i≤ written¼ anΣ thσ commanΣ linσ tha⌠ ì
  72. ZFILE╥á generate≤á t∩ initiatσ thσ batcΦ operation«á  Thσ NZ-CO═ versioεá oµ ì
  73. ZFILE╥ use≤ ß filσ calleΣ ZFILER.ZE╪ anΣ thσ commanΣ linσ "ZE╪ ZFILER"«  Thσ ì
  74. Z3PLU╙ version¼á unde≥ whicΦ ZE╪ wil∞ no⌠ run¼ use≤ ß filσ calleΣ ZFILER.SU┬ ì
  75. anΣ ß commanΣ linσ oµ "SUBMI╘ ZFILER".
  76.  
  77.      Sincσ macro≤ (anΣ thσ maiε men⌡ "Zó function⌐ worδ b∙ passinτá command≤ ì
  78. t∩á thσá commanΣ processor¼á filσ tag≤ werσ oncσ los⌠ b∙ olde≥á version≤á oµ ì
  79. ZFILER╗á wheεá thesσ olde≥ version≤ resumeΣ operation¼á thσ proces≤á starteΣ ì
  80. afresh«  ZFILE╥ no≈ remember≤ al∞ thσ filσ tag≤ wheε i⌠ return≤ froφ ß macr∩ ì
  81. o≥ ┌ commanΣ (i⌠ write≤ ß temporar∙ file¼á "ZFILER.TAG"¼á t∩ ßá configurablσ ì
  82. director∙ whicΦ contain≤ thσ filσ list).
  83.  List Capability for Group Macros 
  84.  
  85.      Iµ ß ZFILER.CM─ scrip⌠ begin≤ witΦ ß commß (beforσ o≥ afte≥ thσ leadinτ ì
  86. "!ó shel∞ pausσ parameter)¼á ZFILE╥ wil∞ alway≤ expanΣ thσ macr∩ directl∙ t∩ ì
  87. ZCPR'≤ multiplσ commanΣ line«á  Iε thσ casσ oµ ß grou≡ macro¼ $P¼ $F¼ anΣ $╘ ì
  88. parameter≤á arσá expandeΣ t∩ ß lis⌠ oµ al∞ taggeΣ files¼á separateΣá b∙á thσ ì
  89. characte≥ followinτ thσ leadinτ comma«  
  90.  
  91. For example, the script:
  92.  
  93.         1 , !echo the tagged files are $F
  94.  
  95. display≤á "TH┼á TAGGE─ FILE╙ AR┼ "¼á followeΣ b∙ ß lis⌠ oµ thσ taggeΣá file≤ ì
  96. separateΣá b∙á ó ó oε thσ consolσ (assuminτ ECH╧ i≤ ß valiΣá ZCP╥á command)«  ì
  97. ZFILE╥ theε prompt≤ fo≥ ß keypres≤ beforσ returning«á  Pleasσ notσ tha⌠ thi≤ ì
  98. macr∩ buffer≤ thσ entirσ lis⌠ oµ taggeΣ file≤ t∩ CP/M'≤ commanΣ linσ buffer¼ ì
  99. whicΦ i≤ onl∙ 12╡ byte≤ iε length«á  Thσ abovσ command¼á therefore¼ normall∙ ì
  100. cause≤á ßá "CommanΣ to∩ longó erro≥ iµ morσ thaε abou⌠ ╕ file≤á arσá tagged¼ ì
  101. dependinτ oε thσ length≤ oµ thσ taggeΣ names.
  102.  
  103.      Lis⌠ capabilit∙ allow≤ program≤ whicΦ accep⌠ ß filσ list¼á sucΦ a≤ LPU╘ ì
  104. o≥ V¼ t∩ ruε oε taggeΣ files«  ZE╪ i≤ NO╘ involved.
  105.  Group Macro Tagged File Count 
  106.  
  107.      Thσá numbe≥ oµ file≤ taggeΣ i≤ pu⌠ int∩ Use≥ Registe≥ #╡ (configurable⌐ ì
  108. beforσ runninτ ZEX«á  Thσ macr∩ caε theε dowε coun⌠ anΣ takσ somσ additiona∞ ì
  109. actioε afte≥ i⌠ ha≤ ruε oε eacΦ taggeΣ file.
  110.  
  111.      For example, if you press "G<ESC>1", the script:
  112.  
  113.     1 ! $d$u:;$!crunch $f B1:;reg m5;if reg 5= 0;$"Library DU ":;
  114.             lput $"Library Name: " B1:*.* +1;era B1:*.?Z?;fi;$h:
  115.  
  116. crunche≤ taggeΣ file≤ t∩ ß fixeΣ empt∙ director∙ B1:¼ make≤ ß librar∙ ou⌠ oµ ì
  117. theφá (leavinτá rooφá fo≥á ▒ morσ file⌐ witΦá inpu⌠á fo≥á librar∙á namσá anΣ ì
  118. location¼á theεá erase≤ al∞ "thσ crunchettes"«á  Thi≤ macr∩ require≤ RE╟á t∩ ì
  119. decremen⌠ Registe≥ 5.
  120.  
  121.      Notσá tha⌠ RE╟ mus⌠ bσ ß Type│ o≥ Type┤ (o≥ RCP⌐ fo≥ thσ ZE╪ G╧ "$!ó t∩ ì
  122. ruε CRUNC╚ repeatedly«  Als∩ notσ tha⌠ register≤ onl∙ holΣ ß 25╡ countí  Fo≥ ì
  123. consistency¼á singlσá macro≤á pu⌠ ß "1ó coun⌠ iε thσá Use≥á Register«á  Use≥ ì
  124. registe≥ rangσ 0..╣ i≤ no⌠ enforced¼á s∩ yo⌡ caε usσ register≤ 10..3▒ iµ yo⌡ ì
  125. wish«  However¼ 10-1╡ arσ reserved¼ while 16-1╖ arσ useΣ b∙ other programs.
  126. :S
  127. ü Macr∩ Script≤ 
  128.  
  129.      ZFILE╥á macr∩á script≤ arσ simila≥ t∩ thosσ iε ARUN┌ anΣ iεá thσá othe≥ ì
  130. men⌡á shell≤á (MENU¼á VMENU¼á FMANAGER⌐á iε tha⌠ paramete≥á expression≤á caε ì
  131. appear«á Thσá critica∞ parameter≤ -- thσ one≤ tha⌠ implemen⌠ function≤á tha⌠ ì
  132. canno⌠ bσ achieveΣ an∙ othe≥ wa∙ -- arσ thosσ tha⌠ conve∙ informatioεá abou⌠ ì
  133. thσá director∙ currentl∙ displayeΣ b∙ ZFILE╥ anΣ abou⌠ thσ pointed-t∩á file« ì
  134. Parameter≤á consis⌠á oµá ß "$ó characte≥ followeΣ b∙ onσ oµá thσá character≤ ì
  135. listeΣ below.
  136.     Use≥ promp⌠ parameters:
  137.  
  138.         º    Use≥ inpu⌠ prompt
  139.         ó    Use≥ inpu⌠ prompt
  140.                 *       Clear screen in user prompt
  141.                 $       Escape character (example: '$"' for double quote)
  142.                 ^       Control character (example: '^x' for control-X)
  143.  
  144.  
  145.     Parameter≤ fo≥ directories:
  146.  
  147.       - currentl∙ displayeΣ directory
  148.         ├    DI╥ form
  149.         ─    Drivσ letter
  150.         ╒    Use≥ number
  151.  
  152.         - homσ director∙ (froφ where ZFILE╥ wa≤ invoked)
  153.         ╚    D╒ form
  154.         ╥    Homσ DIR
  155.     Parameter≤ fo≥ pointed-t∩ file:
  156.  
  157.         ╨    Ful∞ informatioε (DU:FN.FT)
  158.         ╞    Filσ namσ (FN.FT)
  159.         ╬    Filσ namσ only
  160.         ╘    Filσ typσ only
  161.  
  162.     Specia∞ parameters:
  163.  
  164.         í    G╧ substitutioε indicator
  165.         ñ    Thσ dolla≥ character
  166.  
  167.      Thσ parameter≤ arσ listeΣ iε ß specia∞ orde≥ above¼ anΣ wσ wil∞ explaiε ì
  168. tha⌠ later«  Firs⌠ wσ wil∞ jus⌠ presen⌠ thσ meaninτ fo≥ eacΦ parameter.
  169.  
  170.      Thσá paramete≥á expression≤á $ó anΣ $º arσ useΣá t∩á displa∙á ßá promp⌠ ì
  171. messagσá t∩á thσ use≥ anΣ t∩ reaΣ iε ß responsσ string«á  Singlσ anΣá doublσ ì
  172. quote≤á arσ equivalent«á  Oncσ thσ promp⌠ paramete≥ ha≤ beeεá detected¼á al∞ ì
  173. subsequen⌠ character≤ u≡ t∩ onσ oµ thσ quotσ character≤ arσ displayeΣ a≤ thσ ì
  174. use≥ prompt«á  Thus¼á iµ ╔ aφ no⌠ mistaken¼ therσ i≤ presentl∙ n∩ wa∙ t∩ pu⌠ ì
  175. eithe≥ quotσ characte≥ int∩ thσ prompt«á  Thσ enΣ oµ thσ linσ o≥ thσ enΣá oµ ì
  176. thσ filσ wil∞ als∩ terminatσ thσ prompt.
  177.      Iµ yo⌡ wan⌠ t∩ makσ fanc∙ screens¼ yo⌡ caε includσ escapσ sequence≤ anΣ ì
  178. somσ contro∞ character≤ (obviousl∙ carriagσ returε won'⌠ work)«á  Prompt≤ iε ì
  179. script≤á ma∙á contaiε contro∞ character≤ a≤ "^x"¼á wherσ ° i≤ an∙á characte≥ ì
  180. froφ └ t∩ z.
  181.  
  182.      Thσá dolla≥ sigε ma∙ bσ useΣ aε "escapσ characteró fo≥ scrip⌠á prompts¼ ì
  183. anΣ caε be used to include the $, ^, ", and ' characters in prompts.
  184.  
  185.     Examples:
  186.         Script                Result
  187.         $"Enter name or $^C: "         Enter name or ^C: 
  188.         $"Type $"//$" for help: "    Type "//" for help: 
  189.  
  190.      Thσ $¬ scrip⌠ paramete≥ clear≤ thσ screeε during¼ anΣ rebuild≤ i⌠ afte≥ ì
  191. ß scrip⌠ prompt«  Usagσ i≤ $"$*..text.."«  Promp⌠ tex⌠ appear≤ a⌠ thσ to≡ oµ ì
  192. ß cleared screen.
  193.      No≈á fo≥á thσ director∙ parameters«á  Parameter≤ C¼á D¼á anΣá ╒á returε ì
  194. informatioεá abou⌠ thσ currentl∙ displayeΣ directory¼á whilσ ╚ anΣ ╥á returε ì
  195. informatioεá abou⌠á thσá homσá directory¼á thσ onσá froφá whicΦá ZFILE╥á wa≤ ì
  196. originall∙á invoked«á  PLEAS┼á NOTE║á macro≤ alway≤ operatσá froφá thσá homσ ì
  197. directory«á  Thσ reasoε fo≥ thi≤ i≤ tha⌠ ZFILE╥ caε displa∙ directorie≤ witΦ ì
  198. use≥á number≤ highe≥ thaε 1╡ eveε wheε i⌠ i≤ no⌠ possiblσ t∩ loτ int∩á thesσ ì
  199. areas«á  Iµ yo⌡ wan⌠ t∩ operatσ iε thσ displayeΣ directory¼ theε you≥ scrip⌠ ì
  200. mus⌠ includσ aε explici⌠ directory-changσ commanΣ oµ thσ forφ "$D$U:ó a⌠ thσ ì
  201. beginninτá (o≥á "$C:ó iµ you≥ systeφ require≤ thσ usσ oµ nameΣá directories⌐ ì
  202. anΣ ß commanΣ oµ thσ forφ "$H:ó (o≥ "$R:"⌐ a⌠ thσ end.
  203.  
  204.      Onσ specia∞ notσ abou⌠ thσ parameter≤ tha⌠ returε director∙ names«á  Iµ ì
  205. thσ director∙ ha≤ n∩ name¼á theε thσ strinτ "Nonameó i≤ returned«  Thi≤ wil∞ ì
  206. presumabl∙ no⌠ matcΦ an∙ actua∞ namσ anΣ wil∞ lead¼á onσ hopes¼á t∩ ß benigε ì
  207. erro≥ condition«  Thesσ parameter≤ arσ includeΣ onl∙ fo≥ system≤ tha⌠ d∩ no⌠ ì
  208. allo≈ directorie≤ t∩ bσ indicateΣ usinτ thσ D╒ forφ (╔ hopσ tha⌠ fe≈ iµá an∙ ì
  209. system≤ arσ se⌠ u≡ thi≤ way).
  210.      No≈á wσá comσá t∩á thσ fou≥ filσ namσ parameters«á  The∙á allo≈á u≤á t∩ ì
  211. generatσá easil∙ thσ completσ filσ specificatioε o≥ an∙ par⌠á oµá it«á  Notσ ì
  212. tha⌠á "$Fó i≤ no⌠ quitσ thσ samσ a≤ "$N.$T"«á  Thσ latte≥ alway≤ contain≤á ß ì
  213. dot╗ thσ forme≥ doe≤ no⌠ iµ thσ filσ ha≤ n∩ filσ type.
  214.  
  215.      Finally¼á wσ havσ tw∩ specia∞ parameters«á  "$$ó i≤ includeΣ t∩ allo≈ ß ì
  216. dolla≥á sigεá characte≥ t∩ bσ entereΣ int∩ thσ script«á  "$!ó i≤á ßá contro∞ ì
  217. paramete≥ tha⌠ i≤ useΣ onl∙ wheε ß grou≡ macr∩ i≤ executed«  Iµ i⌠ i≤ placeΣ ì
  218. immediatel∙á beforσá ß tokeε (strinτ oµ contiguou≤á characters)¼á theεá tha⌠ ì
  219. tokeεá wil∞ bσ replaceΣ b∙ thσ strinτ "GOó oε al∞ bu⌠ thσ firs⌠ expansioε oµ ì
  220. thσ script«á  Thi≤ allow≤ grou≡ macr∩ script≤ t∩ operatσ faste≥ b∙á avoidinτ ì
  221. repetitivσá loadinτá oµá ß CO═ file«á  I⌠ mus⌠ bσ useΣ witΦ grea⌠á carσá anΣ ì
  222. consideration¼ however¼ fo≥ reason≤ tha⌠ ╔ wil∞ no⌠ g∩ int∩ here.
  223. :D
  224. ü Defininτ Macro≤ é --  Thσ CM─ File
  225.  
  226.      No≈á let'≤á learεá ho≈ t∩ definσ thσ macr∩ function≤á wσá want«á  A≤á ╔ ì
  227. indicateΣ earlier¼ thσ macro≤ arσ defineΣ iε ß filσ calleΣ "ZFILER.CMDó (thσ ì
  228. ZFILE╥ ComMan─ file)«á  Iε thσ versioε oµ ZFILE╥ distributeΣ witΦ NZ-CO═ anΣ ì
  229. Z3PLUS¼á thσá CM─á filσ i≤ searcheΣ fo≥ iε thσ roo⌠ director∙ oµá thσá ZCPR│ ì
  230. commanΣá searcΦá path«á  A≤ describeΣ earlier¼á thσ optioε men⌡á allow≤á thσ ì
  231. entirσ patΦ t∩ bσ used«  Therσ arσ als∩ somσ additiona∞ configurablσ option≤ ì
  232. tha⌠á wil∞á bσá discusseΣá anothe≥á time«á  Yo⌡ mus⌠ bσá surσá t∩á pu⌠á you≥ ì
  233. ZFILER.CM─á filσá iεá thσ appropriatσ directory«á  Iµá thσá filσá canno⌠á bσ ì
  234. located¼á yo⌡ wil∞ stil∞ ge⌠ thσ macr∩ prompt¼ but¼ afte≥ yo⌡ havσ specifieΣ ì
  235. ß macr∩ key¼ thσ erro≥ messagσ "ZFILER.CM─ NO╘ Foundó wil∞ bσ displayed.
  236.  
  237.      Thσá ZFILER.CM─ filσ i≤ aε ordinar∙ tex⌠ filσ tha⌠ yo⌡ caε creatσá witΦ ì
  238. an∙á edito≥á o≥ wordprocesso≥ tha⌠ caε makσ plaiε ASCI╔ file≤á (WordSta≥á iε ì
  239. nondocumen⌠ mode¼ fo≥ example)«  Thσ CM─ filσ ha≤ tw∩ parts«  Thσ firs⌠ par⌠ ì
  240. contain≤ thσ macr∩ commanΣ definitions╗á thσ seconΣ contain≤ thσ hel≡ screeε ì
  241. (describeΣ earlier).
  242.      Iεá thσ firs⌠ par⌠ oµ thσ CM─ file¼á eacΦ linσ define≤á ßá macro«á  Thσ ì
  243. characte≥á iεá thσ firs⌠ columε i≤ thσ ke∙ associateΣ witΦá tha⌠á definitioε ì
  244. (casσá doe≤ no⌠ matter)«á  Macro≤ caε bσ associateΣ witΦ thσ 1░ numbe≥ keys¼ ì
  245. 2╢á lette≥á keys¼á anΣá al∞á printablσ specia∞á character≤á excep⌠á fo≥á "#ó ì
  246. (explaineΣ below)«á  Thσ spacσ characte≥ anΣ al∞ contro∞ character≤ arσá no⌠ ì
  247. allowed«á  Owinτá t∩á aεá oversight¼á thσá rubou⌠á (DEL⌐á characte≥á caεá bσ ì
  248. associateΣ witΦ ß macro!
  249.  
  250.      Afte≥á thσá characte≥ tha⌠ name≤ thσ macr∩ therσ ma∙ bσ an∙á numbe≥á oµ ì
  251. blank≤ (includinτ zero)«á  Iµ thσ firs⌠ non-blanδ characte≥ i≤ "!"¼ theε thσ ì
  252. "strikσá an∙ keyó (shell-wait⌐ promp⌠ wil∞ appea≥ beforσ ZFILE╥ put≤ u≡á thσ ì
  253. filσ displa∙ afte≥ ß macr∩ commanΣ i≤ run«  Thi≤ shoulΣ bσ useΣ wheneve≥ thσ ì
  254. macr∩á wil∞á leavσá informatioε oε thσ screeε tha⌠ yo⌡ wil∞á wan⌠á t∩á read«  ì
  255. Afte≥á thσ "!ó therσ caε agaiε bσ an∙ numbe≥ oµ spaces«á  An∙ remaininτ tex⌠ ì
  256. oε thσ linσ i≤ takeε a≤ thσ scrip⌠ fo≥ thσ macr∩ command.
  257.    Thσá seconΣ par⌠ oµ thσ CM─ filσ start≤ wheε ß "#ó characte≥ i≤ founΣá iε ì
  258. thσá firs⌠á columε (hencσ thσ exclusioε oµ tha⌠ characte≥ a≤ ß macr∩á name)« ì
  259. Oncσ tha⌠ characte≥ appears¼ al∞ remaininτ text¼ includinτ tex⌠ oε thσ line¼ ì
  260. wil∞ bσ useΣ a≤ thσ hel≡ screen«á  Sincσ ZFILE╥ wil∞ adΣ somσ informatioε t∩ ì
  261. thσá displa∙á (thσá namσ oµ thσ pointed-t∩ filσá anΣá ßá prompt)¼á yo⌡á wil∞ ì
  262. generall∙á wan⌠ t∩ kee≡ thσ hel≡ screeε t∩ n∩ morσ thaε 2░ lines¼á includinτ ì
  263. aε extrß blanδ linσ a⌠ thσ enΣ fo≥ spacing«á  WitΦ somσ experimentatioεá yo⌡ ì
  264. wil∞ ge⌠ thσ hanτ oµ designinτ thi≤ screen.
  265.  
  266.  
  267.   Here is a parameter reminder you can include in your ZFILER.CMD file:
  268.  
  269.     $!     ZEX 'GO'          $P  DU:FN.FT       $D  Current Drive
  270.     $".."  PROMPT            $F  FN.FT          $U  Current User
  271.     $'..'  PROMPT            $N  FN             $C  Current DIR
  272.     $*     CLS on Prompt     $T  FT             $H  Home DU   $R  Home DIR  
  273. :R
  274. ü Rule≤ fo≥ Scrip⌠ Expansioε 
  275.  
  276.      ZFILE╥á follow≤ ß specifiπ sequencσ oµ step≤ wheε expandinτá ßá script¼ ì
  277. onσ tha⌠ give≤ i⌠ ß specia∞ featurσ that¼ ╔ woulΣ guess¼ fe≈ user≤ arσ awarσ ì
  278. of«á  Thσá firs⌠á ste≡á iε thσ expansioε i≤ t∩ proces≤ onl∙á thσá user-inpu⌠ ì
  279. promp⌠ parameters¼á substitutinτ fo≥ thσ promp⌠ whateve≥ thσ use≥ entereΣ iε ì
  280. response«á  Thi≤ result≤ iε ß modifieΣ scrip⌠ tha⌠ i≤ theε processeΣ b∙á thσ ì
  281. seconΣá ste≡ iε thσ expansion«á  Becausσ thσ expansioε i≤ handleΣ thi≤á way¼ ì
  282. thσ use≥ inpu⌠ caε includσ ZFILE╥ scrip⌠ parametersíá  Thus¼á thσ scrip⌠ caε ì
  283. bσ useΣ t∩ writσ ß script«  Yo⌡ wil∞ seσ aε examplσ oµ thi≤ later.
  284.  
  285.      Thσá seconΣá ste≡á iεá thσ expansioε i≤ t∩ substitutσá value≤á fo≥á thσ ì
  286. director∙ parameters¼ whicΦ arσ somewha⌠ likσ constants«  The∙ d∩ no⌠ changσ ì
  287. a≤á ßá functioε oµ thσ pointed-t∩ file«á  Finally¼á iεá ßá thirΣá step¼á thσ ì
  288. remaininτ parameter≤ arσ expanded«  Fo≥ grou≡ macros¼ thi≤ fina∞ ste≡ iε thσ ì
  289. expansioε i≤ repeateΣ fo≥ eacΦ oµ thσ taggeΣ files«  Thσ filσ parameter≤ arσ ì
  290. expandeΣá differentl∙ fo≥ eacΦ file¼á and¼á startinτ witΦ thσ seconΣá taggeΣ ì
  291. file¼ thσ "$!ó paramete≥ cause≤ "GOó substitution.
  292. :E
  293. ü Macr∩ Example≤ 
  294.  
  295.      Thσá macr∩ CM─ listinτ iε sectioε ü ╠ é show≤ aε examplσ oµ ßá ZFILER.CM─ ì
  296. file¼á onσá designeΣ t∩ illustratσ somσ technique≤ oµ macr∩ writing«á  Whilσ ì
  297. writinτ thi≤ article¼ ╔ discovereΣ tha⌠ onσ caε includσ blanδ line≤ a≤ showε ì
  298. t∩ makσ thσ CM─ filσ easie≥ t∩ read«  Thσ hel≡ screeε par⌠ oµ thσ listinτ i≤ ì
  299. takeε froφ m∙ persona∞ scrip⌠ filσ (oε which¼á ╔ havσ t∩ confess¼ ╔ havσ no⌠ ì
  300. reall∙ workeΣ ver∙ hard)«  Thσ macr∩ definitioε par⌠ oµ thσ listinτ include≤ ì
  301. onl∙á ß fe≈ oµ thσ definitions«á  Yo⌡ ma∙ wisΦ t∩ usσ thσ Prin⌠ functioεá oµ ì
  302. thσá HEL╨ utilit∙ t∩ prin⌠ ou⌠ thi≤ section¼á iε orde≥ t∩ follo≈ alonτá witΦ ì
  303. thi≤ discussion.
  304.      Thσ macr∩ "Qó i≤ includeΣ t∩ illustratσ ß ver∙ simple¼ bu⌠ useful¼ typσ ì
  305. oµ macro«á  I⌠ invoke≤ thσ ver∙ powerfu∞ filσ typinτ prograφ Q╠ (quicδ look⌐ ì
  306. oεá thσ pointed-t∩ file«á  Thi≤ i≤ hand∙ wheε yo⌡ wan⌠ morσ powerfu∞ viewinτ ì
  307. capabilit∙á thaε tha⌠ offereΣ b∙ thσ built-iε "Vó command«á  Q╠á caεá handlσ ì
  308. cruncheΣá file≤á anΣ libraries¼á anΣ i⌠ caε displa∙ tex⌠ o≥ he°á forwarΣá o≥ ì
  309. backward.
  310.  
  311.      Macr∩á "Uó uncompresse≤ ß file«á  I⌠ illustrate≤ ß morσ comple°á scrip⌠ ì
  312. tha⌠ involve≤ flo≈ contro∞ anΣ parameter≤ tha⌠ extrac⌠ individua∞ component≤ ì
  313. oµá thσ pointed-t∩ filσ name«á  I⌠ test≤ thσ filσ typσ t∩ seσ iµ thσá middlσ ì
  314. lette≥ i≤ "Qó o≥ "Z"«á  Iε thσ forme≥ case¼á i⌠ unsqueeze≤ thσ file╗á iε thσ ì
  315. latter¼á i⌠á uncrunche≤á it«á  Thσ uncompresseΣ filσ i⌠ pu⌠ int∩ thσá sourcσ ì
  316. file'≤ directory.
  317.  
  318.      Macro≤ S¼á K¼á anΣ ┬ illustratσ thσ usσ oµ inpu⌠ prompting«á  Thσ firs⌠ ì
  319. onσ allow≤ thσ use≥ t∩ specif∙ thσ filσ attribute≤ t∩ bσ set«  Notσ tha⌠ thσ ì
  320. promp⌠ include≤ ß helpfu∞ reminde≥ oµ thσ synta° requireΣ b∙ SFA.
  321.      Macr∩á ╦á crunche≤á file≤ t∩ ßá user-specifieΣá destination«á  I⌠á als∩ ì
  322. illustrate≤ ho≈ onσ log≤ int∩ thσ currentl∙ displayeΣ directory«á  ╔ d∩ thi≤ ì
  323. herσ s∩ tha⌠ ß nul∞ answe≥ t∩ thσ promp⌠ (i.e.¼ jus⌠ ß carriagσ return⌐ wil∞ ì
  324. resul⌠á iεá thσá cruncheΣá file≤ beinτ placeΣá iεá thσá currentl∙á displayeΣ ì
  325. director∙ rathe≥ thaε iε thσ homσ directory¼á a≤ woulΣ otherwisσ bσ thσ casσ ì
  326. (sincσ tha⌠ i≤ wherσ thσ macr∩ run≤ from¼á remember)«  A≤ ß result¼ however¼ ì
  327. thi≤á macr∩ wil∞ no⌠ operatσ properl∙ iε use≥ area≤ abovσ 1╡ unde≥á BGiΘá o≥ ì
  328. version≤á oµ thσ commanΣ processo≥ tha⌠ d∩ no⌠ allo≈ logginτ int∩ higΦá use≥ ì
  329. areas.
  330.  
  331.      Macr∩á ┬á perform≤á ßá slightl∙ morσ comple°á function«á  I⌠á no⌠á onl∙ ì
  332. compresse≤ thσ pointed-t∩ filσ t∩ ß specifieΣ destinatioε directory¼á bu⌠ i⌠ ì
  333. theε mark≤ thσ sourcσ filσ a≤ havinτ beeε backeΣ up«á  ┴ combinatioε oµá thσ ì
  334. grou≡á archivσá built-iε commanΣ (t∩ taτ file≤ tha⌠ neeΣ backinτ up⌐á anΣá ß ì
  335. grou≡ macr∩ ┬ (t∩ perforφ thσ backup⌐ give≤ thσ ZFILE╥ use≥ ß wa∙ t∩ bacδ u≡ ì
  336. file≤ iε cruncheΣ forφ oε thσ backu≡ disk.
  337.      Macr∩á ═ i≤ includeΣ t∩ sho≈ tha⌠ ß ZFILE╥ macro¼á wheε i⌠ need≤ t∩á d∩ ì
  338. somethinτá morσ comple° thaε i⌠ i≤ capablσ oµ doinτ al∞ b∙ itself¼á caε pas≤ ì
  339. thσá tasδ t∩ aε ARUN┌ alias«á  Thσ MOV┼ alia≤ firs⌠ determine≤á whethe≥á thσ ì
  340. sourcσá anΣ destinatioε arσ oε thσ samσ drive«á  Iε tha⌠ case¼á MOVE.CO═á i≤ ì
  341. useΣá t∩á perforφ thσ move«á  Otherwise¼á thσ sourcσ filσ i≤ copieΣá t∩á thσ ì
  342. destinatioε anΣ theε deleted«á  Wha⌠ wσ have¼á therefore¼á i≤ ß MOV┼ commanΣ ì
  343. tha⌠ free≤ thσ use≥ oµ thσ responsibilit∙ oµ worryinτ abou⌠ whicΦ drive≤ arσ ì
  344. involveΣ -- anothe≥ examplσ oµ ho≈ Z-Systeφ caε freσ yo⌡ froφ consideration≤ ì
  345. tha⌠ neeΣ no⌠ concerε you¼ tha⌠ d∩ no⌠ requirσ humaε intelligencσ t∩ decide.
  346.  
  347.      Thσá fina∞ threσ macr∩ example≤ arσ executioε macros«á  Macr∩ ╪á cause≤ ì
  348. thσá pointed-t∩á filσ t∩ bσ executed«á  ┴ morσ sophisticateΣá versioεá migh⌠ ì
  349. checδá t∩ makσ surσ tha⌠ thσ filσ typσ i≤ COM«á  ╔ opteΣ fo≥ thσ flexibilit∙ ì
  350. oµ pointing¼á fo≥ example¼á t∩ PROGRAM.Z8░ anΣ havinτ PROGRAM.CO═á run«á  Iµ ì
  351. therσ i≤ n∩ CO═ filσ witΦ ß matchinτ name¼á thσ erro≥ handle≥ wil∞ takσ carσ ì
  352. oµ things«á  Yo⌡ wil∞ notσ thσ leadinτ coloε beforσ thσ "$nó parameter«á  I⌠ ì
  353. make≤á surσ tha⌠ thσ curren⌠ director∙ i≤ searcheΣ eveε iµ i⌠ i≤ no⌠ oεá thσ ì
  354. path«  PrompteΣ inpu⌠ i≤ useΣ t∩ allo≈ ß commanΣ tai∞ t∩ bσ included.
  355.      Thσá ┌ macr∩ perform≤ ß user-specifieΣ functioε oε thσ pointed-t∩ file« ì
  356. Tw∩á separatσ use≥ prompt≤ allo≈ botΦ thσ commanΣ anΣ ß commanΣ tai∞á t∩á bσ ì
  357. given«á  Fo≥á example¼á iµ yo⌡ wanteΣ t∩ squeezσ thσ filσ t∩ A0:¼á yo⌡ woulΣ ì
  358. ente≥á "SQóá iε responsσ t∩ thσ firs⌠ promp⌠ anΣ "A0:ó iεá responsσá t∩á thσ ì
  359. second.
  360.  
  361.      Thσá ░ macr∩ illustrate≤ ho≈ thσ responsσ t∩ ß promp⌠ caε bσ useΣ a≤á ß ì
  362. ZFILE╥á script«á  Thi≤ macr∩ take≤ carσ oµ al∞ thosσ function≤ wσ forgo⌠á t∩ ì
  363. includσ iε ZFILER.CMD«  Thσ wholσ macr∩ i≤ jus⌠ prompteΣ input¼ anΣ whateve≥ ì
  364. wσ answe≥ wil∞ bσ ruε a≤ ß script«á  ╔ usσ thi≤ functioε s∩ ofteε tha⌠ ╔ pu⌠ ì
  365. i⌠á oε ß numbe≥ ke∙ s∩ tha⌠ i⌠ caε bσ invokeΣ witΦ ß singlσ ke∙ rathe≥á thaε ì
  366. thσ usua∞ pair«á  Also¼ a≤ yo⌡ ma∙ havσ noticed¼ ╔ includσ iε thσ macr∩ hel≡ ì
  367. screeε ß lis⌠ oµ thσ parameter≤ tha⌠ caε bσ used.
  368.  
  369.      Thσá onl∙á rea∞ limitatioε oµ thi≤ macro-to-write-a-macr∩á approacΦá i≤ ì
  370. tha⌠á prompteΣ inpu⌠ canno⌠ bσ includeΣ iε thσ response«á  A≤ ╔ writσá this¼ ì
  371. however¼á i⌠á occur≤á t∩á mσá tha⌠á thi≤ limitatioεá coulΣá bσá overcomσá b∙ ì
  372. recursivel∙ parsinτ thσ promp⌠ parameter≤ unti∞ nonσ remain¼á anΣ onl∙á theε ì
  373. goinτ oε t∩ thσ subsequen⌠ macr∩ expansioε steps.
  374. :L
  375.                            ü SAMPLE MACRO LISTIN╟ 
  376.                             --------------------
  377. ╤   q∞ $p
  378.  
  379. ╒ í iµ $t=?q?;$!sys:uµ $≡ $d$u:;else;$!sys:unc≥ $≡ $d$u:;fi
  380.  
  381. ╙ í $!sfß $≡ $ó SF┴ Option≤ (/o,o.« o=ARC,-ARC,R/O,R/W,SYS,DIR)║ "
  382. ╦ í $d$u:;$!cruncΦ $µ $"Destinatioε director∙ (DU:⌐ -- ";$h:
  383. ┬   $d$u:;cruncΦ $µ $"Destinatioε director∙ (DU:⌐ -- ";sfß $µ /arc;$h:
  384.  
  385. ═ í /movσ $≡ $"Destinatioε director∙ fo≥ move║ "
  386.  
  387. ╪ í $d$u:;:$ε $ó CommanΣ Tail║ ";$h:
  388. ┌ í $d$u:;$ó CommanΣ t∩ perforφ oε file║ ó $µ $ó Tail║ ";$h:
  389. ░ í $"Ente≥ ZFILE╥ macr∩ script║ "
  390. ú           SAMPL┼ ZFILE╥ MACRO╙ FO╥ TCJ
  391.  
  392. 0« on-linσ macr∩    A« se⌠ Archivσ bi⌠        N« NULU
  393. 1« LPU╘            B« Backu≡ (cr/sfa⌐        O.
  394. 2« Z80AS═ t∩ CO═    C« CR├                P« Protect
  395. 3« Z80AS═ t∩ RE╠    D« Datσ displa∙            Q« QL
  396. 4« Comparσ File≤    E« Edi⌠                R.
  397. 5«            F«                S« SFA
  398. 6«            G«                T« Type
  399. 7«            H«                U« Uncompress
  400. 8«            I«                V« VLU
  401. 9«            J«                W.
  402.             K« KruncΦ            X« eXecute
  403.             L« LDI╥                Y.
  404.             M« Movσ                Z« ruε command
  405.  
  406. $íá    ZE╪á 'GOº    $─  DRIV┼      $╨á DU:FN.F╘        $╞  FN.FT
  407. $"..ó  PROMP╘       $╒  USE╥       $╬  F╬              $╘  FT
  408. $'..º  PROMP╘       $╚  HOME
  409.