/* * 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_env(temp, 0); // set_spy(temp, 0); // set_shared(temp, 0); // set_tabled(temp, 0); set_name(temp, string_find(name, 1)); set_arity(temp, arity); init_psc_ep_info(temp); return temp; }
/* * 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; }
/* * 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; }
bool drd_info_rep::heuristic_init_xmacro (string var, tree xmacro) { tree_label l = make_tree_label (var); tag_info old_ti= copy (info[l]); int i, m= minimal_arity (xmacro[1], xmacro[0]); set_arity (l, m, 1, ARITY_REPEAT, CHILD_DETAILED); set_type (l, get_type (xmacro[1])); for (i=0; i<=m; i++) { int type= TYPE_UNKNOWN; tree arg (ARG, xmacro[0], as_string (i)); tree env= arg_access (xmacro[1], arg, tree (ATTR), type); //cout << var << ", " << xmacro << ", " << i << " -> " << type << "\n"; set_type (l, i, type); if (env != "") { set_accessible (l, i, ACCESSIBLE_ALWAYS); set_env (l, i, env); } } // if (old_ti != info[l]) // cout << var << ": " << old_ti << " -> " << info[l] << "\n"; return (old_ti != info[l]); }
bool drd_info_rep::heuristic_init_macro (string var, tree macro) { //cout << "init_macro " << var << " -> " << macro << "\n"; tree_label l = make_tree_label (var); tag_info old_ti= copy (info[l]); int i, n= N(macro)-1; set_arity (l, n, 0, ARITY_NORMAL, CHILD_DETAILED); set_type (l, get_type (macro[n])); set_with_like (l, heuristic_with_like (macro, "")); //if (heuristic_with_like (macro, "")) //cout << "With-like: " << var << LF; for (i=0; i<n; i++) { if (is_atomic (macro[i])) if (l >= START_EXTENSIONS || get_child_name (l, i) == "") set_child_name (l, i, macro[i]->label); int type= TYPE_UNKNOWN; tree arg (ARG, macro[i]); tree env= arg_access (macro[n], arg, tree (ATTR), type); //if (var == "section" || var == "section-title") //cout << var << " -> " << env << ", " << macro << "\n"; //if (var == "math") //cout << var << ", " << i << " -> " << type << ", " << env << ", " << macro << "\n"; set_type (l, i, type); if (env != "") { //if (var == "eqnarray*") //cout << var << " -> " << env << "\n"; //if (var == "session") //cout << var << " = " << macro << ", " << i << " -> " << env << "\n"; rewrite_symbolic_arguments (macro, env); set_accessible (l, i, ACCESSIBLE_ALWAYS); set_env (l, i, env); } } //if (old_ti != info[l]) //cout << var << ": " << old_ti << " -> " << info[l] << "\n"; return (old_ti != info[l]); }