本文整理汇总了C++中popsettings函数的典型用法代码示例。如果您正苦于以下问题:C++ popsettings函数的具体用法?C++ popsettings怎么用?C++ popsettings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了popsettings函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pushsettings
/*
* Get a filename in cache for given md5sum.
*/
const char *filecache_getpath(TARGET *t)
{
char buffer[1024];
LIST *filecache;
const char *cachedir = NULL;
LIST *cachevar;
pushsettings( t->settings );
filecache = var_get( "FILECACHE" );
if ( !filecache ) {
popsettings( t->settings );
return NULL;
}
/* get directory where objcache should reside */
strcpy( buffer, filecache->string );
strcat( buffer, ".PATH" );
cachevar = var_get( buffer );
if( cachevar ) {
TARGET *t = bindtarget( cachevar->string );
t->boundname = search( t->name, &t->time );
cachedir = copystr( t->boundname );
}
popsettings( t->settings );
return cachedir;
}
示例2: bind_explicitly_located_target
static void bind_explicitly_located_target(void* xtarget, void* data)
{
TARGET* t = (TARGET*)xtarget;
if (! (t->flags & T_FLAG_NOTFILE) )
{
/* Check if there's a setting for LOCATE_TARGET */
SETTINGS* s = t->settings;
for(; s ; s = s->next)
{
if (strcmp(s->symbol, "LOCATE") == 0)
{
pushsettings(t->settings);
t->boundname = search( t->name, &t->time );
t->binding = t->time ? T_BIND_EXISTS : T_BIND_MISSING;
popsettings(t->settings);
{
LOCATED_TARGET lt, *lta = <
lt.file_name = t->boundname;
lt.target = t;
if (!located_targets)
located_targets = hashinit( sizeof(LOCATED_TARGET),
"located targets" );
/* TODO: should check if we've entered the item or not. */
hashenter(located_targets, (HASHDATA **)<a);
}
break;
}
}
}
}
示例3: builtin_md5file
LIST *
builtin_md5file(
PARSE *parse,
LOL *args,
int *jmp )
{
MD5_CTX context;
unsigned char digest[16];
unsigned char digest_string[33];
unsigned char* p;
int i;
LIST *l;
LIST *result;
const size_t BUFFER_SIZE = 100 * 1024;
unsigned char* buffer = (unsigned char*)malloc(BUFFER_SIZE);
MD5Init(&context);
/* For each argument */
for (i = 0; i < args->count; ++i) {
l = lol_get(args, i);
if (l) {
do {
FILE* file;
TARGET *t = bindtarget(l->string);
pushsettings( t->settings );
t->boundname = search( t->name, &t->time );
popsettings( t->settings );
file = fopen(t->boundname, "rb");
if (file) {
size_t readSize;
do
{
readSize = fread(buffer, 1, BUFFER_SIZE, file);
MD5Update(&context, buffer, readSize);
} while (readSize != 0);
fclose(file);
}
l = list_next(l);
} while (l);
}
}
free(buffer);
MD5Final(digest, &context);
p = digest_string;
for (i = 0, p = digest_string; i < 16; i++, p += 2) {
sprintf((char*)p, "%02x", digest[i]);
}
*p = 0;
result = list_new(L0, (const char*)digest_string, 0);
return result;
}
示例4: filecache_disable
void filecache_disable(TARGET *t)
{
BUFFER buff;
LIST *filecache;
pushsettings( t->settings );
filecache = var_get( "FILECACHE" );
if ( !filecache ) {
popsettings( t->settings );
return;
}
buffer_init(&buff);
buffer_addstring(&buff, filecache->string, strlen(filecache->string));
buffer_addstring(&buff, ".USE", 4);
buffer_addchar(&buff, 0);
var_set(buffer_ptr(&buff), list_new(L0, "0", 0), VAR_SET);
buffer_free(&buff);
buffer_init(&buff);
buffer_addstring(&buff, filecache->string, strlen(filecache->string));
buffer_addstring(&buff, ".GENERATE", 9);
buffer_addchar(&buff, 0);
var_set(buffer_ptr(&buff), list_new(L0, "0", 0), VAR_SET);
buffer_free(&buff);
}
示例5: filecache_disable
void filecache_disable(TARGET *t)
{
BUFFER buff;
LIST *filecache;
char const* filecacheStr;
pushsettings( t->settings );
filecache = var_get( "FILECACHE" );
if ( !list_first(filecache) ) {
popsettings( t->settings );
return;
}
filecacheStr = list_value(list_first(filecache));
buffer_init(&buff);
buffer_addstring(&buff, filecacheStr, strlen(filecacheStr));
buffer_addstring(&buff, ".USE", 4);
buffer_addchar(&buff, 0);
var_set(buffer_ptr(&buff), list_append(L0, "0", 0), VAR_SET);
buffer_free(&buff);
buffer_init(&buff);
buffer_addstring(&buff, filecacheStr, strlen(filecacheStr));
buffer_addstring(&buff, ".GENERATE", 9);
buffer_addchar(&buff, 0);
var_set(buffer_ptr(&buff), list_append(L0, "0", 0), VAR_SET);
buffer_free(&buff);
}
示例6: swap_settings
/*
* swap_settings() - replace the settings from the current module and
* target with those from the new module and target
*/
static void swap_settings(
module_t** current_module
, TARGET** current_target
, module_t* new_module
, TARGET* new_target)
{
if (new_module == root_module())
new_module = 0;
if (new_target == *current_target && new_module == *current_module)
return;
if (*current_target)
popsettings( (*current_target)->settings );
if (new_module != *current_module)
{
if (*current_module)
exit_module( *current_module );
*current_module = new_module;
if (new_module)
enter_module( new_module );
}
*current_target = new_target;
if (new_target)
pushsettings( new_target->settings );
}
示例7: call_timing_rule
/* Look up the __TIMING_RULE__ variable on the given target, and if
* non-empty, invoke the rule it names, passing the given
* timing_info
*/
static void call_timing_rule(TARGET* target, timing_info* time)
{
LIST* timing_rule;
pushsettings(target->settings);
timing_rule = var_get( "__TIMING_RULE__" );
popsettings(target->settings);
if (timing_rule)
{
/* We'll prepend $(__TIMING_RULE__[2-]) to the first argument */
LIST* initial_args = list_copy( L0, timing_rule->next );
/* Prepare the argument list */
FRAME frame[1];
frame_init( frame );
/* First argument is the name of the timed target */
lol_add( frame->args, list_new( initial_args, target->name ) );
append_double_string(frame->args, time->user);
append_double_string(frame->args, time->system);
if( lol_get( frame->args, 2 ) )
evaluate_rule( timing_rule->string, frame );
/* Clean up */
frame_free( frame );
}
}
示例8: cache_name
static const char * cache_name( void )
{
static OBJECT * name = 0;
if ( !name )
{
LIST * hcachevar = var_get( root_module(), constant_HCACHEFILE );
if ( !list_empty( hcachevar ) )
{
TARGET * t = bindtarget( list_front( hcachevar ) );
pushsettings( root_module(), t->settings );
/* Do not expect the cache file to be generated, so pass 0 as the
* third argument to search. Expect the location to be specified via
* LOCATE, so pass 0 as the fourth arugment.
*/
object_free( t->boundname );
t->boundname = search( t->name, &t->time, 0, 0 );
popsettings( root_module(), t->settings );
name = object_copy( t->boundname );
}
}
return name ? object_str( name ) : 0;
}
示例9: LS_jam_setvar
int LS_jam_setvar(ls_lua_State *L)
{
int numParams = ls_lua_gettop(L);
if (numParams < 2 || numParams > 3)
return 0;
if (!ls_lua_isstring(L, 1))
return 0;
if (numParams == 2)
{
var_set(ls_lua_tostring(L, 1), luahelper_addtolist(L, L0, 2), VAR_SET);
}
else
{
TARGET *t;
if (!ls_lua_isstring(L, 2))
return 0;
t = bindtarget(ls_lua_tostring(L, 1));
pushsettings(t->settings);
var_set(ls_lua_tostring(L, 2), luahelper_addtolist(L, L0, 3), VAR_SET);
popsettings(t->settings);
}
return 0;
}
示例10: compile_on
LIST *
compile_on(
PARSE *parse,
FRAME *frame )
{
LIST *nt = parse_evaluate( parse->left, frame );
LIST *result = 0;
if( DEBUG_COMPILE )
{
debug_compile( 0, "on", frame );
list_print( nt );
printf( "\n" );
}
if( nt )
{
TARGET *t = bindtarget( nt->string );
pushsettings( t->settings );
result = parse_evaluate( parse->right, frame );
popsettings( t->settings );
}
list_free( nt );
return result;
}
示例11: compile_foreach
LIST * compile_foreach( PARSE * parse, FRAME * frame )
{
LIST * nv = parse_evaluate( parse->left, frame );
LIST * l;
SETTINGS * s = 0;
if ( parse->num )
{
s = addsettings( s, VAR_SET, parse->string, L0 );
pushsettings( s );
}
/* Call var_set to reset $(parse->string) for each val. */
for ( l = nv; l; l = list_next( l ) )
{
LIST * val = list_new( L0, copystr( l->string ) );
var_set( parse->string, val, VAR_SET );
list_free( parse_evaluate( parse->right, frame ) );
}
if ( parse->num )
{
popsettings( s );
freesettings( s );
}
list_free( nv );
return L0;
}
示例12: pushsettings
static void call_action_rule
(
TARGET * target,
int status,
timing_info const * time,
char const * executed_command,
char const * command_output
)
{
LIST * action_rule;
pushsettings( root_module(), target->settings );
action_rule = var_get( root_module(), constant_ACTION_RULE );
popsettings( root_module(), target->settings );
if ( !list_empty( action_rule ) )
{
/* rule action-rule (
args * :
target :
command status start end user system :
output ? ) */
/* Prepare the argument list. */
FRAME frame[ 1 ];
OBJECT * rulename = list_front( action_rule );
frame_init( frame );
/* args * :: $(__ACTION_RULE__[2-]) */
lol_add( frame->args, list_copy_range( action_rule, list_next(
list_begin( action_rule ) ), list_end( action_rule ) ) );
/* target :: the name of the target */
lol_add( frame->args, list_new( object_copy( target->name ) ) );
/* command status start end user system :: info about the action command
*/
lol_add( frame->args,
list_push_back( list_push_back( list_push_back( list_push_back( list_push_back( list_new(
object_new( executed_command ) ),
outf_int( status ) ),
outf_time( &time->start ) ),
outf_time( &time->end ) ),
outf_double( time->user ) ),
outf_double( time->system ) ) );
/* output ? :: the output of the action command */
if ( command_output )
lol_add( frame->args, list_new( object_new( command_output ) ) );
else
lol_add( frame->args, L0 );
/* Call the rule. */
evaluate_rule( bindrule( rulename, root_module() ), rulename, frame );
/* Clean up. */
frame_free( frame );
}
}
示例13: make1bind
static void make1bind( TARGET * t )
{
if ( t->flags & T_FLAG_NOTFILE )
return;
pushsettings( root_module(), t->settings );
object_free( t->boundname );
t->boundname = search( t->name, &t->time, 0, t->flags & T_FLAG_ISFILE );
t->binding = timestamp_empty( &t->time ) ? T_BIND_MISSING : T_BIND_EXISTS;
popsettings( root_module(), t->settings );
}
示例14: make1bind
static void
make1bind(
TARGET *t )
{
if( t->flags & T_FLAG_NOTFILE )
return;
pushsettings( t->settings );
t->boundname = search( t->name, &t->time, 0 );
t->binding = t->time ? T_BIND_EXISTS : T_BIND_MISSING;
popsettings( t->settings );
}
示例15: call_action_rule
/* Look up the __ACTION_RULE__ variable on the given target, and if
* non-empty, invoke the rule it names, passing the given info,
* timing_info, executed command and command output
*/
static void call_action_rule(TARGET* target, int status, timing_info* time,
char *executed_command, char *command_output)
{
LIST* action_rule;
pushsettings(target->settings);
action_rule = var_get( "__ACTION_RULE__" );
popsettings(target->settings);
if (action_rule)
{
/* rule action-rule (
args * :
target :
command status start end user system :
output ? ) */
/* Prepare the argument list */
FRAME frame[1];
frame_init( frame );
/* args * :: $(__ACTION_RULE__[2-]) */
lol_add( frame->args, list_copy( L0, action_rule->next ) );
/* target :: the name of the target */
lol_add( frame->args, list_new( L0, target->name ) );
/* command status start end user system :: info about the action command */
lol_add( frame->args,
list_new( list_new( list_new( list_new( list_new( list_new( L0,
newstr(executed_command) ),
outf_int(status) ),
outf_time(time->start) ),
outf_time(time->end) ),
outf_double(time->user) ),
outf_double(time->system) ) );
/* output ? :: the output of the action command */
if (command_output)
lol_add(frame->args, list_new(L0, newstr(command_output)));
else
lol_add(frame->args, L0);
/* Call the rule. */
evaluate_rule( action_rule->string, frame );
/* Clean up */
frame_free( frame );
}
}