(self)
return params
Return a dictionary of parameters for the Session object.
Return a dictionary of parameters for the Session object.
Return a dictionary of parameters for the Session object .
def session_params(self):
        """Return a dictionary of parameters for the Session object."""
        if self._session_params:
            return self._session_params
        # don't parse any options on --resume
        if self.get('resume'):
            return {}
        # preset PEEK values
        peek_values = {}
        try:
            for a in self.get('peek'):
                seg, addr, val = a.split(u':')
                peek_values[int(seg)*0x10 + int(addr)] = int(val)
        except (TypeError, ValueError):
            pass
        # devices and mounts
        device_params = {
            key.upper(): self.get(key)
            for key in ('lpt1', 'lpt2', 'lpt3', 'com1', 'com2', 'cas1')
        }
        current_device, mount_dict = self._get_drives()
        device_params.update(mount_dict)
        # memory setting
        max_list = self.get('max-memory')
        max_list[1] = max_list[1]*16 if max_list[1] else max_list[0]
        max_list[0] = max_list[0] or max_list[1]
        # codepage parameters
        codepage_params = self.get('codepage').split(u':')
        codepage_dict = data.read_codepage(codepage_params[0])
        nobox = len(codepage_params) > 1 and codepage_params[1] == u'nobox'
        # video parameters
        video_params = self.get('video').split(u':')
        # redirects
        params = self._get_redirects()
        params.update({
            'syntax': self.get('syntax'),
            'video': video_params[0],
            'codepage': codepage_dict,
            'box_protect': not nobox,
            'monitor': self.get('monitor'),
            # screen settings
            'text_width': self.get('text-width'),
            'video_memory': self.get('video-memory'),
            'font': data.read_fonts(codepage_dict, self.get('font')),
            # find program for PCjr TERM command
            'term': self.get('term'),
            'shell': self.get('shell'),
            'double': self.get('double'),
            # device settings
            'devices': device_params,
            'current_device': current_device,
            'serial_buffer_size': self.get('serial-buffer-size'),
            # text file parameters
            'textfile_encoding': self.get('text-encoding'),
            'soft_linefeed': self.get('soft-linefeed'),
            # keyboard settings
            'ctrl_c_is_break': self.get('ctrl-c-break'),
            # program parameters
            'hide_listing': self.get('hide-listing'),
            'hide_protected': self.get('hide-protected'),
            'allow_code_poke': self.get('allow-code-poke'),
            'rebuild_offsets': not self.get('convert'),
            # max available memory to BASIC (set by /m)
            'max_memory': min(max_list) or 65534,
            # maximum record length (-s)
            'max_reclen': max(1, min(32767, self.get('max-reclen'))),
            # number of file records
            'max_files': self.get('max-files'),
            # first field buffer address (workspace size; 3429 for gw-basic)
            'reserved_memory': self.get('reserved-memory'),
            'peek_values': peek_values,
            'extension': self.get('extension'),
            # ignore key buffer in console-based interfaces, to allow pasting text in console
            'check_keybuffer_full': self.get('interface') not in ('cli', 'text', 'ansi', 'curses'),
        })
        # deprecated arguments
        if self.get('utf8', get_default=False) is not None:
            if self.get('text-encoding', get_default=False) is not None:
                logging.warning(
                    'Deprecated option `utf8` ignored: `text-encoding` takes precedence.'
                )
            else:
                logging.warning('Option `utf8` is deprecated; use `text-encoding=utf-8` instead.')
                params['textfile_encoding'] = u'utf-8' if self.get('utf8') else u''
        self._session_params = params
        return params
def session_params ( self ) : if self . _session_params : return self . _session_params # don't parse any options on --resume if self . get ( 'resume' ) : return { } # preset PEEK values peek_values = { } try : for a in self . get ( 'peek' ) : seg , addr , val = a . split ( u':' ) peek_values [ int ( seg ) * 0x10 + int ( addr ) ] = int ( val ) except ( TypeError , ValueError ) : pass # devices and mounts device_params = { key . upper ( ) : self . get ( key ) for key in ( 'lpt1' , 'lpt2' , 'lpt3' , 'com1' , 'com2' , 'cas1' ) } current_device , mount_dict = self . _get_drives ( ) device_params . update ( mount_dict ) # memory setting max_list = self . get ( 'max-memory' ) max_list [ 1 ] = max_list [ 1 ] * 16 if max_list [ 1 ] else max_list [ 0 ] max_list [ 0 ] = max_list [ 0 ] or max_list [ 1 ] # codepage parameters codepage_params = self . get ( 'codepage' ) . split ( u':' ) codepage_dict = data . read_codepage ( codepage_params [ 0 ] ) nobox = len ( codepage_params ) > 1 and codepage_params [ 1 ] == u'nobox' # video parameters video_params = self . get ( 'video' ) . split ( u':' ) # redirects params = self . _get_redirects ( ) params . update ( { 'syntax' : self . get ( 'syntax' ) , 'video' : video_params [ 0 ] , 'codepage' : codepage_dict , 'box_protect' : not nobox , 'monitor' : self . get ( 'monitor' ) , # screen settings 'text_width' : self . get ( 'text-width' ) , 'video_memory' : self . get ( 'video-memory' ) , 'font' : data . read_fonts ( codepage_dict , self . get ( 'font' ) ) , # find program for PCjr TERM command 'term' : self . get ( 'term' ) , 'shell' : self . get ( 'shell' ) , 'double' : self . get ( 'double' ) , # device settings 'devices' : device_params , 'current_device' : current_device , 'serial_buffer_size' : self . get ( 'serial-buffer-size' ) , # text file parameters 'textfile_encoding' : self . get ( 'text-encoding' ) , 'soft_linefeed' : self . get ( 'soft-linefeed' ) , # keyboard settings 'ctrl_c_is_break' : self . get ( 'ctrl-c-break' ) , # program parameters 'hide_listing' : self . get ( 'hide-listing' ) , 'hide_protected' : self . get ( 'hide-protected' ) , 'allow_code_poke' : self . get ( 'allow-code-poke' ) , 'rebuild_offsets' : not self . get ( 'convert' ) , # max available memory to BASIC (set by /m) 'max_memory' : min ( max_list ) or 65534 , # maximum record length (-s) 'max_reclen' : max ( 1 , min ( 32767 , self . get ( 'max-reclen' ) ) ) , # number of file records 'max_files' : self . get ( 'max-files' ) , # first field buffer address (workspace size; 3429 for gw-basic) 'reserved_memory' : self . get ( 'reserved-memory' ) , 'peek_values' : peek_values , 'extension' : self . get ( 'extension' ) , # ignore key buffer in console-based interfaces, to allow pasting text in console 'check_keybuffer_full' : self . get ( 'interface' ) not in ( 'cli' , 'text' , 'ansi' , 'curses' ) , } ) # deprecated arguments if self . get ( 'utf8' , get_default = False ) is not None : if self . get ( 'text-encoding' , get_default = False ) is not None : logging . warning ( 'Deprecated option `utf8` ignored: `text-encoding` takes precedence.' ) else : logging . warning ( 'Option `utf8` is deprecated; use `text-encoding=utf-8` instead.' ) params [ 'textfile_encoding' ] = u'utf-8' if self . get ( 'utf8' ) else u'' self . _session_params = params return params