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