]> git.saurik.com Git - wxWidgets.git/blob - src/stc/gen_iface.py
Committing in .
[wxWidgets.git] / src / stc / gen_iface.py
1 #!/bin/env python
2 #----------------------------------------------------------------------------
3 # Name: gen_iface.py
4 # Purpose: Generate stc.h and stc.cpp from the info in Scintilla.iface
5 #
6 # Author: Robin Dunn
7 #
8 # Created: 5-Sept-2000
9 # RCS-ID: $Id$
10 # Copyright: (c) 2000 by Total Control Software
11 # Licence: wxWindows license
12 #----------------------------------------------------------------------------
13
14
15 import sys, string, re, os
16 from fileinput import FileInput
17
18
19 IFACE = os.path.abspath('./scintilla/include/Scintilla.iface')
20 H_TEMPLATE = os.path.abspath('./stc.h.in')
21 CPP_TEMPLATE = os.path.abspath('./stc.cpp.in')
22 H_DEST = os.path.abspath('../../include/wx/stc/stc.h')
23 CPP_DEST = os.path.abspath('./stc.cpp')
24
25
26 # Value prefixes to convert
27 valPrefixes = [('SCI_', ''),
28 ('SC_', ''),
29 ('SCN_', None), # just toss these out...
30 ('SCEN_', None),
31 ('SCE_', ''),
32 ('SCLEX_', 'LEX_'),
33 ('SCK_', 'KEY_'),
34 ('SCFIND_', 'FIND_'),
35 ('SCWS_', 'WS_'),
36 ]
37
38 # Message function values that should have a CMD_ constant as well
39 cmdValues = [ (2300, 2350), 2011, 2013, (2176, 2180) ]
40
41
42 # Map some generic typenames to wx types, using return value syntax
43 retTypeMap = {
44 'position': 'int',
45 'string': 'wxString',
46 'colour': 'wxColour',
47 }
48
49 # Map some generic typenames to wx types, using parameter syntax
50 paramTypeMap = {
51 'position': 'int',
52 'string': 'const wxString&',
53 'colour': 'const wxColour&',
54 'keymod': 'int',
55 }
56
57 # Map of method info that needs tweaked. Either the name needs changed, or
58 # the method definition/implementation. Tuple items are:
59 #
60 # 1. New method name. None to skip the method, 0 to leave the
61 # default name.
62 # 2. Method definition for the .h file, 0 to leave alone
63 # 3. Method implementation for the .cpp file, 0 to leave alone.
64 # 4. tuple of Doc string lines, or 0 to leave alone.
65 #
66 methodOverrideMap = {
67 'AddText' : (0,
68 'void %s(const wxString& text);',
69
70 '''void %s(const wxString& text) {
71 SendMsg(%s, text.Len(), (long)text.c_str());''',
72 0),
73
74 'AddStyledText' : (0,
75 'void %s(const wxString& text);',
76
77 '''void %s(const wxString& text) {
78 SendMsg(%s, text.Len(), (long)text.c_str());''',
79 0),
80
81 'GetViewWS' : ( 'GetViewWhiteSpace', 0, 0, 0),
82 'SetViewWS' : ( 'SetViewWhiteSpace', 0, 0, 0),
83
84 'GetStyledText' : (0,
85 'wxString %s(int startPos, int endPos);',
86
87 '''wxString %s(int startPos, int endPos) {
88 wxString text;
89 int len = endPos - startPos;
90 if (!len) return "";
91 TextRange tr;
92 tr.lpstrText = text.GetWriteBuf(len*2);
93 tr.chrg.cpMin = startPos;
94 tr.chrg.cpMax = endPos;
95 SendMsg(%s, 0, (long)&tr);
96 text.UngetWriteBuf(len*2);
97 return text;''',
98
99 ('Retrieve a buffer of cells.',)),
100
101
102 'PositionFromPoint' : (0,
103 'int %s(wxPoint pt);',
104
105 '''int %s(wxPoint pt) {
106 return SendMsg(%s, pt.x, pt.y);''',
107
108 0),
109
110 'GetCurLine' : (0,
111 'wxString %s(int* OUTPUT=NULL);',
112
113 '''wxString %s(int* linePos) {
114 wxString text;
115 int len = LineLength(GetCurrentLine());
116 if (!len) return "";
117 char* buf = text.GetWriteBuf(len);
118
119 int pos = SendMsg(%s, len, (long)buf);
120 text.UngetWriteBuf(len);
121 if (linePos) *linePos = pos;
122
123 return text;''',
124
125 0),
126
127 'SetUsePalette' : (None, 0,0,0),
128
129 'MarkerSetFore' : ('MarkerSetForeground', 0, 0, 0),
130 'MarkerSetBack' : ('MarkerSetBackground', 0, 0, 0),
131
132 'MarkerDefine' : (0,
133 '''void %s(int markerNumber, int markerSymbol,
134 const wxColour& foreground = wxNullColour,
135 const wxColour& background = wxNullColour);''',
136
137 '''void %s(int markerNumber, int markerSymbol,
138 const wxColour& foreground,
139 const wxColour& background) {
140
141 SendMsg(%s, markerNumber, markerSymbol);
142 if (foreground.Ok())
143 MarkerSetForeground(markerNumber, foreground);
144 if (background.Ok())
145 MarkerSetBackground(markerNumber, background);''',
146
147 ('Set the symbol used for a particular marker number,',
148 'and optionally the for and background colours.')),
149
150 'SetMarginTypeN' : ('SetMarginType', 0, 0, 0),
151 'GetMarginTypeN' : ('GetMarginType', 0, 0, 0),
152 'SetMarginWidthN' : ('SetMarginWidth', 0, 0, 0),
153 'GetMarginWidthN' : ('GetMarginWidth', 0, 0, 0),
154 'SetMarginMaskN' : ('SetMarginMask', 0, 0, 0),
155 'GetMarginMaskN' : ('GetMarginMask', 0, 0, 0),
156 'SetMarginSensitiveN' : ('SetMarginSensitive', 0, 0, 0),
157 'GetMarginSensitiveN' : ('GetMarginSensitive', 0, 0, 0),
158
159 'StyleSetFore' : ('StyleSetForeground', 0, 0, 0),
160 'StyleSetBack' : ('StyleSetBackground', 0, 0, 0),
161 'SetSelFore' : ('SetSelForeground', 0, 0, 0),
162 'SetSelBack' : ('SetSelBackground', 0, 0, 0),
163 'SetCaretFore' : ('SetCaretForeground', 0, 0, 0),
164 'StyleSetFont' : ('StyleSetFaceName', 0, 0, 0),
165
166 # need to fix this to map between wx and scintilla encoding flags, leave it out for now...
167 'StyleSetCharacterSet' : (None, 0, 0, 0),
168
169 'AssignCmdKey' : ('CmdKeyAssign',
170 'void %s(int key, int modifiers, int cmd);',
171
172 '''void %s(int key, int modifiers, int cmd) {
173 SendMsg(%s, MAKELONG(key, modifiers), cmd);''',
174
175 0),
176
177 'ClearCmdKey' : ('CmdKeyClear',
178 'void %s(int key, int modifiers);',
179
180 '''void %s(int key, int modifiers) {
181 SendMsg(%s, MAKELONG(key, modifiers));''',
182
183 0),
184
185 'ClearAllCmdKeys' : ('CmdKeyClearAll', 0, 0, 0),
186
187
188 'SetStylingEx' : ('SetStyleBytes',
189 'void %s(int length, char* styleBytes);',
190
191 '''void %s(int length, char* styleBytes) {
192 SendMsg(%s, length, (long)styleBytes);''',
193
194 0),
195
196
197 'IndicSetStyle' : ('IndicatorSetStyle', 0, 0, 0),
198 'IndicGetStyle' : ('IndicatorGetStyle', 0, 0, 0),
199 'IndicSetFore' : ('IndicatorSetForeground', 0, 0, 0),
200 'IndicGetFore' : ('IndicatorGetForeground', 0, 0, 0),
201
202 'AutoCShow' : ('AutoCompShow', 0, 0, 0),
203 'AutoCCancel' : ('AutoCompCancel', 0, 0, 0),
204 'AutoCActive' : ('AutoCompActive', 0, 0, 0),
205 'AutoCPosStart' : ('AutoCompPosStart', 0, 0, 0),
206 'AutoCComplete' : ('AutoCompComplete', 0, 0, 0),
207 'AutoCStops' : ('AutoCompStops', 0, 0, 0),
208 'AutoCSetSeparator' : ('AutoCompSetSeparator', 0, 0, 0),
209 'AutoCGetSeparator' : ('AutoCompGetSeparator', 0, 0, 0),
210 'AutoCSelect' : ('AutoCompSelect', 0, 0, 0),
211 'AutoCSetCancelAtStart' : ('AutoCompSetCancelAtStart', 0, 0, 0),
212 'AutoCGetCancelAtStart' : ('AutoCompGetCancelAtStart', 0, 0, 0),
213 'AutoCSetFillUps' : ('AutoCompSetFillUps', 0, 0, 0),
214 'AutoCSetChooseSingle' : ('AutoCompSetChooseSingle', 0, 0, 0),
215 'AutoCGetChooseSingle' : ('AutoCompGetChooseSingle', 0, 0, 0),
216 'AutoCSetIgnoreCase' : ('AutoCompSetIgnoreCase', 0, 0, 0),
217 'AutoCGetIgnoreCase' : ('AutoCompGetIgnoreCase', 0, 0, 0),
218 'AutoCSetAutoHide' : ('AutoCompSetAutoHide', 0, 0, 0),
219 'AutoCGetAutoHide' : ('AutoCompGetAutoHide', 0, 0, 0),
220
221
222 'SetHScrollBar' : ('SetUseHorizontalScrollBar', 0, 0, 0),
223 'GetHScrollBar' : ('GetUseHorizontalScrollBar', 0, 0, 0),
224
225 'GetCaretFore' : ('GetCaretForeground', 0, 0, 0),
226
227 'GetUsePalette' : (None, 0, 0, 0),
228
229 'FindText' : (0,
230 '''int %s(int minPos, int maxPos,
231 const wxString& text,
232 bool caseSensitive, bool wholeWord);''',
233 '''int %s(int minPos, int maxPos,
234 const wxString& text,
235 bool caseSensitive, bool wholeWord) {
236 TextToFind ft;
237 int flags = 0;
238
239 flags |= caseSensitive ? SCFIND_MATCHCASE : 0;
240 flags |= wholeWord ? SCFIND_WHOLEWORD : 0;
241 ft.chrg.cpMin = minPos;
242 ft.chrg.cpMax = maxPos;
243 ft.lpstrText = (char*)text.c_str();
244
245 return SendMsg(%s, flags, (long)&ft);''',
246 0),
247
248 'FormatRange' : (0,
249 '''int %s(bool doDraw,
250 int startPos,
251 int endPos,
252 wxDC* draw,
253 wxDC* target, // Why does it use two? Can they be the same?
254 wxRect renderRect,
255 wxRect pageRect);''',
256 ''' int %s(bool doDraw,
257 int startPos,
258 int endPos,
259 wxDC* draw,
260 wxDC* target, // Why does it use two? Can they be the same?
261 wxRect renderRect,
262 wxRect pageRect) {
263 RangeToFormat fr;
264
265 fr.hdc = draw;
266 fr.hdcTarget = target;
267 fr.rc.top = renderRect.GetTop();
268 fr.rc.left = renderRect.GetLeft();
269 fr.rc.right = renderRect.GetRight();
270 fr.rc.bottom = renderRect.GetBottom();
271 fr.rcPage.top = pageRect.GetTop();
272 fr.rcPage.left = pageRect.GetLeft();
273 fr.rcPage.right = pageRect.GetRight();
274 fr.rcPage.bottom = pageRect.GetBottom();
275 fr.chrg.cpMin = startPos;
276 fr.chrg.cpMax = endPos;
277
278 return SendMsg(%s, doDraw, (long)&fr);''',
279 0),
280
281
282 'GetLine' : (0,
283 'wxString %s(int line);',
284
285 '''wxString %s(int line) {
286 wxString text;
287 int len = LineLength(line);
288 if (!len) return "";
289 char* buf = text.GetWriteBuf(len);
290
291 int pos = SendMsg(%s, line, (long)buf);
292 text.UngetWriteBuf(len);
293
294 return text;''',
295
296 ('Retrieve the contents of a line.',)),
297
298 'SetSel' : ('SetSelection', 0, 0, 0),
299 'GetSelText' : ('GetSelectedText',
300 'wxString %s();',
301
302 '''wxString %s() {
303 wxString text;
304 int start;
305 int end;
306
307 GetSelection(&start, &end);
308 int len = end - start;
309 if (!len) return "";
310 char* buff = text.GetWriteBuf(len);
311
312 SendMsg(%s, 0, (long)buff);
313 text.UngetWriteBuf(len);
314 return text;''',
315
316 ('Retrieve the selected text.',)),
317
318 'GetTextRange' : (0,
319 'wxString %s(int startPos, int endPos);',
320
321 '''wxString %s(int startPos, int endPos) {
322 wxString text;
323 int len = endPos - startPos;
324 if (!len) return "";
325 char* buff = text.GetWriteBuf(len);
326 TextRange tr;
327 tr.lpstrText = buff;
328 tr.chrg.cpMin = startPos;
329 tr.chrg.cpMax = endPos;
330
331 SendMsg(%s, 0, (long)&tr);
332 text.UngetWriteBuf(len);
333 return text;''',
334
335 ('Retrieve a range of text.',)),
336
337 'PointXFromPosition' : (None, 0, 0, 0),
338 'PointYFromPosition' : (None, 0, 0, 0),
339
340 'ScrollCaret' : ('EnsureCaretVisible', 0, 0, 0),
341 'ReplaceSel' : ('ReplaceSelection', 0, 0, 0),
342 'Null' : (None, 0, 0, 0),
343
344 'GetText' : (0,
345 'wxString %s();',
346
347 '''wxString %s() {
348 wxString text;
349 int len = GetTextLength()+1;
350 char* buff = text.GetWriteBuf(len);
351
352 SendMsg(%s, len, (long)buff);
353 text.UngetWriteBuf(len-1);
354 return text;''',
355
356 ('Retrieve all the text in the document.', )),
357
358 'GetDirectFunction' : (None, 0, 0, 0),
359 'GetDirectPointer' : (None, 0, 0, 0),
360
361 'CallTipPosStart' : ('CallTipPosAtStart', 0, 0, 0),
362 'CallTipSetHlt' : ('CallTipSetHighlight', 0, 0, 0),
363 'CallTipSetBack' : ('CallTipSetBackground', 0, 0, 0),
364
365
366 'ReplaceTarget' : (0,
367 'int %s(const wxString& text);',
368
369 '''
370 int %s(const wxString& text) {
371 return SendMsg(%s, text.Len(), (long)text.c_str());
372 ''',
373
374 0),
375
376 'ReplaceTargetRE' : (0,
377 'int %s(const wxString& text);',
378
379 '''
380 int %s(const wxString& text) {
381 return SendMsg(%s, text.Len(), (long)text.c_str());
382 ''',
383
384 0),
385
386 'SearchInTarget' : (0,
387 'int %s(const wxString& text);',
388
389 '''
390 int %s(const wxString& text) {
391 return SendMsg(%s, text.Len(), (long)text.c_str());
392 ''',
393
394 0),
395
396
397
398 # Remove all methods that are key commands since they can be
399 # executed with CmdKeyExecute
400 'LineDown' : (None, 0, 0, 0),
401 'LineDownExtend' : (None, 0, 0, 0),
402 'LineUp' : (None, 0, 0, 0),
403 'LineUpExtend' : (None, 0, 0, 0),
404 'CharLeft' : (None, 0, 0, 0),
405 'CharLeftExtend' : (None, 0, 0, 0),
406 'CharRight' : (None, 0, 0, 0),
407 'CharRightExtend' : (None, 0, 0, 0),
408 'WordLeft' : (None, 0, 0, 0),
409 'WordLeftExtend' : (None, 0, 0, 0),
410 'WordRight' : (None, 0, 0, 0),
411 'WordRightExtend' : (None, 0, 0, 0),
412 'Home' : (None, 0, 0, 0),
413 'HomeExtend' : (None, 0, 0, 0),
414 'LineEnd' : (None, 0, 0, 0),
415 'LineEndExtend' : (None, 0, 0, 0),
416 'DocumentStart' : (None, 0, 0, 0),
417 'DocumentStartExtend' : (None, 0, 0, 0),
418 'DocumentEnd' : (None, 0, 0, 0),
419 'DocumentEndExtend' : (None, 0, 0, 0),
420 'PageUp' : (None, 0, 0, 0),
421 'PageUpExtend' : (None, 0, 0, 0),
422 'PageDown' : (None, 0, 0, 0),
423 'PageDownExtend' : (None, 0, 0, 0),
424 'EditToggleOvertype' : (None, 0, 0, 0),
425 'Cancel' : (None, 0, 0, 0),
426 'DeleteBack' : (None, 0, 0, 0),
427 'Tab' : (None, 0, 0, 0),
428 'BackTab' : (None, 0, 0, 0),
429 'NewLine' : (None, 0, 0, 0),
430 'FormFeed' : (None, 0, 0, 0),
431 'VCHome' : (None, 0, 0, 0),
432 'VCHomeExtend' : (None, 0, 0, 0),
433 'ZoomIn' : (None, 0, 0, 0),
434 'ZoomOut' : (None, 0, 0, 0),
435 'DelWordLeft' : (None, 0, 0, 0),
436 'DelWordRight' : (None, 0, 0, 0),
437 'LineCut' : (None, 0, 0, 0),
438 'LineDelete' : (None, 0, 0, 0),
439 'LineTranspose' : (None, 0, 0, 0),
440 'LowerCase' : (None, 0, 0, 0),
441 'UpperCase' : (None, 0, 0, 0),
442 'LineScrollDown' : (None, 0, 0, 0),
443 'LineScrollUp' : (None, 0, 0, 0),
444
445
446 'GetDocPointer' : (0,
447 'void* %s();',
448 '''void* %s() {
449 return (void*)SendMsg(%s);''',
450 0),
451
452 'SetDocPointer' : (0,
453 'void %s(void* docPointer);',
454 '''void %s(void* docPointer) {
455 SendMsg(%s, 0, (long)docPointer);''',
456 0),
457
458 'CreateDocument' : (0,
459 'void* %s();',
460 '''void* %s() {
461 return (void*)SendMsg(%s);''',
462 0),
463
464 'AddRefDocument' : (0,
465 'void %s(void* docPointer);',
466 '''void %s(void* docPointer) {
467 SendMsg(%s, (long)docPointer);''',
468 0),
469
470 'ReleaseDocument' : (0,
471 'void %s(void* docPointer);',
472 '''void %s(void* docPointer) {
473 SendMsg(%s, (long)docPointer);''',
474 0),
475
476 'GrabFocus' : (None, 0, 0, 0),
477
478 '' : ('', 0, 0, 0),
479
480 }
481
482 #----------------------------------------------------------------------------
483
484 def processIface(iface, h_tmplt, cpp_tmplt, h_dest, cpp_dest):
485 curDocStrings = []
486 values = []
487 methods = []
488
489 # parse iface file
490 fi = FileInput(iface)
491 for line in fi:
492 line = line[:-1]
493 if line[:2] == '##' or line == '':
494 #curDocStrings = []
495 continue
496
497 op = line[:4]
498 if line[:2] == '# ': # a doc string
499 curDocStrings.append(line[2:])
500
501 elif op == 'val ':
502 parseVal(line[4:], values, curDocStrings)
503 curDocStrings = []
504
505 elif op == 'fun ' or op == 'set ' or op == 'get ':
506 parseFun(line[4:], methods, curDocStrings, values)
507 curDocStrings = []
508
509 elif op == 'cat ':
510 if string.strip(line[4:]) == 'Deprecated':
511 break # skip the rest of the file
512
513 elif op == 'evt ':
514 pass
515
516 else:
517 print '***** Unknown line type: ', line
518
519
520 # process templates
521 data = {}
522 data['VALUES'] = processVals(values)
523 defs, imps = processMethods(methods)
524 data['METHOD_DEFS'] = defs
525 data['METHOD_IMPS'] = imps
526
527 # get template text
528 h_text = open(h_tmplt).read()
529 cpp_text = open(cpp_tmplt).read()
530
531 # do the substitutions
532 h_text = h_text % data
533 cpp_text = cpp_text % data
534
535 # write out destination files
536 open(h_dest, 'w').write(h_text)
537 open(cpp_dest, 'w').write(cpp_text)
538
539
540
541 #----------------------------------------------------------------------------
542
543 def processVals(values):
544 text = []
545 for name, value, docs in values:
546 if docs:
547 text.append('')
548 for x in docs:
549 text.append('// ' + x)
550 text.append('#define %s %s' % (name, value))
551 return string.join(text, '\n')
552
553 #----------------------------------------------------------------------------
554
555 def processMethods(methods):
556 defs = []
557 imps = []
558
559 for retType, name, number, param1, param2, docs in methods:
560 retType = retTypeMap.get(retType, retType)
561 params = makeParamString(param1, param2)
562
563 name, theDef, theImp, docs = checkMethodOverride(name, number, docs)
564
565 if name is None:
566 continue
567
568 # Build the method definition for the .h file
569 if docs:
570 defs.append('')
571 for x in docs:
572 defs.append(' // ' + x)
573 if not theDef:
574 theDef = ' %s %s(%s);' % (retType, name, params)
575 defs.append(theDef)
576
577 # Build the method implementation string
578 if docs:
579 imps.append('')
580 for x in docs:
581 imps.append('// ' + x)
582 if not theImp:
583 theImp = '%s wxStyledTextCtrl::%s(%s) {\n ' % (retType, name, params)
584
585 if retType == 'wxColour':
586 theImp = theImp + 'long c = '
587 elif retType != 'void':
588 theImp = theImp + 'return '
589 theImp = theImp + 'SendMsg(%s, %s, %s)' % (number,
590 makeArgString(param1),
591 makeArgString(param2))
592 if retType == 'bool':
593 theImp = theImp + ' != 0'
594 if retType == 'wxColour':
595 theImp = theImp + ';\n return wxColourFromLong(c)'
596
597 theImp = theImp + ';\n}'
598 imps.append(theImp)
599
600
601 return string.join(defs, '\n'), string.join(imps, '\n')
602
603
604 #----------------------------------------------------------------------------
605
606 def checkMethodOverride(name, number, docs):
607 theDef = theImp = None
608 if methodOverrideMap.has_key(name):
609 item = methodOverrideMap[name]
610
611 if item[0] != 0:
612 name = item[0]
613 if item[1] != 0:
614 theDef = ' ' + (item[1] % name)
615 if item[2] != 0:
616 theImp = item[2] % ('wxStyledTextCtrl::'+name, number) + '\n}'
617 if item[3] != 0:
618 docs = item[3]
619
620 return name, theDef, theImp, docs
621
622 #----------------------------------------------------------------------------
623
624 def makeArgString(param):
625 if not param:
626 return '0'
627
628 typ, name = param
629
630 if typ == 'string':
631 return '(long)%s.c_str()' % name
632 if typ == 'colour':
633 return 'wxColourAsLong(%s)' % name
634
635 return name
636
637 #----------------------------------------------------------------------------
638
639 def makeParamString(param1, param2):
640 def doOne(param):
641 if param:
642 aType = paramTypeMap.get(param[0], param[0])
643 return aType + ' ' + param[1]
644 else:
645 return ''
646
647 st = doOne(param1)
648 if st and param2:
649 st = st + ', '
650 st = st + doOne(param2)
651 return st
652
653
654 #----------------------------------------------------------------------------
655
656 def parseVal(line, values, docs):
657 name, val = string.split(line, '=')
658
659 # remove prefixes such as SCI, etc.
660 for old, new in valPrefixes:
661 lo = len(old)
662 if name[:lo] == old:
663 if new is None:
664 return
665 name = new + name[lo:]
666
667 # add it to the list
668 values.append( ('wxSTC_' + name, val, docs) )
669
670 #----------------------------------------------------------------------------
671
672 funregex = re.compile(r'\s*([a-zA-Z0-9_]+)' # <ws>return type
673 '\s+([a-zA-Z0-9_]+)=' # <ws>name=
674 '([0-9]+)' # number
675 '\(([ a-zA-Z0-9_]*),' # (param,
676 '([ a-zA-Z0-9_]*)\)') # param)
677
678 def parseFun(line, methods, docs, values):
679 def parseParam(param):
680 param = string.strip(param)
681 if param == '':
682 param = None
683 else:
684 param = tuple(string.split(param))
685 return param
686
687 mo = funregex.match(line)
688 if mo is None:
689 print "***** Line doesn't match! : " + line
690
691 retType, name, number, param1, param2 = mo.groups()
692
693 param1 = parseParam(param1)
694 param2 = parseParam(param2)
695
696 # Special case. For the key command functionss we want a value defined too
697 num = string.atoi(number)
698 for v in cmdValues:
699 if (type(v) == type(()) and v[0] <= num < v[1]) or v == num:
700 parseVal('CMD_%s=%s' % (string.upper(name), number), values, ())
701
702 #if retType == 'void' and not param1 and not param2:
703
704 methods.append( (retType, name, number, param1, param2, tuple(docs)) )
705
706
707 #----------------------------------------------------------------------------
708
709
710 def main(args):
711 # TODO: parse command line args to replace default input/output files???
712
713 # Now just do it
714 processIface(IFACE, H_TEMPLATE, CPP_TEMPLATE, H_DEST, CPP_DEST)
715
716
717
718 if __name__ == '__main__':
719 main(sys.argv)
720
721 #----------------------------------------------------------------------------
722