7 last if (m#BEGINING OF FUNCTION DEFINITION#);
13 last if (m#END OF FUNCTION DEFINITION#);
15 $line .= $_ unless (m{^\s*//});
22 // this file is automatically generated by makefunc
23 // see dependency information in mayu-common.mak
27 foreach $functionDefinition ( split(/;/, $line) ) {
28 # void funcPrefix(FunctionParam *i_param, const Keymap *i_keymap,
29 # bool i_doesIgnoreModifiers = true);
30 next unless ( $functionDefinition =~ m{^
32 \s+ func(\w+) # funcPrefix
34 \s* FunctionParam # FunctionParam
38 \s* (.*?) # const Keymap *i_keymap,
39 # bool i_doesIgnoreModifiers = true
45 class FunctionData_$name : public FunctionData
49 my(@args) = split(/\s*,\s*/, $2);
52 my @argIsReference = ();
55 my @argDefaultValues = ();
57 foreach $arg ( @args ) {
61 my $defaultValue = "";
62 # bool i_doesIgnoreModifiers = true
64 (.*\S) # bool i_doesIgnoreModifiers
71 # const Keymap *i_keymap
75 \s* i_(\w+) # i_keymap
101 push(@argIsReference, $isReference);
102 push(@argTypes, $type);
103 push(@argNames, $argName);
104 push(@argDefaultValues, $defaultValue);
108 for ($i = 0; $i < $argc; $i ++) {
110 $argTypes[$i] m_$argNames[$i];
116 static FunctionData *create()
118 FunctionData_$name *fd
119 = new FunctionData_$name;
121 for ($i = 0; $i < $argc; $i ++) {
122 if ($argDefaultValues[$i]) {
123 print " fd->m_$argNames[$i] = $argDefaultValues[$i];\n";
130 virtual void load(SettingLoader *i_sl)
133 if ($argc == 0 || $argDefaultValues[0]) {
135 if (!i_sl->getOpenParen(false, FunctionData_${name}::getName()))
140 i_sl->getOpenParen(true, FunctionData_${name}::getName()); // throw ...
143 for ($i = 0; $i < $argc; $i ++) {
144 if ($argDefaultValues[$i]) {
146 if (i_sl->getCloseParen(false, FunctionData_${name}::getName()))
152 i_sl->getComma(false, FunctionData_${name}::getName()); // throw ...
155 print " i_sl->load_ARGUMENT(&m_$argNames[$i]);\n";
158 i_sl->getCloseParen(true, FunctionData_${name}::getName()); // throw ...
161 virtual void exec(Engine *i_engine, FunctionParam *i_param) const
164 print " i_engine->func$name(i_param";
165 for ($i = 0; $i < $argc; $i ++) {
166 print ", m_$argNames[$i]";
173 inline virtual const _TCHAR *getName() const
178 virtual tostream &output(tostream &i_ost) const
180 i_ost << _T("&") << getName();
187 for ($i = 0; $i < $argc; $i ++) {
188 if ($i == $argc - 1) {
190 i_ost << m_$argNames[$i];
194 i_ost << m_$argNames[$i] << _T(", ");
207 virtual FunctionData *clone() const
209 return new FunctionData_${name}(*this);
217 #endif // FUNCTION_DATA
219 #ifdef FUNCTION_FRIEND
221 foreach $name ( @names ) {
223 friend class FunctionData_$name;
227 #endif // FUNCTION_FRIEND
229 #ifdef FUNCTION_CREATOR
230 FunctionCreator functionCreators[] = {
232 foreach $name ( @names ) {
234 { _T("$name"), FunctionData_${name}::create },
239 #endif // FUNCTION_CREATOR