diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1995-11-30 15:03:09 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1995-11-30 15:03:09 (GMT) |
commit | b996856d12ac43ea6c1cb3697083f5d331de8e15 (patch) | |
tree | 251e18c7a35415bac4371b0a5715bb3b6f156c0b /Mac/Lib | |
parent | 41058c0d0bdbada508427ad0a0dc0ff7be662b2b (diff) | |
download | cpython-b996856d12ac43ea6c1cb3697083f5d331de8e15.zip cpython-b996856d12ac43ea6c1cb3697083f5d331de8e15.tar.gz cpython-b996856d12ac43ea6c1cb3697083f5d331de8e15.tar.bz2 |
Component mgr support
Diffstat (limited to 'Mac/Lib')
-rw-r--r-- | Mac/Lib/test/cmtest.py | 45 | ||||
-rw-r--r-- | Mac/Lib/toolbox/Components.py | 23 |
2 files changed, 68 insertions, 0 deletions
diff --git a/Mac/Lib/test/cmtest.py b/Mac/Lib/test/cmtest.py new file mode 100644 index 0000000..7170424 --- /dev/null +++ b/Mac/Lib/test/cmtest.py @@ -0,0 +1,45 @@ +"""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.4s %4.4s %4.4s %s 0x%x 0x%x'%(type, subtype, creator, name, f1, f2) + print ' ', description + sys.exit(1) + +main() diff --git a/Mac/Lib/toolbox/Components.py b/Mac/Lib/toolbox/Components.py new file mode 100644 index 0000000..d211cec --- /dev/null +++ b/Mac/Lib/toolbox/Components.py @@ -0,0 +1,23 @@ +# 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 |