ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/kgsueme/doc/doc2constants_pm.xsl
Revision: 1.1
Committed: Sun Jan 18 20:12:36 2004 UTC (20 years, 4 months ago) by pcg
Content type: application/xml
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 pcg 1.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 %gameopt %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_TEACHING => "teaching",
57     &GAMETYPE_FREE => "free",
58     &GAMETYPE_RATED => "rated",
59     &GAMETYPE_TYPE4 => "<no idea, pls tell me>",
60     );
61    
62     # game option (/ 5)
63    
64     %gameopt = (
65     &GAMEOPT_NONE => "normal",
66     &GAMEOPT_LECTURE => "lecture",
67     &GAMEOPT_PRIVATE => "private",
68     &GAMEOPT_SIMUL => "simul",
69     );
70    
71     # special score values.
72     # positive == black won, negative == white one
73    
74     # use the abs value
75     %special_score = (
76     &SCORE_TIMEOUT => "time",
77     &SCORE_RESIGN => "resign",
78     &SCORE_FORFEIT => "forfeit",
79    
80     &SCORE_JIGO => "jigo",
81    
82     &SCORE_NO_RESULT => "NR",
83     &SCORE_ADJOURNED => "(adj)",
84     &SCORE_UNKNOWN => "(unknown)",
85     );
86    
87     # rule set
88    
89     %ruleset = (
90     &RULESET_JAPANESE => "japanese",
91     &RULESET_CHINESE => "chinese",
92     &RULESET_AGA => "AGA",
93     &RULESET_NEW_ZEALAND => "new zealand",
94     );
95    
96     # time system
97    
98     %timesys = (
99     &TIMESYS_NONE => "none",
100     &TIMESYS_ABSOLUTE => "absolute",
101     &TIMESYS_BYO_YOMI => "byo-yomi",
102     &TIMESYS_CANADIAN => "canadian",
103     );
104    
105     # stone/player etc. colours
106    
107     %room_group = (
108     0 => "Main",
109     1 => "New Rooms",
110     2 => "Clubs",
111     3 => "Lessons",
112     4 => "Tournaments",
113     5 => "Social",
114     6 => "Bational",
115     );
116    
117     # misplaced here...
118     sub findfile {
119     my @files = @_;
120     file:
121     for (@files) {
122     for my $prefix (@INC) {
123     if (-f "$prefix/$_") {
124     $_ = "$prefix/$_";
125     next file;
126     }
127     }
128     die "$_: file not found in \@INC\n";
129     }
130     wantarray ? @files : $files[0];
131     }
132    
133     1;
134     ]]>
135     </xsl:template>
136    
137     </xsl:stylesheet>
138