ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/kgsueme/doc/doc2constants_pm.xsl
Revision: 1.5
Committed: Fri Oct 28 14:59:36 2005 UTC (18 years, 7 months ago) by root
Content type: application/xml
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +7 -7 lines
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 root 1.5 # 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 pcg 1.1
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    
31 root 1.5 <![CDATA[
32 pcg 1.3 %ruleset %timesys %gametype %special_score %room_group
33 root 1.5
34 pcg 1.1 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 pcg 1.3 &GAMETYPE_EDITING => "editing",
57 pcg 1.1 &GAMETYPE_TEACHING => "teaching",
58 root 1.4 &GAMETYPE_SIMUL => "simul",
59 pcg 1.1 &GAMETYPE_FREE => "free",
60     &GAMETYPE_RATED => "rated",
61     );
62    
63     # special score values.
64     # positive == black won, negative == white one
65    
66     # use the abs value
67     %special_score = (
68     &SCORE_TIMEOUT => "time",
69     &SCORE_RESIGN => "resign",
70     &SCORE_FORFEIT => "forfeit",
71    
72     &SCORE_JIGO => "jigo",
73    
74     &SCORE_NO_RESULT => "NR",
75     &SCORE_ADJOURNED => "(adj)",
76     &SCORE_UNKNOWN => "(unknown)",
77     );
78    
79     # rule set
80    
81     %ruleset = (
82     &RULESET_JAPANESE => "japanese",
83     &RULESET_CHINESE => "chinese",
84     &RULESET_AGA => "AGA",
85     &RULESET_NEW_ZEALAND => "new zealand",
86     );
87    
88     # time system
89    
90     %timesys = (
91     &TIMESYS_NONE => "none",
92     &TIMESYS_ABSOLUTE => "absolute",
93     &TIMESYS_BYO_YOMI => "byo-yomi",
94     &TIMESYS_CANADIAN => "canadian",
95     );
96    
97     # stone/player etc. colours
98    
99     %room_group = (
100     0 => "Main",
101     1 => "New Rooms",
102     2 => "Clubs",
103     3 => "Lessons",
104     4 => "Tournaments",
105     5 => "Social",
106 pcg 1.2 6 => "National",
107 pcg 1.1 );
108    
109     # misplaced here...
110     sub findfile {
111     my @files = @_;
112     file:
113     for (@files) {
114     for my $prefix (@INC) {
115     if (-f "$prefix/$_") {
116     $_ = "$prefix/$_";
117     next file;
118     }
119     }
120     die "$_: file not found in \@INC\n";
121     }
122     wantarray ? @files : $files[0];
123     }
124    
125     1;
126     ]]>
127     </xsl:template>
128    
129     </xsl:stylesheet>
130