(py-indent-right, py-outdent-left): new commands, bound to C-c C-r and
[python/dscho.git] / Mac / Modules / ae / aescan.py
blob75003ecc5035cb3850b011547f5c48d27f333d2d
1 # Scan AppleEvents.h header file, generate aegen.py and AppleEvents.py files.
2 # Then run aesupport to generate AEmodule.c.
3 0# (Should learn how to tell the compiler to compile it as well.)
5 import sys
6 import os
7 import string
8 import regex
9 import regsub
10 import MacOS
12 from scantools import Scanner
14 def main():
15 input = "AppleEvents.h"
16 output = "aegen.py"
17 defsoutput = "AppleEvents.py"
18 scanner = AppleEventsScanner(input, output, defsoutput)
19 scanner.scan()
20 scanner.close()
21 print "=== Done Scanning and Generating, now doing 'import aesupport' ==="
22 import aesupport
23 print "=== Done 'import aesupport'. It's up to you to compile AEmodule.c ==="
25 class AppleEventsScanner(Scanner):
27 def destination(self, type, name, arglist):
28 classname = "AEFunction"
29 listname = "functions"
30 if arglist:
31 t, n, m = arglist[0]
32 if t[-4:] == "_ptr" and m == "InMode" and \
33 t[:-4] in ("AEDesc", "AEAddressDesc", "AEDescList",
34 "AERecord", "AppleEvent"):
35 classname = "AEMethod"
36 listname = "aedescmethods"
37 return classname, listname
39 def makeblacklistnames(self):
40 return [
41 "AEDisposeDesc",
42 "AEGetEventHandler",
45 def makeblacklisttypes(self):
46 return [
47 "ProcPtr",
48 "AEArrayType",
51 def makerepairinstructions(self):
52 return [
53 ([("Boolean", "isSysHandler", "InMode")],
54 [("AlwaysFalse", "*", "*")]),
56 ([("void_ptr", "*", "InMode"), ("Size", "*", "InMode")],
57 [("InBuffer", "*", "*")]),
59 ([("EventHandlerProcPtr", "*", "InMode"), ("long", "*", "InMode")],
60 [("EventHandler", "*", "*")]),
62 ([("EventHandlerProcPtr", "*", "OutMode"), ("long", "*", "OutMode")],
63 [("EventHandler", "*", "*")]),
65 ([("void", "*", "OutMode"), ("Size", "*", "InMode"),
66 ("Size", "*", "OutMode")],
67 [("VarVarOutBuffer", "*", "InOutMode")]),
70 if __name__ == "__main__":
71 main()