rem : safely comments out imbedded code examples

The situation is common: you want to write long comments to document your code properly :) or to comment out a portion of obsolete code quickly but neatly. rem is a filter which gathers together all of the commenting conventions you are likely to need, and provides one-stop commenting (and eventually de-commenting) according to what you are working on.

Using jstar screen dumps, it would work like this. You type in your documentation, with
wordwrap and other niceties in place, then hi-light the comments and send them through
the rem filter:



The filter then neatly comments out your text (better than cap3-downarrow over-n-over):



Okay, you could do that through sed or awk or perl , substituting different types of
regex for the different types of code you were editing... what rem does is not rocket science, it simply enables you to figure out the regexes =once= and offer them as memorable mneuonic switches.


USAGE
rem {-switches}

Intended to act on STDIN and STDOUT from within a word processor
(like =joe=) which allows a hilit block to be filtered through
a shell command. Good for imbedding shell output in your code.

e.g. ^K/
Command to filter block through (^C to abort): ls -l | rem -list

SWITCHES
-all pad all lines, even if empty
-c[har] [='#'] use the quoted comment character
-hist output gleaned from history dump; remove leading line #s
-in[dent]=n add n[=4] spaces before the line
-out flag as program output
-pad add n[=2] spaces after the comment char
-po[e]m for imbedding poetry in source code
-pwd=bin as above, showing pwd
-shell flag commandline w/ fake prompt
-su flag su-issued shell command
-man runs this help section (|txt2man) into a manpage

ENVIRONMENT

Works well within joe/jstar editor. It's intended that you use this
with the ^K/ (block filter) command.

BUGS
Lots. This is version $VERSION.

AUTHOR
rem is part of the YUCC suite by J.F. Cuff

__TODO__
TODO
-expand preprocess |expand to convert output containing tabs
-ls=/dir do a listing of /dir
-do='cmd' run cmd, prepend to comment; then filter
-un remove a single level of commenting



This concept needs a bit more work. There are lots of feeping creaturism available for implementation. The next version should implement basic uncommenting of a block previously commented copy. Currently there is only one flavour of comment directly supported (-c for c-style # comments) ... or two, if you count the -poem directive.  This filter should implement all sorts of commenting environments via switches (e.g. rem -html; rem -smb; unrem -java). REM's goal is simple: better code documentation (and poetry) through easier commenting.

The creation of a Yetanother Universal Commenting Convention is the subject of a separate to do note.

The code for the current rem.pl is here. (You need to chmod it executable before it runs.)

        rem : safely comments out imbedded code examples