示例#1
0
 def write_from_resume_data_partial(virtualizable, reader, index, numb):
     virtualizable = cast_gcref_to_vtype(virtualizable)
     # Load values from the reader (see resume.py) described by
     # the list of numbers 'nums', and write them in their proper
     # place in the 'virtualizable'.
     for FIELDTYPE, fieldname in unroll_static_fields:
         item, index = numb_next_item(numb, index)
         x = reader.load_value_of_type(FIELDTYPE, item)
         setattr(virtualizable, fieldname, x)
     for ARRAYITEMTYPE, fieldname in unroll_array_fields:
         lst = getattr(virtualizable, fieldname)
         for j in range(getlength(lst)):
             item, index = numb_next_item(numb, index)
             x = reader.load_value_of_type(ARRAYITEMTYPE, item)
             setarrayitem(lst, j, x)
     return index
示例#2
0
 def write_from_resume_data_partial(virtualizable, reader, index, numb):
     virtualizable = cast_gcref_to_vtype(virtualizable)
     # Load values from the reader (see resume.py) described by
     # the list of numbers 'nums', and write them in their proper
     # place in the 'virtualizable'.
     for FIELDTYPE, fieldname in unroll_static_fields:
         item, index = numb_next_item(numb, index)
         x = reader.load_value_of_type(FIELDTYPE, item)
         setattr(virtualizable, fieldname, x)
     for ARRAYITEMTYPE, fieldname in unroll_array_fields:
         lst = getattr(virtualizable, fieldname)
         for j in range(getlength(lst)):
             item, index = numb_next_item(numb, index)                    
             x = reader.load_value_of_type(ARRAYITEMTYPE, item)
             setarrayitem(lst, j, x)
     return index
示例#3
0
 def load_list_of_boxes(virtualizable, reader, vable_box, numb, index):
     virtualizable = cast_gcref_to_vtype(virtualizable)
     # Uses 'virtualizable' only to know the length of the arrays;
     # does not write anything into it.  The returned list is in
     # the format expected of virtualizable_boxes, so it ends in
     # the virtualizable itself.
     boxes = []
     for FIELDTYPE, fieldname in unroll_static_fields:
         item, index = numb_next_item(numb, index)
         box = reader.decode_box_of_type(FIELDTYPE, item)
         boxes.append(box)
     for ARRAYITEMTYPE, fieldname in unroll_array_fields:
         lst = getattr(virtualizable, fieldname)
         for j in range(getlength(lst)):
             item, index = numb_next_item(numb, index)
             box = reader.decode_box_of_type(ARRAYITEMTYPE, item)
             boxes.append(box)
     boxes.append(vable_box)
     return boxes, index
示例#4
0
 def load_list_of_boxes(virtualizable, reader, vable_box, numb, index):
     virtualizable = cast_gcref_to_vtype(virtualizable)
     # Uses 'virtualizable' only to know the length of the arrays;
     # does not write anything into it.  The returned list is in
     # the format expected of virtualizable_boxes, so it ends in
     # the virtualizable itself.
     boxes = []
     for FIELDTYPE, fieldname in unroll_static_fields:
         item, index = numb_next_item(numb, index)
         box = reader.decode_box_of_type(FIELDTYPE, item)
         boxes.append(box)
     for ARRAYITEMTYPE, fieldname in unroll_array_fields:
         lst = getattr(virtualizable, fieldname)
         for j in range(getlength(lst)):
             item, index = numb_next_item(numb, index)                    
             box = reader.decode_box_of_type(ARRAYITEMTYPE, item)
             boxes.append(box)
     boxes.append(vable_box)
     return boxes, index