------------------------- RBN TO HTML CONVERTER 2.2 by Richard Pavlicek ------------------------- This is a bridge utility to verify RBN data files and convert them to HTML. It produces attractive card diagrams, bidding diagrams and play diagrams, which require no tedious checking because any errors would be caught and reported. The program is written in assembly language for IBM-compatible computers using DOS or Windows 95/98. For details about the RBN data format, see this URL: http://www.rpbridge.net/7a12.htm The package is archived as R2H22.ZIP (a standard zip file) and includes these 11 files: R2H.COM The program itself R2H22.DTA Conversion template (can be edited) R2H.TXT The file you are reading MISC.RBN Miscellaneous data file in RBN format C.GIF Club symbol graphic D.GIF Diamond symbol graphic H.GIF Heart symbol graphic S.GIF Spade symbol graphic T.GIF Table graphic (with NESW) U.GIF Alternate table graphic X.GIF Invisible spacer graphic No special installation is required. Just unzip the files into any folder (directory) and it's ready to use. To test it, enter the command line: R2H MISC.RBN This will convert the file MISC.RBN (in RBN format) to a new file MISC.HTM (in HTML format). Use any HTML viewer (like your web browser) to view MISC.HTM and you should be pleased. Note that the seven GIF image files must be in the same folder (directory) as the HTML file, else you will see "not found" markers where the graphics should appear. The conversion works similarly for any source (file or pathname) specified on the command line. The output file is always created using the same name as the source, but with the .HTM extension. WARNING: If the output file exists, it will be overwritten! The RBN source file must have the extension .RBN or start with the signature "% RBN" or "%RBN" (no quotes) to be recognized as valid. Otherwise, nothing will be done. See also my Bridge File Converter (available separately), which will convert other formats to RBN, which then can be converted to HTML using this program. --------------- Version Updates --------------- Version 2.2 Minor update to comply with RBN 2.2, which removed the N# syntax (name repetition pattern is now implied by K label) and added a new form of scoring: X = IMP Pairs. Updated score verification to account for "old scoring" (pre-1987) if specified, and honors if appropriate. Header requirement "% RBN" is no longer required in source file if .RBN extension exists. Renamed template file to R2H22.DTA (to be consistent) but file is the same as in Version 2.1. Version 2.1 Added recognition of RBN label K (Team Names and Carryovers). Added ability to display running totals in team matches. Renamed template file to R2H21.DTA. Version 2.0 Updated RBN recognition to latest RBN 2.0 standard. Renamed template file to R2H20.DTA (i.e., with version number) to prevent program from using an obsolete template. Suppression of repeating labels is modified slightly only to suppress _subordinate_ repeating labels. For example, if the E (event or main heading) label changes, the S (session or subheading) label will be given even if it happens to be the same as the last S label. Added an analysis of plain text to determine whether output should be flowing text or tabular (fixed width). Removed P2R.COM utility, which is obsolete. Version 1.7 Increased attractiveness of HTML output: (1) Player names are now shown above their direction in bidding diagram, (2) placed board number, dealer (when no bidding) and vulnerability within diagram corners, (3) moved contract/declarer to follow bidding, and other cosmetic enhancements. Increased output control so any RBN label (TDLESNBHACPR) can be omitted for repeating data (or entirely) in the HTML output. Version 1.6 Cosmetic adjustment to display board number (and period) in upper left corner of diagram when no dealer, vulnerability, contract or leader exists. Purpose is to make the display more compact for files containing only numbered deals. Version 1.5 Expanded the board number display to include open/closed room status or section info when given in the RBN file. For example, if the RBN file has 1:1, it used to be shown only as "Board 1-1" but now it is "Board 1 (Open room)". Similarly, 1:2 would be shown as "Board 1 (Closed room)". If a section letter is given as 1:A, it is now clearly shown as "Board 1 (Section A)". A counter variable [#] was added. This can be placed anywhere in the template to provide consecutive numbering (always starting with 1 in each file). Note that it appears in the "Before deal" section of the default template. Version 1.4 Added the display of the dealer when a deal has no contract. This is useful for simple "hand records" when there is no actual bidding or play recorded. Note that the dealer is not displayed when a contract exists because it is either redundant (readily seen in the bidding diagram) or useless (as in a puzzle or end position with no bidding diagram). -------------------- Command Line Options -------------------- The program accepts 20 command-line switches to control output of specific data. Switches correspond to RBN labels (TDLESFKNBHACPRIM) plus: W = free text, X = exhibit number before deal, Y = formatting after deal, Z = deal separator. An uppercase letter means _always_ and a lowercase letter applies to _repeating_items_ only. Switches must follow the filename (and a space). Precede switches with a plus sign to include, or a minus sign to exclude. Examples: R2H MISC.RBN +ACR Include only auction, contract and result R2H MISC.RBN +h Include only nonrepeating hand diagrams R2H MISC.RBN -PF Exclude play diagram and free text R2H MISC.RBN -tdles Exclude repeating title, event, stage, location, date R2H MISC.RBN -tdlesfkbh As above, and also excluding repeating form of scoring, team names, board numbers and hand diagrams R2H MISC.RBN -tdlesfkbhXz As above, excluding exhibit numbers completely, and deal separators whenever diagram repeats. (This setting was used to prepare the MISC.HTM file on my web site.) Note: You cannot combine the plus and minus signs in one command. (If you think about it, this wouldn't make much sense either.) ------------- Verifications ------------- The following errors are reported: Card Diagram Error -- Invalid card, duplicated card, or any hand or suit with more than 13 cards. Incomplete diagrams are allowed, but if the deal contains _bidding_, an error is reported if any hand has from 1-12 cards. (Note that blank hands do not generate an error, as this is usually by intention.) Bidding Error -- Invalid call, insufficient bid, illegal double or redouble, too many consecutive passes, or an extra call after the auction was legally terminated. Play Error -- Invalid play, revoke, playing a card not held, or a lead by a player who did not win previous trick. An error is also generated if the suit is superfluously given when _following_ to the suit led. Contract Error -- The given contract does not match the contract reached by the auction, including the proper risk status (doubled or redoubled). (This check is omitted if auction is incomplete.) Declarer Error -- The given declarer does not match the declarer determined from the auction. (This check is omitted if auction is incomplete.) Opening Leader Error -- The given opening leader is not to the immediate left of declarer. (This check is omitted for partial diagrams, since anyone could be on lead in an end position.) Score Error -- The given score does not match a calculated score for the actual result, which includes a check for the proper sign status (plus or minus). Note that this error could be caused by a vulnerability error. Note: When errors are reported, the Line Number given is the _starting_line_ of that deal in the RBN file (not the exact line on which the error occurred). This is because some errors are due to conflicting data, so it's not clear which line is the culprit. ------------------- Conversion Template ------------------- The file R2H22.DTA is a template that controls the HTML conversion. It can be edited as desired, however, _do_not_ add or remove any of the vertical bars (|). These are placemarkers for data insertion and the program relies on a fixed number being present. Also, do not edit the comment lines, e.g., , as these delimit the different sections of the file. For example, the default deal (or board) number is shown simply with a period after the number (e.g., "27."). Suppose you wanted this to display as "Board 27" instead. Find the section that says and the next line reads:
||.|
Note the three vertical bars. The period between the second and third bar is the "aft label." Currently, there is nothing between the first and second bar, which is the "fore label." To make the desired change, remove the period, and add "Board " (no quotes) between the first two bars. Then it should look like:
|Board ||
Note the space after "Board" which is required to display correctly as "Board 27" (otherwise it would be "Board27"). You probably would want to make the same change in the "Two Hand Diagram" and the "Single Suit Diagram" sections. The template structure allows much flexibility. Essentially, you can add, edit or remove any text, as long as you _do_not_ add or remove the vertical bars or the comment lines. The HTML tags have been carefully designed to provide an attractive display, however, these may also be modified by an experienced user. Just be careful not to remove the vertical bars. Maximum size of R2H22.DTA is 4096 bytes. ---------------------- Copyright & Disclaimer ---------------------- This software is offered free, "as is" and without warranty. The author assumes no liability. It may be distributed freely provided all the files are intact and unmodified, no fee is charged, and it is not included as part of another package. ---------- Comments and suggestions are welcome. E-mail to: richard@rpbridge.net