Select Git revision
Forked from
Nettle / nettle
Source project has a limited visibility.
-
Niels Möller authored
const. Rev: src/nettle/bignum.c:1.3 Rev: src/nettle/bignum.h:1.2
Niels Möller authoredconst. Rev: src/nettle/bignum.c:1.3 Rev: src/nettle/bignum.h:1.2
master.pike 16.04 KiB
/* $Id: master.pike,v 1.56 1997/11/11 22:20:59 hubbe Exp $
*
* Master-file for Pike.
*/
#define GETCWD_CACHE
#define FILE_STAT_CACHE
#define UNDEFINED (([])[0])
#define error(X) throw( ({ (X), backtrace()[0..sizeof(backtrace())-2] }) )
string describe_backtrace(mixed *trace);
object low_cast_to_object(string oname, string current_file);
string _master_file_name;
string pike_library_path;
string *pike_include_path=({});
string *pike_module_path=({});
string *pike_program_path=({});
#ifdef GETCWD_CACHE
string current_path;
int cd(string s)
{
current_path=0;
return predef::cd(s);
}
string getcwd()
{
return current_path || (current_path=predef::getcwd());
}
#endif
string combine_path_with_cwd(string path)
{
return combine_path(path[0]=='/'?"/":getcwd(),path);
}
#ifdef FILE_STAT_CACHE
#define FILE_STAT_CACHE_TIME 20
int invalidate_time;
mapping(string:multiset(string)) dir_cache = ([]);
mixed *master_file_stat(string x)
{
string file, dir=reverse(combine_path_with_cwd(x));
if(sscanf(dir,"%*[/]%s/%s", file, dir)!=3)
file=x;
file=reverse(file);
dir=reverse(dir);
multiset(string) d;
if(time() > invalidate_time)
{
dir_cache=([]);
invalidate_time=time()+FILE_STAT_CACHE_TIME;
}
if(zero_type(d=dir_cache[dir]))
{
if(string *tmp=get_dir(dir))
{
d=dir_cache[dir]=aggregate_multiset(@tmp);
}else{
dir_cache[dir]=0;
}
}