mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Make the callback for the file autoloader optional, and clarify its use
darcs-hash:20061019114632-ac50b-a0b3e1b3e7f26aa7cd674ade1a4fb2246f978ebc.gz
This commit is contained in:
parent
ff96668151
commit
52b2525b0e
2 changed files with 10 additions and 8 deletions
|
@ -492,6 +492,7 @@ static void clear_hash_value( void *key, void *data, void *aux )
|
|||
{
|
||||
wchar_t *name = (wchar_t *)key;
|
||||
void (*handler)(const wchar_t *)= (void (*)(const wchar_t *))aux;
|
||||
if( handler )
|
||||
handler( name );
|
||||
}
|
||||
|
||||
|
@ -717,7 +718,8 @@ int parse_util_load( const wchar_t *cmd,
|
|||
if( hash_get( &loaded->is_loading, cmd ) )
|
||||
{
|
||||
debug( 0,
|
||||
_(L"Could not autoload item '%ls', it is already being autoloaded. This is a circular dependency in the autoloading scripts, please remove it."),
|
||||
_( L"Could not autoload item '%ls', it is already being autoloaded. "
|
||||
L"This is a circular dependency in the autoloading scripts, please remove it."),
|
||||
cmd );
|
||||
return 1;
|
||||
}
|
||||
|
|
12
parse_util.h
12
parse_util.h
|
@ -102,12 +102,12 @@ int parse_util_lineno( const wchar_t *str, int len );
|
|||
|
||||
\param cmd the filename to search for. The suffix '.fish' is always added to this name
|
||||
\param path_var_name the environment variable giving the search path
|
||||
\param unload a callback function to run if a suitable file is found, which has not already been run. unload will also be called for old files which are unloaded.
|
||||
\param on_unload a callback function to run if a suitable file is found, which has not already been run. unload will also be called for old files which are unloaded.
|
||||
\param reload wheter to recheck file timestamps on already loaded files
|
||||
*/
|
||||
int parse_util_load( const wchar_t *cmd,
|
||||
const wchar_t *path_var_name,
|
||||
void (*unload)(const wchar_t *cmd),
|
||||
void (*on_unload)(const wchar_t *cmd),
|
||||
int reload );
|
||||
|
||||
/**
|
||||
|
@ -116,11 +116,10 @@ int parse_util_load( const wchar_t *cmd,
|
|||
reset.
|
||||
|
||||
\param path_var_name the environment variable giving the search path
|
||||
\param on_load the callback function to use when a file is reloaded
|
||||
\param on_load the callback function to call if the file has been previously loaded
|
||||
\param on_unload a callback function which will be called before (re)loading a file, may be used to unload the previous file.
|
||||
*/
|
||||
void parse_util_load_reset( const wchar_t *path_var_name,
|
||||
void (*on_load)(const wchar_t *cmd) );
|
||||
void (*on_unload)(const wchar_t *cmd) );
|
||||
|
||||
/**
|
||||
Tell the autoloader that the specified file, in the specified path,
|
||||
|
@ -128,11 +127,12 @@ void parse_util_load_reset( const wchar_t *path_var_name,
|
|||
|
||||
\param cmd the filename to search for. The suffix '.fish' is always added to this name
|
||||
\param path_var_name the environment variable giving the search path
|
||||
\param on_unload a callback function which will be called before (re)loading a file, may be used to unload the previous file.
|
||||
\return non-zero if the file was removed, zero if the file had not yet been loaded
|
||||
*/
|
||||
int parse_util_unload( const wchar_t *cmd,
|
||||
const wchar_t *path_var_name,
|
||||
void (*on_load)(const wchar_t *cmd) );
|
||||
void (*on_unload)(const wchar_t *cmd) );
|
||||
|
||||
/**
|
||||
Set the argv environment variable to the specified null-terminated
|
||||
|
|
Loading…
Reference in a new issue