diff -r ffa851df0825 -r 2fb8b9db1c86 symbian-qemu-0.9.1-12/python-2.6.1/Mac/Demo/resources/listres.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/symbian-qemu-0.9.1-12/python-2.6.1/Mac/Demo/resources/listres.py Fri Jul 31 15:01:17 2009 +0100 @@ -0,0 +1,60 @@ +# List all resources + +from Carbon import Res +from Carbon.Resources import * + +def list1resources(): + ntypes = Res.Count1Types() + for itype in range(1, 1+ntypes): + type = Res.Get1IndType(itype) + print "Type:", repr(type) + nresources = Res.Count1Resources(type) + for i in range(1, 1 + nresources): + Res.SetResLoad(0) + res = Res.Get1IndResource(type, i) + Res.SetResLoad(1) + info(res) + +def listresources(): + ntypes = Res.CountTypes() + for itype in range(1, 1+ntypes): + type = Res.GetIndType(itype) + print "Type:", repr(type) + nresources = Res.CountResources(type) + for i in range(1, 1 + nresources): + Res.SetResLoad(0) + res = Res.GetIndResource(type, i) + Res.SetResLoad(1) + info(res) + +def info(res): + print res.GetResInfo(), res.SizeResource(), decodeattrs(res.GetResAttrs()) + +attrnames = { + resChanged: 'Changed', + resPreload: 'Preload', + resProtected: 'Protected', + resLocked: 'Locked', + resPurgeable: 'Purgeable', + resSysHeap: 'SysHeap', +} + +def decodeattrs(attrs): + names = [] + for bit in range(16): + mask = 1<