first cut at the whole quickdraw.h header file ...

This commit is contained in:
Guido van Rossum 1995-03-19 22:49:50 +00:00
parent 86c3af7d12
commit e56db434a9
5 changed files with 3573 additions and 28 deletions

View File

@ -0,0 +1,77 @@
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:QuickDraw.h'
invalColReq = -1
srcCopy = 0
srcOr = 1
srcXor = 2
srcBic = 3
notSrcCopy = 4
notSrcOr = 5
notSrcXor = 6
notSrcBic = 7
patCopy = 8
patOr = 9
patXor = 10
patBic = 11
notPatCopy = 12
notPatOr = 13
notPatXor = 14
notPatBic = 15
grayishTextOr = 49
blend = 32
addPin = 33
addOver = 34
subPin = 35
addMax = 37
adMax = 37
subOver = 38
adMin = 39
ditherCopy = 64
transparent = 36
normalBit = 0
inverseBit = 1
redBit = 4
greenBit = 3
blueBit = 2
cyanBit = 8
magentaBit = 7
yellowBit = 6
blackBit = 5
blackColor = 33
whiteColor = 30
redColor = 205
greenColor = 341
blueColor = 409
cyanColor = 273
magentaColor = 137
yellowColor = 69
picLParen = 0
picRParen = 1
normal = 0
bold = 1
italic = 2
underline = 4
outline = 8
shadow = 0x10
condense = 0x20
extend = 0x40
clutType = 0
fixedType = 1
directType = 2
gdDevType = 0
burstDevice = 7
ext32Device = 8
ramInit = 10
mainScreen = 11
allInit = 12
screenDevice = 13
noDriver = 14
screenActive = 15
hiliteBit = 7
pHiliteBit = 0
defQDColors = 127
RGBDirect = 16
baseAddr32 = 4
rgnOverflowErr = -147
insufficientStackErr = -149
allDevices = 1 << allDevicesBit

File diff suppressed because it is too large Load Diff

789
Mac/Modules/qd/qdgen.py Normal file
View File

@ -0,0 +1,789 @@
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:QuickDraw.h'
f = Function(void, 'OpenPort',
(GrafPtr, 'port', InMode),
)
functions.append(f)
f = Function(void, 'InitPort',
(GrafPtr, 'port', InMode),
)
functions.append(f)
f = Function(void, 'ClosePort',
(GrafPtr, 'port', InMode),
)
functions.append(f)
f = Function(void, 'SetPort',
(GrafPtr, 'port', InMode),
)
functions.append(f)
f = Function(void, 'GetPort',
(GrafPtr, 'port', OutMode),
)
functions.append(f)
f = Function(void, 'GrafDevice',
(short, 'device', InMode),
)
functions.append(f)
f = Function(void, 'PortSize',
(short, 'width', InMode),
(short, 'height', InMode),
)
functions.append(f)
f = Function(void, 'MovePortTo',
(short, 'leftGlobal', InMode),
(short, 'topGlobal', InMode),
)
functions.append(f)
f = Function(void, 'SetOrigin',
(short, 'h', InMode),
(short, 'v', InMode),
)
functions.append(f)
f = Function(void, 'SetClip',
(RgnHandle, 'rgn', InMode),
)
functions.append(f)
f = Function(void, 'GetClip',
(RgnHandle, 'rgn', InMode),
)
functions.append(f)
f = Function(void, 'ClipRect',
(Rect_ptr, 'r', InMode),
)
functions.append(f)
f = Function(void, 'InitCursor',
)
functions.append(f)
f = Function(void, 'HideCursor',
)
functions.append(f)
f = Function(void, 'ShowCursor',
)
functions.append(f)
f = Function(void, 'ObscureCursor',
)
functions.append(f)
f = Function(void, 'HidePen',
)
functions.append(f)
f = Function(void, 'ShowPen',
)
functions.append(f)
f = Function(void, 'GetPen',
(Point, 'pt', InOutMode),
)
functions.append(f)
f = Function(void, 'PenSize',
(short, 'width', InMode),
(short, 'height', InMode),
)
functions.append(f)
f = Function(void, 'PenMode',
(short, 'mode', InMode),
)
functions.append(f)
f = Function(void, 'PenNormal',
)
functions.append(f)
f = Function(void, 'MoveTo',
(short, 'h', InMode),
(short, 'v', InMode),
)
functions.append(f)
f = Function(void, 'Move',
(short, 'dh', InMode),
(short, 'dv', InMode),
)
functions.append(f)
f = Function(void, 'LineTo',
(short, 'h', InMode),
(short, 'v', InMode),
)
functions.append(f)
f = Function(void, 'Line',
(short, 'dh', InMode),
(short, 'dv', InMode),
)
functions.append(f)
f = Function(void, 'TextFont',
(short, 'font', InMode),
)
functions.append(f)
f = Function(void, 'TextFace',
(short, 'face', InMode),
)
functions.append(f)
f = Function(void, 'TextMode',
(short, 'mode', InMode),
)
functions.append(f)
f = Function(void, 'TextSize',
(short, 'size', InMode),
)
functions.append(f)
f = Function(void, 'SpaceExtra',
(Fixed, 'extra', InMode),
)
functions.append(f)
f = Function(void, 'DrawChar',
(short, 'ch', InMode),
)
functions.append(f)
f = Function(void, 'DrawString',
(ConstStr255Param, 's', InMode),
)
functions.append(f)
f = Function(void, 'DrawText',
(TextThingie, 'textBuf', InMode),
(short, 'firstByte', InMode),
(short, 'byteCount', InMode),
)
functions.append(f)
f = Function(short, 'CharWidth',
(short, 'ch', InMode),
)
functions.append(f)
f = Function(short, 'StringWidth',
(ConstStr255Param, 's', InMode),
)
functions.append(f)
f = Function(short, 'TextWidth',
(TextThingie, 'textBuf', InMode),
(short, 'firstByte', InMode),
(short, 'byteCount', InMode),
)
functions.append(f)
f = Function(void, 'ForeColor',
(long, 'color', InMode),
)
functions.append(f)
f = Function(void, 'BackColor',
(long, 'color', InMode),
)
functions.append(f)
f = Function(void, 'ColorBit',
(short, 'whichBit', InMode),
)
functions.append(f)
f = Function(void, 'SetRect',
(Rect, 'r', OutMode),
(short, 'left', InMode),
(short, 'top', InMode),
(short, 'right', InMode),
(short, 'bottom', InMode),
)
functions.append(f)
f = Function(void, 'OffsetRect',
(Rect, 'r', OutMode),
(short, 'dh', InMode),
(short, 'dv', InMode),
)
functions.append(f)
f = Function(void, 'InsetRect',
(Rect, 'r', OutMode),
(short, 'dh', InMode),
(short, 'dv', InMode),
)
functions.append(f)
f = Function(Boolean, 'SectRect',
(Rect_ptr, 'src1', InMode),
(Rect_ptr, 'src2', InMode),
(Rect, 'dstRect', OutMode),
)
functions.append(f)
f = Function(void, 'UnionRect',
(Rect_ptr, 'src1', InMode),
(Rect_ptr, 'src2', InMode),
(Rect, 'dstRect', OutMode),
)
functions.append(f)
f = Function(Boolean, 'EqualRect',
(Rect_ptr, 'rect1', InMode),
(Rect_ptr, 'rect2', InMode),
)
functions.append(f)
f = Function(Boolean, 'EmptyRect',
(Rect_ptr, 'r', InMode),
)
functions.append(f)
f = Function(void, 'FrameRect',
(Rect_ptr, 'r', InMode),
)
functions.append(f)
f = Function(void, 'PaintRect',
(Rect_ptr, 'r', InMode),
)
functions.append(f)
f = Function(void, 'EraseRect',
(Rect_ptr, 'r', InMode),
)
functions.append(f)
f = Function(void, 'InvertRect',
(Rect_ptr, 'r', InMode),
)
functions.append(f)
f = Function(void, 'FrameOval',
(Rect_ptr, 'r', InMode),
)
functions.append(f)
f = Function(void, 'PaintOval',
(Rect_ptr, 'r', InMode),
)
functions.append(f)
f = Function(void, 'EraseOval',
(Rect_ptr, 'r', InMode),
)
functions.append(f)
f = Function(void, 'InvertOval',
(Rect_ptr, 'r', InMode),
)
functions.append(f)
f = Function(void, 'FrameRoundRect',
(Rect_ptr, 'r', InMode),
(short, 'ovalWidth', InMode),
(short, 'ovalHeight', InMode),
)
functions.append(f)
f = Function(void, 'PaintRoundRect',
(Rect_ptr, 'r', InMode),
(short, 'ovalWidth', InMode),
(short, 'ovalHeight', InMode),
)
functions.append(f)
f = Function(void, 'EraseRoundRect',
(Rect_ptr, 'r', InMode),
(short, 'ovalWidth', InMode),
(short, 'ovalHeight', InMode),
)
functions.append(f)
f = Function(void, 'InvertRoundRect',
(Rect_ptr, 'r', InMode),
(short, 'ovalWidth', InMode),
(short, 'ovalHeight', InMode),
)
functions.append(f)
f = Function(void, 'FrameArc',
(Rect_ptr, 'r', InMode),
(short, 'startAngle', InMode),
(short, 'arcAngle', InMode),
)
functions.append(f)
f = Function(void, 'PaintArc',
(Rect_ptr, 'r', InMode),
(short, 'startAngle', InMode),
(short, 'arcAngle', InMode),
)
functions.append(f)
f = Function(void, 'EraseArc',
(Rect_ptr, 'r', InMode),
(short, 'startAngle', InMode),
(short, 'arcAngle', InMode),
)
functions.append(f)
f = Function(void, 'InvertArc',
(Rect_ptr, 'r', InMode),
(short, 'startAngle', InMode),
(short, 'arcAngle', InMode),
)
functions.append(f)
f = Function(RgnHandle, 'NewRgn',
)
functions.append(f)
f = Function(void, 'OpenRgn',
)
functions.append(f)
f = Function(void, 'CloseRgn',
(RgnHandle, 'dstRgn', InMode),
)
functions.append(f)
f = Function(void, 'DisposeRgn',
(RgnHandle, 'rgn', InMode),
)
functions.append(f)
f = Function(void, 'CopyRgn',
(RgnHandle, 'srcRgn', InMode),
(RgnHandle, 'dstRgn', InMode),
)
functions.append(f)
f = Function(void, 'SetEmptyRgn',
(RgnHandle, 'rgn', InMode),
)
functions.append(f)
f = Function(void, 'SetRectRgn',
(RgnHandle, 'rgn', InMode),
(short, 'left', InMode),
(short, 'top', InMode),
(short, 'right', InMode),
(short, 'bottom', InMode),
)
functions.append(f)
f = Function(void, 'RectRgn',
(RgnHandle, 'rgn', InMode),
(Rect_ptr, 'r', InMode),
)
functions.append(f)
f = Function(void, 'OffsetRgn',
(RgnHandle, 'rgn', InMode),
(short, 'dh', InMode),
(short, 'dv', InMode),
)
functions.append(f)
f = Function(void, 'InsetRgn',
(RgnHandle, 'rgn', InMode),
(short, 'dh', InMode),
(short, 'dv', InMode),
)
functions.append(f)
f = Function(void, 'SectRgn',
(RgnHandle, 'srcRgnA', InMode),
(RgnHandle, 'srcRgnB', InMode),
(RgnHandle, 'dstRgn', InMode),
)
functions.append(f)
f = Function(void, 'UnionRgn',
(RgnHandle, 'srcRgnA', InMode),
(RgnHandle, 'srcRgnB', InMode),
(RgnHandle, 'dstRgn', InMode),
)
functions.append(f)
f = Function(void, 'DiffRgn',
(RgnHandle, 'srcRgnA', InMode),
(RgnHandle, 'srcRgnB', InMode),
(RgnHandle, 'dstRgn', InMode),
)
functions.append(f)
f = Function(void, 'XorRgn',
(RgnHandle, 'srcRgnA', InMode),
(RgnHandle, 'srcRgnB', InMode),
(RgnHandle, 'dstRgn', InMode),
)
functions.append(f)
f = Function(Boolean, 'RectInRgn',
(Rect_ptr, 'r', InMode),
(RgnHandle, 'rgn', InMode),
)
functions.append(f)
f = Function(Boolean, 'EqualRgn',
(RgnHandle, 'rgnA', InMode),
(RgnHandle, 'rgnB', InMode),
)
functions.append(f)
f = Function(Boolean, 'EmptyRgn',
(RgnHandle, 'rgn', InMode),
)
functions.append(f)
f = Function(void, 'FrameRgn',
(RgnHandle, 'rgn', InMode),
)
functions.append(f)
f = Function(void, 'PaintRgn',
(RgnHandle, 'rgn', InMode),
)
functions.append(f)
f = Function(void, 'EraseRgn',
(RgnHandle, 'rgn', InMode),
)
functions.append(f)
f = Function(void, 'InvertRgn',
(RgnHandle, 'rgn', InMode),
)
functions.append(f)
f = Function(void, 'ScrollRect',
(Rect_ptr, 'r', InMode),
(short, 'dh', InMode),
(short, 'dv', InMode),
(RgnHandle, 'updateRgn', InMode),
)
functions.append(f)
f = Function(PicHandle, 'OpenPicture',
(Rect_ptr, 'picFrame', InMode),
)
functions.append(f)
f = Function(void, 'PicComment',
(short, 'kind', InMode),
(short, 'dataSize', InMode),
(Handle, 'dataHandle', InMode),
)
functions.append(f)
f = Function(void, 'ClosePicture',
)
functions.append(f)
f = Function(void, 'DrawPicture',
(PicHandle, 'myPicture', InMode),
(Rect_ptr, 'dstRect', InMode),
)
functions.append(f)
f = Function(void, 'KillPicture',
(PicHandle, 'myPicture', InMode),
)
functions.append(f)
f = Function(PolyHandle, 'OpenPoly',
)
functions.append(f)
f = Function(void, 'ClosePoly',
)
functions.append(f)
f = Function(void, 'KillPoly',
(PolyHandle, 'poly', InMode),
)
functions.append(f)
f = Function(void, 'OffsetPoly',
(PolyHandle, 'poly', InMode),
(short, 'dh', InMode),
(short, 'dv', InMode),
)
functions.append(f)
f = Function(void, 'FramePoly',
(PolyHandle, 'poly', InMode),
)
functions.append(f)
f = Function(void, 'PaintPoly',
(PolyHandle, 'poly', InMode),
)
functions.append(f)
f = Function(void, 'ErasePoly',
(PolyHandle, 'poly', InMode),
)
functions.append(f)
f = Function(void, 'InvertPoly',
(PolyHandle, 'poly', InMode),
)
functions.append(f)
f = Function(void, 'SetPt',
(Point, 'pt', InOutMode),
(short, 'h', InMode),
(short, 'v', InMode),
)
functions.append(f)
f = Function(void, 'LocalToGlobal',
(Point, 'pt', InOutMode),
)
functions.append(f)
f = Function(void, 'GlobalToLocal',
(Point, 'pt', InOutMode),
)
functions.append(f)
f = Function(short, 'Random',
)
functions.append(f)
f = Function(Boolean, 'GetPixel',
(short, 'h', InMode),
(short, 'v', InMode),
)
functions.append(f)
f = Function(void, 'ScalePt',
(Point, 'pt', InOutMode),
(Rect_ptr, 'srcRect', InMode),
(Rect_ptr, 'dstRect', InMode),
)
functions.append(f)
f = Function(void, 'MapPt',
(Point, 'pt', InOutMode),
(Rect_ptr, 'srcRect', InMode),
(Rect_ptr, 'dstRect', InMode),
)
functions.append(f)
f = Function(void, 'MapRect',
(Rect, 'r', OutMode),
(Rect_ptr, 'srcRect', InMode),
(Rect_ptr, 'dstRect', InMode),
)
functions.append(f)
f = Function(void, 'MapRgn',
(RgnHandle, 'rgn', InMode),
(Rect_ptr, 'srcRect', InMode),
(Rect_ptr, 'dstRect', InMode),
)
functions.append(f)
f = Function(void, 'MapPoly',
(PolyHandle, 'poly', InMode),
(Rect_ptr, 'srcRect', InMode),
(Rect_ptr, 'dstRect', InMode),
)
functions.append(f)
f = Function(void, 'AddPt',
(Point, 'src', InMode),
(Point, 'dst', InOutMode),
)
functions.append(f)
f = Function(Boolean, 'EqualPt',
(Point, 'pt1', InMode),
(Point, 'pt2', InMode),
)
functions.append(f)
f = Function(Boolean, 'PtInRect',
(Point, 'pt', InMode),
(Rect_ptr, 'r', InMode),
)
functions.append(f)
f = Function(void, 'Pt2Rect',
(Point, 'pt1', InMode),
(Point, 'pt2', InMode),
(Rect, 'dstRect', OutMode),
)
functions.append(f)
f = Function(void, 'PtToAngle',
(Rect_ptr, 'r', InMode),
(Point, 'pt', InMode),
(short, 'angle', OutMode),
)
functions.append(f)
f = Function(Boolean, 'PtInRgn',
(Point, 'pt', InMode),
(RgnHandle, 'rgn', InMode),
)
functions.append(f)
f = Function(PixMapHandle, 'NewPixMap',
)
functions.append(f)
f = Function(void, 'DisposPixMap',
(PixMapHandle, 'pm', InMode),
)
functions.append(f)
f = Function(void, 'DisposePixMap',
(PixMapHandle, 'pm', InMode),
)
functions.append(f)
f = Function(void, 'CopyPixMap',
(PixMapHandle, 'srcPM', InMode),
(PixMapHandle, 'dstPM', InMode),
)
functions.append(f)
f = Function(PixPatHandle, 'NewPixPat',
)
functions.append(f)
f = Function(void, 'DisposPixPat',
(PixPatHandle, 'pp', InMode),
)
functions.append(f)
f = Function(void, 'DisposePixPat',
(PixPatHandle, 'pp', InMode),
)
functions.append(f)
f = Function(void, 'CopyPixPat',
(PixPatHandle, 'srcPP', InMode),
(PixPatHandle, 'dstPP', InMode),
)
functions.append(f)
f = Function(void, 'PenPixPat',
(PixPatHandle, 'pp', InMode),
)
functions.append(f)
f = Function(void, 'BackPixPat',
(PixPatHandle, 'pp', InMode),
)
functions.append(f)
f = Function(PixPatHandle, 'GetPixPat',
(short, 'patID', InMode),
)
functions.append(f)
f = Function(void, 'FillCRect',
(Rect_ptr, 'r', InMode),
(PixPatHandle, 'pp', InMode),
)
functions.append(f)
f = Function(void, 'FillCOval',
(Rect_ptr, 'r', InMode),
(PixPatHandle, 'pp', InMode),
)
functions.append(f)
f = Function(void, 'FillCRoundRect',
(Rect_ptr, 'r', InMode),
(short, 'ovalWidth', InMode),
(short, 'ovalHeight', InMode),
(PixPatHandle, 'pp', InMode),
)
functions.append(f)
f = Function(void, 'FillCArc',
(Rect_ptr, 'r', InMode),
(short, 'startAngle', InMode),
(short, 'arcAngle', InMode),
(PixPatHandle, 'pp', InMode),
)
functions.append(f)
f = Function(void, 'FillCRgn',
(RgnHandle, 'rgn', InMode),
(PixPatHandle, 'pp', InMode),
)
functions.append(f)
f = Function(void, 'FillCPoly',
(PolyHandle, 'poly', InMode),
(PixPatHandle, 'pp', InMode),
)
functions.append(f)
f = Function(void, 'SetPortPix',
(PixMapHandle, 'pm', InMode),
)
functions.append(f)
f = Function(void, 'AllocCursor',
)
functions.append(f)
f = Function(void, 'CharExtra',
(Fixed, 'extra', InMode),
)
functions.append(f)
f = Function(long, 'GetCTSeed',
)
functions.append(f)
f = Function(void, 'SubPt',
(Point, 'src', InMode),
(Point, 'dst', InOutMode),
)
functions.append(f)
f = Function(void, 'SetClientID',
(short, 'id', InMode),
)
functions.append(f)
f = Function(void, 'ProtectEntry',
(short, 'index', InMode),
(Boolean, 'protect', InMode),
)
functions.append(f)
f = Function(void, 'ReserveEntry',
(short, 'index', InMode),
(Boolean, 'reserve', InMode),
)
functions.append(f)
f = Function(short, 'QDError',
)
functions.append(f)

83
Mac/Modules/qd/qdscan.py Normal file
View File

@ -0,0 +1,83 @@
# Scan an Apple header file, generating a Python file of generator calls.
import addpack
addpack.addpack('D:python:Tools:bgen:bgen')
from scantools import Scanner
def main():
input = "QuickDraw.h"
output = "qdgen.py"
defsoutput = "QuickDraw.py"
scanner = MyScanner(input, output, defsoutput)
scanner.scan()
scanner.close()
print "=== Done scanning and generating, now importing the generated code... ==="
import qdsupport
print "=== Done. It's up to you to compile it now! ==="
class MyScanner(Scanner):
def destination(self, type, name, arglist):
classname = "Function"
listname = "functions"
if arglist:
t, n, m = arglist[0]
if t in ("WindowPtr", "WindowPeek") and m == "InMode":
classname = "Method"
listname = "methods"
return classname, listname
def makeblacklistnames(self):
return [
'InitGraf',
'StuffHex',
'StdLine',
'StdComment',
'StdGetPic',
'StdLine',
]
def makeblacklisttypes(self):
return [
'BitMap_ptr',
'CCrsrHandle',
'CGrafPtr',
'CIconHandle',
'CQDProcs',
'CSpecArray',
'CTabHandle',
'ColorComplementProcPtr',
'ColorSearchProcPtr',
'ConstPatternParam',
'Cursor_ptr',
'DeviceLoopDrawingProcPtr',
'DeviceLoopFlags',
'FontInfo',
'GDHandle',
'GrafVerb',
'OpenCPicParams_ptr',
'PenState',
'PenState_ptr',
'Ptr',
'QDProcs',
'RGBColor',
'RGBColor_ptr',
'ReqListRec',
'void_ptr',
]
def makerepairinstructions(self):
return [
([('void_ptr', 'textBuf', 'InMode'),
('short', 'firstByte', 'InMode'),
('short', 'byteCount', 'InMode')],
[('TextThingie', '*', '*'), ('*', '*', '*'), ('*', '*', '*')]),
([('Point', '*', 'OutMode')],
[('*', '*', 'InOutMode')]),
]
if __name__ == "__main__":
main()

View File

@ -5,6 +5,9 @@
import string
import addpack
addpack.addpack('D:python:Tools:bgen:bgen')
# Declarations that change for each manager
MACHEADERFILE = 'QuickDraw.h' # The Apple header file
MODNAME = 'Qd' # The name of the module
@ -22,6 +25,22 @@ from macsupport import *
# Create the type objects
GrafPtr = WindowPtr
class TextThingieClass(FixedInputBufferType):
def getargsCheck(self, name):
pass
TextThingie = TextThingieClass(None)
# These are temporary!
Fixed = long
RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
PicHandle = OpaqueByValueType("PicHandle", "ResObj")
PolyHandle = OpaqueByValueType("PolyHandle", "ResObj")
PixMapHandle = OpaqueByValueType("PixMapHandle", "ResObj")
PixPatHandle = OpaqueByValueType("PixPatHandle", "ResObj")
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
#include <Desk.h>
@ -58,8 +77,8 @@ Method = OSErrMethodGenerator
# Create and populate the lists
functions = []
methods = []
#execfile(INPUTFILE)
execfile(EXTRAFILE)
execfile(INPUTFILE)
#execfile(EXTRAFILE)
# add the populated lists to the generator groups
# (in a different wordl the scan program would generate this)