Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
79e71f73
Kaydet (Commit)
79e71f73
authored
Ara 13, 2001
tarafından
Just van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
second CoreGraphics batch
üst
c97eefc3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
451 additions
and
0 deletions
+451
-0
CFMLateImport.c
Mac/Modules/cg/CFMLateImport.c
+0
-0
CFMLateImport.h
Mac/Modules/cg/CFMLateImport.h
+0
-0
CGStubLib
Mac/Modules/cg/CGStubLib
+2
-0
CGStubLib.exp
Mac/Modules/cg/CGStubLib.exp
+58
-0
CGStubLib.readme
Mac/Modules/cg/CGStubLib.readme
+3
-0
_CGmodule.c
Mac/Modules/cg/_CGmodule.c
+0
-0
cgscan.py
Mac/Modules/cg/cgscan.py
+83
-0
cgsupport.py
Mac/Modules/cg/cgsupport.py
+305
-0
No files found.
Mac/Modules/cg/CFMLateImport.c
0 → 100755
Dosyayı görüntüle @
79e71f73
This diff is collapsed.
Click to expand it.
Mac/Modules/cg/CFMLateImport.h
0 → 100755
Dosyayı görüntüle @
79e71f73
This diff is collapsed.
Click to expand it.
Mac/Modules/cg/CGStubLib
0 → 100755
Dosyayı görüntüle @
79e71f73
(This file must be converted with BinHex 4.0) :!!"cG(9L69"6)!#3"!L3!!!!!BUjr%T[H5&`C@CQF(G`B`!!!!'i-rHh!*!0!3# 3"[q3"!#3$JJm!!!!8!3"!*!1rj!%!*!%rj!%!*!%rj!%!*!A1!!!"2!!!!!$!!! !1N0(3fpZG'9iG&0SEhG8CAKd3A43EfPZG%0(3fpZG'9iG&0SEhG8CAKd3dG$Efj dCAKd8f9XC@0d4QpZG%0(3fpZG'9iG&0PG&4PH(4%FQ&hD@jR6@pNC80(3fpZG'9 iG%4bBAG3BA4S3dG$EfjdCAKd8f9d6'PZC8T[D@j$4d0[ER4PH(46CA4-D@jP3f& `3dG$EfjdCAKd4f9d9'9iG&"[FfPdD@pZ3dG$EfjdCAKd4f9d8'&dD%0eFR*PER4 3EfPZG%0(3fpZG'9iG&0PG&0SEh9XC%&ZG'PKE'PKFd0(3fpZG'9iG&0jEQ0SFQp ZDATP3dG$EfjdCAKd4QaeFfK$4d0[ER4PH(4&EQ43B@GP3dG$EfjdCAKd8f9d4Qp ZG&0THQ9$4d0[ER4PH(4(CA48CAKd6@&dFQPi3dG$EfjdCAKd8f9d9'9iG%eKG(* TH%0(3fpZG'9iG&0PG&4PH(43Eh0TG'P[EN0(3fpZG'9iG&0PG%0SBA*KBh4PFP0 `B@0TEQG$4d0[ER4PH(46CA4$69P,8h4bEfYP3fpXEh*$4d0[ER4PH(46CA4$69P ,4QPXE%0[E'pb3dG$EfjdCAKd8f9d8NG#8h4bEfYP3fpXEh*$4d0[ER4PH(46CA4 54d*'D@aX3fpXEh*$4d0[ER4PH(46CA4(FQ&j8h4bEfYP3fpXEh*$4d0[ER4PH(4 6CA4(FQ&j4QPXE%0[E'pb3dG$EfjdCAKd3faTF&4[8Q9MG%0(3fpZG'9iG%923fa TF%0(3fpZG'9iG%0XDA"$4d0[ER4PH(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r!!6,PJ!&IIe!"QcA`!6,A)!%S40!"@ 4"!!C[em!(!eJ!"+&B!!B'J8!$h&S!"XE+!!4[r-!%r"c!"BZe`!6,@J!'&Y`!"+ (m!!0R!B!('d8!"Gd9!!E00d!%142!"3ae3!4bj`!&UJa!J#3"rrq!J!"D!#3"2r q!J!$+J#3"2rq!J!$'`#3"2rq!J!#63#3"2rq!J!#eJ#3"2rq!J!"1J#3"2rq!J! #a3#3"2rq!J!#m3#3"2rq!J!"dJ#3"2rq!J!%,J#3"2rq!J!!D!#3"2rq!J!!I!# 3"2rq!J!"*!#3"2rq!J!!T`#3"2rq!J!%I!#3"2rq!J!%93#3"2rq!J!!mJ#3"2r q!J!"kJ#3"2rq!J!!9`#3"2rq!J!#-3#3"2rq!J!!hJ#3"2rq!J!"!*!&rri#!!- &!*!%rri#!!!B!*!%rri#!!!T!*!%rri#!!21!*!%rri#!!4Q!*!%rri#!!'i!*! %rri#!!#2!*!%rri#!!!m!*!%rri#!!%3!*!%rri#!!+b!*!%rri#!!4!!*!%rri #!!'I!*!%rri#!!*l!*!%rri#!!3F!*!%rri#!!2i!*!%rri#!!)&!*!%rri#!!* I!*!%rri#!!-k!*!%rri#!!0S!*!%rri#!!30!*!%rri#!!$$!*!%rri#!!+1!*! %rri#!!)H!*!%rri#!!2L!*!%rri#!!+I!*!%rri#!!&3!*!%rri#!!1V!*!%rri #!!*!!*!%rri#!!0-!*!%rri#!!1!!*!%rri#!!'%!*!%rri#!!52!*!%rri#!!1 A!*!%rri#!!1p!*!%rri#!!5I!*!%rri!N!3E2!!!!3!!!!&B!!!!@!!!!$)!N20 8!*!,!3#3%`&`Gh"M!*!5!`%!N"%d#80(8h4eBNaTBJ!!!3!!!!&B!!!!@!!!!$* 66e*8"*B!J!!F!$)!!'0QFQF!!!!+!!$rr`#3#2Ib:
\ No newline at end of file
Mac/Modules/cg/CGStubLib.exp
0 → 100755
Dosyayı görüntüle @
79e71f73
CGContextShowTextAtPoint
CGContextShowText
CGContextSelectFont
CGContextSetTextDrawingMode
CGContextDrawPath
CGContextSetLineJoin
CGContextSetLineCap
CGContextGetTextPosition
CGContextGetPathCurrentPoint
CGContextSetShouldAntialias
CGContextSynchronize
CGContextFlush
CGContextEndPage
CGContextSetFontSize
CGContextGetTextMatrix
CGContextSetTextMatrix
CGContextSetTextPosition
CGContextSetCharacterSpacing
CGContextSetCMYKStrokeColor
CGContextSetCMYKFillColor
CGContextSetRGBStrokeColor
CGContextSetRGBFillColor
CGContextSetGrayStrokeColor
CGContextSetGrayFillColor
CGContextClipToRect
CGContextEOClip
CGContextClip
CGContextClearRect
CGContextStrokeRectWithWidth
CGContextStrokeRect
CGContextFillRect
CGContextStrokePath
CGContextEOFillPath
CGContextFillPath
CGContextGetPathBoundingBox
CGContextIsPathEmpty
CGContextAddArcToPoint
CGContextAddArc
CGContextAddRect
CGContextClosePath
CGContextAddQuadCurveToPoint
CGContextAddCurveToPoint
CGContextAddLineToPoint
CGContextMoveToPoint
CGContextBeginPath
CGContextSetAlpha
CGContextSetFlatness
CGContextSetMiterLimit
CGContextSetLineWidth
CGContextGetCTM
CGContextConcatCTM
CGContextRotateCTM
CGContextTranslateCTM
CGContextScaleCTM
CGContextRestoreGState
CGContextSaveGState
CGContextRelease
CreateCGContextForPort
Mac/Modules/cg/CGStubLib.readme
0 → 100755
Dosyayı görüntüle @
79e71f73
# CGStubLib was created by issuing this command in MPW:
MakeStub CGStubLib.exp -o CGStubLib
Mac/Modules/cg/_CGmodule.c
0 → 100755
Dosyayı görüntüle @
79e71f73
This diff is collapsed.
Click to expand it.
Mac/Modules/cg/cgscan.py
0 → 100755
Dosyayı görüntüle @
79e71f73
# Scan an Apple header file, generating a Python file of generator calls.
import
sys
import
os
BGENDIR
=
os
.
path
.
join
(
sys
.
prefix
,
':Tools:bgen:bgen'
)
sys
.
path
.
append
(
BGENDIR
)
from
scantools
import
Scanner_OSX
from
bgenlocations
import
TOOLBOXDIR
LONG
=
"CoreGraphics"
SHORT
=
"cg"
OBJECTS
=
(
"CGContextRef"
,
)
# ADD object typenames here
def
main
():
input
=
[
"CGContext.h"
,
]
output
=
SHORT
+
"gen.py"
defsoutput
=
TOOLBOXDIR
+
LONG
+
".py"
scanner
=
MyScanner
(
input
,
output
,
defsoutput
)
scanner
.
scan
()
scanner
.
gentypetest
(
SHORT
+
"typetest.py"
)
scanner
.
close
()
print
"=== Done scanning and generating, now importing the generated code... ==="
exec
"import "
+
SHORT
+
"support"
print
"=== Done. It's up to you to compile it now! ==="
class
MyScanner
(
Scanner_OSX
):
def
destination
(
self
,
type
,
name
,
arglist
):
classname
=
"Function"
listname
=
"functions"
if
arglist
:
t
,
n
,
m
=
arglist
[
0
]
if
t
in
OBJECTS
and
m
==
"InMode"
:
classname
=
"Method"
listname
=
t
+
"_methods"
# Special case for the silly first AllocatorRef argument
if
t
==
'CFAllocatorRef'
and
m
==
'InMode'
and
len
(
arglist
)
>
1
:
t
,
n
,
m
=
arglist
[
1
]
if
t
in
OBJECTS
and
m
==
"InMode"
:
classname
=
"MethodSkipArg1"
listname
=
t
+
"_methods"
return
classname
,
listname
def
writeinitialdefs
(
self
):
self
.
defsfile
.
write
(
"def FOUR_CHAR_CODE(x): return x
\n
"
)
def
makeblacklistnames
(
self
):
return
[
"CGContextRetain"
,
"CGContextRelease"
,
]
def
makegreylist
(
self
):
return
[]
def
makeblacklisttypes
(
self
):
return
[
"float_ptr"
,
"CGRect_ptr"
,
"CGPoint_ptr"
,
"CGColorSpaceRef"
,
"CGColorRenderingIntent"
,
"CGFontRef"
,
# "char_ptr",
"CGGlyph_ptr"
,
"CGImageRef"
,
"CGPDFDocumentRef"
,
]
def
makerepairinstructions
(
self
):
return
[
([(
"char_ptr"
,
"cstring"
,
"InMode"
),
(
"size_t"
,
"length"
,
"InMode"
)],
[(
"InBuffer"
,
"*"
,
"*"
)]),
# ([("char_ptr", "name", "InMode"),],
# [("CCCCC", "*", "*")]),
]
if
__name__
==
"__main__"
:
main
()
Mac/Modules/cg/cgsupport.py
0 → 100755
Dosyayı görüntüle @
79e71f73
# This script generates a Python interface for an Apple Macintosh Manager.
# It uses the "bgen" package to generate C code.
# The function specifications are generated by scanning the mamager's header file,
# using the "scantools" package (customized for this particular manager).
#error missing SetActionFilter
import
string
# Declarations that change for each manager
MODNAME
=
'_CG'
# The name of the module
# The following is *usually* unchanged but may still require tuning
MODPREFIX
=
'CG'
# The prefix for module-wide routines
INPUTFILE
=
string
.
lower
(
MODPREFIX
)
+
'gen.py'
# The file generated by the scanner
OUTPUTFILE
=
MODNAME
+
"module.c"
# The file generated by this program
from
macsupport
import
*
# Create the type objects
includestuff
=
includestuff
+
"""
#ifdef WITHOUT_FRAMEWORKS
#include <Quickdraw.h>
#include <CGContext.h>
#else
#include <CoreGraphics/CoreGraphics.h>
#endif
#if !TARGET_API_MAC_OSX
/* This code is adapted from the CallMachOFramework demo at:
http://developer.apple.com/samplecode/Sample_Code/Runtime_Architecture/CallMachOFramework.htm
It allows us to call Mach-O functions from CFM apps. */
#include <Folders.h>
#include "CFMLateImport.h"
static OSStatus LoadFrameworkBundle(CFStringRef framework, CFBundleRef *bundlePtr)
// This routine finds a the named framework and creates a CFBundle
// object for it. It looks for the framework in the frameworks folder,
// as defined by the Folder Manager. Currently this is
// "/System/Library/Frameworks", but we recommend that you avoid hard coded
// paths to ensure future compatibility.
//
// You might think that you could use CFBundleGetBundleWithIdentifier but
// that only finds bundles that are already loaded into your context.
// That would work in the case of the System framework but it wouldn't
// work if you're using some other, less-obvious, framework.
{
OSStatus err;
FSRef frameworksFolderRef;
CFURLRef baseURL;
CFURLRef bundleURL;
*bundlePtr = nil;
baseURL = nil;
bundleURL = nil;
// Find the frameworks folder and create a URL for it.
err = FSFindFolder(kOnAppropriateDisk, kFrameworksFolderType, true, &frameworksFolderRef);
if (err == noErr) {
baseURL = CFURLCreateFromFSRef(kCFAllocatorSystemDefault, &frameworksFolderRef);
if (baseURL == nil) {
err = coreFoundationUnknownErr;
}
}
// Append the name of the framework to the URL.
if (err == noErr) {
bundleURL = CFURLCreateCopyAppendingPathComponent(kCFAllocatorSystemDefault, baseURL, framework, false);
if (bundleURL == nil) {
err = coreFoundationUnknownErr;
}
}
// Create a bundle based on that URL and load the bundle into memory.
// We never unload the bundle, which is reasonable in this case because
// the sample assumes that you'll be calling functions from this
// framework throughout the life of your application.
if (err == noErr) {
*bundlePtr = CFBundleCreate(kCFAllocatorSystemDefault, bundleURL);
if (*bundlePtr == nil) {
err = coreFoundationUnknownErr;
}
}
if (err == noErr) {
if ( ! CFBundleLoadExecutable( *bundlePtr ) ) {
err = coreFoundationUnknownErr;
}
}
// Clean up.
if (err != noErr && *bundlePtr != nil) {
CFRelease(*bundlePtr);
*bundlePtr = nil;
}
if (bundleURL != nil) {
CFRelease(bundleURL);
}
if (baseURL != nil) {
CFRelease(baseURL);
}
return err;
}
// The CFMLateImport approach requires that you define a fragment
// initialisation routine that latches the fragment's connection
// ID and locator. If your code already has a fragment initialiser
// you will have to integrate the following into it.
static CFragConnectionID gFragToFixConnID;
static FSSpec gFragToFixFile;
static CFragSystem7DiskFlatLocator gFragToFixLocator;
extern OSErr FragmentInit(const CFragInitBlock *initBlock);
extern OSErr FragmentInit(const CFragInitBlock *initBlock)
{
__initialize(initBlock); /* call the "original" initializer */
gFragToFixConnID = (CFragConnectionID) initBlock->closureID;
gFragToFixFile = *(initBlock->fragLocator.u.onDisk.fileSpec);
gFragToFixLocator = initBlock->fragLocator.u.onDisk;
gFragToFixLocator.fileSpec = &gFragToFixFile;
return noErr;
}
#endif
extern int GrafObj_Convert(PyObject *, GrafPtr *);
/*
** Manual converters
*/
PyObject *CGPoint_New(CGPoint *itself)
{
return Py_BuildValue("(ff)",
itself->x,
itself->y);
}
int
CGPoint_Convert(PyObject *v, CGPoint *p_itself)
{
if( !PyArg_Parse(v, "(ff)",
&p_itself->x,
&p_itself->y) )
return 0;
return 1;
}
PyObject *CGRect_New(CGRect *itself)
{
return Py_BuildValue("(ffff)",
itself->origin.x,
itself->origin.y,
itself->size.width,
itself->size.height);
}
int
CGRect_Convert(PyObject *v, CGRect *p_itself)
{
if( !PyArg_Parse(v, "(ffff)",
&p_itself->origin.x,
&p_itself->origin.y,
&p_itself->size.width,
&p_itself->size.height) )
return 0;
return 1;
}
PyObject *CGAffineTransform_New(CGAffineTransform *itself)
{
return Py_BuildValue("(ffffff)",
itself->a,
itself->b,
itself->c,
itself->d,
itself->tx,
itself->ty);
}
int
CGAffineTransform_Convert(PyObject *v, CGAffineTransform *p_itself)
{
if( !PyArg_Parse(v, "(ffffff)",
&p_itself->a,
&p_itself->b,
&p_itself->c,
&p_itself->d,
&p_itself->tx,
&p_itself->ty) )
return 0;
return 1;
}
"""
initstuff
=
initstuff
+
"""
#if !TARGET_API_MAC_OSX
CFBundleRef sysBundle;
OSStatus err;
if (&LoadFrameworkBundle == NULL) {
PyErr_SetString(PyExc_ImportError, "CoreCraphics not supported");
return;
}
err = LoadFrameworkBundle(CFSTR("ApplicationServices.framework"), &sysBundle);
if (err == noErr)
err = CFMLateImportBundle(&gFragToFixLocator, gFragToFixConnID, FragmentInit, "
\
pCGStubLib", sysBundle);
if (err != noErr) {
PyErr_SetString(PyExc_ImportError, "CoreCraphics not supported");
return;
};
#endif /* !TARGET_API_MAC_OSX */
"""
class
MyOpaqueByValueType
(
OpaqueByValueType
):
"""Sort of a mix between OpaqueByValueType and OpaqueType."""
def
mkvalueArgs
(
self
,
name
):
return
"
%
s, &
%
s"
%
(
self
.
new
,
name
)
CGPoint
=
MyOpaqueByValueType
(
'CGPoint'
,
'CGPoint'
)
CGRect
=
MyOpaqueByValueType
(
'CGRect'
,
'CGRect'
)
CGAffineTransform
=
MyOpaqueByValueType
(
'CGAffineTransform'
,
'CGAffineTransform'
)
char_ptr
=
Type
(
"char *"
,
"s"
)
CGTextEncoding
=
int
CGLineCap
=
int
CGLineJoin
=
int
CGTextDrawingMode
=
int
CGPathDrawingMode
=
int
# The real objects
CGContextRef
=
OpaqueByValueType
(
"CGContextRef"
,
"CGContextRefObj"
)
class
MyObjectDefinition
(
GlobalObjectDefinition
):
def
outputStructMembers
(
self
):
ObjectDefinition
.
outputStructMembers
(
self
)
def
outputCleanupStructMembers
(
self
):
Output
(
"CGContextRelease(self->ob_itself);"
)
# Create the generator groups and link them
module
=
MacModule
(
MODNAME
,
MODPREFIX
,
includestuff
,
finalstuff
,
initstuff
)
CGContextRef_object
=
MyObjectDefinition
(
'CGContextRef'
,
'CGContextRefObj'
,
'CGContextRef'
)
# ADD object here
module
.
addobject
(
CGContextRef_object
)
Function
=
FunctionGenerator
Method
=
MethodGenerator
CGContextRef_methods
=
[]
# ADD _methods initializer here
execfile
(
INPUTFILE
)
CreateCGContextForPort_body
=
"""
\
GrafPtr port;
CGContextRef ctx;
OSStatus _err;
if (!PyArg_ParseTuple(_args, "O&", GrafObj_Convert, &port))
return NULL;
_err = CreateCGContextForPort(port, &ctx);
if (_err != noErr)
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&", CGContextRefObj_New, ctx);
return _res;
"""
f
=
ManualGenerator
(
"CreateCGContextForPort"
,
CreateCGContextForPort_body
);
f
.
docstring
=
lambda
:
"(CGrafPtr) -> CGContextRef"
module
.
add
(
f
)
# ADD add forloop here
for
f
in
CGContextRef_methods
:
CGContextRef_object
.
add
(
f
)
# generate output (open the output file as late as possible)
SetOutputFileName
(
OUTPUTFILE
)
module
.
generate
()
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