home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mass61.zip / mass.zip / masm61 / DISK3 / INIT / TOOLS.PR$ / TOOLS
Text File  |  1992-09-17  |  23KB  |  657 lines

  1. ;   Sample TOOLS.INI file for:
  2. ;
  3. ;   Microsoft Programmer's WorkBench Version 2.00
  4. ;   Copyright (c), 1989-1992  Microsoft Corp.
  5. ;
  6. ;----------------------------------------------------------------------
  7. ;   To use the macros or settings in this file, copy or merge this file
  8. ;   with your TOOLS.INI file.
  9. ;
  10. ;   Once in TOOLS.INI, the macros and editor settings in this file can
  11. ;   be defined by initializing the appropriate tagged section. A tagged
  12. ;   section for PWB begins with a tag, which has the form:
  13. ;
  14. ;       [PWB-name]
  15. ;
  16. ;   Where <name> is the name of the tagged section.
  17. ;
  18. ;   To initialize a named section of TOOLS.INI, execute Arg <name>
  19. ;   Initialize, as follows:
  20. ;
  21. ;   1.  Execute the Arg function (press ALT+A).
  22. ;   2.  Type the name of the tagged section.
  23. ;   3.  Execute the Initialize function (press SHIFT+F8).
  24. ;
  25. ;   If you want certain settings to be your default settings, copy the
  26. ;   contents of that section to the main PWB section.
  27.  
  28. ;----------------------------------------------------------------------
  29. ;   Contents
  30. ;
  31. ;   Tag                 Description
  32. ;   --------------      -----------------------------------------------
  33. ;   [pwb pwb-main]      Main PWB section
  34. ;   [pwb-4.0]           Settings for MS-DOS 4.0 and 4.1
  35. ;   [pwb-5.0]           Settings for MS-DOS 5.0
  36. ;   [pwb-..]            Default file-extension settings
  37. ;   [pwb-.bak]          Settings for .BAK files
  38. ;   [pwb-utility]       Miscellaneous utility macros
  39. ;   [pwb-emulations]    Selected editor emulations
  40. ;   [pwb-visible]       Settings for visisble whitespace characters
  41. ;   [pwb-invisible]     Settings for invisisble whitespace characters
  42. ;   [pwb-wptab]         Settings for word-processor-like tab handling
  43. ;   [pwb-notab]         Settings for no tab characters
  44. ;   [pwb-CTPL]          C templates
  45. ;   [pwb-ckeys]         Key assignments for C templates
  46. ;   [pwb-samples]       Sample macros from Help
  47. ;   [pwb-tutor]         Sample macros from the PWB tutorial
  48. ;   [pwb-abbr]          Abbreviation facility
  49.  
  50. ;----------------------------------------------------------------------
  51. ;   Note  - Some macros in this file assume certain conditions.
  52. ;
  53. ;   All macros in this file that use regular expressions assume that the
  54. ;   Unixre switch is set to yes, the default value for Unixre.
  55. ;
  56. ;   Many macros assume that the current selection mode is stream or box
  57. ;   mode. These macros may not work correctly in line selection mode.
  58.  
  59. ;----------------------------------------------------------------------
  60. [pwb pwb-main]
  61. ;   Main section of TOOLS.INI
  62. ;
  63. ;   Only this section, operating-system-specific, and file extension
  64. ;   sections are initialized at startup. For more information on these
  65. ;   sections, see the PWB Help under TOOLS.INI.
  66.  
  67. ;   Autostart is executed automatically at startup.
  68. Autostart :=
  69.  
  70. ;----------------------------------------------------------------------
  71. ;   Sample operating system tagged sections
  72.  
  73. [pwb-4.0]
  74. ;   Settings when running on MS-DOS version 4.0 or 4.1
  75.  
  76. [pwb-5.0]
  77. ;   Settings when running on MS-DOS version 5.0
  78.  
  79. ;----------------------------------------------------------------------
  80. ;   Sample file extension tagged sections
  81.  
  82. [pwb-..]
  83. ;   Default settings for any file extension that is not otherwise
  84. ;   defined.
  85.  
  86. color:text 17
  87.  
  88. [pwb-.asm]
  89. ;    Change tab settings for .ASM files
  90.  
  91. tabstops      :8
  92. filetab       :8
  93.  
  94. [pwb-.bak]
  95. ;   It's easy to open a .BAK file by mistake, so this section defines
  96. ;   the text color to something noticeable.
  97.  
  98. color:text 4e
  99.  
  100. ;----------------------------------------------------------------------
  101. [pwb-utility]
  102. ;   Utility macros
  103.  
  104. ;   Window and file management
  105.  
  106. ;   Close all files in the active window except the current file.
  107. ;   When multiple files have been opened in a single window, this
  108. ;   macro removes the extra files.
  109. AllBut1File  := cancel :>s setfile -> closefile < =>s
  110.  
  111. ;   Close all windows except for the active window.
  112. AllBut1Window:= cancel :>s openfile -> meta window < =>s
  113.  
  114. ;   Minimize all windows.
  115. MinimizeAll := cancel arg minimize
  116.  
  117. ;   Restore all windows.
  118. RestoreAll  := cancel arg minimize :>s selwindow minimize ->s  \
  119.                selwindow minimize
  120.  
  121. ;   Change directory to directory of current file.
  122. ;   Requires an editable file.
  123. ccd  := linsert curfile arg curfilenam msearch arg meta ldelete  \
  124.         begline arg right right setfile begline arg setfile undo
  125.  
  126. ;   Change directory to directory of current file.
  127. ;   Requires an editable file.
  128. ;   This version is slower, but does not change the current search
  129. ;   pattern.
  130. ccd2 := linsert curfile savecur curfilenam curfileext restcur  \
  131.         :>s delete cdelete left right +>s  \
  132.         begline arg right right setfile begline arg setfile undo
  133.  
  134.  
  135. ;   Synchronized error traversal: Build Results, source, and Help.
  136. ;
  137. ;   Traverses messages in the build results, showing the message, the
  138. ;   location of the message in the source file, and help for the message
  139. ;   in arranged windows.
  140. ;
  141. ;psync  - Synchronize to next message
  142. ;msync  - Synchronize to previous message
  143. ;setsync- Synchronize to message at the cursor in Build Results.
  144.  
  145. syncmsg := nextmsg -> pwbhelperr openfile arg arrangewindow
  146.  
  147. psync   := cancel syncmsg
  148. msync   := cancel arg "-1" syncmsg
  149. setsync := cancel arg "<COMPILE>" pwbwindow arg arg syncmsg
  150.  
  151. psync   :Alt+Down
  152. msync   :Alt+Up
  153. setsync :Alt+Goto
  154.  
  155. ;----------------------------------------------------------------------
  156. [pwb-emulations]
  157. ;   These macros approximate selected behaviors of other editors.
  158.  
  159. ;   Successively go to beginning of line, top left window corner,
  160. ;   beginning of file.
  161. BRIEFHome := begline +> home +> begfile
  162.  
  163. ;   Successively go to end of line, end of last line in the window,
  164. ;   end of file.
  165. BRIEFEnd  := endline +> meta down endline +> endfile
  166.  
  167. ;   Emulate an emacs-style character delete. When at the end of a line,
  168. ;   delete the line break. Otherwise delete the character at the cursor.
  169. ;   Note that this macro includes the line break when deleting the last
  170. ;   character on a line.
  171.  
  172. EmacsDel  := delete "-" left right ->eol emacscdel => :>eol left  \
  173.              arg meta sdelete
  174.  
  175. ;----------------------------------------------------------------------
  176. [pwb-visible]
  177. ;   Settings to make tabs, trailing spaces, and trailing lines visible.
  178.  
  179. tabdisp       :250
  180. traildisp     :177
  181. traillinesdisp:7
  182.  
  183. ;----------------------------------------------------------------------
  184. [pwb-invisible]
  185. ;   Settings to make tabs, trailing spaces, and trailing lines invisible.
  186.  
  187. tabdisp       :32
  188. traildisp     :32
  189. traillinesdisp:32
  190.  
  191. ;----------------------------------------------------------------------
  192. [pwb-wptab]
  193. ;   Word-processor-like settings.
  194. ;   Because tab characters and trailing spaces are allowed, the visible
  195. ;   whitespace settings above are recommended.
  196.  
  197. ;   You can change tabstops and filetab to your preference, but should
  198. ;   have the same value for proper emulation.
  199. tabstops  :8
  200. filetab   :8
  201.  
  202. realtabs  :yes
  203. tabalign  :yes
  204. entab     :0
  205. trailspace:yes
  206.  
  207. ;   Insert a tab character in insert mode.
  208. ;   Move the cursor right one tab stop in overtype mode.
  209. tabio := insertmode +>over insertmode "\t" =>  \
  210.       :>over insertmode tab
  211. tabio : Tab
  212.  
  213. ;   Move right one tab stop in both insert mode and overtype mode.
  214. ;   To insert a tab in all modes, use Quote TAB (CTRL+P, TAB)
  215. tab   :ctrl+tab
  216.  
  217. ;----------------------------------------------------------------------
  218. [pwb-notab]
  219. ;   Settings so that no new tab characters are added to the file.
  220. ;
  221.  
  222. Filetab :8          ;Tabs expand to 8 spaces
  223. Realtabs:no         ;Do not preserve tabs
  224. Entab   :0          ;Translate whitespace to spaces
  225.  
  226. ;   Note that tab characters on unmodified lines are preserved.
  227. ;
  228. ;   To strip all tabs from the file, execute the TouchAll macro with
  229. ;   these settings. To also strip trailing spaces, uncomment the next
  230. ;   line.
  231. ;trailspace:no
  232.  
  233. ;  TouchAll - Modify all nonblank lines
  234. TouchAll:= savecur  \
  235.            begfile arg arg replace "^." newline "\\0" newline restcur
  236. TouchAll:Alt+D      ;Press Alt+D to touch all nonempty lines in the file
  237.  
  238. ;----------------------------------------------------------------------
  239. [pwb-CTPL]
  240. ;   C template macro set for Microsoft Programmer's WorkBench
  241. ;   Copyright (c), 1989-1992  Microsoft Corp.
  242. ;
  243. ;   CTPL is a useful example of an extended system of macros to
  244. ;   customize the PWB. You can change this set to implement your own C
  245. ;   programming style.
  246. ;
  247. ;   To install CTPL, add this section to your TOOLS.INI. When you want
  248. ;   to activate the macros, type:
  249. ;
  250. ;       Arg "ctpl" Initialize
  251. ;
  252. ;   Or define the following macro in the main section of TOOLS.INI:
  253. ;
  254. ;       CTPL:=arg "Ctpl" initialize
  255. ;       CTPL:Alt+F10
  256. ;
  257. ;   and press ALT+F10 to initialize the C templates.
  258. ;
  259. ;   Most templates are activated by typing a C keyword and executing the
  260. ;   DoTpl macro (Alt+T). Templates usually insert some text, then select
  261. ;   an active area--a "tag".
  262. ;
  263. ;   To fill out a tag, type the replacement text.
  264. ;
  265. ;   To skip the tag, execute Cancel (Press ESC).
  266. ;
  267. ;   To move back and forth among tags use the Mrec (ALT+PGUP) and Prec
  268. ;   (ALT+PGDN) macros.
  269. ;
  270. ;   Since tags are C comments, you can compile code with incompletely
  271. ;   filled-in templates.
  272. ;
  273. ;   For templates that do not have a keyword--a function or prototype,
  274. ;   for example--CTPL defines a key assignment. This command structure
  275. ;   minimizes the number of key bindings necessary to support the CTPL
  276. ;   macro set.
  277. ;
  278. ;   For example, the switch template uses the macro AddCase (ALT+F9) to
  279. ;   insert a case just before the default case provided by the switch
  280. ;   template.
  281. ;
  282. ;   HINT: Sometimes you don't want the semicolon that CTPL often places
  283. ;   after a tag. In these situations press RIGHT to extend the selection
  284. ;   to include the semicolon as well as the tag, and it is replaced by
  285. ;   what you type.
  286. ;
  287. ;   NOTE: CTPL macros assume that the current selection mode is box or
  288. ;   stream mode. If this becomes troublesome for you, use the mode-safe
  289. ;   versions of the SelTag and DoTpl macros. The CTPL macros also work
  290. ;   correctly in stream-selection mode. If you prefer stream selection,
  291. ;   change the mode-safe versions to use the _pwbstreammode macro.
  292. ;
  293. ;   NOTE: Because PWB rereads a file-extension tagged section each time
  294. ;   you move to the file, It is not recommend to rename the CTPL section
  295. ;   as [pwb-.C]. This works, but slows down switching to .C files.
  296.  
  297.  
  298. ;   Select word
  299. selword    :=pword ->eof mword arg meta pword =>  \
  300.            :>eof mword pword arg meta pword
  301.  
  302. ;-- The core macro for CTPL
  303. ;   select the current word and execute it
  304. DoTpl      :=selword execute
  305.  
  306. ;   selection-mode safe DoTpl
  307. ;DoTpl     :=_pwbboxmode selword execute
  308.  
  309. ;-- simple 'pairs'
  310. parens     :="()" left
  311. subscript  :="[]" left
  312. angles     :="<>" left
  313. quotes     :="\"\"" left
  314.  
  315. ;-- messages
  316. notag      :=arg "No more tags" message
  317. nobrace    :=arg "Missing right brace" message
  318. nodefault  :=arg "No \"default:\" found" message
  319.  
  320. ;-- tag & utilities
  321. tag        :="/*%*/"
  322. stmt       :="/*%*/;"
  323.  
  324. seltag     :=arg right right right right right
  325. ;   selection-mode safe seltag
  326. ;seltag    :=_pwbboxmode arg right right right right right
  327.  
  328. ;   Tag movement - Move to and select the position to be filled in.
  329. ;mrec      - Move to and select previous tag
  330. ;prec      - Move to and select next tag
  331. mrec       :=cancel left  arg tag msearch ->f seltag => :>f notag
  332. prec       :=cancel right arg tag psearch ->f seltag => :>f notag
  333.  
  334. ;-- Utilities -- redefine to change indentation styles
  335. ;test      - condition in parentheses
  336. ;plist     - parameter list
  337. ;testbreak - type of break (if any) after a test
  338. test       :="( " tag " )"
  339. plist      :="( " tag " )"
  340. testbreak  :=addline
  341.  
  342. ;-- utilities for adding components of C constructs
  343. ;
  344. ;addline  - Add a line, with same indentation as this line
  345. ;addstmt  - Add a statement after this line
  346. ;addstmti - Add an indented statement after this line
  347. ;block    - Add a statement block after this line
  348. ;
  349. addline  :=cancel begline down linsert
  350. addstmt  :=addline tag mrec
  351. addstmti :=addline tab tag mrec
  352. block    :="{" addline "}" begline linsert tab tag down endline
  353.  
  354. ;-- function, prototype and utilities
  355. ;
  356. ;func    - Parameter list and body
  357. ;proto   - Semicolon-terminated parameter list
  358. ;main    - Alias of func
  359. ;additem - Add item to the current parameter list or 'for' control
  360. ;
  361. func     :=endline savecur plist addline block restcur prec
  362. proto    :=endline plist ";" mrec
  363. main     :=func
  364. additem  :=cancel left arg arg "[;:)}]" psearch ->   \
  365.            arg arg "[^ \t]" msearch right ", " tag right mrec
  366.  
  367. ;printf, fprintf, sprintf  - Handy templates
  368. ;
  369. printf   :=proto quotes tag "\\n"  mrec
  370. fprintf  :=proto "std" tag ", " quotes tag "\\n" begline prec
  371. sprintf  :=proto tag ", " tag ", " tag mrec mrec quotes tag  \
  372.            endline mrec mrec
  373.  
  374. ;-- conditional constructs
  375. ;
  376. ;if      - Add a condition and statement block
  377. ;else    - You usually use addelse, but this is still useful
  378. ;addelse - Add an else clause to the current if statement
  379. ;addelif - Add an else-if clause to the current if statement
  380. ;while   - While loop
  381. ;for     - For loop template. Use additem for comma-op items
  382. ;do      - Do  loop template
  383. ;queryop - "() ? : " template for the ternary operator
  384. ;
  385. if      :=endline savecur  test testbreak block  restcur prec
  386. else    :=testbreak block  mrec
  387. addelse :=cancel arg "}" psearch ->f testbreak "else" else => :>f nobrace
  388. addelif :=cancel arg "}" psearch ->f testbreak "else if" if => :>f nobrace
  389. while   :=if
  390. for     :=if stmt " " stmt " " tag  begline prec
  391. do      :=testbreak block " while" test endline ";" mrec
  392. queryop :=savecur test " ? " tag " : " tag restcur prec
  393.  
  394. _asm    :=testbreak block mrec
  395.  
  396. ;-- declarations
  397. ;
  398. enum    :=endline " " tag " { " tag " } " stmt begline prec
  399. typedef :=endline " " tag " " stmt begline prec
  400. struct  :=endline savecur " " tag testbreak block " " stmt restcur prec
  401. class   :=struct
  402.  
  403. ;-- switch statement and components
  404. ;   Use add-case to build the cases of the switch.
  405. ;   Use addbreak to terminate a statement section.
  406. ;
  407. ;case     - Colon-terminated placeholder
  408. ;addbreak - Insert a break statement after the current statement
  409. ;addcase  - Insert case just before the next or default case
  410. ;switch   - Condition, block, and default case.
  411. ;swiback  - By default case labels appear at the same indentation level
  412. ;           as the opening 'case' For indented case labels, define it
  413. ;           as 'swiback:='
  414. swiback :=backtab
  415. case    :=endline " " tag ":" mrec
  416. addbreak:=addstmt "break;"  begline
  417. addcase :=cancel arg arg "\\{default:\\!case\\}" psearch ->f   \
  418.           linsert "case" case => :>f nodefault
  419. switch  :=endline test testbreak block mrec right meta delete swiback   \
  420.           "default:" addstmti "break" mrec
  421.  
  422. ;-- preprocessor utilities
  423. ;inc     - #include <x>
  424. ;def     - #define x x
  425. ;pragma  - #pragma x( x )
  426. inc   :=begline "#" endline "lude <>"  left
  427. def   :=begline "#" endline "ine " tag " " tag  begline prec
  428. pragma:=begline "#" endline " " tag plist begline prec
  429.  
  430. ;   The OpenInclude macro opens an include file named in the next
  431. ;   #include directive. The macro demonstrates a technique using the
  432. ;   Lasttext function to pick up text from the file and modify it
  433. ;   without modifying the file or the clipboard.
  434. OpenInclude :=  \
  435.     up meta begline arg arg "^[ \t]*#[ \t]*include" psearch ->  \
  436.     arg arg "[<>\"]" psearch -> right savecur psearch ->        \
  437.     selcur lasttext begline "$INCLUDE:" openfile <n +>          \
  438.     lastselect openfile <
  439.  
  440. ;   Key Assignments
  441. mrec      :Alt+PgUp
  442. prec      :Alt+PgDn
  443. addcase   :Alt+F9
  444. addbreak  :Alt+F10
  445. addelse   :Shift+Ctrl+E
  446. addelif   :Shift+Ctrl+I
  447. additem   :Alt+,
  448. queryop   :Alt+/
  449. parens    :Ctrl+0
  450. subscript :Alt+]
  451. quotes    :alt+'
  452. angles    :Alt+>
  453. addstmt   :Ctrl+;
  454. addstmti  :Shift+Ctrl+:
  455. proto     :Shift+Ctrl+P
  456. func      :Shift+Ctrl+F
  457. dotpl     :Alt+T
  458.  
  459. ;-------------------
  460. [pwb-ckeys]
  461. ;   Initialize this section if you've switched to another type of file
  462. ;   and need to recover your CTPL keys.
  463. mrec :=cancel left  arg tag msearch ->f seltag => :>f notag
  464. prec :=cancel right arg tag psearch ->f seltag => :>f notag
  465. mrec        :Alt+PgUp
  466. prec        :Alt+PgDn
  467. addcase     :Alt+F9
  468. addbreak    :Alt+F10
  469. addelse     :Shift+Ctrl+E
  470. addelif     :Shift+Ctrl+I
  471. additem     :Alt+,
  472. queryop     :Alt+/
  473. parens      :Ctrl+0
  474. subscript   :Alt+]
  475. quotes      :alt+'
  476. angles      :Alt+>
  477. addstmt     :Ctrl+;
  478. addstmti    :Shift+Ctrl+:
  479. proto       :Shift+Ctrl+P
  480. func        :Shift+Ctrl+F
  481. dotpl       :Alt+T
  482.  
  483. ;----------------------------------------------------------------------
  484. [pwb-samples]
  485. ;   This section contains example macros from help.
  486. ;
  487.  
  488. ;   Run the program for current PWB project
  489. Run  :=arg "run" compile
  490.  
  491. ;   Debug the program for current PWB project
  492. Debug:=arg "debug" compile
  493.  
  494.  
  495. ;   Insert spaces to next tab stop.
  496. InsertTab := arg tab sinsert
  497.  
  498. ;   Indent a paragraph to the next tab stop:
  499. para_indent:=_pwbboxmode meta mpara down begline arg   \
  500.              meta ppara up begline tab insert
  501.  
  502. ;    Move the cursor to column one, then toggle between column one and
  503. ;    the first nonblank character on the line.
  504. ToggleBegline := left ->x meta :>x begline
  505.  
  506. ;   Put parts of current filename on the clipboard.
  507. Path2clip     := Arg Curfile Copy
  508. Name2clip     := Arg Curfilenam Copy
  509. Filename2clip := Arg Curfilenam Curfileext Copy
  510.  
  511. ;-------------------
  512. ;   Macro utilities
  513. ;   Macro writing and debugging tools, plus convenient shorthands
  514.  
  515. ;   Set True return value. Side effect: cancels active arguments
  516. True := cancel
  517.  
  518. ;   Set False return value. Side effect: turns off Meta
  519. False := meta +>off meta :>off meta
  520.  
  521. ;   The following macros test common conditions.
  522. ;
  523. ;   At beginning of line?
  524. bol? := savecur begline +>no True => :>no restcur False
  525.  
  526. ;   Any text at cursor?
  527. text? := right +>yes left False => :>yes left True
  528.  
  529. ;   Is the current line an empty line?
  530. empty? := meta begline endline ->yes False => :>yes True
  531.  
  532.  
  533. ;   Display the current macro return value on the status bar, then
  534. ;   reset return value. Use this macro when debugging loops and
  535. ;   conditional flow control.
  536. ? := +>t arg "FALSE" message => :>t arg "TRUE" message
  537.  
  538. ;   Refresh - force a full screen redraw
  539. ! := meta message
  540.  
  541.  
  542. ;   These two utilities make readable find/replace macros. For example,
  543. ;   use the phrase:
  544. ;       replace "<junk text>" with nothing
  545. ;   to delete <junk text> from the file.
  546. With    := newline
  547. Nothing := " " cdelete newline
  548.  
  549.  
  550. ;   Position the window so that the next tagged section of TOOLS.INI
  551. ;   starts at the top of the window.
  552. FindTag:=arg arg "^\\[[^\\]]+\\]" psearch ->none  \
  553.          arg setwindow => :>none arg "no tag" message
  554.  
  555. ;   Adjust each line continuation (backslash at the end of a line) so
  556. ;   that it appears in column 73.
  557. SlashJust:=savecur begfile arg arg replace    \
  558.            "^\\(.*[^ ]\\)  +\\\\$" newline    \
  559.            "\\(-70,1)  \\\\" newline restcur
  560.  
  561.  
  562. ;   Prompt for help topic to look up.
  563. QueryHelp := arg "Get Help On:" prompt ->no pwbhelp =>  \
  564.           :>no arg "Query Cancelled" message
  565.  
  566. ;-------------------
  567. ;   Iterations on the file.
  568. ;   All... - Macros that iterate over the file, one line at a time.
  569. ;   Act    - Define as the action to be performed on each line.
  570. Act :=
  571.  
  572. ;   Perform Act on all lines of the file, starting from the end.
  573. AllBackward := endfile :>s act up +>s
  574.  
  575. ;   Perform Act on all lines from start, including a page of blank lines
  576. ;   at the end of the file.
  577. AllForward  := begfile :>s act down +>s
  578.  
  579. ;   Perform Act on all lines from start, testing for end-of-file at each
  580. ;   step. Solves 'extra lines' problem of AllForward at the cost of
  581. ;   speed.
  582. AllForward2 := begfile savecur :>s restcur act   \
  583.                down savecur begline endfile +>s
  584.  
  585. ;-------------------
  586. ;   Perform Act at each occurrence of a regular expression in the file.
  587. Act :=
  588.  
  589. ;   Regular expression to match (example is for blank line)
  590. RE   := "^$"
  591.  
  592. ;   Perform Act at each occurrence of RE.
  593. For1 := begfile :>s arg arg RE psearch -> act =>s
  594.  
  595. ;   Like For1, but iterates much faster with the restriction that Act
  596. ;   cannot perform a search.
  597. For2 := begfile arg arg RE :>s psearch -> act =>s
  598.  
  599. ;-------------------
  600. ;GetMac - Load a separate file of macros or assignments.
  601. ;
  602. ;Usage: Arg 'file' getMac where <file> is the base name of
  603. ;       a file in the INIT directory
  604. ;
  605. GetMac := cancel lasttext begline "$INIT:" endline ".MAC"  \
  606.           setfile <n +>Ok lasttext begline               \
  607.           "Can't find \"" endline "\"" message =>          \
  608.        :>Ok begfile arg endfile assign ->  arg refresh
  609.  
  610. ;----------------------------------------------------------------------
  611. [pwb-tutor]
  612. ;   PWB Tutorial macro examples
  613. CloseWindows := :>Loop Openfile -> Meta Window Window =>Loop
  614. CloseWindows : SHIFT+CTRL+W
  615.  
  616. LineComment := "//  "
  617. RevHead     := "** Revision History **"
  618. RevComment  :=  \
  619.   Arg Arg "Start" Mark                 \
  620.   Begfile Arg RevHead Psearch +>Found  \
  621.   Linsert LineComment RevHead          \
  622. :>Found  \
  623.   Down Linsert Begline LineComment Curdate " ("    \
  624.   Arg "Initials" Prompt ->Quit Paste Endline ") "  \
  625.   Arg "Comment"  Prompt ->Quit Paste =>End         \
  626. :>Quit Meta Ldelete  \
  627. :>End Arg "Start" Mark
  628. RevComment:CTRL+H
  629.  
  630.  
  631. ;----------------------------------------------------------------------
  632. [pwb-abbr]
  633. ;   Abbreviations - Define and expand abbreviations.
  634.  
  635. ;  Select the current word
  636. SelWord:= pword ->eof mword arg meta pword =>  \
  637.                 :>eof mword pword arg meta pword
  638.  
  639. ;  Delete the current word and execute it
  640. Expand := selword lasttext cancel lastselect meta sdelete lasttext execute
  641. Expand :Alt+T
  642.  
  643. ;  Simple text expansion
  644. prog   := "program"
  645. ex     := "example"
  646.  
  647. ;  Expand 'cmd' once to get 'command', Expand twice to get 'command line'
  648. cmd    := "command"
  649. command:= "command line"
  650.  
  651. ;   Expand to the contents of the file HEADER.TPL in the INIT
  652. ;   directory--a good technique for large boilerplate text.
  653. Header := arg arg "$INIT:header.TPL" paste
  654.  
  655.  
  656. [end]
  657.