Example #1
0
    def set(self, pointer, value, length=0):
        'Set an integer to the position indicated by *pointer*.'
        if not length:
            length = self.align

        if isStackPointer(pointer):
            self.stack.set(pointer.offset, value, length)
        elif isHeapPointer(pointer):
            if length < self.align or pointer.offset != 0:
                obj = self.heap.get(pointer.handle)
                value = replaceDecomposed(obj, pointer.offset, value, length)
            self.heap.set(pointer.handle, value)
        else:
            return self.RAM.set(pointer, value, length)
Example #2
0
 def get(self, pointer, length=0):
     'Get an integer at position indicated by *pointer*.'
     if not length:
         length = self.align
 
     if isStackPointer(pointer):
         return self.stack.get(pointer.offset, length)
     elif isHeapPointer(pointer):
         obj = self.heap.get(pointer.handle)
         if length < self.align or pointer.offset != 0:
             return decompose(obj, pointer.offset, length)
         else:
             return obj
     else:
         return self.RAM.get(pointer, length)