| 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 | #
|
|---|
| 20 | import sys
|
|---|
| 21 | import os
|
|---|
| 22 | import varsubst
|
|---|
| 23 |
|
|---|
| 24 | error = 'genmodule.error'
|
|---|
| 25 |
|
|---|
| 26 | #
|
|---|
| 27 | # Names of functions in the object-description struct.
|
|---|
| 28 | #
|
|---|
| 29 | FUNCLIST = ['new', 'tp_dealloc', 'tp_print', 'tp_getattr', 'tp_setattr',
|
|---|
| 30 | 'tp_compare', 'tp_repr', 'tp_hash', 'tp_call', 'tp_str']
|
|---|
| 31 | TYPELIST = ['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.
|
|---|
|
|---|