Exemplo n.º 1
0
/* assign input vector */
void assign_input_affix ()
{   int nr = popi ();
    affix_node affx = popa ();
    value new_val = my_ivals[nr];

    if (affx -> val != value_nil)
    {   if (equal_value (new_val, affx -> val)) callq ();
    }
    else
    {   affx -> val = rdup_value (new_val);
        if (affx -> mfunc != NULL)
        {   /* check metadefinition */
            pushv (new_val);
            pushq (affx -> mfunc);
            callq ();
            pop (2);
        }
        else callq ();
        rfre_value (new_val);
        affx -> val = value_nil;
    };
    pusha (affx);
    pushi (nr);
    pushq (assign_input_affix);
};
Exemplo n.º 2
0
uint8_t* Assembler::emitCall(void* ptr, Register scratch) {
    // emit a 64bit movabs because some caller expect a fixed number of bytes.
    // until they are fixed use the largest encoding.
    mov(Immediate(ptr), scratch, true /* force_64bit_load */);
    callq(scratch);
    return addr;
}
Exemplo n.º 3
0
/*
   Reserve space to collect output affixes
*/
void reserve_collection_space ()
{   my_nrps = popi ();
    my_cvals = (value **) ckcalloc (1, sizeof (value *));
    room = 1;
    allocated = 0;
    callq ();
    pushi (my_nrps);
    pushq (reserve_collection_space);
};
Exemplo n.º 4
0
void collect_output_affix ()
{   int nr = popi ();
    affix_node affx = popa ();
    value new_val = affx -> val;
    check_for_space ();
    my_cvals[nrofparses][nr] = rdup_value (new_val);
    callq ();
    pusha (affx);
    pushi (nr);
    pushq (collect_output_affix);
};
Exemplo n.º 5
0
static void delayed_makeemptyfield (pos_node *ps)
	{ pos_node ps1 = ps[0];
	  pos_node ps2 = ps[1];
	  if (!crit_pos_has_value (ps1) || !crit_pos_has_value (ps2)) callq();
	  else
	   { ps1 -> delayed = 0;
	     ps2 -> delayed = 0;
	     act_makeemptyfield (ps1, ps2);
	     ps1 -> delayed = 1;
	     ps2 -> delayed = 1;
	   };
	};
Exemplo n.º 6
0
static void act_isempty (pos_node ps1, pos_node ps2)
	{ value v1 = calc_affix_value (ps1, lower_side);
	  value v2 = calc_affix_value (ps2, lower_side);
	  /* Insert code here */
	  if ((v1 -> tag == integer_value) && (v2 -> tag == integer_value))
	     { int x = v1 -> u.inum;
	       int y = v2 -> u.inum;
	       if ((0 <= x) && (0 <= y) && (x < width) && (y < height))
		  if (!field [y * width + x]) callq ();
	     };
	  /* End of insertion */
	  rfre_value (v1);
	  rfre_value (v2);
	};
Exemplo n.º 7
0
void semipred_showfield ()
	{ int i,j;
	  fprintf (stderr, "Field:\n");
	  for (i = 0; i < height; i++)
	     { for (j = 0; j < width; j++)
		  fputc ((field [i*width +j])?'X':' ', stderr);
	       fputc ('\n', stderr);
	     };
	  fputc ('\n', stderr);
	  pushi (0);
	  pushi (0);
	  pushi (mk_nodenr (alib_modnr, 3));
	  pushq (make_semipredicate_node);
	  callq ();
	  pop (4);
	  pushq (semipred_showfield);
	};
Exemplo n.º 8
0
void pred_makeemptyfield ()
	{ affix_node af1 = new_affix_node ("makeemptyfield_af1");
	  affix_node af2 = new_affix_node ("makeemptyfield_af2");
	  pushq (delayed_makeemptyfield);
	  pushq (make_node_delayed);
	  pusha (af2);
	  pushi (tag_single);
	  pusha (af1);
	  pushi (tag_single);
	  pushi (2);
	  pushi (0);
	  pushi (mk_nodenr (alib_modnr, 0));
	  pushq (make_predicate_node);
	  callq ();
	  pop (10);
	  rfre_value (af1 -> val);
	  free_affix_node (af1);
	  rfre_value (af2 -> val);
	  free_affix_node (af2);
	  pushq (pred_makeemptyfield);
	};
Exemplo n.º 9
0
static void act_makeemptyfield (pos_node ps1, pos_node ps2)
	{ value v1 = calc_affix_value (ps1, lower_side);
	  value v2 = calc_affix_value (ps2, lower_side);
	  /* Insert code here */
	  if ((v1 -> tag == integer_value) && (v2 -> tag == integer_value))
	     { char *save_field = field;			/* Ugh */
	       int save_width = width;
	       int save_height = height;
	       int ix;
	       width = v1 -> u.inum;
	       height = v2 -> u.inum;
	       field = (char *) ckcalloc (width*height, sizeof (char));
	       for (ix = 0; ix < width * height; ix++) field[ix] = 0;
	       callq ();
	       ckfree (field);
	       height = save_height;
	       width = save_width;
	       field = save_field;
	     };
	  /* End of insertion */
	  rfre_value (v1);
	  rfre_value (v2);
	};
Exemplo n.º 10
0
uint8_t* Assembler::emitCall(void* ptr, Register scratch) {
    mov(Immediate(ptr), scratch);
    callq(scratch);
    return addr;
}