Next: , Previous: , Up: Executive Assembler Introduction   [Index]


8.1.2 Program Interpretation

The outer scope program execution routine assembles the aime executive and collects the program source before moving to the next program execution scope. When done, it destroys the created resources.

static int
run_logic(struct context_type *context_data)
{
    int status;

Declare the aggregate recording the executive objects and hook it in the outer context:

    struct x1f4_indexset_type indexset;

    context_data->indexset_data = &indexset;

See struct x1f4_indexset_type.

See Standalone Context.

Assemble the executive:

    status = init_xset(context_data);
    if (status) {
    } else {

See Assembling The Executive.

The standalone interpreter features the process library and should set up for receiving SIGCHLD signals:

	SIGCHLD_received = 0;

	signal(SIGCHLD, SIGCHLD_handler);

See Process Library.

	if (context_data->immediate) {
	    if (0) {
	    } else {

Set the data and program features of the global context and move to the next program execution scope:

		context_data->data = ...;

		context_data->program = NULL;

		status = set_logic(context_data, NULL, program);
	    }
	} else {
	    void *data;

Read program in data, add an extra zero byte to it:

	    status = read_file(..., &data, ...);
	    if (status) {
		...;
	    } else {

Set the data and program features of the global context and move to the next program execution scope:

		context_data->data = data;

		context_data->program = <PATH>;

		status = set_logic(context_data, <PATH>, data);

		free(data);
	    }
	}

Reset signal handler:

	signal(SIGCHLD, SIG_DFL);

Disassemble the executive:

	if (1) {
	    int excess;

	    excess = fini_xset(context_data);
	    if (excess) {
		if (status) {
		} else {
		    status = excess;
		}
	    }
	}
    }

    return status;
}

See Program Parsing And Execution.