home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sources / hp48 / 291 < prev    next >
Encoding:
Text File  |  1992-11-19  |  12.7 KB  |  294 lines

  1. Newsgroups: comp.sources.hp48
  2. Path: sparky!uunet!seq!spell
  3. From: Daniel COHEN-LAROQUE <COHEN_LA@eldi.epfl.ch>
  4. Subject:  v07i040:  mbuilder.dc - Menu Builder v1.0, Part01/01
  5. Message-ID: <1992Nov19.195618.18939@seq.uncwil.edu>
  6. Followup-To: comp.sys.hp48
  7. Sender: spell@seq.uncwil.edu (Chris Spell)
  8. Organization: Univ. of North Carolina @ Wilmington
  9. Date: Thu, 19 Nov 1992 19:56:18 GMT
  10. Approved: spell@seq.uncwil.edu
  11. Lines: 285
  12.  
  13. Checksum: 3685736460 (verify with brik -cv)
  14. Submitted-by: Daniel COHEN-LAROQUE <COHEN_LA@eldi.epfl.ch>
  15. Posting-number: Volume 7, Issue 40
  16. Archive-name: mbuilder.dc
  17.  
  18. BEGIN_DOC mbuilder.doc
  19.  
  20.       Hello FortyEighters!
  21.  
  22. Several hackers asked 2 or 3 weeks ago for some info about menus. 
  23. The problem was to build sub directory menus with the MENU & TMENU
  24. commands. The answer might be :
  25.    {{ << grob 21x8 << {{ "back" <<0 menu>> }} TMENU >> }}
  26. but of course a grob is fastidious to make and eat furthermore our precious
  27. RAM. That was enough for me to find a better way to achieve this task.
  28.  
  29. The following program is a recursive menu compiler. It's a sytem-RPL code
  30. which compiles a list (menu) in level 1 and returns his system-RPL equivalent.
  31. The program is fast (about 2 seconds for a classical menu, depending on how 
  32. huge yours is) and performs lots of tasks described below.
  33.       
  34.       GREAT! It's time to try it...
  35.  
  36. Fist of all, I did my best to keep the MENU format. So, you just need to add
  37. a single parameter per assigned key: this lets you modify your olds menus.
  38.  
  39. IMMMMMMMMMMMMM;
  40. : MENU SYNTAX :
  41. HMMMMMMMMMMMMM<  
  42. The basic format is the following:
  43.  
  44. {{ KeyType1 KEY1 AssignedArea1 } { KeyType2 KEY2 AssignedArea2 } ... }
  45.  
  46. IMMMMMMMMMMMMKMMMMMMMMMMMMMKMMMMMMMMMMMMMMMMMMMMMMMMMMMKMMMMMMMMMMMMMMMMMMMMM;
  47. :   KeyType  :     Key     :       AssignedArea        :         Note        :
  48. LMMMMMMMMMMMMNMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMMM9
  49. :    "S"     :   String    : ....//{..../ ..../ ..../} :  Like normal menu   :
  50. : (Standard) :             :                           :                     :
  51. LMMMMMMMMMMMMNMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMMM9
  52. :    "R"     :     "       :           "               :  Like Solver menu   :
  53. : (Reverse)  :             :                           :                     :
  54. LMMMMMMMMMMMMNMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMMM9
  55. :    "G"     :    Grob     :           "               :  Like the grob      :
  56. :  (Grob)    :             :                           :                     :
  57. LMMMMMMMMMMMMNMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMMM9
  58. :    "F"     :   String    : Real Number + user flag   : Like Beep in the    :                     :
  59. :  (Flag)    :             :             - system flag : Modes menu (VAR key):
  60. LMMMMMMMMMMMMNMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMMM9
  61. :    "D"     :   String    : Basic format, see         : Not limited in the  :
  62. : (Directory):             : provided example          : number of dir.      :
  63. HMMMMMMMMMMMMJMMMMMMMMMMMMMJMMMMMMMMMMMMMMMMMMMMMMMMMMMJMMMMMMMMMMMMMMMMMMMMM<
  64.  
  65. Once your list is written, push it on level 1 and evaluate MBUILDER. You
  66. should get the executable code menu. This code can be stored in any
  67. variable, CST excepted. Recalling this variable causes a temporary menu
  68. (like the TMENU command).
  69.  
  70. Now, instead of building a temporary menu, you can make a 'CST' one
  71. (permanent menu like the MENU command). For this, push 'CST' in level 2
  72. and your list in level 1, then evaluate MBUILDER. In this case,
  73. the ***LOCAL*** 'CST' variable will be created/replaced and 
  74. directly contains your menu. Recall it by pressing the CST key.
  75. (Maybe the arguments can appear not very logical, but that's not very
  76. easy because MBUILDER recursively builds the menu, trust me!)
  77.  
  78. IMMMMMMMMMMMMMMMMMMMMMM;
  79. : ERROR MESSAGES TABLE :
  80. HMMMMMMMMMMMMMMMMMMMMMM<  
  81. Because of using systemRPL code, I tried to trap the maximum of syntax errors.
  82.  
  83. "Hey, {}? Nice Menu!" : Null list entered
  84.  
  85. ":Syntax:  {} missing" : The sub element is not a list 
  86.                          i.e. { {} "S" "KEY" ..../ }
  87.  
  88. "Need #3 Parameters" : The sub list does not exactly contain 3 elements.
  89.  
  90. "Max #3 Def. Per Key" : The Assigned Area(if list is used) must 
  91.                         contain <= 3 programs.
  92.  
  93. ":Program Expected:..../" : Means the Assigned Area is not a program or
  94.                             does nor contain programs if list is used.
  95.  
  96. ":Grob Size: 21x8 Only" : i.e. { { "G" grob21x7 ..../} }  
  97.  
  98. ":Bad Configuration:
  99. Check List"             : i.e. { { "G" "example" { ..../ ..../ } } or
  100.                           the keytype is not one of the following ones 
  101.                           "G" "S" "D" "F" R"
  102.  
  103. IMMMMMMMMMMMMMM;
  104. : SOME ADVICES :
  105. HMMMMMMMMMMMMMM<  
  106.  
  107. - A menu like { { "S" "example" { ./ . DROP / } } provides the DROP command
  108.   for left-shifted key and a DoBadKey (Error Beep) for non-shifted and
  109.   right-shifted keys.
  110.  
  111. - The output compiled menu is a systemRPL code but the userRPLprograms 
  112.   attached to the keys are still in userRPL. That means the menu should be 
  113.   safe to use (for people scared to see 'external' on the stack!).
  114.   Of course, systemRPL programs are not changed too.
  115.  
  116. - Executing MBUILDER without any arguments displays the necessary help.
  117.  
  118. - When the "D" & "F" keytypes (Directory) are used, the grob is build each 
  119.   time the menu is launched (in order to save RAM).
  120.  
  121. - { "S" "back" . 0 MENU / } displays the upper directory. See the provided
  122.    example. However, I didn't solved the problem of going back when more 
  123.    than one sub directory is used. Tell me if you 've found the solution!
  124.  
  125. - Don't forget to call the program MBUILDER (Upper case letters)
  126.  
  127. IMMMMMMMMMMMMMMMMM;
  128. : STILL FEW WORDS :
  129. HMMMMMMMMMMMMMMMMM<  
  130.  
  131. I didn't write this tool to replace each time the MENU command but to improve
  132. your menus. All the things are not perfect: once a menu has been compiled,
  133. it can't be extracted anymore.(A program could be written for this! Maybe
  134. in the next release...) So, I recommend to save a compressed version
  135. of the menus you compiled or use MBUILDER for the menus you don't change
  136. anymore (if they exist!)
  137.  
  138. This soft is posted in the hope it will be usefull, 
  139. but without any WARRANTY. It has been successfully tested 
  140. on my calc (Revision E), but can still contain some bugs.
  141. MBUILDER is freeware, but I want my name to be attached to the soft.
  142.  
  143. If you find MBUILDER usefull enough to keep it in either your calc or you PC,
  144. please mail me a postcard.
  145.  
  146. Use my e-mail for any improvements, suggestions etc...
  147. Dan.
  148.  
  149. --:
  150. Daniel COHEN_LAROQUE                        Address :  Les Pommeraies
  151. Swiss Federal Institute of Technology                  74160 ARCHAMPS
  152. Communication Sciences                                 FRANCE
  153.            ----><----       
  154. "Notre nature est dans le mouvement,          Voice :  (+33) 50.43.71.67
  155.  le repos entier est la mort."               e-mail :  cohen_la@eldi.epfl.ch
  156.                  Blaise Pascal                
  157.  
  158. END_DOC
  159.  
  160.  
  161. BEGIN_ASC mbuilder.asc
  162. %%HP: T(3)A(R)F(.);
  163. "D9D202BF8112040D9D20F6A36CB916D9D20C2A20B2000845697C202B7D7F302E
  164. 496365602D656E6571284051B2130EA431C2A20F2000245796C64696E6760235
  165. 97372505C402D456E657F1504219E550FC436FA450D7ED5BD37011226A2170D9
  166. D20C2A20F2000A33597E647168702A30202B7D702D696373796E676794708405
  167. 1B2130F6A368DA16D9D204423079E6017CE3B2130D9D20FA450D0040E4D30CB9
  168. 16D9D20C2A2092000E45656460232330205162716D656475627377947084051B
  169. 2130EF11688130C2A20700004479B3032230C2A20700006491636A2170D9D201
  170. 12268DA16D9D20FA450D7ED588130D004038D30CB916D9D2079470C2A20B2000
  171. D4168702323302445666E20207562702B4569784051B2130B21309FF309E550F
  172. C4363C3707E126A2170D9D2079470C2A20F2000A30527F6762716D6025487075
  173. 636475646A3BAF1BB84051B213088130C2A20B0000BA02BB7314179B308DA16D
  174. 9D2044230EFDF3B2130D9D2079E60D9D2088704B213032230F1250B213070F26
  175. AF2500E516433706B436B213033F06D9D2088130C2A20700003579B30EF11695
  176. 12664B307F816D9D2079E60D9D2088704B213032230AF25079E60823A3AF250B
  177. 213088130C2A20700002579B30EF1169512664B307F816D9D2079E60D9D20887
  178. 04B213032230AF25079E60E44A3AF250B213088130C2A20700007479B30EF116
  179. 1022664B307F816D9D20E97159B136F30401C0409B13679B30A2170D9D207947
  180. 0C2A20F2000A37427F626023596A756A3022313878302F4E6C69784051B2130B
  181. 213088130C2A20700006479B30EF1169512664B307F816D9D207472696126A21
  182. 70D9D20C2A2013000A364C6167602E457D6265627025487075636475646A3794
  183. 7084051B21307D8A232230009A2AEC815923047A20D6E204066C61676D6E2030
  184. 374727B21300D47079E60D9D2088704B213088130D6E204066C61676AF250592
  185. 30683A21C8A28DA16D9D2079E60D9D2088130DEE361673513735B2130F125032
  186. 23079E60EECE3AF250B2130D9D2079E60D9D20881309DE365573552735B2130F
  187. 12503223079E60D9D2088704ED9368773599CE3B2130AF250B2130D6E2030374
  188. 727AF250D6E204066C61676AF25079470B213088130C2A20700004479B30EF11
  189. 69512664B30C12166122664B307F816D9D2079E60D9D2088704B213032230AF2
  190. 5079E60CE3A3AF2503223084E2080D4245594C444542532230B2130D9D20C2A2
  191. 014000A32416460234F6E66696765727164796F6E6A3A034865636B602C49637
  192. 4784051B2130B2130DEE3232230AF250B213070F26AF2500E516433706B436C4
  193. 1300F636CB916D9D202C23079E604B11279B30CB916D9D203223031581D4170B
  194. 2130B21307EF3679E6068F04AF250B2130FEF30D9D20CA03113593FC2E4D0040
  195. 30040C2A20F2000D456E657245796C6465627022497024416E672932300D110B
  196. 821CF14653621CF14642D46D5040F2911FF2210B8217604088130C2A20F30005
  197. 6D2D61696C6A30236F68656E6F5C6160456C64696E2560766C6E2368608F110B
  198. 821FEF303A0408813042D463223071B05C2A2034000727235727202B5354746D
  199. 5A302020202027272020202020202020202027272C2A2014000727225727202B
  200. 5255667D5A3020235472796E67602020202020202027272C2A20940007272747
  201. 27202B57427F626D5A3027427F6260202020202B45697C4963747F2052776C2A
  202. 2054000727264727202B564C61676D5A30202020272720202020202021B32026
  203. 4C61676C2A2054000727244727202B5449627D5A302020235472796E67602020
  204. 2C4963747D456E657B2040EC3703004012270B20402CE30B7040CBD305923008
  205. F110B821433709FF30E4B46C2A2074000B7027272459707567272020202B4569
  206. 7E416D656020205162716D65647562702D708F110B8219E040A8B46C2A20F100
  207. 005275637370216E69702B6569700D110B82156F1485230EA431C2A205C00002
  208. 0202020202025537167656A3A002A313A302D456E65702C4963747A0D8025487
  209. 563657471626C65602D456E657A0A002A313A302D456E65702C4963747A002A3
  210. 23A3027234354572A0D8A0C4F63616C60234354502D456E6570237166756469F
  211. F30F3040EC4A3F2293B2130B21300111"
  212. END_ASC
  213.  
  214. BYTES: #1110h 1550
  215.  
  216. BEGIN_UU mbuilder.uue
  217. begin 644 mbuilder
  218. M2%!(4#0X+46=+2#[&"%`T-D";SK&FV&=+<"B`BL`@%26QP*RU_<#XI0V5@;2
  219. M5N96%X($%2LQX$H3+"KP`@!"=6EL9&EN9R!3>7-24$P@365N=1\%))%>!<\T
  220. M]DH%?=ZU/0<1(J82!YTMP*("+P"@,Y7G1A>&!Z(#`K+7!]*6-C>7YG9V20=(
  221. M4+$2`V\ZAJUAG2U`)`.7;A#'/BLQT-D"KU30``1./<";89TMP*("*0#@5%9&
  222. M!C(R`P(5)A?65D97)C=W20=(4+$2`_X1AA@#+"IP``!$ESLP(@,L*G```$89
  223. M-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`O!2LQ</!B^E(`7F$T<V!+8TPQ`&]CO!G6V0+",G#I!K01<KD#O!G6
  240. MV0(C,C!1&$UQL!(#*S%P_F.7;F#X0/I2L!(#[S_0V0*L,!%3.<_BU``$`T#`
  241. MH@(O`-!4YE8G5)?&1E8F!R*4!T(4YG:2(P/0$;`HP1]D-2;!'V0D3=8%!"\9
  242. M\2\2L"AQ!@2(,<"B`C\`4-;2%I;&I@,R]H96YO;%%@94QD:6YE(&9\;F,H8&
  243. M^!&P*/'^`Z-`@!@#)$TV(@,7"\6B`D,`<'(R=7("LC5%1]:E`P("`@)R<@("
  244. M`@("`@("`@)R<L*B`D$`<'(B=7("LB559M>E`P(R12>7YG8&`@("`@("`G)R
  245. MPJ("20!P<G)T<@*R=23W)M:E`W(D]R8&`@("`K)4EL>4-D?W`B5WQJ("10!P
  246. M<F)T<@*R9<06=M:E`P("`G)R`@("`@("$CL"8L06=L:B`D4`<')"='("LD64
  247. M)M>E`P(",D4GE^9V!@("PI0V1]=4YE:W`@3.<S``!"%RL`($PCZP!P2\/5`I
  248. M`X`?`8L2-'.0_P-.2\:B`D<`L`=R<D*5!U=V<@("`K)4EN<4UE8&`@(5)A?6
  249. M5D97)@?2!_@1L"B1#@2*2\:B`A\``"57-C<'$N:6![)6E@?0$;`H4?9!6#+@
  250. M2A,L*E`,`"`@("`@("!5<V%G93H*(#HQ.B!-96YU($QI<W0*C2!%>&5C=71A
  251. M8FQE($UE;G4*"B`Z,3H@365N=2!,:7-T"B`Z,CH@)T-35"<*C0I,;V-A;"!#
  252. <4U0@365N=2!S879E9/D_\`,$SJ3S(CDK,;`2`[`2
  253. `
  254. end
  255. sum -r/size 38053/2175 section (from "begin" to "end")
  256. sum -r/size 63278/1558 entire input file
  257. END_UU
  258.  
  259. BEGIN_RPL example
  260. %%HP: T(3)A(D)F(.);
  261. { { "S" "STD" {
  262. \<<
  263. "Standard Key
  264.  
  265. Left \-> bad key
  266. Right \-> 'right'"
  267. CLLCD 2 DISP 7
  268. FREEZE
  269. \>>
  270. \<<
  271. \>>
  272. \<< "Right Shifted"
  273. CLLCD 2 DISP 7
  274. FREEZE
  275. \>> } } { "R" "REV"
  276. \<< "Reverse Key"
  277. CLLCD 2 DISP 7
  278. FREEZE
  279. \>> } { "G"
  280. GROB 21 8 7C7CF110000110000191B131100001100001100001FF0E11
  281. \<< "Grob Key" CLLCD
  282. 2 DISP 7 FREEZE
  283. \>> } { "F" "TIME"
  284. -40 } { } { "D"
  285. "DIR" { { "S" "IN"
  286. \<< "Inside Dir"
  287. CLLCD 2 DISP 7
  288. FREEZE
  289. \>> } { } { "R"
  290. "BACK"
  291. \<< 0 MENU
  292. \>> } } } }
  293. END_RPL
  294.