More installation info. Bump alpha version.
[python/dscho.git] / Mac / Modules / drag / dragscan.py
blob158cfffeb078efa6ad3c7066d791f475b22d03de
1 # Scan <Drag.h>, generating draggen.py.
2 import sys
3 import os
4 from bgenlocations import TOOLBOXDIR, BGENDIR, INCLUDEDIR
5 sys.path.append(BGENDIR)
7 from scantools import Scanner
9 MISSING_DEFINES="""
10 kDragHasLeftSenderWindow = (1 << 0)
11 kDragInsideSenderApplication = (1 << 1)
12 kDragInsideSenderWindow = (1 << 2)
13 kDragRegionAndImage = (1 << 4)
14 flavorSenderOnly = (1 << 0)
15 flavorSenderTranslated = (1 << 1)
16 flavorNotSaved = (1 << 2)
17 flavorSystemTranslated = (1 << 8)
18 """
21 def main():
22 input = INCLUDEDIR + "Drag.h"
23 output = "draggen.py"
24 defsoutput = TOOLBOXDIR + "Dragconst.py"
25 scanner = MyScanner(input, output, defsoutput)
26 scanner.scan()
27 scanner.close()
28 print "=== Testing definitions output code ==="
29 execfile(defsoutput, {}, {})
30 print "=== Done scanning and generating, now doing 'import dragsupport' ==="
31 import dragsupport
32 print "=== Done. It's up to you to compile Dragmodule.c ==="
34 class MyScanner(Scanner):
36 def destination(self, type, name, arglist):
37 classname = "Function"
38 listname = "functions"
39 if arglist:
40 t, n, m = arglist[0]
41 if t in ('DragReference', 'DragRef') and m == "InMode":
42 classname = "Method"
43 listname = "methods"
44 return classname, listname
46 def writeinitialdefs(self):
47 self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
48 self.defsfile.write("from Carbon.TextEdit import *\n")
49 self.defsfile.write("from Carbon.QuickDraw import *\n")
50 self.defsfile.write("\n")
51 # Defines unparseable in Drag.h
52 self.defsfile.write(MISSING_DEFINES)
54 def makeblacklistnames(self):
55 return [
58 def makeblacklisttypes(self):
59 return [
60 "DragTrackingHandlerUPP",
61 "DragReceiveHandlerUPP",
62 "DragSendDataUPP",
63 "DragInputUPP",
64 "DragDrawingUPP",
67 def makerepairinstructions(self):
68 return [
69 ([("void_ptr", "*", "InMode"), ("Size", "*", "InMode")],
70 [("OptionalInBuffer", "*", "*")]),
72 ([("void", "*", "OutMode"), ("Size", "*", "OutMode")],
73 [("VarOutBuffer", "*", "InOutMode")]),
77 if __name__ == "__main__":
78 main()