COMMENT - Written 01.27.96 SZ Borland Corporation

INTRODUCTION

This archive contains an add-on module for Codewright which provides
functions that can let you easily comment and uncomment source code
lines with the stroke of a key. Support is provided for the following
language types: .C, .CPP, .PAS, .BAS, .ASM, .FOR, .COB, .ADA, .JAVA,
.PRG, and .SC. Other types may easily be added.

INSTALLATION

Create a COMMENT directory below your main Codewright directory, and
extract the files there (be sure to recreate the archive's directory
structure). Launch Codewright, and select Customize|Libraries. Click on Add.
Go to the COMMENT\WIN32 directory and open COMMENT.DLL. Click Ok on the Libraries
dialog.

Now, you'll want to add a couple keymappings, one to comment a line of
code, and one to remove the comment. Either use the Tools | 
Customize 'Keyboard' folder to map to the functions "CommentLine"
and "UnCommentLine", or add something similar to the following in the
[KmapAssign] section of your CWRIGHT.INI file:

KmapAssign='<Alt-V>' 'UnCommentLine'
KmapAssign='<Alt-C>' 'CommentLine'

USAGE

With one of the supported file types open, just press the appropriate
key to comment the line of code out, or to remove the comment.

DETAILS

COMMENT.DLL exports the following functions which you can use.

        CommentLine() - Determines the name of the function to call
                        to actually comment the line out, based on
                        the extension of the document, for example
                        _ext_CommentLine().

        UnCommentLine() - Does the same as CommentLine(), but calls
                          _ext_UnCommentLine().

        CommentLineWith() - Takes two parameters. The first is the
                            text to place at the beginning of the source
                            line, the second is the text to place at the
                            end. The second parameter can be nil if there
                            is no end comment sequence, as in .ASM files.
                            This function is ultimately called by the
                            _ext_CommentLine() functions.

        UnCommentLineWith() - Takes two parameters. The first is the
                              text to remove from the beginning of the
                              line, the second is the text to remove
                              from the end. The second can be nil. Both
                              must be regular expressions.

        AddCommentDelimeters() - Add a set of comment delimeters to the
                                 hash table that contains them. The first
                                 parameter is the extension to which these
                                 apply. The second and third are strings
                                 which contain the parameters required
                                 for CommentLineWith(), the fourth and
                                 fifth are parameters for
                                 UnCommentLineWith().

UNSUPPORTED LANGUAGES

If there is no built-in support for your language, you can add support
easily. Just add a line to your CWRIGHT.INI file, under the [Editor]
section, like this:

AddCommentDelimeters="ext","start1","end1","start2","end2"

"ext" is the extension this should apply to, "start1" and "end1 are the
strings to add to the beginning and end of the line to comment it out,
and "start2" and "end2" are the parameters required to remove the comment,
and are passed to UnCommentLineWith(). See the next section for details
on the format of these two parameters.

PARAMETERS FOR UnCommentLineWith()

The two parameters for UnCommentLineWith must be in regular expression
format to work correctly. For example, your comments begin with "(*" and
end with "*)" (like old-style pascal comments). You would need to call
UnCommentLineWith like so:

        UnCommentLineWith("\(\*", "\*\)");

Basically, just escape characters that have special meaning to regular
expression searches.

INCLUDED FILES

        README.TXT        - This file
        COMMENT.C         - The source code
        COMMENT.RC        - A dummy resource file
        COMMENT.          - Microsoft makefile
        COMMENT.MAK       - Borland makefile
        COMMENT.DEF - 32-bit .DEF file
        COMMENT.DLL - 32-bit .DLL file

FEEDBACK AND SUPPORT

Send e-mail to CodeSupport@Borland.com, or call 503.207.1190.
