예제 #1
0
파일: variable.c 프로젝트: edwardotis/hivm
void
var_set(
	char	*symbol,
	LIST	*value,
	int	flag )
{
	VARIABLE *v = var_enter( symbol );

	if( DEBUG_VARSET )
	    var_dump( symbol, value, "set" );
        
	switch( flag )
	{
	case VAR_SET:
	    /* Replace value */
	    list_free( v->value );
	    v->value = value;
	    break;

	case VAR_APPEND:
	    /* Append value */
	    v->value = list_append( v->value, value );
	    break;

	case VAR_DEFAULT:
	    /* Set only if unset */
	    if( !v->value )
		v->value = value;
	    else
		list_free( value );
	    break;
	}
}
예제 #2
0
void var_set( struct module_t * module, OBJECT * symbol, LIST * value, int flag
    )
{
    LIST * * v = var_enter( module, symbol );

    if ( DEBUG_VARSET )
        var_dump( symbol, value, "set" );

    switch ( flag )
    {
    case VAR_SET:  /* Replace value */
        list_free( *v );
        *v = value;
        break;

    case VAR_APPEND:  /* Append value */
        *v = list_append( *v, value );
        break;

    case VAR_DEFAULT:  /* Set only if unset */
        if ( list_empty( *v ) )
            *v = value;
        else
            list_free( value );
        break;
    }
}
예제 #3
0
LIST * var_swap( struct module_t * module, OBJECT * symbol, LIST * value )
{
    LIST * * v = var_enter( module, symbol );
    LIST * oldvalue = *v;
    if ( DEBUG_VARSET )
        var_dump( symbol, value, "set" );
    *v = value;
    return oldvalue;
}
예제 #4
0
LIST * var_swap( OBJECT * symbol, LIST * value )
{
    VARIABLE * v = var_enter( symbol );
    LIST     * oldvalue = v->value;
    if ( DEBUG_VARSET )
        var_dump( symbol, value, "set" );
    v->value = value;
    return oldvalue;
}