1 # Scan <Drag.h>, generating draggen.py.
4 BGENDIR
=os
.path
.join(sys
.prefix
, ':Tools:bgen:bgen')
5 sys
.path
.append(BGENDIR
)
7 from scantools
import Scanner
8 from bgenlocations
import TOOLBOXDIR
, INCLUDEDIR
11 kDragHasLeftSenderWindow = (1 << 0)
12 kDragInsideSenderApplication = (1 << 1)
13 kDragInsideSenderWindow = (1 << 2)
14 kDragRegionAndImage = (1 << 4)
15 flavorSenderOnly = (1 << 0)
16 flavorSenderTranslated = (1 << 1)
17 flavorNotSaved = (1 << 2)
18 flavorSystemTranslated = (1 << 8)
23 input = INCLUDEDIR
+ "Drag.h"
25 defsoutput
= TOOLBOXDIR
+ "Dragconst.py"
26 scanner
= MyScanner(input, output
, 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
== 'DragReference' 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 TextEdit import *\n")
48 self
.defsfile
.write("from QuickDraw import *\n")
49 self
.defsfile
.write("\n")
50 # Defines unparseable in Drag.h
51 self
.defsfile
.write(MISSING_DEFINES
)
53 def makeblacklistnames(self
):
57 def makeblacklisttypes(self
):
59 "DragTrackingHandlerUPP",
60 "DragReceiveHandlerUPP",
66 def makerepairinstructions(self
):
68 ([("void_ptr", "*", "InMode"), ("Size", "*", "InMode")],
69 [("OptionalInBuffer", "*", "*")]),
71 ([("void", "*", "OutMode"), ("Size", "*", "OutMode")],
72 [("VarOutBuffer", "*", "InOutMode")]),
76 if __name__
== "__main__":