Help Index

Match for Windows

Help Index

Match is one of the Barry Press Utilities, and is Copyright © 1991-1993 by Barry Press.  Support for CodeList and other programs in the Barry Press Utilities is available from the author (CompuServe 72467,2353).

You can find a summary of Match operation in the following items:

Summary of Operation

Matching Algorithm

The following menu items appear in the Match menu bar.  For information on the commands in one of the menu items, mouse on the corresponding menu item name.

File Menu

Search Menu

Options Menu

Help Menu

A number of keystrokes are interpreted by Match.  For information on these keystrokes, mouse on the following item:

Match Keyboard

Match accepts one or two command line arguments, which are assumed to be the pathnames of files to be opened and compared.  The first command line argument is opened into the left match window; the second into the right.

The executable file match.exe also includes a related program which runs from the DOS command line.  It accepts exactly two command line arguments, the pathnames of the files to be matched.  The results of the match are written to standard output.  The output is formatted for presentation on a wide printer, such as a laser printer in landscape mode with a small, fixed-pitch font.

For information on using Help, press F1 or choose Using Help from the Help menu item.


File Menu

The File menu item provides commands to direct loading text files into the left and right windows for matching against one another.  Separate File Open commands are provided for the left and right match windows, with keyboard accelerators for each.  The File menu item also provides a command to exit Match altogether.  For more information, select a File menu command name from the list below.

Open Left

Open Right

Exit

Under versions of Windows that support drag and drop for applications, one or two files may be dropped into the Match window from the File Manager.  Match attempts to do the sensible thing with the files dropped:

==> If two files are dropped, one is loaded into the left window and one into the right.

==> If one file is dropped and the left window is empty, the file is loaded into the left window.  Otherwise, the file is loaded into the right window.


Open Left
Open Left command - File Menu

The Open Left command of the File menu item directs that a file be loaded into the left-hand match window.  A file open dialog box is displayed for selection of the file, which is then opened, read, and compared against the file in the right-hand window, if any.  Lines of text which cannot be matched against lines in the right-hand window are displayed in reverse video.

You choose the file to be loaded into the left-hand window via a file open dialog box.  A check-box titled "Clear Other Pane" is provided at the bottom of the dialog box which, if checked, will cause the right-hand pane to be cleared before the selected file is loaded into the left-hand pane.

You may also invoke the Open Left command via the Cntrl+F12 or Alt+Cntrl+F2 keystrokes.


Open Right
Open Right command - File Menu

The Open Right command of the File menu item directs that a file be loaded into the right-hand match window.  A file open dialog box is displayed for selection of the file, which is then opened, read, and compared against the file in the left-hand window, if any.  Lines of text which cannot be matched against lines in the left-hand window are displayed in reverse video.

You choose the file to be loaded into the right-hand window via a file open dialog box.  A check-box titled "Clear Other Pane" is provided at the bottom of the dialog box which, if checked, will cause the left-hand pane to be cleared before the selected file is loaded into the right-hand pane.

You may also invoke the Open Right command via the Cntrl+Shift+F12 or Alt+Cntrl+Shift+F2 keystrokes.


Exit
Exit command - File menu

The Exit command terminates the Match application, removing it from the screen.  The keystroke Alt+F4 is equivalent to the Exit command.


Search Menu

The Search menu item provides commands to advance forward or backwards in the matched files, stepping from one set of changes to another or to a specified text string.  Comparison search commands are provided to move to the next set of differing lines, the next set of identical lines, or the next set of lines which are of the opposite sense (same/different) to the current set.  Each of these three functions are provided for moving forward and backward in the file.  String search commands are provided to search backwards or forwards (using an exact, case sensitive match) for a specified string.

All nine search commands operate relative to the line(s) at the top of the match window, and move the top line to the requested point.  The display control is such that a full window of text lines is maintained on the display at the end of the file, so the search may stop short in cases where to reach the requested destination would cause less than a full window to be displayed.  In cases where no lines meeting the requested search could be found, a message box is displayed indicating that the search failed.

For more information, select a Search menu command name from the list below:

Next

Next Compare

Next Difference

Previous

Previous Compare

Previous Difference

String Again

String Next

String Previous


Next
Next command − Search Menu

The Next command moves the match window display forward (towards the end of the files) to the next interesting point in the comparison.  If the top line in the match window is a pair of identical lines, then the new top line will be the next pair of differing lines.  If the top line is a pair of differing lines, the new top line will be the next pair of identical lines.

The search never goes further than the last line in the file(s) such that a full window of text is displayed.


Next Compare
Next Compare command − Search Menu

The Next Compare command moves the match window display forward (towards the end of the files) to the next pair of identical lines following the top line in the left and right windows.  It does not matter whether the top lines are identical or not for the Next Compare search.

The search never goes further than the last line in the file(s) such that a full window of text is displayed.


Next Difference
Next Difference command − Search Menu

The Next Difference command moves the match window display forward (towards the end of the files) to the next pair of differing lines following the top line in the left and right windows.  It does not matter whether the top lines are identical or not for the Next Difference search.

The search never goes further than the last line in the file(s) such that a full window of text is displayed.


Previous
Previous command - Search Menu

The Previous command moves the match window display backwards (towards the beginning of the files) to the next interesting point in the comparison.  If the top line in the match window is a pair of identical lines, then the new top line will be the next previous pair of differing lines.  If the top line is a pair of differing lines, the new top line will be the next previous pair of identical lines.


Previous Compare
Previous Compare command - Search Menu

The Previous Compare command moves the match window display backwards (towards the beginning of the files) to the next pair of identical lines preceding the top line in the left and right windows.  It does not matter whether the top lines are identical or not for the Previous Compare search.


Previous Difference
Previous Difference command - Search Menu

The Previous Difference command moves the match window display backwards (towards the beginning of the files) to the next pair of differing lines preceding the top line in the left and right windows.  It does not matter whether the top lines are identical or not for the Previous Difference search.


String Again
String Again command - Search Menu

The String Again command repeats the previous string search command, moving the match window display to the next line in either window matching the last-entered search string.  With the exception noted below, the line matching the search string is moved to the top of the display window.  An error message is displayed if the string cannot be found.  Wraparound to the beginning/end of the files is not performed.

The search is case sensitive and in the direction of the prior search.  If there was no prior string search, then the default search direction is forward and a prompt is displayed to permit a search string to be entered.

As with the other search commands, the search never displays further forward in the file than the point at which a full screen of text is displayed, even if this causes the line containing the matched string to not be at the top of the display window.


String Next
String Next command - Search Menu

The String Next command searches forward in the files for a specified search string, moving the match window display to the next line in either window matching the string.  With the exception noted below, the line matching the search string is moved to the top of the display window.  The search is case sensitive.  An error message is displayed if the string cannot be found.  Wraparound to the beginning of the files is not performed.

As with the other search commands, the search never displays further forward in the file than the point at which a full screen of text is displayed, even if this causes the line containing the matched string to not be at the top of the display window.


String Previous
String Previous command - Search Menu

The String Previous command searches backward in the files for a specified search string, moving the match window display to the previous line in either window matching the string.  The line matching the search string is moved to the top of the display window.  The search is case sensitive.  An error message is displayed if the string cannot be found.  Wraparound to the end of the files is not performed.


Options Menu

The Options menu item provides access to controls on the operation of Match.  Options are available to control the matching process, to setup the window colors, and to select the font used for display.  Information on each of these commands may be displayed by selecting the appropriate item below.

Matching Options

Color Commands

Font


Color Commands

The color commands support selecting a color for the text and background for both matched and differing text lines.  The four commands available are:

Matched Background

Matched Foreground

Different Background

Different Foreground

Each command invokes a color selection dialog box.  Although both solid and dithered colors may be displayed in the dialog box (depending on your video adapter), only solid colors are used by Match for text display.  You may have to experiment some to find the colors that work best for you on your display.

The default colors for Match are taken from the Windows color selection made through the Windows Control Panel.  Color selections made within Match are saved in the file "press.ini" which Windows places in your Windows directory.


Font Command

The Font command invokes a dialog box with which you can select the font and text size used to display the matched files.  The font selection is limited to fixed pitch fonts available for your display.  Although the option is presented for bold or italic text, these selections are ignored.

Font selections made within Match are saved in the file "press.ini" which Windows places in your Windows directory.


Matching Options Command

When the Matching Options command is selected, a dialog box is displayed to let you set the controls on how Match processes input files.  The elements of the dialog box have the following functions:

Maximum Change Length (Lines): This option is currently not changeable.  The value controls the maximum number of lines of differing text that can be handled between regions of identical text.  If more than this number of lines of differing text occur, Match will display a dialog box indicating that the changes were too great to process.

Maximum Sync Length (Lines): This option controls the number of identical lines Match must find before it declares that a set of differences has ended and the following lines correspond to each other.  The default value is 3.  Increasing this value will eliminate certain false matches, but can also increase the size of the blocks Match declares as being changed.

Allow Sync on Whitespace Lines: When checked, this options allows lines consisting entirely of whitespace characters to be included when looking for sequences of matching lines following a difference.  Turning off this option can improve matching in files containing sequences of blank lines.

Text Matching Controls: In addition to exact, character-by-character comparisons of text lines, Match can relax the comparison to ignore case or to ignore whitespace characters within the line.  Check the corresponding radio button to change the text comparison.  Exact match and matching ignoring case are likely to be faster than matching ignoring whitespace within the line.

Retain CPU: Normally, Match allows other Windows applications to run while it compares its two files.  If this control is checked, Match retains control and does not allow other applications to run until the comparison is finished.  This can significantly improve performance on some machines at the expense of tying up the machine.


Help Menu

The Help menu item provides access to Windows Help for the Match application.  Commands are available for the Match help index, for the Match keyboard summary, and for help on the Windows Help application.  A command is also available to show the About box for Match.  For additional information, select a command from the list below.

Index

Keyboard

Help on Help

About


Index
Index command - Help Menu

The Index command activates the Windows Help application and displays the help index for Match.


Keyboard
Keyboard command - Help Menu

The Keyboard command activates the Windows Help application and displays keyboard usage information for Match.


Help on Help
Help on Help command - Help Menu

The Help on Help command activates the Windows Help application and displays help information on using Windows Help.


About Match Dialog Box

The About Match command in the Help menu item displays a dialog box for Windows Match.  The dialog box includes the version number of the program and the date the executable file (match.exe) was created.


Match Keyboard

Match provides the following Command Accelerator keys:

Cntrl+F12	Open a file into the left-hand match window.

Alt+Cntrl+F2	Open a file into the left-hand match window.

Cntrl+Shift+F12	Open a file into the right-hand match window

Alt+Cntrl+Shift+F2	Open a file into the right-hand match window.

F3	Search Next

Shift+F3	Search Next Compare

Cntrl+F3	Search Next Difference

F4	Search Previous

Shift+F4	Search Previous Compare

Cntrl+F4	Search Previous Compare

F5	String Again

Shift+F5	String Next

Cntrl+F5	String Previous

Alt+F4	Exit Match

Match provides the following window scrolling keys (scroll up means towards the front of the files).  Scrolling up or down applies to both match windows.  Scrolling left or right applies only to the specific match window.

Vertical Scrolling

Home	Scroll to the first line in both files.

End	Scroll to the last line in both files.

PageUp	Scroll up one window in both files.

PageDown	Scroll down one window in both files.

Up Arrow	Scroll up one line in both files.

Down Arrow	Scroll down one line in both files.

Horizontal Scrolling - Left Match Window

Cntrl+Home	Scroll right to the left edge of the file.

Cntrl+End	Scroll left to the right edge of the file.

Cntrl+PageUp	Scroll right the width of the window.

Cntrl+PageDown	Scroll left the width of the window.

Cntrl+Up Arrow	Scroll right one character.

Cntrl+Down Arrow	Scroll left one character.

Horizontal Scrolling - Right Match Window

Cntrl+Shift+Home	Scroll right to the left edge of the file.

Cntrl+Shift+End	Scroll left to the right edge of the file.

Cntrl+Shift+PageUp	Scroll right the width of the window.

Cntrl+Shift+PageDown	Scroll left the width of the window.

Cntrl+Shift+Up Arrow	Scroll right one character.

Cntrl+Shift+Down Arrow	Scroll left one character.


Summary
Summary of Operation

Match is a Windows application to compare the contents of two text files.  The overall Match window is divided into two child windows below the menu bar, termed the  and right-hand match window.  Text files may be loaded into both of these child windows.  Text loaded into the child windows is matched, line by line, with the results of the comparison displayed in the windows.  For any given line of text, there are three possibilities:

1.	If the line matches a corresponding line in the opposite window, then the two lines are displayed alongside each other using the normal window text colors.  These colors are user-selected via the Windows Control Panel.

2.	If the line occurs in the left-hand window but not the right, or in the right-hand window but not the left, then the line is displayed in reverse video and a blank line is displayed alongside it in the opposite window.

3.	If the line corresponds to a differing line in the opposite window, then the two lines are displayed alongside each other, both lines in reverse video.

See Also

Matching Algorithm


Matching Algorithm

Because text files may contain inserted or changed lines, simple character-by-character file comparison algorithms are inadequate to discover the changes between two files in any useful way.  Match incorporates a line-oriented algorithm designed to find inserted or changed lines and to display these changes in a useful form.

Match operates by scanning the two files from front to back.  After a pair of lines are found which differ, Match looks for a changed section in the two files or an inserted section in one or the other file after which the files once again compare.  A minimum number of lines must correspond exactly before Match decides it has isolated the difference between the two files.  The default value for this minimum number of lines is 3.  The value may be changed via the Options menu item..

The matching algorithm used requires a large number of string comparisons if the changed sections in the files contain many lines, possibly leading to the conclusion that the program has stopped if processing a large change.  While bugs are always possible, I haven't seen the program fail to complete matching a set of files yet given enough time.  The matching process (after the second file is selected) goes in two steps.  First, the file is read into memory in its entirety.  Completion of this step is marked by the cessation of disk activity and the display of the full path name of the file at the top of the appropriate child window.  Secondly, Match processes to determine the matching and differing lines in the two files.  This step proceeds with the Windows "wait" (hourglass) icon displayed for the mouse cursor, with completion marked by display of the file data in the child window.  Other programs can run while the comparison proceeds and the window may be resized, iconized, or closed while comparison is in process (unless the Retain CPU option is set in the Matching Options dialog box).

Finally, it is possible that a change will be larger than the tables used to track change information.  If this happens, Match will display a message box indicating that situation, and will not display data past the last point successfully matched.