示例#1
0
文件: psc_xsb.c 项目: jianqiao/code
void set_psc_ep_to_psc(Psc psc_to_set, Psc target_psc) {
    if (get_arity(psc_to_set) != get_arity(target_psc)) {
        xsb_abort("[IMPORT AS] Cannot import predicate as a predicate with a different arity: %s/%d\n",
                  get_name(psc_to_set),get_arity(psc_to_set));
    } else if (get_ep(psc_to_set) != (byte *)&(psc_to_set->load_inst) &&
               get_ep(psc_to_set) != (byte *)&(target_psc->load_inst)) {
        xsb_warn("[IMPORT AS] Redefining entry to import-as predicate: %s/%d\n",
                 get_name(psc_to_set),get_arity(psc_to_set));
        set_ep(psc_to_set,(byte *)&(target_psc->load_inst));
    } else {
        set_ep(psc_to_set,(byte *)&(target_psc->load_inst));
    }
}
示例#2
0
文件: psc_xsb.c 项目: jianqiao/code
/* === PSC and PSC-PAIR structure creation/initialization =============== */
void init_psc_ep_info(Psc psc) {
    set_type(psc, 0);
    psc->env = 0;
    psc->incr = 0;
    set_data(psc, 0);
    set_ep(psc,(byte *)&(psc->load_inst));
    cell_opcode(&(psc->load_inst)) = load_pred;
    psc->this_psc = psc;
}
示例#3
0
文件: psc_xsb.c 项目: eden/navajoverb
/*
 *  Create a PSC record and initialize its fields.
 */
static Psc make_psc_rec(char *name, char arity) {
  Psc temp;
  int length;
  
  length = strlen(name);
  temp = (Psc)mem_alloc(sizeof(struct psc_rec));
  set_env(temp, 0);
  set_type(temp, 0);
  set_spy(temp, 0);
  set_arity(temp, arity);
  set_length(temp, length);
  set_data(temp, 0);
  set_ep(temp,(byte *)&(temp->load_inst));
  set_name(temp, string_find(name, 1));
  cell_opcode(&(temp->load_inst)) = load_pred;
  temp->this_psc = temp;
  return temp;
}
示例#4
0
文件: psc_xsb.c 项目: flavioc/XSB
/*
 *  Create a PSC record and initialize its fields.
 */
static Psc make_psc_rec(char *name, char arity) {
  Psc temp;
  
  temp = (Psc)mem_alloc(sizeof(struct psc_rec),ATOM_SPACE);
  set_type(temp, 0);
  temp->env = 0;
  //  set_env(temp, 0);
  //  set_spy(temp, 0);
  //  set_shared(temp, 0);
  //  set_tabled(temp, 0);
  temp->incr = 0;
  set_arity(temp, arity);
  set_data(temp, 0);
  set_ep(temp,(byte *)&(temp->load_inst));
  set_name(temp, string_find(name, 1));
  cell_opcode(&(temp->load_inst)) = load_pred;
  temp->this_psc = temp;
  return temp;
}