home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / DATABASE / DSCALC.ZIP / DSKEYS.SC < prev    next >
Text File  |  1990-01-23  |  4KB  |  236 lines

  1. ;-- this utility procedure is used to re-define the keys used in DSCalc.
  2. ;-- by changing the key types and the source code of the calculator,
  3. ;-- keys can be mapped to change their action in the calculator
  4. ;-- if you attempt to do this, a full understanding of the program is
  5. ;-- required 
  6. ;-------------------------------------------------------------------------------
  7. ;                                                                    ds.keys.u()
  8. ;-------------------------------------------------------------------------------
  9. ; purpose: used to modify the keys accepted by the DSCalc program
  10. proc ds.keys.u()
  11.  
  12. ;-- start with a clean slate
  13. reset
  14.  
  15. ;-- place the key table on the workspace in coedit mode
  16. coedit "dskeys"
  17.  
  18. ;-- no modifications to the key fields
  19. imagerights update
  20.  
  21. ;-- wait until [f2] or [esc]
  22. ;-- normally would trap for other keys such as dos and dosbig
  23. ;-- but for this simple procedure, I left it as simple as possible
  24. wait table
  25. prompt "Modify the keys as required.",
  26.        "Press [F2] when done, [Esc] to cancel."
  27. until -60, 27
  28.  
  29. imagerights
  30. do_it!
  31.  
  32. if retval = 27 then
  33.    reset
  34.    return
  35. endif
  36.  
  37. reset
  38.  
  39. clear
  40.  
  41. echo normal
  42.  
  43. create "answer"
  44.        "keyspec" :"a80"
  45.  
  46. view "answer"
  47. view "dskeys"
  48. moveto [ascii code]
  49. coeditkey
  50.  
  51. ;-- scan the table and build the variables ds.neg.key.a and
  52. ;-- ds.pos.key.a
  53.  
  54. moveto "answer"
  55. [keyspec] = "ds.neg.key.a=\""
  56.  
  57. sleep 500
  58.  
  59. moveto "dskeys"
  60. xx = ""
  61. for x from 0 to -63 step -1
  62.    zoom
  63.    select x
  64.    if upper(window()) <> "match not found" then
  65.     xx = xx + lower(substr([dscalc function],1,1))
  66.      else
  67.     xx = xx + "i"
  68.    endif
  69. endfor
  70.  
  71. xx = lower(xx)
  72.  
  73. moveto "answer"
  74. [] = [] + xx + "\"+"
  75.  
  76. down
  77.  
  78. [] = "             \""
  79.  
  80. sleep 500
  81.  
  82. moveto "dskeys"
  83. xx = ""
  84. for x from -64 to -127 step -1
  85.    zoom
  86.    select x
  87.    if upper(window()) <> "match not found" then
  88.       xx = xx + lower(substr([dscalc function],1,1))
  89.     else
  90.      xx = xx + "i"
  91.    endif
  92. endfor
  93.  
  94. xx=lower(xx)
  95.  
  96. moveto "answer"
  97. [] = [] + xx + "\"+"
  98.  
  99. down
  100.  
  101. [] = "             \""
  102.  
  103. sleep 500
  104.  
  105. moveto "dskeys"
  106. xx = ""
  107. for x from -128 to -132 step -1
  108.    zoom
  109.    select x
  110.    if upper(window()) <> "match not found" then
  111.       xx = xx + lower(substr([dscalc function],1,1))
  112.     else
  113.       xx = xx + "i"
  114.    endif
  115. endfor
  116.  
  117. xx = lower(xx)
  118.  
  119. moveto "answer"
  120. [] = [] + xx + "\""
  121.  
  122. down down
  123.  
  124.      "ds.pos.key.a=\""
  125.  
  126. sleep 500
  127.  
  128. moveto "dskeys"
  129. xx = ""
  130. for x from 1 to 64
  131.    zoom
  132.    select x
  133.    if upper(window()) <> "match not found" then
  134.       xx = xx + lower(substr([dscalc function],1,1))
  135.     else
  136.       xx = xx + "i"
  137.    endif
  138. endfor
  139.  
  140. xx = lower(xx)
  141.  
  142. moveto "answer"
  143. [] = [] + xx + "\"+"
  144.  
  145. down
  146.  
  147. [] = "             \""
  148.  
  149. sleep 500
  150.  
  151. moveto "dskeys"
  152. xx = ""
  153. for x from 65 to 128
  154.    zoom
  155.    select x
  156.    if upper(window()) <> "match not found" then
  157.       xx = xx + lower(substr([dscalc function],1,1))
  158.     else
  159.       xx = xx + "i"
  160.    endif
  161. endfor
  162.  
  163. xx = lower(xx)
  164.  
  165. moveto "answer"
  166. [] = [] + xx + "\"+"
  167.  
  168. down
  169.  
  170. [] = "             \""
  171.  
  172. sleep 500
  173.  
  174. moveto "dskeys"
  175. xx = ""
  176. for x from 129 to 192
  177.    zoom
  178.    select x
  179.    if upper(window()) <> "match not found" then
  180.       xx = xx + lower(substr([dscalc function],1,1))
  181.     else
  182.       xx = xx + "i"
  183.    endif
  184. endfor
  185.  
  186. xx = lower(xx)
  187.  
  188. moveto "answer"
  189. [] = [] + xx + "\"+"
  190.  
  191. down
  192.  
  193. [] = "             \""
  194.  
  195. sleep 500
  196.  
  197. moveto "dskeys"
  198. xx = ""
  199. for x from 193 to 255
  200.    zoom
  201.    select x
  202.    if upper(window()) <> "match not found" then
  203.       xx = xx + lower(substr([dscalc function],1,1))
  204.     else
  205.       xx = xx + "i"
  206.    endif
  207. endfor
  208.  
  209. xx = lower(xx)
  210.  
  211. moveto "answer"
  212. [] = [] + xx + "\""
  213.  
  214. sleep 500
  215.  
  216. do_it!
  217.  
  218. reset
  219.  
  220. ;-- export the answer table to a script file
  221. menu {tools} {exportimport} {export} {ascii} {text} {answer} {dskeyspc.sc}
  222. if lower(menuchoice()) = "cancel" then
  223.   {replace}
  224. endif
  225.  
  226. delete "answer"
  227.  
  228. beep
  229.  
  230. message "Done!"
  231.  
  232. sleep 1000
  233.  
  234. endproc
  235.  
  236. ds.keys.u()