home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
editors
/
amac41.arj
/
COM001.QM
< prev
next >
Wrap
Text File
|
1991-08-26
|
37KB
|
744 lines
* COM001.QM
* Written By Tom Hogshead
* [ See COMTxx.QM For Use ]
* 8/8/91
* Key Subfile Description
* ===== ========= =====================================================
* ^(cursordown)
* --Comment Or Un-Comment Line Or Block With * In Col 1,
* Blank Lines NOT Commented,
* Pauses To Mark Block If Not Marked
* (John Goodman And Tom Hogshead, Authors)
* @(3) --Comment Or Un-Comment Line Or Block With * In Col 1,
* Blank Lines NOT Commented
* (John Goodman And Tom Hogshead, Authors)
* @(8) --Comment Or Un-Comment Line Or Block With * In Col 1,
* Blank Lines Are Commented,
* (John Goodman And Tom Hogshead, Authors)
* @(2) --Comment Or Un-comment With "*»" In Col 1,
* Blank Lines NOT Commented,
*» (like this)
* @(1) --Add/Delete '*-- ' In Front Of Commenting Line,
*-- (like this)
* @(4) --Center Macro Comment * -- <Comment> --*
* @(7) --Remove Macro Comment * -- <Comment> --*
* @(F1) --Comment Non-macro Portion Of File
* ^(F1_) --Un-comment Non-macro Portion Of File
* @(F5) --Original Commenting Macro (John Goodman, Author)
* @(5) --Original Un-commenting Macro (John Goodman, Author)
* #(F5__) --Revised Original Goodman Un-commenting,
* Checks Before Un-commenting
* @(F2) --Comment Paragraph Or Block
* #(F2__) --Builds A "Comment Box" For C Programmers
* (Tim Farley, Author)
* @(F3) --Comment Whole File
* ^(F3_) --Un-comment Whole File
* #(F3__) --Center C Program Comment (Richard Blackburn, Author)
*
* {e:\up\COMT*}--Return To COMTxx.QM
*
*-- eoi
*
* -------------------------------------------------------------------
* ^(cursordown) Comment or un-comment line or block with <* comment>,
* Blank Lines NOT Commented,
* Pauses To Mark Block If Not Marked
* (Tom Hogshead and John Goodman authors)
* -------------------------------------------------------------------
* This macro performs the same commenting or uncommenting functions as
* @8 (commenting macro written by John Goodman and me) except this
* version does *not* comment blank lines and pauses to allow the user
* to select lines to be commented or uncommented if they are not
* already marked. Blocks do not have to be marked before executing
* macro, and may be a line, character or column block, open or closed.
* Blank lines are not commented, but can be by changing ASCII #32 to
* any other ASCII character. This macro will fit on one line of QConfig
* by changing "Label" to "L" in the QMAC compiled txtfile as shown at
* the end of this macro.
^CursorDown MacroBegin
CursorRight * Needed for single line blocks
GotoBlockBeg * Try going to block begin
JTrue A: * True only if both ends marked |
MarkLine * Set line block marker |
GotoBlockBeg * Try going to block begin again |
JTrue OK: * True if one end was marked |
Pause * Nothing marked, let user mark it |
Jump B: * Jump to finish block |f
A: * Here if both ends originally marked |
GotoBlockEnd * Go to end of block |
UnmarkBlock * Remove block completely |
MarkLine * Start Line block |
PrevPosition * Return to original begin of block |
B: * |
MarkLine * Finish marking block |
GotoBlockBeg * Make sure we're at the beginning |
OK: * Now have completed line block |
* ----------------- Check If Block Already Commented ----------------*
BegLine * Go to col 1 |f
CursorRight * Position cursor for find
Find "*" Return * Test if line is already commented
"LB" Return *(assumes all block commented or not)
Jfalse COMMENT: * If no star in col 1, must comment
* ------------------------ Uncomment Block -------------------------*
UNCOMMENT: *ELSE
ShiftLeft ShiftLeft * Col 1 has star, uncomment block
Jump END: * End macro
* -------------------------- Comment Block --------------------------*
COMMENT:
ShiftRight ShiftRight * Shift all lines right twice
BegLine * Move cursor to col 1
GotoBlockEnd * Move to 1st char of last line
MarkColumn * Mark 1st char, column block
PrevPosition * Return to block begin col 2
begline * Needed for single-line case
markcolumn * Close column block to go to at end
FillBlock * FillBlock
#32 Return * with space #32 (Change #32 to any ASCII
* character to comment blank lines)
FindReplace * Replace
#32 Return * space
"*" Return * with "*"
"LN" Return * Local, No Prompt Replace
END: *
GoToBlockEnd * Move to end of block
begline *
UnmarkBlock * Unmark the block
CursorDown * Go to next line
*
* 46 bytes Sun 03-31-1991 01:51:24 (TH/JG @8)
* 58 bytes Tue 04-30-1991 19:06:16 (TH/JG @3 not comment blank lines)
* 66 bytes Mon 05-27-1991 18:55:32 (TH sent to JG as @7 |a)
* 65 bytes Tue 07-09-1991 14:49:01 (TH ^cursordown, line blocks only, |b)
* 78 bytes Tue 07-09-1991 15:09:58 (TH ^cursordown, col/char blocks OK, |c)
* 74 bytes Tue 07-09-1991 23:15:04 (TH ^cursordown, shortened/sent to JG|d)
* 74 bytes Thu 07-11-1991 23:09:20 (TH ^CursorDown, moved begline up |e)
* 71 bytes Tue 07-23-1991 20:49:09 (JG @1, Replaced all above OK: label |f)
* 71 bytes Tue 07-23-1991 20:49:09 (JG/TH ^cursordown, shortened |f)
* QConfig Version of ^CursorDown Above
* -------------------------------------
* Changing "Label" to "L" the following QMAC compiled version of
* ^cursordown will fit on one line of QConfig.dat using 479 of 512
* characters:
* ^cursordown MacroBegin CursorRight GotoBlockBeg JTrue L0: MarkLine
* GotoBlockBeg JTrue L1: Pause Jump L2: L0: GotoBlockEnd
* UnmarkBlock MarkLine PrevPosition L2: MarkLine GotoBlockBeg L1:
* BegLine CursorRight Find "*" Return "LB" Return JFalse L3:
* ShiftLeft ShiftLeft Jump L4: L3: ShiftRight ShiftRight BegLine
* GotoBlockEnd MarkColumn PrevPosition BegLine MarkColumn FillBlock
* " " Return FindReplace " " Return "*" Return "LN" Return L4:
* GotoBlockEnd BegLine UnmarkBlock CursorDown
* *
* * 71 bytes Tue 07-23-1991 20:49:09 (JG/TH ^cursordown)
*
* -------------------------------------------------------------------
* @(3) Comment or un-comment <* comment>, Blank lines *not* commented
* (Tom Hogshead and John Goodman authors)
* -------------------------------------------------------------------
* Does *not* comment blank lines. Change #32 to any ASCII character
* to comment blank lines. This is an alternate version of @8.
@3 MacroBegin
* ------- Check and finish marking line or block if not marked -------*
CursorRight * Needed for single-line blocks
GotoBlockBeg * Try going to block beg, retain pos.
JTrue BLK: * Determine if a completed block
DropAnchor * If not, DropAnchor will finish it
* or mark current line if none started
GotoBlockBeg * Go to block beg to retain position
BLK: GotoBlockEnd * Start at the end
MarkLine * Mark line to close block
PrevPosition * Return to block begin
* ----------------- Check if block already commented -----------------*
BegLine * Go to bol in case line block
CursorRight * Move to column 2
Find "*" Return * See if line is already commented
"LB" Return *(assumes all block commented or not)
Jfalse COMMENT: * If no star in col 1, must comment
* ------------------------ un-comment block ------------------------*
UNCOMMENT: *ELSE
ShiftLeft ShiftLeft * Col 1 has star, un-comment block
Jump END: * Go to end macro
* -------------------------- Comment block --------------------------*
COMMENT:
ShiftRight ShiftRight * Shift all lines to right twice
BegLine * Move cursor to column 1
GotoBlockEnd * Move to 1st char of last line
MarkColumn * Mark 1st character column
PrevPosition * Return to first line
BegLine * Needed for single-line blocks
* FillBlock '*' Return * Fill 1st column with '*'
FillBlock * FillBlock
#32 Return * with space (Change #32 to any ASCII
* character to comment blank lines)
FindReplace * Replace
#32 Return * space
"*" Return * with "*"
"LN" Return * Local, No Prompt Replace
END: *
UnmarkBlock * Unmark the block
CursorDown * Go to next line
*
* 46 bytes Sun 03-31-1991 01:51:24 (JG/TH @8)
* 58 bytes Tue 04-30-1991 19:06:16 (TH/JG @3, not comment blank lines)
*
* ----------------------------------------------------------------------
* @(4) Center macro comment <* -- comment --*>
* ----------------------------------------------------------------------
*
* I have modified #F3, written by Richard Blackburn of SemWare at the
* request of Bob Denhnhardt to comment c programs, to make and center
* macro comment lines. Type comment beginning in column 1. Press @4 to
* make it a comment line highlighted with dashes. This line was made
* typing "start", then @4:
*
* ------------------------------ start ------------------------------*
*
@4 MacroBegin * Start Macro
UnMarkBlock * make sure no blocks marked
* ---------------------------- set margin ----------------------------*
SetRmargin "72" Return ** set right margin to 72
* -------------------------- center comment --------------------------*
BegLine * goto start of line
DropAnchor * ---
DropAnchor * --- to save our place
CenterLine * center the line
* -------------------------- complete line --------------------------*
GotoBlockBeg * goto begin of block
UnMarkBlock * un mark it
CursorLeft * cursor left twice
CursorLeft *
JFalse END * if not goto end line to long
MarkColumn * mark column
BegLine * goto beginning of line
DelCh * delete char incase in insert mode
DelCh ** delete char incase in insert mode
"* " ** put a "*_space" at start
MarkColumn * mark the column
FillBlock "-" Return ** fill with -
Copy * copy to scrap buffer
EndLine * goto end of line
CursorRight * space over one
Paste EndLine "*" ** paste * at eol
* ------------------------ move to next line ------------------------*
END: BegLine * goto start of comment line
UnMarkBlock * un mark it
CursorDown ** and move down to next line
*
* 45 bytes Fri 03-29-1991 09:30:22
*
* -------------------------------------------------------------------
* @(8) Comment or un-comment line or block with <* comment> in col 1,
* John Goodman and Tom Hogshead, authors
* -------------------------------------------------------------------
* This macro will add (or delete) comments in front of dBase lines or
* any text or macfile lines that are either a single unmarked line, a
* character, column, or line block that has been opened and/or opened
* and closed by adding (or deleting) an asterisk and single space in
* column 1. Blank lines are commented.
@8 MacroBegin
* ------- Check and finish marking line or block if not marked -------*
CursorRight * Needed for single-line blocks
GotoBlockBeg * Try going to block beg, retain pos.
JTrue BLK: * Determine if a completed block
DropAnchor * If not, DropAnchor will finish it
* or mark current line if none started
GotoBlockBeg * Go to block beg to retain position
BLK: GotoBlockEnd * Start at the end
MarkLine * Mark line to close block
PrevPosition * Return to block begin
* * ----------------- Check if block already commented -----------------*
BegLine * Go to bol in case line block
CursorRight * Move to column 2
Find "*" Return * See if line is already commented
"LB" Return *(assumes all block commented or not)
Jfalse COMMENT: * If no star in col 1, must comment
* ------------------------ un-comment block ------------------------*
UNCOMMENT: *ELSE
ShiftLeft ShiftLeft * Col 1 has star, un-comment block
Jump END: * Go to end macro
* -------------------------- Comment block --------------------------*
COMMENT:
ShiftRight ShiftRight * Shift all lines to right twice
BegLine * Move cursor to column 1
GotoBlockEnd * Move to 1st char of last line
MarkColumn * Mark 1st character column
PrevPosition * Return to first line
BegLine * Needed for single-line blocks
FillBlock '*' Return * Fill 1st column with '*'
END: *
UnmarkBlock * Unmark the block
CursorDown * Go to next line
* *
* * 46 bytes Sun 03-31-1991 01:51:24 (TH/JG @8)
*
*» -------------------------------------------------------------------
*» @(2) Comment or un-comment <*» comment> (no blank lines), 64 bytes
*» -------------------------------------------------------------------
*» Does *not* comment blank lines. Change #32 to any ASCII character
*» to comment blank lines. Replace #175 "»" with any character for
*» alternate commenting second characters.
@2 MacroBegin
* ------- Check and finish marking line or block if not marked -------*
CursorRight * Needed for single-line blocks
GotoBlockBeg * Try going to block beg, retain pos.
JTrue BLK: * Determine if a completed block
DropAnchor * If not, DropAnchor will finish it
* or mark current line if none started
GotoBlockBeg * Go to block beg to retain position
BLK: GotoBlockEnd * Start at the end
MarkLine * Mark line to close block
PrevPosition * Return to block begin
* ----------------- Check if block already commented -----------------*
BegLine * Go to bol in case line block
CursorRight CursorRight * Move to column 3
Find "*" #175 Return * See if line is already commented
* ( replace #175 with any character
* for alternate second character)
"LB" Return * (assumes all block commented or not)
Jfalse COMMENT: * If no "*»" in col 1, must comment
* ------------------------ un-comment block ------------------------*
UNCOMMENT: *ELSE
ShiftLeft ShiftLeft * Col 1 has "*»", remove it
ShiftLeft * Get rid of blank space
Jump END: * End macro
* -------------------------- Comment block --------------------------*
COMMENT:
ShiftRight ShiftRight * Shift all lines to right twice
BegLine * Move cursor to column 1
GotoBlockEnd * Move to 1st char of last line
MarkColumn * Mark 1st character column
PrevPosition * Return to first line
BegLine * Needed for single-line blocks
FillBlock * FillBlock with space #32
#32 Return * (Change #32 to any ASCII character
* to comment blank lines)
FindReplace * Replace
#32 Return * space
"*" #175 Return * with "*»"
"LN" Return * Local, No Prompt Replace
END: *
UnmarkBlock * Unmark the block
CursorDown * Go to next line
*
* 64 bytes Tue 04-30-1991 16:33:59
*
* ----------------------------------------------------------------------
* @(1) Add/Delete '*-- ' In Front Of Commenting Line, Like
*-- this
* ----------------------------------------------------------------------
*-- Type comment. This macro then does this. If line is already
*-- commented, the macro removes the "star" + "-- ".
@1 macrobegin
unmarkblock *
markline *
begline *
shiftright *
Find "*-" return * Test if line already commented
"L" return *
jfalse ADD: * If not, we need to add '*-- '
delch delch delch delch *ELSE delete 4 commenting characters + space
shiftleft *
jump END: * End macro
ADD: *
begline *
insertline * InsertLine for Insert set ON/OFF
"*--" * Insert commenting characters,
joinline *
END: *
begline * Re-position
unmarkblock *
*
* 39 bytes Sun 06-23-1991 00:43:28 (TH)
*-- test
*
* ----------------------------------------------------------------------
* @(7) Remove macro comment
* ----------------------------------------------------------------------
* This macro removes comments made with @4, like <* -- comment --*>
* Comment must not contain "---", and must contain a "* -" in col 1.
* First character in comment must be in defaultwordset, no * @^ etc.
* Insert must be ON.
@7 MacroBegin
UnMarkBlock * Unmark
DefaultWordSet * Set default to find first word
BegLine * Move to begin of comment line
DropAnchor * Mark block begin
WordRight CursorLeft *ELSE move to space before comment
DropAnchor * Mark block begin
Find "* -" return "LB" return * Check if comment centered
jfalse end: * End macro if not centered
DeleteBlock * Delete left "* --.." to comment
MarkLine * MarkLine
Find "---" Return "L" Return * Find first dashes to rt of comment |
jfalse end: * If no dashes, end macro
UnMarkBlock MarkColumn *ELSE Mark first dash right of comment
EndLine DeleteBlock * Delete all right "---*"
end:
unmarkblock * Unmark if marked
BegLine * Back to comment begin for edit
*
* 47 bytes Wed 04-17-1991 00:28:25
* 49 bytes Tue 08-06-1991 12:41:36 (TH @7, comment cannot have '---')
*
* ----------------------------------------------
* @(F1) Comment non-macro portion of file
* ----------------------------------------------
*
@F1 MacroBegin
Begfile InsertLine * Insert temp line in case macro
START: * starts on line 1
MarkLine *
Find " " "macrob" Return "I" Return * Find start of macro
Jtrue HAS_MACROB: * If this para is a macro, go
* mark non-macro lines
EndPara *ELSE para is not a macro and
* go to end of para
Jump SHIFT: * Go shift it
HAS_MACROB: *
CursorUp MarkLine * Move up one line off macro
* and mark all non-macro lines
SHIFT:
ShiftRight ShiftRight * Shift block right
BegLine * Move cursor to column 1
GotoBlockBeg * Move to 1st char of first line
MarkColumn * Mark 1st character column
PrevPosition * Return to last line
BegLine * Needed for single-line blocks
FillBlock '*' Return * Fill 1st column with '*'
UnMarkBlock * Unmark non-macro block
EndPara NextPara * Move to para after macro
Jtrue START: *ELSE at eof
UnMarkBlock * Unmark last non-macro block
BegFile DelLine * Go to tof, delete temp line
*
* 55 bytes Wed 03-27-1991 08:26:36 (TH @F1)
*
* ----------------------------------------------
* @(5) un-comment non-macro portion of file
* ----------------------------------------------
*
@5 MacroBegin
Begfile InsertLine *
START: *
MarkLine *
Find " " "macrob" Return "I" Return * Find start of macro
Jtrue HAS_MACROB: * If this para is a macro, go
* mark non-macro lines
EndPara *ELSE para is not a macro and
* go to end of para
Jump SHIFT: * Go shift it
HAS_MACROB: *
CursorUp MarkLine * Move up one line off macro
* and mark all non-macro lines
SHIFT:
ShiftLeft ShiftLeft * Shift block left, rem. cmnts.
UnMarkBlock * Unmark non-macro block
EndPara NextPara * Move to para after macro
Jtrue START: *ELSE at eof
UnMarkBlock * Unmark last non-macro block
BegFile DelLine * Go to tof, delete temp line
*
* 46 bytes Wed 03-27-1991 08:26:56
*
* ----------------------------------------------------------------------
* @(F2) Comment paragraph or block
* ----------------------------------------------------------------------
*
* @F2 Places an asterisk and space in front of block that IS a
* paragraph and also in front of any paragraph that is NOT marked
* as a block from the cursor to the end of the paragraph.
*
* To run, first either mark a paragraph as a block or position the
* cursor in column 1. Press Alt and F2 at the same time, and an asterisk
* and a space are placed in column 1 in front of the block, or the
* paragraph, from the cursor to the end of the paragraph. Remember, a
* paragraph ends at the next blank line. Insert must ON.
*
@F2 Macrobegin
Gotoblockbeg * Go to block begin
NEXT: *
Endline Begline * End if line blank
Jfalse END: * If line blank, go to end
"* " * Put asterisk space in col 1
Cursordown * Move down to next line
Jump NEXT: * Cycle until done
END: *
*
* 18 bytes Mon 08-20-1990 22:19:35
*
* ----------------------------------------------
* @(F3) Comment whole file
* ----------------------------------------------
*
@F3 MacroBegin *
UnmarkBlock * Unmark
Begfile MarkLine * Mark bof
EndFile MarkLine * Mark eof
ShiftRight ShiftRight * Shift all lines to right
BegLine * Move cursor to col 1
UnmarkBlock * Unmark
MarkColumn * Mark 1st character column
BegFile
FillBlock '*' Return * Fill 1st column with '*'
UnmarkBlock
*
* 20 bytes Tue 03-26-1991 14:57:37
*
* ----------------------------------------------
* ^(F3_) un-comment whole file
* ----------------------------------------------
*
^F3 MacroBegin
UnmarkBlock * Unmark
EndFile MarkLine * Mark eof
Begfile MarkLine * Mark bof
ShiftLeft ShiftLeft * Remove comments in column 1 and 2
UnmarkBlock * Unmark
*
* 12 bytes Tue 03-26-1991 14:57:43
* ======================================================================
* Date: 03-28-91 (12:29) Number: 3716 SemWare Support BBS
* To: BOB DEHNHARDT Refer#: 3715
* From: RICHARD BLACKBURN Read: YES
* Subj: Macro Help! Conf: (21) ILink
* ----------------------------------------------------------------------
*
* ╒══>Quoting BOB from Date: 03-26-91 (10:36)
* │
* │1. Center the text I just typed in
* │2. Go to the beginning of the line, turn insert
* │off, and type a slash "/"
* │3. Type astericks (asterixes? stars.) up to one
* │space before my centered
* │4. Jump to one space after the centered text, and
* │continue entering stars until column 78
* │5. Go to the beginning of the next line, with insert
* │turned back on
* ╘══════════════════════════════════════════════════
*
*
* ----------------------------------------------------------------------
* #(F3__) Center c program comment, Richard Blackburn, author
* ----------------------------------------------------------------------
* Here is a macro that will center a line and put "*'s" around your text.
* It will not change your Insert status.
*
#f3 MacroBegin ** Start Macro (key ^1)
UnMarkBlock * make sure no blocks marked
BegLine * goto start of line
DropAnchor * ---
DropAnchor * --- to save our place
CenterLine * center the line
GotoBlockBeg * goto begin of block
UnMarkBlock * un mark it
CursorLeft * cursor left twice
CursorLeft *
JFalse end * if not goto end line to long
MarkColumn * mark column
BegLine * goto beginning of line
DelCh * delete char incase in insert mode
"/" * put a / at start
MarkColumn * mark the column
FillBlock "*" Return * fill with *
Copy * copy to scrap buffer
EndLine * goto end of line
CursorRight * space over one
Paste * paste the * in here also
UnMarkBlock * un mark the block
end: BegLine * goto start of line
AddLine * and add a line
*
* 33 bytes Fri 03-29-1991 07:43:59 (added TH)
*
* This will do this
*
* /************************* This will do this *************************
* Leaving the cursor at the start of the next line.
* Richard Blackburn
* SemWare Technical Support
* Written Thu 03-28-1991 at 12:22:39
*
* ----------------------------------------------------------------------
* @(F5) ORIGINAL commenting macro by John Goodman
* ----------------------------------------------------------------------
*
@F5 MacroBegin
* ------- Check and finish marking line or block if not marked -------*
CursorRight * Needed for single-line blocks
GotoBlockBeg * Try going to block beg, retain pos.
JTrue BLK: * Determine if a completed block
DropAnchor * If not, DropAnchor will finish it
* or mark current line if none started
GotoBlockBeg * Go to block beg to retain position
BLK: GotoBlockEnd * Start at the end
MarkLine * Mark first line
PrevPosition * Return to beg of where block was
* -------------------------- comment block --------------------------*
COMMENT:
ShiftRight ShiftRight * Shift all lines to right
BegLine * Move cursor to column 1
GotoBlockEnd * Move to 1st char of last line
MarkColumn * Mark 1st character column
PrevPosition * Return to first line
BegLine * Needed for single-line blocks
FillBlock '*' Return * Fill 1st column with '*'
UnmarkBlock * Unmark the block
CursorDown * Go to next line
*
* 27 bytes Thu 04-18-1991 22:56:02
*
* ----------------------------------------------------------------------
* ^(F5_) ORIGINAL un-commenting macro by John Goodman
* ----------------------------------------------------------------------
* un-comments even if *not commented
^F5 MacroBegin
* ------- Check and finish marking line or block if not marked -------*
CursorRight * Needed for single-line blocks
GotoBlockBeg * Try going to block beg, retain pos.
JTrue BLK: * Determine if a completed block
DropAnchor * If not, DropAnchor will finish it
* or mark current line if none started
GotoBlockBeg * Go to block beg to retain position
BLK: GotoBlockEnd * Start at the end
MarkLine * Mark first line
PrevPosition * Return to beg of where block was
* ------------------------ un-comment block --------------------------*
UNCOMMENT:
ShiftLeft ShiftLeft * Shift all lines to right
UnmarkBlock * Unmark the block
CursorDown * Go to next line
*
* 18 bytes Thu 04-18-1991 23:23:21
*
* ------------------------------------------------------------------------
* #(F5__) Revised original Goodman un-commenting, checks before un-commenting
* ------------------------------------------------------------------------
*
#F5 MacroBegin
* ------- Check and finish marking line or block if not marked -------*
CursorRight * Needed for single-line blocks
GotoBlockBeg * Try going to block beg, retain pos.
JTrue BLK: * Determine if a completed block
DropAnchor * If not, DropAnchor will finish it
* or mark current line if none started
GotoBlockBeg * Go to block beg to retain position
BLK: GotoBlockEnd * Start at the end
MarkLine * Mark first line
PrevPosition * Return to beg of where block was
* ----------------- Check if block already commented -----------------*
BegLine * Go to bol in case line block
CursorRight * CursorRight * Move to column 2
Find "*" Return * See if line is already commented
"LB" Return *(assumes all block commented or not)
Jfalse END: * If no star, must comment
* ---------------------------- un-comment ----------------------------*
UNCOMMENT: *ELSE
ShiftLeft ShiftLeft * Line has star, un-comment block
END: *
UnmarkBlock * Unmark the block
CursorDown * Go to next line
*
* 32 bytes Thu 04-18-1991 23:18:47
*
* ----------------------------------------------------------------------
* #(F2__) Builds a "comment box" for C programmers, Tim Farley, author
* ----------------------------------------------------------------------
*
* =========================================================================
* Date: 04-18-91 (10:02) Number: 230 SemWare Support BBS
* To: TOM HOGSHEAD Refer#: 229
* From: TIM FARLEY Read: NO
* Subj: COMMENTS ON @7 Conf: 3 Macros
* ------------------------------------------------------------------------
* TH> Very clever using FillBlock to fill a column 1 column block with dummy
* TH> character #224 and then replacing #224 with user input text. In all
* TH> cases I could think of it works perfectly - can't stump it!
*
* Another neat trick I like to use FillBlock for, is to make
* "boxes" of a single character.
*
* For instance, if you want to make a large box of asterisks, just
* mark a column block of the appropriate size and shape, do:
*
* FillBlock "*" Return
*
* Then do some appropriate cursor commands to move "in" one column
* in each direction from the edges of the block, mark again, and
* do:
*
* FillBlock " " Return
*
* Voila! A box of asterisks with space in the middle.
*
* With a few frills for "C", the complete macro looks like this:
*
*
* Builds a "comment box" for C programmers.
*
* The box starts on the left at the current indent level, and
* extends over to column 78 on the right.
*
* Assumes there is nothing to the right of the cursor on the current
* line at start. To handle that case, increase the number of SplitLines
* in line 2 of the macro.
*
#F2 MacroBegin
"/*" SplitLine 8 * start "C" comment
CursorDown CursorLeft * go to upper left of box
UnmarkBlock MarkColumn * start marking
GotoColumn "78" Return * extend box
CursorDown 6
MarkColumn * close mark
FillBlock "*" Return * and fill with *'s
CursorUp CursorLeft * move in one on lower right
GotoBlockBeg PrevPosition * remember old beginning
UnmarkBlock MarkColumn * start marking new block
PrevPosition * back to beginning
CursorDown CursorRight * move in one on upper left
MarkColumn * close mark
FillBlock " " Return * and fill with spaces
UnmarkBlock
CursorDown 6 CursorLeft "*/" * close "C" comment
CursorUp 5 * and move to spot to start
CursorRight * typing inside the block
* --Tim Farley