示例#1
0
rt_public void rout_obj_call_procedure_dynamic (
	int routine_id, int is_basic_type, int written_type_id_inline_agent,
	EIF_TYPED_VALUE* closed_args, int closed_count,
	EIF_TYPED_VALUE* open_args, int open_count,
	EIF_REFERENCE open_map)
{
	EIF_GET_CONTEXT
	int i = 2;
	int args_count = open_count + closed_count;
	int next_open = 0xFFFF;
	int open_idx = 1;
	int closed_idx = 1;
	rt_uint_ptr nb_pushed = 0;
	EIF_TYPED_VALUE* first_arg = NULL;
	EIF_INTEGER* open_positions = NULL;

	REQUIRE("valid_closed_args", (closed_count == 0) || closed_args);
	REQUIRE("valid_open_args", (open_count == 0) || open_args);

	if (open_count > 0) {
		open_positions = (EIF_INTEGER*)(*(EIF_REFERENCE*)open_map);
		if (open_positions [0] == 1) {
			first_arg = &(open_args [1]);
			open_idx = 2;
			if (open_count > 1) {
				next_open = open_positions [1];
			}
		} else  {
			next_open = open_positions [0];
		}
	}
	if (first_arg == NULL) {
		first_arg = &(closed_args [1]);
		closed_idx = 2;
	}
	while (i <= args_count) {
		if (i == next_open) {
			fill_it (eif_opstack_push_empty(&op_stack), &(open_args [open_idx]));
			nb_pushed++;
			if (open_idx < open_count) {
				next_open = open_positions [open_idx];
				open_idx++;
			} else {
				next_open = 0xFFFF;
			}
		} else {
			fill_it (eif_opstack_push_empty(&op_stack), &(closed_args [closed_idx]));
			nb_pushed++;
			closed_idx++;
		}
		i = i + 1;
	}
	fill_it (eif_opstack_push_empty(&op_stack), first_arg);
	nb_pushed++;

		/* We are calling a feature through an agent, in this case, we consider all calls
		 * as qualified so that the invariant is checked. */
	nstcall = 1;
	dynamic_eval (routine_id, written_type_id_inline_agent, is_basic_type, nb_pushed);
}
示例#2
0
文件: scan.c 项目: Colliotv/42.sh
static BOOL	export_alias(char *s, t_alias **alias, int no)
{
  t_alias	*link;
  BOOL		c;
  char *s1;
  char *s2;

  if (fill_it(s, &s1, &s2, no) == FALSE)
    return (FALSE);
  if (!s1 || !s2)
    printf("error at line %d\n", no);
  if (!s1 || !s2)
    return (FALSE);
  link = *alias + (unsigned int)(c = FALSE);
  while (link && !c)
    if (MATCH(link->name, s1))
      c = TRUE;
    else
      link = link->next;
  if (!c)
    return (!mod_alias(s1, s2, alias));
  free(link->next);
  link->fill = s2;
  free(s1);
  return (FALSE);
}
示例#3
0
static void
fill_out_level(void)
{
    short i, rn;

    mix_random_rooms();

    r_de = NO_ROOM;

    for (i = 0; i < MAXROOMS; i++) {
        rn = random_rooms[i];
        if ((rooms[rn].is_room & R_NOTHING) ||
                ((rooms[rn].is_room & R_CROSS) && coin_toss())) {
            fill_it(rn, 1);
        }
    }
    if (r_de != NO_ROOM) {
        fill_it(r_de, 0);
    }
}
示例#4
0
文件: scan.c 项目: Colliotv/42.sh
static BOOL	export_env(char *s, int no)
{
  char *s1;
  char *s2;

  if (fill_it(s, &s1, &s2, no) == FALSE)
    return (FALSE);
  set_env(s1, s2);
  free(s1);
  free(s2);
  return (TRUE);
}