ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/kgsueme/doc/doc2constants_pm.xsl
Revision: 1.3
Committed: Tue May 25 18:36:34 2004 UTC (20 years ago) by pcg
Content type: application/xml
Branch: MAIN
Changes since 1.2: +2 -11 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 <!DOCTYPE xsl:stylesheet>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3
4 <xsl:output method="text" media-type="text/plain" encoding="utf-8"/>
5
6 <xsl:template match="/"><![CDATA[
7 # This is an automatically generated file.
8 # This is an automatically generated file.
9 # This is an automatically generated file.
10 # This is an automatically generated file.
11 # This is an automatically generated file.
12
13 # See doc/protocol.xml and doc/doc2constants_pm.xsl (and doc/Makefile)
14
15 package KGS::Constants;
16
17 use base Exporter;
18
19 BEGIN {
20 @EXPORT = qw(
21 ]]>
22 <xsl:for-each select="descendant::enum | descendant::set">
23 <xsl:variable name="prefix" select="@name"/>
24 <xsl:text>&#10; </xsl:text>
25 <xsl:for-each select="descendant::member">
26 <xsl:value-of select="concat($prefix, '_', @name)"/>
27 <xsl:text> </xsl:text>
28 </xsl:for-each>
29 </xsl:for-each>
30 <![CDATA[
31
32 %ruleset %timesys %gametype %special_score %room_group
33
34 INTERVAL_GAMEUPDATES
35 );
36 }
37
38 ]]>
39
40 <xsl:for-each select="descendant::enum | descendant::set">
41 <xsl:variable name="prefix" select="@name"/>
42 <xsl:for-each select="descendant::member">
43 <xsl:value-of select="concat('sub ', $prefix, '_', @name, ' () { ', @value, ' }')"/>
44 <xsl:text>&#10;</xsl:text>
45 </xsl:for-each>
46 </xsl:for-each>
47
48 <![CDATA[
49
50 sub INTERVAL_GAMEUPDATES () { 60 } # request game list updates this often (seconds).
51
52 # gametype (% 5)
53
54 %gametype = (
55 &GAMETYPE_DEMONSTRATION => "demonstration",
56 &GAMETYPE_EDITING => "editing",
57 &GAMETYPE_TEACHING => "teaching",
58 &GAMETYPE_FREE => "free",
59 &GAMETYPE_RATED => "rated",
60 );
61
62 # special score values.
63 # positive == black won, negative == white one
64
65 # use the abs value
66 %special_score = (
67 &SCORE_TIMEOUT => "time",
68 &SCORE_RESIGN => "resign",
69 &SCORE_FORFEIT => "forfeit",
70
71 &SCORE_JIGO => "jigo",
72
73 &SCORE_NO_RESULT => "NR",
74 &SCORE_ADJOURNED => "(adj)",
75 &SCORE_UNKNOWN => "(unknown)",
76 );
77
78 # rule set
79
80 %ruleset = (
81 &RULESET_JAPANESE => "japanese",
82 &RULESET_CHINESE => "chinese",
83 &RULESET_AGA => "AGA",
84 &RULESET_NEW_ZEALAND => "new zealand",
85 );
86
87 # time system
88
89 %timesys = (
90 &TIMESYS_NONE => "none",
91 &TIMESYS_ABSOLUTE => "absolute",
92 &TIMESYS_BYO_YOMI => "byo-yomi",
93 &TIMESYS_CANADIAN => "canadian",
94 );
95
96 # stone/player etc. colours
97
98 %room_group = (
99 0 => "Main",
100 1 => "New Rooms",
101 2 => "Clubs",
102 3 => "Lessons",
103 4 => "Tournaments",
104 5 => "Social",
105 6 => "National",
106 );
107
108 # misplaced here...
109 sub findfile {
110 my @files = @_;
111 file:
112 for (@files) {
113 for my $prefix (@INC) {
114 if (-f "$prefix/$_") {
115 $_ = "$prefix/$_";
116 next file;
117 }
118 }
119 die "$_: file not found in \@INC\n";
120 }
121 wantarray ? @files : $files[0];
122 }
123
124 1;
125 ]]>
126 </xsl:template>
127
128 </xsl:stylesheet>
129