Using Jeff's HTML Bridge Macro Package dnl
divert(-1)
# These are macros for building bridge diagrams in HTML.
# They are somewhat patterened after a set I stole for
# LaTeX. I don't remember their origin. See README for
# use details.
# image files
define(`SIMG',s.gif) dnl
define(`HIMG',h.gif) dnl
define(`DIMG',d.gif) dnl
define(`CIMG',c.gif) dnl
define(`TIMG',table11.gif) dnl
# inline suit symbols during text
define(`SPADE',
) dnl
define(`HEART',
) dnl
define(`DIAMOND',
) dnl
define(`CLUB',
) dnl
define(`CARD',`ifelse($2,,SUITREPLACE($1),SUITREPLACE($1)SUITREPLACE($2))')
define(`SUITREPLACE',`ifelse($1,Dbl,Dbl,
$1,Pass,Pass,
$1,All Pass,All Pass,
$1,dbl,dbl,
$1,pass,pass,
$1,all pass,all pass,
$1,All pass,All pass,
substr($1,0,1),S,SPADE{substr($1,1)},
substr($1,0,1),H,HEART{substr($1,1)},
substr($1,0,1),D,DIAMOND{substr($1,1)},
substr($1,0,1),C,CLUB{substr($1,1)},
substr($1,0,1),s,SPADE{substr($1,1)},
substr($1,0,1),h,HEART{substr($1,1)},
substr($1,0,1),d,DIAMOND{substr($1,1)},
substr($1,0,1),c,CLUB{substr($1,1)},
substr($1,eval(len($1)-1),1),S,{substr($1,0,eval(len($1)-1))}SPADE,
substr($1,eval(len($1)-1),1),H,{substr($1,0,eval(len($1)-1))}HEART,
substr($1,eval(len($1)-1),1),D,{substr($1,0,eval(len($1)-1))}DIAMOND,
substr($1,eval(len($1)-1),1),C,{substr($1,0,eval(len($1)-1))}CLUB,
substr($1,eval(len($1)-1),1),s,{substr($1,0,eval(len($1)-1))}SPADE,
substr($1,eval(len($1)-1),1),h,{substr($1,0,eval(len($1)-1))}HEART,
substr($1,eval(len($1)-1),1),d,{substr($1,0,eval(len($1)-1))}DIAMOND,
substr($1,eval(len($1)-1),1),c,{substr($1,0,eval(len($1)-1))}CLUB,
$1)')
# suit symbols for diagrams
define(`VSPADE',
) dnl
define(`VHEART',
) dnl
define(`VDIAMOND',
) dnl
define(`VCLUB',
) dnl
# the table marker
define(`TMARKER',
) dnl
# horizontal hands
define(`HHAND',` 'SPADE$1 HEART$2 DIAMOND$3 CLUB$4) dnl
# vertical hands
define(`VHAND',VSPADE $1 `
'VHEART $2 `
'VDIAMOND $3 `
'VCLUB $4) dnl
# full hand diagrams
define(`HAND',
) dnl
# bidding: 2-player
define(`BIDHEAD',| `ifelse($1,,North,$1)' | `ifelse($2,,South,$2)' |
) dnl
define(`BIDNAMES',| `ifelse($1,,North,$1)' | `ifelse($2,,South,$2)' |
) dnl
define(`BIDROUND',`ifelse($1,,,| CARD($1) | CARD($2) |
)') dnl
define(`BIDEND',
) dnl
define(`BIDDING',`BIDHEAD($1,$2)'`BIDROUND(shift(shift($@)))'`BIDROUND(shift(shift(shift(shift($@)))))'`BIDROUND(shift(shift(shift(shift(shift(shift($@)))))))'`BIDROUND(shift(shift(shift(shift(shift(shift(shift(shift($@)))))))))'`BIDROUND(shift(shift(shift(shift(shift(shift(shift(shift(shift(shift($@)))))))))))'`BIDEND') dnl
# old version
define(`OBIDHEAD',| `ifelse($1,,North,$1)' | `ifelse($2,,South,$2)' |
) dnl
define(`OBIDNAMES',| `ifelse($1,,North,$1)' | `ifelse($2,,South,$2)' |
) dnl
define(`OBIDROUND',`ifelse($1,,,| $1 | $2 |
)') dnl
define(`OBIDEND',
) dnl
define(`OBIDDING',`OBIDHEAD($1,$2)'`OBIDROUND(shift(shift($@)))'`OBIDROUND(shift(shift(shift(shift($@)))))'`OBIDROUND(shift(shift(shift(shift(shift(shift($@)))))))'`OBIDROUND(shift(shift(shift(shift(shift(shift(shift(shift($@)))))))))'`OBIDROUND(shift(shift(shift(shift(shift(shift(shift(shift(shift(shift($@)))))))))))'`OBIDEND') dnl
# bidding: 4-player
define(`BID4HEAD',| `ifelse($1,,North,$1)' | `ifelse($2,,East,$2)' | `ifelse($3,,South,$3)' | `ifelse($4,,West,$4)' |
) dnl
define(`BID4NAMES',| `ifelse($1,,North,$1)' | `ifelse($2,,East,$2)' | `ifelse($3,,South,$3)' | `ifelse($4,,West,$4)' |
) dnl
define(`BID4ROUND',`ifelse(CARD($1),,,| CARD($1) | CARD($2) | CARD($3) | CARD($4) |
)') dnl
define(`BID4END',
) dnl
define(`BID4',`BID4HEAD($1,$2,$3,$4)'`BID4ROUND(shift(shift(shift(shift($@)))))'
`BID4ROUND(shift(shift(shift(shift(shift(shift(shift(shift($@)))))))))'
`BID4ROUND(shift(shift(shift(shift(shift(shift(shift(shift(shift(shift(shift(shift($@)))))))))))))'
`BID4END') dnl
# old version
define(`OBID4HEAD',| `ifelse($1,,North,$1)' | `ifelse($2,,East,$2)' | `ifelse($3,,South,$3)' | `ifelse($4,,West,$4)' |
) dnl
define(`OBID4NAMES',| `ifelse($1,,North,$1)' | `ifelse($2,,East,$2)' | `ifelse($3,,South,$3)' | `ifelse($4,,West,$4)' |
) dnl
define(`OBID4ROUND',`ifelse($1,,,| $1 | $2 | $3 | $4 |
)') dnl
define(`OBID4END',
) dnl
define(`OBID4',`OBID4HEAD($1,$2,$3,$4)'`OBID4ROUND(shift(shift(shift(shift($@)))))'
`OBID4ROUND(shift(shift(shift(shift(shift(shift(shift(shift($@)))))))))'
`OBID4ROUND(shift(shift(shift(shift(shift(shift(shift(shift(shift(shift(shift(shift($@)))))))))))))'
`OBID4END') dnl
# suit combination
define(`SUIT',
) dnl
# miscellany
define(`FOOTNOTE',$1)
define(`OLDPANELIST',$*)
define(`PANELIST',SMCAPS($*))
define(`SMCAPS',`UPCASE(substr($1,0,1))UPCASE(substr($1,1))')
define(`UPCASE',`translit($1,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ)')
define(`DOWNCASE',`translit($1,ABCDEFGHIJKLMNOPQRSTUVWXYZ,abcdefghijklmnopqrstuvwxyz)')
# try to avoid some collisions
undefine(`define')
undefine(`include')
undefine(`index')
changequote({,})
changecom
divert dnl