[go: up one dir, main page]

Menu

[a2d634]: / utils / prefs2cxx.xsl  Maximize  Restore  History

Download this file

133 lines (101 with data), 3.3 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?xml version="1.0" standalone="yes"?>
<stylesheet version="1.0"
xmlns="http://www.w3.org/1999/XSL/Transform"
xmlns:y="http://www.icewm.org/2002/prefs">
<output method="text" indent="no" encoding="iso-8559-1"/>
<param name="source"/>
<param name="target"/>
<template match="/">
<choose><when test="$source">-
// DON'T EDIT THIS FILE
// Generated by prefs2cxx.xsl from <value-of select="$source"/>
<choose><when test="$target='wmaction.h'">
#ifndef __WMACTION_H
#define __WMACTION_H
#include "config.h"
#include "yaction.h"
class WMAction {
public:
<apply-templates mode="declaration" select=".//y:action-list/*"/>-
static YAction::Id lookupAction(const char *name);
private:
struct Symbol {
Symbol(YAction::Name name, YAction::Id action):
name(name), action(action) {
}
YAction::Name name;
YAction::Id action;
};
typedef Symbol SymbolTable[];
static const SymbolTable symtab;
};
#endif
</when><when test="$target='wmaction.cc'">
#include "wmaction.h"
#include &lt;string.h&gt;
<apply-templates mode="implementation" select=".//y:action-list/*"/>-
const WMAction::SymbolTable WMAction::symtab = {
<apply-templates mode="symboltable" select=".//y:action-list/*"/>-
};
YAction::Id WMAction::lookupAction(const char *name) {
for (const Symbol *sym = symtab;
sym &lt; symtab + sizeof(symtab)/sizeof(*symtab); ++sym) {
if (!strcmp(name, sym->name)) return sym->action;
}
return 0;
}
</when><otherwise><message terminate="yes"><text>
You have to pass a valid value for the 'target' parameter.
Valid targets are: 'wmaction.h', 'wmaction.cc'
Contact icewm-devel@lists.sourceforge.net for questions.
</text></message></otherwise></choose>
</when><otherwise><message terminate="yes"><text>
You have to pass the name of the source file with the 'source' parameter.
Contact icewm-devel@lists.sourceforge.net for questions.
</text></message></otherwise></choose>
</template>
<!--
create preprocessor statements
-->
<template match="y:if" mode="declaration">-
#if <value-of select="@test"/><text>
</text><apply-templates select="y:*" mode="declaration"/>-
#endif
</template>
<template match="y:if" mode="implementation">-
#if <value-of select="@test"/><text>
</text><apply-templates select="y:*" mode="implementation"/>-
#endif
</template>
<template match="y:if" mode="symboltable">-
#if <value-of select="@test"/><text>
</text><apply-templates select="y:*" mode="symboltable"/>-
#endif
</template>
<!--
create actions
-->
<template match="y:action" mode="declaration">-
static YAction::Id <value-of select="@name"/>;
</template>
<template match="y:action" mode="implementation">-
YAction::Id WMAction::<value-of select="@name"/>(new YAction());
</template>
<template match="y:action" mode="symboltable">-
Symbol("<value-of select="@name"/>", <value-of select="@name"/>),
<apply-templates select="y:*" mode="symboltable"/>
</template>
<template match="y:alias" mode="symboltable">-
Symbol("<value-of select="@name"/>", <value-of select="../@name"/>),
</template>
<!--
planned as fallback template - but don't know how to pass the mode
-->
<!--
<template match="@*|node()" mode="declaration">
<apply-templates select=".">
<with-param name="mode">declaration</with-param>
</apply-templates>
</template>
-->
</stylesheet>