(self, name, indices, offset, length)
Attach a FIELD variable.
Attach a FIELD variable.
Attach a FIELD variable .
def attach_var(self, name, indices, offset, length):
        """Attach a FIELD variable."""
        if name[-1:] != values.STR:
            # type mismatch
            raise error.BASICError(error.TYPE_MISMATCH)
        if offset + length > len(self._buffer):
            # FIELD overflow
            raise error.BASICError(error.FIELD_OVERFLOW)
        # create a string pointer
        str_addr = self._address + offset
        str_sequence = struct.pack('<BH', length, str_addr)
        # assign the string ptr to the variable name
        # desired side effect: if we re-assign this string variable through LET,
        # it's no longer connected to the FIELD.
        self._memory.set_variable(name, indices, self._memory.values.from_bytes(str_sequence))
def attach_var ( self , name , indices , offset , length ) : if name [ - 1 : ] != values . STR : # type mismatch raise error . BASICError ( error . TYPE_MISMATCH ) if offset + length > len ( self . _buffer ) : # FIELD overflow raise error . BASICError ( error . FIELD_OVERFLOW ) # create a string pointer str_addr = self . _address + offset str_sequence = struct . pack ( '<BH' , length , str_addr ) # assign the string ptr to the variable name # desired side effect: if we re-assign this string variable through LET, # it's no longer connected to the FIELD. self . _memory . set_variable ( name , indices , self . _memory . values . from_bytes ( str_sequence ) )