예제 #1
0
int function_exists_no_autoload( const wcstring &cmd, const env_vars_snapshot_t &vars )
{
	if( parser_keywords_is_reserved(cmd) )
		return 0;
    scoped_lock lock(functions_lock);
    return loaded_functions.find(cmd) != loaded_functions.end() || function_autoloader.can_load(cmd, vars);            
}
예제 #2
0
/**
   Make sure that if the specified function is a dynamically loaded
   function, it has been fully loaded.
*/
static int load( const wcstring &name )
{
    ASSERT_IS_MAIN_THREAD();
    scoped_lock lock(functions_lock);
	bool was_autoload = is_autoload;
	int res;
    function_map_t::iterator iter = loaded_functions.find(name);
	if( iter !=  loaded_functions.end() && !iter->second.is_autoload ) {
        /* We have a non-autoload version already */
		return 0;
    }
	
	is_autoload = true;	
	res = function_autoloader.load( name, true );
	is_autoload = was_autoload;
	return res;
}
예제 #3
0
/// Make sure that if the specified function is a dynamically loaded function, it has been fully
/// loaded.
static int load(const wcstring &name) {
    ASSERT_IS_MAIN_THREAD();
    scoped_lock locker(functions_lock);
    bool was_autoload = is_autoload;
    int res;

    bool no_more_autoload = function_tombstones.count(name) > 0;
    if (no_more_autoload) return 0;

    function_map_t::iterator iter = loaded_functions.find(name);
    if (iter != loaded_functions.end() && !iter->second.is_autoload) {
        // We have a non-autoload version already.
        return 0;
    }

    is_autoload = true;
    res = function_autoloader.load(name, true);
    is_autoload = was_autoload;
    return res;
}
예제 #4
0
void function_remove( const wcstring &name )
{
    if (function_remove_ignore_autoload(name))
        function_autoloader.unload( name );
}