1 # Scan <Drag.h>, generating draggen.py.
4 from bgenlocations
import TOOLBOXDIR
, BGENDIR
, INCLUDEDIR
5 sys
.path
.append(BGENDIR
)
7 from scantools
import Scanner
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)
22 input = INCLUDEDIR
+ "Drag.h"
24 defsoutput
= TOOLBOXDIR
+ "Dragconst.py"
25 scanner
= MyScanner(input, output
, defsoutput
)
28 print "=== Testing definitions output code ==="
29 execfile(defsoutput
, {}, {})
30 print "=== Done scanning and generating, now doing '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"
41 if t
in ('DragReference', 'DragRef') and m
== "InMode":
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
):
58 def makeblacklisttypes(self
):
60 "DragTrackingHandlerUPP",
61 "DragReceiveHandlerUPP",
67 def makerepairinstructions(self
):
69 ([("void_ptr", "*", "InMode"), ("Size", "*", "InMode")],
70 [("OptionalInBuffer", "*", "*")]),
72 ([("void", "*", "OutMode"), ("Size", "*", "OutMode")],
73 [("VarOutBuffer", "*", "InOutMode")]),
77 if __name__
== "__main__":