(self, in_str, address=None, check_free=True)
return length, address
Store a new string and return the string pointer.
Store a new string and return the string pointer.
Store a new string and return the string pointer .
def store(self, in_str, address=None, check_free=True):
        """Store a new string and return the string pointer."""
        length = len(in_str)
        # don't store overlong strings
        if length > 255:
            raise error.BASICError(error.STRING_TOO_LONG)
        # don't store if address is provided (code or FIELD strings)
        if address is None:
            # reserve string space; collect garbage if necessary
            if check_free:
                self._memory.check_free(length, error.OUT_OF_STRING_SPACE)
            # find new string address
            self.current -= length
            address = self.current + 1
            # don't store empty strings
            if length > 0:
                # copy and convert to bytearray
                self._strings[address] = bytearray(in_str)
        return length, address
def store ( self , in_str , address = None , check_free = True ) : length = len ( in_str ) # don't store overlong strings if length > 255 : raise error . BASICError ( error . STRING_TOO_LONG ) # don't store if address is provided (code or FIELD strings) if address is None : # reserve string space; collect garbage if necessary if check_free : self . _memory . check_free ( length , error . OUT_OF_STRING_SPACE ) # find new string address self . current -= length address = self . current + 1 # don't store empty strings if length > 0 : # copy and convert to bytearray self . _strings [ address ] = bytearray ( in_str ) return length , address