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
b996856d
Kaydet (Commit)
b996856d
authored
Kas 30, 1995
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Component mgr support
üst
41058c0d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
399 additions
and
0 deletions
+399
-0
cmtest.py
Mac/Lib/test/cmtest.py
+45
-0
Components.py
Mac/Lib/toolbox/Components.py
+23
-0
Cmgen.py
Mac/Modules/cm/Cmgen.py
+158
-0
Cmmodule.c
Mac/Modules/cm/Cmmodule.c
+0
-0
cmscan.py
Mac/Modules/cm/cmscan.py
+65
-0
cmsupport.py
Mac/Modules/cm/cmsupport.py
+108
-0
No files found.
Mac/Lib/test/cmtest.py
0 → 100644
Dosyayı görüntüle @
b996856d
"""cmtest - List all components in the system"""
import
Cm
import
Res
import
sys
def
getstr255
(
r
):
"""Get string from str255 resource"""
if
not
r
.
data
:
return
''
len
=
ord
(
r
.
data
[
0
])
return
r
.
data
[
1
:
1
+
len
]
def
getinfo
(
c
):
"""Return (type, subtype, creator, fl1, fl2, name, description) for component"""
h1
=
Res
.
Resource
(
''
)
h2
=
Res
.
Resource
(
''
)
h3
=
Res
.
Resource
(
''
)
type
,
subtype
,
creator
,
fl1
,
fl2
=
c
.
GetComponentInfo
(
h1
,
h2
,
h3
)
name
=
getstr255
(
h1
)
description
=
getstr255
(
h2
)
return
type
,
subtype
,
creator
,
fl1
,
fl2
,
name
,
description
def
getallcomponents
():
"""Return list with info for all components, sorted"""
any
=
(
'
\0\0\0\0
'
,
'
\0\0\0\0
'
,
'
\0\0\0\0
'
,
0
,
0
)
c
=
None
rv
=
[]
while
1
:
try
:
c
=
Cm
.
FindNextComponent
(
c
,
any
)
except
Cm
.
Error
:
break
rv
.
append
(
getinfo
(
c
))
rv
.
sort
()
return
rv
def
main
():
"""Print info for all components"""
info
=
getallcomponents
()
for
type
,
subtype
,
creator
,
f1
,
f2
,
name
,
description
in
info
:
print
'
%4.4
s
%4.4
s
%4.4
s
%
s 0x
%
x 0x
%
x'
%
(
type
,
subtype
,
creator
,
name
,
f1
,
f2
)
print
' '
,
description
sys
.
exit
(
1
)
main
()
Mac/Lib/toolbox/Components.py
0 → 100644
Dosyayı görüntüle @
b996856d
# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Components.h'
kAppleManufacturer
=
'appl'
kComponentResourceType
=
'thng'
kAnyComponentType
=
0
kAnyComponentSubType
=
0
kAnyComponentManufacturer
=
0
kAnyComponentFlagsMask
=
0
cmpWantsRegisterMessage
=
1L
<<
31
kComponentOpenSelect
=
-
1
kComponentCloseSelect
=
-
2
kComponentCanDoSelect
=
-
3
kComponentVersionSelect
=
-
4
kComponentRegisterSelect
=
-
5
kComponentTargetSelect
=
-
6
kComponentUnregisterSelect
=
-
7
defaultComponentIdentical
=
0
defaultComponentAnyFlags
=
1
defaultComponentAnyManufacturer
=
2
defaultComponentAnySubType
=
4
registerComponentGlobal
=
1
registerComponentNoDuplicates
=
2
registerComponentAfterExisting
=
4
Mac/Modules/cm/Cmgen.py
0 → 100644
Dosyayı görüntüle @
b996856d
# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Components.h'
f
=
Function
(
Component
,
'RegisterComponentResource'
,
(
ComponentResourceHandle
,
'tr'
,
InMode
),
(
short
,
'global'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Method
(
OSErr
,
'UnregisterComponent'
,
(
Component
,
'aComponent'
,
InMode
),
)
c_methods
.
append
(
f
)
f
=
Function
(
Component
,
'FindNextComponent'
,
(
Component
,
'aComponent'
,
InMode
),
(
ComponentDescription
,
'looking'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Function
(
long
,
'CountComponents'
,
(
ComponentDescription
,
'looking'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Method
(
OSErr
,
'GetComponentInfo'
,
(
Component
,
'aComponent'
,
InMode
),
(
ComponentDescription
,
'cd'
,
OutMode
),
(
Handle
,
'componentName'
,
InMode
),
(
Handle
,
'componentInfo'
,
InMode
),
(
Handle
,
'componentIcon'
,
InMode
),
)
c_methods
.
append
(
f
)
f
=
Function
(
long
,
'GetComponentListModSeed'
,
)
functions
.
append
(
f
)
f
=
Method
(
ComponentInstance
,
'OpenComponent'
,
(
Component
,
'aComponent'
,
InMode
),
)
c_methods
.
append
(
f
)
f
=
Method
(
OSErr
,
'CloseComponent'
,
(
ComponentInstance
,
'aComponentInstance'
,
InMode
),
)
ci_methods
.
append
(
f
)
f
=
Method
(
OSErr
,
'GetComponentInstanceError'
,
(
ComponentInstance
,
'aComponentInstance'
,
InMode
),
)
ci_methods
.
append
(
f
)
f
=
Method
(
long
,
'ComponentFunctionImplemented'
,
(
ComponentInstance
,
'ci'
,
InMode
),
(
short
,
'ftnNumber'
,
InMode
),
)
ci_methods
.
append
(
f
)
f
=
Method
(
long
,
'GetComponentVersion'
,
(
ComponentInstance
,
'ci'
,
InMode
),
)
ci_methods
.
append
(
f
)
f
=
Method
(
long
,
'ComponentSetTarget'
,
(
ComponentInstance
,
'ci'
,
InMode
),
(
ComponentInstance
,
'target'
,
InMode
),
)
ci_methods
.
append
(
f
)
f
=
Method
(
void
,
'SetComponentInstanceError'
,
(
ComponentInstance
,
'aComponentInstance'
,
InMode
),
(
OSErr
,
'theError'
,
InMode
),
)
ci_methods
.
append
(
f
)
f
=
Method
(
long
,
'GetComponentRefcon'
,
(
Component
,
'aComponent'
,
InMode
),
)
c_methods
.
append
(
f
)
f
=
Method
(
void
,
'SetComponentRefcon'
,
(
Component
,
'aComponent'
,
InMode
),
(
long
,
'theRefcon'
,
InMode
),
)
c_methods
.
append
(
f
)
f
=
Method
(
short
,
'OpenComponentResFile'
,
(
Component
,
'aComponent'
,
InMode
),
)
c_methods
.
append
(
f
)
f
=
Function
(
OSErr
,
'CloseComponentResFile'
,
(
short
,
'refnum'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Method
(
Handle
,
'GetComponentInstanceStorage'
,
(
ComponentInstance
,
'aComponentInstance'
,
InMode
),
)
ci_methods
.
append
(
f
)
f
=
Method
(
void
,
'SetComponentInstanceStorage'
,
(
ComponentInstance
,
'aComponentInstance'
,
InMode
),
(
Handle
,
'theStorage'
,
InMode
),
)
ci_methods
.
append
(
f
)
f
=
Method
(
long
,
'GetComponentInstanceA5'
,
(
ComponentInstance
,
'aComponentInstance'
,
InMode
),
)
ci_methods
.
append
(
f
)
f
=
Method
(
void
,
'SetComponentInstanceA5'
,
(
ComponentInstance
,
'aComponentInstance'
,
InMode
),
(
long
,
'theA5'
,
InMode
),
)
ci_methods
.
append
(
f
)
f
=
Method
(
long
,
'CountComponentInstances'
,
(
Component
,
'aComponent'
,
InMode
),
)
c_methods
.
append
(
f
)
f
=
Method
(
OSErr
,
'SetDefaultComponent'
,
(
Component
,
'aComponent'
,
InMode
),
(
short
,
'flags'
,
InMode
),
)
c_methods
.
append
(
f
)
f
=
Function
(
ComponentInstance
,
'OpenDefaultComponent'
,
(
OSType
,
'componentType'
,
InMode
),
(
OSType
,
'componentSubType'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Method
(
Component
,
'CaptureComponent'
,
(
Component
,
'capturedComponent'
,
InMode
),
(
Component
,
'capturingComponent'
,
InMode
),
)
c_methods
.
append
(
f
)
f
=
Method
(
OSErr
,
'UncaptureComponent'
,
(
Component
,
'aComponent'
,
InMode
),
)
c_methods
.
append
(
f
)
f
=
Function
(
long
,
'RegisterComponentResourceFile'
,
(
short
,
'resRefNum'
,
InMode
),
(
short
,
'global'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Method
(
OSErr
,
'GetComponentIconSuite'
,
(
Component
,
'aComponent'
,
InMode
),
(
Handle
,
'iconSuite'
,
OutMode
),
)
c_methods
.
append
(
f
)
Mac/Modules/cm/Cmmodule.c
0 → 100644
Dosyayı görüntüle @
b996856d
This diff is collapsed.
Click to expand it.
Mac/Modules/cm/cmscan.py
0 → 100644
Dosyayı görüntüle @
b996856d
# Scan an Apple header file, generating a Python file of generator calls.
import
addpack
addpack
.
addpack
(
':tools:bgen:bgen'
)
from
scantools
import
Scanner
LONG
=
"Components"
SHORT
=
"Cm"
def
main
():
input
=
"Components.h"
output
=
SHORT
+
"gen.py"
defsoutput
=
LONG
+
".py"
scanner
=
MyScanner
(
input
,
output
,
defsoutput
)
scanner
.
scan
()
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
):
def
destination
(
self
,
type
,
name
,
arglist
):
classname
=
"Function"
listname
=
"functions"
if
arglist
:
t
,
n
,
m
=
arglist
[
0
]
#
# FindNextComponent is a special case, since it call also be called
# with None as the argument. Hence, we make it a function
#
if
t
==
"Component"
and
m
==
"InMode"
and
name
!=
"FindNextComponent"
:
classname
=
"Method"
listname
=
"c_methods"
elif
t
==
"ComponentInstance"
and
m
==
"InMode"
:
classname
=
"Method"
listname
=
"ci_methods"
return
classname
,
listname
def
makeblacklistnames
(
self
):
return
[
# "GetComponentInfo" # XXXX I dont know how the Handle args are expected...
]
def
makeblacklisttypes
(
self
):
return
[
"ResourceSpec"
,
"ComponentResource"
,
"ComponentPlatformInfo"
,
"ComponentResourceExtension"
,
"ComponentPlatformInfoArray"
,
"ExtComponentResource"
,
"ComponentParameters"
,
"ComponentRoutineUPP"
,
]
def
makerepairinstructions
(
self
):
return
[
([(
'ComponentDescription'
,
'looking'
,
'OutMode'
)],
[(
'ComponentDescription'
,
'*'
,
'InMode'
)]),
]
if
__name__
==
"__main__"
:
main
()
Mac/Modules/cm/cmsupport.py
0 → 100644
Dosyayı görüntüle @
b996856d
# 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).
import
string
# Declarations that change for each manager
MACHEADERFILE
=
'Components.h'
# The Apple header file
MODNAME
=
'Cm'
# The name of the module
# The following is *usually* unchanged but may still require tuning
MODPREFIX
=
MODNAME
# The prefix for module-wide routines
C_OBJECTPREFIX
=
'CmpObj'
# The prefix for object methods
CI_OBJECTPREFIX
=
'CmpInstObj'
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
+
"""
#include <
%
s>"""
%
MACHEADERFILE
+
"""
/*
** Parse/generate ComponentDescriptor records
*/
PyObject *CmpDesc_New(itself)
ComponentDescription *itself;
{
return Py_BuildValue("O&O&O&ll",
PyMac_BuildOSType, itself->componentType,
PyMac_BuildOSType, itself->componentSubType,
PyMac_BuildOSType, itself->componentManufacturer,
itself->componentFlags, itself->componentFlagsMask);
}
CmpDesc_Convert(v, p_itself)
PyObject *v;
ComponentDescription *p_itself;
{
return PyArg_ParseTuple(v, "O&O&O&ll",
PyMac_GetOSType, &p_itself->componentType,
PyMac_GetOSType, &p_itself->componentSubType,
PyMac_GetOSType, &p_itself->componentManufacturer,
&p_itself->componentFlags, &p_itself->componentFlagsMask);
}
"""
ComponentDescription
=
OpaqueType
(
'ComponentDescription'
,
'CmpDesc'
)
Component
=
OpaqueByValueType
(
'Component'
,
C_OBJECTPREFIX
)
ComponentInstance
=
OpaqueByValueType
(
'ComponentInstance'
,
CI_OBJECTPREFIX
)
ComponentResult
=
Type
(
"ComponentResult"
,
"l"
)
ComponentResourceHandle
=
OpaqueByValueType
(
"ComponentResourceHandle"
,
"ResObj"
)
class
MyCIObjectDefinition
(
GlobalObjectDefinition
):
def
outputCheckNewArg
(
self
):
Output
(
"""if (itself == NULL) {
PyErr_SetString(Cm_Error,"NULL ComponentInstance");
return NULL;
}"""
)
class
MyCObjectDefinition
(
GlobalObjectDefinition
):
def
outputCheckNewArg
(
self
):
Output
(
"""if (itself == NULL) {
/* XXXX Or should we return None? */
PyErr_SetString(Cm_Error,"No such component");
return NULL;
}"""
)
def
outputCheckConvertArg
(
self
):
Output
(
"""if ( v == Py_None ) {
*p_itself = 0;
return 1;
}"""
)
# Create the generator groups and link them
module
=
MacModule
(
MODNAME
,
MODPREFIX
,
includestuff
,
finalstuff
,
initstuff
)
ci_object
=
MyCIObjectDefinition
(
'ComponentInstance'
,
CI_OBJECTPREFIX
,
'ComponentInstance'
)
c_object
=
MyCObjectDefinition
(
'Component'
,
C_OBJECTPREFIX
,
'Component'
)
module
.
addobject
(
ci_object
)
module
.
addobject
(
c_object
)
# Create the generator classes used to populate the lists
Function
=
OSErrFunctionGenerator
Method
=
OSErrMethodGenerator
# Create and populate the lists
functions
=
[]
c_methods
=
[]
ci_methods
=
[]
execfile
(
INPUTFILE
)
# add the populated lists to the generator groups
# (in a different wordl the scan program would generate this)
for
f
in
functions
:
module
.
add
(
f
)
for
f
in
c_methods
:
c_object
.
add
(
f
)
for
f
in
ci_methods
:
ci_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