Add region support.

Abstractions for classic/region added.
This commit is contained in:
Dhananjay Balan
2013-07-28 14:45:58 +05:30
committed by Chris Johns
parent c3d06d531c
commit b9ee5df588
6 changed files with 54 additions and 10 deletions

View File

@@ -15,6 +15,8 @@ class block:
return False
return True
def val(self):
return str(self.block)
def next(self):
if not self.null():
@@ -25,11 +27,15 @@ class block:
self.block = self.block['prev']
class stats:
''heap statistics''
'''heap statistics'''
def __init__(self,stat):
self.stat = stat
def inst(self):
i = self.stat['instance']
return i
def avail(self):
val = self.stat['size']
return val
@@ -37,9 +43,14 @@ class stats:
def free(self):
return self.stat['free_size']
def show(self):
print ' Instance:',self.inst()
print ' Avail:',self.avail()
print ' Free:',self.free()
# ToDo : incorporate others
def control:
class control:
'''Abstract a heap control structure'''
def __init__(self, ctl):
@@ -59,4 +70,15 @@ def control:
def stat(self):
st = stats(self.ctl['stats'])
return st
return st
def show(self):
fi = self.first()
la = self.last()
print ' First:', fi.val()
print ' Last:', la.val()
stats = self.stat()
print ' stats:'
stats.show()