1 # Scan <Drag.h>, generating draggen.py.
3 from bgenlocations
import TOOLBOXDIR
, BGENDIR
, INCLUDEDIR
4 sys
.path
.append(BGENDIR
)
6 from scantools
import Scanner
9 kDragHasLeftSenderWindow = (1 << 0)
10 kDragInsideSenderApplication = (1 << 1)
11 kDragInsideSenderWindow = (1 << 2)
12 kDragRegionAndImage = (1 << 4)
13 flavorSenderOnly = (1 << 0)
14 flavorSenderTranslated = (1 << 1)
15 flavorNotSaved = (1 << 2)
16 flavorSystemTranslated = (1 << 8)
21 input = INCLUDEDIR
+ "Drag.h"
23 defsoutput
= TOOLBOXDIR
+ "Dragconst.py"
24 scanner
= MyScanner(input, output
, defsoutput
)
27 print "=== Testing definitions output code ==="
28 execfile(defsoutput
, {}, {})
29 print "=== Done scanning and generating, now doing 'import dragsupport' ==="
31 print "=== Done. It's up to you to compile Dragmodule.c ==="
33 class MyScanner(Scanner
):
35 def destination(self
, type, name
, arglist
):
36 classname
= "Function"
37 listname
= "functions"
40 if t
in ('DragReference', 'DragRef') and m
== "InMode":
43 return classname
, listname
45 def writeinitialdefs(self
):
46 self
.defsfile
.write("def FOUR_CHAR_CODE(x): return x\n")
47 self
.defsfile
.write("from Carbon.TextEdit import *\n")
48 self
.defsfile
.write("from Carbon.QuickDraw import *\n")
49 self
.defsfile
.write("fkDragActionAll = -1\n")
50 self
.defsfile
.write("\n")
51 # Defines unparseable in Drag.h
52 self
.defsfile
.write(MISSING_DEFINES
)
54 def makeblacklistnames(self
):
59 def makeblacklisttypes(self
):
61 "DragTrackingHandlerUPP",
62 "DragReceiveHandlerUPP",
68 def makerepairinstructions(self
):
70 ([("void_ptr", "*", "InMode"), ("Size", "*", "InMode")],
71 [("OptionalInBuffer", "*", "*")]),
73 ([("void", "*", "OutMode"), ("Size", "*", "OutMode")],
74 [("VarOutBuffer", "*", "InOutMode")]),
78 if __name__
== "__main__":