source: trunk/essentials/dev-lang/python/Tools/modulator/genmodule.py@ 3951

Last change on this file since 3951 was 3225, checked in by bird, 19 years ago

Python 2.5

File size: 4.7 KB
Line 
1#
2# Genmodule - A python program to help you build (template) modules.
3#
4# Usage:
5#
6# o = genmodule.object()
7# o.name = 'dwarve object'
8# o.abbrev = 'dw'
9# o.funclist = ['new', 'dealloc', 'getattr', 'setattr']
10# o.methodlist = ['dig']
11#
12# m = genmodule.module()
13# m.name = 'beings'
14# m.abbrev = 'be'
15# m.methodlist = ['newdwarve']
16# m.objects = [o]
17#
18# genmodule.write(sys.stdout, m)
19#
20import sys
21import os
22import varsubst
23
24error = 'genmodule.error'
25
26#
27# Names of functions in the object-description struct.
28#
29FUNCLIST = ['new', 'tp_dealloc', 'tp_print', 'tp_getattr', 'tp_setattr',
30 'tp_compare', 'tp_repr', 'tp_hash', 'tp_call', 'tp_str']
31TYPELIST = ['tp_as_number', 'tp_as_sequence', 'tp_as_mapping', 'structure']
32
33#
34# writer is a base class for the object and module classes
35# it contains code common to both.