BRDGHTM2 Information for Programmers
BRDGHTM2.DLL contains routines for creating HTML documents to display
bridge hands.
BRDGHTM2.DLL is available on a freeware/shareware basis. It is
completely functional as freeware, but it will display a five-second
self-advertisement when the DLL is loaded. The routine necessary to
suppress the ad is supplied to programmers who register the DLL as
shareware.
BRDGHTM2.DLL and the related gif files are distributed with Duper.
Creating HTML documents with BRDGHTM2 consists of these steps:
- Add all the deals you want displayed to a queue, using the AddDeal
routine.
- Create the HTML document, which will show all deals in the queue,
by calling either of the HTML-creation routines, HTMLCustom or
HTMLDef. The only difference between these routines is that
the 'custom' routine uses a large number of parameters to give the user
more control over the resulting HTML document. The 'defaults' routine,
HTMLDef, takes fewer parameters and uses many default values, all of which
should be acceptable for purposes of American English. (British English
speakers might prefer 'All' to 'Both' when describing vulnerability; if
so, they should use HTMLCustom. Speakers of languages other than English
will almost certainly want to use HTMLCustom.)
- Clear the deal queue, using ClearDeals.
GIFs
It would make life much easier to use fonts rather than gifs for the
suit symbols. Unfortunately, although the necessary fonts can be read on most platforms,
they can't be read on all. Accordingly, the documents created by
BRDGHTM2.DLL expect gifs for the suit symbols. In addition, they expect a
gif representing the direction indicators in the middle of each deal. Those
five gifs (spade.gif, heart.gif,diamond.gif, club.gif, and board.gif) are
distibuted with BRDGHTM2.DLL.
The dimensions of the gifs are coded into the HTML documents created by
BRDGHTM2.DLL, so if you use gifs other than the ones supplied with the DLL,
you may have to do some editing of the HTML documents it creates.
While the DLL anticipates that users may want to use terms other than the
English ones ('N','E','S','W'), board.gif does use those letters. Several
non-English alternatives to board.gif are distributed with Duper. Any one of those
alternative gifs may be used with the html code generated by BRDGHTM2 by the
simple expedient of renaming it 'board.gif'.
If none of the supplied board
gifs reflect the language you want to use, you can create your own. The gif
you create should be 50 pixels by 50 pixels, the
dimensions anticipated by the HTML documents created by the DLL. (Creating
such a gif is a pretty simple operation. If you have trouble, let me know
and I'll be happy to create one for your language myself.)
Routines and parameters
Important note:
All parameters passed to the routines must be passed using the Windows
stdcall calling convention. Please consult your compiler documentation on
this calling convention.
BRDGHTML2 exports five routines. They are AddDeal, ClearDeals,
HTMLCustom, HTMLDef, and AbortAd. Each is described below.
AddDeal
- Function : Adds a deal to the queue.
- Syntax: AddDeal(Deal)
- Parameter:
- Deal is a pointer to a null-terminated string. The string must
be in PBN format (http://home.iae.nl/users/veugent/pbn.html),
except that all PBN 'tags' passed to AddDeal must be passed as a single
concatenated string. The Deal parameter must include the PBN Deal Tag.
The PBN Board, Vulnerable, and Dealer Tags may optionally be
concatenated with the Deal Tag. All tags must comply strictly with PBN
standards, including, for example, the use of brackets.
ClearDeals
- Function: Clears the queue of all deals added by calls to AddDeal.
ClearDeals must be called explicitly after the desired HTML documents
have been created.
Otherwise, the already added deals will be written to the next HTML document,
along with any newly added deals, when the next call to HTMLCustom or HTMLDef
is made.
- Syntax: ClearDeals
- Parameters
HTMLCustom
- Function: HTMLCustom gives the programmer extensive control over the
HTML document to be created. If your HTML documents will be in English,
particularly American English, you can probably ignore this routine and
use HTMLDef, which requires fewer parameters, instead.
- Syntax: HTMLCustom (FName, GIFDirectory, Header1, Header2,
ASymbol, KSymbol, QSymbol, JSymbol, TSymbol,
NoneTerm, BothTerm, DealerTerm, DealTerm,
VulTerm,
NorthTerm, EastTerm, SouthTerm, WestTerm,
AutoNumberDeals, AutoDealerAndVul)
- Parameters
- FName is a pointer to a null-terminated string for the filename
of the HTML document that will be created. BRDGHTM2.DLL does no checking
for the validity of the name, so validity should be tested by the calling
program before the call.
- GIFDirectory is a pointer to a null-terminated string giving the
directory location of the gifs on the web site. If the gifs will be in the
same directory as the html file itself, just pass a null string to
GIFDirectory. Internally, BRDGHTM2 appends a '/' character to the end of
any string (other than a null string) that does not have one, unless the
string ends in a backslash ('\').
- Header1 and Header2 are pointers to null-terminated
strings that will appear as headers on the HTML document. Pass null strings
if no headers are desired. In addition to showing these as headers,
BRDGHTM2.DLL concatenates them to make a <TITLE> tag within the
HTML <HEAD> tag.
- ASymbol, KSymbol, QSymbol, JSymbol, and TSymbol are pointers
to null-terminated strings
representing how the symbols for the five honor cards are to be
displayed.
- Note that regardless of the symbols passed in HonorSymbols, the
Deal Tag passed to AddDeal must use the English symbols required by PBN
standards.
- NoneTerm and BothTerm are pointers to null-terminated
strings representing the terms to be used in describing vulnerability.
A null string passed to NoneTerm will result in 'None' being used. A
null string passed to BothTerm will result in 'Both' being used. (When
the vulnerability is North-South or East-West, vulnerability
designations will be based on NorthTerm, etc.)
- Note that regardless of the strings passed to NoneTerm and BothTerm,
the terms used in any tags passed to AddDeal must be the English terms
required by PBN standards.
- DealerTerm is a pointer to a null-terminated string
representing the term to be used to identify the Dealer. A null string
passed to DealerTerm will result in 'Dlr'.
- Note that regardless of the string passed to DealerTerm, the term
used in any tags passed to AddDeal must be the English term required by
PBN standards.
- DealTerm is a pointer to a null-terminated string
representing the term to be used to identify each deal. A null string
passed to DealTerm will result in 'Board'.
- Note that regardless of the string passed to DealTerm, the term used
in any tags passed to AddDeal must be the English term required by PBN
standards.
- VulTerm is a pointer to a null-terminated string representing
the term to be used to represent the term for vulnerability. A null
string passed to VulTerm will result in 'Vul'.
- Note that regardless of the string passed to VulTerm, the term used
in any tags passed to AddDeal must be the English term required by PBN
standards.
- NorthTerm, EastTerm, SouthTerm, and WestTerm are
pointers to null-terminated strings indicating the
compass positions. The code generated by BRDGHTM2 will look best if abbreviations
(e.g., 'N','E','S','W'), rather
than full terms, are passed to NorthTerm, etc. (String support is provided
for any displayed language in which one-character abbreviations might be
ambiguous.)
- As noted above, these parameters will not affect the
notations at the center diagram, because that is a gif. They are
used only for designating the dealer and the vulnerability.
- Note that regardless of the strings passed to NorthTerm, etc.,
the characters used in any tags passed to AddDeal must be the English
characters required by PBN standards.
- AutoNumberDeals is an 8-bit value indicating
whether the deals should be numbered automatically (beginning with 1).
1 = yes; 0 = no. If
autonumbering is used, any Board Tags that have been passed in the
parameter to AddDeal will be ignored. If autonumbering is not used and
no Board Tags are passed via AddDeal, then the deals will not be
numbered.
- AutoDealerAndVul is an 8-bit value indicating
whether the dealer and vulnerability should be given according to the
normal scheme for duplicate board numbering. 1 = yes;
0 = no. If this is set to yes, any Dealer Tags and
Vulnerable Tags that have been passed in the parameter to AddDeal will
be ignored. If this is set to no and no Dealer and Vulnerable Tags are
passed via AddDeal, then there will be no indication of dealer and
vulnerability.
HTMLDef
- Function: Creates HTML page with all deals in the queue,
using many default values.
- Syntax: HTMLDef (FName, GIFDirectory, Header1, Header2,
TenChar, AutoNumberDeals, AutoDealerAndVul)
- Parameters
- TenChar is an 8-bit char character indicating
the symbol to be used to represent tens. Pass '1' to have tens
represented by '10'.
- Note that regardless of what character is passed to TenChar, the
character used in the Deal Tags passed to AddDeal must be 'T', the
character required by PBN standards.
- All other parameters: See the identically named parameters under
HTMLCustom.
- Note: Internally, HTMLDef calls HTMLCustom with the
following parameters:
- FName: FName
- GIFDirectory: GIFDirectory
- Header1: Header1
- Header2: Header2
- ASymbol: 'A'
- KSymbol: 'K'
- QSymbol: 'Q'
- JSymbol: 'J'
- TSymbol: TenChar, unless TenChar='1', in which case TSymbol will = '10'
- NoneTerm: 'None'
- BothTerm: 'Both'
- DealerTerm: 'Dlr'
- DealTerm: 'Board'
- VulTerm: 'Vul'
- NorthTerm: 'N'
- EastTerm: 'E'
- SouthTerm: 'S'
- WestTerm: 'W'
- AutoNumberDeals: AutoNumberDeals
- AutoDealerAndVul: AutoDealerAndVul
AbortAd
- Function: suppresses the advertisement that appears when BRDGHTM2.DLL
is loaded. It must be called immediately after loading.
- Syntax: The AbortAd parameters are supplied upon registration.
Registering BRDGHTM2.DLL
To register BRDGTHML.DLL, snail mail the following information and US $25 to:
David Howorth
1420 South 10th Street
Oxford, Mississippi 38655
or send $25 via PayPal to howorthd@bellsouth.net.
In either case, please supply the following information:
- Name
- Address
- Email Address
The information necessary to suppress the BRDGHTM2 self-advertisement
will be supplied by email.