home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 31 / CDASC_31_1996_juillet_aout.iso / vrac_os2 / thedjg22.zip / DEMO.THE < prev    next >
Text File  |  1996-05-26  |  12KB  |  349 lines

  1. /**/
  2. 'rexxout file 5000'
  3. Call Initialise
  4. Do Forever
  5.    'reserved * off'
  6.    'reserved' midline-2 Centre('Select the category of demonstration',numcols)
  7.    'reserved' midline-1
  8.    prefix = (numcols-25) % 2
  9.    'reserved' midline   Copies(" ",prefix)||'1.  THE concepts'
  10.    'reserved' midline+1 Copies(" ",prefix)||'2.  Configuration of THE'
  11.    'reserved' midline+2 Copies(" ",prefix)||'3.  Some THE commands'
  12.    'reserved' midline+3 Copies(" ",prefix)||'4.  Navigating through THE'
  13.    rc = menuopt()
  14.    Select
  15.      When rc = 1 Then Call concepts numlines
  16.      When rc = 2 Then Call config numlines, reserved_colour
  17.      When rc = 3 Then Call commands numlines
  18.      When rc = 4 Then Call navigating numlines
  19.      Otherwise Nop
  20.    End
  21. /* 'qquit'
  22.    'x' fpath.1||fname.1 */
  23.    Call Restart
  24. End
  25. 'reserved * off'
  26. 'curline' save_curline
  27. Return
  28.  
  29. /*---------------------------------------------------------------------------*/
  30. concepts: Procedure Expose monitor.
  31. /*---------------------------------------------------------------------------*/
  32. Parse Arg numlines .
  33. If monitor.1 = 'MONO' Then
  34.   Do
  35.     norm. = 'normal'
  36.     high = 'reverse'
  37.     'color prefix normal bold'
  38.     'color idline normal bold'
  39.     'color statarea normal bold'
  40.     highlight_text = 'in reverse video'
  41.   End
  42. Else
  43.   Do
  44.     norm.1 = 'grey blue'
  45.     norm.2 = 'black cyan'
  46.     norm.3 = 'blue white'
  47.     norm.4 = 'blue white'
  48.     norm.5 = 'white blue'
  49.     norm.6 = 'black cyan'
  50.     high = 'white black'
  51.     highlight_text = 'with white writing on black background'
  52.   End
  53.  
  54. precmd.   = ''
  55. precmd.2  = "colour filearea" high
  56. precmd.3  = "colour prefix" high
  57. precmd.4  = "colour statarea" high
  58. precmd.5  = "colour idline" high
  59. precmd.6  = "colour curline" high
  60. precmd.7  = "colour cmdline" high
  61. precmd.8  = ""
  62.  
  63. command.1  = "0"
  64. command.2  = "0 colour filearea" norm.1
  65. command.3  = "0 colour prefix" norm.2
  66. command.4  = "0 colour statarea" norm.3
  67. command.5  = "0 colour idline" norm.4
  68. command.6  = "0 colour curline" norm.5
  69. command.7  = "0 colour cmdline" norm.6
  70. command.8  = "0"
  71. command.0  = 8
  72.  
  73. rsrvd_start.  = -5
  74. rsrvd_start.8 = -4
  75.  
  76. rsrvd.1  = " The lines displayed here are reserved lines which can contain any text that\n",
  77.            "the user desires. They can appear anywhere within the window and can be\n",
  78.            "turned on or off with the SET RESERVED command.\n\n"
  79. rsrvd.2  = " The area of the screen that is displayed" highlight_text "\n",
  80.            "is the FILEAREA.  This is where the contents of the file being edited is\n",
  81.            "displayed.\n\n"
  82. rsrvd.3  = " The area of the screen that is displayed" highlight_text "\n",
  83.            "is the PREFIX AREA.  This is used to display the line number associated with\n",
  84.            "each line.  Editing commands can also be entered here.\n\n"
  85. rsrvd.4  = " The area of the screen that is displayed" highlight_text "\n",
  86.            "is the STATUS AREA.  This is used to display information about the current\n",
  87.            "editing session.\n\n"
  88. rsrvd.5  = " The area of the screen that is displayed" highlight_text "\n",
  89.            "is the IDLINE. The information in this area relates to the file currently\n",
  90.            "being edited.\n\n"
  91. rsrvd.6  = " The area of the screen that is displayed" highlight_text "\n",
  92.            "is the CURRENT LINE. All commands issued from the command line take effect\n",
  93.            "from this line.\n\n"
  94. rsrvd.7  = "off\nThe area of the screen that is displayed" highlight_text "\n",
  95.            "is the COMMAND LINE. THE commands can be entered in this area.\n\n"
  96. rsrvd.8  = "off\nThis completes the tour of the concepts and definitions of THE.\n"
  97.  
  98. 'reserved * off'
  99.  
  100. Call doit numlines
  101.  
  102. If monitor.1 = 'MONO' Then
  103.   Do
  104.     'color prefix reverse'
  105.     'color idline reverse'
  106.     'color statarea reverse'
  107.   End
  108. Return
  109.  
  110. /*---------------------------------------------------------------------------*/
  111. config: Procedure 
  112. /*---------------------------------------------------------------------------*/
  113. Parse Arg numlines, reserved_colour
  114. 'reserved * off'
  115.  
  116. command.1  = "0 'prefix off#cmdline off#idline off#statusline off#reserved * off'"
  117. command.2  = "0 'prefix on left#cmdline bot#idline on#statusline bot#cursor cmdline'"
  118. command.3  = "0 'prefix on right'"
  119. command.4  = "0 'cmdline top'"
  120. command.5  = "0 'prefix on left#cmdline bot'"
  121. command.6  = "0 'set compat xedit#msgline on -2 1'"
  122. command.7  = "0 'set compat kedit#msgline on -2 1'"
  123. command.8  = "0 'compat the#msgline on -2 1#colour reserved'" reserved_colour
  124. command.9  = "1"
  125. command.0  = 9
  126.  
  127. precmd. = ''
  128.  
  129. rsrvd_start.  = -7
  130. rsrvd_start.4 = -4
  131. rsrvd_start.5 = -3
  132. rsrvd_start.6 = -5
  133. rsrvd_start.7 = -5
  134. rsrvd_start.8 = -3
  135. rsrvd_start.9 = -3
  136.  
  137. rsrvd.1  = " One of THE's most powerful features is that it lets you change\n",
  138.            "the way the editor looks.  In it's default mode, THE has several\n",
  139.            "portions of the screen set aside for displaying useful information.\n",
  140.            "You may not want all of these areas displayed, or displayed in their\n",
  141.            "default areas. For example, lets hide all areas except for the FILEAREA.\n\n"
  142. rsrvd.2  = ''
  143. rsrvd.3  = "off\noff\noff\n",
  144.            "Now that we have everything back the way it was, lets move them around.\n\n",
  145.            "Lets move the PREFIX AREA to the right...\n\n"
  146. rsrvd.4  = 'off\n',
  147.            "... the COMMAND LINE to the top...\n\n"
  148. rsrvd.5  = " Now we'll put everything back the way it was...\n\n"
  149. rsrvd.6  = " THE makes it easy to set up your editing session to look like other editors\n",
  150.            "of its ilk; XEDIT and Kedit, with the SET COMPAT command...\n\n",
  151.            "First, lets look at SET COMPAT XEDIT...\n\n"
  152. rsrvd.7  = 'off\noff\n',
  153.            "... now Kedit's default look...\n\n"
  154. rsrvd.8  = " Now we'll put everything back the way it was...\n\n"
  155. rsrvd.9  = " This completes the section on configuring THE.\n\n"
  156.  
  157. Call doit numlines
  158.  
  159. Return
  160.  
  161. /*---------------------------------------------------------------------------*/
  162. commands: Procedure
  163. /*---------------------------------------------------------------------------*/
  164. Parse Arg numlines .
  165.  
  166. command.1  = "1 'all /the/ | /and/'"
  167. command.2  = "1 'set shadow off'"
  168. command.3  = "1 'all'"
  169. command.4  = '1'
  170. command.0  = 4
  171.  
  172. precmd. = ''
  173.  
  174. rsrvd_start. = -7
  175.  
  176. rsrvd.1  = " Lets look at some of the powerful features of THE...\n",
  177.            "The ALL command lets you edit a selected group of lines based on a target.\n",
  178.            'Assume we want to look at only those lines that contain the string "the"\n',
  179.            'or "and"\n',
  180.            'The command to do this is displayed on the COMMAND LINE.\n\n'
  181. rsrvd.2  = ' All lines that contain either "the" or "and" are now displayed.  Those lines\n',
  182.            'not displayed are replaced with SHADOW lines, indicating the number of lines\n',
  183.            'NOT matching the requested target.  These shadow lines can be made to not\n',
  184.            'appear by changing the setting of SHADOW.\n',
  185.            'The command to do this is displayed on the COMMAND LINE.\n\n'
  186. rsrvd.3  = 'off\noff\noff\n',
  187.            "To restore the display of all lines in the file issue the ALL command without\n",
  188.            "any arguments as displayed on the COMMAND LINE.\n\n"
  189. rsrvd.4  = 'off\noff\noff\noff\n',
  190.            "This completes the tour of the some of THE's most powerful and useful commands.\n\n"
  191.  
  192. Call doit numlines
  193.  
  194. 'set shadow on'
  195. 'cursor cmdline'
  196. Return
  197.  
  198. /*---------------------------------------------------------------------------*/
  199. navigating: Procedure
  200. /*---------------------------------------------------------------------------*/
  201. Parse Arg numlines .
  202.  
  203. command.1  = '1 cursor home'
  204. command.2  = "1 'cursor down#cursor down'"
  205. command.3  = "1 'text the'"
  206. command.4  = '1 sos undo'
  207. command.5  = '1 sos tabwordf'
  208. command.6  = '1 sos tabwordb'
  209. command.7  = '1 sos prefix'
  210. command.8  = '1 sos marginl'
  211. command.9  = '1 sos endchar'
  212. command.10 = '1 sos startendchar'
  213. command.11 = '1 bottom'
  214. command.12 = '1 top'
  215. command.13 = '1 forward'
  216. command.14 = '1 cursor screen 10 20'
  217. command.15 = '1 cursor 10 20'
  218. command.16 = '1'
  219. command.0  = 16
  220.  
  221. precmd. = ''
  222.  
  223. rsrvd_start. = -3
  224. rsrvd_start.13 = -4
  225. rsrvd_start.14 = -5
  226. rsrvd_start.15 = -5
  227. rsrvd_start.16 = -5
  228.  
  229. rsrvd.1  = " First, we'll move the cursor into the FILEAREA...\n\n"
  230. rsrvd.2  = " ...move the cursor down 2 lines...\n\n"
  231. rsrvd.3  = ' ...type the word "the"...\n\n'
  232. rsrvd.4  = " ...oops, we didn't want to do that, let's undo the change...\n\n"
  233. rsrvd.5  = " Move the cursor to the start of the next word...\n\n"
  234. rsrvd.6  = " Move the cursor to the start of the previous word...\n\n"
  235. rsrvd.7  = " Move the cursor into the PREFIX area...\n\n"
  236. rsrvd.8  = " ...and back to the FILEAREA.\n\n"
  237. rsrvd.9  = " Move to the end of the line...\n\n"
  238. rsrvd.10 = " ...and back to the start of the line.\n\n"
  239. rsrvd.11 = " Scroll to the bottom of the file...\n\n"
  240. rsrvd.12 = " ...and back to the top of file.\n\n"
  241. rsrvd.13 = " Scrolling backwards and forwards by a screen at a time is also available.\n",
  242.            "We'll go forward now\n\n"
  243. rsrvd.14 = "The cursor can be positioned at particular positions in the FILEAREA\n",
  244.            "by using the CURSOR SCREEN command The following positions the cursor at\n",
  245.            "row 10, column 20 relative to the top left corner of the FILEAREA.\n\n"
  246. rsrvd.15 = " The cursor can also be positioned at particular positions relative to\n",
  247.            "the top left corner of the physical window, provided the resulting position\n",
  248.            "is a valid position to be placed.\n\n"
  249. rsrvd.16 = "off\noff\nThis completes the examples of some of THE's cursor navigation.\n\n"
  250.  
  251. Call doit numlines
  252.  
  253. 'cursor cmdline'
  254. Return
  255.  
  256. /*---------------------------------------------------------------------------*/
  257. show_reserved: Procedure
  258. /*---------------------------------------------------------------------------*/
  259. Parse Arg numlines,start_line,rsrvd
  260. Do i = 0
  261.    Parse Var rsrvd line '\n' rsrvd
  262.    'reserved' start_line+i line
  263.    If rsrvd = '' Then Leave
  264. End
  265. Return
  266.  
  267. /*---------------------------------------------------------------------------*/
  268. doit: Procedure Expose command. precmd. rsrvd_start. rsrvd.
  269. /*---------------------------------------------------------------------------*/
  270. Parse Arg numlines .
  271. 'reserved * off'
  272. Do i = 1 To command.0
  273.   Call show_reserved numlines,rsrvd_start.i,rsrvd.i
  274.   If precmd.i \= '' Then
  275.     Do
  276.       cmd = precmd.i
  277.       Interpret cmd
  278.     End
  279.   If Word(command.i,1) = 1 Then
  280.     Do
  281.       'set linend off'
  282.       'cmsg' Strip(Subword(command.i,2),'B',"'");
  283.     End
  284.   Call getkey
  285.   'set linend on #'
  286.   cmd = Subword(command.i,2)
  287.   Interpret cmd
  288. End
  289. Return
  290.  
  291. /*---------------------------------------------------------------------------*/
  292. getkey: Procedure 
  293. /*---------------------------------------------------------------------------*/
  294. 'msg' Centre('Hit any key to continue...',74)
  295. 'refresh'
  296. 'readv key'
  297. If readv.1 = 'S-Q' Then 
  298.   Do
  299.     'reserved * off'
  300.     Exit
  301.   End
  302. Return
  303.  
  304. /*---------------------------------------------------------------------------*/
  305. menuopt: Procedure
  306. /*---------------------------------------------------------------------------*/
  307. 'refresh'
  308. 'readv key'
  309. If readv.1 = 'S-Q' Then
  310.   Do
  311.     'reserved * off'
  312.     Exit
  313.   End
  314. If readv.1 >= 1 & readv.1 <= 4 Then Return readv.1
  315. 'msg' Centre('Please enter 1,2,3 or 4.',74)
  316. Return 0
  317.  
  318. /*---------------------------------------------------------------------------*/
  319. Restart:
  320. /*---------------------------------------------------------------------------*/
  321. 'cmsg'
  322. 'msgline on -2 1'
  323. ':2'
  324. 'cursor screen 10 15'
  325. 'cursor cmdline'
  326. 'extract /lscreen/version/monitor/fname/fpath/curline/'
  327. If monitor.1 = 'MONO' Then reserved_colour = 'bold'
  328. Else reserved_colour = 'blue white'
  329. 'colour reserved' reserved_colour
  330. numlines = lscreen.1
  331. numcols = lscreen.2
  332. midline = numlines % 2
  333. save_curline = curline.1
  334. 'curline 6'
  335. Return
  336.  
  337. /*---------------------------------------------------------------------------*/
  338. Initialise:
  339. /*---------------------------------------------------------------------------*/
  340. Call Restart
  341. 'reserved' numlines-8 ' This is an interactive demo of THE. The demo is simply a THE macro written in'
  342. 'reserved' numlines-7 " THE's macro language, REXX. All commands and statements used are valid THE or"
  343. 'reserved' numlines-6 " REXX commands. This demonstration will give you an idea of THE's power and"
  344. 'reserved' numlines-5 ' versatility.'
  345. 'reserved' numlines-4 ' To run the demonstration, just follow the instructions that are displayed'
  346. 'reserved' numlines-3 ' in this portion of the screen.'
  347. Call getkey
  348. Return
  349.