Quick update to the README file. For intros and books we now point to
[python/dscho.git] / Mac / Modules / scrap / scrapscan.py
blob1a03b18ad82d46347522c642f29675b1a3b86244
1 # Scan an Apple header file, generating a Python file of generator calls.
3 # Note that the scrap-manager include file is so weird that this
4 # generates a boilerplate to be edited by hand.
6 import sys
7 import os
8 BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen')
9 sys.path.append(BGENDIR)
10 from scantools import Scanner
11 from bgenlocations import TOOLBOXDIR
13 LONG = "Scrap"
14 SHORT = "scrap"
16 def main():
17 input = "Scrap.h"
18 output = SHORT + "gen.py"
19 defsoutput = "@Scrap.py"
20 scanner = MyScanner(input, output, defsoutput)
21 scanner.scan()
22 scanner.close()
23 print "=== Done scanning and generating, now importing the generated code... ==="
24 exec "import " + SHORT + "support"
25 print "=== Done. It's up to you to compile it now! ==="
27 class MyScanner(Scanner):
29 def destination(self, type, name, arglist):
30 classname = "Function"
31 listname = "functions"
32 return classname, listname
34 def makeblacklistnames(self):
35 return [
38 def makeblacklisttypes(self):
39 return [
42 def makerepairinstructions(self):
43 return [
44 ([('void', '*', 'OutMode')], [('putscrapbuffer', '*', 'InMode')]),
47 if __name__ == "__main__":
48 main()