Пример #1
0
static
void
goalsand(T_PTR_tree entry) {
	T_PTR_tbsymbol_info infoid, infonb_left, infonb_right;
	char *info;

	if (entry) {
		if (tree_nbrsubtrees(entry)){
			info = (char *) tree_getinfo(entry);
			infoid = tbsymbol_getinfo(tree_getinfo(tree_subtree(entry, 0)));
			infonb_left = tbsymbol_getinfo(tree_getinfo(tree_subtree(entry, 1)));
			if (strcmp(info,"=") == 0){
				ist_assign_values_to_interval(tokensgoals[nbrgoalscmd * nbr_var + infoid->info.id.addr],
						(integer32) infonb_left->info.nb.value, (integer32) infonb_left->info.nb.value);
			} else if (strcmp(info,">=") == 0){
				ist_assign_values_to_interval(tokensgoals[nbrgoalscmd * nbr_var + infoid->info.id.addr],
						(integer32) infonb_left->info.nb.value,INFINITY);
			} else if (strcmp(info,"in") == 0){
				infonb_right = tbsymbol_getinfo(tree_getinfo(tree_subtree(entry, 2)));
				ist_assign_values_to_interval(tokensgoals[nbrgoalscmd * nbr_var + infoid->info.id.addr],
						(integer32) infonb_left->info.nb.value,(integer32) infonb_right->info.nb.value);
			}
		}
	}
}
Пример #2
0
static
void
guard(T_PTR_tree entry) {
	T_PTR_tbsymbol_info infoid, infonb_left, infonb_right;
	char *info;

	if (entry) {
		/* If entry = TRUE, we haven't any subtrees and nothing to do OK */
		if (tree_nbrsubtrees(entry)){
			info = (char *) tree_getinfo(entry);
			infoid = tbsymbol_getinfo(tree_getinfo(tree_subtree(entry, 0)));
			infonb_left = tbsymbol_getinfo(tree_getinfo(tree_subtree(entry, 1)));
			if (strcmp(info,"=") == 0){
				ist_assign_values_to_interval(
						&sys->transition[nbrcmd].cmd_for_place[infoid->info.id.addr].guard,
						(integer32) infonb_left->info.nb.value, (integer32) infonb_left->info.nb.value);
			} else if (strcmp(info,">=") == 0){
				ist_assign_values_to_interval(
						&sys->transition[nbrcmd].cmd_for_place[infoid->info.id.addr].guard,
						(integer32) infonb_left->info.nb.value,INFINITY);
			} else if (strcmp(info,"in") == 0){
				infonb_right = tbsymbol_getinfo(tree_getinfo(tree_subtree(entry, 2)));
				ist_assign_values_to_interval(
						&sys->transition[nbrcmd].cmd_for_place[infoid->info.id.addr].guard,
						(integer32) infonb_left->info.nb.value,(integer32) infonb_right->info.nb.value);
			}
		}
	}
}
Пример #3
0
static
void
rules(T_PTR_tree entry) {
  size_t i, j, k, nbr_rules;

  if (entry) {
	/* We allocate memory for the transitions */
	nbr_rules = tree_nbrsubtrees(entry);
	sys->limits.nbr_rules = nbr_rules;
	sys->transition = (transition_t *)xmalloc(nbr_rules*sizeof(transition_t));
	for (i = 0; i < nbr_rules; i++) {
		/* We allocate memory for each gd_cmd of each transition */
		sys->transition[i].cmd_for_place = (gd_command_t *)xmalloc(nbr_var*sizeof(gd_command_t));
		/* Default, guard = 0,\infty and delta = 0 */
		for (j = 0; j < nbr_var; j++) {
			ist_assign_values_to_interval(&sys->transition[i].cmd_for_place[j].guard, 0L,  INFINITY);
			sys->transition[i].cmd_for_place[j].delta = 0L;
			/* In the case of places merged the genuine system is the abstraction of itself */
			sys->transition[i].cmd_for_place[j].places_abstracted=1;
		}
		for (k = 0; k < MAXNBTRANS; ++k){
			/* We allocate memory for each transfert */
			sys->transition[i].transfers[k].origin = (integer16 *)xmalloc(nbr_var*sizeof(integer16));
			/* We initialize the origin vector */
			for (j = 0; j < nbr_var; j++) 
				sys->transition[i].transfers[k].origin[j] = 0;
		}
	}
	for (nbrcmd = 0 ; nbrcmd < nbr_rules ; nbrcmd++) {
		rule(tree_subtree(entry,nbrcmd));
	}
  }
}