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