You are on page 1of 342

Codewright Programmers Editor

8VHUV*XLGH

Part No. 000-3936

Copyright 1992-1996 Premia Corporation. All rights reserved. The following copyright message is required due to the inclusion of CTL3D.DLL with our product: Portions Microsoft Corporation, 1985-1995. All rights reserved.

Publication History
October, 1991 February, 1992 June, 1992 August 1993 August 1994 November 1995 January 1997 First Release Updated for 1.1 Updated for 2.0 Updated for 3.0 Updated for 3.1 Reformatted and updated for 4.0 Updated for 5.0

Trademarks
Premia is a registered trademark of Premia Corporation. Codewright is a trademark of Premia Corporation. Borland C++ and Brief are registered trademarks of Borland International. Microsoft is a registered trademark of Microsoft Corporation. Windows and Visual C++ are trademarks of Microsoft Corporation. Epsilon is a trademark of Lugaru, Inc. Other product names are the trademarks of their respective holders.

Premia Corporation 1075 NW Murray Blvd., Suite 268 Portland, Oregon 97229 Phone: (503) 641-6000 Fax: (503) 641-6001 BBS: (503) 646-1374 CompuServe: 70673,2627 Email: sales@premia.com or support@premia.com World Wide Web: http://www.premia.com

ii

Table of Contents
Selective Display ...................................19 Using Selective Display.....................19 Spell Checker ........................................19 Spell Check Dialog............................20 Spell Correction Dialog.....................21 Template Macros...................................22 Predefined Templates ........................23 Adding and Changing Template Definitions .........................................23 Using Macros in Templates...............24 User-definable Popup Menu..................27 Definition Sections ............................28 Item Definition Lines.........................28 Item Hot Keys ...................................28 Separator Lines..................................29 Supporting Functions.........................29 SEARCH AND REPLACE.....................31 Search and Replace Dialog....................31 Search Settings ......................................32 Replacement Options.............................33 Multiple Sources Search Dialog ............34 Advanced Multi-source Search Options 34 Edit Search List .....................................37 Incremental Searching ...........................38 ISearch Function................................38 Quick Search .........................................39 Toolbar Search ......................................39 DOCKABLE TOOLBARS AND WINDOWS ..............................................41 What Does Dockable Mean? .................41 Enabling and Disabling Toolbars ..........41 Docking and Moving Toolbars and Windows................................................42 Customizing Toolbars and Buttons .......42 Project Window.....................................43 File View Window ............................44 Outline Window ................................45 Bookmarks Window..........................47

INTRODUCTION...................................IX What Makes Codewright Different? ...... ix Basic Strategy ..................................... x User Compiled DLLs .......................... x Key Editor Features................................ xi About the Manuals ................................ xii Using this Manual ................................. xii Typographical Conventions .................xiii EDITOR HIGHLIGHTS.......................... 1 API Assistance ........................................ 1 Using the API Assistant ...................... 1 Modifying the Database ...................... 2 Automation Tools................................ 2 Browsing, Tags, and Outline Symbols .... 3 Which Type of Browsing Should I Use? .................................................... 3 Browser Support ................................. 4 Tags Support ....................................... 9 Outline Symbols................................ 10 Button links ........................................... 12 How it works ..................................... 12 What you see..................................... 12 Defining buttons................................ 12 View Links ........................................ 13 Mouse Commands................................. 14 Inclusive or Exclusive Selection ....... 14 Closed Selections .............................. 14 Column Marking ............................... 15 Line Selections .................................. 15 Word Selections ................................ 15 Status Line Actions ........................... 15 Text Drag and Drop .......................... 16 Mouse Copy and Move ..................... 17 Creating Windows with a Mouse ...... 17 Drag and Drop File Loading ............. 18 Expand / Collapse ............................. 18 Popup Menu ...................................... 18 Making Mouse Assignments ............. 19

iii

Table of Contents
Open File Window ............................ 48 Tabbed Output Window........................ 48 Select View via Tabs......................... 49 Associated Dialogs............................ 50 VDOS.................................................... 50 LANGUAGE FEATURES...................... 53 Document Settings ................................ 53 Document Language Dialog.................. 53 Associating File Types with a Language........................................... 53 Other File Type Specific Settings ......... 54 Editing the Extensions File................ 54 Function Definitions Outline................. 55 C Language Support.............................. 55 Brace Matching ................................. 55 Pre-processed View........................... 57 KEY COMMANDS ................................ 59 CUA Key Commands............................ 59 In the Beginning................................ 60 Advanced Stages ............................... 60 Codewright CUA Variant...................... 60 Persistent Selections.............................. 61 Disabling Virtual Space ........................ 61 CUA Commands by Category............... 63 CUA Commands by Key....................... 65 Making CUA Key Assignments ............ 67 CUA Keymap Functions ....................... 67 BRIEF Key Commands......................... 74 BRIEF-compatible Commands by Category ............................................ 75 BRIEF Compatible Commands by Key78 Brief Keymap Functions ................... 80 VI Key Commands................................ 84 Vi Modes........................................... 84 VI Command Summary..................... 84 Codewright Extensions...................... 89 EX Command Words Supported....... 89 Epsilon Key Commands........................ 90 Epsilon Keymap Functions ............... 99 VERSION CONTROL SETUP............114 Which Interface Do I Use? ..................114 Command Line Interface .....................115 Unlisted Providers ...........................115 Check In Command .........................115 Check Out Command ......................116 Check Out with Lock Command .....116 Lock Command ...............................117 Unlock Command............................117 Log Command .................................117 Manager Command .........................117 SCC Provider Interface .......................118 VCS Maintenance Dialog....................118 PROJECTS AND WORKSPACES .....119 What is a Project?................................119 What is a Workspace? .........................119 Creating a Project ................................120 Adding and Deleting Project Members120 Project Setup Checklist .......................121 Using Projects .....................................121 Selecting or Changing Projects........122 Loading Files for Editing.................122 Project Window...............................122 Creating a Workspace .....................123 Workspace Saving...........................123 Changing Workspaces .....................124 Searching Project Files....................125 Selecting files for Check-in or Checkout....................................................125 Project Files.........................................125 Configuration and State Hierarchy ......125 REGULAR EXPRESSIONS ................127 Special Characters ...............................127 Escape Sequences................................128 Matching a Character ..........................129 Character Classes ................................129 Escaping Characters in a Class ............130 Iteration Qualifiers ..............................130

iv

Table of Contents
Beginning and End of Line ................. 131 Alternation and Grouping.................... 132 Reference Groups and Replacement Strings ................................................. 133 Placing the Cursor ............................... 133 Examples............................................. 135 GENERAL OPERATION.................... 136 Backup Files and Directories .............. 136 Backup Formatting Strings.............. 137 Transformation Patterns .................. 138 Illustrative Examples....................... 139 Command Key..................................... 139 Command Completion .................... 140 Using the API.................................. 141 Source Code versus Command Key 141 Displaying Return Values ............... 142 Examples of Usage.......................... 142 Expression Evaluator ...................... 143 Line Drawing ...................................... 144 Menu Editor ........................................ 146 Menus.............................................. 146 Menu Items and Submenus ............. 147 Operating on Submenus .................. 148 Prompt Histories ................................. 148 CONFIGURATION AND STATE ...... 150 Introduction to Configuration and State151 Configuration File ........................... 151 State File ......................................... 151 Other Files Containing Configuration Data................................................. 152 Example File ................................... 152 Example Interpretation.................... 153 Processing At Startup.......................... 154 Order of Processing......................... 155 User Defined Sections......................... 156 Relating Checkboxes to Functions ...... 158 State File ............................................. 159 Contents of the State File ................ 159 COMMAND LINE PARAMETERS ...161 Filenames.............................................161 Flags ....................................................161 Command Files....................................166 APPENDIX A -- COLOR GUIDE .......167 Palette Settings ....................................168 APPENDIX B -- TECHNICAL SUPPORT ..............................................169 Web Page ............................................169 Internet Mail........................................169 CompuServe ........................................169 Fax.......................................................170 Phone Support .....................................170 Maintenance Policy .............................170 APPENDIX C -- UPDATING SOURCE WITH MERGE .....................................171 Steps to Merging .................................171 Identify Merge Candidates ..............172 Make the Source Files Available.....172 Install AutoMerge............................173 Define AutoMerge Directories ........173 Execute the AutoMerge Function ....174 Resolve Conflicts.............................174 APPENDIX D -- TAGSWNN UTILITY176 Usage...................................................176 TAGSWnn Command Line Options....176 APPENDIX E -- SPECIFICATIONS ..183 Line Length Limit............................183 Lines per Buffer Limit.....................183 Buffers Limit ...................................183 Windows Limit................................183 File Size...........................................183 Number of Files...............................183 Clipboard/Scrap Buffer Size............183 Search String Length .......................183

Table of Contents
FUNCTION REFERENCE.................. 187 Function Description Format............... 187 AssignMouseKeys............................... 189 AttrSetPaletteEntry ............................. 189 Autosave.............................................. 189 AutosaveDir ........................................ 190 BackTab .............................................. 190 BlockCopy .......................................... 190 BlockCut ............................................. 191 Brace ................................................... 191 BraceMatch ......................................... 191 BraceMatchNext ................................. 192 BufBackspace...................................... 192 BufDelChar ......................................... 193 BufDelLine.......................................... 194 BufDelSelection .................................. 194 BufDelToEOL..................................... 194 BufEditFile.......................................... 195 BufInsertChar...................................... 196 BufInsertEOL...................................... 196 BufInsertFile ....................................... 196 BufInsertScrap .................................... 197 BufInsertStr......................................... 198 BufSetAutoIndentMode ...................... 198 BufSetBackupSpec.............................. 199 BufSetGlobalBackupSpec................... 200 BufSetTabStr....................................... 201 BufSetTabUsage ................................. 202 BufWrite ............................................. 203 BufWriteFile ....................................... 203 BufWriteSelection............................... 204 CenterLine........................................... 204 CheckIn ............................................... 204 CheckInBuffer..................................... 206 CheckInSetCmd .................................. 206 CheckOut ............................................ 207 CheckOutBuffer .................................. 208 CheckOutSetCmd................................ 209 ClipboardEnableSepStr....................... 210 ClipboardSetSepStr............................. 211 ColorCommandLine ............................211 Color....................................................212 ColorError ...........................................213 ColorMessage......................................214 ColorWarning......................................214 ColorWarning......................................215 ConfigFileRead ...................................215 CWHelp...............................................216 DefaultKeymap....................................217 DeleteNextWord..................................217 DeletePrevWord ..................................218 DisplayFileName.................................218 Dlg.......................................................218 DlgMenuPopup ...................................220 DlgMenuExec......................................221 EditNextBuffer ....................................221 EditPrevBuffer ....................................221 EdVersion............................................222 ErrKmapAssign ...................................222 EvalStrAdd ..........................................223 EvalStrDel ...........................................223 ExecApp ..............................................224 ExecCommand ....................................224 ExecUserCmnd....................................225 ExecuteMacro......................................226 ExtAddKeyword..................................226 ExtAlias...............................................227 ExtAssignTemplate .............................228 ExtColors.............................................229 ExtColorsAssoc ...................................229 ExtCommentSearchLimit ....................230 ExtDelayedColoring ............................231 ExtExpandTemplate ............................231 ExtIndentEnable ..................................233 ExtIndentEnableAssoc ........................233 ExtKmapAssign...................................234 ExtReadKeywordFile ..........................235 ExtReadTemplateFile ..........................235 ExtSetDelimiters..................................236 ExtSetStyle ..........................................237 ExtSetTemplateMacro.........................238

vi

Table of Contents
ExtSetUpdateDelay ............................. 238 ExtSetWrap ......................................... 239 FFind ................................................... 240 FFindFile............................................. 240 FFindNext ........................................... 241 FFindPattern........................................ 241 FFindShow .......................................... 241 FGrepFile ............................................ 242 FGrepFlags.......................................... 242 FGrepNext........................................... 243 FGrepPattern ....................................... 243 FGrepScope......................................... 244 FGrepShow ......................................... 244 FileTabs .............................................. 244 FilterAdd ............................................. 245 FilterDeleteList ................................... 246 FontSelectMsg .................................... 246 GotoLine ............................................. 246 InsertMode .......................................... 247 ISearch ................................................ 247 KeyPlayback ....................................... 247 KeyRecord .......................................... 248 KmapAssign........................................ 248 LibAutoLoad....................................... 249 LibFunctionReplace ............................ 250 LibPreLoad ......................................... 251 LibUnLoad .......................................... 252 Lower .................................................. 252 MarkGoto............................................ 252 MarkRestorePos .................................. 253 MarkSavePos ...................................... 253 MarkSet............................................... 253 MenuCmnd.......................................... 254 MenuCommand................................... 255 MouseLeftDClick................................ 255 MouseLeftDown.................................. 255 MouseRightDown ............................... 256 MovDown ........................................... 257 MovEndWin........................................ 257 MovEOF ............................................. 257 MovEOL ............................................. 258 MovHome............................................258 MovLeft...............................................258 MovNextChar......................................259 MovPageDown....................................259 MovPageUp.........................................260 MovPrevChar ......................................260 MovRight ............................................261 MovTopBuf.........................................261 MovTopWin........................................261 MovUp ................................................262 MsgLevel.............................................262 MsgMessage........................................263 MsgPauseOnError ...............................264 NextWord............................................264 OutputFile............................................264 OutputWindow ....................................265 Paste ....................................................265 PrevWord ............................................266 Print .....................................................266 PrintFlags ............................................266 PrintFooter...........................................267 PrintHeader .........................................268 PrintLineInc.........................................268 PrintLineInc.........................................269 PrintMargin... ......................................269 PrintSelection ......................................270 QDefaultKeymap.................................270 Redo ....................................................271 Repeat..................................................271 ResizeWindow.....................................271 ScrapNext ............................................271 ScrapPrev ............................................271 ScrapSetCount .....................................272 SelectWord..........................................272 SetLineDrawBindings .........................272 SetLineDrawStyle................................273 SlideIn .................................................274 SlideOut...............................................274 Space ...................................................275 SrchFind ..............................................275 SrchQFlags ..........................................276

vii

Table of Contents
SrchSetFlags........................................ 276 SrchTranslate ...................................... 277 StateSetMarkLevel.............................. 278 SysBeep............................................... 279 SysCaretHeight ................................... 279 SysCaretWidth .................................... 280 SysExit ................................................ 280 SysQFlags ........................................... 281 SysSetCwd .......................................... 282 SysSetDefault...................................... 282 SysSetFlags ......................................... 283 SysSwapBlocks ................................... 284 Tab ...................................................... 285 Tabs..................................................... 285 TagFind ............................................... 286 TagIgnoreCase .................................... 286 TagPrompt........................................... 287 TagSetFile ........................................... 287 ToBottom ............................................ 288 ToTop ................................................. 288 Undo.................................................... 288 Upper .................................................. 289 Visibles ............................................... 289 WinScrollHInc .................................... 289 WinSetCreationPos ............................. 290 WinVisible... ....................................... 291 WinVisibleMarginColumn.................. 292 WrapEnable......................................... 292 WrapParagraph ................................... 293 WrapSetRightMargin .......................... 293 WriteBuffer ......................................... 294 ZoomWindow ..................................... 294 CHANGING AND EXTENDING CODEWRIGHT.................................... 295 System Overview ................................ 295 Core Services ...................................... 296 CWSTART DLL............................. 296 CWDIALOG DLL .......................... 299 CWHELP DLL ............................... 299 Keyboard Command Sets.................... 299 Supplemental Language Support .........300 Auxiliary Services ...............................301 Sample DLL ........................................302 Dissecting a Codewright DLL .............302 The _init Function ...........................302 Exporting Functions ........................303 Making Changes and Additions...........303 Changing Existing Functions...........303 Adding Your Own Functions...........304 Creating New Keymap Command Sets304 Keymap _init Function ....................304 Keymap Function ............................305 Flag Initialization ............................305 Basic Assignments...........................305 Keymap Specific Assignments ........306 Menu Accelerators ..........................306 Recompiling a DLL .............................306 Using and Modifying the Makefiles 306 Compile and Link Options ..............307 Link Libraries ..................................307 Using Your Own DLL .........................309 Installing Your DLL ........................309 INDEX....................................................311

viii

Introduction
Codewright is, in large part, an editor. It is the first professional quality, extensible, programmer's editor written from the ground up for Windows. Codewright is also your "Central Command". From it you issue commands to your generals in the field: your compiler, version control system, operating system, and more. Codewright blends powerful productivity tools and Windows resources with a command shell. The result is eminently usable.

What Makes Codewright Different?


Here are some of the things that make Codewright different from other editors: Codewright is not a port of a program from DOS, Unix, or any other operating system. Codewright is the innovator. Here are just a few of the innovations Codewright brought to programmers editors under Windows: Syntax Highlighting (ChromaCode), DLL extensibility, Merge and Difference, elided text (Selective Display), Help Manager, IDE integration, API Assistance, Button Links, HTML viewer, and MVB file support. Codewright is from Premia Corp. This ensures you of the best satisfaction guarantee and the best support available. Codewright for Windows Just Windows. Porting to other platforms where there is little demand for a Windows editor slows development, and degrades performance. By doing just one platform well we avoid having to charge you for ill-advised marketing forays.

ix

What Makes Codewright Different?


Basic Strategy
Most professional programmer's editors use the same basic strategy. They provide the programmer with the following: An editor engine to perform basic tasks. An extension language in which higher level functions are written. An interpreter built into the editor to interpret functions written in the extension language and to accept user commands. An extension language "compiler" to turn extension language source code into something the interpreter can use. An extension language debugger to debug the extension language source code.

Codewright needs just one of these five components: an editor engine to perform basic tasks. Yet it provides the same capabilities and more. To be properly designed for Windows, Codewright had to avoid the weaknesses of Windows while taking advantage of its strengths. That meant using a different basic strategy.

User Compiled DLLs


Many editors tout their "C like" extension language. Some say their extension language debugger is a lot like the one you are using now. They don't want you to worry about how hard it will be to learn to write extensions to their editors. You are most familiar with the tools you use for your regular software development, so they imitate those tools as much as possible. We say, better yet, use your regular compiler and debugger. We'll supply the source code, and make it easy for you to change the editor. Well, not all the source code. Just the source code you need to recompile many of the Dynamic Link Libraries (DLLs). Write your extensions in C, use your compiler and linker to rebuild the DLL, and use your debugger if your extensions don't work as expected. For those who use a Windows compatible language other than C, just create your own DLL that can be loaded and used by Codewright. For most users, nothing could be more natural. This architecture does not preclude a macro language. In fact, it allows for the possibility of many.

Key Editor Features

Key Editor Features


Unlimited Undo and Redo of commands. Line length and file size virtually unlimited. Optional auto-save at scheduled intervals or during idle periods. Interactively definable Toolbars for quick mouse access to common commands. Complete support of regular expressions in searching and replacement, including searches across multiple lines and replacement groups. Configurable and Extensible through configuration file and DLLs. Hex mode for editing binary files, including inserting and deleting bytes. ChromaCode use of color to signal changed lines or highlight language syntax. Flexible multiple-window, multiple file interface. Edit as many files in as many windows as your resources allow. Selective Display mode for selecting which lines to make visible or invisible. Allows selecting lines to be viewed with grep-like commands, or by preprocessing #ifdefs -- you name it. CUA, Brief, Epsilon, or vi style key commands. Multi-document or file-based search and replace. Completely remappable keyboard -- Create your own command set. Special integration with Compiler Environments including Borlands C++ IDE, Microsofts VC++ Workbench, Borlands Delphi, and Watcom. Uses features of Windows , including Common Dialogs for familiar operation, Drag and Drop for convenient file loading, E-mail integration, and Tabbed Dialogs (property sheets) to simplify dealing with settings and options. Button Links let you reference and view external documents, such as diagrams and word processor files, or organize notes into a To Do list. These items appear as graphical buttons within the text file. Extensive per-window, per-file and per-file type configurability. Side-by-side Differencing, Difference Editing, and Merging of files. Allows unlimited local and global bookmarks.

xi

About the Manuals


Powerful Templates for language constructs, personalized function headers and more. Any API function that can be executed interactively can be executed within a template. API Assistant helps you accurately complete function calls by showing you the types and options for each parameter defined for the function. It then assembles the proper call for insertion into your text. Multiple scrap buffers allow copying more than one item for later use without overwriting previous items. Spell checker that lets you check the spelling of just source code comments and strings, if you like. Spell check the whole buffer, or just the selection. Offers several types of browsing, including Tags, Microsoft .BSC files, and Outline Symbols.

In short, you'll find Codewright to be the most powerful editing environment available on any platform.

About the Manuals


Two manuals are supplied with Codewright Professional: this Users Guide and a smaller Getting Started guide. Use the Getting Started guide to install and begin using Codewright Professional, and later use this manual to learn how to take full advantage of this unique product.

Using this Manual


Due to the advantages of hypertext links and pop-ups over flipping pages, we have put some things in online help and other things in the manuals. While there is some overlap, we expect that you will rely on the online help for details of using the dialogs and Codewrights own API. This manual contains more general reference and how to information. This manual is divided into two parts. The first part provides reference on many of the things you can do with Codewright Professional. The second part describes functions that you may use to make key assignments or to use in Codewright Professionals initialization (.INI) file. It also contains an introduction to extending Codewright through your own DLLs.

xii

Typographical Conventions
Typographical Conventions
Becoming familiar with a few typographical conventions used in this manual will accelerate your understanding of the information presented. Several different typefaces are used to signal specific purposes. Courier Courier typeface is used to indicate something you might see on the monitor, such as a prompt, something you are asked to type, or the contents of a file. When a combination of a prompt and user input is shown, the response portion will appear in bold, as shown below: Command: just_do_it Times Bold Times Italic The Times Bold typeface is used for keywords and function names. Times Italic is used for names of parameters that you supply. It is also occasionally used for emphasis. Keystrokes are usually described using pictures of the keys which must be pressed. The example to the left depicts the control and shift keys and the right mouse button, all being pressed at the same time.

)6

xiii

Typographical Conventions

xiv

Editor Highlights
Codewright contains many fine features. Some of these, such as search and replace, version control, and projects, merit chapters unto themselves. Other equally important features require less description, and are described in this chapter.

API Assistance
You will find on the help menu the item API Assistance on... This item will provide you with help in completing a call to a subroutine or function, if such help is available. Currently, help is provided on the Windows API, Standard C Library functions, Microsoft Foundation Classes, and the Codewright API.

Using the API Assistant


You begin using the API Assistant by selecting API Assistance On from the help menu. If there is a word near the cursor when you do this, Codewright will attempt to locate assistance for that word. If no word is nearby, you are prompted for a subroutine or function name to look up. If more than one occurrence of the word is found, you are prompted to select from those found. You are then presented with a form to fill out. There is an edit box or set of checkboxes for each parameter used by the subroutine or function. The parameter type is listed by each edit box or set of buttons. This makes it simple to ensure that all necessary parameters are supplied, and are of the correct type. If you need additional information, press the Help button and you will see the Windows API Help entry, or other helpfile entry, for that subroutine or function. When the form is completed, press OK and the information you have provided is assembled into a complete function call, including commas and parentheses, and is inserted into the document. Using the API Assistant, it is hard to go far wrong, and you spend less time doing it.

API Assistance
Using the Checkboxes The use of checkboxes in the API Assistant is usually associated with a numeric parameter, such as an integer. The values you check, as represented by the predefined labels, are ORed together in the resulting function call. If you are not familiar with the labels you require, press the Help button and locate the descriptions in the related help file.

Modifying the Database


One of the sample tools placed at the end of the Tools menu is the API Database Editor. This lets you modify and make minor additions to any of the API Assistants databases. More serious modifications may best be done with the automation tools described below. The database editor provides the primary method by which you may present a parameter as a series of choices, rather than a simple edit box. This assists the user in remembering or selecting a reasonable value for the parameter, and tends to validate the choice. The databases supplied as of this writing are described in the table below:

Filename WINAPI.TDB CWAPI.TDB MFC.TDB C.TDB

Description Contains information about Windows API function calls Contains information about Codewright API function calls Contains information about Microsoft Foundation Classes Contains information about Standard C library functions

Automation Tools
A tool has been provided to take data, in one of several formats, and make entries in an API Assistant database. This enables you to automate the creation and update of an API Assistant database for an API or library for which support is not provided. You will need to create a method for getting the data into the proper format. This might be done using an AWK script on source files or DDE queries to InfoView. After doing this, the automation tool will do the work of actually creating or updating the database, based on this information.

Browsing, Tags, and Outline Symbols


A description of the automation tools and how to use them is contained in the file AUTOTOOL.TXT. You will find it in the directory containing the Codewright executables.

Browsing, Tags, and Outline Symbols


Programmers have a need to investigate the code they edit. Whether you are working on someone else's C++ code with a long line of inheritance, or working on C code you wrote last week, you can spend a lot of time investigating. Browsers and Tags programs have long been available to assist with this aspect of programming. Codewright offers these and another form of on-the-fly browsing we call Outlining that will reduce the time you spend being a detective.

Which Type of Browsing Should I Use?


The Codewright Browser uses Microsoft .BSC files that are produced when you compile. It uses a graphical tree to demonstrate relationships and simplify locating the file or other information you need. If you are compiling with Microsoft tools this method gives you the most information about your code. However, you must be able to compile the code, and the information is only as up to date as your most recent build. The Codewright Tags support provides only limited information about your code primarily the location of function definitions. You can access this information in two ways: you can use the same graphical interface as the browser, or a hypertext-style lookup of the word at the cursor. This information, too, relies on you updating the database regularly. The Codewright Outline/Symbols feature may render the other two nearly obsolete. It has its own graphical tree interface in the Outline Window tab of the Project Window. It uses the Symbols Window, a tab on the Output Window, and background parsing to let you view the most up to date information about your project. In addition, users with a knowledge of regular expressions can readily add to the parsers provided.

Browsing, Tags, and Outline Symbols


Browser Support
The Codewright Browser supports two kinds or browser databases: Microsoft format .BSC databases These are the databases generated by Microsoft C/C++ 7.0 and later. (If you need support for an earlier format, contact Premia.) Premia Compiled Tags databases These are the databases produced by the TAGSWnn utility shipped with Codewright. The nn in the name is replaced by 16 or 32 depending on which version of Codewright you are running, 16 bit or 32 bit respectively. The Tags databases are given the extension .PTG by convention. TAGSWnn is described in Appendix D of this manual.

Browser Window

The Browser is one of the windows available for viewing in the tabbed Output Window. It appears when you select Browse from the Project menu or when you select the Browse tab on the Output Window. The Browser is actually two windows side by side with its own tool ribbon at the top. The Tree window appears on the left and the Inspect window appears on the right. Press  to receive help, press ; at any time to leave the Browser window and return to the current edit window. To close the Browser window, select Browser again from the Project menu.

Browsing, Tags, and Outline Symbols


Selecting a Database The first step in using the Browser is to select a database. If you have previously defined a valid .BSC or .PTG file for the current project, that database is loaded when you select Browse. You define the database for the project in the Project Properties dialog, on the Directories tab. If you have not defined a database, or if you later want to change databases, you may select a database by choosing the File Open button on the Browser ribbon. Microsoft project makefiles can contain instructions that cause these databases to be created automatically with the BSCMAKE utility as part of a Build or Make. Therefore, you may find that no action is required from you to create and maintain this database. Traversing the Tree Once you have loaded the database, a tree structure will be displayed in the Tree window. You may traverse this tree from the keyboard by using the arrow keys to move from node to node, and by pressing the ( key to expand or collapse a node. Using the mouse, you may double-click on a node to expand or collapse it, or click on the (expand/collapse) button on the browser ribbon. As you traverse the tree, you will note that information about the selected node appears in the Inspect window to the right. This window will list information such as where the item is defined and where it is referenced, if this information is in the database. You may move between the Tree window and the inspect window by either pressing the 7 key or clicking in the intended window.

Label Bitmaps At the beginning of each line of the tree is a bitmapped label identifying to what the information in that branch relates. A key to these labels is given below: Bitmap Description Root information coming from the database. Information pertaining to a file or module. Information pertaining to a class. Information pertaining to a function. A preprocessor macro definition. A type definition. Information pertaining to a variable.

Browsing, Tags, and Outline Symbols


The first file in the tree list will often be labeled <unknown>. These are functions and other objects that are referenced, but whose source was not compiled along with the project. The most common examples of this are the use of functions in the Microsoft Foundation Classes, or other libraries. Browser Ribbon Here is how the Browser Ribbon appears:

Refer to this diagram as you read the descriptions below. Jump to Code After traversing the tree, you will usually want to go to the corresponding source. There are two Go to buttons on the Browser Ribbon that allow you to do this. If you wish to go to the source code represented by the selected tree node (usually a point of definition), (go to) button on the left of the Browser Ribbon. If you have you can press the selected a reference, a calling or called function in the Inspect window, you may wish to key (Go to from Inspect) to go to that reference or function. Simply press the pressing the J key will always take you to whatever is selected in the Tree window. String Search The String Search feature of the browser works like a grep or filter of information in the database. Use it to filter out extraneous information. It is one of the most useful features of the browser. To use the String Search feature, enter a string into the combo box on the browser ribbon. Unlike some other browsers, the string you enter will not be treated in a case sensitive manner, and a trailing wildcard will be assumed. That is to say, if you enter "dump", it will match strings like "Dump" and "dumpFile".

Browsing, Tags, and Outline Symbols


Each matching identifier is displayed as a node on the tree. All other nodes disappear. You can then traverse this "filtered" tree. Query Button The first button to the right of the Search String combo box on the browser ribbon is the button, or by pressing the T Query button. You can initiate a query by pressing the key. Depending on the context, one of six query dialogs will then appear. An example dialog is shown below:

Each query dialog has a set of action buttons and filter check boxes. The filter check boxes apply only to the action buttons that are enclosed in the same group box. Therefore, in the example above, the check boxes apply only to the Used By and Uses buttons. The other action buttons operate independently of the filters. With all the filters enabled (all the check boxes checked), you may find that you have too much information to sift through to find what you are after. It is probably best to check the minimum number of boxes that fill your needs. The six Query Dialogs are as follows:

Button General Class Function Friend Class (Fclass) Database Module

Purpose General inquiries about the terminals (leaves) on the tree. OOP class inquiries. Inquiries about functions. OOP friend class inquiries. Inquiries from the root of the database. Inquiries related to a module.

Browsing, Tags, and Outline Symbols


Quick Search The Quick Search button on the Browser Ribbon is for use when you are in a normal edit window and want to look up the word at cursor in the browser database. This step saving device acts the same as if you had typed the word into the String Search combo box and pressed (. Called By / Calls To When you have selected a function in the Tree window, you may view either a list of functions that call it, or a list of functions it calls by pressing one of these buttons. Search After Go To The Search After Go To button is a toggle that determines what action is taken after jumping to the related source code (Go To). When this button is depressed, the Browser executes a forward search for the item selected in the Browser window from which it jumped. This is especially useful if you have modified the source code since the last time the database was generated. The Browser may still be able to take you directly to the item of interest. Filter Toggle Buttons The Filter Toggle buttons allow you to focus in on specific categories of objects by turning filters on and off. Each of the lettered buttons at the right of the browser ribbon has an on and off position. When depressed, the button is on, and object associated with that button will show up in the tree. When the button is out, it is in its off position. Related objects will not show up in the tree. You can reverse the condition of any of these buttons by clicking on it with the mouse or by pressing the corresponding letter on your keyboard (i.e., IWPYF ). Below is a list of the buttons and their related objects:

Letter F T M V C

Filter Objects Function references and definitions. Type references and definitions Preprocessor macro references and definitions. Variable references and definitions. OOP Class references and definitions.

Browsing, Tags, and Outline Symbols


After changing the filter toggle settings, you will find that the new settings do not take effect until you have performed some action, such as opening a branch of the tree. To see the effect of the filter change on a branch you are already viewing, collapse and re-expand the branch.

Tags Support
Codewright has support for CTags and other Tags generating programs whose databases conform to the standard Tags format. The file TAGS.C in Codewright's CWSTART subdirectory contains the functions that support this capability, and also defines the standard Tags file format. In addition, Codewright comes with a built-in Tags database generation capability. This program produces both a standard Tags database and a compiled database The resulting compiled database may be used with Codewright's Browser in a similar fashion to a browser database. You can search the database and traverse its contents via a graphical tree. A standard Tags database adds browse-like capabilities to an editor that knows how to read and use the database. If you see the name of a function on the screen and need to know what that function does, the supporting functions allow you to jump directly to the file and line at which the function is defined. You may later return to your original location by changing back to the original buffer. Codewright is known to be compatible with the PCTags program from Moderne Software and GNU Tags, the former of which is available for download from our bulletin board system; the latter is supplied with Codewright. Tags Setup To get Codewright to generate and use a Tags database automatically requires that you follow a few simple steps: Create a project whose members are the files you want to scan for your Tags database. Begin by selecting New or Open from the Project menu. Define what files will hold your Tags data -- your standard Tags database and your compiled database for use with the Browser. These are the last two entries on the Directories tab of the Project Properties dialog. Enter a filename in the Browser database field that employs the .PTG extension rather than .BSC to avoid having the file overwritten by a browser database generator.

Browsing, Tags, and Outline Symbols


Select Build Tags from the Project menu. Use the Browser or TagFind function.

Using the Tags Database To use the standard Tags database, you need to have the function TagFind assigned to a key. The TagFind function looks at the word at the cursor and tries to find a match for it in the database. You can assign this function along with TagNext and TagPrev to keystrokes, if they are not already assigned. You do this through the Keyboard dialog on the Tools menu. To use the compiled tags database with the Browser, load the .PTG file with the Browser File Open dialog. You will then be able to traverse a tree of your tags database, search the database, and be able to do queries for functions and other objects except for friend classes. You will only be able to query definitions, however. References are not stored in the Tags database.

Outline Symbols
The Outline Window is a hierarchical view of symbols in Project files and any other files that are currently loaded. The references to symbols (usually function names, variable names and the like) are kept in a database that is generated in the background as you work. It does not rely on a database generated by compiling, and therefore works on code that has never been compiled. Parsers are provided for use with a variety of file types to generate the symbol databases. You can add parsers for use with the output window without compiling. An advanced knowledge of regular expressions, and some development effort is required, however.

10

Browsing, Tags, and Outline Symbols


Supported File Types Parsers are available for the following file types:

File Type .BAS .C .COB .CPP .H .HTML .INI .JAVA .PAS .PRG

Parsers Declare, Function, Sub Function, Define Section, Division Function, Define, Class Function, Define, Class Function Section Function, Class Function, Procedure Function

These parsers are also available to any file types that have been mapped to the ones above (e.g., .HTM is mapped to .HTML).

Using the Outline Window


The Outline Window uses the Symbols tab in the Output Window and an edit window to let you investigate the code you are working with. In the window you will see a tree structure with a root for each of the files you currently have open. When you open each root, you will see a list of symbols found in that file, grouped by parser type. Symbol Window Clicking on a filename or root opens that file for editing. A single click on a listed symbol shows references to that symbol in the Symbol Window tab of the Output Window. If there is just one reference in the symbols database, the source code at that location is shown in the Symbol window. If there is more than one reference, a summary of each reference is listed in the Symbol window. You can then select a reference of interest, and view that location in the source code by double clicking on that entry in the list. When you single click on a symbol listed in the Outline window, as described above, the view in your current edit window is not modified. This allows you to browse symbol references without losing your place. If you double-click on a symbol listed under one of the loaded files, your view in the current edit window moves to that location, in addition to listing references in the Symbol window.

11

Button links
Button links
Button links are special action buttons that Codewright lets you embed in your text files. You may use them to view bitmapped images, bring up a related document or spreadsheet, run a macro or just to make notes. To any other editor, it is still just a straight text file, and because the buttons are placed in comments, source code files compile as they normally would.

How it works
You select the type of link and the text that will appear in the button. Codewright uses this information to create an index entry for that text, and places it into the text file with a special 3 character prefix and suffix. Comment prefixes and suffixes are used as you indicate. The index entry refers to an entry in a database that indicates what the button link does.

What you see


When you have turned on the View Links option in the Document Properties, you will not see the 3 character prefix or suffix. Instead, you will see a 3D-style button containing the text you specified, and a notation indicating what type of link it represents. Click on the button and the associated action is performed.

Defining buttons
When you select Insert Link from the Edit menu, you are presented with a dialog that allows you to define a button link. You enter your buttons text (which must be unique), select the link type, and enter the appropriate text to be associated with the button. The nature of the associated text depends on which link type you select. Using buttons you can perform three different categories of actions:

Access to the Codewright API


The Template and Macro type links allow you access to the Codewright API. Templates -- Templates allow you to insert text, prompt, move the cursor, or execute a series of actions. For templates, the associated text is the contents of a template to execute, such as supplied to the ExtExpandTemplate function.

12

Button links
Macros -- Macros allow you to execute any API command that is available interactively. The text associated with a Macro link is the function call. It is limited to a single function.

Running external programs


The Document and Application link types allow you to run external programs. Document The document link allows you to run the program associated with a file type, to view or modify that document. The document might be a bitmapped diagram or a word processor file. In this case, the text associated with the button is just the filename of the document. Application The application link lets you define any arbitrary command line to be executed when the button is pressed.

Pop-up notes
Pop-up note links come in two flavors: standard notes and to do notes. These two types of notes are essentially the same. Providing two link types for notes, however, gives the buttons a different appearance and allows you to sort to do notes separately from other notes, when viewing the list of defined links.

View Links
The View Links dialog lets you see what links are currently defined in the database, lets you edit their definitions, delete them, or go to the location in the file where the link is defined. The tree shows the six different types of links available, and allows you to view the links of each type. There is a folder on the tree representing each of the six types of links. When the folder appears disabled, this indicates that there are no links of that type defined. After you open a branch of the tree to view the list of links of that type, you may select a specific link. Once selected, you may edit the definition of that link by pressing the Edit button, go to the location where that link is defined by pressing Go To, or you may delete the link from the database.

13

Mouse Commands
Note: Deleting a link from the database does not delete the button part of the link from the text file. This is something that currently must be done manually. If you do not do this, your files and database will become out of sync.

Mouse Commands
You can probably guess most of the things that you can do with a mouse in Codewright: click on menus, select text and so on. There may be a few things that you wouldn't guess you could do with a mouse, and other things that you might suspect you could do but do not know how to do. It is those things that we will be covering in this section.

Inclusive or Exclusive Selection


In all three standard keymaps, you can select text by clicking with the left mouse button and dragging the mouse across the area you want to select. In the CUA and BRIEF keymaps, the block you define is exclusive, while if you are using the vi keymap, the block is inclusive. That is, in vi the block includes the character at the cursor, but the others do not.

Closed Selections
You may elect to have selections that you make with the mouse be either closed or open when you release the mouse button. This is one of the System Options that you can set. Your keymap dictates the initial setting for this option. A closed selection means you will not change the selection size or shape when you move the cursor. Selections made with key commands usually are not closed. In this case, one end of the selection is defined by the cursor position, and it therefore moves with the cursor. Your keymap may have a command to toggle a mouse selection or other selection open or closed. You can do this with the )D command in the BRIEF-compatible keymap, and ) in the CUA keymap, for example. If you re-open a closed selection after moving the cursor away from the selection, the end of the selection moves to the cursor position, wherever it happens to be. The distinction between closed and open selections is not meaningful in the CUA keymap unless you have turned on persistent selections. Otherwise, CUA removes the selection, whether closed or open, whenever you execute an cursor motion command.

14

Mouse Commands
Column Marking
Making a column selection with the mouse is just as easy. Just click and drag with the right mouse button instead of the left. Column blocks are always inclusive, regardless of which keymap you are using.

Line Selections
There is an adjustable margin between the left edge of the buffer and the window border. You can use this area for making line selections. Clicking with the mouse in this space selects the line to the right. Clicking and dragging selects a series of lines -- even if the mouse happens to stray from the margin.

Word Selections
As with many Windows editors, double clicking on a word makes a selection encompassing that word. If you continue to hold down the cursor on the second click and drag it around, you can select in units of words. You may be familiar with this method of selection from one of several word processors.

Status Line Actions


There are a number of functions that you can perform just by clicking with the right mouse button on hotspots on the status line. These actions are listed below:

Action Insert/Overtype Toggle

Read-only/Read-write Toggle

Go to line Next Message

Description Toggle between insert and overtype mode by clicking-right on the Ins or Ovr designation on the status line. Toggle between Read-only and Read/write status by clicking-right in the box to the left of the line number. The box may be blank or have a RO designation in it. This toggles both file and buffer status. Clicking-right in the Line number box brings up the Go to Line dialog. Clicking with the right mouse button in the message box at the left of the status line will cause the program to process the next Build error message.

15

Mouse Commands
A related command is the right mouse click on the Ribbon Search combo box. This is on the Standard Toolbar instead of the status line. A right click here brings up the Search Options dialog. This allows you to check or change the settings in preparation for using the Ribbon Search or other search mechanism.

Text Drag and Drop


After you have selected a block, you can move or copy the block by dragging the block to its new location. To move the block, place the mouse cursor in the selection's highlighted area and press the left mouse button. The cursor will change shape to indicate that a drag and drop operation has commenced. Continuing to press the mouse button, move the mouse cursor to the intended destination. The caret (text cursor) follows the mouse cursor, indicating where the destination would be at any given moment. When the caret is at the intended destination, release the mouse button and the selected text moves there. You perform a copy operation in the same manner as a move, except that the ) key must be pressed when you initiate the operation. To cancel a drag and drop operation after it has been commenced, move the mouse cursor back over the selection and release the mouse button. A selection cannot be copied or moved into itself. The operation is then cancelled and the selection removed. Text drag and drop is not effective for copying or moving text from one window to another. Use mouse copy and move commands, described below, for those operations.

Disabling Drag and Drop


If you are unaccustomed to text drag and drop, you may find it annoying and want to turn it off. You can do this by editing the key bindings. Just follow the steps listed below: 1. 2. From the Tools menu, select Keyboard. Click on the Mouse tab at the top of the dialog. There you will see a series of buttons for each of the mouse buttons in three different columns. Press the Down button under the heading Left and press the binding button immediately to the right of the Key Sequence edit box. The binding should appear in the Functions edit box below. Move the cursor into the Functions edit box, and press the End key. You will see a 0 and a 1 at the end of the key binding.

3.

16

Mouse Commands
4. 5. Change the 1 to a 0. Press the Save to File button and then the Quit button.

The drag and drop editing feature should now be disabled.

Mouse Copy and Move


In addition to Text Drag and Drop, Codewright supports another method of copying and moving text with the mouse. You just select the text you want to copy or move, point the mouse at the place you want it to go, and issue the proper mouse command. The command for moving the selected text is ) . The copy command is )6 . Sometimes, when you are moving or copying text, the source and destination of the text are too far apart to be viewed in the same window at the same time. You can still use the mouse move and copy commands, if you find this method more convenient than using either one of Codewright's Scrap buffers or the Windows Clipboard. This is done by either opening up another window, or scrolling between source and destination. You might have several sections of text that you want to copy or move, all from the same source location to a single destination. In this case, viewing the source in one window and the destination in another is the best approach. If you have just one copy or move operation in mind, you can select the desired text and then scroll to the destination. The selection will scroll off the screen, but so long as you are using closed selections for mouse operations, it won't change. A "closed selection" refers to Codewright's ability to separate the selection from the cursor position. You can select whether selections made with the mouse are open or closed in the Environment dialog on the Tools menu. Select the System tab.

Creating Windows with a Mouse


It is very easy to create windows of an arbitrary size and position when you are working with a mouse. This is the quickest way to open up a second window onto your current buffer, so that you can view two different sections of the buffer at the same time. You do this by pointing to any part of Codewright's client area that is not currently occupied by a window and clicking with the left button and dragging the mouse cursor to any other part of the client area. Whatever buffer was current previous to creating the

17

Mouse Commands
window is also made visible in the new window. This means you will have at least two windows in which to view the current buffer. If you don't like this use of the left mouse button you can turn it off through the Environment dialog on the Tools menu. You will find it on the System tab..

Drag and Drop File Loading


The Drag and Drop feature allows you to load files into applications from the Windows File Manager. This is done by selecting one or more files listed in the File Manager, and then dragging them with the mouse to a minimized application. When the mouse button is released, the application is restored, and the file or files are loaded or processed. If you choose to use Codewright regularly in this manner, you may want to add Codewright to the Load= statement in your WIN.INI file. You can then perform other duties when you first start Windows, such as reading your mail. When you are ready to work with Codewright you can then use the File Manager to drag and drop the appropriate file onto the Codewright icon. If you already have files loaded in Codewright, the files you drag and drop onto Codewright will be added to those already being edited. Whether or not a window is created for each of the files dropped onto Codewright depends on your settings of the System Options. If windows are not created, the window that was current will contain the first file of those dropped.

Expand / Collapse
When you are using selective display mode, you can use a mouse for expanding and collapsing sections of text as you might the sections of an outline. The mouse command used for this is a double click with the right mouse button. See the description of "Selective Display" later in this chapter for more information about this use of the mouse.

Popup Menu
Whenever you click with the right mouse button, you get a popup menu in any of the four standard keymaps. (Not press and hold, but rather a quick press and release.) This popup menu is context sensitive, presenting different items depending on whether you are clicking in a regular edit window, or in the output window; whether you have a selection defined or none defined. The Popup menu is described more fully later in this chapter.

18

Spell Checker
Making Mouse Assignments
You can also make your own assignments to mouse buttons and combinations through the Keyboard dialog on the Tools menu.

Selective Display
Selective Display mode lets you focus by hiding text that is not of current interest. The text is still there, but you dont see it until you want to. There are several ways to select what text to make visible. You can specify a pattern and hide lines that contain text that doesnt match that pattern. In this case, the resulting view of the file looks something like grep output. You can similarly specify a pattern and hide lines containing matching text. There are also some other more complex operations predefined for your use. You will find all of these capabilities in the Selective Display dialog on the Text menu.

Using Selective Display


Just press ; when you want to restore the invisible lines. When you want to see just the lines you have selected again, there's no need to re-enter the dialog and run the command again. Instead, just press &%F in the CUA or the BRIEF keymap, or  in the vi emulation. In Selective mode, lines are preceded with a small button or icon. When this button contains a plus sign, it indicates that there is text hidden following that line. You may view the hidden text by double-clicking on the plus sign or pressing %( on that line. The plus sign then turns to a minus sign, to indicate that the section has been expanded to show the "invisible" lines. Double-click on the minus sign or press %( again, and the section collapses again. You can also double click with the right mouse button to expand and collapse hidden text.

Spell Checker
Codewright Professional's spell checker has a 100,000 word dictionary and some "codesmarts" that make it useful for a variety of purposes. It will help you keep reports, code comments, and the messages your program displays looking professional.

19

Spell Checker
The Spell Check item appears on the Edit menu. The Spell check button will appear on the Toolbox when it is enabled. The spell checker relies on several dictionary files: DICT.D DICT.I DICT.S DICT.APP DICT.U Main dictionary data file. Main dictionary index file. Small word dictionary containing one and two character words. Application dictionary. User dictionary.

All of these files, except for DICT.U, are placed in your Codewright Professional home directory during installation. The file DICT.U is created when you first specify that a new word is to be added to the dictionary.

Spell Check Dialog


The Spell Check dialog allows you to check the spelling of a word, the words in a selection, or an entire document.

Suggest Alternate Spellings The Suggest Alternate Spellings check box determines, when the spell checker finds a word that is not in the dictionary, whether it lists similarly spelled words that are in the dictionary. This has the effect of slowing down the checking process, so you may want to omit this option when you know you will be checking a lot of words that are not in the dictionary.

20

Spell Checker
Restrict to Selection This check box is only available when you have selected a block of text. When a selection has been defined, a check in this box indicates that only words in the selection are to be checked. Restrict to Comments/Strings This option is normally only available when you have a file loaded that has one of the following extensions: .C, .H, .CPP, .HPP, .HXX, .CXX, .PAS, .INC, .ASM, .PRG, .SC. These represent the file types for which Codewright Professional understands comment structures and string constants. It is then able to differentiate between comments, strings and other code. When this box is checked, the spell checker operates only on the words in comments and strings. Restrict to Strings The option is the same as the one above, except that the spell checker limits itself to strings only. Check Document Button The Check Document button initiates a spell check on the current document, using the selected options. Check Word Button The Check Word button checks the spelling of the word at or by the cursor. Next Button The Next button initiates a spell check on the current document beginning at the cursor position and continuing through the subsequent text. This button is useful when you momentarily exit the spell checker to make manual corrections and then want to pick up the spell check from where you left off.

Spell Correction Dialog


The Spell Correction dialog box displays the word that the spell checker did not find in the dictionary in its caption. It then allows you to add the word to the dictionary or correct the spelling of the word. Replace with The Replace with edit box displays the spelling that will replace the misspelling when you press the Correct button. If you have elected to have the spell checker suggest possible correct spellings, the spelling selected in the list box below appears here. You may manually enter a spelling into this box or edit the word displayed.

21

Template Macros
Add to User Dictionary When the spelling in the caption is correct and you wish to have the spell checker recognize the word in the future, press this button. The spell check then continues. The word will be saved to a special user dictionary at the end of the session. Correct button This button replaces the word displayed in the caption with the word in the Replace with edit box. The spell check then continues. Correct All button This button replaces the word displayed in the caption with the word in the Replace with edit box. The spell check then continues. If Codewright encounters the same misspelling again, it will correct the spelling in the same way without further prompting. Ignore button When you neither want to correct the spelling of the word in the caption, nor want to add the word to the dictionary, press this button. This is useful when the word is not expected to be repeated elsewhere. The spell check then continues. Ignore All button When you neither want to correct the spelling of the word in the caption, nor want to add the word to the dictionary, press this button. The spell check then continues. If Codewright encounters the same misspelling again, it will ignore it. Quit button This button discontinues the spell check session. It may be continued later by selecting the Next button on the Spell Check dialog.

Template Macros
Templates are useful in taking the drudgery out of repetitive tasks. The constructs used in programming lend themselves to a fill-in-the-blanks style of template. Codewright Professional supports this type of templates that are automatically triggered when you type a designated abbreviation. Codewright Professional's templates have a macro capability, however, that makes them the most powerful in the industry. You may be leaving great potential untapped if you just use templates for language constructs.

22

Template Macros
This section of the manual reviews how to create the type of template used for language constructs. It goes on to describe the advanced features provided by template macros.

Predefined Templates
Before you add or change a template, you need to know what templates are already defined, and what there definitions are. Since templates are associated with a specific programming language, Codewright Professional associates them with file types used in that programming language. You can therefore view the templates defined for a particular file type by selecting Template tab of the Language dialog on the Document menu. Here, you can view the abbreviations that trigger template expansion, and the string values associated with them.

Adding and Changing Template Definitions


Two methods are provided for adding your own constructs, or changing existing ones. The first of these methods is through the Template Setup dialog mentioned above. The second method is to directly edit your configuration file. If you choose to do this by directly editing your configuration file (CWRIGHT.INI), you can do this by adding a call to ExtAssignTemplate. Put it under the [Editor] heading. There are three string parameters used by ExtAssignTemplate. The first tells what file extension to associate the template with (e.g., .C, .SC...). The second specifies a word or abbreviation that is to trigger the template expansion, for example "if", "else", and so on. The third string is the template itself. There are special characters defined for use in language templates, that give Codewright Professional useful instructions. For example, most templates will take up more than one line in the document. There is a need, therefore, to specify in the template string the locations of new lines. In most templates, you will also want to specify a location where the cursor is to be placed after the template is inserted. Here is a table of the special characters available, and their meanings:

Character \n & @ \c

Purpose New Line. Simulates pressing enter at this point. Specifies cursor position after template insertion. Issues a backspace. Insert 'c' literally, (e.g., \&, \@, \\)

23

Template Macros
\t Insert a tab.

Here are some sample template strings, to give you an idea of how these special characters are used to construct templates: "if (&)\n{\n}" "do \n{\n\t&\n}\n while( );" "for (&; ; )\n{\n}" Finally, here is how the complete ExtAssignTemplate line might look in your configuration file:
ExtAssignTemplate=".pas","proc","Procedure &();\nBegin\nEnd;"

This example adds a template for use when editing files with the extension .PAS. When the word "proc" is typed, followed by a space, a template for a Pascal Procedure is inserted in the document. The cursor is positioned at the point where the name of the procedure would be entered. The ExtAssignTemplate function is described in the Function Reference part of this manual.

Using Macros in Templates


You may have noticed the use of certain % macros in some of the existing templates used for language constructs. These macros can have a great many uses. For example, they enable Codewright Professional to place braces differently, depending on the indentation style desired. You can even find uses for these Template macros independent of triggering abbreviations and specific programming languages. You may wish to assign a template to a key or button. To do this, you need to use a function that interprets these macros directly. That function is ExtExpandTemplate. You will find an example use of ExtExpandTemplate on the Toolbox. There are two buttons that use this function to insert a header. One button inserts a module header, and the other inserts a function header. The function call is quite simple: ExtExpandTemplate %ffunct.tpl$ This command uses the %f Template macro to insert the file FUNCT.TPL, which contains the function header. The trailing $ is used to delimit the filename string. Template macros can, of course, be a lot more complex. The file that this macro inserts

24

Template Macros
can also contain Template macros. The file FUNCT.TPL is also simple, and it contains just one Template macro. To demonstrate the use of Template macros, we will add a few macros to this file. This is the contents of the file FUNCT.TPL: /* ** * * * * * * */ %qEnter function name:$ PARAMETERS: DESCRIPTION: RETURNS:

The second line contains the %q query macro, which requests the name of the function. Here is the modified version of the same file: /%rep*60 ** %qEnter function name:$ * * PARAMETERS: & * * DESCRIPTION: * * RETURNS: * * CREATED: %date %time * * BY: %eUSERNAME$ */ These are the macros that were added: %rep & %date %time %e This macro repeats the * character 60 times. This specifies where the cursor should be placed at the end of the insertion. This inserts the current date. This inserts the current time. This inserts the value associated with the specified environment variable, USERNAME. Again, the $ character is used to delimit the string.

Below is an example expansion of this template file: /*********************************************************** ** MyFunc

25

Template Macros
* * * * * * * * * * * PARAMETERS: DESCRIPTION: RETURNS: CREATED: BY: milow 08/16/95 11:45:50

These are just a few of the things you can do with template macros. A table containing a complete list of the % macros available follows:

Macro form %colNum %date %db %dcNum %de %dlNum %dw %eEnVar$ %fFilename$
%home %lineNum %mdNum %meof %meol %mlNum %mrNum %muNum %Num

Description
Moves the cursor to column Num of the current line. Inserts a U.S. formatted date string at the current cursor position. (mm/dd/yy) Deletes to the beginning of the line. Deletes Num characters at cursor. Deletes to the end of the line. Delete Num lines, beginning with the current. Delete the word at the cursor. Insert the string value associated with environment variable EnVar. Insert the named file at the cursor. Any template macros within the file are also processed. Move the cursor to the beginning of the line. Move the cursor to the line named by Num. Move down Num lines. Move the cursor to the end of the file. Move the cursor to the end of the line. Move the cursor left by Num columns. Move the cursor right by Num columns. Move up Num lines. When Num is 0 to 9, it refers to a user-definable string that may be different for each extension. Any macros contained in these strings are also expanded. These definitions are normally stored in your configuration file or CWRIGHT.EXT. The macros 0 through 3 are used for custom indentation in predefined language templates. See ExtSetTemplateMacro. Higher numbered macros (10 through 31) are not extension specific, but are otherwise similarly definable. They are reserved for the use of individual users.

26

User-definable Popup Menu


%open %qPrompt$ %repCNum %restore %save %time %tof %xFuncCall$
Open a new line following the current. Similar to going to the end of the line and . pressing Query for string to insert, using the string Prompt to prompt the user. Insert Num repetitions of character C. Restore a saved position. Save a position for later restoration. Insert a formatted time string. (hh:mm:ss) Move cursor to the top (first line) of the file. Requires %home to assure positioning at the first character of the file. Execute the Codewright Professional API function call in FuncCall. This may be any function that could be assigned to a key or otherwise executed through LibFunctionExec.

User-definable Popup Menu


The user-definable popup menu is a menu that is defined in a text file. You can change the way the menu works by editing that file. The changes are effective immediately. There is no need to recompile anything or to restart Codewright -- just save the file and your changes are effective. The file that contains the popup menus is named CWRIGHT.MNU. Codewright looks for this file in its home directory, usually along with the Codewright executables. You will find it there, too, when you want to modify it. A portion of CWRIGHT.MNU is shown below:

;----------------- Popup Menu sections ----------------[Utilities] Quick Search Check in Check out Match brace Match next brace EnTab DeTab Selective text Hexidecimal File comment Function comment ; SearchQuick ; CheckInBuffer ; CheckOutBuffer 1 ; BraceMatch 1 ; BraceMatchNext 1 ; EnTab ; DeTab ; BufSetCompact ; BufSetHexAscii

Menu Definition Section

Pseudo-comment Function to execute

; ExtExpandTemplate %ffile.tpl$ ; ExtExpandTemplate %ffunct.tpl$

27

User-definable Popup Menu


[pvcs] ; This is a comment Check &In... ; MenuCommand Check &Out... ; MenuCommand - This is a menu separator &Lock file ; DlgMenuExec &Unlock file ; DlgMenuExec &Newest Rev ; DlgMenuExec

Real Comment
0x1708 0x1709

Menu Separator

[Lock] [Unlock] [ReportRev]

Definition Sections
The popup menu definition file contains sections just like a Windows .INI file does. Each section begins with a section heading, a word or label enclosed in square brackets. The lines that follow the section heading describe the menu items that will appear on the popup menu, and what happens when you select each item from the menu. These are called item definition lines.

Item Definition Lines


There are two parts to each item definition line: the part that appears on the menu (menu item) and the part that tells Codewright what to do when the item is selected (function call).

The two parts of the definition line are separated by a semicolon. This may appear to be a comment, but it is not. We therefore call this a pseudo-comment. For a line to be a comment, the semicolon must be the first character on the line. The rest of the line is then ignored. The part of the line in the pseudo-comment is the function call that Codewright will execute when you select the menu item to the right of the semicolon. This function call must be something that you could call through the Codewright function LibFunctionExec, or the API Command prompt. No variables, no nested function calls.

Item Hot Keys


You may use an ampersand ( & ) in the menu item portion of the definition line to define a hot key for the menu item. This follows Windows conventions for menu constructs:

28

User-definable Popup Menu


The letter following the ampersand appear underlined, and pressing that letter on the keyboard selects the menu item.

Separator Lines
Any line in a definition section that begins with a dash indicates that Codewright should place a separator line on the popup menu at that position. A line the full width of the menu will appear on the menu even if there is only a single dash on the line. Codewright will ignore the remainder of any line that begins with a dash.

Supporting Functions
There are two functions that support the operation of popup menus. They are as follows: DlgMenuPopup -- Use this function to assign a popup menu to a key or mouse click. DlgMenuExec -- Use this function to execute other sections within the CWRIGHT.MNU file.

These functions are further described in the Function Reference portion of this manual.

29

User-definable Popup Menu

30

Search and Replace


Codewright offers a relatively large number of methods of performing search and replace operations. Each has its own advantages under differing circumstances. Some work on a single file when loaded into a document. Others work directly on the files on disk. Some are meant to be quick and simple while others are designed for power. To help you review your alternatives, the description of these methods are collected together in this chapter. The methods of search and replace discussed in this chapter are listed below: Search and Replace dialog Incremental Search Toolbar Search Quick Search Multi-source Search and Replace

In addition, the Search Options dialog influences the various methods of search and replace described here.

Search and Replace Dialog

31

Search Settings
Search and Replacement Edit Boxes The Search String and Replacement String edit boxes allow you to enter the pattern you want to match and the replacement string. You may only enter a replacement string when the Replace radio button in the Action group has been selected. Both of these edit boxes maintain a history of previous responses, which you may select by pressing the down arrow to the right of the edit box. Save Settings This check box is provided to save you from having to make a trip to the Search Options dialog whenever you want to make a change to the search settings. Settings are not immediately written to disk, however. Checking the box makes the current settings the default for the session. These settings are saved in the state file on exit, if you are employing one.

Search Settings
Search Direction You may elect to search forward from the cursor position or backward. Search Options This group of check boxes allows you to turn various search attributes on or off. These include: Ignore case. When this box is checked, uppercase characters or lower case characters will be matched. When it is not checked, the case of the characters in the specified search string is significant. Regular expression. When checked, this box indicates that the search pattern is a regular expression. Some of the characters in regular expressions are given a different meaning than they would have in an ordinary string search. This allows for more powerful searches. Maximal match A check in this check box indicates that regular expressions should match the largest possible unit. If this box is not checked, regular expressions will match the smallest possible unit, which in some cases may be 0 characters. For example, if the regular expression specifies matching 2 or more A's in a row (AA+), and the search encounters 5 in a row (AAAAA), what does it match? If maximal match is on, it matches five. If it is not, the search matches the first two.

32

Replacement Options
Whole word When the whole word box is checked, the pattern you are searching will not match strings that are only partial words. That is, the pattern must be preceded and followed by one of the following: Beginning of file or end of file Beginning of line or end of line Spaces or tabs Wrap at beginning/end A check in this check box indicates that you want to search the entire document. When the document extremity is reached (the beginning or end of the document, depending upon the direction of search), the search is continued from the other document extreme. The search concludes at the point at which the search began. Restrict to selection. This check box allows you to indicate whether you want the search to be restricted to the selection or marked block of text. If the box is not checked, the scope of the search is global. This option will be disabled if no selection is defined. Select matching string. This check box specifies whether the text that matches the search will be highlighted in a selection at the end of the search. The selection may be momentary, or may be retained so that you can operate on it (copy, cut, or replace). Retain selection. When the "Select matching string" box is checked, this check box indicates whether the selection that encompasses matching text is momentary or whether it is retained so that you may operate on it.

Replacement Options
The Range group of options is specific to the replacement operation. Prompted replacement. When this radio button is selected, you will be prompted each time text matching the search pattern is found. You may elect at that time to make or skip the replacement, or to cancel the search. The search continues until no more matches are found in the defined scope of the search, or you select cancel. Single replacement. When you select this radio button, the first occurrence of matching text is replaced without prompting. Global replacement. Selecting this radio button causes all occurrences of matching text within the scope of the search to be replaced without further prompting.

33

Multiple Sources Search Dialog


Multiple Sources Search Dialog
The Multiple Sources Search and Replace Dialog allows you to define a search or replace operation that is not confined to a single document. You may elect to search through all loaded documents, through files that are members of the current project, or any arbitrary set of files. Search and Replacement Edit Boxes The Search String and Replacement String edit boxes allow you to enter the pattern you want to match and the replacement string, just as you would in a single document search. Both of these edit boxes maintain a history of previous responses, which you may select by pressing the down arrow to the right of the edit box. You may only enter a replacement string when the Search and Replace action has been selected. If you elect only to search a series of files, rather than selecting the Replace action, you are selecting to perform a File Grep. A list of matches in the files specified will appear in the File Grep tab of the Output Window. The line numbers and the line containing the matching text are also displayed. To move to any of the matches listed in the message box, double click on it with the mouse, or select the matching line from the list and press (.

Advanced Multi-source Search Options


You receive these options when you press the Advanced button on the Search and Replace dialog, or when you select Multi-source Search from the menu.

34

Advanced Multi-source Search Options


Current Directory The Search and Replace dialog shows the directory that is current as you initiate the search. Browse Button If you are not in the desired directory, press the Browse button to select a new working directory for Codewright. Retain Directory After changing the directory, you may want that directory to remain in effect after you finish searching and return to editing. If this is so, check the Retain Dir box. If you just want the directory in effect for the search, ensure that this box is not checked.

Multiple Source Mode Selection Project This option lets you search through files that are members of the current project. Documents only This option lets you limit the search to the list of currently loaded documents. Files and folders This option lets you search an arbitrary group of files in any series of folders. Enter a name for your search set in the edit box associated with this radio button, or select from the list of previously created search sets.

File Pattern You may use the File Pattern edit box for quick, ad hoc searches that you are not apt to repeat. It lets you specify a file type or series of file types to search without associating it with a search set name. While not as powerful as the Search list, it is simpler to use. Enter one or more wildcard patterns into this box. Separate multiple patterns with a semicolon. The File Pattern supplements the selected items on the Search list, if any. You may add it to the Search list by pressing the Add button. Note: The File Pattern, when specified, does not override the list of files in the Search list. If both are defined, the files in both the File Pattern and any selected members of the Search list are searched. Search List The initial contents of this box depends on which mode of search you have selected. If you have selected Project mode, the box will list the files in the current project. If you have selected Documents only mode, the listbox shows the list of documents currently open. When you select Files and Folders, the list reflects the search set shown in the

35

Advanced Multi-source Search Options


Files/Folders combo box. It is usually a series of wildcard patterns. To edit the list, press the Edit button. When you first select your desired mode, you will see that the entire contents of the listbox is selected. If you wish to further limit the search or replace to a subset of the list, deselect the files you want to exclude. Selecting Files from the List Clicking on a filename or wildcard pattern selects it for the search operation. You may select or deselect additional files or patterns by holding down the & button and clicking on those members of the list. The Clear button allows you to start your selection process over again. If the list of documents you don't want to search is shorter than the list of documents you do want to search, select the documents you want to leave out and then press the Invert button. All of the documents that were previously selected become unselected, while the unselected documents become selected. Search Subdirectories Check this box if you want the search to encompass the files in subdirectories of the path searched. Edit Modified Files If you are performing a replace operation, you may wish to review the changes made, or at least to know which files were changed. Selecting this option lets you do this. Modified files are loaded for viewing and possible editing. This is a convenience when you plan to check the modified files into version control. Threaded Checking this box lets the search or replace operation proceed as a separate process. You can then proceed with other tasks as the search continues. In the case of a search only (File Grep) operation, the output window will be updated as matches are found. Without threading, the matches would only be listed after the operation is completed. Send Listing to Output Window This checkbox and group controls whether and what information is sent to Codewrights tabbed output window. Its primary purpose is to let you see the results of Search only (File Grep) operations, but it can also be useful as a summary of replacement operations. List Filenames Only By default, the output listing contains the file and line numbers of matches, along with the line of text in which the match was found. For a terse summary containing only the filenames in which matches were found, check this box.

36

Edit Search List


Append to Listing To add to the information in the output window from previous searches, check this box. Otherwise, the contents of the output window will be reinitialized. List to File You may specify that the information about the matches found be stored in a file, and the name or that file. The default name is CWFGREP.___, which is created in your TEMP directory. You may specify another name if the default causes a conflict, or if you wish to save the output from the previous or current operation, rather than allowing it to be overwritten. You may also redisplay the results of a previous search by specifying the name of the file in which you saved the results.

Edit Search List


File Pattern Enter the file specification that you wish to add to the definition of the current Search Set in this edit box. Standard wildcard characters ? and * are allowed. Your pattern may be anything from *.c to k:\src\cw????.??v. You can enter several patterns at once by separating them with semicolons. When you do so, each pattern is given a separate line in the list of patterns for the Search Set. Use the Add button to add the file pattern to the Patterns list. Patterns List This listbox contains source patterns already defined for this Search Set. The Search Set is the union of these patterns, rather than the intersection. Files are only searched once, even if they match several of the Search Sets source patterns. Therefore, if the Search Set contains the pattern *.*, other patterns are superfluous unless they contain a path element. Source patterns that do not contain a path element will apply to the current directory. Drive and Directory Lists The drive listbox and the directory tree list box allow you to select the path you want to apply to the source set. This is only meaningful if the Include Directory checkbox is checked when the Source Pattern is added to the Patterns list. Include Directory When this box is checked, the drive and directory selected in the adjacent listboxes are automatically added to the pattern specified in the File Pattern edit box as you press the Add button.

37

Incremental Searching
List Editing Buttons You may Add, or Delete members of the Source Patterns list. The Invert and Clear buttons assist you in selecting patterns on the list that you wish to delete. Invert reverses the selection; those items that were selected become deselected and visa versa. The Clear button deselects all the patterns on the list so that you can start selecting from scratch.

Incremental Searching
Incremental searches can save time and typing. This is because Codewright searches for the string as you are typing it in, rather than waiting for you to type in the whole word and press (. Many times the search function finds the string you are looking for without you having to type it all in. This results in a little savings of time and effort for you.

ISearch Function
The ISearch function performs the incremental type of search for you. It may already be bound to a key in your keymap, but if not you can easily add such a binding with the Keyboard dialog on the Tools menu. You can check the listings for your keymap in the "Key Commands" chapter of this manual. You begin the search by invoking ISearch; press &%L in the CUA keymap, for example. ISearch prompts you for the search string, and you begin typing. Keep in mind that ISearch always searches in a case-sensitive fashion. The case of the characters you type must agree with the case of the characters in the document, in order to match. When you type the first character, ISearch moves to the next occurrence of that character and highlights it. ISearch performs a search after each character you type, looking for the sequence of characters you have typed thus far. If it doesn't find a match, it issues a beep, and the character you just typed is removed from the search string. If you find you have mistyped, just backspace over the incorrect character or characters. As you remove characters from the search string, the cursor backs up to the position that first matched the characters that remain. Delete the entire search string and you will find yourself at the position where the search began. You cancel ISearch by pressing ;. At that time, the string you typed into ISearch is added to the search response history to make searching for that string again more convenient. You may also use the Quick Search feature to search for the word that is now at the cursor position.

38

Toolbar Search
Quick Search
The Quick Search facility is a function you can use to do an immediate search for the word at the cursor. In the default configuration, you will find this function assigned to the button on the Tool Ribbon, and assigned to the &%T key combination in the CUA keymap. Other assignments may be made, or readily changed.

Toolbar Search
"Toolbar Search" refers to the search capability built into the Tool Ribbon in the form of a drop-down listbox control. This provides the most immediate, convenient way to perform simple searches. To use the Toolbar Search, click in the Toolbar Search edit box and type in the string you wish to search for. This may be a regular expression pattern, if you have regular expressions turned on. Toolbar Search honors all of the settings in the Search Options dialog. As soon as you press (, the search commences. If Codewright finds a match, Toolbar Search will retain the focus. This gives you the opportunity to search again just by pressing ( again. Pressing anything else will cause Toolbar Search to lose the focus, and you are then able to edit at the position where the match was found. Toolbar Search maintains its own response history, to allow you to recall strings or patterns you previously typed. These are available when you select the down arrow to the right of the edit box and the history list drops down.

39

40

Dockable Toolbars and Windows


Codewright supports a number of standard toolbars, as well as allowing for user-defined toolbars. Any of these toolbars can be modified through a simple drag and drop interface. Select Toolbars from the Tools menu to select which are visible and which are not, or to make any other modifications to your toolbars. In addition to toolbars, dockable windows, such as the Output Window and the Project Window are listed here. That is because they use the same docking system and can be made visible or invisible just like a toolbar though they do not contain the same button system.

What Does Dockable Mean?


A dockable window or toolbar can either be attached to one of the edges of Codewrights client area, or it can be free-floating. When the window or toolbar is docked, it reduces the client area, and does not overlay other objects. When free-floating, the window or toolbar may be placed anywhere on the screen and may be resized to most any shape. It will, in all likelihood, partially obscure other objects, however.

Enabling and Disabling Toolbars


Once any dockable toolbar or window is enabled (visible), a shortcut is available for setting the visibility status of any toolbar or dockable window. Click with the right mouse button on any non-button part of the toolbar or windows frame, and a list of currently defined toolbars and dockable windows will pop up. The ones preceded by checkmarks are the ones that are currently visible. You may change the status of any of those listed by selecting it from the list. If no toolbars or dockable windows are currently visible, select Toolbars from the Tools menu, select the desired toolbar from the list and put a check in the Visible checkbox. Press the OK button and the toolbar will become visible.

41

Docking and Moving Toolbars and Windows


Docking and Moving Toolbars and Windows
You can dock or undock a toolbar or dockable window by double clicking on any nonbutton portion of its frame. If it was docked, it will become free-floating. If it was freefloating, it will become docked. The exception is when the toolbar or window has never been docked before, and has no default docking location. In this case it wont know where to dock, and you will need to dock it manually. You can manually dock and undock these objects by dragging them with the mouse. When you drag a free-floating toolbox or window to the edge of Codewrights client area, you will notice a change in the mouse cursor. A small square with a plus sign in it will appear at the base of the arrow. This is to tell you that if you drop the object, it will dock. The outline of the object you are dragging will indicate what orientation it will take when dropped. Dockable windows have a title bar, but dragging them by the title bar disables automatic docking. This is so you can reposition free floating windows without accidental docking. Drag a dockable window by some other part of if its frame or part of its interior (other than a control) and it will automatically dock when over the edge of the client area. To undock a toolbar or window, point the mouse at any non-button portion of the frame, press the left mouse button and drag the mouse. You will see an outline of the toolbar or window appear. Continue to drag the object away from the edge of the Codewright client area, and then drop it where ever you want it. You can then resize and reposition the freefloating toolbar or window at will. If you have multiple toolbars docked along a single edge of the client area, you can use this drag and drop technique to change the order of the toolboxes.

Customizing Toolbars and Buttons


When you select Toolbars from the Tools menu, you receive a dialog with three separate tabs. Use the Select Buttons tab and Bindings tab to customize your toolbars.

Select Buttons
When you select the tab marked Select Buttons, Codewright enters a special mode. The toolbars are temporarily inoperative, but you can drag and drop buttons from the dialog to any toolbar, or even drag buttons from one toolbar to another. You may rearrange

42

Project Window
buttons by dragging and dropping within the toolbar. To remove a button, just drag it off the toolbar and drop it away from any toolbar. If you drag from one toolbar to another, the function bound to that button moves with it. If you drag from the dialog, the button receives the default binding for that button. Use the Binding tab to view or modify these assignments. Default bindings for each button are kept in a resource description file. For example, the default buttons you see in the dialog and their bindings are kept in a file named CWBUTTON.BTN. It is formatted rather like an .INI file, and it tells Codewright about the resources in the DLL file.

Bindings
The Bindings tab lets you change what each button does. You begin using it by selecting a toolbar from the listbox. You can then cycle through the buttons on that toolbar until you get to the one you want to change. The three edit boxes below the toolbar listbox contain the bindings for each the button. The Text button only applies to buttons containing ordinary text not bitmapped images. The Function Binding field contains the function call to be executed when the button is pressed. This function call must conform to the rules of LibFunctionExec, or calling it through the API Command Key. The Tool Tip field contains the message that pops up when the mouse cursor pauses over the button.

Project Window
The Project window is one of the dockable windows provided with Codewright. Like the Output Window, it contains several tabs that let you view different information about your project files and even other files. These tab are: File View Window Outline Window Bookmarks Window Open Window

43

Project Window
File View Window
The File View Window lists the files in the current project in hierarchical form, and lets you operate on files or groups of files. Getting Started with the File View Window Select Properties from the Project Menu, and use the Files tab to add files to your project definition. If you have more than a few files in your project, you will probably find it useful to define some filters for your project, using the Filters tab. This allows the files to be listed hierarchically in the File View Window, rather than just appearing as one long list. For example, let us say that a C language project consists of some .C files, some .H files, a .DEF file, a .RC file, and a .MAK file. You could divide these into three groups by defining three filters: Description Source files Include files Other files File Spec. *.c *.h *.*

Set up this way, you would see three headings in the Project window, Source files, Include files and Other files. The *.c files would be listed under the Source Files heading, the *.h files would be listed under the Include Files heading and the rest of the files would be listed under Other Files. Because of the order in which the filters are defined, the Other Files category only lists the .DEF, .RC and .MAK file. Files are listed only once. If there is any overlap in the file specs of two filters, the intersection will appear in whichever filter category is listed first. File Icons Each file listed in the Project window is preceded by an icon. These icons tell you something about the files. An icon that looks like a page with the corner turned over represents a normal read/write file. If the file is read only, the icon appear in light gray or disabled colors. If the file is not present at the specified location, the icon is followed by an exclamation point.

44

Project Window
Operating on the files You may select any number files listed in the Project Window, using the rules for multiple selection listbox click on a single file, shift click a range of files, or add to the currently selected file with control click. After you have selected the desired files, just press ( to load them for editing. For a list of other operations available, click with the right mouse button on one of the selected files. Set up this way, you would see three headings in the File View Window, Source files, Include files and Other files. The *.c files would be listed under the Source Files heading, the *.h files would be listed under the Include Files heading and the rest of the files would be listed under Other Files. Because of the order in which the filters are defined, the Other Files category only lists the .DEF, .RC and .MAK file. Files are listed only once. If there is any overlap in the file specs of two filters, the intersection will appear in whichever filter category is listed first.

Outline Window
The Outline Window is a hierarchical view of symbols in Project files and any other files that are currently loaded. The references to symbols (usually function names, variable names and the like) are kept in a database that is generated in the background as you work. It does not rely on a database generated by compiling, and therefore works on code that has never been compiled. For many users, this will replace the normal uses of a Browser. Parsers are provided for use with a variety of file types to generate the symbol databases. You can add parsers for use with the output window without compiling. An advanced knowledge of regular expressions, and some development effort is required, however. See the Symbols tab of the Document Language dialog for further information. Using the Outline Window The Outline Window uses the Symbols tab in the Output Window and an edit window to let you investigate the code you are working with. In the window you will see a tree structure with a root for each of the files you currently have open. When you open each root, you will see a list of symbols found in that file, grouped by parser type.

45

Project Window
Symbol Window
Clicking on a filename or root opens that file for editing. A single click on a listed symbol shows references to that symbol in the Symbol Window tab of the Output Window. If there is just one reference in the symbols database, the source code at that location is shown in the Symbol window. If there is more than one reference, a summary of each reference is listed in the Symbol window. You can then select a reference of interest, and view that location in the source code by double clicking on that entry in the list. When you single click on a symbol listed in the Outline window, as described above, the view in your current edit window is not modified. This allows you to browse symbol references without losing your place. If you double-click on a symbol listed under one of the loaded files, your view in the current edit window moves to that location, in addition to listing references in the Symbol Window.

Auto-Expand/Collapse
When this checkbox, at the bottom of the Outline Window, is checked, changing from one document to another will close one list of symbols and open another for the newly current document. This saves a step when you want to view or jump to a symbol location. When the box is not checked, you control when the symbol lists open and close. Supported File Types Parsers are available for the following file types:

File Type .BAS .C .COB .CPP .H .HTML .INI .JAVA .PAS .PRG

Parsers Declare, Function, Sub Function, Define Section, Division Function, Define, Class Function, Define, Class Function Section Function, Class Function, Procedure Function

46

Project Window
These parsers are also available to any file types that have been mapped to the ones above (e.g., .HTM is mapped to .HTML).

Bookmarks Window
The Bookmark Window gives you a view of local and global bookmarks defined in your documents. Clicking on a bookmark moves you to the bookmarks document and location. Although the bookmark database may contain bookmarks for files that are not loaded, only bookmarks found in loaded documents are listed. The contents of the bookmarks database, and other bookmark options are found on the Bookmarks Tab of the Document Preferences dialog. Global Bookmarks Global bookmarks are listed under that heading, regardless of in which document they are found. The entry for the global bookmark shows: the bookmark number, its name, if one was given, and the name of the document in which it is found.

Local Bookmarks Local bookmarks are listed under the name of the document in which they are found. The entry shows: the bookmark number, its name, if one was given.

Double clicking on the document heading makes that document current.

Auto-Expand/Collapse
When this checkbox, at the bottom of the Bookmark Window, is checked, changing from one document to another will close one list of symbols and open another for the newly current document. This saves a step when you want to view a list of bookmarks. When the box is not checked, you control when the bookmark lists open and close.

47

Tabbed Output Window


Open File Window
The Open File Window is like a persistent File Open Dialog and a file manager in one. It a list of icons representing valid drives from which to choose, a directory tree, a place to specify a file filter to limit the files displayed, and a box where matching files are listed. Just double click on any of the files listed and Codewright loads it for viewing or editing. But opening files is just the beginning. There are a total of 17 other operations that you can perform, as represented by a series of icons appearing on the window frame. There are tool tips, small popup messages, that describe each of these. Two of these icons are user definable commands, and you can select which icons are displayed, as well as defining the user commands in the Configuration dialog. The icon that invokes the Configuration dialog is the last in the series of icons. The user commands must be Codewright API function calls, rather than DOS commands or the like. You may, however, execute DOS commands by specifying the API function ExecUserCmnd. Example: ExecUserCmnd Dir In the Configuration dialog, you will also note that you can elect to view hidden files, file timestamps, file sizes and file attributes. The timestamps, file sizes and file attributes only become visible as tooltips, when you pause the mouse cursor over a file in the list box.

Tabbed Output Window


There are a number of windows in Codewright that are not normal edit windows. They contain such things as output from a compiler or OS command, and require special treatment. Codewright has a special output window for these purposes. This section presents some of its special features.

48

Tabbed Output Window

The Codewright output window may be opened explicitly, by selecting the Output item from the Window menu. There may be little to view in the output window, however, until you use one of the features that relies on it. If you use one of these features, the output window will open automatically when needed. Initially, the window uses the bottom portion of the Codewright client area, and effectively reduces it. This is its docked mode. It is convenient when you dont want edit windows overlapping the Output Window. You can view the output window and the file you are editing at the same time.

Select View via Tabs


In a sense, the Codewright output window is several windows of which you can view any one at a time. At the bottom of the Codewright output window, you will note a series of tabs similar in appearance to those you might see on file folders or dividers. These allow you to select between compiler output, File Find, or other output just by clicking on the desired tab. Predefined tabs include: Build, File Find, Search, Browse, Difference, VDOS Shell, and Symbols.

49

VDOS
Associated Dialogs
You can invoke the associated dialog for several of these output windows by using the mouse to right-click on the tab. The tabs that you can click on and their associated dialogs are listed below:

Tab Find Search Difference Symbol

Dialog File Find File Grep File Difference Symbol Menu

The Search dialog also can perform File Greps and sends output to the Search Tab window. See also Browser Support. See the description of VDOS for further information about the Build and Shell tabs.

VDOS
VDOS is a command shell that runs in a Codewright edit window. This facilitates cut and paste, re-executing commands and more. When VDOS is activated, it will intercept output from Compile, Make, Rebuild and other project commands, and put it in the Build buffer. Checking the No shell box next to any of these commands will disable the use of VDOS for that command. You can also directly interact with VDOS through the Shell buffer. You can do most things you might do in a DOS box using the Shell buffer, but there are a few special keystrokes that are also available: Highlight part of a line and press ( to execute it as a command. Highlight part of a line and press )( to copy the text to the command line at the end of the buffer for editing or use in a command. Press 68 or )F to copy the current selection to the clipboard.

VDOS has been tested for compatibility in a number of configurations. It appears to be compatible with Windows for Workgroups V3.11, even with 32 bit disk and file access turned on.

50

VDOS
You may view either the Build or Shell buffer by selecting the appropriate tab on Codewrights tabbed output window. When you first select the Shell tab on the output window, Codewright will automatically activate VDOS. If you are running Windows 3.x, the first time you use VDOS, it will offer to modify your SYSTEM.INI file for you to add a reference to the VxD in requires under 3.x. If you would like to do this yourself, just add a line like the one below to the [386Enh] section of your SYSTEM.INI file: device=c:\cwright\cwvdos.386 If you installed Codewright into a different directory, be sure to substitute the name of that directory for the one shown above. After adding this line, you will need to restart Windows for the change to take effect. Remove references to other redirectors from your command lines when you use VDOS. Programs such as FTEE are not compatible with VDOS.

51

52

Language Features
Codewright Professional's Language features are settings and support that vary with the extension of the file that you are working on. For example, you may want Word Wrap to default to "on" in files with the extension .TXT, but not in files with the .ASM extension. Many features can be turned on or off for any type of file you may be using. There are some features, however, that will only work for languages for which there is built-in support. Language templates and ChromaCoding, for example, require built-in support. You can create built-in support for additional languages, but this is not something you can do on the fly.

Document Settings
Since extensions apply to files, and files are loaded as documents, you will find that most extension specific features are document settings. In Codewright Professional there are two dialogs for document settings, both on the Document menu: the Document Preferences dialog and the Document Language dialog. Since you will find some of the same settings in both of these dialogs, you should note that the difference between the overlapping settings is largely a matter of scope. You control the settings for the current document, the default settings, and all user defined documents by selecting the Document Preferences dialog. Use the Document Language dialog to create settings that effect all documents of a certain file type, as indicated by its filename extension.

Document Language Dialog


When you select the Language dialog from the Document menu, you are looking at the central jumping-off point for controlling Codewright Professional's Language features.

Associating File Types with a Language


Before you start your Language configuration, you should consider if you will need to add or extend language features to file types that Codewright Professional doesn't know about.

53

Other File Type Specific Settings


By default, it knows that files with the extension .C are C language source files. Similarly, it knows about .ASM, .PAS, .CPP, and, if the right DLL is loaded, .SC, .PRG, .BAS and .COB. But what about .A86 or .CAS or even .INC? The first thing to do in the Document Languages dialog is to make sure that all of the file types you expect to be working with are listed in the list box on the left of the dialog. You do this by pressing the New Type button, and then entering the file extension or extensions in the edit box presented. Next, make sure that Codewright knows what programming language they are associated with by mapping the new file types to ones that Codewright is familiar with. Use the Map Type To button to perform this task. Once you have done this, the settings in your new file types will mirror those of the type they have been mapped to.

Other File Type Specific Settings


Almost any setting can be made specific to a certain file type. If you dont see the setting in the Language dialog, you can often place a function call directly in the Extensions file. Your extensions file may be your configuration file, your project file, or another file of your choosing. If you don't know which it is, it is probably your configuration file, but to be sure, check the Store tab on the Document Language dialog.

Editing the Extensions File


As an example, we will imagine that we wish to make the right margin mark extension specific. This is the visual indicator of where a specific column is on the screen. It is generally used as a marker for Word Wrap, when Word Wrap is turned on, but it is also useful if you have to follow a coding standard. It reminds you not to make lines too long. Language settings are stored under headings that incorporate the extension to which the settings apply. The heading we are looking for in our example is [Extension.txt], which is followed by settings that apply to files with the extension .TXT. If you made other settings through the Language Settings dialog for files with the extension .TXT, those settings will also be listed under this heading. If the heading does not already exist, just create it. Here is how the section might look when we are through: [Extension.txt] WinVisibleMarginColumn=70

54

C Language Support
This sets the right margin mark at column 70, for files that have the extension .TXT. This leaves a little margin for our friends who are stuck in 80 column mode. What can you make file type specific? Most things. Just follow this guideline: if you can't set it as a document or window default, don't try and make it extension specific. In that case, it is probably global, and turning on for one extension will turn it on for all. For example, don't try setting the color of warning messages differently for .C files. It will change the color for all warning messages.

Function Definitions Outline


One handy language specific feature is the ability to collapse the body of your functions or subroutines so that you are just looking at a list of function definitions. It is similar to using an outliner in a word processor to look at headings. Then, when you have located a function of interest, you can view the full text of the function at will. This works for a number of different languages. You can access this feature through the Selective Display dialog on the Text menu.

C Language Support
This section contains description of some functions and features that are specifically for C and similar or related languages. These things are not language sensitive, however, since they operate the same way regardless of the extension of the file on which you are using them.

Brace Matching
Brace matching is a function specific to certain programming languages, primarily C and C++. Brace matching support in Codewright comes in several forms: check the current buffer to see that braces are balanced. This form is useful for checking syntax. highlight the text between a set of braces. This form is useful in visualizing the scope of the block defined by the braces and indenting blocks. locate the matching brace and move to it, either momentarily or permanently.

55

C Language Support
These services are performed by functions assigned to keys or buttons. You may wish to customize these assignments or make new assignments. Key assignments may be made through the Keyboard dialog on the Tools menu. Button assignments may be made through the Toolbars dialog also on the Tools menu.

Brace Function There is a function supplied with Codewright that processes the current buffer, looking for unmatched curly braces. By default, the function will ignore any curly braces it finds in C language comments within the file. You can specify that all braces within the file are to be matched.
You invoke the Brace function through the API Command Key. By now, you know that this means pressing in the CUA keymap and in the BRIEF-compatible keymap. If you are using another keymap, you may have to select API Command from the Tools menu. Supposing that you wanted to match all curly braces within a file, you would respond to the Command: prompt in the following manner: Command: Brace TRUE If you wished to ignore braces in comments, you just omit the TRUE parameter, or supply FALSE as a parameter instead. The function shows its progress by displaying the number of the line it is processing on the status line. If the function finds an unmatched curly brace, the cursor is positioned on that curly brace.

Brace Highlighting There are two functions that help you examine or operate on the text between matching curly braces and parentheses. Both of these functions are available on the Codewright Edit toolbar, but may be readily assigned to keys or other buttons.
The first function is BraceMatchNext, which looks for the next left brace or parenthesis, locates its mate, and then highlights the text between them. On subsequent calls, this function will find pairs nested within the highlighted set, or a pair following the highlighted set. The second function is BraceMatch, which operates similarly to BraceMatchNext, except that it searches for a match to the brace at the cursor position. If the curly brace at the cursor is a left brace or parenthesis, the function searches forward for its mate. If it is a right curly brace or parenthesis, the function instead searches backward for the mate. If

56

C Language Support
neither a left nor a right parenthesis or brace is at the cursor position, the function searches forward for the next matching set. Note: Since BraceMatch looks at the current cursor position, it is not effective for highlighting a series of blocks in sequence. On subsequent calls to this function, BraceMatch "finds" the pair that is already highlighted.

If you omit the parameter to this function, it will look for braces only. Passing a non-zero parameter to either of these two functions will cause it to look for matching parentheses in addition to curly braces.

Brace Locating The function BraceFind is provided to allow you to locate the brace, parenthesis, or square bracket that is the mate for the one at the cursor position. It does not create a highlight, but just positions the cursor at the corresponding object. This function is also available on Codewright's Edit toolbar.
The function also has a "kissing" mode that can be activated by giving the function a TRUE or 1 value as a parameter. In this mode, the cursor moves to the corresponding object, but only momentarily. After a brief pause, the cursor returns to its original position. This provides a method of reassuring yourself that you are closing the block or clause you thought you were.

Pre-processed View
This feature is for C users that find their source files cluttered with #ifdefs. Now you can see your source code exactly as the compiler will see it, while you are editing it. Thanks to Selective Display Mode, the whole file is still there, but you don't have to look at the parts that don't apply. Just create your "defines" in the [Definitions] section of the configuration file, or interactively. Then use the Preprocess function in the Selective Display dialog and soon you'll be seeing just what you need to see. Youll find this dialog on the Text menu.

Freedom to #ifdef If you put more than a couple of #ifdefs and related pre-processor commands into a file, you will probably note that the readability of the file has diminished. It can sometimes get difficult, if not impossible, to tell what is "going on" in the file. Don't get us wrong; #ifdefs are very important and useful. If you aren't making extensive use of these preprocessor commands, maybe you should be. Now you can use them without any concern for their down side.

57

C Language Support
If you write applications that are to run on more than one platform, or if you write custom software for more than one company, #ifdefs help you avoid redundant maintenance. If you maintain separate versions of a file for each of several platforms or customers, you will need to change each version whenever you need to improve the code that is common to all of them. You can instead maintain different versions in a single file using #ifdefs. Then, if you have to change the code they share in common, you change it only once. Previously, you may have been reluctant to use a lot of pre-processor conditionals because of how confused the source code begins to appear. Whatever time you saved on redundant maintenance could be lost just trying to figure out confusing source code. Codewright allows you to get the full benefit from the use of pre-processor conditionals by letting you see clearly the code for just what you are working on.

Creating Definitions You use the functions EvalStrAdd and EvalStrDel to define and undefine the symbols you use in your #ifdefs. You can place these calls in your configuration file (CWRIGHT.INI), or execute them through the Command Key. Many times you will want to do a combination of both.
When placing these calls in your configuration file, put them under the heading [Definitions]. As an example of how such a call might appear, a definition of the symbol "MSWINDOWS" is shown below: [Definitions] EvalStrAdd=MSWINDOWS, 0 The meaning of the three parameters to the right of the equal sign are as follows: MSWINDOWS is the label being created. The value assigned to MSWINDOWS is 0. The value assigned to the symbol or label is immaterial, so long as you are using only the #ifdef and #ifndef constructs to evaluate this label.

If later we want to undefine this symbol through the Command Key, here is how we can do it: Command: EvalStrDel=MSWINDOWS

58

Key Commands
The Codewright editor is several editors in one. In its "standard" mode, Codewright is a Common User Access (CUA) compliant editor. If you have ever used a Windows editor before, such as NotePad or SysEdit, you will find that you can guess many of the basic commands. This command set offers a number of short-cut keystrokes to allow you to bypass the menus in most cases. Codewright offers alternate command sets that may be more to the liking of users whose roots are embedded in DOS, Unix and other non-Windows platforms. These alternate command sets imitate the commands used in the BRIEF editor so popular in the DOS development world, Epsilon, an EMACS-style editor, and vi, the standard editor under Unix. We have supplemented these command sets with a number of CUA commands. It should take very little urging to get those who used a similar command set under DOS to give this alternate command set a try. Note: You may occasionally find that you have inadvertently placed Codewright in menu mode by pressing and releasing the key. This commonly happens when you start to issue a command, but fail to carry through. You can tell this has happened when most keys that you type result only in a chirp, and a menu item appears highlighted. Pressing and releasing the key again will toggle you out of this mode.

This behavior is typical of Windows programs, but is made more of a hazard in the BRIEF-compatible keymap, due to its numerous commands that employ the key.

CUA Key Commands


The CUA keymap has many more assignments in it than are covered by the Common User Access standard. In devising these additional keystrokes, we have relied heavily on mnemonics, that is, keys that easily form an association in your memory with the action they perform. This makes the commands easier to learn and remember. If you are familiar with CUA commands, you may doubt that CUA commands would be easy to associate, and some commands are not. (It's hard to associate anything with , you just have to memorize it.) You will find, however, that most commands of this variety have a more memorable equivalent. For example, to search again you have your choice of or ( is find). Two stages of mnemonics are needed for the two stages of learning: Beginner and Advanced.

+  )6V )I

Codewright CUA Variant


In the Beginning
When you are first using a keymap or command set, you need to remember the most common keystrokes that you will use, perhaps, hundreds of times a day. Memory aids at this stage can hasten learning.

The keystrokes that you use most often should require pressing no more than two keys. Since the key is defined in CUA as a System key, very few commands can use that key. The common two key commands are therefore primarily the

key combined with a letter key.

Advanced Stages
It is not long, though, before you perform these common commands quite automatically, and there is no need for memory aids. At this second stage, mnemonics are needed for those once-in-a-while commands. You don't want to stop what you are doing to look up a command you use once every couple of days. If all the best mnemonics are used up by the stage 1 commands, only the more arbitrary assignments remain for the less common commands. The less frequently used commands often require that you press more than two keys. They attempt to maintain an easily remembered association at the expense of pressing another key. For this reason, many of the less common commands are the keys combined with a letter key.

)6

Codewright CUA Variant


The CW CUA keymap is almost identical to the CUA Key Commands with the following exceptions: Search Make line middle Make bottom of window Display Filename Begin exclusive selection Undo Copy to Cut to Paste from

)V )P )D )I )]

60

Persistent Selections
The Codewright (CW) CUA keymap was designed at a time when Microsoft Word for Windows used to save a file. While the CUA keymap demonstrates our desire to keep up with the current interpretation of the standard, we have retained the CW CUA keymap out of respect for those whose fingers have come to rely on these keystrokes. We expect further divergence in the future.

6

Persistent Selections
The CUA convention is to have non-persistent selections. That is, selections disappear whenever you execute a motion command, such as pressing one of the arrow keys. Programmers often find this behavior unfamiliar and limiting. A number of the key assignments in the CUA keymap are ineffective when in this mode, such as toggling a selection open or closed. To assure flexibility, we have added the ability to disable this behavior of CUA. Selections will then not disappear when you move the cursor. You can open and close selections to extend them as you wish. If you wish to have your selections persist, place the following command in your configuration file (CWRIGHT.INI): [Editor] CUA_sel_persist=TRUE To try out persistent selections, you can execute this same command from the API Command key.

Disabling Virtual Space


Another CUA convention is not to allow the cursor to go into virtual space. For example, when you press and hold down the right arrow key in NotePad, the cursor moves from one character to the next. When it reaches the end of a line, it moves on to the first character of the next line. If you click the mouse somewhere to the right of the end of a line, the cursor snaps to the end of the line, rather than where the mouse is pointing. This is not the default behavior for Codewright. Codewright's default action, when you continually press the right arrow, is to move from one column to the next, out past the end of the line, as far as you might like to go. When you click with the mouse, the cursor goes right where you are pointing, even if it is beyond the end of a line. Those who prefer to have Codewright work as closely to CUA conventions as possible may disable cursor travel into virtual space by adding the following line to their configuration file, CWRIGHT.INI:

61

Disabling Virtual Space


[Editor] CUA_enable_virtual=FALSE For more information about configuration files, consult the "Configuration and State" chapter of this manual.

62

CUA Commands by Category


CUA Commands by Category
Document/File
Change output name Close document New document Open file Open file Print Read file into document Save file Save selection/file

Editing
Delete character left Delete line Delete to end of line Delete next word Delete previous word Indent block Insert line Insert next literally Redo Redo Slide-in prompt Slide-out prompt

tuR t tQ t tH tS tuI tV tZ t r q tuO tuE o p tW tR to tp t tr tq

Cursor Motion/Scrolling
Beginning of line Bottom of file Cursor left Cursor right End of line Go to line (prompt) Go to mark (prompt) Line down Line up Make top of window Make middle of win. Page down Page up Scroll down one line Scroll up one line top of file Word left Word right Delete character

Undo Undo Unindent block

tG t u t v t. tT s t\ t! t t] tX uv t tF u
*[

Scrap/Clipboard
Copy to Copy to Cut to Cut to Paste from Paste from Toggle clipb./scrap

u tY t tuL tuN t^ tuP

Search/Replace
Incremental search Kiss matching brace Match brace or paren Multibuf search again

63

CUA Commands by Category


Search/Replace (cont.)
Quick word search Replace again Find Find again

System
API Assistant API interface Auto indent on/off Build current Compact Mode

tuT tuU tI d tL tP tE tO t tuH ur uq up uo tur tuq u u tu tu tuM tuE t [0..9] tuG tuX tD t! t

Selections/Marks
Begin sel., inclusive Begin sel., exclusive Begin selec., column Begin selection, line Close/open Selection Create comment Extend selection left Extend selection right Extend selection up Extend sel. down Extend sel. word left Extend sel. word right Extend sel. begin line Extend sel. end line Extend sel. beg. document Extend sel. end document Format columns Go to mark (prompt) Set mark Lower case selec. Upper case selec. Select all Slide-in prompt Slide-out prompt

Compile document Error list Help Hex Mode Insert mode on/off Load recording file Next error Play stored keys Playback keystrokes Print version Quit Record keys toggle Routines Text Mode Wrap paragraph Write recording file

sb j tuD tj tuF tk tup b tuK th tuo tu[0..9] i tuY se h tuJ tuW tuZ ti te tu tue tuQ tg tuS tu[ sc

Window
Close win. & document Close window only Iconify window Next window Next wind. & document Previous window Toggle visible whsp. Zoom window

64

CUA Commands by Key

CUA Commands by Key

document document

s ...... Undo sb........ API Assistant sc........ Zoom window se........ Quit s ........ Redo ........... Delete character left t........ Close document t........ Close/open Selection t........ Toggle clipb./scrap t^........ Match brace or paren. tD........ Begin column sel. t ...... Delete previous word tF........ Copy to clip/scrap tG........ Delete line t ........ Delete to end of line to........ Scroll down one line tH........ Open file t ........ Go to bottom of file tx ...... Insert line tI........ Find te........ Close wind. & tg........ Next wind. & th........ Load recording file ti........ Write recording file tj........ Build current tk........ Compile document tH........ Open file t ........ Go to bottom of file

document document

tx ...... Insert line tI ........ Find te ........ Close wind. & tg ........ Next wind. & th ........ Load recording file ti ........ Write recording file tj ........ Build current tk ........ Compile document
................ Open file

t ........ Go to top of file tL ........ Begin selec., inclusive t ........ Copy to tO ........ Begin selection, line tr ........ Word left tP ........ Begin selec., exclusive tQ ........ New file tS ........ Print tT ........ Insert next literally tU ........ Replace tq ........ Word right tV ........ Save tur... Extend sel. word left tuq... Extend sel. word right tuo... Next error tu ... Extend sel. beginning
document document

tu ... Extend sel. end of tu... Close window only

65

CUA Commands by Key


tu[0..9]. Play stored keys tuD .. Auto indent on/off tuE .. Go to mark (prompt) tuF .. Compact Mode tuG .. Lower case sel. tuH .. Create comment tuI .. Read file into doc tue .. Iconify window tuJ .. Routines tuK .. Hex Mode tuL .. Incremental search tuM .. Format columns tuN .. Kiss matching brace tuO .. Go to line (prompt) tuP .. Multi-document search
again

tuQ .. Next window tuR .. Change output name tuS .. Previous window tuT .. Quick search for word tuU .. Replace again tuV .. Search again tuW .. Text Mode tup .. Show errors tuX .. Upper case sel. tuY .. Print version tuZ .. Wrap paragraph tu[ .. Toggle visible whsp. tW........ Make line top of win. tX........ Undo tY........ Paste from clip/scrp tp........ Scroll up one line tZ........ Write selection/file

t[ ........ Cut to clip/scrp t\ ........ Redo t] ........ Begin excl. sel. t! ........ Slide-in prompt t ........ Slide-out prompt t[0..9] ........ Set mark ............. Delete character o ............. Line down .............. Go to end of line b ............. Help d ............. Search again h ............. Record keys toggle i ............. Playback keystrokes j ............. API interface ............. Beginning of line ............. Insert mode on/off r ............. Cursor left ............. Page down ............. Page up q ............. Cursor right u ....... Delete next word u ........ Cut to u ........ Extend sel. beginning line u ........ Extend sel. end of line u ........ Save file u ........ Paste from ur ........ Character left uq ........ Character right uv ...... Backtab/unindent v............ Tab/indent p ............. Line up t! ........ Slide-in prompt t ........ Slide-out prompt

66

Making CUA Key Assignments

Making CUA Key Assignments


If you have occasion to add or modify key assignments in the CUA keymap you will notice that two functions seem to be assigned to many of the keystrokes. This section of the manual describes what you are seeing to better enable you to make key assignments of your own. There are three pass-through functions that are used to give the CUA keymap consistency. These functions are CUA_motion, CUA_deletion and CUA_selection. You will note that the key assignments that look like they have two functions assigned to them usually begin with one of these functions. The second function is actually a parameter of the first function call. It is called by the pass-through function.

The CUA_selection Function CUA Keystrokes that extend the current selection or create a new selection use the CUA_selection function. The functions that are in turn called by the CUA_selection function are, for the most part, ordinary motion commands. The pass-through function manages the creation and opening or closing of the selection. The CUA_deletion Function The CUA_deletion function manages the process of replacing a selection with what is typed or inserted. This behavior is part of the CUA standard. The function deletes the contents of a selection, if there is one, and then calls the inserting function to allow the insertion to take place. The CUA_motion Function As part of the CUA standard, a selection is removed, if an ordinary motion command is typed. Keystrokes that operate in this way pass the motion command through the CUA_motion function to allow it to remove a selection, if necessary.
There is also a pass-through function for CUA mouse commands, named CUA_mouse. This function manages the creation of mouse selections in a way that maintains compatibility with the other pass-through function that use selections.

CUA Keymap Functions


This section describes the major functions defined and used in the CUA keymap. You will find this listing useful when you want to change or add key assignments.

67

CUA Keymap Functions


The functions are listed here in much the same fashion that they would be used in key assignments. The same form may be used when executing these commands through the API Command Key. Parameters are enclosed in angle brackets, < and >. You must replace the angle brackets and their contents with your value. Parameter names that are enclosed in single quotes are strings. You may need to enclose your string in single quotes, too -- especially if the string contains whitespace. Numeric parameter names are preceded by a type. CUA_attach Toggle whether the cursor is tied to the selection or moves independently. CUA_auto_indent Toggles auto indent off or on. CUA_backspace If a selection is defined, the selection is deleted. Otherwise, the preceding character is deleted. CUA_back_tab Move to the preceding tabstop, or, if a selection is defined, unindent the selection to the preceding tabstop. CUA_copy Copies the current selection, if any, to the scrap buffer. CUA_cut Cuts the current selection to the clipboard or scrap buffer. CUA_delete Deletes the current selection, if defined, otherwise deletes the character at the cursor. CUA_delete_curr_buffer Delete the current document, prompting for save if modified.

68

CUA Keymap Functions


CUA_delete_curr_window Delete the current window, but not the document, unless "one document per window" is on. CUA_deletion <'func'> Delete the current selection, if any, and then execute the named function. CUA_drop_bookmark <int num> Place a numbered global bookmark at the current position. CUA_edit_file Load a file for editing. CUA_edit_next_window Selects the next window in the window list and displays its name. CUA_edit_prev_window Selects the previous window in the window list and displays its name. CUA_end_of_buffer Go to the last character of the last line of the document CUA_end_of_window Synonym for MovEndWin. CUA_esc Changes the display mode to normal, otherwise it removes the current selection, if any. CUA_exit Exit with query to save modified documents.

69

CUA Keymap Functions


CUA_goto_bookmark <int num> Prompt for a bookmark number 1-10 and then go there. CUA_left_side Go to the first column visible at the left of the screen. CUA_make_window_icon Minimize the current window. CUA_mark <int mark_type> Starts a selection of the specified type. If selection already exists, it is removed if the old and new selection are the same type. The type of the existing selection is changed, if they are not the same. CUA_motion <'func'> Removes an existing selection before calling the named function. CUA_mouse <'func'> Identifies the operation as a mouse operation before executing the named function. CUA_mouse_selextend <int seltype>

Extends an existing selection to the current mouse position. CUA_next_winbuf Selects the next window, unless there is only one, in which case it selects the next document. CUA_open_line Inserts a new line at the end of the current line. CUA_playback Plays back the current keystroke recording.

70

CUA Keymap Functions


CUA_QPersistSel Reports whether persistent selections are on or off. CUA_quote Inserts the next key literally, rather than processing it as a command. CUA_read_file Inserts a file at the cursor position, after prompting for the name. CUA_remember Toggles recording of keystrokes. CUA_right_side Moves to the last visible column at the right of the window. CUA_search_again Repeat the last search operation using the same parameters. CUA_search_back Set the direction of search to backward. CUA_search_fwd Set the direction of search to forward. CUA_selection <'func'> Used to exec functions that extend an existing selection, this function reopens the existing selection. CUA_self_insert <int ch> Inserts a specified character, or the key just pressed if none is specified.

71

CUA Keymap Functions


CUA_sel_persist <BOOL persist_on> Sets persistent selections feature to the state of the parameter. CUA_shiftpage <int direction> Pages the text in the window horizontally. Left if the parameter is a negative number, right if it is positive. CUA_tab Inserts a tab character or equivalent spaces, or indents a block, if defined. CUA_tab_use Toggles the use of tab characters or equivalent spaces on or off. CUA_toggle_clipscrap Toggle between using the Windows clipboard or a scrap buffer. CUA_top_of_buffer Move to the first character of the first line in the document. CUA_top_of_window Move to the last character of the last line in the document. CUA_translate Perform a search and replace operation. CUA_translate_again Repeat a search and replace operation using the previous settings. CUA_translate_back Perform a replace operation in a backward direction.

72

CUA Keymap Functions


CUA_translate_fwd Perform a replace operation in a forward direction. CUA_write_and_exit Save all modified documents to disk and exit the program. PlaybackRecStr <int StrNum> Playback one of the numbered keystroke recording strings used by the Playback Strings dialog.

73

Advanced Stages

BRIEF Key Commands


BRIEF key commands are not CUA compliant. This means that they conflict with the way Windows commands normally work. For example, the BRIEF commands make extensive use of + key combinations. CUA rules reserve most of these for standard commands, such as accessing menus. For instance, +I is usually reserved for bringing down the File menu. In BRIEF, this is used for displaying the output file's name on the status line. For this reason, when using the BRIEF command set, you must press and release the + key to access the menu. To access the File menu, for example, you press and release the + key and then press I. Similarly, to access other menus, you press and release + and then press the underlined letter in the menu's name.

74

BRIEF-compatible Commands by Category

BRIEF-compatible Commands by Category


Note: Gray keys indicate keys located on the keypad.

Buffer/File
Change output name Close buffer Display filename List of buffers Next buffer Open file Previous buffer Print buffer Read file into buffer Save file Write selection to file

Cursor Motion/Scrolling (cont.)


Make bottom of win. Make top of window Make center of win. Page down Page up Right wind. edge Scroll down 1 line Scroll up 1 line Top of file Top of file Top of window Top of window Word left Word right

sR t s) sE sQ sH s sS sU sZ sZ

tE tW tF u tG tX t t tr tq

Cursor Motion/Scrolling
Beginning of line Bottom of file Bottom of file Bottom of window Bottom of window Column left Column right End of line Go to line (prompt) Go to mark (prompt) Left window edge Line down Line up

t t r q sJ sM u o p

Editing
Delete character Delete character to left Delete line Delete to end of line Delete next word Delete previous word Indent block by tab Indent block by space Insert line Insert next literally Redo

sG sN s t v tx sT s\

75

BRIEF-compatible Commands by Category


Editing (cont.)
Slide-in Prompt Slide-out Prompt Undo Undo Unindent block by tab

Selections/Marks
Begin selec., inclusive Begin selec., exclusive Begin selec., column Begin selection, line Close/open Selection Go to mark (prompt) Set mark

t! t sX uv t u

Scrap/Clipboard
Copy to Cut to Copy to Cut to Paste from Toggle clipb./scrap

sP sD sF sO tD sM sn k tZ sk tJ ux tQ tS sK sL j sh i sS sY s[ t[ h tU s]

System
API interface Backups on/off Compile buffer Display routines Expand/Collapse Next error Show errors Help Insert mode on/off Load DLL Load recording file Playback keystrokes Print buffer Print version Quit w/prompt Quit w/write Record keys toggle Repeat key action Shell Text Mode

t tf tuN tuT tuP tg sW g ug f sV uf

Search/Replace
Ignore case on/off Kiss matching brace Quick search for word MultiBuf Search again Reg. expr. on/off Replace Replace Replace again Search Search Search again

76

BRIEF-compatible Commands by Category


System (Cont.)
Unload DLL Write recording file

uj si sb d e c u u u b u sc

Window
Borders on/off Create tiled edge Delete tiled edge Resize window Select win. at left Select win. at right Select win. above Next window Select win. below Zoom window

77

BRIEF Compatible Commands by Key


BRIEF Compatible Commands by Key s ............... Previous buffer sD ............... Mark exclusive block sE ............... Buffer list s .......... Delete word at right sF ............... Mark column block sG ............... Delete line sH ............... Load new buffer sI ............... Show output filename sb ............... Window borders toggle sk ............... Compile current buffer. sc ............... Zoom in/out on window sf ............... Search backward sg ............... Replace backwards sh ............... Save keystroke file si ............... Load keystroke file sJ ............... Go to line no. sK ............... Help index sL ............... Insert mode toggle sM ............... Go to bookmark sN ............... Delete to end of line sO ............... Mark block of lines sP ............... Mark inclusive block sQ ............... Next buffer sR ............... Change output filename sS ............... Print buffer

sT ............... Insert key literally sU ............... Read block from file sV ............... Search forward sW ............... Replace forwards sX ............... Undo last edit sY ............... Show program version sZ ............... Write block to file sZ ............... Write buffer to file s[ ............... Quit with query save s\ ............... Redo last Undo s] ............... OS Shell sn.................. Set bookmark
................. Delete character left

t! ............... Slide-in Prompt t ............... Slide-out Prompt t ............... Delete current buffer tD ............... Toggle block attach tE ............... Scroll to wind. bottom t .......... Delete word at left tF ............... Scroll to window center tG ............... Scroll down a line t .............. Bottom line of window tx ............. Open new line tf ............... Ignore case toggle tg ............... Regular expr. toggle tJ ............... Display routines t ............. Top line of window tr ............... Previous word

78

BRIEF Compatible Commands by Key


tQ ............... Next error position tS ............... Show errors t .......... End of buffer t .......... Top of buffer tU ............... Repeat key action tq ............... Next word tuF ........ Compact mode tuK ........ Hex mode tuN ........ Kiss matching brace tuP ........ MultiBuf Search again tuT ........ Quick search for word tW ............... Scroll to window top tX ............... Scroll up a line tZ ............... Backup file toggle t[ ............... Write buffers and exit
................... Delete block ................... Delete char. at cursor

j ................ Preload DLL ............... Beginning of line .......... Top of window


....... Top of buffer .............. Insert scrap ............... Copy block to scrap ............... Cut block to scrap ............... Undo

o ...................... Line down


.................... End of line .............. End of window ........ End of buffer

x.................... Insert new line b ................ Next window k ................ API interface c ................ Resize window d ................ Create tiled edge e ................ Delete tiled edge f ................ Search forward g ................ Translate forward h ................ Record keys toggle i ................ Play recorded keys

r ................ Column left ............ Page down ............ Page up q ................ Column right u .......... Right edge of window ux ......... Expand/Collapse uf ........... Search again ug ............... Replace again uj ............... Unload DLL u ............. Left edge of window u ............. Select adjacent win. u ............. Select adjacent win. u ............. Select adjacent win. u ............. Select adjacent win. uv ............. Outdent block by tab
................. Indent block by space

v .................... Indent block by tab p ...................... Line up

79

Brief Keymap Functions


Brief Keymap Functions
This section describes the major functions defined and used in the Brief keymap. You will find this listing useful when you want to change or add key assignments. The functions are listed here in much the same fashion that they would be used in key assignments. The same form may be used when executing these commands through the API Command Key. Parameters are enclosed in angle brackets, < and >. You must replace the angle brackets and their contents with your value. Parameter names that are enclosed in single quotes are strings. You may need to enclose your string in single quotes, too -- especially if the string contains whitespace. Numeric parameter names are preceded by a type. BR_adjacent_window <int direction> Select a new current window with the arrow keys BR_attach Toggles the current selection between being attached to the cursor or unattached. BR_backspace Brief-style backspace. Won't backspace beyond the beginning of the line. BR_beginning_of_line Synonym for MovHome(). BR_borders Toggles window borders on an off. BR_copy Copies the selection to scrap. If no selection, copies current line. BR_create_edge Split the current window, creating a new window in the indicated direction. BR_cut Cuts the selection to scrap. If no selection, cuts current line. BR_delete Deletes the current selection. If no selection, deletes character at the cursor.

80

Brief Keymap Functions


BR_delete_curr_buffer Deletes the current buffer unless it is the last one. BR_delete_edge Delete adjacent window and expand current window to occupy its space. BR_delete_macro Delete a macro by unloading its DLL. BR_del_to_BOL Delete from the cursor position to the beginning of the line. BR_drop_bookmark <int num> Place a numbered global bookmark. BR_edit_file Load a file. BR_end_key Brief's overworked End key. End (End of line), End-End (End of Screen), EndEnd-End (End of file). BR_end_of_buffer Go to the last character of the last line. BR_end_of_line Synonym for MovEOL() BR_end_of_window Move to the last character on the last line visible on the screen. BR_esc Return to normal display mode. Otherwise, insert and escape character. BR_exit Brief's standard exit. Prompts [ynw] if any buffers contain unsaved changes. BR_goto_bookmark <long num> Move to a numbered global bookmark. BR_home_key Brief's overworked Home key. Home (beginning of line), Home-Home (beginning of screen), Home-Home-Home (beginning of file)

81

Brief Keymap Functions


BR_left_side Move to the first visible column at left of screen BR_load_macro Load a DLL. BR_mark <int mark_type> Drop an anchor, using Brief's selection types. BR_open_line Open a new line at the end of the current one. BR_playback Playback the keystroke recording. BR_print Invoke the print dialog. BR_quote Insert the next character literally, without interpreting it. BR_read_file Read a file from disk into the buffer at the current position. BR_remember Toggle recording of keystrokes. BR_right_side Move the cursor to the last column visible at the right of the screen. BR_search_again Repeat the last search operation using the same parameters. BR_search_back Set the direction of search to be backward. BR_search_case Toggles case sensitivity on and off in searching BR_search_fwd Set the direction of search to be forward.

82

Brief Keymap Functions


BR_set_backup Toggles backups on or off for all existing buffers. BR_set_mode <int mode> Select between display modes: 1 = Normal ASCII, 2 = Compact, 3 = Hex (if already in hex, toggles between hex and ASCII columns.) BR_tab Inserts a tab character or equivalent spaces, or moves to the next tab stop when in overtype mode. BR_toggle_clipscrap Toggle the use of the Windows clipboard or the current scrap buffer. BR_toggle_re Toggles on or off the use of regular expressions in a search pattern. BR_top_of_buffer Moves to the first character of the first line in the buffer. BR_top_of_window Move to the first character of the first line in the window. BR_translate Perform a replace operation after prompting for parameters. BR_translate_again Repeat the last replace operation using same parameters. BR_translate_back Perform a replace operation in a backward direction. BR_translate_fwd Perform a replace operation in a forward direction. BR_write_and_exit Write all modified buffers to disk and exit the program.

83

Vi Modes

VI Key Commands
In the commands listed below, escape key.

( stands for carriage return and ; stands for the

Vi Modes
Command Input Initial (Normal) mode. Other modes normally return to command mode upon completion. (escape) is used to cancel a partial command. Enter this mode by setting any of the following options: a A i I o 0 c C s S R. You may then enter arbitrary text. This mode is normally terminated by pressing ;. Reading input for : / ? or !; terminated by typing a (.

Last line

VI Command Summary
Examples
/text ................................................search for text :cmd ...............................................ex or ed command ..................................................quit, discarding changes :q! ^U ^D ....................................................scroll up or down 3dd.........................................................delete 3 lines ..............................................change word to new cwnew dd...........................................................delete a line dw..........................................................delete a word eas ....................................................plurals word (end of word; append s; escape from input state) h i k l .....................................................same as arrow keys, respectively ..................................................insert text itext ...............................................arrow keys move the cursor u.............................................................undo previous change x.............................................................delete a character ZZ..........................................................exit vi, saving changes

( ( ( ;

; 4<=5

84

VI Command Summary
Count Arguments
Numbers may prefix some commands, They are interpreted in one of these ways.
line/col number......................................z G I scroll amount.........................................^D ^U repeat effect ...........................................most of the rest

File Operations
:!cmd .............................................run cmd, then return .................................................edit alternate file :e # ......................................edit, starting at end :e + name ..............................................edit starting at line n :e +n ..........................................edit file name :e name :e! # ...............................................edit alternate file, discard changes ..................................................reload, discard changes :e! ...........................................specify new arglist :n args ...................................................edit next file in arglist :n ..................................................quit, discard changes :q! ...................................................quit :q ..................................................run shell, then return :sh ............................................position cursor to tag :ta tag :w name .........................................write file name :w! name ........................................overwrite file name :w! .................................................forced write, if permission originally not valid ...................................................write back changes :w ^G..........................................................show current file and line ZZ..........................................................if file modified, write and exit; otherwise, exit

( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (

In general, any command word (such as substitute or global) may be typed, preceded by a colon and followed by a carriage return.

Cursor Motion
h or ...................................................backward $.............................................................end of line ( .............................................................back a sentence ( .............................................................beginning of sentence ) .............................................................end of sentence ) .............................................................to next sentence + ............................................................next line, at first non-white

85

VI Command Summary
- .............................................................previous line, at first non-white [[ ............................................................previous section/function ]] ............................................................next section/function ^.............................................................first non white-space character ^B ..........................................................backward screen ^D..........................................................scroll down half screen ^F...........................................................forward screen ^H..........................................................same as backspace ^U..........................................................scroll up half screen {.............................................................back a paragraph {.............................................................beginning of paragraph }.............................................................end of paragraph }.............................................................to next paragraph 0.............................................................beginning of line B ............................................................back a blank-delimited word b.............................................................back a word E ............................................................end of a blank-delimited word e.............................................................end of word ......................................................return, same as + H............................................................top line on screen l or ....................................................forward L ............................................................last line on screen M ...........................................................middle line on screen n.............................................................repeat last or ? command N............................................................reverse last or ? command n|............................................................move to column n nG..........................................................go to the beginning of the specified line (end default), where n is a line number space......................................................same as space bar W...........................................................forward a blank-delimited word w............................................................forward a word or j ....................................................next line, same column or k ...................................................previous line, same column

( 5

< =

Searching
,..............................................................repeat inverse of last f F t or T % ...........................................................find matching ( ) { or } /pat ........................................................next line matching par /pat/+n...................................................n-th line after pat ............................................move pat line to bottom of window /pat/z; .............................................................repeat last f F t or T ?pat........................................................previous line matching pat ?pat?-n...................................................n-th line before pat a.............................................................append after cursor

86

VI Command Summary
A............................................................append at end of line fx............................................................find next x Fx...........................................................find previous x i .............................................................insert before cursor I .............................................................insert before first non-blank Rtext; ...............................................replace characters rx............................................................replace single char with x Tx .......................................................... move to character following previous x tx............................................................move to character prior to next x

Scrolling
^E ..........................................................scroll window down 1 line ^L ..........................................................clear and redraw window ^R ..........................................................clear and redraw window if -L is - key ^Y..........................................................scroll window up 1 line ...................................................redraw screen with current line at bottom of window z....................................................redraw screen with current line at center of window z. .....................................................redraw screen with current line at top of window z ..................................................use n-line window zn.

( ( ( (

Bookmarks
mx..........................................................mark current position with the ASCII lower-case letter x `x............................................................move cursor to mark x 'x ............................................................move cursor to first non-white space in line marked by x

Editing (Insert Mode)


^H..........................................................erase last character (backspace) ^W .........................................................erase last word erase.......................................................your erase character, same as ^H (backspace) \ .............................................................quotes your erase and kill characters ; .......................................................ends insertion, back to command mode .......................................................interrupt, terminates insert mode ^D..........................................................backtab one character; reset left margin of autoindent ^^D ........................................................caret (^) followed by control-d (^D); backtab to beginning of line; do not reset left margin of autoindent O^D .......................................................backtab to beginning of line; reset left margin of autoindent ^V..........................................................quote non-printable character o.............................................................open line below O............................................................open above

87

VI Command Summary
Operators
Operators are followed by a cursor motion, and affect all text between the cursor's starting and ending position. For example, since w move's over one word, dw deletes the word that would be moved over. Double the operator, e.g., dd to affect whole lines.
! .............................................................fitter through command < ............................................................left shift > ............................................................right shift c.............................................................change d.............................................................delete y.............................................................yank lines to buffer

Miscellaneous Operations
C ............................................................change rest of line (c$) D............................................................delete rest of line (d$) J .............................................................join lines s .............................................................substitute chars (cl) S ............................................................substitute lines (cc) x.............................................................delete characters (dl) X............................................................delete characters before cursor (dh) Y............................................................yank lines (yy)

Yank and Put


Put inserts the text most recently deleted or yanked; however, if a buffer is named (using lower-case letters), the text in that buffer is put instead.
"xd .........................................................delete into buffer x "xp .........................................................put from buffer x "xy .........................................................yank to buffer x 3yl .........................................................yank 3 characters 3yy.........................................................yank 3 lines p.............................................................put back text after cursor P ............................................................put back text before cursor

Undo, Redo, Retrieve


"dp .........................................................retrieve dth last delete ...............................................................repeat last change U............................................................restore current line u.............................................................undo last change

88

EX Command Words Supported


Codewright Extensions  #  
Context sensitive help ASCII Editing mode Selective Display mode Hex Edit mode API Command Key

EX Command Words Supported


! & < = > appe nd cc cd chan ge chdi r copy delet e edit errli st ex file glob al inser t join k list make mark move next number previous print put quit read rewind set shell substitute tag to undo version vglobal visual wq write xit yank

89

Epsilon Keymap Functions


Epsilon Key Commands
Epsilon Emulation Commands by Category Note: Gray keys indicate keys located on the keypad. Buffer/File
Bufed Copy to file Kill buffer Next buffer Next buffer Previous buffer Previous buffer Save all buffers Save file Select buffer Visit file Write file

Cursor Motion/Scrolling
Backward sentence Backward sentence Backward word Backward word Beginning of line Beginning of line

t[,tE th t[,N t[,! t[, t[,V t[,tV t[,E t[,tY t[,tZ r tE s tsE s> sp

sD tp sE tr sr tD s tO o tQ sq tH s q tI tsI s@ so

Beginning of window Beginning of window Center window Down line Down line End of line End of line End of window End of window Forward character Forward character Forward level Forward paragraph Forward paragraph

Cursor Motion/Scrolling
Backward character Backward character Backward kill level Backward level Backward paragraph Backward paragraph

90

Epsilon Keymap Functions


Cursor Motion/Scrolling
Forward sentence Forward sentence Forward word Forward word Go to beginning Go to end Goto beginning Goto end Goto line Next page Next page Next position Previous page Previous page Previous position Scroll down Scroll left Scroll right Scroll up To indentation Up line Up line

Editing
Backward delete character Backward delete character Backward kill word Capitalize word Center line Delete blank lines Delete character Delete character Delete horizontal space Enter key Fill paragraph Indent for comment Indent previous Indent region Indent rigidly Indent under Insert ascii Insert file Kill level Kill line Kill Region Kill sentence Kill word

sH to sI tq t t s s! t[,J tY t[,tQ sY t[,tS s] s^ s` t] sP p tS

tK t" tsK sF sV t[,tR tG s? tP sT s tL ts? t[,tL tsL s t[,L tsN tN tZ sN sG

91

Epsilon Keymap Functions


Editing (cont.)
Lowercase word Maybe break line Open line Overwrite mode Quoted insert Redo Redo Redo changes Redo changes Transpose characters Transpose lines Transpose words Undo Undo Undo changes Undo changes Uppercase word

Search/Replace
Find delimiter Incremental search Query replace Query replace

sO tM tR tT t[,U k tk t[,tU tW t[,tW sW t[,X j tj t[,tX sX tsZ sZ t[,[ t[,\ t\ s\

Regex replace Regex replace Regex search Replace string Reverse incremental search Reverse regex search Select tag file tag files

s tV s sU s s tsV s tU tsU t[,s t[,s t[,t[ t[,tK sM sK t[, s t# s

Selections/Marks
Exchange point and mark Highlight region Jump to last bookmark Mark paragraph Rectangle mode Set bookmark Set mark Set mark

Scrap/Clipboard
Append next kill Copy region Copy to scratch Insert scratch Yank Yank pop

92

Epsilon Keymap Functions


Selections/Marks
Set named bookmark Tabify region

System
End kbd macro Exit Exit level Find file Goto tag Grep

Untabify region Write region

t[, t[, tsL t[,sL t[,Z tJ t> t[,t> tX s s e h sa tc t[,O tA tsA t[, tsA t[,tA t[,G

System
Abort Alt prefix Alt prefix Argument Argument Argument Bind to key cd Change modified Compare windows Count lines Ctrl prefix Ctrl prefix Ctrl prefix

Help Help Last kbd macro Last kbd macro Load bytes Make Name kbd macro Named command Named command Pluck tag Push Set comment column Set fill column Set variable Show bindings Show menu Show variable

Ctrl prefix Dired

t[, t[,tF t[,t] t[,tI t[, sh tB b te t[,H d t[,P t[,sQ s[ c t[, t[,tH t[, t[,I i f sc ti

93

Epsilon Keymap Functions


System
Start kbd macro Start process Stop process What is Write state

Window
One window Previous window Previous window Shrink window Shrink window horizontally Shrink window interactively Shrink window interactively Split window Split window vertically Zoom window

t[, t[,tP tF g td
Window

t[, t[,S s t s t[, t,[ t[, t[, t[,]

Enlarge window Enlarge window Enlarge window Enlarge window horizontally Enlarge window horizontally Enlarge window interactively Enlarge window interactively Kill window Kill window Move to window Move to window Move to window Move to window Next window Next window Next window

t[,A t t[,A s t[,# t[, t[, t[,tG t[, t[,o t[,r t[,q t[,p t[,Q t[,R s

94

Epsilon Keymap Functions


Epsilon Emulation Commands by Key

r o q p

............ Backward character ............ Down line ............ Forward character ............ Up line ............ Delete character ............ Beginning of window ............ Overwrite mode ............ End of window b ............ Help c ............ Named command d ............ Load bytes e ............ Bind to key f ............ Show bindings g ............ What is h ............ cd i ............ Set variable j ............ Undo k ............ Redo ............. Previous buffer ............ Next buffer ............ Next page ............ Previous page sp ....... Backward paragraph sr ....... Beginning of line sq ....... End of line so ....... Forward paragraph

horizontally

s s s s sa s> s@ s? s s s s s s s

....... Argument ....... Argument ....... Beginning of window ....... Regex replace ....... Change modified ....... Backward paragraph ....... Forward paragraph ....... Delete horizontal space ....... End of window ....... Find delimiter ....... Goto beginning ....... Backward kill level ....... Next window ....... Previous window ....... Shrink window ....... Enlarge window ....... Show menu ....... Grep ....... Goto end ....... Help ....... Indent for comment ....... Query replace ....... Insert ascii

horizontally

s sc sh s! s" s s s

95

Epsilon Keymap Functions


s# s s s s^ s` sD sE sF sG sH sI sK sM sN sO sP sT sU sV sW sX sY sZ ....... Set mark ....... Regex replace ....... Replace string ....... Set bookmark ....... Scroll left ....... Scroll right ....... Backward sentence ....... Backward word ....... Capitalize word ....... Kill word ....... Forward sentence ....... Forward word ....... Mark paragraph ....... Jump to last bookmark ....... Kill sentence ....... Lowercase word ....... To indentation ....... Fill paragraph ....... Query replace ....... Center line ....... Transpose words ....... Uppercase word ....... Previous page ....... Copy region s[ ....... Named command s\ ....... Yank pop s] ....... Scroll down tp ........ Backward sentence tr ....... Backward word tq ....... Forward word to ....... Forward sentence t ....... Goto beginning t ....... Goto end t ....... Shrink window t ....... Enlarge window tc ....... Compare windows td ....... Write state te ....... Last kbd macro th ....... Copy to file ti ....... Show variable tj ....... Undo changes tk ....... Redo changes tB ....... Help t# ....... Set mark t> ....... Alt prefix t" ....... Backward delete character tA ....... Ctrl prefix tD ....... Beginning of line

96

Epsilon Keymap Functions


tE tF tG tH tI tJ tK tL tM tN tO tP tQ tR tS tT tU tV tW tX tY tZ t\ t] ....... Backward character ....... Stop process ....... Delete character ....... End of line ....... Forward character ....... Abort ....... Backward delete character ....... Indent previous ....... Maybe break line ....... Kill line ....... Center window ....... Enter key ....... Down line ....... Open line ....... Up line ....... Quoted insert ....... Reverse incremental search ....... Incremental search ....... Transpose characters ....... Argument ....... Next page ....... Kill Region ....... Yank ....... Scroll up tsA .. Ctrl prefix ts? .. Indent region tsE .. Backward level tsI .. Forward level tsK .. Backward kill word tsL .. Indent under tsN .. Kill level tsU .. Reverse regex search tsV .. Regex search tsZ .. Append next kill t[,o ... Move to window t[,r ... Move to window t[,q ... Move to window t[,p ... Move to window t[, .. End kbd macro t[,A .. Enlarge window t[,# .. Enlarge window
horizontally

interactively

t[, .. Enlarge window


interactively

t[, t[,
interactively

.. Enlarge window .. Shrink window

t[, .. Set named bookmark t[, .. Show point

97

Epsilon Keymap Functions


t[, .. Shrink window
interactively

t[, t[, t[, t[, t[, t[, t[,F t[,! t[, t[, t[, t[, t[,E t[,G t[,H t[,I t[,J t[,L t[,M t[,N t[,O t[,P

.. Start kbd macro .. Goto tag .. Kill window .. One window .. Split window .. Split window vertically .. Compare windows .. Next buffer .. Pluck tag .. Previous buffer .. Rectangle mode .. Set comment column .. Select buffer .. Dired .. Last kbd macro .. Set fill column .. Goto line .. Insert file .. Jump to named bookmark .. Kill buffer .. Count lines .. Make

t[,Q .. Next window t[,R .. Next window t[,S .. Previous window t[,U .. Redo t[,V .. Save all buffers t[,X .. Undo t[,Z .. Write region t[,[ .. Copy to scratch t[,\ .. Insert scratch t[,] .. Zoom window t[,s .. tag files t[,s .. Select tag file t[,sL .. Untabify region t[,sQ .. Name kbd macro t[,t> .. Alt prefix t[,tA .. Ctrl prefix t[,tE .. Bufed t[,tF .. Exit t[,tG .. Kill window t[,tH .. Push t[,tI .. Find file t[,tK .. Highlight region t[,tL .. Indent rigidly t[,tP .. Start process t[,tQ .. Next position

98

Epsilon Keymap Functions


t[,tR t[,tS t[,tU t[,tW t[,tV t[,tX t[,tY
Delete blank lines Previous position Redo changes Transpose lines Save file Undo changes Visit file

t[,tZ Write file t[,t[ Exchange point and mark t[,t] Exit level t[,tsA Ctrl prefix t[,tsL Tabify region

Epsilon Keymap Functions


This section describes the major functions defined and used in the Epsilon keymap. You will find this listing useful when you want to change or add key assignments. The functions are listed here followed by a terse description of each. EPSAltPrefix reads the next character as an alt character EPSAppendNextKill causes the next kill command to append to the previous kill buffer. An append will occur ONLY of the next IMMEDIATE command is a kill command. EPSArgument will set the global argument variable. Assumes input of Ctrl-U, Alt--, or Alt-0 through Alt-9. Any other input will result in bizarre argument values. EPSAutoFillMode switches in and out of fill mode EPSBackwardCharacter backs up in the buffer towards the start of the buffer EPSBackwardDeleteCharacter deletes characters towards the start of the buffer

99

Epsilon Keymap Functions


EPSBackwardKillWord removes all characters to the beginning of the word closest to the cursor towards the start of the buffer. EPSBackwardParagraph moves the cursor to the previous paragraph EPSBackwardSentence moves the cursor to the previous sentence EPSBackwardWord move back in the buffer by words. EPSBeginningOfLine moves the character to the beginning of the current line. EPSBeginningOfWindow moves the cursor to the top left of the current window. EPSBindToKey starts the key binding dialog box EPSBufed starts the buffer selection dialog EPSBufferInit will set buffer specific variable for emulation and is executed on buffer creation. This is an EVENT_BUFFER_CREATED event handler. EPSCapitalizeWord sets the first character of the current word to uppercase and the rest to lower

100

Epsilon Keymap Functions


EPSCd starts the directory select dialog EPSCenterLine centers the current line horizontally EPSCenterWindow scrolls the buffer so that it is centered vertically in the current window EPSChangeModified toggles the read only state of the current buffer. EPSCopyRegion copies all text between the current point and mark to the kill buffer. EPSCopyToFile will start the file save as dialog. The previous filename will not be associated with the buffer unless the keep old file check box in the save as dialog is checked. EPSCountLines tells the number of lines and bytes in the buffer and the line number of the point EPSCtrlPrefix reads the next character as a ctrl character EPSCtrlXTable switches the current keymap to the ctrl-x key table EPSDeleteBlankLines deletes lines that are empty or contain only whitespace

101

Epsilon Keymap Functions


EPSDeleteChar removes characters in the buffer. It will remove characters in the forward direction if numChars is positive and will remove characters in the backward direction if numChars is negative. No characters are removed if numChars is 0. EPSDeleteCharacter deletes characters from the current position towards the end of the buffer. EPSDeleteHorizontalSpace removes all whitespace around the current cursor. EPSDired calls the Codewright file browser EPSDownLine move the cursor down a line EPSEndKbdMacro ends keyboard macro recording EPSEndOfLine moves the cursor to the end of the current line. EPSEndOfWindow moves the cursor to the lower right corner of the current window. EPSEnlargeWindow grows the window vertically by the number of lines of text specified in the argument (defaults to 1) EPSEnlargeWindowHorizontally grows the window horizontally by the number of lines of text specified in the argument (defaults to 1)

102

Epsilon Keymap Functions


EPSEnlargeWindowInteractively lets you use the keyboard to resize the current window EPSEnterKey inserts a newline at the point EPSExchangePointAndMark swaps point and mark. Any existing highlight is preserved. EPSExit will terminate the editing session. This relies on Codewright file save hooks and is therefore slightly different on User Interface when there are modified buffers. EPSExitLevel will perform the same command as EPSExit since there appears to be no concept of a recursive edit level. EPSFillParagraph fills the current paragraph to the current right fill margin. EPSFindFile starts the file open dialog EPSForwardCharacter moves the cursor in the direction of the end of the current buffer. EPSForwardParagraph moves the cursor to the next paragraph EPSForwardSentence moves the cursor to the next sentence

103

Epsilon Keymap Functions


EPSForwardWord moves the cursor to the next word EPSGotoBeginning will place the cursor at the beginning of the buffer. EPSGotoEnd will place the cursor at the end of the buffer. EPSGotoLine puts the cursor on the line given as an argument. If no argument is given, the Codewright Goto Line dialog comes up. EPSGotoTag puts the cursor at the next occurrence of the current tag. In Epsilon, tagging is case-insensitive. EPSGrep starts the file grep dialog. EPSHelp brings up the Codewright help engine EPSHighlightRegion begins a highlight if none is active; otherwise it removes the current highlight EPSIncrementalSearch initiates an I-Search EPSIndentPrevious makes the current line start at the same column as the previous non-blank line. Specifically, if you invoke this command with point in or adjacent to a line's

104

Epsilon Keymap Functions


indentation, that indentation is replaced with the indentation of the previous non-blank line. If point's indentation exceeds that of the previous non-blank line, or if you invoke this command with point outside of the line's indentation, this command simply inserts a tab character. EPSIndentRegion performs a tab operation on every line in the region. EPSIndentRigidly will indent a block of code EPSInsertChar inserts characters into the current buffer EPSInsertEOL inserts newline characters into the current buffer. This function is used locally only. EPSInsertFile brings up a file open dialog or gets command line input and inserts the returned file name. EPSInsertToColumn inserts whitespace to the given column. EPSJumpToLastBookmark puts the cursor on the most recently set bookmark EPSJumpToNamedBookmark brings up Codewright's Go to Bookmark dialog EPSKillBuffer brings up a dialog that lets you delete a specified buffer

105

Epsilon Keymap Functions


EPSKillLevel (not implemented) EPSKillLine deletes the current line EPSKillRegion removes all text between the current point and mark and copies it to the current kill buffer. EPSKillSentence deletes the current sentence EPSKillWindow deletes the current window EPSKillWord deletes the current word EPSLastKbdMacro executes the last recorded keyboard macro EPSLoadBytes loads a pre-compiled library (DLL) into Codewright EPSLowercaseWord converts the entire current word to lower case EPSMake with no arguments executes the build command. If an argument is given, the user is prompted for the name of an application to run.

106

Epsilon Keymap Functions


EPSMarkParagraph highlights the entire current paragraph EPSMaybeBreakLine inserts a new line into the buffer EPSMouseLeftButtonDown calls the standard binding, sets the mark and switches out of rectangle mode if required. EPSMouseRightButtonDown calls the standard binding, sets the mark switches out of rectangle mode if required. EPSMouseRightButtonUp current does nothing EPSMouseRightClick currently does nothing EPSMoveToWindow will move to another window in the indicated direction. If a window does not exist in the wanted direction the function does nothing. EPSNamedCommand executes a Codewright or user-defined API call EPSNextBuffer moves to the next buffer in the buffer list EPSNextPage moves the cursor down one page in the buffer

107

Epsilon Keymap Functions


EPSNextPosition goes to the next error or the next FGrep item EPSNextWindow moves to next window in the window list. EPSOneWindow make the current window the only window EPSOpenLine adds newlines at the after the current cursor position. EPSOverwriteMode toggles overwrite mode (or sets is if an argument exists). EPSPluckTag finds the tag for the word at the cursor EPSPreviousBuffer moves to the previous buffer in the buffer list. EPSPreviousPage moves to the previous page in the buffer EPSPreviousWindow moves to the previous window in the window list. EPSPush calls Codewright's ExecCommand EPSQueryReplace does an interactive search/replace

108

Epsilon Keymap Functions


EPSQuotedInsert takes the next character literally and inserts it into the text at the cursor position. If an argument is given, it is taken as the number of times to insert the character repeatedly. EPSROEditEvent will check for a read-only buffer and abort the insert if the buffer is read-only. EPSRectangleMode toggles rectangle mode EPSRedo redo an undo EPSRedoChanges currently just calls EPSRedo EPSRegexReplace performs an interactive search/replace using regular expressions EPSRegexSearch performs a text search on the current file using regular expressions EPSReplaceString performs an interactive search/replace EPSReverseIncrementalSearch performs an I-search backwards EPSReverseRegexSearch is performs a regular expression search backwards

109

Epsilon Keymap Functions


EPSSaveAllBuffers saves all currently modified non-system buffers EPSSaveFile writes the contents of the current buffer. EPSScrollDown scrolls the current text down in the current window EPSScrollLeft scrolls the current text left in the current window EPSScrollRight scrolls the current text right in the current window EPSScrollUp scrolls the current text up in the current window EPSSelectBuffer starts the buffer selection dialog EPSSelectTagFile sets the name of the file to use for a tags database. The browser file is not set. EPSSetBookmark sets a bookmark at the cursor EPSSetFillColumn sets the column to be used for paragraph fills EPSSetMark sets the mark at the current cursor position

110

Epsilon Keymap Functions


EPSSetNamedBookmark presents a dialog that lets you set and name a bookmark at the cursor EPSShowBindings brings up the dialog bindings dialog. EPSShowPoint displays information about the cursor position. Includes column number, byte offset, size of file in bytes, and ASCII, decimal, and hex values for the character at the cursor. EPSShrinkWindow decrements the window vertically by the given number of lines of text (defaults to 1) EPSShrinkWindowHorizontally decrements the window horizontally by the given number of lines of text (defaults to 1) EPSShrinkWindowInteractively lets you use the keyboard to resize the current window EPSSplitWindow splits the current window into two windows one above the other. EPSSplitWindowVertically creates two windows side by side in the real estate occupied by the current one. EPSStartKbdMacro starts recording a keyboard macro

111

Epsilon Keymap Functions


EPSStartProcess calls Codewright's ExecCommand to execute an application EPSToIndentation moves the cursor to the first nonwhite space in the line EPSTransposeCharacters swaps the current character with the next EPSTransposeLines swaps the current line with the next EPSTransposeWords swaps the current word with the next EPSUnassignedKey will beep if an unassigned key is pressed EPSUndo undoes previous editing tasks EPSUndoChanges currently just hooks into EPSUndo EPSUpLine moves the cursor up lines towards the beginning of the buffer. EPSUppercaseWord converts words towards the end of the buffer to uppercase.

112

Epsilon Keymap Functions


EPSVisitFile closes the current buffer and prompts the user for a new file to open EPSWhatIs prompts for a key and displays the function associated with it EPSWriteFile brings up the file save as dialog. The buffer may or may not have a new file name associated with it depending on how the keep old file check box is marked. EPSWriteRegion prompts the user for a filename and saves the current region (selection) to that file EPSWriteState updates the state file which saves editor context information between sessions EPSYank inserts the current kill region into the buffer at the cursor EPSYankPop replaces the last-yanked item with the next item on the kill ring EPSZoomWindow toggles the maximize state of the current windower4t56w.

113

Version Control Setup


Codewright can work with your version control software in one of two ways: Using a command line interface Using your providers Application Programming Interface (API)

Your selection of which interface to use will control the operation of all of the items on the Version Control submenu of the Tools menu, and version control related buttons on any toolbars. The capabilities that Codewright provides will vary somewhat depending on which of these interfaces you use. You select which you plan to use by selecting Setup from the Version Control submenu on the Tools menu.

Which Interface Do I Use?


To use the command line interface for Version Control, you need only have a version control system that processes arguments on the command line to tell it what file to operate on, and what options you are specifying. The application can be Windows or DOS based. To use your providers Application Programming Interface (API) requires more. For this reason, only a few providers are supported in this manner. You need the following: A version control system that offers a robust API. The version that supports that API installed on your system An interface DLL

The last item, the interface DLL, must be developed specifically for the providers system. Whether it is done by Premia, the provider, or as a collaborative effort may determine where you can obtain this DLL. It may come on your providers disks, on your Codewright disks, or may be downloaded from an online service or BBS. As of this writing, interface DLLs are only available for Intersolvs PVCS and Microsofts Visual SourceSafe. Any system that is designed to be used with Microsofts published version control interface for Visual C++ may be readily adapted to work with Codewright, however.

114

Command Line Interface


Command Line Interface
Codewright has predefined commands for several version control systems, including Intersolvs PVCS, MKSs Source Integrity, and various versions of the RCS utility, ported from Unix. The first step in setting up your command lines is to find the Version Control submenu on the Tools menu, and select the Setup item. Make sure that the Command Line Provider radio button is selected, and then choose a command set from the list. You are then ready to use the commands on the Version Control submenu that you will find on the Tools menu.

Unlisted Providers
If you do not see you provider listed, you will need to create your own command lines. If you know that one of the command sets listed is similar to yours, you may want to select that one, and use its commands as a starting point for your own. To start from scratch, select Other from the list. In either case, you will need to pay a visit to the Project Properties dialog to define or modify the command lines. Select the Tools tab, and you will see a list of command lines. Scroll toward the end of the list, and you will see seven External VCS commands that you can define or customize.

Check In Command
The Check-in command is the command line needed to check in a file to your version control system or archive. If possible, this command should work whether an archive currently exists for the workfile or if one must be created. If the check-in command is empty the following command will be used: put %b%e The initial check-in command defined in your CWRIGHT.INI file is as follows: put -t@%Q -m@%Q %b%e The additional flags and %Q macro enables you to supply a description of the changes or of the archive itself, when creating a new archive, to the check-in command. This is done

115

Command Line Interface


through prompting, or through the Comment String edit box in the check-in dialog. The text is placed in a temporary response file. The command could also look like this: put @%Q Use this form if you want to supply all parameters to the command, including filenames, from within the temporary response file the %Q macro creates. There are predefined command lines for several version control vendors. You select between these in the Setup dialog on the Version Control submenu of the Tools menu.

Check Out Command


The Check-out command is the command line to execute when you are checking out a revision from a version control system or other archive. If your version control system offers revision locking, this command should not lock the revision. This is the command to be used when you are browsing or compiling the file, rather than planning to change it. If you don't define a command for check-out, the following command will be used: get %b%e If you wish to be prompted for additional options, or to supply them through the Additional Options edit box in the Check-out dialog, use a command like the one below: get @%Q %b%e Predefined command lines are provided for a number of vendors. You select between these in the Setup dialog on the Version Control submenu of the Tools menu.

Check Out with Lock Command


The Check-out With Locking command is the command line to execute when checking out a revision for the purpose of changing it. If your version control system does not offer revision locking, you may either make this command the same as the Check-out command or leave it blank. If you don't define a command for Check-out with locking, the following command will be used: get -l %b%e

116

Command Line Interface


If you wish to be prompted for additional options, or to supply them through the Additional Options edit box in the Check-out dialog, use a command like the one below: get -l @%Q %b%e Command lines for several vendors are provided. You select between these in the Setup dialog on the Version Control submenu of the Tools menu.

Lock Command
This is the command that your version control system uses to lock a revision without checking it out. This is useful when you already have a modified version of the source file that you want to check in, but you discover that the file was not locked. Note Make sure that your modified version contains all the changes in the most recent revisions before doing this. If it does not, use a merge utility (such as Codewrights) to merge your changes with the ones you are missing before you check it in.

Unlock Command
This is the command your version control system uses to unlock a revision without checking it in. It is useful when you discover that you have a file checked out that you do not plan to modify at present.

Log Command
This is a command to obtain a report about activity in the current documents archive. You may make it general or specific whichever best meets your needs. It can be anything from list all changes and their descriptions to what is the number of the latest revision?

Manager Command
This is the command that brings up you version control packages manager, if any. The manager is a general purpose, menu or form driven program that lets you perform a variety of version control functions. It is useful when you have a slightly unusual need that is not covered by the other version control commands.

117

VCS Maintenance Dialog


SCC Provider Interface
Microsoft published an interface to allow version control systems to interact with their product, Visual C++ 4.0 and later. We have adopted this interface as a standard for direct interaction between Codewright and version control systems. Microsoft has referred to this interface as the Source Code Control Provider interface, or SCC Provider. Hence, we use the name SCC Provider to refer to direct manipulation of a version control system through DLLs and an API. When you are using the SCC Provider Interface, you make the same selections from the Version Control submenu as you would with the command line interface. The difference is that any setup required is done through your version control system (SCC Provider), rather than by specifying command lines for Codewright to use.

VCS Maintenance Dialog


The VCS Maintenance dialog is a multi-purpose dialog that works for either the command line interface or the SCC Provider interface. You invoke it by selecting Maintenance from the Version Control submenu of the Tools menu. It lets you apply labels to revisions, lock and unlock revisions without checking them in or out, plus review the revision history and properties of an archive. Some of these services, such as history and properties, are very specific to the version control system or SCC provider. You set it up to do what you want, depending on what is available. The dialog stays open through a series of maintenance functions until you explicitly close it.

118

Projects and Workspaces


This chapter describes how to use the Codewright Project and Workspace facility. The complex relationships between files and groups of files that are almost routine in program development for Windows demand this type of organization. Without the simplifying effect of Projects, dealing with the demands of Windows programming would be even more taxing.

What is a Project?
A project, at a minimum, is a list of files that you find it useful to group together logically. Creating a project facilitates operating on these file as a group, whether you are using version control, creating a "Tags" database, or even if you are just loading files. The project may be further divided into Workspaces, which may contain project and nonproject files. A project may also store the options you have selected. If you wish, your project files may contain almost as much information as your Codewright configuration file.

What is a Workspace?
You can think of each workspace almost as a separate instance of Codewright. That is, when you change workspaces you have the ability to pick up where you left off with a group of files. It doesn't matter if you worked on that group of files a half hour before or three months ago. It is as if an instance of Codewright were frozen in time containing these files. A workspace differs from a project in that it does not store the system-wide options normally stored in a configuration file. In a sense, the workspace is like a state file that you can swap on the fly. As such, it retains information about the currently open windows and buffers. Other state information such as search options, response histories, bookmarks and so on are stored as part of the project.

119

Adding and Deleting Project Members


Creating a Project
Creating a Codewright project is as simple as selecting New from the Project menu and entering a name for your new project. The name is the filename and path in which the project information will be stored. In selecting a name, keep in mind that Codewright assumes the filename extension .PJT for project files if you don't supply one. If you want another extension, you must specify it. If you wish to have no extension, put a dot ( . ) at the end of the root. After creating the project, you are given the opportunity to specify the names of files that are members of the project. You should also select the Options tab from the Project Properties dialog to define how much configuration information will be saved along with the filenames in the project file.

Adding and Deleting Project Members

120

Using Projects
You specify the members of a project by selecting the Files tab of the Project Properties dialog. Locate the files you want to add by navigating your file system as you would when using the File Open dialog. You may select a series of files and then add them by pressing the Add button, or you can double click on each filename to add it to the project. A file may be a member of more than one project, so specify any files you want to group together logically and which you might want to operate on as a group. Files that are included in the project are listed in the box at the bottom of the dialog as you add them. You may delete files from the project by selecting them in this box and then pressing the Delete button.

Project Setup Checklist


Whenever you create a new project, it is a good idea to make sure that the settings are appropriate for the project. A quick once over will avoid surprises later. There are several dialogs that you should visit. Begin by selecting the Directories tab in the Project Properties dialog: Working Directory Define a working directory for your project. An explicit directory or %x (the path of the project file) are usually the best choices.

Next select the Tools tab: Project Command Lines Define the major project-wide command lines you will be using (other than the command to compile the current file). For example, your Make command might be Ftee nmake -f %y.mak. (%y indicates the path and root of your project file) If you already have a makefile, just name it explicitly instead of using %y. If you will be using VDOS instead of FTEE to watch the progress of the command, just omit FTEE from the command.

Finally, select Compile from the list of tools, and then press the Compiler button that appears in place of the Browse button. Compiler Command Lines The compiler to use is associated with the extension instead of being associated directly with the project. Compiler associations are project specific, by default, so make sure the right associations are in effect.

Using Projects
This section describes the uses you can make of projects, once defined. The primary uses of projects covered here are listed below:

121

Using Projects
Selecting or Changing Projects Loading Files for Editing Creating and Selecting Workspaces Searching Project Files Selecting files for Check-in or Check-out Generating a compiled tags database Making different build parameters for different purposes

Selecting or Changing Projects


You can select a project by choosing Open from the Project menu. You can navigate your directory structure as you would when using the File Open dialog and select the name of a project file you wish to load. Recently selected projects will be listed at the bottom of the Project menu, numbered from one to nine. The active project will have a check mark next to it. You may select from this list to reload any of the projects listed.

Loading Files for Editing


One of the best things about organizing your work into projects is the convenience it provides in selecting files for loading. Just choose Load Files from the Project menu and you will be presented with a list of files in the current project. You can select one or more files from this list for loading and editing. If you find that some members of the project aren't listed, select the Files tab of the Project Properties dialog to add them. If you wish to load files that are not part of the project, select Open from the File menu. The rules for using extended selection listboxes apply to the Load Files dialog.

Project Window
Alternately, you may wish to use the Project Window to operate on files in a project. As with the Load Files dialog, you just select the desired files from the list and press ( to load the files. It has the advantage, however, of showing which files are actually on disk (some may currently be archived), and whether they are read/write. In addition, you may define filters (file specification patterns) to sort the file list into groups.

122

Using Projects
The primary purpose of the Project Window is to facilitate version control operations. For this reason, you will find that by right clicking on a file or one of a selected group of files will bring up a menu with a list of available version control operations.

Creating a Workspace
One of the most powerful aspects of projects is the workspace. At any time while working on a project, you can select Save Workspace from the Project menu and create a new workspace. Just give your workspace a name -- a descriptive name this time, rather than just a file name -- and you are done. A workspace name may contain any printable characters (including spaces) except apostrophe ( ' ), backslash ( \ ), quote ( " ), and square brackets ( [ ] ). Suppose that you have a number of files open, and want to create a new workspace that doesn't include any of the files currently open. Select Load Workspace from the Project menu. You will see listed there a workspace that is always available, called <none>. You can select that workspace to wipe the slate clean. If the "Delete buffers and windows" option is set to "All", your buffers and windows are all closed so that you can start afresh. Of course, if any of the buffers contain changes that have not been saved to disk you will be given an opportunity to do so. Now that you have your clean slate, open the files that you want to have open in your workspace. Anytime you are ready, you can save your workspace under whatever descriptive name you wish. Remember that workspaces are specific to the projects in which they are created. You could have an "options dialog" workspace in several different projects, but as far as Codewright is concerned, they are unrelated.

Workspace Saving
You may at any time save a workspace by selecting Save Workspace from the Project menu, but this is usually only necessary when creating a new workspace. Codewright automatically updates the active workspace whenever you: close or change projects, exit Codewright, and optionally when you change workspaces.

123

Using Projects
Changing Workspaces
Once you have created more than one workspace, you will find it easy to switch between them. When you select Load Workspace from the Project menu to do this, you will notice a couple of options are available. These options relate to what happens to the workspace you are leaving.

Update Current Workspace When the Update Current Workspace box is checked, the workspace you are leaving is automatically updated before the new workspace is loaded. Close Windows/Delete Buffers You may choose to close all windows and buffers after leaving one workspace and before the next is loaded. In this event, no buffers or windows are carried over from one workspace to the next. You may elect to just close the files that are members of the workspace. This means that any files you opened during the session, such as a special header file, will carry over to the next workspace. You may even choose to have all files carry over into the next workspace. If you do this, we recommend that you either delete the carry-over buffers before saving the workspace, or save the workspace under a new name. Otherwise, workspaces will become less distinct, and therefore less useful, entities.
Keep in mind that the saving of windows and buffers in the workspace you are leaving is unaffected by which of these options you select.

124

Configuration and State Hierarchy


Searching Project Files
You can search as a group the files that are members of the current project, or you can select a subset of the member files on which to perform a search. This feature is available in the Multiple Sources portion of the Search and Replace dialog (Project Files) and is described in detail in the Search and Replace chapter of this manual.

Selecting files for Check-in or Check-out


Codewright's version control interface (Check-in, Check-out and related commands) can operate independently of, or in conjunction with Projects. The dialog allows you to select from files in the project or the current directory. You can make your version control commands project-specific, if you like. Just locate the Options tab in the Project Properties dialog and put a check in the Version Control Setup checkbox. This will cause your Check-in, Check-out and related commands to be stored in your project file.

Project Files
A project file is essentially a configuration file and state file all in one. Workspaces are stored as additional "state files" within the project file. Once you understand the format of a Codewright configuration file, you understand a Codewright project file. These files look just like standard Windows .INI files with headings enclosed in square brackets, and statements on lines following these headings. Statements take the form of <keyword>=<value>. The primary difference between a Codewright configuration or project file and a Windows .INI file, is that keywords may not be repeated within a section of a Windows .INI file. In a Codewright configuration or project file, keywords may be repeated. This is possible because Codewright processes these files directly, without going though Windows. For more information on the format of configuration and related files, refer to the "Configuration and State" chapter of this manual.

Configuration and State Hierarchy


When you have no projects in use, Codewright stores its configuration information in its configuration file (CWRIGHT.INI). Between sessions, Codewright stores the more transient information about the files you are working on in its state file. When you are

125

Configuration and State Hierarchy


using a project, however, some configuration information is kept in the project file, and almost all of the state information is stored there also. The state file then serves largely to identify which project file you were last using. You determine the amount of configuration information kept in the project file. The Options tab in the Project Properties dialog lets you select which categories of settings are stored in the project file, and therefore change as you change projects. The more information that goes into the Project file, the less information goes into the Configuration file. If you are using one or more workspaces within your project, document and window state information is stored with the active workspace when you exit, rather than in the state section of the project.

126

Regular Expressions
Regular Expressions are a powerful notation for describing string matching patterns that has gained wide acceptance. Codewright Professional optionally makes available Unixstyle Regular Expressions for use in searching. They have now gained wide acceptance outside the Unix realm. The relatively small investment of time required to gain a useful knowledge of Regular Expressions can pay you back many times over. As you begin using Regular Expressions, keep an eye out for new uses. This will help your use and understanding of Regular Expressions to grow, as well as save you time. A Regular Expression can be as simple as a single literal character. Such simple expressions are usually a subexpression of a more complex regular expression. In reading the descriptions that follow, an "expression" may mean a single character, a group or class of characters. These topics are described in detail in this section of the manual.

Special Characters
Regular Expressions give special meaning to certain characters. Some are operators and some show grouping. There is also a method of representing non-printing characters, such as a tab, within Regular Expressions. All other characters just represent themselves, as they would in an ordinary string search. The characters to which Regular Expressions give special meaning are called metacharacters. These characters and their meaning are shown below:

127

Escape Sequences
Character . *
+ ? [ and ] ( and )

| $ ^ \ \c

Meaning Matches any single character, except a newline Matches any number of occurrences (even zero) of the expression that precedes it. Matches one or more occurrences of the preceding expression. Matches zero or one occurrence of the preceding expression. Defines the beginning and end of a character class. Defines the beginning and end of a group of expressions. Groups expressions into a larger units, dictates precedence. Each group is also a Reference Group which may be pasted into a replacement string. Alternation. Allows matching the expression on the left or on the right of the operator. Matches the end of a line. Two meanings: Matches the beginning of a line. Complement operator when the first character in a character class. Used for escaping metacharacters and non-printing characters. The position in the pattern at which the cursor is placed at the end of a successful search.

Escape Sequences
There are times that you want to use a metacharacter as itself -- without the special meaning that Regular Expressions gives it. For example, you may wish to match a dollar sign, rather than look for the end of a line. To match a dollar sign you must escape or quote it. This is done by preceding the character with a backslash. This is true of all the metacharacters. To match a dollar sign, for example, you use \$ in your Regular Expression, rather than just $. Below is a list of other escape sequences supported by Codewright Professional's Regular Expressions:

128

Character Classes
Escape \n
\t \b \r \f \nnn \xnn \m

Meaning Newline (<CR><LF> or <LF>, depending on how it is defined for the document) Tab Ctrl-H (backspace) Carriage return form feed Octal value between 0 and 0377. Hexadecimal digit between 0x00 and 0xFF The literal character m.

Matching a Character
The basic unit of a regular expression is matching a single character. You can match a single character in one of three ways: Literally, Ambiguously, or with a Character Class.

You may match a character literally by using the character itself or the appropriate escape sequence. If matching a character literally is too limiting, you may match ambiguously, by using the dot ( . ) metacharacter. If a literal character is too narrow a match and the dot is too broad a match, a character class can be used for anything in between.

Character Classes
A character class is a series of characters enclosed in square brackets. It specifies a set of characters, any one of which may match. For example, the character class [AEIOUYaeiouy] matches any vowel, whether upper or lower case. Ranges of characters may also be specified within a character class. This is done by placing a dash between the character that begins the range and the character that ends the range. The following character class

129

Iteration Qualifiers
[0-9] will match any character between 0 and 9. How do you match a dash, then? If it is not in the character range you specified, just place it at the beginning or end of the character class where it is not between two characters of the class. If you precede the dash with a backslash ( \ ) you can put it anywhere within the class. The caret ( ^ ) has a special meaning when it appears as the first character of a character class. It complements the class. When it appears at any other position within the character class, it just adds the up-caret to that class. You may use it as a shorthand method of saying "match any characters except for the following:", rather than specifying a large character class. For example, [^$.|(){}*+?^] matches anything except the eleven characters following the up-caret.

Escaping Characters in a Class


Metacharacters may be used in character classes without escaping. The only characters that must be escaped are as follows: ] " \ and sometimes - and ^ depending on the position within the class. Escape the - when you use it in the middle of a class but don't intend it to signify a range. Escape the ^ when it would otherwise be at the beginning of a class but you do not intend for it to signify complement. When in doubt, escape the character. It can't do any harm. These characters look like this when escaped: \] \" \\ \- \^

Iteration Qualifiers
Iteration qualifiers are metacharacters that are not regular expressions by themselves. Instead, they state how many iterations of the preceding expression there must be or can be, in order to match. These metacharacters are: *, + and ?. As stated in the table above, the * matches any number of occurrences, the + matches one or more, and the ? matches

130

Beginning and End of Line


zero or one. Without these qualifiers, a regular expression will match exactly one occurrence in the text. Let us consider some specific examples of how these qualifiers might be used in the task of matching whitespace: \t* The example above will match any number of consecutive tabs, including none. By itself, it is not very useful to match none of something. As part of a larger regular expression, it could be quite useful. For our purposes here, the following might be preferable: \t+ This example matches one or more consecutive tabs. The tab is represented as \t, and the plus sign says "one or more of the previous". To match whitespace, we need to match spaces too. We don't know what order the spaces and tabs will come in, and we don't know how many there will be. These are signs that we need a character class. [ \t]+ The example above uses a character class containing a space and a tab. The + sign following it means that this Regular Expression will match any combination of spaces and tabs, so long as there is at least one space or tab. If you wanted to match the whitespace within a function call, where you knew there might be one space or tab, or there might be none, your expression could look like this: \([ \t]? This example searches for a left parenthesis followed by zero or one spaces or tabs. Since the left parenthesis is a metacharacter it is necessary to escape or quote it with a preceding backslash. The \t we have used before to represent a tab character. The question mark says "zero or one of the preceding".

Beginning and End of Line


You may use the metacharacters ^ and $ to qualify your Regular Expression further. We have already seen how the ^ may be used to complement a character class, but it has another quite different use outside of a character class. These metacharacters specify that, in order to match your Regular Expression, the text must appear at the beginning or end of a line, respectively. Unlike the iteration qualifiers, however, these metacharacters can

131

Alternation and Grouping


stand alone as Regular Expressions. That is, you can search for just the end of the line or just the beginning of the line. ^PUBLIC \)$ ^\)$ The first of the examples above matches the word "PUBLIC" when it occurs at the beginning of a line. The second example matches a right parenthesis, a character which must be escaped, when it is found at the end of a line. The third example matches a right parenthesis when it is the only thing on the line.

Alternation and Grouping


Alternation and grouping go hand in hand. Alternation often relies on grouping and is the primary need for grouping. Alternation uses the metacharacter | to denote that a match has been found if the text matches either of two Regular Expressions. This operator may be repeated to indicate that the text may match any one of several expressions. Because of the typical order of precedence, the alternation applies to the entire expression, if not limited by grouping. Grouping occurs when you place parentheses around one or more expressions that are part of a larger expression. Here are some examples of how these two features work together: PUBLIC|PRIVATE PUBLIC (void|DWORD) ^PUBLIC[ \t]+(void|int|long|DWORD) The first of these examples matches either the word "PUBLIC" or "PRIVATE". The second matches the word "PUBLIC", when followed by a single space, and then followed by either the word "void" or "DWORD". Note the use of grouping in this example. The third example is a bit more complex. It matches, at the beginning of a line, the word "PUBLIC", followed by one or more spaces or tabs, followed by any one of the following words: "void", "int", "long" or "DWORD". This begins to show the power of regular expressions.

132

Placing the Cursor


Reference Groups and Replacement Strings
In addition to showing association and precedence, grouping allows the use of Reference Groups. A reference group is one or more expressions that have been placed between parentheses and then pasted into a replacement string by referencing its number. Codewright Professional assigns a reference number, from 1 to 9, to the text matching each group defined. Reference numbers are assigned from left to right. You may paste the associated text into a replacement string by using this number, preceded by a backslash. The following example demonstrates how reference groups may be used: Search pattern: GotoXY\((.*),(.*)\) Replacement String: move_cursor(\2,\1) Note that in replacement strings you do not need to escape metacharacters, such as the left parenthesis, with a backslash. There are a few escape sequences that are meaningful in a replacement string, such as those used by reference groups, but such sequences are not themselves regular expressions. An operation using reference groups, such as that depicted above, could be used to reverse the parameter order used by one function when converting to a similar function. There is an implicit reference group that you can use in replacement strings to represent the matching text in its entirety. You reference this group in the replacement string with an & at the desired location. This means that you must use \& to specify an ampersand in a replacement string, when regular expressions are enabled.

Placing the Cursor


When you search for a piece of text, it is usually because you are going to do something with it or to it. After a successful search operation, Codewright Professional positions the cursor at the beginning of the matching text -- at least, that is the default action. What if you want to edit the other end of the matching text, or perhaps the middle?

133

Examples
When using Codewright Professional's regular expressions, you have a special escape sequence available that allows you to indicate where in the matching text the cursor should be positioned. You should note that this is available only for search operations. It is not for use in replacement text. The escape sequence that specifies cursor position is \c. An example of its use follows: singletons\[\c.*\] This example places the cursor at the beginning of whatever text is contained between the left and right square brackets. The square brackets are metacharacters and are therefore escaped. This cursor positioning facilitates editing the contents of the square brackets.

134

Examples

Examples
The following examples are intended to inspire your own uses of regular expressions:

Pattern
[A-Za-z_][A-Za-z0-9_]* -?([0-9]+\.?[0-9]*|\.[0-9]+) ([ \t]|^)[^ \t]+ [^ \t]+\c([ \t]|$) ([^A-Za-z0-9]|^)[A-Za-z0-9]+ [A-Za-z0-9]+\c([^A-Za-z0-9]|$) /\*.*\*/ /\*.*\n([ \t]*\*.*\n)*.*\*/

Description C language identifier Floating point (real) number Beginning of word (simple whitespace) End of word (simple whitespace) Beginning of word (Non-alphanumeric) End of word (Non-alphanumeric) Single-line comment (C language) Multi-line comment (C language)

135

General Operation
This chapter presents Codewright Professional topics that you may need to consult on a reference basis from time to time. The topics are presented in alphabetical order, for added convenience.

Backup Files and Directories


Codewright Professional allows you to specify where and under what name you wish to store backup files. It even allows you to define how to derive the root or extension of the backup filename from the file being backed up. If you find, even with this flexibility, that it is hard to come up with a backup system that applies equally well to all files, there is more. There is also the notion of global and local backup specifications. The functions BufSetGlobalBackupSpec and BufSetBackupSpec allow you to set a system wide method of dealing with backups, and allow setting an individualized method for a document that overrides the global method. These functions are paired with the query functions BufQGlobalBackupSpec and BufQBackupSpec that allow you to discover the current backup settings. If you plan to assign backup specifications to individual buffers, you may automate the process by assigning a function to the "Document Created" event. This function could, for example, look at the extension on a file whenever a new document is created, and assign an appropriate backup specification. Backup locations and the filenames used are controlled with formatting strings. The formatting strings contain format controls and transformation patterns that tell Codewright Professional how to deal with file names that are unknown as yet. It is possible to specify a format that will result in an illegal filename. Codewright Professional does not attempt to ensure that the resulting filename is legal. When you attempt to backup the file, an error will occur, just as if you had specified an illegal filename for saving a file. Setting both the local and global formatting strings to empty strings effectively turns backups off. This may also be done by turning off the DOCUMENT_BACKUP attribute of the document's SysFlag, using the BufSetSysFlags function. Initially, backups are

136

Backup Files and Directories


turned on, and the backup is made in the same directory as the file being backed up. The backup file is given the extension .BAK.

Backup Formatting Strings


The formatting strings used to specify the location and names of backup files may remind you of the formatting strings used by printf() and similar C language library functions. As previously stated, these strings contain format controls and transformation patterns, which are used in conjunction with some of the format controls. Format controls begin with a single percent sign ( % ). Any other text is treated literally. The format controls available for use in backup formatting strings are listed in the table below. Note that optional portions of these format controls are enclosed in italicized square brackets. Examples are based on the output filename C:\SRC\FOO.BAR:

Control %b
%d

Represents basename
directory

%[{...}]e

extension

%f %p %[{...}]r

filename path root

%v %%

volume percent

Description The entire name of the output file (fully qualified), less the extension. (e.g., C:\SRC\FOO) Includes the path, less the drive (volume) specifier and filename, but ends with a backslash only if describing the root directory. (e.g., \SRC) Includes the dot that separates the basename from the extension, unless the name of the output file has no extension. May optionally contain a transformation pattern, as described below. (e.g., .BAR if no transformation pattern supplied) The root name and extension. Does not include the drive (volume) or filename. Always ends with a backslash. (e.g., \SRC\) Does not include extension, drive (volume) or path. May contain an optional transformation pattern, as described below. (e.g., FOO if no transformation pattern supplied) The drive letter and the colon. (e.g., C:) A single percent sign is represented by two consecutive percent signs (%%).

As an example, the formatting string which represents the initial default is "%b.BAK". You would set this default using a function call like the one below: BufSetGlobalBackupSpec="%b.BAK"

137

Backup Files and Directories


Transformation Patterns
The root and extension format controls, described above, may contain transformation patterns. These patterns describe modifications within the root filename and extension. You enclose the pattern within curly braces and place it between the percent sign and the control character, r or e respectively. You supply the pattern in two parts: the override pattern and the fill pattern: The override pattern specifies characters, each of which replaces characters at the same position within the original root or extension string. The override pattern also may limit the length of the resulting string. The fill pattern specifies characters to fill empty positions within the root or extension string.

A single vertical bar ( | ) separates the override pattern from the fill pattern. If you are supplying only the override pattern, you may omit the vertical bar. Supplying only the fill pattern is pointless, since the resulting string will be empty. The rules are the same for using transformation patterns, whether you are using them on the root of a filename or its extension. There is one noteworthy difference in their result, however. After the transformation is performed on an extension, the resulting extension is examined. If the extension is not null, a dot is added to the beginning of the extension. This is true whether or not the original extension was null.

Override Pattern There is a character in the override pattern for each character in the resulting string. The character at each position may be either a valid filename character, or a question mark ( ? ). If a filename character ivs specified, the character in the original string is replaced by that character. If a question mark appears at a given position in the string, the character in the original string is used. If no character appears in the override pattern for a given position (i.e., the root is shorter than 8 characters or the extension is shorter than 3), the resulting string is truncated at that position, even if a you have supplied a fill pattern. Fill Pattern The fill pattern may contain only valid filename characters. The character at a given position in the pattern is used in the resulting string if that position in the original string is empty (i.e., the original string is shorter than the fill pattern) and a question mark is specified by the override pattern.

138

Command Key
Illustrative Examples
The following illustration shows how the characters in the override pattern take precedence over those in the original extension, and how the fill pattern characters become the default:

Here is the resulting extension (less the preceding dot):

The following examples demonstrate the effects of various override and fill patterns:

Pattern
%r%{??~|___}e

Original Name
foo.cpp foo.c

Backup Name
foo.cp~ foo.c_~ foo.cp~ foo.c foo.~pp foo.~ foo.~ foo.~ foo.c foo.c foo~~~~~ foo~~~~~.c testfil~.c foo.bak foo.cak testf.cak

%r%{??~}e

foo.cpp foo.c

%r%{~??}e

foo.cpp foo.c

%r%{~}e

foo.cpp foo.c

%r%{?}e

foo.cpp foo.c

%{???????~|~~~~~~~~}r%e

foo foo.c testfile.c

%{?????}r%{???|bak}e

foo foo.c testfile.c

Command Key
The Command Key is a keystroke that calls the LibFunctionExec function. It provides an interface to Codewright's API while you are running Codewright.

139

Command Key
If you find you want to do something in Codewright for which there is neither a key command nor a menu entry, you can probably do it using the Command Key. If you are using the CUA and vi command set, the Command Key is . If you are using the BRIEF-compatible command set, the Command Key is , which in BRIEF provides access to the BRIEF interpreter. In keymaps where there is no such assignment, you can still execute an API Command by selecting API Command from the Tools menu. When you press the Command Key, a prompt appears on the status line or in a pop-up dialog box, depending on which is enabled: Command: You then respond by entering a Codewright API function call, much as you would enter it in Codewright's C source code. Pressing ( sends the command off for processing.

Command Completion
In addition to the command history, described in the previous section, you can also use the command completion feature. This feature is only available when status line prompting is in effect, rather than the pop-up dialog. You can control which type of prompting is used through the System tab of the Environment dialog found on the Tools menu.

Figure 3: Command Completion list after entering "color" Command completion allows you to enter as much of a command (function name) you can recall and then press the 7 key. In return, you receive a list of commands that begin the same way as your partial command. You can then select the desired command

140

Command Key
from that list and it is placed on the prompt line for you. If you want a complete list of the commands available just press the tab key without entering anything at the prompt.

Using the API


To make much use of the Command Key, you will need to know something about the Codewright API -- at a minimum, you need to know the name of a function you want to execute. The Online Programmer's Reference is the place to learn more about the Codewright API and specific functions, whether you want information about a topic or just want to browse the library of functions. For many users this is the first step toward truly customizing and extending Codewright. Once users see how quickly they become comfortable with Codewright's API, they want more. Soon they start delving into the supplied DLL source code and, before they know it, they've altered the world. Well, their Codewright world, at least. If you are trying to avoid learning any more about Codewright's API than you have to, make sure you have checked the various dialogs and menu entries to see if what you are trying to do can be done through the menu. On the other hand, those who are more comfortable issuing commands than making selections from a menu (a la SPF, or even BRIEF), will probably find themselves using the Command Key regularly.

Source Code versus Command Key


Here are the differences between Codewright API function calls issued in source code and through the Command Key: Parameters may be only numeric values and strings. Parameters may not be variables or nested function calls, when issued through the Command Key. The only exception to this is that the various identifiers/labels listed in the Online Programmer's Reference may be substituted for numeric values. Expressions that employ only bit-wise AND, OR and complement (&, | and !) may also be used. Some API functions cannot be issued through the Command Key. In particular, functions that return allocated strings and functions that have a variable number of parameters may not be issued through the Command Key. In addition, functions that require a pointer or handle (other than a pointer to a string) as a parameter cannot be issued. These functions may only be used in source code. The description of each affected function clearly notes this limitation.

141

Command Key
User written functions are available only when registered. The function LibExport must be used to register a user function, its parameters and return value before it may be called from the Command Key. Parameters may be omitted. If you omit parameters from a function call issued through the Command Key, Codewright will either fill in default values or the call will fail. In source code, you have no option but to supply parameters, if you want it to compile. The format permitted and required varies from that of source code. The requirements on quoting string constants are stringent so that other requirements may be more lax. Spaces can be used to separate function parameters in place of commas, and spaces, equal signs, or parentheses may be used to separate a function name from its parameters.

Displaying Return Values


It isn't very useful to use one of the Query functions via the Command Key to query Codewright about one thing or another unless you can see a response. Since virtually all Codewright Query functions respond by returning a value, you'll need to tell Codewright to show you what value a function returns. You can do this by beginning your command with a question mark. Here is an example of how such a command might look, just before sending the command off for processing: Command: ?BufQModifiedCount When the return type is a numeric value, Codewright displays that number on the status line in both decimal and hexadecimal notation. If the return type is a pointer to a string, Codewright displays the contents of that string.

Examples of Usage
BufSetHexBinary BufSetHexBinary() bufsethexbinary All three of these examples do the same thing. They put Codewright in the Hex Editing mode, with the cursor located in the "binary" portion of the display. MovNextChar( 2 ) Movnextchar 2

142

Command Key
Both of these examples advance the cursor position by two characters. BufEdit( "c:\projecta\debug.c" ) bufEdit "c:\projecta\debug.c" Either of these commands opens a document for C:\PROJECTA\DEBUG.C. kmapAssign( "<ctrl-a>", "BufSetHexAscii" ) Assigns the function BufSetHexAscii to the keystroke Ctrl-A. MarkBeginSel( SELECTION_INCLUSIVE ) Begins an inclusive selection, using one of the labels listed in the Online Programmer's Reference.

Expression Evaluator
The Command Key provides another capability that you may find useful in programming, debugging, or just in place of a calculator. Codewright can evaluate a numeric expression that uses C language operators and grouping, and display the result. You signify that your response to the Command: prompt is an expression you wish to evaluate by preceding the expression with two question marks. You can use Codewright identifiers in these expressions. Here are examples of an expression to be evaluated: ??SELECTION_INCLUSIVE ??0xcf54-3*4 ??MARK_GLOBAL+1 The following operators are supported in expressions, grouped by precedence, and listed in order of decreasing precedence:

143

Line Drawing
Operator
( ~ ! / * % + << >> > < <= >= == != & ^ | && || )

Operation
Grouping Unary Minus Bitwise Complement Logical NOT Division Multiplication Modulus Subtraction Addition Bitwise Shift Left Bitwise Shift Right Greater Than Less Than Less Than or Equal Greater Than or Equal Equivalence Non-Equivalence Bitwise AND Bitwise Exclusive OR Bitwise OR Logical AND Logical OR

Line Drawing
A line drawing package is supplied with Codewright Professional that allows you to draw boxes, lines and simple charts, using the IBM Extended Character Set. If you or a subsequent viewer are using a font other than one of the "OEM" or terminal fonts, the lines and boxes drawn with this package will look like garbage. To use this package, a Dynamic Link Library named CWLDRAW.DLL must be loaded. Look in your Codewright Professional configuration file, usually CWRIGHT.INI, and find a line like the one below in your [LibPreload] section: LibPreLoad=CWLDRAW.DLL In your file, the line may be preceded by a semicolon, which disables the use of the DLL by commenting it out. If so, remove the semicolon so that the line drawing package will

144

Line Drawing
be available the next time you start Codewright Professional. If your configuration file does not have a line like the one depicted above, place this line in the file. The line drawing package uses the arrow keys on the cursor pad to draw lines when the ) and + keys are also depressed. There is another entry you can place in your configuration file to make the necessary key bindings to do this. Put the command below on the line following the line that loads CWLDRAW.DLL: SetLineDrawBindings= Here are the key assignments installed by this command:

)+= )+< )+4 )+5

Move up and insert appropriate character. Move down and insert appropriate character. Move left and insert appropriate character. Move right and insert appropriate character.

The "appropriate character" is determined by whether you are drawing a straight line, turning a corner, or intersecting with another line. It also depends on which line drawing style you select. The example below demonstrates the styles available:

Use the function SetLineDrawStyle in your configuration file, or through the API Command Key to set which style the line draw package will use. The default style is Style 1. You can use the same command, regardless of which method you are using to set the style. From the API Command Key, it would look something like this: Command: SetLineDrawStyle=4 This sets the line drawing style to 4. You will probably find that Overtype mode is best for adding labels to boxes and charts.

145

Menu Editor
Menu Editor

The Menu Editor allows you to change, delete and add menus and menu items interactively. It is located on the Menu tab of the Environment dialog on the Tools menu. (At least, before you use the Menu Editor that is where it is.

Menus
Menus are the top-most selections on the Menu bar. They contain items and submenus. You begin your modification of the menu by selecting a menu from the list on the left. Up/Down These buttons allow you to change the position of the menu relative to other menus. Up and down refer to the position in the listbox. Up moves the selected menu to the left on the menu bar, while Down moves the menu to the right. Add Menu The Add Menu dialog lets you add a menu to Codewright's menu bar. You must provide a name for the menu, a unique ID number, a helpful message to display when the menu is selected, and, optionally, one or more functions to initialize the menu. The initialization functions are responsible for disabling or check marking menu items as necessary.

146

Menu Editor
Change Menu Attributes The Change Menu Attributes dialog is like the Add Menu dialog, except that the attributes for the selected menu are displayed for editing. You cannot change the ID of a menu. Delete The Delete button deletes the selected menu. You could delete all menus, if you wish. You would then find that you are unable to add them back interactively, once you leave this dialog. (You couldn't get the dialog back.) If the worst happens, you can restore the original menu by editing Codewright's configuration file, CWRIGHT.INI. Locate the [Menu] section of the file and rename the section, or delete all lines under that section heading.

Menu Items and Submenus


Menu items and Submenus are the entries listed on a menu. After selecting a menu, the items on that menu will appear in the list box on the right. Any submenus on the menu will also be listed in order, preceded by a + sign. You may then select a menu item or submenu from the list on which to operate. Up/Down These buttons allow you to change the position of the item or submenu on the menu. You may also move separator lines with these buttons. Add Item The Add Item dialog lets you add an item to one of Codewright's menus. You must provide a name for the item (Menu item text), a unique ID number (ID), a helpful message to display when the menu is selected (Help string), and a function to execute when that item is selected (Handler function). If there is a short-cut keystroke that performs the same function, you may enter that keystroke for display on the menu (Key string). Add Popup This button brings up a dialog similar to the Add Menu dialog. Enter a name for the submenu, an ID number, a help message, and any functions to initialize the submenu. Change Item Attributes The operation of this button depend on whether you have selected a submenu or a normal menu item. If you have selected a normal menu item, the Change Item Attributes dialog is like the Add Item dialog, except that the attributes for the selected item are displayed for editing. If you have selected a submenu, the dialog is like the Add Popup dialog. Delete The Delete button deletes the selected item. You could delete all items in a menu, if you wish. You can also delete separators with this button. Add Separator The Add Separator button allows you to add a separator line at the selected position within the menu.

147

Prompt Histories
Add List There are five lists which may be added to the bottom of a menu: recent files, scrap buffers, edit buffers, recent projects, and windows. If you are using One-document-per-window mode, the list of edit buffers is not available. (See System tab on the Environment dialog) Each of these lists may only appear on one menu. Therefore, you must first delete a list from a menu before you can add it to another. This button is disabled if there are no unassigned lists.

Operating on Submenus
To view or operate on a submenu, you must double click with the mouse on the submenu (marked with a plus) in the list on the right. The submenu then moves to the list on the left and is marked with a minus sign. You may then operate on it as you would a menu, adding items, moving and deleting items as you desire. Whenever you are through operating on a submenu, you may move it back to the list on the right by double clicking on the name again. The minus sign will change back to a plus when it arrives in the list on the right. This system allows you to have any level of nesting of submenus that you like. Just keep adding them on the right and moving them over to the left.

Prompt Histories
Many of Codewright's prompts remember previous responses you have made at that prompt. Most notably, the Command Key prompt, the Search and Replace prompts, and the prompt at which you enter the name of a file to edit have prompt histories.

Status Line When the prompt appears on the status line, the prompt history may be activated by pressing either the up arrow or the down arrow. Pressing the up arrow reuses the most recently entered response, whereas pressing the down arrow reuses the oldest. Repeatedly pressing the up arrow allows you to view earlier responses. Repeatedly pressing the down arrow key views more recent responses. Pressing ( accepts the response displayed.
As each historical response is displayed, you will note that it is highlighted. If you issue , , or , the highlighting disappears and an editing command, such as you are permitted to continue editing the response. You can accept the edited response at anytime by pressing (. If, when the response is still highlighted, you type characters, the typing replaces the highlighted text. This allows you to easily type in a new response, if the one you are looking for isn't in the history.

148

Prompt Histories
Dialog Boxes In dialog boxes, a "combo" box is used to present prompt history. Pressing the down arrow button to the right of the edit box will cause a list box to drop down, containing previous responses to the prompt. Select one, and you are ready to edit or execute the command.
There is a history editor on the History tab of the Environment dialog on the Tools menu. It allows you to view and remove members of these prompt histories. Many prompt histories are saved between Codewright sessions by default. This information is saved in the State file. For more information about Codewright State files, refer to the "Configuration and State" chapter of this manual.

149

Configuration and State


Codewright's configuration data is kept in a separate file. During initial installation, the configuration file CWRIGHT.INI is placed in the same directory as your Codewright executable file. You may move it to another location, if you like, or you may have several configuration files in different work areas. You may even specify another name for the file. If your Codewright executables are installed on a network, you will almost certainly want to place your configuration file somewhere else. By placing your configuration file in a private or local directory, you ensure that you will not be using or changing someone else's configuration. Codewright looks in several places to determine what configuration file to use. When it finds a place where you have indicated the location of the configuration file, or the file itself, it looks no further but proceeds to read the file. Here are the places that Codewright looks, in the order of searching: It looks on the command line to see if you specified the /C flag , in your environment for a variable named CWINI , for CWRIGHT.INI in your working directory (working directory is also set through File Properties in the Program Manager), for CWRIGHT.INI in the directory containing CW.EXE or CW32.EXE, or for CWRIGHT.INI in the Windows directory.

The command line flag, or the environment variable will have an associated string value, when it is used to point to the configuration file. This string names the directory in which the configuration file resides. It may also name the file itself. For example, the string may take this form when specifying a directory: d:\source\project1 It may also take this form when specifying a file: d:\source\projects\cencom.cfg If Codewright does not find a configuration file at all, it will create one in the working directory, when it needs one. Codewright has no problem running without a configuration file, but it does notify you if one could not be found.

150

Introduction to Configuration and State


Introduction to Configuration and State
To properly understand Codewright's projects and workspaces, you need to have some knowledge of how Codewright maintains its configuration and how it preserves its state between sessions. This will help you intelligently choose which information is kept in which file. In addition, you may find it expedient to modify Codewright's configuration file directly. This section will give you the information to do these things.

Configuration File
The configuration file normally contains information about the way you have Codewright set up. This information may be put there during installation, through modifying the settings in dialog boxes, or by directly editing the configuration file. In the latter case, the configuration file might contain almost any Codewright commands. The configuration file is nominally CWRIGHT.INI. The configuration file is a text file that follows the same general format as other Windows .INI files. It contains section headings enclosed in square brackets followed by configuration statements. Headings that appear in a Codewright configuration file include: [Editor], [LibPreload], [Colors], [DefaultKeymap], [KmapAssign], [Printer], [Compiler], [VersionControl], [Definitions] and [Fmatch]. The configuration statements contain keywords with string assignments. For the lines containing keywords, the format is as follows: <function>=<param 1>[,<param 2>,...<param n>] The keywords are actually the names of functions in the Codewright API. The string assigned to the keyword contains the parameters required by that function. The assigned string may contain whitespace. The parameters may be numbers, strings, constant identifiers and operators. Variables and nested function calls may not be used as parameters.

State File
The State file contains information about the buffers and windows you had open when last you exited Codewright. It also contains the more transient information about your Codewright settings, such as your search options and responses to prompts. It follows the same rules as a configuration file, but it is normally limited to one section named [State]. This file is nominally CWRIGHT.PST.

151

Introduction to Configuration and State


Other Files Containing Configuration Data
Project files also contain configuration information. These files are intended to be swapped on the fly, whereas the configuration file remains constant throughout a session. The project file overrides any information duplicated in the configuration file. As you change settings in the various dialog boxes, you are automatically updating your configuration. You may select which file the dialogs use to update configuration information: the configuration file or the project file. You may further select which categories of information are kept in which file. These selections are made through the Options tab in the Project Properties dialog. The main question you need to ask yourself in order to be able to make these selections is "Do I want this setting to travel with the project, or have it transcend individual projects?" If you want to have it travel with the project, have it stored in the project file. To transcend projects, the information should be updated in the configuration file.

Example File
Here is an abbreviated example of a configuration file:
[DefaultKeymap] DefaultKeymap=brief [KmapAssign] KmapAssign=<Ctrl-`>, Preprocess [LibPreload] LibPreload=PRG.DLL [Editor] KeyDelay=1200 KeyRepeat=5 Autosave=20 SysSetFileLocking=30 [Colors] ColorError=0xe0 ColorWarning=0xd4 SysSetDefault=DEFAULT_COLOR_TEXT,0x1f SysSetDefault=DEFAULT_COLOR_SELECTION,0x9e [Printer] PrintLineInc=5 PrintFooter="-Page %p-" PrintHeader="%f %d %t" PrintFlags=145

152

Introduction to Configuration and State


PrintMarginBottom=0 PrintMarginRight=0 PrintMarginLeft=0 PrintMarginTop=0 [Definitions] EvalStrAdd=DEBUG,1 [Compiler] CompilerAssign='Borland C++','.c'

Example Interpretation
Here is an interpretation of the contents of the example configuration file above. The analysis proceeds section by section:

Editor Section The Editor section of the example configuration file sets the keyboard delay and repeat rate. Auto-save is set to occur after 20 seconds of keyboard inactivity. File locking is enabled for 30 file handles Colors Section The Colors section of the example sets the color of error messages to black on yellow, and the color of warning messages is set to red on gray. These are global settings. The next two color settings may be set differently for each edit window. For this reason, we do not use the functions ColorText and ColorSelection to set the colors, but rather set what the default color will be. You use the SysSetDefault functions when setting defaults for things that are specific to individual buffers or windows. In this case, the color of text is set to white on blue, and the highlight for the selection is set to yellow on light blue. DefaultKeymap Section The default key command set to BRIEF. This will cause BRIEF.DLL to be loaded and its function brief to be called. KmapAssign Section In the KmapAssign section, a key assignment is added to the default keymap. The Preprocess function is assigned to the Control - Backquote keystroke. LibPreload One of the supplemental language support DLLs is loaded for use.

153

Processing At Startup
Printer Section The Printer section and a number of other sections use private, undocumented functions. The Print menu item within Codewright controls the contents of this section. You can probably guess what most of it does, but you are not encouraged to fiddle with it. Definitions Section This section defines the label DEBUG and gives it a value of one. This label may be used in numeric expressions processed by Codewright, including those given through the Command Key and the Preprocess function (#ifdefs). Compiler Section In this section, the Borland C++ compiler is assigned for use on files that have the .C file extension.

Processing At Startup
When Codewright is launched, the command line is processed before the configuration file or the state file. This gives the command line the opportunity to specify the location of these files. It also means there is some potential for the configuration file to reverse the effects of a parameter specified on the command line. The following sections of the configuration file are automatically read at startup in the order given: Menu DefaultKeymap KmapAssign LibPreload Editor VersionControl Template Colors Ribbon

After the portions of the configuration file that are automatically read have been processed, the state file is processed. This gives settings in the state file priority over similar commands in the configuration file.

154

Processing At Startup
Order of Processing
The functions under each of the section headings are executed in the order they are listed. Regardless of the order in which the sections occur, however, the sections are always executed in the same order. The Printer, Compiler, Definitions and other sections are processed as needed. Each section heading represents a logical grouping of functions, as shown in the list below:

+HDGLQJ
Colors

)XQFWLRQV
Functions to set the colors for text, messages and so on. This is done with the SysSetDefault function described in the Online Programmer's Reference. Used primarily by Codewright for saving associations between file extensions and compilers. The function that sets the initial key command set, usually Brief or CUA. For example, the statement DefaultKeymap=brief will cause Codewright to load BRIEF.DLL and call its keymap function, which it assumes to be the same as the filename root -- brief. Defines labels for use in expression evaluation. System-wide functions, default settings (except for keymap), and any other functions that are not order dependent. Used by Codewright for saving the parameters used by the File Find and File Grep features. Key assignments that are additions or modifications to the default keymap. Load DLLs that are not automatically loaded. Defines the menu structure, if other than the default. The results of using the Menu Editor are placed here. Used by Codewright for defining print margins and headers. Defines modifications to the default ribbon and sidebar configuration after using the ribbon editor. Contains user-defined Language Template definitions. For defining command lines for Check-in, Check-out and several other related commands. The section is duplicated for each version control system defined, so that you may have separate commands for each.

Compiler DefaultKeymap

Definitions Editor Fmatch KmapAssign LibPreload Menu Printer Ribbon Template VersionControl

You may place any Codewright function under any of the section headings, but grouping functions logically under section headings will help ensure that the functions are executed

155

User Defined Sections


in their proper order. For example, you could place the default keymap in the Editor section, but then the modifications and additions made in the KmapAssign section would be lost when the keymap is loaded over top of them.

User Defined Sections


You may define other section headings and place other editor commands under those sections. These commands will not be processed automatically at startup, however. Many functions you might want to create for assignment to a keystroke are a simple sequence of functions to execute consecutively. Return values are not examined, and no control structures are required. Under these conditions, you can place the sequence of functions in a user defined section, and assign the processing of that section to a keystroke. Here is an example: [ISearchBack] SrchSetFwd=FALSE ISearch= SrchSetFwd=TRUE This example simplifies the process of performing an incremental search backwards in the buffer. Usually, the search options are set to search forward. You could bring down the menu and change the options and then change them back, after performing your incremental search. The example above changes the search options to search backward, performs the incremental search and then sets the search direction to forward. After you have created this section in your configuration file, you could make a key assignment like the one below, also in your configuration file: [KmapAssign] KmapAssign="<F12>","ConfigFileRead '' 'ISearchBack'" This key assignment will cause Codewright to do a backwards incremental search when  is pressed. You can use this example key assignment to implement other examples or sections of your own.

Save and Restore Position The following example can be used in place of the standard save and restore position commands:
[RotateMarks]

156

User Defined Sections


MarkRestorePos= MarkSavePos= MarkRotatePos= [StackMarks] MarkSavePos= MarkRotatePos= If you use StackMarks to save your current position, you will restore positions in the same order you saved them instead of the reverse order in which you saved them. By using RotateMarks instead of the restore position command, restored positions are not lost, but rather moved to the other end of the list. You can then continuously cycle through your saved positions. Together, these two sections give a functionality similar to that of Microsoft's PWB.

Scrap Buffers This next example makes good use of Codewright's Multiple scrap buffers. For it to be useful, you must first define more than one scrap buffer. You define the number of scrap buffers in the Clipboard tab of the Document Preferences dialog. Use these sections instead of Cut, Copy and Paste:
[RingCopy] BlockCopy= ScrapNext= MsgMessage="Copied to current scrap" [RingCut] BlockCut= ScrapNext= MsgMessage="Cut to current scrap" [RingPaste] ScrapPrev= BufInsertScrap= MsgMessage="Current scrap inserted" When using these three sections in place of Copy Cut and Paste, you get a last-in first-out ring of scrap buffers. Successive copy or cut operations (without an intervening Paste) do not overwrite each other until you run out of scrap buffers. Successive Paste operations let you paste the contents of each scrap buffer in the reverse order they were used.

157

Relating Checkboxes to Functions


Relating Checkboxes to Functions
There are a series of checkboxes common to the Options tab of the Project Properties dialog and the Read Configuration Data dialog. The following list will help you relate those checkboxes to the contents of your configuration file or project file:

Checkbox Option Buffer Defaults Window Defaults Default Window Font Default Window Colors System Colors

System Options

Auto-save Options Compiler Settings

Language Options

Version Control Setup Filename Filters Clipboard/Scrap Options

State File Options

Related Configuration Function SysSetDefault=DEFAULT_BUFFER SysSetDefault=DEFAULT_WINDOW _FontDefault SysSetDefault=DEFAULT_COLOR ColorCommandLine ColorError ColorMessage ColorWarning BufSetGlobalBackupSpec ExtCommentSearchLimit ExtDelayedColoring KeyDelay KeyRepeat Autosave AutosaveDir BrowseSetFile CompilerAddBuild CompilerAssign CompilerNewExt TagSetFileCompilerAdd ExtColors ExtColorsAssoc ExtIndentEnable ExtIndentEnableAssoc CheckInSetCmd CheckOutSetCmd FilterAdd FilterDeleteList ClipboardEnableSepStr ClipboardEnableTermStr ClipboardSetSepStr ClipboardSetTermStr ScrapSetCount StateSetMarkLevel

158

State File
State File
At your option, Codewright's condition at the time you exit may be recorded in a file. As part of the installation process, you had the opportunity to turn this feature on or off. If you elected the default setting, saving the state was turned on. You may specify the location and name of your state file in your Codewright configuration file. If you name a location for your state file by accessing a dialog box through the menu, it will be saved in your configuration file. If your configuration file does not contain the name of your state file, and saving state information is turned on, Codewright will search for the location of the state file in much the same manner used to locate the configuration file. The differences are as follows: The command line flag for specifying the state file is /S. The environment variable that points to the state file is CWPST. Instead of looking for CWRIGHT.INI, however, it will be looking for CWRIGHT.PST.

Once again, if no location is dictated for the state file, and no existing file is found, the file is created in the working directory. Codewright can operate just fine without a state file. In fact, you may turn off the saving of state information, and Codewright will ignore any state file and the information it contains. Similar to the configuration file, the strings that give the location of the state file may also dictate a name for the file. If the string names only a directory, the name CWRIGHT.PST will be used. The following methods of setting the location of the state file are all valid: Using the environment variable -set CWPST=d:\premia On the command line -cw /sd:\premia\cwright.pst In the CWRIGHT.INI file -StateSetFilename=H:\home\ericj

Contents of the State File


The following are among the data kept in the state file:

159

State File
Windows Visible attributes Colors Coordinates and extents System flags Attached buffer, if any Default Window Properties for the above Buffers File name Output file name Tab settings Backup file specification Line and column Max. virtual lines Current mode (hex, compact, normal) System flags Default Buffer Properties for all of the above Prompt Histories Search and Replace Command Key Open file Miscellaneous Search flags Codewright's Window frame coordinates and extents

160

Command Line Parameters


Codewright supports a number of command line parameters. You may add these parameters to the command line by editing the files shortcut, or through the File Properties selection in the Program Manager's menu. If you have multiple Codewright shortcuts or program items, the command line may be used to have each operate differently. Different program items may, through the command line, specify different configuration files, different files to load, and even different state files. The process of creating multiple Codewright program items is described in the "Getting Started" manual. The command line is processed before the configuration file and state file have been read. This allows the command line to specify the location of those files. This also has the effect of allowing the configuration file and state file to override things on the command line. This is not normally a problem, if you follow the stated guidelines for the use of flags and the contents of these files. Configuration files and state files are further described in the chapter "Configuration and State". Codewright allows three types of command line parameters. The first of these is the names of files to edit. The second is flags or switches. The third is the command file, which contains command line parameters. The command line is processed before the state file is read. As a result, some command line parameters may be overridden, unless reading the state file is inhibited. Such possible conflicts are noted in the descriptions below.

Filenames
You may specify any number of files to edit on the command line, limited only by the command line length. You may use wildcards to specify multiple files. These files are loaded in addition to, rather than in place of, any named in the state file.

Flags
Consider whether you wish to allow the configuration file to be read before or after each flag that you specify. The configuration file may in some cases cause a command line flag to be ineffective if the flag is processed first. There are upper case and lower case

161

Flags
versions of each of the Command line flags, where ever applicable. Flags specified with a lower case character will be processed before the configuration file is read. Flags that use an upper case character will be processed after the configuration file is read. Some flags require additional information in the form of an argument. The arguments appear in italics following the flag, in the descriptions below. When supplying an argument to a flag, Codewright permits the argument to immediately follow the flag, with no intervening whitespace, or to be separated from the flag by whitespace. The flags listed below are depicted as preceded with a minus or dash character ( - ). While a slash will also work in most instances, these can be mistaken for filename paths and should be avoided. -C<configLoc> The configuration location flag allows you to specify the directory or file in which configuration information is to be found. The configLoc argument names that directory or file. If configLoc names only a directory, Codewright looks for a file named CWRIGHT.INI in that directory from which configuration is read. If it names a complete path, including filename, Codewright will attempt to read configuration information from that file. When this flag does not appear on the command line, Codewright looks for a configuration information in a series of places. These places include: a directory or file named by the CWRIGHTINI environment variable, in CWRIGHT.INI in the Working Directory, in CWRIGHT.INI in the directory in which the CW.EXE or CW32.EXE file is located, or in CWRIGHT.INI in the windows directory.

This default search for configuration information is described in greater detail in the "Configuration and State" chapter of this manual. Example: cw -c c:\source\proj1 -CThis is a variant of the configuration location flag that instructs Codewright not to read a configuration file.

162

Flags
Example: cw -c-G <lineNumber> Go to the line number indicated by the argument. It should follow the name of the file to which it refers, and it may be specified following each file named on the command line. This flag will be overridden if you attempt to position the cursor in a file loaded as part of the state restoration. Example: cw -g215 -heapalloc The heap allocation flag may be used for user debugging purposes. THIS OPTION IS ONLY AVAILABLE ON THE 32 BIT VERSION OF CODEWRIGHT. When used, Codewright will use global allocation of memory. This makes it easier to detect allocation errors. Use this if you suspect your DLL has this type of memory error. Example: cw -heapalloc -K <keymap> The keymap flag names a default keymap to be used by Codewright. If this flag is used, the [DefaultKeymap] section of the Codewright configuration file will not be read. The keymap argument to this flag names a DLL (less the .DLL extension) containing the default keymap. The argument at the same time names the function contained in the DLL which initializes the keymap and makes the key assignments. Example: cw -k mycua -L <library> The library flag designates a dynamically linked library to be loaded at startup time. This flag is useful for testing user created or modified DLLs before a more permanent

163

Flags
installation. It can, however, significantly increase the amount of time it takes Codewright to start up. The library argument is the name of the library to be loaded. If this argument does not name a path to the DLL, Codewright will look in the current directory, the Windows directory and on the PATH, in an attempt to locate the DLL. Example: cw -Lmyutils -M The multi-instance flag allows you to run more than one instance of Codewright at a time. By default, multiple instances are disallowed. Your operating system must be either Windows 95 or Windows NT for this option to work. Example: cw -M -N The no files flag indicates that the state file is to be processed, except that no files from the previous session are to be restored. Example: cw -N -NOSPLASH The No splash flag suppresses the display of Codewrights opening splash screen. This can save a small amount of loading time. Example: cw -NOSPLASH

164

Flags

-P <section> The paragraph flag tells Codewright to read the named section of the configuration file. The section will be read after all of the standard portions of the configuration file have been read, to give it priority over the other contents of the configuration file. For additional information about configuration files and their contents, consult the "Configuration and State" chapter of this manual. The section argument to this flag is the name of the section of the configuration file to be processed. If you name a section that is automatically read at startup, it will be processed twice. This section name may contain whitespace. If it does, however, it must be enclosed in either single or double quotes. Examples: cw -p "Windows driver" -S <stateLoc> The state location flag allows you to specify the directory or file in which state information is to be found. The stateLoc argument names that directory or file. If stateLoc names only a directory, Codewright looks for a file named CWRIGHT.PST in that directory, from which state information is read. If stateLoc names a complete path, including filename, Codewright will attempt to read state information from that file. When this flag does not appear on the command line, Codewright looks for a state information file in a series of places, unless the saving and restoring of state information has been turned off. These places include: a directory or file named by the CWPST environment variable, in CWRIGHT.PST in the Working Directory, in CWRIGHT.PST in the directory in which the CW.EXE or CW32.EXE file is located, or in a location named in CWRIGHT.INI.

This default search for state information is described in greater detail in the "Configuration and State" chapter of this manual. Example:

165

Command Files
cw -s h:\home\ericj -SThis is a special form of the state location flag that instructs Codewright not to read a state file. State information, however, is not automatically reinitialized, and may be used subsequently. Example: cw -s-X <function> The execute function flag names a function to be invoked as part of Codewright startup. This function should not attempt to perform any configuration, since such configuration may be overridden or reversed by the subsequent processing of the configuration and state files. The function argument to this flag contains the function call. If the call contains any parameters to the function, the entire function call must be enclosed in single or double quotes. In addition, it must conform to the syntax required by LibFunctionExec. For more information about this format, refer to the "Using the Editor -- The Command Key" section of this manual. Example: cw -X"special_init 1"

Command Files
@<commandFile> A command file is a file that may contain any valid command line parameters, including additional command files. Codewright identifies filenames preceded by an @ sign as command files. Command files are useful for overcoming command line length limits and also for creating reusable, logical groupings of filenames and flags. Parameters within a command file may be separated by whitespace or newlines. Newlines are often used to promote readability.

166

Appendix A -- Color Guide


The methods of setting colors in Codewright Professional use a common scheme, intended to simplify selection of foreground and background colors. The scheme is similar to the one used by DOS, in that it has 16 predefined color settings available that you can use as either foreground or background colors. You can, however, change the RGB color settings for each of the colors in the table. This color scheme is also used by the following functions:

ColorAlternate... ColorCommandLine ColorError ColorLineNumbers ColorMessage ColorSelection ColorText ColorWarning

AttrFindColor AttrQColor AttrSelColor AttrSetColor AttrSetPaletteEntry

They each take a parameter that has a foreground/background combination encoded into a byte. Each nibble of the byte contains a value corresponding to one of 16 predefined colors. The most significant nibble describes the background color and the least significant nibble describes the foreground.

Figure 9: Example Color Byte

167

Palette Settings

Palette Settings
The table below shows the default red, green and blue values used for each of the predefined colors. The function AttrSetPaletteEntry allows you to change these mappings:

Color Black Blue BlueGreen Green Red Purple Brown Gray DarkGray LightBlue LtBlueGreen LightGreen LightRed LightGray Yellow White

Number 0 1 2 3 4 5 6 7 8 9 10 (A) 11 (B) 12 (C) 13 (D) 14 (E) 15 (F)

Blue 0 128 128 0 0 128 0 128 64 255 255 0 0 192 0 255

Green 0 0 128 128 0 0 128 128 64 0 255 255 0 192 255 255

Red 0 0 0 0 128 128 128 128 64 0 0 0 255 192 255 255

168

Appendix B -- Technical Support


If a problem arises in using or programming Codewright Professional, there are a number of things you can do to try and solve the problem. First, check the README.TXT file that was shipped along with Codewright Professional. It is placed in Codewright Professional's home directory during installation. It will warn you about any known "gotchas" that are not covered by the manual. The next place to look for help is in the manual.

Web Page
You can access our home page on the Internets World Wide Web using the following URL: http://www.premia.com. Information and services available there include: messaging to sales and tech support pricing and product descriptions problem report form downloading of add-ons and patches

Internet Mail
You can send email to support@premia.com, and we will assist you as soon as practical. For sales matters, use the address sales@premia.com.

CompuServe
Premia has a section in one of the Windows Vendor Forums on CompuServe. You can type Go Premia at any ! prompt, or look in the WinAPA forum, section 9. You may also reach us at 70673,2627.

169

Fax

Fax
A fax will normally get a quick response. Our fax number is (503) 641-6001.

Phone Support
If you urgently need some information in order to continue using Codewright Professional, or if you have an urgent bug report, give us a call. The phone number is (503) 641-6000.

Maintenance Policy
Registered users who report bugs that are later fixed are entitled to a patched version or copy of maintenance release software.

170

Appendix C -- Updating Source with Merge


The C source code files for many of Codewright's DLL's are supplied along with the program. This facilitates the process of modifying and extending the capabilities of Codewright. Changing the source code, however, presents a problem when subsequent versions arrive. There are your changes and our changes, both too valuable to give up. The solution is to merge the changes into a single new file. This appendix describes the process of updating changed files with AutoMerge. The merging capability is provided through the Merge function in the Codewright API. For a description of the Merge function, refer to the Online Programmer's Reference.

Steps to Merging
This section describes a relatively simple method of merging your Codewright V4.0 source files with the source files provided in the Codewright Professional V5.0 release. The method described does not try to conserve disk space, and could use as much as 18MB for all Codewright files. Most users will not require nearly this amount, and additional steps may be taken which will substantially reduce this requirement. So that you will know where this space is going, here is a table of the maximum expected disk storage requirements:

Category Old Installation New Installation Original Source Merged Source


A more typical example would be as follows:

Storage 6MB 6MB 3MB 3MB

Category Old Installation New Installation Original CWSTART Source Merged CWSTART Source

Storage 6MB 6MB 850K 50K

171

Steps to Merging
Identify Merge Candidates
Compare the dates on the source files in Codewright's sub directories to the release date. Most of the source files should be marked with the release date, but if you are in doubt, compare the source file date to the date on the CW.EXE or CW32.EXE file. If you have PKZIP available, you will probably find it useful to execute a DOS command like the one below in each of your Codewright source code subdirectories from your old installation: pkzip -t040494 modified *.c *.h Substitute the date on your Codewright executable in place of the 040494 in the command above. When you have done this, you will not only have archived your modified files, you will have also generated a list of these files that you can view or capture with a command like the one following: pkunzip -v modified

Make the Source Files Available


After you have identified which files need to be modified, make a list of the directories that contain these files. For use in subsequent examples, let us say that you have modified files in CWSTART, CUA, and CWDIALOG. Using the distribution disks from your old installation, run INSTALL to install only the files for the subdirectories on your list into a new directory structure. Let us call this directory CWBASE. Do not install the executables or helpfile. Dont worry if you have patched the source files since your original installation. The Merge process will apply these changes along with your own. If you have not already installed Codewright Professional V5.0, do so now. Install it into a new directory rather than installing over top of your previous installation. We suggest the name CW40 for this purpose. If disk space is tight, install only the source code for the directories on your list (plus the INCLUDE and LIB subdirectories). This will allow you to perform the Merge, and then install other source code as you need it.

172

Steps to Merging
Install AutoMerge
Find the disk marked Best of BBS in your new Codewright Professional V5.0 distribution disks, and locate the file AUTOMG.EXE. If you have the CD version of Codewright, you will find the Best of BBS disk in a subdirectory named BBS16 or BBS32, depending on whether you are using the 32 bit version of Codewright or the 16 bit version. If you have trouble locating this file, check the file MANIFEST.TXT in the root of that disk or directory. AUTOMG.EXE is a self-extracting executable that contains the AUTOMRG.DLL and its source In a DOS shell, log to the new executable directory for Codewright Professional V5.0 and Run AUTOMG.EXE from the disk, using a command like the one below: b:\utils\automg automrg.dll This will extract just the DLL. If you later want the source, you can create a subdirectory and extract the entire executable into it by running AUTOMG with no parameters. Next, run Codewright V5.0 and load the configuration file CWRIGHT.INI in its executable directory. Locate the [LibPreload] section of the file and add a line to load the AUTOMRG.DLL library as follows: [LibPreload] LibPreload=automrg.dll

Define AutoMerge Directories


The next step is to create a new section in the CWRIGHT.INI configuration file. An example of such a section appears below: [Merge] MergeBaseDir=c:\\cwbase\\cwstart MergeRevDir=c:\\cw40\\cwstart Note that backslashes in the directory names must be doubled. This is because the directory string may contain any of the escape sequences documented for the ExtExpandTemplate function. We shouldnt be needing them here, however. In our example, we are merging files in the CWSTART, CUA and CWDIALOG subdirectories. The example above prepares to merge the files in the first of these directories, CWSTART. The commands in the example above specify the directories we

173

Steps to Merging
used in our example, CW40 and CWBASE. If you used other names or your files are on another drive, substitute those names in the commands above. The last directory in these paths will need to change as we go on to merge files in another directory. The rest should stay the same. You need only change the path and save the file. You need not restart Codewright for these changes to take effect. At this point, however, we do need to restart Codewright to allow the AutoMerge DLL to be loaded.

Execute the AutoMerge Function


After restarting Codewright with the AUTOMRG.DLL loaded, load your modified version of the source files from your previous installation. For example, if you modified UTIL.C and ERRORFIX.C in your C:\CWRIGHT\CWSTART subdirectory, load those files now. Wait until you change the AutoMerge commands in your CWRIGHT.INI before loading other files you have modified. Now, for each source file loaded (except CWRIGHT.INI), obtain an API Command Prompt Execute the AutoMerge function (no parameters) Note whether or not conflicts are reported. Close the file.

The AutoMerge function creates a .MRG file for each of the files you modified. Continuing our example, AutoMerge would create the files UTIL.MRG and ERRORFIX.MRG in the C:\CWRIGHT\CWSTART subdirectory. Note that this is the subdirectory for your original installation. Modify your CWRIGHT.INI file so that the commands in your [Merge] section point to the next directory of files to merge, load the files in that directory and repeat the process. When you have repeated this for all of the subdirectories on your list, the merge is completed.

Resolve Conflicts
If conflicts were noted in any of the files you merged, load the .MRG file and search for six dashes at the beginning of a line (^------ with regular expressions on). This is how conflicts are identified within the file.

174

Steps to Merging
When you have resolved any conflicts in a merged file, you are ready to copy the file to the original filename in the new installations directory. For example, you might resolve conflicts in C:\CWRIGHT\CWSTART\UTIL.MRG and then copy it to C:\CW40\CWSTART\UTIL.C. If a version control system is available, it is advisable to put all four revisions of the file under version control before copying the file to its original name. Recompile the DLLs and test the features you previously added.

175

Appendix D -- TAGSWNN Utility


TAGSWnn (TAGSW16 or TAGSW32, depending on your platform) is the Tags program supplied with Codewright to automatically generate a tags database and compile it into a format that can be used by the built-in browser. The program is called when you select Build Tags from the Project menu. You may not ever need to run the program from the command line, but in the event that you do, or if you just wish to know more about the program, its options are briefly described here. TAGSWnn is based on the GNU Tags program written by John Kerchival. The primary changes made to it are to allow output in the Premia Compiled Tags format. This is the -p option, which is the only option we have added. Other options are as described in the TAGS.DOC file supplied with the GNU Tags program and provided with Codewright.

Usage
TAGSWnn {[OPTIONS] [SOURCEFILE|@LISTFILE]}

TAGSWnn Command Line Options


An option summary follows: -h, -? Obtain a detailed help screen directed to standard output. @LISTFILE Use LISTFILE as a "response" file. This file is a list of input filenames. This file lists filenames (with or without wildcards) one at a time and the filenames may be separated by '+', ',', ';' or by whitespace. In addition, comments are allowed within the LISTFILE. Comments are delimited by placing a pound sign '#' before the comment. This is very similar to comments allowed in a makefile except that comments are allowed on any line or at the end of any line, start at the '#' and go to the end of the current line. There must be at least one character between the filename and the comment character (i.e. '+', ',', ';' or whitespace) to differentiate between the beginning of comment and a filename character (since '#' is a valid element of a filename). -x{EXCLUDEFILE|@LISTFILE}

176

TAGSWnn Command Line Options


Excludes the files specified by EXCLUDEFILE or excludes all files listed in LISTFILE using the same syntax described above. -tTAGFILE Add new generated tags to TAGFILE. This file may or may not exist. All tags from TAGFILE which were derived from files currently being parsed will be removed during the merge phase. This tagfile is assumed to be in one of this utilities output formats. If sorting is specified then new tags will be merged in correct order with current case sensitivity, otherwise tags will be placed at the beginning of the new resulting tag file (this will result in quicker responses during tag searches while editing). if -m or -s are used this switch is ignored (all output is to stdout). The behavior regarding existing files is determined by the case of the switch as follows: -t (lower case) creates and outputs to a file overwriting file -T (upper case) merges all output to the tagfile if file any currently existing

there is an already existing

-pCOMPILEFILE Convert output tag file (specified by -t) into a compiled file suitable for use with Codewright. The output flag (-t) and the Codewright output format flags (-oc) must be specified for this flag, otherwise it is ignored. -lLOGFILE Output all activity to LOGFILE. The log file will be created in a LISTFILE format (i.e. suitable as input using the @LISTFILE syntax). The behavior regarding existing files is determined by the case of the switch as follows: -l (lower case) creates and outputs to a file overwriting any currently existing file -L (upper case) appends all output to the logfile if there is an already existing file -o[options] This switch is used to determine the output format to the output stream. [options] may be one of the following: e Epsilon (>= V6.0) tag format ( tokenString {tab} fileName {tab} characterOffset {tab} line ) This format is used by the Epsilon editor (V6.x) created by Lugaru Software and specifies the token identifier, the file name (including full path, normally), the

177

TAGSWnn Command Line Options


character offset of the beginning character (starting at character 0) and the line which that offset is located on. 5 Epsilon (<= V5.03) tag format ( tokenString;fileName;characterOffset ) This format is used by the Epsilon editor (V4.x and V5.x) created by Lugaru Software and specifies the token identifier, the file name (including full path, normally) and the character offset of the beginning character (starting at character 0). g GNU tag format ( tokenString {tab} fileName {tab} /$line^/ ) This format is used by GNU's EMACS editor, originally written by Richard Stallman and widely used in the UNIX community. This is also the format created by its companion utility "ctags" which does very simple function header tagging. s Space-Delimited format ( tokenString fileName lineNumber ) This format is the simplest format available and requires very little parsing and is very simple to import into foreign formats (i.e. database formats, etc.). m Microsoft Error format ( tokenString fileName(lineNumber) ) This format has an advantage in that it has been around for quite some time and a fair amount of effort has been expended to parse this format and move to the location in the source specified during compilation stages. Many macros may be modified to use this type of tag format with very minor changes. c Codewright tag format ( tokenString FileName(lineNumber) tokenType ) This format is a minor variant of the Microsoft format but is generally used in conjunction with a compiled database file format (see -p above). This is the format used by Premia's Codewright editor. -a[options] This switch is used to specify the types of tokens for which tags are generated for tagging of assembly files. All token types are tagged as the default ( -afdlmsu ). Source modules

178

TAGSWnn Command Line Options


are expected in 80x86 assembly using MASM/TASM syntax. The location of the -a switch on the command line is important. All files (and files found in LISTFILEs) will be tagged using assembly tagging (and the options specified on that switch) until another -a or -c switch is found. Order is not important for the options to this switch. f procedure labels ( token proc )( proc token ) This is a mnemonic for function (which has nothing to do with a procedure call in assembly, but does well for frail human memory. This option specifies tagging of the "proc" keyword. d definition labels ( token equ const )( token db declaration ) This option specifies tagging of defines and definition labels such as the tokens "equ", "db", "dq", "dw", "df", etc. l local labels ( token label )( label token )( token: ) This option specifies tagging of local labels (labels of local file duration). This includes the keyword "label" as well as the shorter ':' notation. m macro labels ( token macro )( macro token ) This option specifies tagging of defined macros using the keyword "macro". s struc labels ( token struc )( struc token ) This option specifies tagging of structure definitions defined using the keyword "struc". u union labels ( token union )( union token ) This option specifies tagging of union definitions defined using the keyword "union". -c[options]

179

TAGSWnn Command Line Options


This switch is used to detail the token types to tag in C and C++ source files. All token types are tagged by default ( -cdmstekuvcfpxi ). Source files are expected in standard ANSI 2.0 C/C++ syntax. The location of the -c switch on the command line is important. All files (and files found in LISTFILEs) will be tagged using C tagging (and the options specified on that switch) until another -a or -c switch is found. Order is not important for the options to this switch. d defines ( #define token statement ) This option specifies that defines are to be tagged (preprocessor defines). This does not include macros which are an extended use of the #define preprocessor directive. m macro labels ( #define token() statement ) This option specifies tagging of macros defined via use of the preprocessor #define directive. s struct globals ( struct token {} ) This option specifies tagging of structures defined via use of the "struct" keyword and implicitly defined within C++ syntax variations. t typedef globals ( typedef declaration token, token, ... ) This option specifies tagging of identifiers defined via use if the "typedef" keyword. e enum globals ( enum token {} ) This option specifies tagging of enumerations defined via use of the "enum" keyword. k enum konstants ( enum { token, token, token, ...} )

180

TAGSWnn Command Line Options


Note the cute spelling of constants with a 'k' so that I can justify the assignment of this letter. This option specifies tagging of enumeration constants within declared enumerations. u union globals ( union token {} ) This option specifies tagging of unions defined via use of the "union" keyword. v global variable ( declaration token, token = {}, token, ... ) This option specifies tagging of global variable declarations. c global class ( class token: {} ) This option specifies tagging of class definitions specified via use of the "class" keyword. f function definitions ( token() declaration {} ) This option specifies tagging of function declarations. p prototypes ( token(); ) This option specifies tagging of prototypes. x extern defines ( extern declaration ) ( extern "C" declaration ) ( extern "C" { declaration; declaration; ... } ) This option will specify that tags which have the extern storage class are to be output. The x option is a modifier and will only be effective when other options are used (i.e. -cpx must be specified to obtain extern prototypes, -cx alone yields nothing). Note also that the -cx modifier has no effect for function, define and macro tags which are tagged only according only to the f, d and m options respectively. This modifier may be placed anywhere within the options list.

181

TAGSWnn Command Line Options


i static declarations ( static declaration ) This option will specify that tags which have internal static storage class are to be output. The i option is a modifier and will only be effective when other options are used (i.e. -cvi must be specified to obtain static variable declarations, -ci alone yields nothing). Note also that the -ci modifier has no effect for define and macro tags which are tagged only according only to the d and m options respectively. This modifier may be placed anywhere within the options list. -d This flag specifies that all input listfiles and exclude response files should be deleted once parsed. This allows an automated list file generation which is cleaned up by the tags package. See description of LISTFILE below. -j This is the junk filter switch to allow the filtering of functions and declarations which are overloaded operators in C++. For example, if the junk filters are enabled then the declaration "inline myType operator+(MyType m1, MyType m2);" would not be tagged for "+" which is normally a standard C delimiter token and operator. The junk filter if enabled will filter all standard C delimiters from the output. -q This is the quiet switch and will suppress normal status output to stderr and program version information. -r This switch will suppress the default output of the full file path name and will specify the use of relative pathnames in the generated output. -n This switch will suppress sorting of the tag output (Often used in conjunction with GNU or Epsilon style tags) -i This switch specifies the use of a case sensitive sort (Normally a case insensitive sort is used). I know, the character 'i' is normally used for switching to a case insensitive behavior, things are tough all over, you'll learn to live with it.

182

Appendix E -- Specifications
Line Length Limit
Lines are limited to 536,870,911 characters.

Lines per Buffer Limit


The maximum number of lines per buffer is 536,870,911.

Buffers Limit
The maximum number of buffers is limited only by storage (memory and disk).

Windows Limit
The number of windows is limited by Microsoft Windows.

File Size
The total of all file being edited is limited by the Operating System or 536,870,911 characters, whichever is less.

Number of Files
The number of files being edited is limited to 65,535, subject to the limit on total file size given above.

Clipboard/Scrap Buffer Size


The Clipboard is limited by Windows to 64K. Scrap buffers operate under the buffer limits described above.

Search String Length


Search strings are limited to 64K.

183

184

??

Part 2,

Function Reference

186

Function Reference
This portion of the Codewright Professional Users Guide lists and defines API functions. These functions may be used in the configuration file, or in key assignments, and most may be used interactively, through the API Command Key. The syntax used by convention in these three contexts differs slightly, but since Codewright Professional gives you broad latitude in the syntax you use; the three are essentially interchangeable. The syntax used in the function descriptions below is the syntax recommended for the configuration file.

Function Description Format


The description of each function is made up of several components: the Name and Syntax, the Remarks, the Return Value, and the See Also reference. Here is a description of those components: Function Name and Usage Syntax The Syntax line provides a synopsis of the function's name, parameters and parameter types. An equal sign separates the function name from its parameters. If nothing follows the equal sign, the function takes no parameters. Each parameter and its identifying type are enclosed in angle brackets, < and >. Parameter names enclosed in quotes are static strings or string constants (e.g., <"example"> ) Remarks The Remarks describe the purpose and use of the function. Parameters Described Within the Remarks section of the Function Description is a listing and description of each parameter taken by the function. This part of the remarks section appears only if the function takes one or more parameters. API Key defaults Also in the Remarks section is a list of default values for each parameter when parameters are omitted. When a parameter is omitted, Codewright Professional must supply a default value.

187

Return Value The value returned by the function is described here. provided for diagnostic purposes only.

This information is

You cannot test the return value of a function executed from the configuration file or from key assignments. You may, however, see return values when executing functions through the API Command Key, if you prefix the function call with a question mark. This can assist you in performing diagnostics and modifying flag values. See Also References The See Also section lists related functions which may further inform you, or which may serve as an alternative to the function just described.

188

Autosave

AssignMouseKeys=

Remarks

AssignMouseKeys assigns the standard functions to the mouse keys. It is primarily for use in keymaps. KmapAssign

See Also

AttrSetPaletteEntry=<int entry>, <DWORD color>

Remarks

AttrSetPaletteEntry changes the definition of one of the colors in Codewright Professional's color palette. This can affect the appearance of the entire program.

Parameter entry
color

Description The table entry number (0 to 15) for which the color is to be changed.
The new Blue, Green and Red encoded value for the entry. The method of encoding this value is as follows: Select a value for each color from 0 to 255. Place each value in a separate byte of the color DWORD. Red goes in the least significant byte, green the next and blue the next. For example, the hex value 0x00FF7F3F specifies 0xFF for blue, 0x7F for green and 0x3F for red.

Default value when parameters not supplied The function reports a zero value if either parameter is omitted.
The Codewright Professional color palette and the factory supplied values are described in Appendix A of this manual.

Return Value

AttrSetPaletteEntry returns the value in the color table that has been replaced by the new value.

Autosave=<int idleTime>, <int forceTime >

Remarks

Autosave specifies the time intervals used for automatic file backups, when enabled.

189

AutosaveDir
Parameter idleTime Description The number of seconds of keyboard inactivity that must elapse before an auto-save is performed. A zero value effectively turns the feature off.
The number of minutes of editing time that must elapse before a save is performed, regardless of keyboard activity.

forceTime

Using this function to set both time parameters to zero effectively turns this feature off.

See Also

AutosaveDir

AutosaveDir=<"dir ">

Remarks

AutosaveDir permits you to specify a directory in which you wish to have auto-save files created. Auto-save is a feature that periodically saves your edit file, normally to a filename or directory other than the original.

Parameter dir

Description A string containing the name of the directory in which auto-save files are saved.

If a directory for auto-save files is not specified in this manner, the auto-save file is created in the same directory in which the original file resides.

See Also

Autosave

BackTab=

Remarks

BackTab is the function normally assigned to the %7 keystroke. If a selection is defined, the function outdents the block. If no selection is defined, the function moves the cursor to the preceding tabstop. Tab, SlideOut, SlideIn

See Also

BlockCopy=

190

BraceMatch
Remarks
BlockCopy copies the current selection to either the current scrap buffer or the Windows Clipboard, whichever is the designated data staging area. An informative message is printed to indicate the type of selection and the destination. BlockCut, Paste

See Also

BlockCut=

Remarks

BlockCut cuts (copies and deletes) the current selection to either the current scrap buffer or the Windows Clipboard, whichever is the designated data staging area. An informative message is printed to indicate the type of selection and the destination. BlockCopy, Paste

See Also

Brace=<BOOL commentsToo >

Remarks

Brace processes the current buffer, looking for unmatched curly braces. The cursor is positioned on the first unmatched curly brace, if one is found.

Parameter commentsToo

Description If this parameter is TRUE, the function does not exclude braces that occur within the C language comments of the file ( /* */ and // ). If FALSE, only braces outside of comments will be considered for matching.

BraceMatch=<BOOL parens_too >

Remarks

BraceMatch searches forward, beginning at the current position, for a matched pair of curly braces, { }, and optionally parentheses, ( ). The matched set and any text between them are highlighted.

Parameter parens_too

Description If TRUE, match the next set of {} or (), otherwise just {}.

191

BraceMatchNext
Default values when parameters are not supplied parens_too FALSE
If a '}' or ')' is encountered first, the function searches backward for a previous matching '{' or '(' . Since this function always begins the search with the current position, it is not well suited for highlighting a series of matched braces. It will continue to find the currently highlighted set.

Return Value See Also

BraceMatch returns TRUE when a matched set of braces or parentheses are found. If none were found, or an unbalanced set was found the function returns FALSE. Brace, BraceMatchNext

BraceMatchNext=<BOOL parens_too >

Remarks

BraceMatchNext searches forward for a matched pair of curly braces, { }, and optionally parentheses, ( ). The matched set and any text between them are highlighted.

Parameter parens_too

Description If TRUE, match the next set of {} or (), otherwise just {}.

Default value when parameter not supplied parens_too FALSE


The search will find matched sets nested within a currently highlighted block, and subsequent pairs, when called repeatedly.

Return Value See Also

BraceMatchNext returns TRUE when a matched set of braces or parentheses are found. If none were found, or an unbalanced set was found the function returns FALSE. Brace, BraceMatch

BufBackspace=<DWORD count>

Remarks

BufBackspace removes one or more characters preceding the current position in the buffer.

192

BufDelChar
Parameter count Description The number of characters to remove.

Default value when parameter not supplied count 1


Any remaining text shifts to fill the position previously occupied by the removed character.

Return Value See Also

This function returns 0 if the operation is successful. It returns -1 upon error, such as when there is no current buffer or the buffer is read-only. BufDelChar

BufDelChar=<DWORD count>

Remarks

BufDelChar removes characters from the buffer, beginning at the current position. While the function will delete the end-of-line sequence when the count parameter so indicates, it will not delete beyond the end of the current line, regardless of the value of count.

Parameter count

Description The number of characters to delete.

Default value when parameter not supplied count 1


The end-of-line sequence is counted as a single character, whether it is one character or two. Specifying a large value for count may be used as a method of deleting through the end of the line.

Return Value

BufDelChar returns zero to indicate success, even if fewer than the specified number of characters are available for deletion. It only returns non-zero if the buffer is read only or if there is no current buffer. BufDelLine

See Also

193

BufDelLine
BufDelLine=<DWORD count>

Remarks

BufDelLine removes one or more lines from the buffer, beginning with the line containing the current position.

Parameter count

Description The number of lines to delete.

Default value when parameter not supplied count 1


The value of count may be greater than the number of lines subsequent to the current position in the buffer.

Return Value

BufDelLine returns zero to indicate success, even if fewer than the specified number of lines are available for deletion. It only returns non-zero if the buffer is read only or if there is no current buffer. BufDelChar

See Also

BufDelSelection=

Remarks

BufDelSelection removes the current selection. The contents of the selection is not placed in the scrap buffer. It may, then, only be recovered by executing Undo. On success, BufDelSelection returns 0. If no selection was defined, the function returns a non-zero value. BufDelChar

Return Value See Also

BufDelToEOL=

Remarks

BufDelToEOL removes characters from the current position to the end of the line. It does not remove the end of line marker.

194

BufEditFile
Return Value
BufDelToEOL returns zero to indicate success, even if the cursor is already at the end of the line, and it therefore deletes nothing. It only returns non-zero if the buffer is read only or if there is no current buffer. BufDelLine

See Also

BufEditFile=<"file">

Remarks

BufEditFile creates a new buffer for the specified file and assigns it to the current window. If no window is currently defined, one is created. If the system flag is set that indicates One buffer per window a window is created for each file read into a buffer. The buffer or buffers are added to the buffer list following the one that was previously current, if any. If a file opened by BufEditFile is already loaded, it is made current.

Parameter file

Description The filename and optional path of the file to be edited. May contain DOS standard wildcard characters.

Default value when parameter not supplied file ""


If file is an empty string, the function prompts for a filename. If file contains wildcards, a buffer is created for each file that matches the pattern and the first is assigned to the current window. This function honors the "One Buffer Per Window" System Option, if set. When BufEditFile is used to prompt for a file to edit, the functions provides additional assistance in selecting a file to edit. When command-line prompting is enabled (rather than prompting via pop-up dialogs), the user may select from a list of files matching a specified pattern by first entering the pattern and then pressing 7. Alternately, if the user presses the up or down arrow keys in response to the prompt, the user may select a file specified previously.

195

BufInsertChar
BufInsertChar=<int key>

Remarks

BufInsertChar inserts a character at the current buffer position.

Parameter key

Description The character to insert.

Default value when parameter not supplied key Ascii portion of the current keycode
This function causes the current position in the buffer to be advanced. If the character is inserted beyond the end of a line, the virtual space is filled with spaces or tabs to the position at which the character was inserted. If a keycode is used as a parameter to this function, the ASCII portion of that code is inserted into the buffer. Newline characters (0x0A) may be inserted with this function. They will, however, be inserted by calling the BufInsertEOL function. Likewise, inserting a tab character with this function will result in the appropriate tab expansion being inserted in the buffer -that is, a tab if "use tabs" is enabled and otherwise the appropriate number of spaces. To insert a raw newline or tab, use the BufInsertStr function.

See Also

BufInsertStr, BufInsertEOL

BufInsertEOL=

Remarks

BufInsertEOL inserts a newline sequence at the current position. This has the effect of moving the cursor to the beginning of the new line. The specific newline sequence inserted will be either a carriage-return and line-feed, or just a line-feed, depending on the buffer setting selected. The factory setting is the carriage-return and line-feed combination.

BufInsertFile=<"path">

196

BufInsertScrap
Remarks
BufInsertFile reads the named file into the buffer at the current position.

Parameter path

Description The string containing the filename and optional path.

Default value when parameter not supplied path NIL


At the completion of this function, the cursor is positioned immediately following the inserted text.

Return Value

On success, BufInsertFile returns 0. If the file could not be found, or some other error occurred, a non-zero value is returned to indicate the nature of the failure.

BufInsertScrap=

5HPDUNV

BufInsertScrap inserts the contents of the Scrap buffer into the edit buffer at the current position. The resulting cursor position depends on the type of selection used to place the text into the scrap buffer.

Selection type inclusive/exclusive


line column

Cursor position At the end of the inserted text.


Text is inserted at the beginning of the current line. The cursor follows the text in which it was originally located. On the line following the last of the inserted text, at the original column position.

There are other functions which performs similar operations on the Windows Clipboard. These functions begin with the Clipboard... prefix.

5HWXUQ 9DOXH 6HH $OVR

This function returns 0 unless the Scrap buffer is empty. In that case, it returns a nonzero value. BufCopyToScrap, BufCutToScrap, BufAppendToScrap

197

BufInsertStr
BufInsertStr=<"string">

Remarks

BufInsertStr inserts the supplied string into the buffer at the current buffer position.

Parameter string

Description The string to insert.

Default value when parameter not supplied string NIL


This function causes the current position in the buffer to be advanced. If the string is inserted beyond the end of a line, the virtual space is filled with spaces or tabs to the position at which the character was inserted. The string may contain newline sequences and tab characters, but newlines will not receive any of the special treatment afforded by BufInsertEOL and a raw tab will be inserted regardless of the state of the "use tabs" option.

See Also

BufInsertChar, BufInsertEOL

BufSetAutoIndentMode=<WORD mode>

5HPDUNV

BufSetAutoIndentMode sets the fill mode to be used by the auto indent feature. This function does not turn auto-indent on or off.

Parameter mode

Description A value from 0 to 4 indicating the method of filling white space at the beginning of lines, when auto-indent is in effect. Labels for the values and their meaning appear below: Description Immediately fills the indent by duplicating exactly the whitespace present on the preceding line. Used with AUTO_INDENT_VIRTUAL, searches backward, skipping empty lines, until it finds a line with text on it. The white space on the new line is modeled after that line.

Value Label
AUTO_INDENT_DUPLICATE AUTO_INDENT_SEEK

198

BufSetBackupSpec
AUTO_INDENT_SPACE AUTO_INDENT_TAB AUTO_INDENT_TABMODE AUTO_INDENT_VIRTUAL

Immediately fills the indent with spaces, even if the line receives no further edits. Immediately fills the indent optimally (tabs, then spaces as needed), even if the line receives no further edits. Immediately fills the indent with spaces, or spaces and tabs, depending on whether tab usage is enabled. Positions the cursor at the indented position on new lines, but does not fill until the line is edited.

Default value when parameter not supplied mode 0

5HWXUQ 9DOXH 6HH $OVR

BufSetAutoIndentMode returns the old fill mode for auto-indent. If the value for the parameter is out of range, the function returns -1. BufSetAutoIndent, BufQAutoIndentMode

BufSetBackupSpec=<"format">

5HPDUNV

BufSetBackupSpec defines where backup files are placed.

Parameter format

Description The format string describing the location where backup files are placed.

Default value when parameter not supplied format BufQBackupSpec()


The format string may contain certain control characters that refer to portions of the filename of the file to be backed up. This allows you to describe in a generalized way a method for deriving the name of the backup file from the name of the output file. When used in the format string, each of these control characters must be preceded by a percent ( % ) sign. Below is a list of these format control characters and their meaning:

199

BufSetGlobalBackupSpec
Format Control %b %d
%[{...}]e

Represents basename directory


extension

Description
The entire name of the output file (fully qualified). Includes the path and drive (volume) specifier, but only ends with a backslash if describing the root directory. Includes the dot, unless the name of the output file has no extension. May optionally contain a transformation pattern. The root name and extension. Does not contain the drive (volume) or filename. Always ends with a backslash. Does not contain extension, drive (volume) or path. May optionally contain a transformation pattern. The drive letter and the colon. A single percent sign is represented by two consecutive percent signs (%%).

%f %p %[{...}]r %v %%

filename path root volume percent

Example: BufSetBackupSpec("%b%{??~|__}e") The initial default for this local backup specification is an empty string. This means that the global backup specification is relied upon for locating and naming backup files. If the global string is also empty, backups are effectively turned off. Formatting strings, transformation patterns and the subject of backup files are discussed, and examples provided in the "General Operations -- Backup Files and Directories" section of this manual.

5HWXUQ 9DOXH 6HH $OVR

BufSetBackupSpec returns 0 on success, and non-zero on failure. The most likely cause of this function failing is when there is no current buffer. BufSetGlobalBackupSpec, BufQBackupSpec, BufQGlobalBackupSpec

BufSetGlobalBackupSpec=<"format">

5HPDUNV

BufSetGlobalBackupSpec defines where backup files are placed.

200

BufSetTabStr
Parameter format Description The format string describing the location where backup files are placed.

Default value when parameter not supplied format BufQGlobalBackupSpec


The format string may contain literal text and certain control characters that refer to portions of the filename of the file to be backed up. This allows you to describe in a generalized way a method for deriving the name of the backup file from the name of the output file. The initial value for this string is "%b.bak", which causes backups to be made in the same directory as the file being backed up. The backup file is given the extension .BAK. Setting this backup specification an empty string has the effect of turning backups off, unless a backup specification has been defined for a specific buffer. The initial default does not assign backup specification strings to individual buffers. Example: BufSetGlobalBackupSpec("%b.bak") Formatting strings, transformation patterns and the subject of backup files are discussed, and examples provided in the "General Operations -- Backup Files and Directories" section of this manual.

5HWXUQ 9DOXH 6HH $OVR

BufSetGlobalBackupSpec returns 0 on success, and non-zero on failure. BufSetBackupSpec, BufQBackupSpec, BufQGlobalBackupSpec

BufSetTabStr=<"tabPicture">

5HPDUNV

BufSetTabStr defines the tab settings for the current buffer.

Parameter tabPicture

Description Contains a list of column numbers at which tab stops are to occur. If tab stops are at regular intervals, only the first two need to be

201

BufSetTabUsage
named. The distance separating the last two entries is repeated to the limit indicated by BufQMaxTabCol.

Default value when parameter not supplied tabPicture "5 9"


The initial default tab string is "5 9". This sets tabs at four column intervals. The tab string for the current buffer may be obtained with the BufQTabStr function. The maximum tab column may be set with the BufSetMaxTabCol function.

6HH $OVR

BufQMaxTabCol, BufQTabStr, BufSetMaxTabCol

BufSetTabUsage=<BOOL use_tabs>

5HPDUNV

BufSetTabUsage sets whether a tab character or spaces are inserted into the buffer when the tab key is pressed. It also determines how virtual space is filled when characters are inserted beyond the end of a line.

Parameter use_tabs

Description Tells whether to set use of tabs on (TRUE) or off (FALSE).

Default value when parameter not supplied use_tabs 1


When use of tabs is on, the 7 key simply inserts a tab character. Inserting text in the virtual space beyond the end of a line will cause an appropriate combination of spaces and tabs to fill the virtual space to the left of the column where text is inserted. When use of tabs is off, pressing the 7 key causes spaces to be inserted up to the position of the next tab stop. In this case, only spaces are used to fill the virtual space beyond the end of a line. Some users may require that virtual space be filled in a manner different from the way the Tab key operates. Those users will find it relatively simple to devise a function to perform the task of filling virtual space to the current position.

202

BufWriteFile
The initial default for this feature enables the use of tab characters.

6HH $OVR
BufWrite=

BufQTabUsage

Remarks

BufWrite writes the contents of the current buffer to its assigned output filename. This changes the value of the buffer's SysFlags. This function returns 0 upon successful completion. If an error occurs, a non-zero value is returned, indicating the nature of the failure.

Return Value

BufWriteFile=<"filename">

Remarks

BufWriteFile writes the contents of the current buffer to the file named by the parameter.

Parameter filename

Description The name of the file, and optionally its path, to which the current buffer is written.

Default value when parameter not supplied filename NIL


This function sets the buffer's saved attribute. The modified attribute of the buffer, however, is not altered, as it would be with the BufWrite function. BufWrite writes the buffer to its assigned output file and resets the modified attribute. For this reason, you would not normally write to the buffer's output file using this function. This function is used by the auto-save feature.

Return Value

BufWriteFile returns 0 upon successful completion, and a non-zero value when an error occurs. The most likely causes of an error are either an invalid path, or insufficient storage available. BufWrite, BufWriteSelection

See Also

203

BufWriteSelection
BufWriteSelection=<"path">

Remarks

BufWriteSelection writes the contents of the currently defined selection to the specified filename.

Parameter path

Description The string containing the output filename and optional path.

Default value when parameter not supplied path NIL


Unlike other selection operations, BufWriteSelection does not remove the selection.

Return Value See Also

On successful completion, BufWriteSelection returns zero. If an invalid path is specified or no selection is marked, the function returns a non-zero value. BufWrite

CenterLine=

Remarks

CenterLine scrolls the current window up or down so that the line that the cursor is on is in the center of the window. It is useful for showing the context surrounding text that matched a search, for example. ToBottom, ToTop

See Also

CheckIn=<"cmd">, <"project">, <"archive">, <"file">

Remarks

CheckIn executes a command to check a file into a version control system or other archive.

Parameter cmd

Description A string containing the command line that performs the check-in. If this parameter is a NULL, the command "PUT %b%e" will be used. The command may contain any of the following escape

204

CheckIn
sequences, which are decoded using the other parameters of this function:

Escape %% %B
%b %D %d %E %e %n %p %R %r %V %v project

Meaning
% (a single percent sign) The basename (the complete filename, except for the extension) of the version control archive. The basename (the complete filename, except for the extension) of the workfile. The directory of the version control archive. (only ends in backslash if root directory) The directory of the workfile. (only ends in backslash if root directory) The extension of the version control archive. (includes the dot, unless extension is null) The extension of the workfile. (includes the dot, unless extension is null) The project name, as named by the project parameter. The path element of the filename (ends with a backslash) The root of the version control archive. (filename less path and ext.) The root of the workfile. (filename less path and extension.) The volume of the version control archive. (drive letter and colon) The volume of the workfile to check-in. (drive letter and colon)

A string naming the project of which the file to be checked-in is part. The %n project name escape sequence is based on the content of this string. This parameter is not currently used. It may therefore be NULL. It is not required by Codewright Professional as currently implemented, but is available in the event that it is useful to, or required by a version control system. A string containing the filename of the file to check-in. All the escape sequences above are based on the filename in this string, except %n.

archive

file

Default value when parameter not supplied cmd project archive NIL NIL NIL Return Value See Also

file NIL

CheckIn returns the error level resulting from the execution of the command, or -1 if an error prevents execution. ExecComand, CheckOut

205

CheckInBuffer

CheckInBuffer=<"filename">

Remarks

CheckInBuffer executes the CheckIn function on the specified buffer. The buffer is saved to disk before the check-in command is executed.

Parameter filename

Description A string containing the filename of the buffer to be checked in. If this string is empty or a NULL the function uses the effective output filename for the current buffer.

Default value when parameter not supplied filename NIL


After the operation is completed, Codewright Professional checks to see if the file is still there and, if so, checks the read/write status of the file. If the file is gone, the buffer is automatically closed. If the file is Read-Only, the status of the buffer is changed to match.

Return Value See Also

CheckInBuffer returns the value returned by the check-in command executed.

CheckIn, CheckOutBuffer

CheckInSetCmd=<"command">

Remarks

CheckInSetCmd sets the command line to be used for checking in a file under a version control or other archiving system. This function operates in support of the Check-in dialog box, and may appear in your Codewright Professional configuration file.

Parameter command

Description A string containing the command line to execute when checking in a file is requested. The file to be checked in is selected in the dialog box, but that name is not automatically added to the command line. A series of macros are available for referencing

206

CheckOut
portions of the selected filename within the command line. Those macros are listed below:

Macro %b %d %e %n %p %r %v %%

Element of Selected Filename(s) The basename (drive, path and root -- no extension) The directory (path with no trailing backslash, no drive) The extension (begins with the dot) The project name The path (ends with a trailing backslash) The root (filename less drive, path and extension) The volume (drive letter and colon) Percent sign

Default value when parameter is not supplied command NIL See Also
CheckOutSetCmd

CheckOut=<"cmd">, <"project">, <"archive">, <"file">, <BOOL lock>

Remarks

CheckOut executes a command to check-out a file from a version control system or other archive.

Parameter cmd

Description A string containing the command line that performs the check-out. If this parameter is a NULL, the command "GET %b%e" or "GET -l %b%e" will be used, depending on the condition of the lock parameter. The command may contain any of the following escape sequences, which are decoded using the other parameters of this function: Meaning
% (a single percent sign) The basename (the complete filename, except for the extension) of the version control archive. The basename (the complete filename, except for the extension) of the workfile.

Escape %% %B
%b

207

CheckOutBuffer
%D %d %E %e %n %p %R %r %V %v project
The directory of the version control archive. (only ends in backslash if root directory) The directory of the workfile. (only ends in backslash if root directory) The extension of the version control archive. (includes the dot, unless extension is null) The extension of the workfile. (includes the dot, unless extension is null) The project name, as named by the project parameter. The path element of the filename (ends with a backslash) The root of the version control archive. (filename less path and ext.) The root of the workfile. (filename less path and extension.) The volume of the version control archive. (drive letter and colon) The volume of the workfile to check-in. (drive letter and colon)

A string naming the project of which the file to be checked-out is part. The %n project name escape sequence is based on the content of this string. This parameter is not currently used. It may therefore be NULL. It is not required by Codewright Professional as currently implemented, but is available in the event that it is useful to, or required by a version control system. A string containing the filename of the file to check-in. All the escape sequences above are based on the filename in this string, except %n. This parameter is only used when the cmd parameter is null. It selects between the default command lines for checking out a file without or with a lock. If TRUE, the default command is "GET -l %b%e". If FALSE, the command used is "GET %b%e".

archive

file

lock

Default value when parameter not supplied cmd project archive NIL NIL NIL

file NIL

lock FALSE

Return Value See Also

CheckOut returns the error level resulting from the execution of the command, or -1 if an error prevents execution. ExecCommand, CheckIn

CheckOutBuffer=<BOOL withLock>, <"filename">

208

CheckOutSetCmd
Remarks
CheckOutBuffer executes the CheckOut function to replace the specified buffer and associated file with one that has been previously archived. The checked-out version of the file is loaded into the buffer. The "check-out w/Lock" command is used to signal an intention to modify the file.

Parameter withLock

Description When this parameter is TRUE, the "check-out w/Lock" command is used to signal an intention to modify the file. When FALSE, the "check-out for browse" command is used.
A string containing the filename of the buffer to be checked out. If this string is empty or a NULL the function uses the effective output filename for the current buffer.

filename

Default value when parameter not supplied filename withLock NIL FALSE
Use this function with caution. Any unsaved edits will be lost, and the existing file will be overwritten without further prompting.

Return Value See Also

CheckOutBuffer returns the value returned by the check-out command executed.

CheckOut, CheckInBuffer

CheckOutSetCmd=<BOOL lockIt>, <"command">

Remarks

CheckOutSetCmd sets the command line to be used for checking in a file or file under a version control or other archiving system. This function operates in support of the Check-out dialog box.

Parameter lockIt

Description When TRUE, this function specifies the command line for checking out a file with a lock, indicating the intention to modify

209

ClipboardEnableSepStr
the file. The locking capability is not supported by all version control and archiving systems. When FALSE, this function specifies the command line for checking out a file without locking it. This is usually referred to as getting a "browse" copy, and is often write-protected. command A string containing the command line to execute when checking out a file is requested. The file to be checked out is selected in the dialog box, but that name is not automatically added to the command line. A series of macros are available for referencing portions of the selected filename within the command line. Those macros are listed below:

Macro %b %d %e %n %p %r %v %%

Element of Selected Filename(s) The basename (drive, path and root -- no extension) The directory (path with no trailing backslash) The extension (begins with the dot) The project name The path (ends with a trailing backslash, no drive) The root (filename less drive, path and extension) The volume (drive letter and colon) Percent sign

Default value when parameter is not supplied lockIt command FALSE NIL See Also
CheckInSetCmd

ClipboardEnableSepStr=<int state>

5HPDUNV

ClipboardEnableSepStr enables or disables the use of a clipboard separator string. The clipboard separator string is used to separate lines or line segments when they are copied from a Codewright Professional buffer to the Windows Clipboard.

Parameter state

Description When non-zero, the separator string is enabled. When zero, the separator is disabled.

210

ColorCommandLine
Default value when parameter not supplied state TRUE
The function ClipboardSetSepStr defines the string. This function enables or disables its use. The initial setting for this feature is enabled.

5HWXUQ 9DOXH 6HH $OVR

ClipboardEnableSepStr returns the previous state, enabled (non-zero) or disabled (zero). ClipboardEnableTermStr, ClipboardSetSepStr, ClipboardQSepStr

ClipboardSetSepStr=<"sepStr">

5HPDUNV

ClipboardSetSepStr assigns a new value to the clipboard separator string. The clipboard separator string is used to separate lines or line segments when they are copied from a Codewright Professional buffer to the Windows Clipboard.

Parameter sepStr

Description A pointer to the string containing the new value for the clipboard separator string.

Default value when parameter not supplied sepStr NIL


The initial value for this string is "\n", a newline sequence. This string is only used when enabled.

6HH $OVR

ClipboardSetTermStr, ClipboardQSepStr, ClipboardEnableSepStr

ColorCommandLine=<int ColorCode>

Remarks

ColorCommandLine sets the foreground and background color that is applied to the Codewright Professional API command line .

211

Color...
Parameter ColorCode Description The code indicating the foreground and background color desired. A value of -1 for this parameter causes the function to report the current setting without modifying it.

Default value when parameter not supplied ColorCode -1


A table listing the 16 color combinations available appears in Appendix A of this manual.

Return Value See Also

ColorCommandLine returns the code of the color in effect when the function was called. ColorError, ColorWarning, ColorMessage

Color... ColorComments=<int color> ColorDiffAdd=<int color> ColorDiffDel=<int color> ColorInsertedLines=<int color> ColorKeywords=<int color> ColorModifiedLines=<int color> ColorLinenumbers=<int color> ColorSelection=<int color> ColorText=<int color>

Remarks

The Color... functions set or retrieve the color setting for various objects for the current window. The table below describes which of these functions sets which objects:

Function
ColorComments ColorDiffAdd ColorDiffDel

Object The color used, when Language Dependent ChromaCoding is on, to color comments in the source code. The color applied to lines that are flagged as added in the output of a File Difference operation. The color applied to lines that are flagged as deleted in the output of a File Difference operation.

212

ColorError
ColorInsertedLines ColorKeywords ColorLinenumbers ColorModifiedLines ColorSelection ColorText

The color used, when Changed Lines ChromaCoding is on, to color lines that have been inserted during the current edit session. The color used, when Language Dependent ChromaCoding is on, to color keywords in the source code. The color used for the line numbers that appear to the left of each line, when enabled. The color used, when Changed Lines ChromaCoding is on, to color lines changed during the current edit session. The color used for the selection (marked block). The color used for normal, unselected text.

Parameter
color

Description
The id of the foreground/background combination to be used. Color ids are listed in Appendix A of this manual.

Default value when parameter not supplied color -1

Return Value See Also

The Color... series of functions return the id of the color previously in use for the object in question. ColorCommandLine, ColorError, ColorMessage, ColorWarning

ColorError=<int ColorCode>

Remarks

ColorError sets the foreground and background color applied to error messages.

Parameter ColorCode

Description The code indicating the foreground and background color desired. A value of -1 for this parameter causes the function to report the current setting without modifying it.

Default value when parameter not supplied ColorCode -1

213

ColorMessage
A table listing the 16 color combinations available appears in Appendix A of this manual.

Return Value See Also

ColorError returns the code of the color in effect when the function was called.

ColorWarning, ColorMessage, ColorCommandLine

ColorMessage=<int ColorCode>

Remarks

ColorMessage sets the foreground and background color applied to messages.

Parameter ColorCode

Description The code indicating the foreground and background color desired. A value of -1 for this parameter causes the function to report the current setting without modifying it.

Default value when parameter not supplied ColorCode -1


A table listing the 16 color combinations available appears in Appendix A of this manual.

Return Value See Also

ColorMessage returns the code of the color in effect when the function was called.

ColorError, ColorText, ColorWarning

ColorWarning=<int ColorCode>

Remarks

ColorWarning sets the foreground and background color applied to Warning messages.

Parameter ColorCode

Description The code indicating the foreground and background color desired. A value of -1 for this parameter causes the function to report the current setting without modifying it.

214

ConfigFileRead
Default value when parameter is not supplied ColorCode -1 (reports the current setting)
A table listing the 16 color combinations available appears in Appendix A of this manual.

Return Value See Also

ColorWarning returns the code of the color in effect when the function was called.

ColorError, ColorText, ColorMessage

ColorWarning=<int ColorCode>

5HPDUNV

ColorWarning sets the foreground and background color applied to Warning messages. These are the messages displayed using the MsgWarning function.

Parameter ColorCode

Description The code indicating the foreground and background color desired. A value of -1 for this parameter causes the function to report the current setting without modifying it.

Default value when parameter not supplied ColorCode -1 (reports the current setting)
A table listing the 16 color combinations available appears in Appendix A of this manual. These color combinations may be modified using the ColorSetPallete function.

5HWXUQ 9DOXH 6HH $OVR

ColorWarning returns the code of the color in effect when the function was called. ColorError, ColorText, ColorMessage

ConfigFileRead=<"fname">, <"sectionName">, <BOOL leaveOpen>

5HPDUNV

ConfigFileRead reads a section from a configuration file.

215

CWHelp
Parameter fname Description A pointer to the string containing the name and path of the configuration file. If the string is empty, Codewright Professional uses the configuration file read at startup.
The name of the paragraph or section that is processed. This name is specified without the enclosing square brackets that are required in the file. When TRUE, this parameter indicates that the configuration file is to be left open for impending updates. This speeds the process of updating the file. The file must not be left open indefinitely, however. If it is, another source may attempt to update the file, which could result in a sharing violation.

sectionName

leaveOpen

Default value when parameter not supplied fname sectionName leaveOpen NIL NIL FALSE

CWHelp=<long key>, <int mode>

Remarks

CWHelp calls the appropriate help library, based on the parameters and filenames defined.

Parameter key

Description This long integer can be either a string containing the name of the topic, or a 32 bit context identifier, depending on the mode specified. The latter is for looking up a topic by number.
A value, as defined in WINDOWS.H, indicating the look-up method to use. A list of accepted values and their labels appears below:
Label
HELP_KEY

mode

Description

Perform a lookup on the string pointed to by the key parameter. Perform a numeric lookup on the contextidentifier in the key parameter. Ignore the key parameter and display help on using Help.

HELP_CONTEXT

HELP_HELPONHELP

216

DeleteNextWord
HELP_INDEX

Ignore the key parameter and display an index of the Codewright Professional help library.

Default value when parameter not supplied key mode NIL HELP_KEY
If a default help library has been named with the CWHelpDefaultName function, special action is taken whenever a topic cannot be located in Codewright Professional's internal tables. In that case, WinHelp is called upon to find the topic in that default library.

Return Value

CWHelp returns TRUE if the help executable is called. FALSE is returned otherwise.

DefaultKeymap=<"keymapName">

Remarks

DefaultKeymap initializes a keymap DLL and makes it current.

Parameter keymapName

Description A string containing the name of the keymap function, which is also the basename of the DLL containing that function. For example "cwvbrief", "cwvcua" or "mykeys". The keymap function must install and initialize the keymap.

Default value when parameter not supplied keymapName NIL Return Value
DefaultKeymap returns TRUE if the keymap DLL was found and loaded, and the keymap function was found and invoked. QDefaultKeymap

See Also

DeleteNextWord=

217

DeletePrevWord
Remarks
DeleteNextWord deletes from the cursor position to the beginning of the next word. The NextWord function is used to determine the beginning of the next word. As supplied, NextWord defines the beginning of a word as the first non-whitespace character immediately following the next space, tab or newline. If you modify NextWord this function will operate differently. NextWord, DeletePrevWord

See Also

DeletePrevWord=

Remarks

DeletePrevWord deletes from the cursor position to the beginning of the previous word. The PrevWord function is used to determine the beginning of the next word. As supplied, PrevWord defines the beginning of a word as the first non-whitespace character immediately following the preceding space, tab or newline. If you modify PrevWord this function will operate differently. DeleteNextWord

See Also

DisplayFileName=

Remarks

DisplayFileName displays the name associated with the current buffer. This will be the buffer name, if one is defined. Usually, no buffer name has been defined, in which case this function prints the original filename from which the buffer was read.

Dlg...

218

Dlg...
DlgBufferSave=0, <"caption"> DlgBufSettings= DlgDiff= DlgExtensionConfig= DlgFFind= DlgFGrep= DlgFileBuild= DlgFilter= DlgKeys= DlgMarkGoto= DlgMarkGotoLine= DlgMarkSet= DlgMerge= DlgMultiBufSearch= DlgMultiFileSearch= DlgOpenFile= DlgPrint= DlgPrintSetup= DlgSaveAs=0, <"initFilename"> DlgSelectDir= DlgSetSelectBuffer= DlgSysColor= DlgWinColor= DlgWinFont= DlgWinSettings=

Remarks

The Dlg... series of functions are functions that let you call dialog boxes directly. Many of them are available for assignment to a keystroke sequence. Those that return buffer handles or string pointers are intended for use in extension functions written by the user. A description of the purpose of each of these dialogs appears below:

Function
DlgBufferSave DlgBufSettings DlgDiff DlgExtensionConfig DlgFFind DlgFGrep DlgFilter DlgKeys

Dialog Invoked...
The Buffer Save dialog and saves the selected buffers. The Buffer Settings dialog to allow changing one or more buffer's settings. The Differencing dialog. The Extension-specific Settings dialog. The File Find dialog. The File Grep dialog. The Filter dialog (Not on any menu). The Key Bindings dialog.

219

DlgMenuPopup=<LPSTR menuName>
DlgMarkGoto DlgMarkGotoLine DlgMarkSet DlgMerge DlgMultiBufSearch DlgMultiFileSearch DlgOpenFile DlgPrint DlgPrintSetup DlgSaveAs DlgSelectDir DlgSetSelectBuffer DlgWinColor DlgWinFont DlgWinFontDefault DlgWinSettings
The Goto Mark dialog. The Goto Line dialog. The Mark dialog. The Merge dialog. The Multi-buffer dialog. The Multi-file dialog. The File/Open dialog. The Print dialog. The Printer Setup dialog. The File/Save As dialog. The File/Change Dir dialog. The Buffer Selection dialog, allows the user to select a new current buffer, and then assigns that buffer as current. The Colors dialog from the Options menu. The Font dialog from the Options menu. The Default Font dialog from the Options menu. The Settings dialog from the Options menu.

Parameter
caption

Description
The functions that accept a caption parameter string use it as a title for the dialog. These functions call multi-purpose dialogs and the supplied caption indicates the purpose in this instance. The function DlgSaveAs takes this parameter as a string to initially display in the Filename edit box. In many cases this is the name of the current buffer. If this pointer is NIL the edit box will initially be empty.

initFilename

DlgMenuPopup=<LPSTR menuName>

Remarks

DlgMenuPopup reads a popup menu definition from a file and displays the menu it describes.

Parameter
menuName

Description
The name of a popup menu definition section in the file CWRIGHT.MNU, or the name of a file containing a popup menus

220

EditPrevBuffer
definition. If the parameter is a section name, the parameter begins and ends with square brackets. Here is an example key assignment using the DlgMenuPopup function in your CWRIGHT.INI file: [KmapAssign] KmapAssign=<Mouse_right_click> DlgMenuPopup [Utilities]

DlgMenuExec=<LPSTR sectionName>

Remarks

DlgMenuPopup reads a section in the CWRIGHT.MNU file and executes the lines it contains sequentially.

Parameter
sectionName

Description
This parameter contains the name of a section in the file CWRIGHT.MNU that is a series of Codewright API calls. This parameter should begin and end with square brackets.

This function is intended primarily for use in the function call portion of an item definition line, but it may be assigned directly to a key, if desired.

EditNextBuffer=

Remarks

EditNextBuffer makes the next buffer in the buffer list current. The function skips any system buffers in the list. The name of the buffer made current is printed on the status line or in a pop-up window. EditPrevBuffer

See Also

EditPrevBuffer=

Remarks

EditPrevBuffer makes the previous buffer in the buffer list current. The function skips any system buffers in the list. The name of the buffer made current is printed on the status line or in a pop-up window.

221

EdVersion
See Also
EditNextBuffer

EdVersion=

Remarks

EdVersion displays Codewright Professional's version number on the status line or a pop-up message box.

ErrKmapAssign=<"keyName">, <"funcCall">

5HPDUNV

ErrKmapAssign makes key assignments to the Window keymap used for the Output Window. There are few assignments in this keymap by default. This prevents accidental editing.

Parameter keyName
funcCall

Description A string describing the key combination to which the function call is assigned (e.g., "<alt-a>").
A string describing the function call to assign to the key combination (e.g., "MovUp 1"). If this parameter is NIL the assignment is not made.

Default value when parameter not supplied keyid function_call NIL NIL
The method of representing key combinations in strings is detailed in "Key Bindings -Keymaps and Keystrings" section of this manual.

5HWXUQ 9DOXH

ErrKmapAssign returns TRUE upon successful completion, and FALSE if the assignment cannot be made. Failure is usually due to an invalid keystring, since the function assigned to it is not checked for validity at this time. KmapAssign

6HH $OVR

222

EvalStrDel
EvalStrAdd=<"label">, <long value>

Remarks

EvalStrAdd adds a string identifier to the list of those recognized by the expression evaluator. The string can then be used in place of a number, in expressions to be evaluated. This function may also be used to change the value associated with strings that are already defined.

Parameter label
value

Description The string which to associate with a numeric value. Case is significant in defining this string.
The numeric value to associate with the string.

Default value when parameter not supplied label value NIL 0 Return Value See Also
EvalStrAdd returns TRUE if the string definition was added to the list. If the string was already defined, and the change parameter is FALSE, the function returns FALSE. EvalStrDel

EvalStrDel=<"label">

Remarks

EvalStrDel deletes a string identifier from the list of those recognized by the expression evaluator.

Parameter label

Description The string identifier that to delete. Case is significant in specifying this string.

Default value when parameter not supplied label NIL Return Value
EvalStrDel returns TRUE if the label was found and deleted. If the label was not defined, the function returns FALSE.

223

ExecApp
See Also
EvalStrAdd

ExecApp=<"command">

Remarks

ExecApp executes a specified command line. If the command is not supplied in the parameter, the function prompts for it. The command line may invoke either a Windows or DOS application. If executing a DOS application, the subprocess terminates at the conclusion of the command.

Parameter command

Description A string containing the command line to execute, including any arguments and flags. When this string is empty or NIL, the function prompts for a command line.

Default value when parameter not supplied command NIL

Return Value See Also

ExecApp returns the exit code returned by the executed application, if any.

ExecCommand

ExecCommand=<"command ">

Remarks

ExecCommand spawns a command shell from which a command or a series of commands may be executed. The shell used is the one pointed to by the COMSPEC environment variable.

Parameter command

Description A string containing the command line to execute, including any arguments. If this string is omitted or empty, the command shell itself is run. The user must then type "Exit" to close the shell.

224

ExecUserCmnd
Default value when parameter not supplied command NIL Return Value
ExecCommand returns the error level returned by the executed command, or -1 if an error prevents execution. If just the command shell is invoked, the function will return 0.

ExecUserCmnd=<"command">, <WORD wflag>

Remarks

ExecUserCmnd executes a specified command line, after expanding any % macros.

Parameter command

Description A command line which may contain macros referencing the name of the current buffer or some portion thereof. The following macros are defined for use in this parameter: Macro %b %d %e %p %r %v %% Element of Current Buffer Name The basename (drive, path and root -- no extension) The directory (path with no trailing backslash) The extension (begins with the dot, if not null) The path (ends with a trailing backslash) The root (filename less drive, path and extension) The volume (drive letter and colon) Percent sign

wflag

When this parameter is 0 the task is executed in the foreground. When this parameter is 1 the task is executed in the background.

Default value when parameter not supplied command wflag NIL 0


This function may be used to execute either a Windows or DOS command line.

Return Value

ExecUserCmnd returns the exit code of the command executed.

225

ExecuteMacro
See Also
ExecCommand

ExecuteMacro=<"funcStr">

Remarks

ExecuteMacro invokes an API or user-defined function provided in a string parameter. If the string is NIL, the command is prompted for.

Parameter funcStr

Description The string containing the name of the function to be executed and the parameters to provide to that function. If this string is NULL, the function prompts for this information. The case used for the function name is not significant.

Default value when parameter not supplied funcStr NIL


To see the value returned from a function, place a question mark at the beginning of the function call. To display the result of an expression evaluation, prefix the function call with two question marks.

ExtAddKeyword=<"ext">, <"keyword ">

Remarks

ExtAddKeyword adds a keyword to the table of keywords for Language Dependent ChromaCoding, associated with a specified filename extension.

Parameter ext

Description A string containing the extension with which the keyword is to be associated. This extension must be one for which there is built-in support, or one you have added support for. Support is currently built-in for the following extensions: .C, .CPP, .CXX, .PAS, .ASM, and if the appropriate DLLs are loaded .SC and .PRG.
A string containing the keyword to be colored by Language Dependent ChromaCoding, when enabled for the specified extension.

keyword

226

ExtAlias
Default value when parameter not supplied ext keyword NIL NIL Return Value See Also
ExtAddKeyword does not return a value

ExtReadKeywordFile

ExtAlias=<"new">, <"existing ">

Remarks

ExtAlias confers a set of extension-specific attributes on an additional extension. Files with the specified extension (File Type) are processed in the same manner as a predefined type.

Parameter new
existing

Description A string containing the filename extension which is to be treated synonymously with another extension.
A string containing the filename extension that is currently processed in the desired manner.

Default value when parameter not supplied new existing NIL NIL
There are several features that are language-specific, and are predefined as applying to files with a certain extension. These features are ChromaCoding, Template Expansion, and Smart Indenting. For the purposes of these features, files with certain extensions are assumed to contain source code for a specific programming language. These assumptions are listed in the table below:

Extensions .ASM .C; .H .CPP; .CXX .PAL .PAS

Programming Language Assembly C C++ Paradox Pascal

227

ExtAssignTemplate
There may be additional extensions to which you want to apply these language-specific features. For example, you may wish to classify files with the extension .INC as Assembly or Pascal files. The ExtAlias function allows you to do this. Some Windows CASE tools require that include files follow special naming conventions. ExtAlias allows you to follow these conventions without losing Codewright Professional's language-specific features for these files. Example: ExtAlias=".CWL",".C" This statement in your Codewright Professional configuration file would cause files with the extension .CWL to be treated as C language files for ChromaCoding, Template Expansion, and Smart Indenting.

ExtAssignTemplate=<"ext">, <"keyw">, <"templ">

Remarks

ExtAssignTemplate provides a means of adding or modifying language templates. You will find a general description of Language Templates in the General Operation chapter of this manual.

Parameter ext

Description A string containing the filename extension to which the template applies. The extension is used to identify files containing source code for a certain language. The template being defined only applies when the current buffer has this file extension.
A string containing the keyword or abbreviation that triggers template insertion. Pressing the space bar after typing this word inserts the template. A string containing the encoded template. There are special characters defined for use in language templates, that give Codewright Professional instructions. Here is a table of the special characters available, and their meanings:

keyw

templ

Char. \n & @

Purpose New Line. Simulates pressing enter at this point. Specifies cursor position after template insertion. Issues a backspace.

228

ExtColorsAssoc
\c Insert 'c' literally, (e.g., \&, \@, \\)

Default value when parameter not supplied ext keyw templ NIL NIL NIL

ExtColors=<int level>

Remarks

ExtColors controls the status of the ChromaCoding features. Use it to turn on the highlighting of programming language keywords and comments, or to turn on changed line highlighting.

Parameter level

Description When this parameter has a value of 1, ChromaCoding is enabled for keywords and comments. A value of 2 enables ChromaCoding for changed lines. These two modes are mutually exclusive. A zero value turns off ChromaCoding completely. To obtain the current status without changing it, supply a -1 value for this parameter.

Default value when parameter not supplied level -1 Return Value See Also
ExtColors returns the current setting of the ChromaCoding feature. ExtIndentEnable, ExtAssignTemplate

ExtColorsAssoc=<"ext">, <int level >

Remarks

ExtColorsAssoc enables or disables ChromaCoding for files having a specified extension, or for all extensions.

Parameter ext

Description A string containing the extension for which ChromaCoding is to be enabled or disabled. The extension .* causes the command to

229

ExtCommentSearchLimit
apply to all extensions, overriding the settings for specific extensions. level When this parameter is 0, ChromaCoding is turned off. A value of 1 for this parameter turns on Language Dependent ChromaCoding. A value of 2 turns on Changed Lines ChromaCoding. When this parameter is -1 the function reports the current state of ChromaCoding without altering it.

Default value when parameter not supplied ext level NIL 0

Return Value

ExtColorsAssoc returns the previous setting of ChromaCoding for the specified extension. This value is interpreted in the same manner as the level parameter above. ExtIndentEnableAssoc

See Also

ExtCommentSearchLimit=<long limit>

5HPDUNV

ExtCommentSearchLimit sets the maximum number of lines that ChromaCoding will scan, forward and backward from the cursor, to determine if that position is in a comment. The default setting for this feature is 30.

Parameter limit

Description The new line limit for searching for comment delimiters.

Default value when parameter not supplied limit 0


This function helps optimize the performance of ChromaCoding. By default, Codewright Professional searches 100 lines in each direction to find the beginning and end of comments, relative to the current position. You can safely reduce this amount if you have virtually no single comment that spans 100 lines. This will allow the ChromaCoding feature to make assumptions faster, thereby improving performance.

230

ExtExpandTemplate
5HWXUQ 9DOXH 6HH $OVR
ExtCommentSearchLimit returns the previous setting of the comment search limit. ExtColorsAssoc

ExtDelayedColoring=<int on>

5HPDUNV

ExtDelayedColoring turns on, off or reports the current setting of delayed coloring. This determines if a newly loaded file should be ChromaCoded first and then display (not delayed), or displayed and then ChromaCoded (delayed).

Parameter on

Description When this parameter is non-zero, delayed coloring is turned on. When it is zero, delayed coloring is turned off. If the value of this parameter is -1, the setting is not modified, but the function reports the current setting by way of the return value.

Default value when parameter not supplied on 0

5HWXUQ 9DOXH 6HH $OVR

ExtDelayedColoring returns the new setting of the delayed coloring feature. ExtCommentSearchLimit

ExtExpandTemplate=<"template">

5HPDUNV

ExtExpandTemplate expands the specified template string. This is a relatively low level function that does no checking to see if the template expansion is appropriately placed.

Parameter template

Description A string containing the template to execute at the current cursor position. The string may require escape sequences and predefined macros. Macros are identified with a %. A list of these macros appears below:

231

ExtExpandTemplate
Macro form %colNum %date %db %dcNum %de %dlNum %dw %eEnVar$ %fFilename$
%home %lineNum %mdNum %meof %meol %mlNum %mrNum %muNum %Num
Description
Moves the cursor to column Num of the current line. Inserts a U.S. formatted date string at the current cursor position. (mm/dd/yy) Deletes to the beginning of the line. Deletes Num characters at cursor. Deletes to the end of the line. Delete Num line, beginning with the current. Delete the word at the cursor. Insert the string value associated with environment variable EnVar. Insert the named file at the cursor. Any template macros within the file are also processed. Move the cursor to the beginning of the line. Move the cursor to the line named by Num. Move down Num lines. Move the cursor to the end of the file. Move the cursor to the end of the line. Move the cursor left by Num columns. Move the cursor right by Num columns. Move up Num lines. When Num is 0 to 9, it refers to a user-definable string that may be defined differently for each extension. Any macros contained in these strings are also expanded. Typically, these assignments are made in CW??.EXT or your configuration file. The macros 0 through 3 are used for custom indentation in predefined language templates. See ExtSetTemplateMacro. Higher numbered macros (10 through 31) are not extension specific, but are otherwise similarly definable. They are reserved for the use of individual users.

%open %qPrompt$ %repCNum %restore %save %time %tof

Open a new line following the current. Similar to going to the end of the line and pressing . Query for string to insert, using the string Prompt to prompt the user. Insert Num repetitions of character C. Restore a saved position. Save a position for later restoration. Insert a formatted time string. (hh:mm:ss) Move cursor to the top (first line) of the file. Requires %home to assure positioning at the first character of the file.

232

ExtIndentEnableAssoc
%xFuncCall$
Execute the Codewright Professional API function call in FuncCall. This may be any function that could be assigned to a key or otherwise executed through LibFunctionExec.

Default value when parameter not supplied template NIL

ExtIndentEnable=<int level>

Remarks

ExtIndentEnable controls the smart-indenting and language template features of Codewright Professional.

Parameter level

Description When this parameter has a value of 1, Smart-indenting is enabled. A value of 2 enables Template Expansion and Smart-indenting. (Template Expansion relies on Smart-indenting and therefore cannot be enabled alone.) A zero value turns off both of these features. To obtain the current status without changing it, supply a -1 value for this parameter.

Default value when parameter not supplied level -1 Return Value See Also
ExtIndentEnable returns the current setting. ExtColors, ExtAssignTemplate

ExtIndentEnableAssoc=<"ext">, <int level >

Remarks

ExtIndentEnableAssoc enables or disables Smart Indenting and/or Template Expansion for files having a specified extension, or for all extensions.

Parameter ext

Description A string containing the extension for which Smart Indenting/Template Expansion is to be enabled or disabled. The extension .* causes the command to apply to all extensions.

233

ExtKmapAssign
level When this parameter is 0 both Smart Indenting and Template Expansion are disabled. A value of 1 enables Smart Indenting. A value of 2 enables both Smart Indenting and Template Expansion. When this parameter is -1 the current setting is reported but is not altered.

Default value when parameter not supplied ext level NIL 0

Return Value

ExtIndentEnableAssoc returns the previous setting of Smart Indenting and Template Expansion for the specified extension. This value is interpreted in the same manner as the level parameter above. ExtColorsAssoc

See Also

ExtKmapAssign=<keyName>, <funcCall>

Remarks

ExtKmapAssign makes key assignments to the keymap overlay used for language indentation and template expansion.

Parameter keyName
funcCall

Description A string describing the key combination to which the function call is assigned (e.g., "<alt-a>").
A string describing the function call to assign to the key combination (e.g., "MovUp 1"). If this parameter is NIL the assignment is not made.

Default values when called from LibFunctionExec (Command Key) keyid function_call NIL NIL
The method of representing key combinations in strings is detailed in "Key Bindings -Keymaps and Keystrings" section of this manual.

234

ExtReadTemplateFile
Return Value
ExtKmapAssign returns TRUE upon successful completion, and FALSE if the assignment cannot be made. Failure is usually due to an invalid keystring, since the function assigned to it is not checked for validity at this time. KmapAssign

See Also

ExtReadKeywordFile=<"ext">, <"filename">

Remarks

ExtReadKeywordFile reads a series of keywords from a file and associates them with a specified extension. When Language Dependent ChromaCoding is enabled for that extension the added keywords will be colored.

Parameter ext

Description A string containing the extension with which the keywords are to be associated. This extension must be one for which there is builtin support, or one you have added support for. Support is currently built-in for the following extensions: .C, .CPP, .CXX, .PAS, .ASM, and if the appropriate DLLs are loaded .SC and .PRG.
A string containing the name of the file in which the list of additional keywords has been placed. The keywords in the file must be in the format of one keyword per line.

filename

Default value when parameter not supplied ext filename NIL NIL Return Value See Also
ExtReadKeywordFile returns TRUE when the keyword file is successfully found and read. The function returns FALSE otherwise. ExtAddKeyword

ExtReadTemplateFile=<"ext">, <"fname">

5HPDUNV

ExtReadTemplateFile allows loading a series of template assignments from a file.

235

ExtSetDelimiters
Parameter ext Description A string containing the name of the extension to which the templates apply. This string may optionally begin with a dot. (e.g., ".C" or "cpp")
A string containing the name of the file in which the template definitions are found. The format of this file is one template assignment (or definition) per line. Each line contains two string parameters. They may each be enclosed in quotes and separated by whitespace. These are used as the last two parameters of the function ExtAssignTemplate. The first is the word or words that are to trigger the template insertion. The second parameter is the template that is inserted when triggered. This string contains % macros, escape sequences and literal text, as necessary to insert the desired form. See the description of ExtAssignTemplate for further details.

fname

Default value when parameter not supplied ext fname NIL NIL

5HWXUQ 9DOXH

ExtReadTemplateFile returns TRUE if the named file was found and read. This is not indicative of the contents of the file being in proper format. If the file could not be read or found, the function returns FALSE. ExtReadKeywordFile, ExtAssignTemplate

6HH $OVR

ExtSetDelimiters=<"ext">, <"delimiters">

5HPDUNV

ExtSetDelimiters is used to set extension-specific word delimiters in the Extensionspecific Settings file. It appears under the [Extension.xxx] headings in either the configuration file, the project file, or a user-defined file, depending on which option has been selected.

Parameter ext

Description A string containing the affected extension. If this parameter is NIL the delimiters for the current buffer's file type are set.

236

ExtSetStyle
delimiters A string containing those characters, in addition to whitespace, that separate words for this file type. This string is used as a character class in a regular expression. The characters - ^ " and ] therefore need to be escaped. Precede these characters with a backslash. If this parameter is NIL, the delimiters are not modified, but the current setting may be obtained from the return value.

Default value when parameter not supplied ext delimiters NIL NIL

5HWXUQ 9DOXH 6HH $OVR

ExtSetDelimiters returns a string containing the new set of delimiters for the specified extension. NextWord, PrevWord

ExtSetStyle=<"ext">, <int level>

5HPDUNV

ExtSetStyle sets or query Extension-specific indentation style used. At present, this function is only effective on C and C++ files for determining the positioning of braces when templates are expanded.

Parameter ext
level

Description A string containing the affected extension.


A number indicating the desired style. A value of -1 for this parameter does not modify the setting, but allows the current setting to be reported via the return value. Other possible values are noted below:

Value 1 2
3

Meaning Braces on their own lines, not indented. Opening brace at end of line, closing brace on its own line. (K&R) Braces on their own lines, indented.

Default value when parameter not supplied ext level NIL 0

237

ExtSetTemplateMacro
5HWXUQ 9DOXH 6HH $OVR
ExtSetStyle returns the new setting for the indentation style for the specified extension. ExtQIndenting

ExtSetTemplateMacro=<int number>, <"macro">, <"ext">

5HPDUNV

ExtSetTemplateMacro sets the string associated with a numbered template expansion macro.

Parameter number

Description A number from 0 to 31 indicating which numbered macro is being defined. The macro may then be used in templates, by referencing this number preceded by a percent sign (e.g., %1, %3). Macros from 0 to 9 may be associated with an extension so that templates may operate differently for different languages.
The string to insert in place of the macro reference. This string may contain other % macros, escape sequences or literal text. For more information on % macros, refer to the description of ExtExpandTemplate. A string containing the file extension with which the macro is to be associated. This parameter is ignored if the number parameter is a value greater than 9, since these cannot be associated with an extension. For values 0 through 9, if this parameter is NIL the macro is not associated with any extension. It will then only be used if the current buffer has no corresponding macro defined for its extension.

macro

ext

Default value when parameter not supplied number macro ext 0 NIL NIL

6HH $OVR

ExtExpandTemplate, ExtAssignTemplate

ExtSetUpdateDelay=<int numCalls>

238

ExtSetWrap
5HPDUNV
ExtSetUpdateDelay sets the number of times that the ChromaCoding update function is called before it does a complete update. This allows you to control how quickly or how intrusively colors are updated.

Parameter numCalls

Description The number of times the update function is called before a complete update is triggered.

Default value when parameter not supplied numCalls 0


The initial default for the update delay is 20 calls. To make ChromaCoding update faster, lower this number. To be interrupted by updates less often, increase this number.

6HH $OVR

ExtCommentSearchLimit

ExtSetWrap=<"ext">, <int level>

5HPDUNV

ExtSetWrap determines whether the word wrap feature will be turned on or off for files with a specified extension.

Parameter ext

Description A string containing the extension with which the setting is to be associated. This may optionally begin with a dot. (e.g., ".txt" or "C")
When this parameter is 0, the word wrap feature is turned off. When it is a value of 1, word wrap is enabled, but only on the current line. Lines following may require reformatting as a result of edits. A value of 2 for this parameter enables continuous reformatting of the lines from the cursor to the end of the paragraph. See the function WrapEnable for a further description.

level

Default value when parameter not supplied ext level NIL 0

239

FFind
5HWXUQ 9DOXH 6HH $OVR
ExtSetWrap returns the new setting of the word wrap feature for the specified extension. WrapEnable, WrapSetRightMargin, WrapParagraph

FFind=<"filePattern">

5HPDUNV

FFind searches for files matching a specified pattern. It writes the names of matching files in a file for review. The name of the file in which the names of matching files are stored is set with the function FFindFile.

Parameter filePattern

Description A string containing the pattern for which a list of matching files is desired. The pattern may contain the standard DOS wildcard characters ? and *. If the pattern contains a path element, the scope of the search is limited to that directory and its subdirectories. If the pattern does not contain a path element, the search covers the current directory and its subdirectories.

Default value when parameter not supplied filePattern NIL


When the filePattern parameter is NIL or an empty string, the default file pattern, specified with the FFindPattern function, will be used.

5HWXUQ 9DOXH 6HH $OVR

FFind returns the number of matches found. FFindFile, FFindPattern, DlgFFind

FFindFile=<"filename">

Remarks

FFindFile defines the name of the file in which the FFind function will place the names of files that satisfy its search.

Parameter filename

Description A string containing the name of the output file for FFind.

240

FFindShow
Default values when parameters not supplied filename NIL Return Value
FFindFile returns the new output filename.

FFindNext=

Remarks

FFindNext highlights and processes the next entry in the File Find list of matching files. The indicated file is automatically loaded.

FFindPattern=<"defaultFPat">

5HPDUNV

FFindPattern defines the default filename search pattern for the DlgFFind function.

Parameter defaultFPat

Description A string containing the default filename pattern for the DlgFFind dialog (the pattern initially displayed). The pattern may contain the standard DOS wildcard characters ? and *. If the pattern contains a path element, the scope of the search is limited to that directory and its subdirectories. If the pattern does not contain a path element, the search covers the current directory and its subdirectories.

Default value when parameter not supplied defaultFPat NIL

5HWXUQ 9DOXH 6HH $OVR


FFindShow=

FFindPattern returns a string containing the new default pattern. FFindFile, FFind, DlgFFind

Remarks

FFindShow displays the list of files matching a recent File Find operation.

241

FGrepFile
See Also
DlgFFind

FGrepFile=<"outputFile">

5HPDUNV

FGrepFile defines the name of the message file in which FGrep and DlgFGrep place their output for review.

Parameter outputFile

Description A string containing the name of the message file used by the File Grep functions.

Default value when parameter not supplied outputFile NIL

5HWXUQ 9DOXH 6HH $OVR

FGrepFile returns the new name of the message file. FGrep, DlgFGrep

FGrepFlags=<WORD flags>

5HPDUNV

FGrepFlags specifies the default search options used by FGrep if none are specified, and also the initial settings of these options in the DlgFGrep dialog.

Parameter flags

Description A value dictating the attributes of the search. The following values may be ORed together to obtain the desired combined value: Label
FGREP_DIRSEARCH FGREP_REGEX

Description Include subdirectories in the search.


Consider the search string to be a regular expression. Allow lower case or upper case characters to match the pattern.

FGREP_IGCASE

242

FGrepPattern
FGREP_BUFSEARCH

Search only the currently loaded buffers.

Default value when parameter not supplied flags 0

5HWXUQ 9DOXH 6HH $OVR


FGrepNext=

FGrepFlags returns the new value for the File Grep flags. FGrep, DlgFGrep

Remarks

FGrepNext highlight and processes the next entry in the File Grep list of locations of matching text. The file containing the matching text is loaded, and the cursor is placed on the line containing the match. DlgFGrep, FgrepShow

See Also

FGrepPattern=<"defaultRegex">

5HPDUNV

FGrepPattern defines the text or regular expression search pattern initially displayed in the DlgFGrep dialog.

Parameter defaultRegex

Description A string containing the search pattern for the DlgFGrep dialog (the pattern initially displayed). The pattern may be an ordinary string search, or a regular expression, depending on the option flags specified.

Default value when parameter not supplied defaultFPat NIL

5HWXUQ 9DOXH

FGrepPattern returns a string containing the new default pattern.

243

FGrepScope
6HH $OVR
FGrepFile, FGrep, FGrepFlags, DlgFGrep

FGrepScope=<"defaultFPat">

5HPDUNV

FGrepScope defines the default filename search pattern for the DlgFGrep function.

Parameter defaultFPat

Description A string containing the default filename pattern for the DlgFGrep dialog (the pattern initially displayed). The pattern may contain the standard DOS wildcard characters ? and *. If the pattern contains a path element, the scope of the search is limited to that directory and its subdirectories. If the pattern does not contain a path element, the search covers the current directory and its subdirectories.

Default value when parameter not supplied defaultFPat NIL

5HWXUQ 9DOXH 6HH $OVR


FGrepShow=

FGrepScope returns a string containing the new default pattern. FGrepFile, FGrep, DlgFGrep

Remarks See Also

FGrepShow display the message file generated by the DlgFGrep function. DlgFGrep

FileTabs=<"extension">, <"tabString">

5HPDUNV

FileTabs creates an association between a filename extension and a tab string. After the association has been made, whenever a file with that extension is loaded into a buffer the associated tab string is used to define tab stops in that buffer.

244

FilterAdd
Parameter extension
tabString

Description A string containing the filename extension to associate with the tab string. When this string is empty, the tab string is applied globally.
A string describing the locations of tab stops in buffers associated with the extension.

Default value when parameter not supplied extension tabString NIL NIL
Tab strings are further described under the Tabs and BufSetTabStr functions. This function is used primarily in the configuration file.

6HH $OVR

Tabs, BufSetTabStr, BufQTabStr

FilterAdd=<"desc">, <"types">, <WORD position>

5HPDUNV

FilterAdd permits the user to add file filters to those used by the File Open, File Save As, File New Browse, Edit Insert dialog boxes. File filters are the wildcard patterns that appear in the "List file of Type" box that is in the lower left of these dialog boxes.

Parameter desc

Description A string containing a description of the files that match the filter. For example, "C source Files(*.c;*.h)". by convention, the filters are part of this string, placed in parentheses. This string must not be zero length.
A string containing a list of the wildcard patterns that define the files to display, when this filter is selected. Members of this list are separated by semicolons. For example, "*.c;*.h". This string must not be zero length. A number specifying the position within the list of file filters where this filter is placed, with 0 indicating the first position. Numbers larger than the number of members in the list will place the filter at the end of the list.

types

position

245

FilterDeleteList
Default value when parameter not supplied desc types position NIL NIL 0
File filters may be created interactively, through the use of the File Filters dialog. This function is primarily used in the configuration file.

6HH $OVR
FilterDeleteList

FilterDeleteList, FilterGetList

5HPDUNV 6HH $OVR

FilterDeleteList deletes the entire list of user-defined file filters. FilterAdd, FilterGetList

FontSelectMsg=<int fhandle>, <int stockFont>

5HPDUNV

FontSelectMsg sets a default font for status line messages. Use of this function may require the Microsoft Window SDK.

Parameter fhandle
stockFont

Description The numeric handle of a previously created font. If zero, a stock font may be specified.
Specifies a built-in Windows font. Numeric values for this parameter are predefined in WINDOWS.H. (values 10 to 16)

5HWXUQ 9DOXH 6HH $OVR


GotoLine=

FontSelectMsg returns TRUE if a font was successfully selected. If not, the function returns FALSE. FontSelectWin, FontCreate, FontQCurrent

Remarks

GotoLine prompts the user, on the status line or in a pop-up window, for the number of the line at which the cursor is to be placed. This function is usually assigned to a key.

246

KeyPlayback

InsertMode=

Remarks

InsertMode toggle the condition of the insert/overtype flag for the current buffer, and prints a message stating which mode is in effect. The message appears on the status line or in a pop-up window. The function is intended for assignment to a key.

ISearch=

Remarks

ISearch performs an incremental search forward from the cursor position in the current buffer. An incremental search is a search in which the program does not wait for the entire search string to be entered. Instead, it searches for a match for what has been typed thus far, after each character is typed. For example, if you type a character "a" it searches forward for the character "a". If next you type "b" it searches forward, including the current position, for "ab". When you find the desired string, or want to cancel the search, just press [Esc]. SrchFind

See Also

KeyPlayback=<"keystring">

Remarks

KeyPlayback plays back the keystrokes recorded in the string supplied as a parameter as if they had been typed from the keyboard.

Parameter keystring

Description The string containing the keystroke representations.

Default value when parameter not supplied keystring The current keystroke recording
The keystrokes represented in the string follow the format described in the "Key Bindings -- Keymaps and Keystrings" section of this manual.

247

KeyRecord
Return Value
KeyPlayback returns one of the following values:

Value 0 1 2 3 See Also


KeyRecord

Meaning Successful completion There is nothing to play back. A series of keystrokes is currently being recorded. A recording is currently playing.

KeyRecord=<BOOL overwrite>

Remarks

KeyRecord toggles the recording of keystrokes entered at the keyboard. If keystroke recording is not currently on, it is turned on. Otherwise it is turned off.

Parameter overwrite

Description When the value of this parameter is TRUE, any previous recorded keystrokes will be overwritten. If FALSE, the function will fail instead.

Default value when parameter not supplied overwrite 0 Return Value See Also
KeyRecord returns 0 upon successful completion and 1 if a playback is currently in process. A value of -1 is returned if the function fails. KeyPlayback

KmapAssign=<"keyid">, <"function_call">

Remarks

KmapAssign assigns a function call, including any necessary parameters, to a key combination in the current keymap.

248

LibAutoLoad
Parameter keyid
function_call

Description A string describing the key combination to which the function call is assigned (e.g., "<alt-a>").
A string describing the function call to assign to the key combination (e.g., "MovUp(1)"). If this parameter is NIL the assignment is not made.

Default value when parameter not supplied keyid function_call NIL NIL
The method of representing key combinations in strings is detailed in "Key Bindings -Keymaps and Keystrings" section of this manual. Example: KmapAssign="<Shift-ctrl-UP>","movup 5 "

Return Value

KmapAssign returns TRUE upon successful completion, and FALSE if the assignment cannot be made. Failure is usually due to an invalid keystring, since the function assigned to it is not checked for validity at this time.

LibAutoLoad=<"libNames">

Remarks

LibAutoLoad creates associations between function names and libraries (DLLs) in which they are found when the library has not been loaded into memory. Codewright Professional then knows to load the DLL when the associated function is called. This is not necessary if the library has been loaded in to memory.

Parameter libNames

Description A string containing the name of the DLL, followed by the function names it contains. The details of this string's format and example usage is provided below.

Default value when parameter not supplied libNames NIL

249

LibFunctionReplace
The libNames string begins with the name of the DLL. Note that this is the name only -no path or extension should be specified. The DLL must be in the current directory, or in one of the series of directories named by the CWLIB environment variable. The DLL name may be followed by a colon or left parenthesis to offset it from the names of the functions. This is not required, but is allowed for purposes of readability. Next comes the list of functions. The functions are separated from each other and from the library name by whitespace (spaces or tabs). In addition to the whitespace, which is required, the function names may also be separated by commas. Examples: LibAutoLoad="myDLL: func1 func2 " LibAutoLoad="myDLL func1 func2 " LibAutoLoad="myDLL= func1 func2 )" LibAutoLoad="myDLL= func1, func2 )"

Return Value See Also

LibAutoLoad does not return a value.

LibPreload

LibFunctionReplace=<"original">, <"replacement">

5HPDUNV

LibFunctionReplace allows limited aliasing or replacement of one function with another. The replacement is limited to execution through the LibFunctionExec function. This includes execution of all keymap assignments and execution through the Command Key. When the original function is called, the designated replacement is executed.

Parameter original
replacement

Description A string containing the name of the function which is replaced.


A string containing the name of the function to call in its place.

Default value when parameter not supplied original replacement NIL NIL

250

LibPreLoad
If the function is called directly, through compiled source code, for example, the original function will execute rather than the replacement.

5HWXUQ 9DOXH 6HH $OVR

LibFunctionReplace returns TRUE on successful completion and FALSE if both of the arguments is NIL. LibFunctionExec, LibQReplacement

LibPreLoad=<"libName">

Remarks

LibPreLoad loads a dynamic link library (DLL) other than those supplied. supplied DLL's, including the User's DLL, are loaded automatically.

The

Parameter libName

Description The name of the DLL to load. This name may contain a path element, but need not name an extension. If an extension other than .DLL is named, the function will fail.

Default value when parameter not supplied libName NIL


If the DLL contains functions with names identical to those defined in a supplied DLL, the functions will only be accessible by preceding the function name with the name of the DLL and a colon. If no path to the DLL is specified, the DLL must be in the current directory, or in one of the series of directories named by the CWLIB environment variable. Examples: LibPreLoad("myDLL"); LibPreLoad("c:\windows\mydll");

Return Value See Also

LibPreLoad returns TRUE when successful, and FALSE upon failure. Failure is usually caused by Codewright Professional being unable to locate the named DLL. LibAutoLoad

251

LibUnLoad
LibUnLoad=<"libName">

Remarks

LibUnLoad releases the memory occupied by the DLL named in the parameter.

Parameter libName

Description The name of the DLL of which to dispose.

Default value when parameter not supplied libName NIL


Even when a DLL has been removed from memory, Codewright Professional retains the information on what functions the DLL contained. If a function contained within the library is subsequently called, the library is reloaded.

Return Value

This function returns TRUE when successful, and FALSE upon failure. Failure is usually caused by Codewright Professional being unable to locate the named DLL. The function will also fail if a function in the library is being executed (is on the call stack). LibPreLoad, LibAutoLoad

See Also

Lower=

Remarks

Lower forces all alphabetic characters in the current selection to lower case. If no selection has been defined, the current line is converted to lower case.

MarkGoto=<MarkID mark>

Remarks

MarkGoto moves the cursor to the position assigned to the bookmark named as a parameter.

Parameter mark

Description The mark whose location becomes the current cursor position.

Default value when parameter not supplied mark MARK_INVALID

252

MarkSet
Return Value
MarkGoto returns 0 upon successful completion and a non-zero value upon failure. For example, failure will result if the specified MarkID is not currently defined.

MarkRestorePos=

Remarks

MarkRestorePos pops the most recently saved cursor position off the stack and makes that position the current position. Cursor positions are saved onto the stack through a call to MarkSavePos. MarkRestorePos returns 0 upon successful completion and a non-zero value upon failure. MarkSavePos

Return Value See Also

MarkSavePos=

Remarks

MarkSavePos saves the current buffer position described by the parameters in a mark on a stack. This stack is called the "saved positions" stack. The MarkRestorePos function may be used to move to a saved position.

See Also

MarkRestorePos

MarkSet=<MarkID mark>, <long line>, <long column>

Remarks

MarkSet assigns the line and column location, specified by the parameters, to the named mark.

Parameter mark
line column

Description The MarkID of the mark to which the assignment is made. This must be a pre-existing mark.
If non-zero, the line number of the current buffer at which the mark is to be set. If zero, place mark in current line. If non-zero, the column number of the current buffer at which the mark is to be set. If zero, use current column number.

253

MenuCmnd
Default value when parameter not supplied mark line column MARK_INVALID 1 1
The reserved mark, mark 0, which is the current cursor position, may be used as a MarkID parameter. This may result in the cursor being moved.

Return Value

MarkSet returns 0 upon successful completion and a non-zero value upon failure.

MenuCmnd=<menuStr>, <itemStr>

Remarks

MenuCmnd allows you to access any menu item directly by specifying strings that match menu and item. This makes it convenient to create your own shortcut keys. It does not work for submenus.

Parameter menuStr

Description A descriptive string indicating which menu to select. For example, the string File would select the File menu. The case of the string is not significant, and you need only specify enough of the menu name to distinguish it from other menus.
A descriptive string indicating which item to select from the menu. For example, the string Open would select the Open item if menuStr selected the File menu. The case of the string is not significant, and you need only specify enough of the item name to distinguish it from other items.

itemStr

Default values when parameters not supplied menuStr itemStr NIL NIL
Here is an example of how this function might be used in a key assignment in your configuration file (CW??.INI): [KmapAssign] ; same as selecting Window | Tile from menu KmapAssign="<F12>", "MenuCmnd w t"

254

MouseLeftDown

MenuCommand=<int menuItemID>

Remarks

MenuCommand allows you to access any menu item directly by specifying its menu item ID number. This makes it possible to create your own shortcut keys.

Parameter menuItemID

Description The numeric ID of the menu item you wish to execute. You can find these IDs in the file EXPORTS.H, in Codewright Professional's INCLUDE subdirectory. They all begin with IDM_ and are grouped together.

Default values when parameter not supplied menuItemID 0


Here is an example of how this function might be used in a key assignment in your configuration file (CW??.INI): [KmapAssign] ; same as selecting Window | Tile Vertically from menu KmapAssign="<F12>", "MenuCommand 0x150d"

MouseLeftDClick=

Remarks

MouseLeftDClick is the function that processes a double click with the left mouse button. Its operation depends upon the context in which the double click was performed. By default, it is used to select a word. MouseRightDClick, MouseLeftDown

See Also

MouseLeftDown=<int selType>, <BOOL oneLine >

255

MouseRightDown
Remarks
MouseLeftDown is the function that processes a press on the left mouse button. The duration of a press has indicated that it is not a click or a double click. This usually means that the mouse will be dragged to create a selection.

Parameter selType

Description This parameter sets the type of selection that will be created by the function. This parameter may be omitted to indicate a normal selection, as opposed to line or column selection.
When this parameter is TRUE, the selection is limited to a single line. This parameter is usually omitted, in which case the selection is not limited.

oneLine

Default value when parameter not supplied selType oneLine 0 FALSE See Also
MouseRightDown, MouseLeftDClick

MouseRightDown=<int selType>, <BOOL single >

Remarks

MouseRightDown is the function that processes a press on the right mouse button. The duration of a press has indicated that it is not a click or a double click. This usually means that the mouse will be dragged to create a column selection.

Parameter selType

Description This parameter sets the type of selection that will be created by the function. This parameter may be omitted to indicate a column selection, as opposed to line or normal selection.
When this parameter is TRUE, the selection is limited to a single line. This parameter is usually omitted, in which case the selection is not limited.

oneLine

Default value when parameter is not supplied selType oneLine SELECTION_COLUMN FALSE See Also
MouseLeftDown, MouseRightClick, MouseRightDClick

256

MovEOF
MovDown=<long lines>

Remarks

MovDown moves the cursor position in line units, usually toward the end of the current buffer.

Parameter lines

Description The number of lines to advance the cursor position in the buffer.

Default value when parameter is not supplied lines 1


If the parameter is a negative number, the cursor advances toward the beginning of the buffer. This allows a variable, whose value is not known, to be passed as a parameter and obtain the desired result. If a buffer extreme (the beginning or end of the buffer) prevents the cursor from being moved the specified number of lines, the cursor is placed at the closest permissible line. MovDown attempts to leave the column position unaltered.

Return Value See Also

MovDown returns TRUE if the cursor was moved, and FALSE if it did not (for example, the cursor could not advance any further in the direction specified). MovUp

MovEndWin=

Remarks

MovEndWin moves the cursor to the last line visible in the window. The column position does not change, if the current settings allow. This function returns TRUE if the cursor was moved. It returns FALSE if the cursor was already on the last line of the window, or as close as current settings allow. MovTopWin

Return Value See Also

MovEOF=

257

MovEOL
Remarks
MovEOF moves the cursor position to the last real (non-virtual) line of the current buffer. This function returns TRUE if the cursor position was changed, and FALSE if the cursor position was already within the last line of the buffer. MovEOL

Return Value See Also

MovEOL=

Remarks

MovEOL repositions the cursor to the position following the last character of the current line. This function returns TRUE if the cursor moved, and FALSE if the cursor was already at the end of the line.

Return Value

MovHome=

Remarks Return Value See Also

MovHome moves the cursor to the beginning of the current line. This function returns TRUE if the cursor was moved, and FALSE if the cursor was already at the beginning of the line. MovEOL

MovLeft=<long columns>

Remarks

MovLeft repositions the cursor toward the beginning of the line by the indicated number of columns.

Parameter columns

Description The number of columns to move, relative to the current.

Default value when parameter not supplied columns 1

258

MovPageDown
The function will not move the cursor past the beginning of the line. if the parameter is a negative number, the cursor is repositioned toward the end to the line. If the cursor cannot be moved the full number of columns indicated, the function moves the cursor to the closest permissible position.

Return Value See Also

MovLeft returns TRUE if the cursor was moved, and FALSE if it was not (primarily when the cursor is already at the beginning of the line). MovRight

MovNextChar=<long chars>

Remarks

MovNextChar advances the current cursor position by the specified number of characters toward the end of the buffer.

Parameter chars

Description The number of characters to advance the cursor. Negative values for this parameter move the cursor toward the beginning of the buffer.

Default value when parameter not supplied chars 1


The nature of this function does not allow the cursor to be placed in virtual space, but allows it to advance the cursor beyond the boundaries of the current line.

Return Value See Also

This function returns TRUE if the cursor was moved, and FALSE if the cursor was already at the buffer extreme. MovPrevChar

MovPageDown=

259

MovPageUp
Remarks
MovPageDown advances the cursor by a "page". displayed in the current window, less one line. A page is the number of lines

The function does not alter the position of the cursor relative to the window, if that position is permissible at the new buffer location.

Return Value
MovPageUp=

This function returns TRUE if the cursor is moved, and FALSE if it was not.

Remarks

MovPageUp moves the cursor toward the beginning of the buffer by a "page". A page is the number of lines displayed in the current window, less one line. The function does not alter the position of the cursor relative to the window, if that position is permissible at the new buffer location.

Return Value See Also

This function returns TRUE if the cursor is moved, and FALSE if it was not.

MovUp

MovPrevChar=<long chars>

Remarks

MovPrevChar decrements the current cursor position by the specified number of characters, moving it toward the beginning of the buffer.

Parameter chars

Description The number of characters to decrement the cursor. Negative values for this parameter advance the cursor toward the end of the buffer.

Default value when parameter not supplied chars 1


The nature of this function does not allow the cursor to be placed in virtual space, but allows it to move the cursor beyond the boundaries of the current line.

260

MovTopWin
Return Value See Also
This function returns TRUE if the cursor was moved, and FALSE if the cursor was already at the buffer extreme. MovNextChar

MovRight=<long columns>

Remarks

MovRight repositions the cursor the specified number of columns to the right of the current position.

Parameter columns

Description The number of columns to move the cursor.

Default value when parameter not supplied columns 1


Positive values move the cursor toward the end of the line and negative numbers move it toward the beginning of the line. If MovRight is unable to position the cursor at the location indicated, it repositions the cursor to the closest permissible location.

Return Value See Also

This function returns TRUE if the cursor is moved, and FALSE if it was not.

MovLeft

MovTopBuf=

Remarks Return Value See Also

MovTopBuf repositions the cursor at the first character of the buffer. This function returns TRUE if the cursor is moved, and FALSE if it was already at the top of the buffer.. MovEOF

MovTopWin=

261

MovUp
Remarks
MovTopWin positions the cursor on the first line visible in the window. The column position is not altered by this function, unless the column is not a permissible location within the new line. This function returns TRUE if the cursor is moved, and FALSE if it was not.

Return Value See Also

MovEndWin

MovUp=<long lines>

Remarks

MovUp moves the cursor position in line units, usually toward the top of the current buffer.

Parameter lines

Description The number of lines for the cursor position to regress in the buffer.

Default value when parameter not supplied lines 1


If the parameter is a negative number, the cursor advances toward the end of the buffer. This allows a variable, whose value is not known, to be passed as a parameter and obtain the desired result. If a buffer extreme (the beginning or end of the buffer) prevents the cursor from being moved the specified number of lines, the cursor is placed at the closest permissible line. MovUp attempts to leave the column position unaltered.

Return Value See Also

MovUp returns TRUE if the cursor was moved, and FALSE if it did not (for example, the cursor could not advance any further in the direction specified). MovDown

MsgLevel=<int newLevel>

262

MsgMessage
Remarks
MsgLevel sets the message priority level. The purpose of messages ranges from informative to error notification. The function used to display a message indicates its priority. Setting the message level allows you to determine which priority output you will see. Select the appropriate message level from the table below:

Level 0 1 2 3 Parameter newLevel

Message Origins All messages are displayed. Error and warning messages are displayed. Only errors are displayed. All messages are suppressed Description The number of the message level to assign. A value of -1 for this parameter causes the function to report the current setting only.

Default value when parameter not supplied newLevel -1 Return Value


MsgLevel returns an integer value from 0 to 3 indicating the previous message level.

MsgMessage=<message>

5HPDUNV

MsgMessage displays the supplied message on Codewright Professional's status line (the bottom of the parent window).

Parameter message

Description The message to display.

Default value when parameter not supplied message NIL

263

MsgPauseOnError
The color of this message may be set using the function ColorMessage. When the Message Level is greater than 0 (MsgLevel), messages that would otherwise be displayed are suppressed.

6HH $OVR

MsgLevel, ColorMessage, MsgWarning, MsgNotify, MsgError

MsgPauseOnError=<BOOL setting>

Remarks

MsgPauseOnError prescribes whether Codewright Professional should pause between multiple warning or error messages.

Parameter setting

Description This value is TRUE to turn pausing on, and FALSE to turn pausing off.

Default value when parameter not supplied setting 0


When pausing is on, Codewright Professional pauses for input from the keyboard between messages. This provides you with an opportunity to read each message before it is overwritten by the next. When pausing is off, messages are displayed as they are generated.

Return Value
NextWord=

MsgPauseOnError returns the previous pause on error setting.

Remarks

NextWord moves the cursor position to the first non-whitespace character immediately following the next space, tab or newline. PrevWord, SrchFind

See Also

OutputFile=

264

Paste
Remarks
OutputFile prompts the user to enter an output filename for the current buffer. This is the file to which the buffer will be written upon the next save.

OutputWindow=<int showMode>

Remarks

OutputWindow lets you display or hide the tabbed output window, or specify which tab is selected.

Parameter showMode

Description This parameter specifies whether the window is showing and which tab is selected, if it is showing. Values of 0 or greater represent the offset of the tab from the left side of the window. 0 represents the first tab, 1 represents the second and so on. Specifying a tab to select makes the output window visible.
Values less than 0 receive special treatment as indicated below:

Value -1 -2
-3

Purpose Query current visibility status. Display output window without changing which tab is selected. Hide output window

Default values when parameters not supplied showMode


toggles current visibility

Return Value
Paste=

OutputWindow returns a BOOL indicating TRUE if the window is visible and FALSE if it is hidden.

Remarks

Paste inserts the contents of the Scrap buffer or Windows Clipboard, depending upon which is enabled, at the current cursor position. An informative message is printed on the status line. This function is intended for assignment to a key.

265

PrevWord
PrevWord=

Remarks

PrevWord moves the cursor position to the first non-whitespace character immediately following the previous space, tab or newline. NextWord, SrchFind

See Also

Print=<BOOL direct>

Remarks

Print prints the contents of the current buffer on the default printer device.

Parameter direct

Description If this parameter is TRUE, printing occurs without further input, using the current settings. If this parameter is FALSE, the Print dialog box is invoked to allow reviewing and modifying the settings prior to printing.

Default value when parameter not supplied direct hWndParent FALSE 0 Return Value See Also
Print returns TRUE when the printing is successfully commenced. It returns FALSE if the print job was cancelled. PrintSelection

PrintFlags=<WORD flags>

Remarks

PrintFlags sets the flags associated with the File Print dialog (Print) that control various option settings.

Parameter flags

Description A value whose bit settings determine various attributes of the Print task. The bits and their meanings are as follows: Purpose

Bit

266

PrintFooter
PRN_SELECTION PRN_LHEADER PRN_CHEADER PRN_RHEADER PRN_LFOOTER PRN_CFOOTER PRN_RFOOTER PRN_CHROMACODING PRN_CC_ITALIC PRN_CC_BOLD PRN_CC_SWITCH PRN_NO_FF

Print only the contents of the current selection. Left justify the header. Center the header. Right justify the header. Left justify the footer. Center the footer. Right justify the footer. Use ChromaCoding in printing. Use italic text for ChromaCoding. Use bold text for ChromaCoding. Make ChromaCode use plain text and give ChromaCode attributes to other text. Treat form feed as just another character.

Default value when parameter not supplied flags 0 Return Value See Also
PrintFlags does not return a value.

Print

PrintFooter=<"footer">

Remarks

PrintFooter specifies the footer string to use when printing.

Parameter footer

Description A string containing the footer string to print on each page printed. This string may contain any of several macros which are defined as follows: Macro %f %d %p Expands to Current filename Today's date Current page number

267

PrintHeader
Default value when parameter not supplied footer NIL Return Value See Also
PrintFooter does not return a value.

PrintHeader, PrintFlags

PrintHeader=<"header">

Remarks

PrintHeader specifies the header string to use when printing.

Parameter header

Description A string containing the footer string to print on each page printed. This string may contain any of several macros which are defined as follows: Macro %f %d %p Expands to Current filename Today's date Current page number

Default value when parameter not supplied header NIL Return Value See Also
PrintHeader does not return a value.

PrintFooter, Print, PrintFlags

PrintLineInc=<WORD inc>

5HPDUNV

PrintLineInc defines at what increment line numbers are printed.

268

PrintMargin...
Parameter inc Description A value that determines the interval between line numbers on a printout. A value of 0 for this parameter turns line numbering off. A value of 1 prints the line number on each line. The default value is 5, which means that line numbers are printed on every fifth line.

Default value when parameter not supplied inc 0

5HWXUQ 9DOXH 6HH $OVR

PrintLineInc does not return a value. Print, PrintFlags

PrintLineInc=<WORD inc>

Remarks

PrintLineInc defines at what increment line numbers are printed.

Parameter inc

Description A value that determines the interval between line numbers on a printout. A value of 0 for this parameter turns line numbering off. A value of 1 prints the line number on each line. The default value is 5, which means that line numbers are printed on every fifth line.

Default value when parameter not supplied inc 0 Return Value See Also
PrintLineInc does not return a value.

Print, PrintFlags

PrintMargin...

269

PrintSelection
PrintMarginBottom=<WORD margin> PrintMarginLeft=<WORD margin> PrintMarginRight=<WORD margin> PrintMarginTop=<WORD margin>

5HPDUNV

The PrintMargin... functions define how many lines or columns are reserved as a margin at the top, bottom, left and right edge of the page.

Parameter margin

Description The number of lines (top or bottom) or columns (left or right) to reserve as a margin. Lines that do not fit between the margins are truncated.

Default value when parameter not supplied margin 0


These functions are used largely for maintaining the desired configuration, and are therefore usually found in the CW??.INI configuration file under the [Printer] heading.

6HH $OVR
PrintSelection=

Print, PrintFlags

Remarks

PrintSelection prints the contents of the current selection on the default printer device. Unlike most functions that operate on selections, this function does not remove the selection upon completion. If a selection is marked, PrintSelection sends it to Windows for printing and returns TRUE. If no selection is marked, the function returns FALSE and nothing is printed. Print errors are handled by Windows. Print

Return Value

See Also

QDefaultKeymap=

Remarks

QDefaultKeymap reports the name of the keymap currently in effect.

270

ScrapPrev
Return Value
QDefaultKeymap returns a string containing the name of the keymap, e.g., "CUA" or "brief". DefaultKeymap

See Also

Redo=

Remarks

Redo undoes the undo immediately preceding. It prints a message indicating that the undo has been redone, or prints "nothing to redo" if there was no undo operation immediately preceding. This function is intended for assignment to a key. Undo

See Also

Repeat=

Remarks

Repeat is an interactive function intended for assignment to a key. It first prompts for the number of times that you wish to repeat a command, and then waits for the command. That command is repeated the specified number of times.

ResizeWindow=

Remarks

ResizeWindow allows the user to interactively resize the current window. This function is the same as selecting "Size" from the window's System menu.

ScrapNext=

Remarks Return Value See Also

ScrapNext selects the next scrap buffer in the circular list of scrap buffers. ScrapNext returns the index of the previously current scrap buffer.

ScrapPrev

ScrapPrev=

271

ScrapSetCount
Remarks Return Value See Also
ScrapPrev selects the previous scrap buffer in the circular list of scrap buffers. ScrapPrev returns the index of the previously current scrap buffer.

ScrapNext

ScrapSetCount=<WORD count>

5HPDUNV

ScrapSetCount sets the number of scrap buffers available for use.

Parameter count

Description The number of scrap buffers to allow in the list.

Default value when parameter not supplied count 0


If the number of scrap buffers is reduced, the scrap buffers with a higher index than count are lost. If the current scrap buffer was one of those lost, the remaining scrap buffer with the highest index is made current.

5HWXUQ 9DOXH
SelectWord=

ScrapSetCount returns the new setting for the number of scrap buffers that exist.

Remarks

SelectWord creates a selection around the word in which the cursor is positioned. If the cursor is located in whitespace no selection is created. This function is normally assigned to the mouse Left-Double-Click action. SelectWord returns TRUE is a selection was created and FALSE if not.

Return Value See Also

NextWord, PrevWord

SetLineDrawBindings=

272

SetLineDrawStyle
Remarks
SetLineDrawBindings makes the key assignments for line drawing with the arrow keys. Assignments are made to the up, down, left and right keys that allow them to be used for drawing lines in documents when the ) and + keys are also depressed. This function is only available when the "add-on" CWLDRAW.DLL has been loaded. This can be done by adding a line to your .INI file under the [LibPreload] section. Add the statement LibPreload=CWLDRAW.DLL. The characters inserted by the Line Draw keys will only appear as lines if a font supporting the IBM OEM character set is used. The functions that perform the actual drawing are as follows: LDUp, LDDown, LDRight, and LDLeft. These functions are not documented elsewhere.

Return Value See Also

SetLineDrawBindings does not return a value.

SetLineDrawStyle

SetLineDrawStyle=<WORD style>

Remarks

SetLineDrawStyle sets the types of lines used by the Line Draw functions.

Parameter style

Description A value from 1 to 4 indicating which style of lines to use. If a style is not specified, style 1 will be used.

Default value when parameter not supplied style 0


This function is only available when the "add-on" CWLDRAW.DLL has been loaded. This can be done by adding a line to your .INI file under the [LibPreload] section. Add the statement LibPreload=CWLDRAW.DLL.

Return Value

SetLineDrawStyle returns the style number that has been put into effect.

273

SlideIn
See Also
SetLineDrawBindings

SlideIn=<"ch ">

Remarks

SlideIn indents a line or block of lines using a specified character.

Parameter ch

Description The string to use for indenting. This parameter usually specifies a space or a tab, but may also specify a comment character, such as ";", "#" or "C" or decorative character such as "*". If this is a NULL no action is taken.

Default value when parameter not supplied ch NIL See Also


SlideOut

SlideOut=<"ch ">

Remarks

SlideOut outdents a line or block of lines by the character specified.

Parameter ch

Description The string by which the line or block is outdented. If this is a NULL no action is taken.

If the string specified is whitespace (space or tab), and the line is prefixed with whitespace, the parameter is treated as an increment rather than a literal character. For example, if the line begins with a tab and a space is the parameter, the whitespace is adjusted to outdent it one column. Similarly, if the line is preceded by spaces and a tab is specified, the line is outdented the equivalent number of spaces. Other strings are treated literally, such as ";" which removes only semicolons, when present at the beginning of the line. If the

274

SrchFind
specified string is not present at the beginning of the line, no action is taken for that line.

Default value when parameter not supplied ch NIL See Also


SlideIn

Space=

Remarks

Space is intended to be bound to the space key. If there is no current selection, this function merely inserts a space character into the buffer. If there is a selection defined, the function indents that selection by a single space. SlideIn

See Also

SrchFind=<"sPattern">, <DWORD sFlag>

Remarks

SrchFind searches for text that matches the supplied string or regular expression pattern.

Parameter sPattern
sFlags

Description The string or regular expression pattern to match.


The search attribute word, which controls case-sensitivity, direction and scope of the search, and whether the pattern is considered a regular expression or an ordinary string.

Default value when parameter not supplied sPattern sFlags NIL SrchQFlags
When a match is found, the cursor is positioned at the beginning of the matched text, unless a regular expression pattern is used which dictates otherwise.

Return Value

SrchFind returns TRUE if a match was found, and FALSE if no match was found.

275

SrchQFlags
See Also
SrchQFlags

SrchQFlags=

Remarks

SrchQFlags reports the value of the search attribute word. There are functions for setting each of the individual attributes. These attributes include: case-sensitivity, direction and scope of the search, and whether patterns are treated as regular expressions or as ordinary strings. This provides a method of obtaining a snapshot of the search attribute settings at any particular time. That state can later be restored by supplying the value obtained from this function to the SrchSetFlags function.

Return Value See Also

SrchQFlags returns the search attribute word currently in effect. The meaning of the individual bits of this value are listed in the description of the SrchSetFlags function. SrchSetFlags

SrchSetFlags=<DWORD sFlags>

Remarks

SrchSetFlags sets the search attribute word to a specified value.

Parameter sFlags

Description The value to which the search attribute word is set. A value of -1 for this parameter causes the function to report the current setting only.

Default value when parameter is not supplied sFlags -1


There are functions for setting each of the individual attributes. These attributes include: case-sensitivity, direction and scope of the search, and whether patterns are treated as regular expressions or as ordinary strings. This function is useful for setting the attributes as a group, such as when restoring a previous state that has been saved. The attributes governed by individual bits are as follows:

276

SrchTranslate
Label
SEARCH_IGCASE SEARCH_MAXIMAL SEARCH_REGEX

Purpose
Turns case-sensitivity on or off. When the bit is off, case is significant in matching. When on, it is not. When regular expressions are in use, this indicates whether the search will match the largest unit of text or the smallest that fits the specified pattern. Determines whether the pattern to match is treated as a regular expression or an ordinary string. When the bit is on, it is treated as a regular expression. When off, it is treated as an ordinary string. Determines the direction the search takes, relative to the cursor position. When the bit is on, the search begins with text subsequent to the cursor. When off, the search begins with text preceding the cursor. Determines if search operations and replace operations are limited to the current selection . When the bit is on, the operation is limited to the selection. When off, the operation is not limited. Determines if operations terminate after reaching a buffer extreme (beginning or end). When the bit is on, the operation continues from the opposite extreme to the point at which the operation began. When off, the operation is discontinued when a buffer extreme is reached. Used only during replace operations. When the bit is on, all matches within the scope of the operation are subject to translation. When off, the operation only applies to the first match found. Used only during replace operations. When the bit is on, replace operations prompt before changing text matching the pattern. When off, text is replaced without prompting. Used only during replace operations. When this bit is on, one occurrence is replaced without prompting and then the function returns. Used in regular expression searches, primarily for BRIEF compatibility. Forces the Alternation operator, |, to have a lower precedence than other operators.

SEARCH_FORWARD

SEARCH_SELECTION

SEARCH_WRAP

SEARCH_GLOBAL

SEARCH_PROMPT

SEARCH_ONCE SEARCH_LOW_ALT_PRECE DENCE

Return Value See Also

SrchSetFlags returns the value previously in effect.

SrchQFlags

SrchTranslate=<"sPattern">, <"rString">, <DWORD sFlags>

277

StateSetMarkLevel
Remarks
SrchTranslate searches for text that matches a string or regular expression pattern. If a match is found, the text is replaced with a supplied string, with permission.

Parameter sPattern
rString sFlags

Description The string or regular expression pattern to match.


The string to replace the matched text. The search attribute word, which controls case-sensitivity, direction and scope of the search, and whether the pattern is considered a regular expression or an ordinary string. The attribute word may also stipulate replacement without prompting.

Default value when parameter not supplied sPattern rString sFlags NIL NIL SrchQFlags

rLen NIL

The cursor is positioned at the beginning of the matching text when prompting for replacement. The cursor returns to its original position at the end of multiple replacements, if allowed to run to completion. If aborted by the user, the cursor is left at the last occurrence of matching text.

Return Value See Also

SrchTranslate returns the number of replacements made.

SrchFind, SrchQFlags, SrchSetFlags

StateSetMarkLevel=<int LevelFlags>

Remarks

StateSetMarkLevel defines what kinds of bookmarks will be recorded in the statefile for restoration.

Parameter LevelFlags

Description A value whose bits determine which types of marks are saved in the Codewright Professional state file. A -1 for this value indicates that it is a query only, and the setting is not changed. A value of 0 turns off mark saving, while a value of 0x000f turns on saving for all types of marks. The labels below have been defined to assist you in defining the proper flags value.

278

SysCaretHeight
Default values when called from LibFunctionExec (Command Key) fname 0

Label
SAVE_MARK_LOCAL SAVE_MARK_GLOBAL SAVE_MARK_POS SAVE_MARK_SEL

Description Save local bookmarks in the state file for restoration. Save global bookmarks in the state file for restoration. Save the Saved Position stack in the state file for restoration. Save the current selection in the state file for restoration.

Return Value
SysBeep=

StateSetMarkLevel returns the previous setting of the mark level flags.

Remarks

SysBeep emits an unobjectionable, if not pleasant, tone from the speaker.

SysCaretHeight=<int percent>, <int cursor>

Remarks

SysCaretHeight sets the height of the caret or cursor for one of four cursors used by Codewright Professional.

Parameter percent

Description The height or the cursor as a percentage of the character cell height. Positive values fill from the top of the cell, while negative values fill from the bottom.
An index, specifying which of the four cursors is being defined. The predefined labels for this purpose are as follows:

cursor

279

SysCaretWidth
Label
CARET_INSERT CARET_INSERT_VIRTUAL CARET_OVERTYPE CARET_OVERTYPE_VIRTUAL

Description
Cursor used in insert mode, when the cursor is in the text area. Cursor used in insert mode, when the cursor is in virtual space. Cursor used in overtype mode, when the cursor is in the text area. Cursor used in overtype mode, when the cursor is in virtual space.

Return Value See Also

SysCaretHeight returns the previously defined caret height. If a cursor other than the four above is specified, the function returns 0. SysCaretWidth

SysCaretWidth=<int percent>

Remarks

SysCaretWidth sets the width for the cursors used by Codewright Professional.

Parameter percent

Description The width or the cursor as a percentage of the character cell width. Fill begins at the left of the cell.

Return Value See Also

SysCaretWidth returns the width of the caret that was previously in effect.

SysCaretHeight

SysExit=<int exitcode>

Remarks

SysExit terminates Codewright without performing any cleanup, such as saving buffers to output files and deleting temporary files.

Parameter exitcode

Description The termination code returned to the operating system upon exit.

This function represents an abnormal termination of the program.

280

SysQFlags

SysQFlags=

Remarks

SysQFlags reports the state of various system-wide attributes. These settings may also be changed through the menu system and dialogs. This function returns a value that describes the status of various system-wide attributes. Each attribute is represented as a bit within this value. To facilitate analysis of this value, a number of labels have been defined, representing the values of the respective bits. These labels and a description of each are provided below:

Return Value

Bit Label
SYSFLAG_AUTOSAVE_ENABLED SYSFLAG_CLIPBOARD SYSFLAG_CMND_LINE_PROMPT SYSFLAG_CONFIG_UPDATE SYSFLAG_HIDE_BUTTON_MSGS SYSFLAG_HIDE_CURSOR SYSFLAG_IBEAM_CURSOR SYSFLAG_RETAIN_DIR

Meaning when set


If an interval has been defined, buffers will be periodically saved during keyboard inactivity. Use the Windows clipboard for a staging area, instead of the Codewright Professional scrap buffers. Use the status line for prompting, rather than a pop-up window. Update the configuration file when exiting dialogs to reflect changes made. Don't show descriptions on status lines when the mouse passes over the Tool Box. Hide the mouse cursor when typing begins. The mouse cursor returns when moved. Use an I-Beam style cursor in the text area. When using the File Open dialog, or otherwise browsing for a file, remember the last directory accessed and return to that directory when next invoked. Show the Tool Box at its last or default location. Process the Alt key and other system keys before Windows can. This allows assignments to key combinations that included these keys. The BRIEF key commands, for example, require this. Rather than reinitializing the Undo information at each save, allow undo to the time the file was loaded.

SYSFLAG_SHOW_TOOLBOX SYSFLAG_TRAP_SYS_KEYS

SYSFLAG_UNDO_PAST_SAVE

All of these bits are read-write and may be set with the SysSetFlags function.

281

SysSetCwd
See Also
SysSetFlags

SysSetCwd=<"cwd">

Remarks

SysSetCwd sets a new working directory for Codewright Professional. This directory becomes the default for various dialog boxes. It does not affect Windows or other applications running concurrently.

Parameter cwd

Description A string, naming the directory that is to be made current. The string may indicate a new drive as well as directory, and the path may be relative. Either forward or backward slashes may be used to separate elements of the path.

Default value when parameter not supplied cwd NIL Return Value
SysSetCwd returns TRUE if the specified directory was successfully made the default. If the directory or path does not exist, the function returns FALSE.

SysSetDefault=<long defaultIndex>, <DWORD setting>

Remarks

SysSetDefault allows changing the default settings for newly created buffers and edit windows. These defaults are stored in the model window and model buffer. Therefore, changing the settings of the current window or buffer does not affect them.

Parameter defaultIndex

Description A value indicating which feature's setting to modify. A series of labels have been defined for specifying which feature the request pertains to. These labels correspond to features of the current window or buffer. The labels are listed below:

282

SysSetFlags
Label
DEFAULT_BUFFER_AUTOINDENT_MODE DEFAULT_BUFFER_BACKUP_SPEC DEFAULT_BUFFER_MAX_TAB DEFAULT_BUFFER_MAX_VLINES DEFAULT_BUFFER_SYSFLAGS DEFAULT_BUFFER_TABS DEFAULT_COLOR_COMENTS DEFAULT_COLOR_DIFF_ADD_LINES DEFAULT_COLOR_DIFF_DEL_LINES DEFAULT_COLOR_INS_LINES DEFAULT_COLOR_KEYWORDS DEFAULT_COLOR_LINENUMBERS DEFAULT_COLOR_MOD_LINES DEFAULT_COLOR_SELECTION DEFAULT_COLOR_TEXT DEFAULT_WINDOW_FONT DEFAULT_WINDOW_HINC DEFAULT_WINDOW_KEYMAP DEFAULT_WINDOW_LEFT_MARGIN DEFAULT_WINDOW_SYSFLAGS DEFAULT_WINDOW_USERFLAGS DEFAULT_WINDOW_VIS_ELISION DEFAULT_WINDOW_VIS_EOF DEFAULT_WINDOW_VIS_EOL DEFAULT_WINDOW_VIS_MARGIN_COL DEFAULT_WINDOW_VIS_SPACES DEFAULT_WINDOW_VIS_TABS DEFAULT_WINDOW_VIS_VIRTLINES DEFAULT_WINDOW_VIS_VIRTSPACES

setting

This parameter may be either a numeric value or a string, depending on which default is being set.

Default value when parameter not supplied defaultIndex setting 0 NIL

SysSetFlags=<DWORD flags>

Remarks

SysSetFlags sets the system-wide Flags DWORD to a specified value.

Parameter flags

Description The value to assign to the Flags word.

283

SysSwapBlocks
The predefined labels for this flag and their meaning are given below:

Bit Label
SYSFLAG_AUTOSAVE_ENABLED SYSFLAG_CLIPBOARD SYSFLAG_CMND_LINE_PROMPT SYSFLAG_CONFIG_UPDATE SYSFLAG_HIDE_BUTTON_MSGS SYSFLAG_HIDE_CURSOR SYSFLAG_IBEAM_CURSOR SYSFLAG_RETAIN_DIR

Meaning when set


If an interval has been defined, buffers will be periodically saved during keyboard inactivity. Use the Windows clipboard for a staging area, instead of the Codewright Professional scrap buffers. Use the status line for prompting, rather than a pop-up window. Update the configuration file when exiting dialogs to reflect changes made. Don't show descriptions on status lines when the mouse passes over the Tool Box. Hide the mouse cursor when typing begins. The mouse cursor returns when moved. Use an I-Beam style cursor in the text area. When using the File Open dialog, or otherwise browsing for a file, remember the last directory accessed and return to that directory when next invoked. Show the Tool Box at its last or default location. Process the Alt key and other system keys before Windows can. This allows assignments to key combinations that included these keys. The BRIEF key commands, for example, require this. Rather than reinitializing the Undo information at each save, allow undo to the time the file was loaded.

SYSFLAG_SHOW_TOOLBOX SYSFLAG_TRAP_SYS_KEYS

SYSFLAG_UNDO_PAST_SAVE

Return Value See Also

SysSetFlags returns the previous setting of the flags.

SysQFlags

SysSwapBlocks=<int lockedBlocks>

284

Tabs
Remarks
SysSwapBlocks allows you to increase or decrease the number of memory blocks reserved by Codewright Professional. When Codewright Professional needs more memory than it has reserved, it swaps some blocks to disk. If Codewright Professional seems to be swapping to disk too much, and more memory is available, you can improve performance by increasing the number of reserved memory blocks. The initial default is 20 blocks.

Parameter lockedBlocks

Description The number of 8K blocks to reserve (lock) for use by Codewright Professional.

Default value when parameter not supplied lockedBlocks 0

Tab=

Remarks

Tab is the function normally assigned to the tab key. It not only inserts the tab character on request, it also indents when a selection is defined. BackTab

See Also

Tabs=<" tabString ">

Remarks

Tabs defines a new tab string for the current buffer. The tab string describes where tab stops occur by listing the column numbers at which tab stops are to be placed.

Parameter tabString

Description A string containing a list of column numbers at which tab stops are placed. These column numbers are separated by spaces. If this parameter is omitted, the function prompts for the tab string. If the tab string is invalid (e.g., does not begin with a number), the default value of "9 17" is used.

285

TagFind
Normally, all but the first one or two tab stops are implicit, rather than at explicitly named columns. The interval between the last two explicit tab stops is repeated to the maximum column allowed for tab stops, thus creating numerous implicit tab stops. If a single tab stop is listed, the interval between that tab stop and the beginning of the line is repeated.

TagFind=<"label ">

Remarks

TagFind looks for the specified label in the "tags" data file. If the data file indicates in what file and at what line the label is defined, that file is loaded and the position displayed.

Parameter label

Description A string containing the label to search for in the tags data file. If this parameter is NIL the function uses the word at the cursor position.

Default value when parameter not supplied label NIL


Some setup is required for this function to work. Primarily, the name of the tags data file must be defined with the TagSetFile function. TagFind works with CTags other Tags data files using the standard Tags format. Codewright does not maintain the Tags database. This job must be periodically performed by an external process.

Return Value

TagFind returns TRUE if the tag definition was found in the data file. It returns FALSE, otherwise. TagSetFile, TagIgnoreCase, TagPrompt

See Also

TagIgnoreCase=<BOOL igcase >

Remarks

TagIgnoreCase indicates whether case is significant when searching for a label in a Tags data file. This function is usually used in connection with Tags file setup.

286

TagSetFile
Parameter igcase Description If this parameter is TRUE case will not be treated as significant. If FALSE, case is significant.

Default value when parameter not supplied igcase (current state is toggled)
This function affects the searches performed by the functions TagFind and TagPrompt. It is usually used in conjunction with specifying the name of a data file, to match the method in which tag definitions are stored in that file.

Return Value

TagIgnoreCase returns the resulting state of this feature: TRUE when case is ignored, FALSE when case is significant. TagPrompt, TagFind

See Also

TagPrompt=

Remarks

TagPrompt prompts the user for a label to search for in the Tags data file. If the data file indicates in what file and at what line the label is defined, that file is loaded and the position displayed. Some setup is required for this function to work. Primarily, the name of the tags data file must be defined with the TagSetFile function. TagPrompt works with CTags other Tags data files using the standard Tags format. Codewright Professional does not maintain the Tags database automatically. This job must be periodically performed by an external process.

Return Value

TagPrompt returns TRUE if the tag definition was found in the data file. It returns FALSE, otherwise. TagFind, TagSetFile

See Also

TagSetFile=<"fname ">

287

ToBottom
Remarks
TagSetFile sets the name and directory of the Tags data file used in Tags searches.

Parameter fname

Description A string containing the path and complete filename of the file containing the Tags definitions. This file must conform to the standard Tags file format.

Default value when parameter not supplied fname NIL


The data file named is not validated until the first search is performed.

Return Value

TagSetFile returns TRUE if the filename is found to be in valid format. If the filename specified is not a valid DOS path or filename, the function returns FALSE. TagFind, TagIgnoreCase, TagPrompt

See Also

ToBottom=

Remarks

ToBottom scrolls the current line of the buffer to the bottom of the window. The cursor position is not altered, relative to the text. ToTop

See Also

ToTop=

Remarks

ToTop scrolls the current line to the top of the window. The cursor position is not altered, relative to the text. ToBottom

See Also

Undo=

288

WinScrollHInc
Remarks
Undo reverses the effects of the most recent edit operation or cursor motion. It prints a message indicating that the edit has been undone, or prints "nothing to undo" if there are no further undos available. This function is intended for assignment to a key. Redo

See Also

Upper=

Remarks

Upper converts all of the characters in the current selection to upper case. selection is defined, the function converts the entire line to upper case. Lower

If no

See Also

Visibles=<int on >

Remarks

Visibles turns on, off or toggles the display of special characters in place of otherwise invisible portions of the buffer. Such things as the end of file, end of line, spaces, tabs, and virtual space normally appear as undifferentiated blank space in a window. This function assigns more visible representations to these items. For example, a paragraph symbol is used for end of line, and a dot for a space.

Parameter on

Description When non-zero, this parameter turns on the use of the visible representations. When zero, it turns their use off. If the parameter is omitted, the feature is toggle to the opposite of its current condition.

See Also

WinVisible...

WinScrollHInc=<long unit>

Remarks

WinScrollHInc defines the number of columns that Codewright Professional scrolls left or right when scrolling is required.

289

WinSetCreationPos
Parameter unit Description The number of columns to shift the view each time horizontal scrolling is needed. Negative values for this parameter cause the function to report the current setting without changing it.

Default value when parameter not supplied unit 0


The initial default is 3. The smaller this unit is, the more likely it is that more scroll operations will have to be performed. This has the effect of slowing down the editing process.

Return Value

This function returns the new horizontal scroll incremental unit. If the parameter is a negative value, the function merely returns the current setting.

WinSetCreationPos=<int X>, <int Y>, <int width>, <int height>

Remarks

WinSetCreationPos sets a default creation position for new edit windows.

Parameter X, Y

Description The coordinates, relative to the Upper lefthand corner of the client area, at which the Upper lefthand corner of the window is placed.
The label CW_USEDEFAULT may be used for either or both of these parameters, in which case a random value for that parameter is chosen by Windows each time a window is created.

width, height

The extents in each dimension of the window. The label CW_USEDEFAULT may be used for either or both of these parameters, in which case a random value for that parameter is chosen by Windows each time a window is created.

Default value when parameter not supplied X Y width


CW_USEDEFAULT CW_USEDEFAULT CW_USEDEFAULT

height
CW_USEDEFAULT

Return Value

WinSetCreationPos does not return a value.

290

WinVisible...

WinVisible...

WinVisibleEOF=<int symbolic> WinVisibleEOL=<int symbolic> WinVisibleSeparator=<int symbolic> WinVisibleSpaces=<int symbolic> WinVisibleTabs=<int symbolic> WinVisibleVirtLines=<int symbolic> WinVisibleVirtSpaces=<int symbolic>
Remarks
The WinVisible... functions allow you to specify printable characters to represent various characters that are not otherwise visible. These functions effect only the appearance in the current window. The contents of the buffer is not effected.

Parameter symbolic

Description The character which is to symbolize the non-printing character. A value of -1 for this parameter causes the function to report the current setting only.

Default value when parameter not supplied symbolic -1


Below is a table of these functions and the aspects of appearance they control: Function Description A visual representation of where the buffer ends. Anything WinVisibleEOF beyond this marker is virtual space and virtual lines. There is no character in the buffer corresponding to this marker. A character to represent the newline sequence, whether the WinVisibleEOL sequence is one character or two. Space to the right of this is virtual. A character to represent the space character within the text. WinVisibleSpaces A character to represent the tab character within the text. WinVisibleTabs A character to represent lines beyond the end of the buffer. WinVisibleVirtLines A character to represent space beyond the end of lines and WinVisibleVirtSpaces the end of the buffer.

291

WinVisibleMarginColumn
Return Value See Also
These functions return the character that was the previous setting.

Visibles, SysSetDefault

WinVisibleMarginColumn=<int column>

Remarks

WinVisibleMarginColumn draws a vertical line at a specified column, within the current window. The line does not affect editing in any way, but can serve as a reminder for those who must adhere to a line length standard.

Parameter column

Description The column number at which the margin line is to appear. A zero value disables this feature. A value of -1 for this parameter causes the function to report the current setting, but not to change it.

Default value when parameter not supplied column 0 Return Value


WinVisibleMarginColumn returns the previous column setting.

WrapEnable=<int state>

Remarks

WrapEnable selects one of three states for the Word Wrap feature.

Parameter state

Description When this parameter is 0, the Word Wrap feature is turned off. When a value of 1 is supplied, Word Wrap is enabled, but it only wraps the current line. If typing into an existing paragraph, one or more subsequent lines may require reformatting. When this parameter is 2, the current line and all lines following in the paragraph are wrapped.
A series of labels has been defined for use with this function:

Label
WRAP_DISABLED

Value 0

292

WrapSetRightMargin
WRAP_ENABLED WRAP_CONTINUOUS

l 2

Default value when parameter not supplied state 0


A paragraph is defined as one or more lines of text surrounded by blank lines. This feature relies on Auto-indent to maintain the whitespace margin you create on the left. It therefore turns Auto-indent on or off as necessary. The right margin is defined by the function WrapSetRightMargin, the Right Margin Mark, or the right edge of the window.

Return Value See Also

WrapEnable returns the new state for the Word Wrap feature.

WrapParagraph, WrapSetRightMargin, WinVisibleMarginColumn

WrapParagraph=

Remarks

WrapParagraph formats the paragraph in which the cursor is placed to conform with left and right margins. A paragraph is defined as one or more lines of text surrounded by blank lines. This feature relies on Auto-indent to maintain the whitespace margin you create on the left. It therefore turns Auto-indent on or off as necessary. The right margin is defined by the function WrapSetRightMargin, the Right Margin Mark, or the right edge of the window.

See Also

WrapEnable, WinVisibleMarginColumn, WrapSetRightMargin

WrapSetRightMargin=<long margin>

Remarks

WrapSetRightMargin sets the right-hand column after which text will wrap to the next line, when the Word Wrap feature is enabled.

293

WriteBuffer
Parameter margin Description The column number that is the maximum width for text on a line when Word Wrap is on. A value of 0 for this parameter tells Word Wrap to use either the Right Margin Mark or the edge of the window as the right margin.

Default value when parameter not supplied margin 0


A paragraph is defined as one or more lines of text surrounded by blank lines. This feature relies on Auto-indent to maintain the whitespace margin you create on the left. It therefore turns Auto-indent on or off as necessary.

Return Value See Also

WrapSetRightMargin returns the new setting for the right margin.

WrapEnable, WrapParagraph, WinVisibleMarginColumn

WriteBuffer=

Remarks

WriteBuffer writes the currently defined selection, or the entire buffer to disk. If a selection is defined, the function prompts for a filename to which to write the contents of the selection. If no selection is defined, the function saves the entire buffer to its output file, if the buffer contains changes that have not been saved. The function prints a message indicating whether the operation was successful. BufWrite, BufWriteSelection

See Also

ZoomWindow=

Remarks

ZoomWindow zooms in or out on the current edit window, depending on its setting at the time. If the window is maximized, the window is returned to its normal state. If the window is in its normal state, it becomes maximized.

294

Changing and Extending Codewright


In addition to being used in key assignments and .INI file entries, Codewrights API functions can be used to create programs in DLLs. When doing this, there are many more API functions that you may employ which are not documented in this manual. They are instead documented online, where they can be explored more conveniently, using hypertext links and popups. Codewright has been designed to be changed. The users of some applications may be content with the response, "You can't do that," when inquiring about a certain capability of the program. Programmers, on the other hand, are much less apt to be content. Many of them just can't help envisioning how simple it would be to add this capability or change that. By making Codewright extensible, we have come as close as we can to making this product all things to all people. This chapter helps you with the three major steps you must take to change or add capabilities to Codewright: made. It helps you find the source code that you want to change or add to. It assists you in making the changes or additions you want to make. It tells you how to compile and make use of the changes or additions you have

System Overview
The first step in changing Codewright is to understand its anatomy. You can then move from the general to the more specific, in locating the part of Codewright that you want to concentrate on. The primary executable, CW.EXE or CW32.EXE, contains the Codewright Application Programming Interface (API). These are the functions and capabilities that are basic to Codewright's operation. Although you cannot rewrite the functions in the API, you can replace them, in a limited fashion. We will discuss function replacement later. The point is, the source code for main executable is not supplied. External to the primary executable are several Dynamically Linked Libraries (DLLs) which provide services in several areas: Core services. Supplemental language support. Keyboard command sets.

Core Services
Auxiliary services.

The following illustration depicts the organization of Codewright's software system:

Figure 1.: Overview of Codewright System Components

Core Services
The core services are those that Codewright always expects to have available. Some of these services are so essential that Codewright is unable to properly initialize without them. For example, you could use Codewright if no keyboard command sets were available -- you could even build or find a keyboard command set. If the core services were missing, however, the keyboard commands would be of no use.

CWSTART DLL
The CWstart DLL is named CWSTART.DLL. It performs numerous initialization tasks, such as loading other DLLs and reading the configuration file. The source code to CWSTART.DLL is provided. Many of the extension functions are defined in this DLL. To utilize them in your own

296

Core Services
source code you will need to include the header file CWSTART.H, which is in Codewright's CWSTART subdirectory. The tree diagram and file descriptions below will help you locate the functions provided in the various source files.

ASM.C C.C CPP.C LANGUAGE.C PAS.C

AUTOSAVE.C COMPILE.C CONFIG.C CWSTART.C DLGMENU.C FILTER.C OUTPUT.C STATE.C UTIL.C VCS.C WWRAP.C

BRACE.C CURSOR.C ENTAB.C PREPROC.C PROMPT.C REPEAT.C SLIDE.C TABSET.C TAGS.C

ERRORFIX.C ERRINFO.C

* Support for additional languages, such as Paradox and dBASE/Clipper, are contained in separate DLLs. These DLLs are Language Supplements, and their use is optional. See the "Supplemental Language Support" section below for a more complete description.

Language Features File LANGUAGE.C Description The file that contains the engine for language specific features, such as ChromaCoding, Template Expansion, and Language Indenting. It relies on a series of functions being defined elsewhere that incorporate the corresponding filename extension into the function name (e.g., _c_indent(), _pas_indent() ). This file contains the functions that support language specific features for assembly language source files (.ASM files). This file contains the functions that support language specific features for C language source files (.C files).

ASM.C C.C

297

Core Services
CPP.C PAS.C This file contains the functions that support language specific features for C++ language source files (.CPP files). This file contains the functions that support language specific features for Pascal language source files (.PAS files).

Utilities File AUTOSAVE.C COMPILE.C


CONFIG.C CWSTART.C DLGMENU.C FILTER.C OUTPUT.C STATE.C UTIL.C VCS.C WWRAP.C

Description Contains the functions in support of the Auto-save feature. Contains the functions for the Compile, Make, and Rebuild selections on the Project menu. Contains the functions that read, write and process the configuration file. The functions in this file initialize the CWSTART DLL. Contains the supporting functions for the Popup Menu defined by CWRIGHT.MNU. Contains the functions that support the Filter selection on the Project menu. Contains the supporting functions for the tabbed Output Window. Contains the functions that read, write and process the state file. Contains functions used by one or more of the keymaps and other shared functions, such as NextWord /PrevWord. Contains the functions supporting the Version Control submenu. Contains the function in support of the Word Wrap and related features. Error Parsing

File ERRORFIX.C
ERRINFO.C

Description This file contains the engine that drives the various error parsers for different compilers and languages. This file contains the actual error parsers for the various compilers. Macros

File BRACE.C
CURSOR.C ENTAB.C PREPROC.C PROMPT.C

Description The source code file for the Codewright brace matching features, including the functions Brace, BraceMatch and BraceMatchNext. This file contains functions to make and support mouse assignments and operations. The functions that support entabbing and detabbing the current buffer are contained in this file. Contains the functions in support of the Preprocess function. This source file contains the prompting functions and supporting functions that use the prompt history facility.

298

Keyboard Command Sets


REPEAT.C SLIDE.C TABSET.C TAGS.C Contains the source code for the function Repeat, which repeats a command a specified number of times. Contains the functions for moving a block of text in or out. Contains the functions supporting setting tabs, including extension specific settings. The source file for the functions that support the CTags features.

CWDIALOG DLL
The CWdialog DLL is one of the DLLs that is loaded during initialization. The name of this file is CWDIALOG.DLL. This library contains the dialog functions that support the menuing and other interactive operations. The source code for the CWdialog DLL is also supplied. There are a number of functions in this DLL that allow you to access the dialogs on the menu directly. It is sometimes useful to assign these functions directly to keys, or to call them from your own source code. These functions are the functions beginning with Dlg... and Print. To use these functions, just include the file CWDIALOG.H into your C source code. You will find this file in Codewright's CWDIALOG subdirectory.

CWHELP DLL
The CWhelp DLL contains the functions that access the various Help libraries used by Codewright. These include the contextual help for the editor, the Codewright API function help, and the Microsoft Windows API (SDK) help, if you have it. The name of the DLL is CWHELP.DLL. If you want to call the function cwhelp from your C source code, you will need to include the file CWHELP.H in your file. This header file is located in Codewright's CWHELP subdirectory.

Keyboard Command Sets


Codewright is supplied with four keyboard command sets, also called keymaps. They are: CUA (Common User Access), BRIEF emulation, Epsilon emulation, and VI emulation. Each is contained in a separate DLL. The C source code files and makefiles are included for each of these DLLs. Unless you have elected not to install portions of the source code, each set of source code has been installed in its own subdirectory.

299

Supplemental Language Support


The first of these contains the Common User Access or CUA command set. This command set conforms to Windows standards whenever possible. It is contained in the file CUA.DLL. The second command set is fashioned after the DOS programmer's editor, BRIEF, originally from UnderWare, Inc. It does not conform to Windows standards, but is itself something of a standard for programmers. It is supplied in the file BRIEF.DLL. The third command set is an emulation of the Epsilon editor, which is an adaptation of Emacs from Lugaru. This keymap does not conflict with Windows standards as directly as the BRIEF emulation does, but neither does it support Windows standards. The forth command set is an emulation of the Unix editor, vi. There are somewhat different flavors of this editor in use. We have attempted to support the common features of these. You will find this support in VI.DLL

Supplemental Language Support


In addition to the support for C/C++, Pascal, HTML, and assembly language built into the CWSTART DLL, support is provided for other languages in separate DLLs. The source code for these DLLs is provided. Here is a description of the language support DLLs provided:

DLL PRG.DLL
SC.DLL COB.DLL BAS.DLL CWHTML.DLL CWJAVA

Description This DLL contains the functions that support language specific features for dBASE and Clipper language source files (.PRG files). This DLL contains the functions that support language specific features for Paradox PAL source files (.SC files). This DLL contains the functions that support language specific features for COBOL source files (.COB files). This DLL contains the functions that support language specific features for Visual Basic for Windows (.BAS files). This DLL contains additional support for the HTML language, including a split window viewer. This DLL contains the functions that support language specific features for JAVA source files.

These DLLs are not automatically loaded, as is CWSTART.DLL. You will need to use the Libraries dialog on the Tools menu. It adds a statement to your Codewright configuration file (CWRIGHT.INI). Here are example load statements for these DLLs:

300

Auxiliary Services
[LibPreload] LibPreload=PRG.DLL LibPreload=SC.DLL LibPreload=COB.DLL LibPreload=BAS.DLL The statements above load the DLLs and make the functions in them immediately available for use. This does have the effect of slowing the initial loading of Codewright. An alternative is to use LibAutoLoad rather than LibPreload. This will cause the DLLs to be loaded only on demand. It does, however, require listing all of the function in the DLL in the statement. See the description of this function for details.

Auxiliary Services
The Auxiliary Services or DLLs provide support for supplemental features. These features or groups of features are generally provided in separate DLLs. The source code for each DLL, if provided, is in a subdirectory within Codewright's home directory. Each subdirectory is given a name that is the same as the root name of the DLL. These Features or DLLs are add-on packages that may not be required by every user. Like the additional language support DLLs, they may require a little setup to use. They are generally not loaded automatically.

DLL CWLDRAW.DLL

CWREDIT.DLL

CWDIFF.DLL

CWFOPEN.DLL CWDDE.DLL

CWBROWSE.DLL

Description This DLL allows remapping the keyboard so that you can draw lines and boxes in your file, using the IBM OEM character set. You must be using OEMfixed, 8514oem, terminal, or similar font. If not, these lines will be displayed as international characters. It is not loaded automatically. This DLL provides the user with the ability to edit the Tool Ribbon and SideBar interactively. It supports the Tools/Toolbars Editor menu selection. This DLL contains the support for Codewright's differencing feature. It allows side-by-side differencing of files or buffers, in addition to single buffer difference analysis. This DLL supports the File Open mode of the Codewright SideBar. This DLL contains the functions that turn Codewright into a DDE server. Other applications can then operate Codewright remotely to perform syntax checking, Lint, and Tags database updating. The DLL is not loaded automatically. This DLL contains the main support for Codewright's Browser. This DLL is loaded automatically, when needed.

301

Dissecting a Codewright DLL


CWTAGS.DLL CWBSC7.DLL CWWEB.DLL This DLL supports the use of Premia compiled Tags databases with the Browser. It is loaded as needed. This DLL supports the use of Microsoft Browser databases (C/C++ V7.0+) with the Browser. It is loaded as needed. This DLL supports loading files edited in Codewright into various Web browsers. It is not loaded automatically.

Sample DLL
The source code for an essentially empty DLL has been included. You will find it in the SAMPLE subdirectory in the Codewright home directory. You can put some flesh on this skeleton, or you may use it as an example of what elements go in to a Codewright DLL. The source code for SAMPLE.DLL is a skeleton of comments and function stub or two. The comments show you where to insert additions or changes that you want to make to Codewright. These insertions might include: Loading other DLLs, possibly written in a programming language other than C. Adding event handlers. Setting defaults, much as you would in the configuration file. Adding key commands. Writing and installing replacement functions.

A makefile is also included for the this DLL.

Dissecting a Codewright DLL


Your compiler imposes certain requirements in order to correctly produce a Microsoft Windows compatible DLL. In addition to those requirements, there are a few essentials required by Codewright. This section will help you understand what is required and why. Let's take apart a Codewright DLL and see what is typically there.

The _init Function


Whenever Codewright loads a library, it executes that DLLs _init function, if the library has one. This is the function you use for initializing the DLL and letting Codewright know what functions

302

Making Changes and Additions


the library has to contribute. Generally, this function consists of a series of LibExport function calls, which export the functions defined in that DLL for use by other entities in Codewright.

Exporting Functions
The functions in a DLL, and the parameters for each, must be registered with Codewright before you can make full use of them. If you don't register them with Codewright, you will not be able to assign them to a key or call them from the API Command Key. You register or export the functions with the LibExport function. This is in addition to any export declarations required by the programming language. This requirement is a result of the use of Pascal calling conventions. When using Pascal calling conventions, the program stack would become unbalanced if any function parameters were omitted. Yet, the function LibFunctionExec, which services the API Key and the key assignments, has no way of knowing the type and number of parameters are required unless you tell it. The LibExport function does this. Note: If you change the number or type of parameters in a DLL function, you must remember to change the corresponding LibExport call that registers that function.

Making Changes and Additions


When you have determined that you are going to modify Codewright's source code, you have two approaches available to you. You can change existing functions or add new functions to the system.

Changing Existing Functions


Changing an existing function is often the best way to go, if your change is small and you want the change to be reflected whenever a certain function is called. This usually avoids the need to create or change a LibExport call. For example, you might want to change the function that moves the cursor ahead in increments of a word. You can be relatively certain that this function is going to be called as the result of some key command. If you were less certain about what other routines might be using the function, you would need to consider the effects of your changes on those other routines. If you are in serious doubt about what routines may be relying upon the function, it is best not to change it. Instead, create a new function that is called when you want it, and leave the old function in place for the routines that use it.

303

Creating New Keymap Command Sets


Adding Your Own Functions
When adding your own functions, you must be sure that they are declared in the same manner as other Codewright functions. You won't be able to assign your functions to keys, call them from the API Command Key, and other useful things, unless you properly export your functions to Codewright. This means using LibExport. If you create a new file for your functions, you will have to be sure it uses the necessary header files (CWSTART.H, CWDIALOG.H, CWHELP.H...), and that it is included in the compile and link. There is a macro defined in EXPORTS.H that simplifies defining new functions for Codewright, when programming in C. Just define your function as DLL and it is automatically declared as Pascal calling conventions, exported, and so forth. Here is an example of its use: void DLL KeyNotInUse( void ) { SysBeep(); MsgWarning( "Unassigned key" ); } Windows NT also requires that all functions be added to the .DEF file in order to be properly exported. Just edit this text file and add your function name to the end of the existing list. Also note that NT is case sensitive in function names, whereas Windows is not.

Creating New Keymap Command Sets


Keymaps have additional requirements over and above those of a Codewright DLL. This section will walk you through the basic outline of a keymap.

Keymap _init Function


Like the _init function for any other Codewright DLL, the Keymap's _init function typically contains a series of LibExport calls that make functions available to the outside Codewright world. This is necessary for any functions you create to assign to keys within the keymap. Normally, the _init function does not install the keymap. If it did, you would not be able to load the DLL to have access to its functions without loading the keymap.

304

Creating New Keymap Command Sets


Keymap Function
The keymap function is the function that creates and installs the new keymap. To be compatible with the DefaultKeymap function, this function must have the same name as the root of the DLL in which it resides. For example, the CUA keymap is in the file CUA.DLL and is installed with the cua function. If you are creating an EMACS keymap in EMACS.DLL, name the keymap function emacs().

Flag Initialization
One of the first things you will want to do in your keymap function is to set options the way users of your keymap will expect to find them. For example, the Brief keymap needs to allow assignments to Alt keys, and doesn't create a new window for each new file that is loaded. If the users of your keymap will expect to have vertical and horizontal scroll bars on their edit windows, now is the time to make that happen. There are several functions that will assist you in setting the options you require. They are: SysSetFlags, SysSetDefault, and SrchSetFlags. Use SysSetFlags to set options you might otherwise set from the System Options dialog. To set up window and buffer settings the way you want, even before any buffers or windows have been created, use SysSetDefault. To set the default search settings, use SrchSetFlags. You will find these functions described further in the second part of this manual. You are not dictating with these settings how a user must operate. The settings you create here may be overridden by settings stored in the configuration file or state file.

Basic Assignments
When you create a new keymap, it is empty -- and we mean really empty. The only keys or mouse actions that will work are those that Codewright lets Windows process. This includes menus, +7, +;, + and such. If you want pressing the A key to produce and A in a buffer, you need to make that key assignment. There are functions provided to take the drudgery out of making these assignments. KmapAssignTypables and KmapAssignRange are your primary assistants. The difference between these two functions is that the first makes assumptions about what you want the keys to do, whereas the second allows you to specify the function that is assigned to the keys.

305

Recompiling a DLL
Keymap Specific Assignments
Now you are ready to make assignments specific to your keymap. Your main tool in doing this will be the function KmapAssign. Use the Codewright API functions, or create your own supporting functions to assign to keys. Remember that when you create your own functions you will need to export it with a LibExport call in the DLL's _init function in order for the key assignment to work. Otherwise, you will get a "function not found" message when you press the keystroke.

Menu Accelerators
The last step in creating your own keymap is to put strings indicating any "short cut" keys or accelerators on the menu. You will rely on the MenuAddKeyString function to do this.

Recompiling a DLL
Part of the Codewright directory structure is a miniature of that used by most C compilers. There is an INCLUDE subdirectory that contains header files, a LIB subdirectory to contain .LIB files, and subdirectories to contain the source code for each of the Codewright DLLs you can rebuild. The INCLUDE and LIB subdirectories must be made known to your compiler and linker. You can do this manually, or through the use of a MAKE utility or Project file, if your compiler supports these things.

Using and Modifying the Makefiles


There are two makefiles supplied for each of the DLLs that you can modify to suit your specific needs and desires. The makefiles are installed in each subdirectory that contains DLL source code. One makefile is a Microsoft makefile and the other is a Borland makefile. The primary things that makes these files specific to one compiler or another are the compile and link command lines that they employ. If you are using some other compiler, you should find adapting it to your compiler is a straight forward task. You can recognize the Microsoft makefile by looking for the file with no extension that has the same root name as the DLL it makes. The Borland makefile uses the same name, except that the extension used is .MAK. The same makefiles are used for generating 32 bit DLLs as for generating 16 bit DLLs. If you have the environment variable CPU defined this is normally sufficient to cause the Microsoft makefile will generate a 32 bit DLL. You may also cause a 32 bit DLL to be generated for Borland or Microsoft by defining a macro named WIN32 at the beginning of the makefile:

306

Recompiling a DLL
WIN32=TRUE The DLLs themselves are generated in either a WIN16 or WIN32 subdirectory of the source file directory, depending on which platform you are compiling for. You will then need to move the DLL up to the Codewright executable directory for it to be used. The Borland compiler relies on configuration files and command line switches to locate include files and libraries, rather than environment variables. As a result, it may be necessary to modify a macro definition in the Borland makefile to indicate the location of these files, unless you have installed the Borland compiler in the default directory of C:\BC45. If you have installed your Borland compiler in another location, modify the value assigned to BORPATH toward the beginning of the makefile. For example, if you installed the compiler in the directory D:\BC45, change the assignment to read as follows: BORPATH=D:\BC45

Adding Files Groups of related files have been defined as macros toward the beginning of each makefile. This facilitates operating on the filenames as a group. Also, if you choose to place the source code for some extensions to Codewright in a separate file, you can readily add those filenames to the macro definitions. If the makefile employs a linker response file, such as CWSTART.LNK, don't forget to add your file to the list in the response file so that it will get linked in.

Compile and Link Options


The compiler options you use for compiling Codewright DLLs are largely the same as you would use for compiling any Microsoft Windows DLL. Codewright DLLs must be compiled using Large Memory Model. If you specify your include directories on the command line, be sure to include the Codewright CWSTART and INCLUDE subdirectories in your command. You will find that this has been done for you in the makefile. Similar requirements apply to your Link command. Begin with your basic Link command line for producing a Windows DLL. The libraries in Codewright's LIB subdirectory must be linked with the other objects. A standard .DEF file has been supplied for each DLL.

Link Libraries
The makefiles provided reference certain libraries in the linker command. You may find it useful to know the purpose of each of these libraries in case you have a different version of the same compiler or would like to construct a similar command line for a compiler not supported.

307

Recompiling a DLL
Microsoft Link This is the command line in the makefile for Microsoft C invoking the linker:
link /NOD $(LIBDIR)\libentry @cwstart.lnk, $(DLLDIR)\cwstart.dll,,libw oldnames \ ldllcew $(LIBDIR)\cwright,cwstart.def

The libraries used in this link command are LIBW.LIB, OLDNAMES, LDLLCEW.LIB, and CWRIGHT.LIB. Of these, the files LIBW.LIB and CWRIGHT.LIB are import libraries. They don't contain any object code themselves, but rather tell where the routines may be accessed at runtime. LIBW.LIB points to addresses in USER.EXE, GDI.EXE and other executables that provide the Windows API. CWRIGHT.LIB points to addresses in the Codewright kernel that support the Codewright API. You may need to link in other import libraries at times, for example, if you are making direct calls to routines in CWSTART.DLL, CWMATCH.DLL or a DLL of your own creation. If you don't have an import library (.LIB) file corresponding to the DLL you are using, you can create one with the ILIB utility supplied. ILIB is described a little later in this chapter. The library LDLLCEW.LIB contains object code to use when creating Large memory model Windows DLLs. Depending on your installation of Microsoft C, you may find that your Large memory model library is named LDLLCAW.LIB instead. Alternately, you may find that you have not installed any large model library at all. If so, you can run the setup program that came with your compiler to add to your installation. If you use a library intended for any other memory model you are guaranteed to have a program that doesn't work right, and will probably crash Windows. The library OLDNAMES.LIB is included to avoid unresolved externals. This is because Microsoft changed the names of some of their library routines. See your MSC 7.0 README file for details. If you are using an older version of the Microsoft compiler, you should remove this library from your command line.

Borland Link Below is a portion of the input script for TLINK in the makefile for Borland C/C++:
..\lib\cwright.lib+ import.lib+ cwl.lib The purpose of these libraries follows closely the libraries described above for Microsoft. The libraries CWRIGHT.LIB and IMPORT.LIB are import libraries. IMPORT.LIB is supplied to you by Borland for the Windows API and CWRIGHT.LIB comes from Premia for the Codewright API.

308

Using Your Own DLL


You may need to link in other import libraries at times, for example, if you are making direct calls to routines in CWSTART.DLL, or a DLL of your own creation. If you don't have an import library (.LIB) file corresponding to the DLL you are using, you can create one with the ILIB utility supplied. ILIB is described a little later in this chapter. The third library CWL.LIB contains object code to use when creating Large memory model Windows DLLs. This library was named CWINL.LIB in versions prior to 3.0. Use only a Large memory model library intended for Windows for this purpose.

Using Your Own DLL


There are several reasons that you may have for wanting to use a DLL that you have developed on your own, rather than modifying one of those supplied. It is expected that if you write a new command set for the keys that you will place it in a separate DLL. You can then use the DefaultKeymap function to facilitate loading the DLL and calling the keymap subroutine that makes the key assignments. You may find it more convenient to develop a DLL with Borland Pascal for Windows, or Microsoft's Visual Basic than to modify an existing C language DLL. Alternately, you may just be concerned about how well your C language additions will coexist with the source code provided. Your DLL will need all of the same parts described in the "Dissecting a Codewright DLL" section above, regardless of what language you use to produce it. Be sure to compile using a Large memory model. You need Far calls and pointers for things to work properly.

Installing Your DLL


When you are ready to use your DLL, you need only reference it in the proper section of your configuration file. If your DLL is a keymap and supporting functions, just change the name assigned to DefaultKeymap to the basename of the DLL file; if your DLL is named MYKEYS.DLL, change the statement to read DefaultKeymap=mykeys under the [DefaultKeymap] section. If your DLL just contains some additional subroutines you want to have available, you have a couple of options: Always load the functions at startup-time Tell Codewright to load them when needed.

The first option may slow down the initial loading of Codewright, whereas the second can cause a short pause when the function is first called. The second option may be better if you have a

309

Using Your Own DLL


nominal amount of memory installed. If you have a fast CPU and hard disk, you probably won't notice much difference in daily use. The following examples assume that you have put your DLL in Codewright's home directory, or in a directory that your CWLIB environment variable points to. The first loads the DLL immediately, while the second loads it only when needed. Place only one of these commands in your configuration file, under the [Editor] section heading: LibPreLoad=mydll LibAutoLoad="mydll func1 func2" The second option, loading the DLL only as needed, requires that you supply more information. You must supply the names of the functions in the DLL which may be called. For more information on configuration files, refer to the "Configuration and State" chapter in the first part of this manual..

310

Index

#
#Ifdefs, 58

(
(File) Open Window, 43

_
_init, 305 _init Function, 307

AttrSetPaletteEntry, 169, 170, 191 Auto-Expand/Collapse, 47 auto-indent fill mode, 200 set mode, 200 Auto-save, xiii, 154, 155, 192, 206 Autosave, 191 AUTOSAVE.C, 300 AutosaveDir, 192 AUTOTOOL.TXT, 3 Auxiliary Services, 304

B 3
32 bit disk and file access, 50 BackTab, 192 Backup set file name/location global, 203 set file name/location, 201 Backup files, 80, 138, 139, 162, 202, 203 Backup Files And Directories, 138 Backup Formatting Strings, 139 Backup specification, 202, 203 Backup Specs Illustrative Examples, 141 BlockCopy, 193 BlockCut, 193 Bookmark Window, 47 Bookmarks, 79 Global, 47 Bookmarks Window, 43, 47 Borland, 156 Borland Link, 311 Borland Pascal, 312 Borlands Delphi, xiii BORPATH, 310 BR_adjacent_window, 81 BR_attach, 81 BR_backspace, 81 BR_beginning_of_line, 81

A
Add to User Dictionary Spell Correction Dialog, 22 Adding Your Own Functions, 307 Additional Language Support, 303 Alternation And Grouping, 134 Anchors. See Bookmarks API Assistance, 1 API Assistant, xiv, 65 Automation Tools, 2 checkboxes, 2 Modifying the Database, 2 using, 1 API Database Editor, 2 ASM.C, 300 assembly language, 303 AssignMouseKeys, 191 Associated Dialogs, 50 AttrFindColor, 169 AttrQColor, 169 AttrSelColor, 169 AttrSetColor, 169

311

Index
BR_borders, 81 BR_copy, 81 BR_create_edge, 81 BR_cut, 81 BR_del_to_BOL, 82 BR_delete, 81 BR_delete_curr_buffer, 82 BR_delete_edge, 82 BR_delete_macro, 82 BR_drop_bookmark, 82 BR_edit_file, 82 BR_end_key, 82 BR_end_of_buffer, 82 BR_end_of_line, 82 BR_end_of_window, 82 BR_esc, 82 BR_exit, 82 BR_goto_bookmark, 82 BR_home_key, 82 BR_left_side, 83 BR_load_macro, 83 BR_mark, 83 BR_open_line, 83 BR_playback, 83 BR_print, 83 BR_quote, 83 BR_read_file, 83 BR_remember, 83 BR_right_side, 83 BR_search_again, 83 BR_search_back, 83 BR_search_case, 83 BR_search_fwd, 83 BR_set_backup, 83 BR_set_mode, 84 BR_tab, 84 BR_toggle_clipscrap, 84 BR_toggle_re, 84 BR_top_of_buffer, 84 BR_top_of_window, 84 BR_translate, 84 BR_translate_again, 84 BR_translate_back, 84 BR_translate_fwd, 84 BR_write_and_exit, 84 Brace, 193 placement in templates, 241 Brace Matching, 55 BRACE.C, 300 BraceFind, 57 BraceMatch, 57, 193 Bracematch, 57 BraceMatchNext, 57, 194 Brief, 14, 142, 143, 155, 157 BRIEF, 60, 75 Brief Keymap Functions, 81 Browse, 49 Browser Filter Toggle Buttons, 8 Inspect window, 5 Jump to Code, 6 Query Buttons, 7 Ribbon, 6 Selecting a Database, 5 String Search, 6 Traversing the Tree, 5 Tree window, 5 Window, 4 Browser and Tags Support, 3 Browser ribbon, 5 Browser Support, 4 Browser tree expand or collapse, 5 browsing, xiv, 3 Outline Symbols, 10 Supported File Types, 11 using Microsoft .BSC files, 3 BSC file, 5 BSCMAKE, 5 BufBackspace, 195 BufDelChar, 195 BufDelLine, 196 BufDelSelection, 196 BufDelToEOL, 197 BufEditFile, 197 Buffer current, 79 filter dialog, 222

312

Index
settings dialog, 222 Buffer save dialog, 222 BufInsertChar, 198 BufInsertEOL, 200 BufInsertEOL, 198 BufInsertFile, 199 BufInsertScrap, 199 BufInsertStr, 200 Bufqbackupspec, 138 Bufqglobalbackupspec, 138 BufQMaxTabCol, 204 BufQTabStr, 204 BufSetAutoIndentMode, 200 BufSetBackupSpec, 201 Bufsetbackupspec, 138 BufSetGlobalBackupSpec, 203 Bufsetglobalbackupspec, 138 Bufsethexascii, 145 BufSetMaxTabCol, 204 Bufsetsysflags Function, 138 BufSetTabStr, 204, 248 BufSetTabUsage, 204 BufWrite, 205, 206 BufWriteFile, 205 BufWriteSelection, 206 Bugs, 172 Build, 49 Button Link Deleting, 14 Button links, 12 Comment prefixes, 12 Defining buttons, 12 How it works, 12 View Links, 13 What you see, 12 buttons, 12 action, 12 Calls To, 8 Carriage Return, 131 CenterLine, 206 Change directory dialog, 222 Changing Existing Functions, 306 Character Classes, 131 Character Matching, 131 Check Document Button Spell Check Dialog, 21 Check In Command, 117 Check Out Command, 118 Check Word Button Spell Check Dialog, 21 CheckIn, 207 Check-in Dialog, 209 CheckInBuffer, 208 CheckInSetCmd, 209 CheckOut, 209 Check-out Dialog, 212 CheckOutBuffer, 211 CheckOutSetCmd, 212 ChromaCode, xiii ChromaCoding, 231, 232, 300 language dependent, 229 setting update delay, 242 speeding up, 233 ChromaCoding, 232 Clipboard, 17, 213, 268, 284, 287 define separator string, 213 separator string enable, 213 ClipboardEnableSepStr, 213 ClipboardSetSepStr, 213 Closed Selections, 14 Codewright API, 142 Codewright Api, 143 Codewright CUA Variant, 61 Color Settings Predefined, 169 Color value set for Codewright palette, 191 Color..., 215 ColorAlternate..., 169 ColorCommandLine, 169, 214 ColorComments, 215

C
C Language Operators, 145 C Language Support, 55 C.C, 300 Called By, 8

313

Index
ColorDiffAdd, 215 ColorDiffDel, 215 ColorError, 169, 216 ColorInsertedLines, 215 ColorKeywords, 215 ColorLineNumbers, 169, 215 ColorMessage, 169, 216, 267 ColorModifiedLines, 215 Colors warning messages, 217 window dialog, 222 ColorSelection, 169, 215 Colorselection, 155 ColorSetPallete, 218 ColorText, 169, 215 Colortext, 155 ColorWarning, 169, 217 Column Marking, 15 Column Selection, 15 Command Completion, 142 Command Key, 58, 59, 141, 142, 143, 144, 145, 150, 156, 162, 168 Displaying Return Values, 144 examples, 144 Command Line command files, 168 Flags, 163 Parameters And Options, 163 Command Line Parameters, 163 Command lines, 209, 212, 214, 227 command shell in child window, 50 Comment length optimizing for ChromaCoding, 233 Comments, 193, 231 Common Dialogs, xiii Common User Access, 60 Compact mode, xiii, 57, 65, 67, 80 Compile and Link Options, 310 COMPILE.C, 300 CompuServe, 171 Conditional code, xiii, 58, 156 Definitions Used In, 58 CONFIG.C, 300 ConfigFileRead, 218 Configuration Example File, 154 Configuration and State introduction to, 153 Configuration File, xiii, 58, 152, 153, 155, 156, 161, 163, 164, 165, 167, 218, 248, 249 Execute section in, 218 User Defined Sections, 158 Configuration Hierarchy, 128 Contents Of The State File, 161 Copy, 193 Core Services, 299 Correct All button Spell Correction Dialog, 22 Correct button Spell Correction Dialog, 22 CPP.C, 300 Creating a Project, 122 Creating Definitions, 58 Creating New Keymap Command Sets, 307 Creating Windows With A Mouse, 17 CTags setup, 289, 291 CTags, 289, 290 Ctags Support, 9 Cua, 14, 60, 142, 157 CUA, 60, 75 CUA Key Commands, 60 CUA Variant, 61 CUA_attach, 69 CUA_auto_indent, 69 CUA_back_tab, 69 CUA_backspace, 69 CUA_copy, 69 CUA_cut, 69 CUA_delete, 69 CUA_delete_curr_buffer, 70 CUA_delete_curr_window, 70 CUA_deletion, 68, 70 CUA_drop_bookmark, 70 CUA_edit_file, 70 CUA_edit_next_window, 70 CUA_edit_prev_window, 70

314

Index
CUA_enable_virtual, 63 CUA_end_of_buffer, 70 CUA_end_of_window, 70 CUA_exit, 71 CUA_goto_bookmark, 71 CUA_left_side, 71 CUA_make_window_icon, 71 CUA_mark, 71 CUA_motion, 68, 71 CUA_mouse, 68 CUA_mouse, 71 CUA_mouse_selextend, 71 CUA_next_winbuf, 71 CUA_open_line, 71 CUA_playback, 72 CUA_QPersistSel, 72 CUA_quote, 72 CUA_read_file, 72 CUA_remember, 72 CUA_right_side, 72 CUA_search_again, 72 CUA_search_back, 72 CUA_search_fwd, 72 CUA_sel_persist, 73 CUA_selection, 68, 72 CUA_self_insert, 73 CUA_shiftpage, 73 CUA_tab, 73 CUA_tab_use, 73 CUA_toggle_clipscrap, 73 CUA_top_of_buffer, 73 CUA_top_of_window, 73 CUA_translate, 73 CUA_translate_again, 73 CUA_translate_back, 74 CUA_translate_fwd, 74 CUA_write_and_exit, 74 Cursor Placement After Search, 136 CURSOR.C, 300 Customization, xii, xiii, 143 Cut, 193 CW CUA, 61 CW32.EXE, 152 CWBUTTON.BTN, 43 CWDDE.DLL, 304 CWDIALOG DLL, 302 CWDIALOG.H, 302, 307 CWHelp, 219 CWHELP.H, 307 CWHelpDefaultName, 219 CWINL.LIB, 312 CWL.LIB, 312 CWLDRAW.DLL, 146, 304 Cwpst, 161 Cwright.Ini, 161, 303 Cwright.Ini, 164 CWRIGHT.LIB, 311 CWRIGHT.PST, 167 Cwrightini, 164 CWSTART DLL, 299 CWSTART.DLL, 303, 312 CWSTART.H, 300, 307 cwvdos.386, 51

D
dBASE/Clipper, 300 Debugging, 145 Default Backup Specification, 139 Function Parameters, 144 Keymap, 158 Keymap, 165 Default font dialog, 222 DefaultKeymap, 220, 312 Defines creating, 58 Definitions Creating, 58 Delay ChromaCoding update, 242 DeleteNextWord, 220 DeletePrevWord, 220 Dialog change directory, 222 default font, 222 file differencing, 222

315

Index
file find, 222 file grep, 222 file open, 222 filter utility, 222 go to line, 222 go to mark, 222 merge, 222 multi-buffer search, 222 print, 222 print setup, 222 save as, 222 set mark, 222 Spell Correction, 22 window colors, 222 window font, 222 window settings, 222 Dialogs buffer save, 222 buffer settings, 222 Extension-specific Setup, 222 key bindings, 222 DICT.APP, 20 DICT.D, 20 DICT.I, 20 DICT.S, 20 DICT.U, 20 dictionary files, 20 Difference, 49 Differencing dialog, 222 directory set working, 285 Directory change dialog, 222 Disabling Virtual Space, 62 DisplayFileName, 221 Displaying Return Values, 144 Dissecting a Codewright DLL, 305 DlgFGrep, 247 DlgMenuExec, 223 DlgMenuPopup, 223 Dll Source Code, 143 Dockable Toolbars manually dock and undock, 42 Dockable Toolbars and Windows, 41 dockable windows, 43 Document Languages dialog, 54 Document Settings, 53 Document_Backup Attribute, 138 Drag and Drop Copy, 16 File Loading, 18 Move, 16 Text, 16 Drag and Drop, xiii

E
EditNextBuffer, 224 Editor Highlights, 1 EditPrevBuffer, 224 EdVersion, 224 Elision, xiii, 57, 286 email, 171 End of file, 292 Environment Dialog, 18 Environment variables, 227, 253, 254 Environment Variables, 161 EPSAltPrefix, 100 EPSAppendNextKill, 100 EPSArgument, 100 EPSAutoFillMode, 100 EPSBackwardCharacter, 100 EPSBackwardDeleteCharacter, 101 EPSBackwardKillWord, 101 EPSBackwardParagraph, 101 EPSBackwardSentence, 101 EPSBackwardWord, 101 EPSBeginningOfLine, 101 EPSBeginningOfWindow, 101 EPSBindToKey, 101 EPSBufed, 101 EPSBufferInit, 101 EPSCapitalizeWord, 102 EPSCd, 102 EPSCenterLine, 102 EPSCenterWindow, 102 EPSChangeModified, 102 EPSCopyRegion, 102

316

Index
EPSCopyToFile, 102 EPSCountLines, 102 EPSCtrlPrefix, 102 EPSCtrlXTable, 103 EPSDeleteBlankLines, 103 EPSDeleteChar, 103 EPSDeleteCharacter, 103 EPSDeleteHorizontalSpace, 103 EPSDired, 103 EPSDownLine, 103 EPSEndKbdMacro, 103 EPSEndOfLine, 103 EPSEndOfWindow, 103 EPSEnlargeWindow, 104 EPSEnlargeWindowHorizontally, 104 EPSEnlargeWindowInteractively, 104 EPSEnterKey, 104 EPSExchangePointAndMark, 104 EPSExit, 104 EPSExitLevel, 104 EPSFillParagraph, 104 EPSFindFile, 104 EPSForwardCharacter, 105 EPSForwardParagraph, 105 EPSForwardSentence, 105 EPSForwardWord, 105 EPSGotoBeginning, 105 EPSGotoEnd, 105 EPSGotoLine, 105 EPSGotoTag, 105 EPSGrep, 105 EPSHelp, 105 EPSHighlightRegion, 106 Epsilon Key Commands, 91 Epsilon Keymap Functions, 100 EPSIncrementalSearch, 106 EPSIndentPrevious, 106 EPSIndentRegion, 106 EPSIndentRigidly, 106 EPSInsertChar, 106 EPSInsertEOL, 106 EPSInsertFile, 106 EPSInsertToColumn, 106 EPSJumpToLastBookmark, 107 EPSJumpToNamedBookmark, 107 EPSKillBuffer, 107 EPSKillLevel, 107 EPSKillLine, 107 EPSKillRegion, 107 EPSKillSentence, 107 EPSKillWindow, 107 EPSKillWord, 107 EPSLastKbdMacro, 107 EPSLoadBytes, 108 EPSLowercaseWord, 108 EPSMake, 108 EPSMarkParagraph, 108 EPSMaybeBreakLine, 108 EPSMouseLeftButtonDown, 108 EPSMouseRightButtonDown, 108 EPSMouseRightButtonUp, 108 EPSMouseRightClick, 108 EPSMoveToWindow, 109 EPSNamedCommand, 109 EPSNextBuffer, 109 EPSNextPage, 109 EPSNextPosition, 109 EPSNextWindow, 109 EPSOneWindow, 109 EPSOpenLine, 109 EPSOverwriteMode, 109 EPSPluckTag, 109 EPSPreviousBuffer, 110 EPSPreviousPage, 110 EPSPreviousWindow, 110 EPSPush, 110 EPSQueryReplace, 110 EPSQuotedInsert, 110 EPSRectangleMode, 110 EPSRedo, 110 EPSRedoChanges, 110 EPSRegexReplace, 111 EPSRegexSearch, 111 EPSReplaceString, 111 EPSReverseIncrementalSearch, 111 EPSReverseRegexSearch, 111 EPSROEditEvent, 110 EPSSaveAllBuffers, 111

317

Index
EPSSaveFile, 111 EPSScrollDown, 111 EPSScrollLeft, 111 EPSScrollRight, 111 EPSScrollUp, 111 EPSSelectBuffer, 112 EPSSelectTagFile, 112 EPSSetBookmark, 112 EPSSetFillColumn, 112 EPSSetMark, 112 EPSSetNamedBookmark, 112 EPSShowBindings, 112 EPSShowPoint, 112 EPSShrinkWindow, 112 EPSShrinkWindowHorizontally, 113 EPSShrinkWindowInteractively, 113 EPSSplitWindow, 113 EPSSplitWindowVertically, 113 EPSStartKbdMacro, 113 EPSStartProcess, 113 EPSToIndentation, 113 EPSTransposeCharacters, 113 EPSTransposeLines, 113 EPSTransposeWords, 113 EPSUnassignedKey, 114 EPSUndo, 114 EPSUndoChanges, 114 EPSUpLine, 114 EPSUppercaseWord, 114 EPSVisitFile, 114 EPSWhatIs, 114 EPSWriteFile, 114 EPSWriteRegion, 114 EPSWriteState, 114 EPSYank, 115 EPSYankPop, 115 EPSZoomWindow, 115 ERRINFO.C, 300 ErrKmapAssign, 224 ERRORFIX.C, 300 Escape Sequences, 130 EvalStrAdd, 225 EvalStrDel, 59, 226 Exclusive Selection, 14 ExecApp, 226 ExecCommand, 227 ExecUserCmnd, 227 ExecuteMacro, 228 Executing menu items from keyboard, 257, 258 Expand / Collapse, 18 Expanding And Collapsing Text, 18 EXPORTS.H, 258 Expression Evaluator, 145, 225, 226 ExtAddKeyword, 229 ExtAlias, 229 Extassigntemplate, 23, 231, 239, 241 Extassigntemplate, 24 ExtColors, 231 ExtColorsAssoc, 232 ExtCommentSearchLimit, 233, 242 ExtDelayedColoring, 233 Extensibility, 143 Extension specific tab stops, 247 Extensions File editing, 54 Extension-specific Setup dialog, 222 ExtExpandTemplate, 234, 241 ExtExpandTemplate, 25 ExtIndentEnable, 236 ExtIndentEnableAssoc, 236 ExtKmapAssign, 237 ExtReadKeywordFile, 238, 239 ExtReadTemplateFile, 239 ExtSetDelimiters, 239 ExtSetStyle, 240 ExtSetTemplateMacro, 27, 235, 241 ExtSetUpdateDelay, 242 ExtSetWrap, 242

F
Fax support via, 172 Fax Number, 172 FFind, 243 FFindFile, 243 FFindNext, 244 FFindPattern, 244

318

Index
FFindShow, 245 FGrepFile, 245 FGrepFlags, 245 FGrepNext, 246 FGrepPattern, 246 FGrepScope, 247 FGrepShow, 247 File differencing dialog, 222 File filters add, 248 delete, 249 File filters, 249 File Filters dialog, 249 File Find, 49, 243 file specification, 244 output file, 243 File find dialog, 222 File Grep, 36 files to search, 247 option flags, 245 output filename, 245 search pattern, 246 File grep dialog, 222 File locking, 155 file manager, 48 File merge dialog, 222 File Open Dialog, 48, 222 File print dialog, 222 File save as, 222 File type set word wrap for, 242 File Type Specific Settings, 54 File types associating with language, 54 File View Window, 43, 44 File Icons, 44 filters, 44 Operating on the files, 45 FILE.TPL, 25 Filename Transformation, 138, 139, 140 Filenames, 163 Files loading, 124 FileTabs, 247 Fill Pattern, 140 FILTER.C, 300 FilterAdd, 248 FilterDeleteList, 249 filters file specification, 44 Find files, 243 Flags, 163 Fmatch, 153, 157 FMATCH.DLL, 311 Font default dialog, 222 window dialog, 222 FontSelectMsg, 249 form, 1 forms approach completing function calls, 1 FTEE, 51 FUNCT.TPL, 25 Function substitution, 253 Function Definitions Outline, 55 Function Reference, 189

G
GDI.EXE, 311 General Operation, 138 Get command, 210 Global Bookmarks, 47 Gnu Tags, 9 Go to line dialog, 222 Go to mark dialog, 222 GotoLine, 249 grep, xiii, 19

H
help, 219 Help DLL, 302 Hex mode, xiii, 65, 67, 80, 288 History Of Responses, 150, 151 hotspots on the status line, 15 Hunt for files, 243

319

Index
I
Ignore All button Spell Correction Dialog, 22 Ignore button Spell Correction Dialog, 22 ILIB utility, 311 INCLUDE subdirectory, 309 Inclusive Or Exclusive Selection, 14 Incremental Searching, 38 indenting spaces, 278 InfoView, 2 Insert scrap, 199 Insert Link, 12 InsertMode, 250 Installing Your DLL, 312 Internet Mail, 171 ISearch, 250 ISearch Function, 38 ISearch Function, 38 Iteration Qualifiers, 133 KeyRecord, 251 Keystrings, 225, 238, 250, 252 Keystrokes playback, 251 playback, 65, 67, 77 recording, 251 KmapAssign, 225, 238, 251, 309 KmapAssignRange, 308 KmapAssignTypables, 308

L
Language mapping extensions, 54 Language Dialog, 53 Language dialog, 23 Language Features, 53 Language Indenting, 300 Language settings, 54 Language specific processing assigning to file type, 229 Language Templates, 231 expanding, 234 keymap for, 237 reading definitions from file, 239 special chars in, 231 Special Chars In, 24 LANGUAGE.C, 300 LDDown, 276 LDLeft, 276 LDLLCAW.LIB, 311 LDLLCEW.LIB, 311 LDRight, 276 LDUp, 276 LIB subdirectory, 309 LibAutoLoad, 252 LibExport, 306, 307 LibExport, 307 LibFunctionExec, 27, 236, 253, 306 LibFunctionExec, 141 LibFunctionReplace, 253 LibPreLoad, 254 LibUnLoad, 255

K
Key Assignments, 157, 165 Key bindings dialog, 222 Keyboard executing menu items from, 257, 258 Keyboard Command Sets, 302 Keyboard inactivity, 192, 284, 287 Keycode, 198 Keymap, 251, 253, 286 basic outline of, 307 current, 273 Keymap for Output assigning to, 224 Keymap Function, 308 Keymap overlay assigning to, 237 Keymap Specific Assignments, 309 Keymaps, 191 KeyPlayback, 250

320

Index
LIBW.LIB, 311 Limits, 185 line draw, 276 Line Drawing, 146 line drawing, 276 Line length, xiii Line numbers in print output, 271 Line Selections, 15 LINEDRAW.DLL, 276 Link insert, 12 Link Libraries, 310 List file of Type, 248 Local Bookmarks, 47 Lock Command, 119 Lower, 255 Menu Editor, 148 Menu item executing from keyboard, 257, 258 Menu Items adding, 149 deleting, 149 separator, 149 Menu items, 149 MenuAddKeyString, 309 MenuCmnd, 257 MenuCommand, 258 Menus adding, 148 changing position, 148 deleting, 149 file lists, 150 Merge Function, 173 Merge dialog, 222 Message informative print on status, 266 Metacharacters, 129, 130, 132, 133, 134, 135, 136 Microsoft Foundation Classes, 1 Microsoft Link, 311 Model Buffer, 285 Model Window, 285 Mouse, xv, 14, 17, 191 Copying Text, 17 Creating Windows With, 18 Moving Text, 17 Mouse Commands, 14 Mouse Copy And Move, 17 MouseLeftDClick, 258 MouseLeftDown, 259 MouseRightDown, 259 MovDown, 260 MovEndWin, 260 MovEOF, 261 MovEOL, 261 MovHome, 261 MovLeft, 261

M
Macros run from Button Links, 13 Maintenance Policy, 172 makefile, 310 Making Changes and Additions, 306 Making Mouse Assignments, 19 Margin right mark, 295 margin mark, 55 Margins for printing, 273 Mark set dialog, 222 MarkGoto, 255 MarkRestorePos, 256 Marks. See Bookmarks MarkSavePos, 256 MarkSavePos., 256 MarkSet, 256 Matching braces, 193, 194 Matching parentheses, 194 memory usage specifying, 288 Menu Accelerators, 309 Menu Editor, 148

321

Index
MovNextChar, 262 MovPageDown, 263 MovPageUp, 263 MovPrevChar, 263 MovRight, 264 MovTopBuf, 264 MovTopWin, 265 MovUp, 265 MsgLevel, 266, 267 MsgMessage, 266 MsgPauseOnError, 267 MsgWarning, 217 Multi-buffer search dialog, 222 Multiple Sources Search Dialog, 34 Multi-source Search Options, 34

P
Paradox, 300 Parameter checking, 1 PAS.C, 300 Pascal, 303 Paste, 268 Pctags, 9 Persistent Selections, 62 Phone support via, 172 Phone Number, 172 Playback Strings, 251 PlaybackRecStr, 74 Popup Menu, 19, 27 Definition Sections, 28 Item Definition Lines, 28 Item Hot Keys, 29 pseudo-comment, 28 Separator Lines, 29 Supporting Functions, 29 Pop-up notes, 13 Predefined Templates, 23 PREPROC.C, 300 Pre-Processed View, 57 Pre-Processor Commands, 58 Preprocessor Conditionals, 156 PrevWord, 220, 269 PRG.DLL, 303 Print, 269 Print dialog, 222 Print setup dialog, 222 PrintFlags, 269 PrintFooter, 270 PrintHeader, 271 PrintLineInc, 271, 272 PrintMargin..., 273 PrintSelection, 273 Processing At Startup, 156 Project creating, 122 defined, 121 Project file format, 154

N
newline inserting raw, 198 Newline Character, 24, 130, 131, 198, 199, 200, 214, 220, 231, 267, 269, 294 Next Button Spell Check Dialog, 21 NextWord, 220, 267 note links, 13 NotePad, 60

O
OLDNAMES.LIB, 311 Open File Window, 48 Outline Symbols, xiv, 10 Supported File Types, 11, 46 Outline Window, 3, 43, 45, 46 using, 11, 45 Output filename, 205, 206, 268 Output Window, 3, 4, 11, 36, 41, 46, 48, 49 keymap for, 224 OutputFile, 268 OutputWindow, 268 Override Pattern, 140

322

Index
Project Files, 127 Project Members adding and deleting, 122 Project Properties dialog,, 5 Project Setup Checklist, 123 Project Window, 3, 41, 43, 124 Projects loading member files, 124 selecting or changing, 124 use with version control, 127 using, 124 Projects and Workspaces, 121 Prompt Histories, 150 PROMPT.C, 300 PTG file, 5 Put command, 207 PVCS, 116 PWB, 159 positioning at Beginning/End of Line, 134 Special Characters, 129 Relating Checkboxes to Functions, 160 Repeat, 274 REPEAT.C, 300 Replace Global replacement, 33 Prompted replacement, 33 Single replacement, 33 Replace one function with another, 253 Replace with Spell Correction Dialog, 22 Replacement Options, 33 ResizeWindow, 274 response files, 168 Restrict to Comments/Strings Spell Check Dialog, 21 Restrict to Selection Spell Check Dialog, 21 Restrict to Strings Spell Check Dialog, 21 Ribbon Search, 16 Right Margin Mark, 295 right mouse click, 19

Q
QDefaultKeymap, 273 Query functions displaying results, 144 Quick Search, 8, 39 Quit button Spell Correction Dialog, 22 Quoting, 130, 134, 135, 136

S
Sample DLL, 305 SAMPLE.DLL, 305 Save as dialog, 222 SC.DLL, 303 SCC Provider Interface, 120 Scrap insert, 199 select next, 274 select previous, 275 Scrap Buffer, 17, 196, 199, 200, 268 Scrap buffers multiple, 275 multiple, 159 ScrapNext, 274 ScrapPrev, 274, 275 ScrapSetCount, 275 SDK, 249

R
README.TXT, 171 Recompiling a DLL, 309 Recording keystrokes, 251 Redo, xiii, 64, 66, 67, 76, 79, 274, 292 Reference Groups and Replacement Strings, 135 Regular Expressions, xiii, 129, 130, 133, 135, 136, 137, 279, 280 Alternation And Grouping, 134 Character Classes, 132 Escape Sequences, 130 Examples, 137 Iteration Qualifiers, 133 Matching End Of Line, 134

323

Index
Search for word at cursor, 39 Ignore case, 32 Maximal match, 32 multi-source Documents only, 35 Edit Modified Files, 36 Files and folders, 35 Output Window, 36 Project, 35 Threaded, 36 on toolbar, 39 Regular expression, 32 Restrict to selection, 33 Retain selection, 33 Select matching string, 33 Whole word, 33 Wrap, 33 Search After Go To, 8 search and replace, 31 Dialog, 31 Multi-source, xiii Settings, 32 Search List, 35 Drive and Directory Lists, 37 File Pattern, 37 Include Directory, 37 List Editing Buttons, 38 Patterns List, 37 Search Options, 39 Search Options dialog, 16, 32 Search Pattern List editing, 37 Search results window, 49 Search Subdirectories, 36 Searching incremental, 38 Searching Project Files, 127 Select View via Tabs, 49 Selections by Word, 15 Closed, 14 Exclusive, 14 Inclusive, 14 Line, 15 Mouse, 14, 15 persistent in CUA, 62 Reopening, 14 Selective Display, 19 dialog, 19 Using, 19 SelectWord, 275 Separator string enable, 213 Set auto-indent mode, 200 backup file location, 201 backup file name/location global, 203 color value for Codewright palette, 191 name of state file, 281 tab character usage, 204 tab stop definition string, 204 word wrap by file type, 242 SetLineDrawBindings, 147, 276 SetLineDrawStyle, 276 SetLineDrawStyle, 147 Settings buffer dialog, 222 window dialog, 222 Shell buffer, 50 Sidebar File Open, 48 SLIDE.C, 300 SlideIn, 277 SlideOut, 277 Smart Indenting, 236 Source Code v. Command Key, 143 Source Integrity, 117 Space, 278 space key, 278 Special Characters, 24, 129, 231 Specifications, 178, 185 Spell Check Dialog, 20 Spell checker, xiv, 20 Spell Correction Dialog, 22 SrchFind, 278 SrchQFlags, 279

324

Index
SrchSetFlags, 279 SrchTranslate, 281 STARTUP.C, 300 State File, 151, 153, 156, 161, 163, 168 Contents, 161 set filename, 281 STATE.C, 300 StateSetFilename, 281 Status line set font for, 249 Status Line Actions, 15 Submenu adding, 149 Submenus, 149, 150 Suggest Alternate Spellings Spell Check Dialog, 21 Symbol Definitions Creating, 58 Symbol Window, 11, 46 Symbols, 3 Output Window tab, 49 Symbols Window, 3 SysBeep, 282 SysCaretHeight, 282 SysCaretWidth, 283 SysEdit, 60 SysExit, 283 SysQFlags, 284 SysSetCwd, 285 SysSetDefault, 285, 308 Syssetdefault, 155, 157 SysSetFileLocking, 154 SysSetFlags, 284, 308 SysSetUserFlags, 286 SysSwapBlocks, 288 System Overview, 298 Tab stops, 204, 247, 248, 288, 289 define for file type, 247 set definition string, 204 Tabbed Output Window, 48 Tabs, 133, 135, 198, 200, 204, 205, 248, 253, 286, 288, 292 Select View via, 49 TABSET.C, 300 TagFind, 289, 290 Tagfind Function, 10 TagIgnoreCase, 289 TagNext, 10 TagPrev, 10 TagPrompt, 290 Tags Database Using, 10 Tags Database, 9 Tags Setup, 9 Tags Support, 3, 9 TAGS.C, 300 TagSetFile, 290, 291 TagsWnn, 4 Technical Support, 171 Template Definitions adding and changing, 23 Template Expansion, 300 Template Expansion, 236 Template Macros, 23 list of, 26 Templates containing macros, 234 for language constructs, 23 predefined, 23 reading definitions from file, 239 run from Button Links, 12 special characters in, 24 using macros in, 24 The _init Function, 305 The Key Commands, 60 TLINK, 311 ToBottom, 291 Toolbar Bindings, 43 Select Buttons, 42

T
Tab, 288 inserting raw, 198 menu editor, 148 Tab character enable usage, 204

325

Index
Toolbar Search, 39 Toolbars, xiii Docking and moving, 42 Enabling and Disabling, 41 Toolbars and Buttons, 42 Toolbars and Windows dockable, 41 ToTop, 291 Transformation Fill Pattern, 140 Override Pattern, 140 Transformation Patterns, 140 VI Key Commands, 85 virtual space Disabling in CUA, 62 Visibles, 292 Visual Basic, 312 Visual SourceSafe, 116

W
Warning messages color, 217 Web Page, 171 Wildcard, 197, 248 Wildcard patterns, 248 Win.Ini, 18 Window default creation position, 293 window font dialog, 222 Window settings dialog, 222 Windows, xiii Windows .Ini Files, 153 Windows API, 1 Windows File Manager, 18 Windows for Workgroups V3.11, 50 WINDOWS.H, 219 WinScrollHInc, 292 WinSetCreationPos, 293 WinVisible..., 294 WinVisibleEOF, 294 WinVisibleEOL, 294 WinVisibleMarginCol, 295 WinVisibleSeparator, 294 WinVisibleSpaces, 294 WinVisibleTabs, 294 WinVisibleVirtLines, 294 WinVisibleVirtSpaces, 294 Word Selections, 15 Word Wrap, 54 enabling, 295 paragraph reformat, 296 set by extension, 242 setting right margin., 296 Working Directory, 152, 161, 164, 167, 285

U
Undo, xiii, 64, 66, 67, 77, 79, 80, 196, 292 Unmatched curly braces, 193 Updating Source With Merge, 173 Upper, 292 User Defined Sections, 158 USER.EXE, 311 User-definable Popup Menu, 27 Using and Modifying the Makefiles, 309 Using the API, 143 Using the Tags Database, 10 Using Your Own DLL, 312

V
VCS Maintenance Dialog, 120 VCS.C, 300 VDOS, 49, 50 Version Control, 208, 209, 211, 212 Check In Command, 117 Check Out Command, 118 Check Out with Lock Command, 118 Command Line Interface, 117 interface, 207, 209 interface selection, 116 Log Command, 119 Manager Command, 119 Unlock Command, 119 Version Control Setup, 116 VI Command Summary, 85

326

Index
Workspace creating, 125 defined, 121 saving, 125 updating current, 126 Workspaces selecting or changing, 126 WrapEnable, 243, 295 WrapEnable, 242 WrapParagraph, 243, 296 WrapSetRightMargin, 243, 296 WrapSetRightMargin, 296 WriteBuffer, 297

Z
ZoomWindow, 297

327

Index

328

You might also like