Erwerb funktionaler, räumlicher und kausaler Beziehungen von ...

ai.cs.uni.dortmund.de

Erwerb funktionaler, räumlicher und kausaler Beziehungen von ...

Anhang 95

{

def_list * p;

p = (def_list *) new_mem(sizeof(def_list),1);

p->first = NULL;

p->last = NULL;

p->input[0] ='\0';

p->output[0] ='\0';

return p;

}

/* make_def nimmt eine Zeile der Konfigurationsdatei als Eingabe, und bildet

daraus eine neuen Eintrag der def_list. Dabei wird der Eintrag auf eventuelle

Fehler überprüft */

void make_def(char * buffer, def_list *definition)

{

def* p;

string h;

string type_of_line;

get_arg_n(type_of_line,buffer,' ',1,sizeof(string));

if (strcmp(type_of_line,"INPUT") == 0)

{

if (strlen(definition->input) != 0)

exit_on_error("More than one inputfile");

get_arg_n(definition->input,buffer,' ',2,sizeof(string));

return;

}

if (strcmp(type_of_line,"OUTPUT") == 0)

{

if (strlen(definition->output) != 0)

exit_on_error("More than one outputfile");

get_arg_n(definition->output,buffer,' ',2,sizeof(string));

return;

}

if ((strcmp(type_of_line,"MOBAL_CLASS") == 0) || \

(strcmp(type_of_line,"PREDICATE_NAME") == 0) || \

(strcmp(type_of_line,"ARGUMENT") == 0))

{

p = (def *) new_mem(sizeof(def),1);

p->next = NULL;

if (definition->last != NULL)

definition->last->next = p;

definition->last = p;

if (definition->first == NULL)

definition->first = p;

strcpy(p->type,type_of_line);

get_arg_n(h,buffer,' ',2,sizeof(string));

strcpy(p->var_type,h);

get_arg_n(h,buffer,' ',3,sizeof(string));

p->start_position = string_to_number(h);

get_arg_n(h,buffer,' ',4,sizeof(string));

p->end_position = string_to_number(h);

if (strcmp(type_of_line,"ARGUMENT") == 0)

{

if ((p->start_position start_position > p->end_position))

exit_on_error("Incorrect range for argument definition");

}

if((strcmp(p->var_type,"NUMBER") != 0) && \

Weitere Magazine dieses Users
Ähnliche Magazine