예제 #1
0
파일: parse.c 프로젝트: Cabriter/abelkhan
void parse_file( OBJECT * f, FRAME * frame )
{
    /* Suspend scan of current file and push this new file in the stream. */
    yyfparse( f );

    /* Now parse each block of rules and execute it. Execute it outside of the
     * parser so that recursive calls to yyrun() work (no recursive yyparse's).
     */

    for ( ; ; )
    {
        PARSE * p;
        FUNCTION * func;

        /* Filled by yyparse() calling parse_save(). */
        yypsave = 0;

        /* If parse error or empty parse, outta here. */
        if ( yyparse() || !( p = yypsave ) )
            break;

        /* Run the parse tree. */
        func = function_compile( p );
        parse_free( p );
        list_free( function_run( func, frame, stack_global() ) );
        function_free( func );
    }

    yyfdone();
}
예제 #2
0
static void delete_native_rule( void * xrule, void * data )
{
    native_rule_t * rule = (native_rule_t *)xrule;
    if ( rule->arguments )
        args_free( rule->arguments );
    object_free( rule->name );
    if ( rule->procedure )
        function_free( rule->procedure );
}
예제 #3
0
void actions_free( rule_actions * a )
{
    if ( --a->reference_count <= 0 )
    {
        function_free( a->command );
        list_free( a->bindlist );
        BJAM_FREE( a );
    }
}
예제 #4
0
extern void interp_free(Env* env) {
	int i;
	for(i=0; i<env->nbfunction; ++i)
		function_free(env->functions[i]);
	for(i=0; i<env->nbpoints; ++i)
		points_free(env->points[i]);
	free(env->functions);
	free(env->points);
  free(env);
}
예제 #5
0
파일: syscall.c 프로젝트: maxkernel/kernel
void syscall_destroy(kobject_t * object)
{
	syscall_t * sys = (syscall_t *)object;
	hashtable_remove(&sys->global_entry);

	function_free(sys->ffi);
	free(sys->name);
	free(sys->signature);

	if (sys->description != NULL)
	{
		free(sys->description);
	}
}
예제 #6
0
static void set_rule_body( RULE * rule, argument_list * args, FUNCTION * procedure )
{
    if ( args )
        args_refer( args );
    if ( rule->arguments )
        args_free( rule->arguments );
    rule->arguments = args;

    if ( procedure )
        function_refer( procedure );
    if ( rule->procedure )
        function_free( rule->procedure );
    rule->procedure = procedure;
}
예제 #7
0
void rule_free( RULE * r )
{
    object_free( r->name );
    r->name = 0;
    if ( r->procedure )
        function_free( r->procedure );
    r->procedure = 0;
    if ( r->arguments )
        args_free( r->arguments );
    r->arguments = 0;
    if ( r->actions )
        actions_free( r->actions );
    r->actions = 0;
#ifdef HAVE_PYTHON
    if ( r->python_function )
        Py_DECREF( r->python_function );
    r->python_function = 0;
#endif
}