Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3a50f8a5
Commit
3a50f8a5
authored
Jan 11, 1996
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Added FontInfo support
- Added (read-)access to members of [C]GrafPort object
parent
bf220a16
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
178 additions
and
37 deletions
+178
-37
Mac/Lib/toolbox/QuickDraw.py
Mac/Lib/toolbox/QuickDraw.py
+2
-2
Mac/Modules/qd/Qdmodule.c
Mac/Modules/qd/Qdmodule.c
+91
-13
Mac/Modules/qd/qdgen.py
Mac/Modules/qd/qdgen.py
+7
-2
Mac/Modules/qd/qdscan.py
Mac/Modules/qd/qdscan.py
+1
-6
Mac/Modules/qd/qdsupport.py
Mac/Modules/qd/qdsupport.py
+77
-14
No files found.
Mac/Lib/toolbox/QuickDraw.py
View file @
3a50f8a5
# Generated from '
Sap:CodeWarrior7
:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDraw.h'
# Generated from '
flap:CodeWarrior
:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDraw.h'
invalColReq
=
-
1
invalColReq
=
-
1
srcCopy
=
0
srcCopy
=
0
...
@@ -90,7 +90,7 @@ kVerticalConstraint = 1
...
@@ -90,7 +90,7 @@ kVerticalConstraint = 1
kHorizontalConstraint
=
2
kHorizontalConstraint
=
2
kCursorImageMajorVersion
=
0x0001
kCursorImageMajorVersion
=
0x0001
kCursorImageMinorVersion
=
0x0000
kCursorImageMinorVersion
=
0x0000
# Generated from '
Sap:CodeWarrior7
:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDrawText.h'
# Generated from '
flap:CodeWarrior
:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDrawText.h'
leftCaret
=
0
leftCaret
=
0
rightCaret
=
-
1
rightCaret
=
-
1
...
...
Mac/Modules/qd/Qdmodule.c
View file @
3a50f8a5
...
@@ -74,6 +74,19 @@ QdRGB_Convert(v, p_itself)
...
@@ -74,6 +74,19 @@ QdRGB_Convert(v, p_itself)
return
1
;
return
1
;
}
}
/*
** Generate FontInfo records
*/
static
PyObject
*
QdFI_New
(
itself
)
FontInfo
*
itself
;
{
return
Py_BuildValue
(
"hhhh"
,
itself
->
ascent
,
itself
->
descent
,
itself
->
widMax
,
itself
->
leading
);
}
static
PyObject
*
Qd_Error
;
static
PyObject
*
Qd_Error
;
...
@@ -132,21 +145,70 @@ static PyObject *GrafObj_getattr(self, name)
...
@@ -132,21 +145,70 @@ static PyObject *GrafObj_getattr(self, name)
GrafPortObject
*
self
;
GrafPortObject
*
self
;
char
*
name
;
char
*
name
;
{
{
if
(
strcmp
(
name
,
"device"
)
==
0
)
return
PyInt_FromLong
((
long
)
self
->
ob_itself
->
device
);
{
CGrafPtr
itself_color
=
(
CGrafPtr
)
self
->
ob_itself
;
if
(
strcmp
(
name
,
"portBits"
)
==
0
)
{
CGrafPtr
itself_color
=
(
CGrafPtr
)
self
->
ob_itself
;
if
(
strcmp
(
name
,
"data"
)
==
0
)
return
PyString_FromStringAndSize
((
char
*
)
self
->
ob_itself
,
sizeof
(
GrafPort
));
if
(
(
itself_color
->
portVersion
&
0xc000
)
==
0xc000
)
{
/* Color-only attributes */
if
(
(
itself_color
->
portVersion
&
0xc000
)
==
0xc000
)
if
(
strcmp
(
name
,
"portBits"
)
==
0
)
/* XXXX Do we need HLock() stuff here?? */
/* XXXX Do we need HLock() stuff here?? */
return
BMObj_New
((
BitMapPtr
)
*
itself_color
->
portPixMap
);
return
BMObj_New
((
BitMapPtr
)
*
itself_color
->
portPixMap
);
else
if
(
strcmp
(
name
,
"grafVars"
)
==
0
)
return
BMObj_New
(
&
self
->
ob_itself
->
portBits
);
return
Py_BuildValue
(
"O&"
,
ResObj_New
,
(
Handle
)
itself_color
->
visRgn
);
if
(
strcmp
(
name
,
"chExtra"
)
==
0
)
return
Py_BuildValue
(
"h"
,
itself_color
->
chExtra
);
if
(
strcmp
(
name
,
"pnLocHFrac"
)
==
0
)
return
Py_BuildValue
(
"h"
,
itself_color
->
pnLocHFrac
);
}
else
{
/* Mono-only attributes */
if
(
strcmp
(
name
,
"portBits"
)
==
0
)
return
BMObj_New
(
&
self
->
ob_itself
->
portBits
);
}
/*
** Accessible for both color/mono windows.
** portVersion is really color-only, but we put it here
** for convenience
*/
if
(
strcmp
(
name
,
"portVersion"
)
==
0
)
return
Py_BuildValue
(
"h"
,
itself_color
->
portVersion
);
if
(
strcmp
(
name
,
"device"
)
==
0
)
return
PyInt_FromLong
((
long
)
self
->
ob_itself
->
device
);
if
(
strcmp
(
name
,
"portRect"
)
==
0
)
return
Py_BuildValue
(
"O&"
,
PyMac_BuildRect
,
&
self
->
ob_itself
->
portRect
);
if
(
strcmp
(
name
,
"visRgn"
)
==
0
)
return
Py_BuildValue
(
"O&"
,
ResObj_New
,
(
Handle
)
self
->
ob_itself
->
visRgn
);
if
(
strcmp
(
name
,
"clipRgn"
)
==
0
)
return
Py_BuildValue
(
"O&"
,
ResObj_New
,
(
Handle
)
self
->
ob_itself
->
clipRgn
);
if
(
strcmp
(
name
,
"bkPat"
)
==
0
)
return
Py_BuildValue
(
"s#"
,
(
char
*
)
&
self
->
ob_itself
->
bkPat
,
sizeof
(
Pattern
));
if
(
strcmp
(
name
,
"fillPat"
)
==
0
)
return
Py_BuildValue
(
"s#"
,
(
char
*
)
&
self
->
ob_itself
->
fillPat
,
sizeof
(
Pattern
));
if
(
strcmp
(
name
,
"pnLoc"
)
==
0
)
return
Py_BuildValue
(
"O&"
,
PyMac_BuildPoint
,
self
->
ob_itself
->
pnLoc
);
if
(
strcmp
(
name
,
"pnSize"
)
==
0
)
return
Py_BuildValue
(
"O&"
,
PyMac_BuildPoint
,
self
->
ob_itself
->
pnSize
);
if
(
strcmp
(
name
,
"pnMode"
)
==
0
)
return
Py_BuildValue
(
"h"
,
self
->
ob_itself
->
pnMode
);
if
(
strcmp
(
name
,
"pnPat"
)
==
0
)
return
Py_BuildValue
(
"s#"
,
(
char
*
)
&
self
->
ob_itself
->
pnPat
,
sizeof
(
Pattern
));
if
(
strcmp
(
name
,
"pnVis"
)
==
0
)
return
Py_BuildValue
(
"h"
,
self
->
ob_itself
->
pnVis
);
if
(
strcmp
(
name
,
"txFont"
)
==
0
)
return
Py_BuildValue
(
"h"
,
self
->
ob_itself
->
txFont
);
if
(
strcmp
(
name
,
"txFace"
)
==
0
)
return
Py_BuildValue
(
"h"
,
(
short
)
self
->
ob_itself
->
txFace
);
if
(
strcmp
(
name
,
"txMode"
)
==
0
)
return
Py_BuildValue
(
"h"
,
self
->
ob_itself
->
txMode
);
if
(
strcmp
(
name
,
"txSize"
)
==
0
)
return
Py_BuildValue
(
"h"
,
self
->
ob_itself
->
txSize
);
if
(
strcmp
(
name
,
"spExtra"
)
==
0
)
return
Py_BuildValue
(
"O&"
,
PyMac_BuildFixed
,
self
->
ob_itself
->
spExtra
);
/* XXXX Add more, as needed */
}
}
if
(
strcmp
(
name
,
"portRect"
)
==
0
)
return
Py_BuildValue
(
"O&"
,
PyMac_BuildRect
,
&
self
->
ob_itself
->
portRect
);
/* XXXX Add more, as needed */
return
Py_FindMethodInChain
(
&
GrafObj_chain
,
(
PyObject
*
)
self
,
name
);
return
Py_FindMethodInChain
(
&
GrafObj_chain
,
(
PyObject
*
)
self
,
name
);
}
}
...
@@ -3323,6 +3385,20 @@ static PyObject *Qd_TextWidth(_self, _args)
...
@@ -3323,6 +3385,20 @@ static PyObject *Qd_TextWidth(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Qd_GetFontInfo
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
FontInfo
info
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
return
NULL
;
GetFontInfo
(
&
info
);
_res
=
Py_BuildValue
(
"O&"
,
QdFI_New
,
&
info
);
return
_res
;
}
static
PyObject
*
Qd_CharExtra
(
_self
,
_args
)
static
PyObject
*
Qd_CharExtra
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -3738,6 +3814,8 @@ static PyMethodDef Qd_methods[] = {
...
@@ -3738,6 +3814,8 @@ static PyMethodDef Qd_methods[] = {
"(Str255 s) -> (short _rv)"
},
"(Str255 s) -> (short _rv)"
},
{
"TextWidth"
,
(
PyCFunction
)
Qd_TextWidth
,
1
,
{
"TextWidth"
,
(
PyCFunction
)
Qd_TextWidth
,
1
,
"(Buffer textBuf, short firstByte, short byteCount) -> (short _rv)"
},
"(Buffer textBuf, short firstByte, short byteCount) -> (short _rv)"
},
{
"GetFontInfo"
,
(
PyCFunction
)
Qd_GetFontInfo
,
1
,
"() -> (FontInfo info)"
},
{
"CharExtra"
,
(
PyCFunction
)
Qd_CharExtra
,
1
,
{
"CharExtra"
,
(
PyCFunction
)
Qd_CharExtra
,
1
,
"(Fixed extra) -> None"
},
"(Fixed extra) -> None"
},
{
"BitMap"
,
(
PyCFunction
)
Qd_BitMap
,
1
,
{
"BitMap"
,
(
PyCFunction
)
Qd_BitMap
,
1
,
...
...
Mac/Modules/qd/qdgen.py
View file @
3a50f8a5
# Generated from '
Sap:CodeWarrior7
:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDraw.h'
# Generated from '
flap:CodeWarrior
:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDraw.h'
f
=
Function
(
void
,
'SetPort'
,
f
=
Function
(
void
,
'SetPort'
,
(
GrafPtr
,
'port'
,
InMode
),
(
GrafPtr
,
'port'
,
InMode
),
...
@@ -926,7 +926,7 @@ f = Function(void, 'GetIndPattern',
...
@@ -926,7 +926,7 @@ f = Function(void, 'GetIndPattern',
)
)
functions
.
append
(
f
)
functions
.
append
(
f
)
# Generated from '
Sap:CodeWarrior7
:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDrawText.h'
# Generated from '
flap:CodeWarrior
:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:QuickDrawText.h'
f
=
Function
(
void
,
'TextFont'
,
f
=
Function
(
void
,
'TextFont'
,
(
short
,
'font'
,
InMode
),
(
short
,
'font'
,
InMode
),
...
@@ -987,6 +987,11 @@ f = Function(short, 'TextWidth',
...
@@ -987,6 +987,11 @@ f = Function(short, 'TextWidth',
)
)
functions
.
append
(
f
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'GetFontInfo'
,
(
FontInfo
,
'info'
,
OutMode
),
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'CharExtra'
,
f
=
Function
(
void
,
'CharExtra'
,
(
Fixed
,
'extra'
,
InMode
),
(
Fixed
,
'extra'
,
InMode
),
)
)
...
...
Mac/Modules/qd/qdscan.py
View file @
3a50f8a5
...
@@ -85,17 +85,12 @@ class MyScanner(Scanner):
...
@@ -85,17 +85,12 @@ class MyScanner(Scanner):
'ColorSearchProcPtr'
,
'ColorSearchProcPtr'
,
'ColorSearchUPP'
,
'ColorSearchUPP'
,
'ConstPatternParam'
,
'ConstPatternParam'
,
## 'Pattern_ptr',
## 'Pattern',
## 'Cursor_ptr',
'DeviceLoopDrawingProcPtr'
,
'DeviceLoopDrawingProcPtr'
,
'DeviceLoopFlags'
,
'DeviceLoopFlags'
,
'FontInfo'
,
##
'FontInfo',
'GDHandle'
,
'GDHandle'
,
'GrafVerb'
,
'GrafVerb'
,
'OpenCPicParams_ptr'
,
'OpenCPicParams_ptr'
,
## 'PenState',
## 'PenState_ptr',
'Ptr'
,
'Ptr'
,
'QDProcs'
,
'QDProcs'
,
'ReqListRec'
,
'ReqListRec'
,
...
...
Mac/Modules/qd/qdsupport.py
View file @
3a50f8a5
...
@@ -45,6 +45,7 @@ GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj")
...
@@ -45,6 +45,7 @@ GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj")
BitMap_ptr
=
OpaqueByValueType
(
"BitMapPtr"
,
"BMObj"
)
BitMap_ptr
=
OpaqueByValueType
(
"BitMapPtr"
,
"BMObj"
)
RGBColor
=
OpaqueType
(
'RGBColor'
,
'QdRGB'
)
RGBColor
=
OpaqueType
(
'RGBColor'
,
'QdRGB'
)
RGBColor_ptr
=
RGBColor
RGBColor_ptr
=
RGBColor
FontInfo
=
OpaqueType
(
'FontInfo'
,
'QdFI'
)
Cursor_ptr
=
StructInputBufferType
(
'Cursor'
)
Cursor_ptr
=
StructInputBufferType
(
'Cursor'
)
Pattern
=
StructOutputBufferType
(
'Pattern'
)
Pattern
=
StructOutputBufferType
(
'Pattern'
)
...
@@ -82,6 +83,19 @@ QdRGB_Convert(v, p_itself)
...
@@ -82,6 +83,19 @@ QdRGB_Convert(v, p_itself)
return 1;
return 1;
}
}
/*
** Generate FontInfo records
*/
static
PyObject *QdFI_New(itself)
FontInfo *itself;
{
return Py_BuildValue("hhhh", itself->ascent, itself->descent,
itself->widMax, itself->leading);
}
"""
"""
variablestuff
=
"""
variablestuff
=
"""
...
@@ -133,21 +147,70 @@ class MyGRObjectDefinition(GlobalObjectDefinition):
...
@@ -133,21 +147,70 @@ class MyGRObjectDefinition(GlobalObjectDefinition):
Output
(
"return 1;"
)
Output
(
"return 1;"
)
OutRbrace
()
OutRbrace
()
def
outputGetattrHook
(
self
):
def
outputGetattrHook
(
self
):
Output
(
"""if ( strcmp(name, "device") == 0 )
Output
(
"""
return PyInt_FromLong((long)self->ob_itself->device);
{ CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
if ( strcmp(name, "portBits") == 0 ) {
CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
if ( strcmp(name, "data") == 0 )
return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(GrafPort));
if ( (itself_color->portVersion&0xc000) == 0xc000 ) {
/* Color-only attributes */
if ( (itself_color->portVersion&0xc000) == 0xc000 )
if ( strcmp(name, "portBits") == 0 )
/* XXXX Do we need HLock() stuff here?? */
/* XXXX Do we need HLock() stuff here?? */
return BMObj_New((BitMapPtr)*itself_color->portPixMap);
return BMObj_New((BitMapPtr)*itself_color->portPixMap);
else
if ( strcmp(name, "grafVars") == 0 )
return BMObj_New(&self->ob_itself->portBits);
return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->visRgn);
}
if ( strcmp(name, "chExtra") == 0 )
if ( strcmp(name, "portRect") == 0 )
return Py_BuildValue("h", itself_color->chExtra);
return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->portRect);
if ( strcmp(name, "pnLocHFrac") == 0 )
/* XXXX Add more, as needed */
return Py_BuildValue("h", itself_color->pnLocHFrac);
"""
)
} else {
/* Mono-only attributes */
if ( strcmp(name, "portBits") == 0 )
return BMObj_New(&self->ob_itself->portBits);
}
/*
** Accessible for both color/mono windows.
** portVersion is really color-only, but we put it here
** for convenience
*/
if ( strcmp(name, "portVersion") == 0 )
return Py_BuildValue("h", itself_color->portVersion);
if ( strcmp(name, "device") == 0 )
return PyInt_FromLong((long)self->ob_itself->device);
if ( strcmp(name, "portRect") == 0 )
return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->portRect);
if ( strcmp(name, "visRgn") == 0 )
return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->visRgn);
if ( strcmp(name, "clipRgn") == 0 )
return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->clipRgn);
if ( strcmp(name, "bkPat") == 0 )
return Py_BuildValue("s#", (char *)&self->ob_itself->bkPat, sizeof(Pattern));
if ( strcmp(name, "fillPat") == 0 )
return Py_BuildValue("s#", (char *)&self->ob_itself->fillPat, sizeof(Pattern));
if ( strcmp(name, "pnLoc") == 0 )
return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnLoc);
if ( strcmp(name, "pnSize") == 0 )
return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnSize);
if ( strcmp(name, "pnMode") == 0 )
return Py_BuildValue("h", self->ob_itself->pnMode);
if ( strcmp(name, "pnPat") == 0 )
return Py_BuildValue("s#", (char *)&self->ob_itself->pnPat, sizeof(Pattern));
if ( strcmp(name, "pnVis") == 0 )
return Py_BuildValue("h", self->ob_itself->pnVis);
if ( strcmp(name, "txFont") == 0 )
return Py_BuildValue("h", self->ob_itself->txFont);
if ( strcmp(name, "txFace") == 0 )
return Py_BuildValue("h", (short)self->ob_itself->txFace);
if ( strcmp(name, "txMode") == 0 )
return Py_BuildValue("h", self->ob_itself->txMode);
if ( strcmp(name, "txSize") == 0 )
return Py_BuildValue("h", self->ob_itself->txSize);
if ( strcmp(name, "spExtra") == 0 )
return Py_BuildValue("O&", PyMac_BuildFixed, self->ob_itself->spExtra);
/* XXXX Add more, as needed */
}"""
)
class
MyBMObjectDefinition
(
GlobalObjectDefinition
):
class
MyBMObjectDefinition
(
GlobalObjectDefinition
):
def
outputCheckNewArg
(
self
):
def
outputCheckNewArg
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment