Copyright: Copyright ©1993-95 KA Software
Citation: Copyright ©1993-95 KA Software


Contents
Sort for Codewright - Contents

Sort (A Codewright Extension) Version 1.00

Copyright © 1993-95 KA Software, All Rights Reserved

Sort is a DLL that works hand-in-hand with Codewright for Windows, the Programmers Editor.  This DLL is not free, it is being marketed as shareware.  Look at the Order Form to see about registering your copy.  When you register your copy, you will get a copy of the newest version of Sort and will be put on the mailing list for newer versions.  It is also your chance to get your two cents in and tell me what features you would like to see in Sort.  You are reading the sole documentation for Sort.

The sort dialog looks like this (assuming you have loaded in the 3D controls library).  To find out more about a section of the dialog, let your mouse do the walking:

Using Sort:

Sort Keys

Sort Entire Buffer/Sort Selection

Create New Buffer

Expand Tabs

Prepare Sample/Sample List

Sort Button

Future Directions

Order Form

Tech Support

You should do one (or more) of the following with Sort.

•	Put Sort.DLL in your CWRIGHT.INI files [LibPreLoad] section like so:

[LibPreLoad]

LibPreload=sort.dll

•	Hit F10 and type "sort".

•	Assign Sort to a key using the Key Bindings dialog (instructions on using this dialog can be found in Chapter 10 of your Codewright 3.0 users manual).

•	Create an icon on the Tool Bar or the Side bar that calls Sort.  You will find a bitmap thoughtfully contained in the DLL that you can use for this purpose (instructions on adding icons can be found in Chapter 12 under Ribbon Editor in your Codewright 3.0 users manual).

_____________________________________________________________________

I want to thank Sanjay S. Kanade for writing the wonderful shareware

program WhizNotes that was used to develop this help file.


Create New Buffer

This check box will cause Sort to create a new buffer titled <Sort Results>.  This is useful if you are sorting a lot of data in many different ways (more than you can easily preview with the Prepare Sample/Sample List Box.  The new buffer will be brought to the front (in versions of Codewright prior to 3.0 the buffer is created, but will not jump to the front).

It is important to note that using Create New Buffer will not destroy any previous buffers named <Sort Results> so if you intend to keep them, it may be less confusing if you immediately saved them under some other (hopefully more descriptive) name.


Expand Tabs

This check box will cause Sort to expand the tabs for the selection (or entire buffer) before sorting them.  This will force the expansion of tabs before any column numbers are calculated.  If this feature is off then tabs are treated as any other character (thereby taking up only one column).  If you are sorting on the first column in the file then this is not necessary (or if you are sorting on a column that is guaranteed to be before any tabs in any line in the file).  If you are sorting a single column of numbers (using column mark) then this will make no difference regardless of tabs in the line.  If you have any questions about how the sort will take place, use the Prepare Sample/Sample List button first.

It is important to note that using Expand Tabs will slow down your sorting significantly, so if you are sorting a large number of records and you don't need this feature on, you will see better performance by turning it off.


Future Directions

There are some things that I want to do in the future with Sort.

•	Speed up the sort.  Currently if you are sorting a large amount of data, sort may take some time to finish.  While the sort continues the cursor will animate and the status of the sort is displayed on the status bar.  The sort is faster than the previous version, but I think this can be sped up with more work.  Most of the speed difficulties lie in the brute force way I am handling the keys and tab expansion.  However, since the sort appears to be used by fairly few people and I have received few complaints, this work will be put off in favor of new features and other projects.

•	Extend the sort command to allow defining of keys and options so that specialty sorts can be performed from keystrokes. macros, or other extension DLL's.  I need to find out how I can give back the command that was done if the user is recording a macro so that Codewright can save it (if anyone knows how this can be done, please let me know).

•	Make the sort capable of handling data larger than can fit in memory (using disk files or Codewright buffers).

•	Keep the sorted list from Prepare Sample/Sample List when the Sort Button is pressed so that you don't have to wait twice.

•	Allow the user to identify the defaults that the Sort dialog comes up with.

•	(User suggestions here...)


Order Form

Sort Order Form

NOTICE ** NOTICE ** NOTICE ** NOTICE

Please make all checks payable to "Scott Gartner".  Checks made out to KA Software will be discarded.  All checks should be drawable on US banks for US funds (and may take longer to clear).  Please do not send cash through the mail.  Credit cards can not be accepted.  Please try to make it easy on me, this is not my full-time job.

NOTICE ** NOTICE ** NOTICE ** NOTICE

Mail order to:

KA Software

203 E. Broadway

Fairfield, IA  52556-2904

Please send me _____ Copies of Sort at $10 each (plus $2 for Shipping/Handling).

[ ]	Put me on the mailing list, but I want the next version only, not the current one (that I just downloaded from Compuserve or from your BBS).

[ ]	Don't bother with the mailing list, I'll keep up with the new versions through the BBS (where the current version can always be found) and in that case I need not pay any of the shipping and handling charges listed below.

[ ]	Please send me the complete source code for Sort, enclosed is an extra $35 and I promise that I won't give it away or compete with you by using the source to sell (or give away) another sorting DLL for Codewright. (Sign this form below to signify that you agree to this requirement.)  Older versions of the source code may become available for free as the product matures.

[ ]	Please don't send me any information on any of your other shareware products for DOS and Windows 'cause I really don't care.

Total cost for Sort:	$ _________

Shipping/Handling:	$	2.00

Foreign orders:	$	10.00

Rush:	$	4.00

Total:	$ _________

The address to ship Sort to is (print clearly):

Name:	____________________________________________

Address:	____________________________________________

____________________________________________

City/State:	____________________________________________

Country:	____________________________________________

Fax Number:	(_______) __________________________________

If you are ordering the source code then sign below to signify that you agree to the restrictions that are elsewhere on this form.

Signed:	_______________________________________________

Thank you for supporting my work.  I will use your money to support making this product and my other shareware better for all.  If you use Sort but don't feel that it is worth what I am asking for it, please contact me and tell me what I could do to make it worth more for you.


Prepare Sample/Sample List

The Prepare Sample button will cause the chosen data (see Sort Entire Buffer/Sort Selection) to be sorted according to the keys that you have defined (see Sort Keys) and will put the first 30 rows into the list box so that you can preview the results of your sort.

This will not effect your original data in the slightest, you must press the Sort Button before your buffer will be modified.

If you are sorting a large amount of data pressing Prepare Sample may take a moment before control is returned to you.  Before it can show you a representative sample it must sort ALL of your data.


Sort Button

Pressing this button will cause the data you have chosen (see Sort Entire Buffer/Sort Selection) to be sorted.  The sorted data will replace the original data (unless you have checked the Create New Buffer check box).  You may undo the sort by pressing your favorite Undo key in Codewright.  Sort will go away until you need it again.

This button is the default button on the dialog, and with the defaults that come up with Sort you can probably press enter even before you see the dialog (it may not even appear) and it is quite likely to do exactly what you intended (I find that I can do this 90% of the time with the current defaults).


Sort Entire Buffer/Sort Selection

This set of radio buttons controls the choice of data that will be used when Sort does it's work.

•	Sort Entire Buffer will cause the entire contents of your buffer to be sorted according to the keys that you have defined (see Sort Keys).  The buffer's contents will be replaced unless you have checked the Create New Buffer check box.

When sorting the entire buffer you will probably want to turn on the Expand Tabs feature.  This will force the expansion of tabs before any column numbers are calculated.  If this feature is off then tabs are treated as any other character (thereby taking up only one column).  If you are sorting on the first column in the file then this is not necessary (or if you are sorting on a column that is guaranteed to be before any tabs in any line in the file).

•	Sort Selection will sort only the selection that existed when Sort was invoked.  Sort will sort all of the different types of selections that you can make (try sorting a column marked area), you will have to experiment to see what kind of marked areas are useful to sort.

It is important to note that Sort Selection will be grayed out if you started Sort with nothing selected.

Some suggestions on the best selections to sort are:

•	Column Mark - This is useful for sorting lists of numbers in header files.

•	Line Mark - Probably the most common.

•	Inclusive or exclusive - Make sure the first line starts in column 1 and the last line ends after the Return (it should look the same visually as the Line Mark does).


Sort Keys

The Sort Keys define how the data chosen (see Sort Entire Buffer/Sort Selection) will be sorted.  The different sections of each key are:

•	Column Begin -- This is relative to the beginning of the line if you are using Line, Inclusive, or Exclusive Marking and it is relative to the first column if you are using Column Marking.

•	Column End -- This is relative to the beginning of the line if you are using Line, Inclusive, or Exclusive Marking and it is relative to the first column if you are using Column Marking.

•	Ascending/Descending -- These modify the direction that the data will flow after the sort, see the examples below.

•	Numeric -- This will cause the data to be sorted as if it is numbers rather than simply ASCII characters (see examples below).  NOTE:  If you check Numeric and the data does not begin with data that can be translated to numbers then it's order is undefined (although with the current sorting algorithm it will come out in the same order it went in, this "side effect" may change when I use a more advanced sorting technique, to avoid this whole problem, define a second sort key that is not Numeric.  If you are in doubt as to whether the data is usefully sorted Numerically you can use the Prepare Sample/Sample List button to try-before-you-buy or of course you can use Codewright's wonderful Undo.

The second sort key will be used when the first key is unable to discern the order of two records.  I believe that the best way for you to get the hang of using the keys is just to do it.  Hopefully the use of multiple keys corresponds with your expectations, if not I would very much appreciate your writing me and describing any confusion you had.

If the data you are sorting contains tabs, and the columns are relative to those tabs then you should use the Expand Tabs feature.


Registered Notice

The copy of Sort that you are running has been registered to: The person who is scanning the file's contents?  I don't think so.

Thank you for registering your copy of Sort for Codewright.


Tech Support

Technical support is provided for Sort through my Bulletin Board System I Can 'C' Clearly Now! BBS or you may send mail on Internet to scottg@micron.net.

I Can 'C' Clearly Now! BBS

(208) 322-2866

14,400 baud, 24 hours, 8N1

This board is dedicated to programming.  You will find source code, utilities, and interesting discussion as well as help with programming problems in a multitude of languages like C++, Borland Pascal, ICON, AWK, Assembler, etc.  The board hosts VGA Planets games (a good multi-player play-by-email game).  The board is a registered Gravis Ultrasound Node as well and can supply you with the latest in device drivers and information.

The shareware utilities that I write take up a large part of my time and I am dedicated to providing useful, bug-free software at reasonable prices.  However at these prices I cannot afford to respond to phone calls, so please do not call.  It is also much more likely that electronic mail will get a speedy response than regular snail mail.  If you have questions or problems that require a response, please do NOT send them with your payment (although praise is always welcome), but contact me through one of the above services.

Thank you for trying a KA Software utility, I hope you find it useful and that it finds a good home in your computer.  Please report any suspected bugs or feature requests (for bugs, please send me a concise description of exactly how to reproduce the bug with a description of your setup, including the version of Codewright you are running, and if necessary the data or a description of the data that Sort choked on).


Unregistered Warning

The copy of Sort that you are running has not been registered.

If you find this program useful, please register it, (see Order Form) and

help support future upgrades and other shareware programs from KA Software!