/*-------------------------------------------------------------------------* * PL_LOOKUP_OPER_ANY_TYPE * * * *-------------------------------------------------------------------------*/ OperInf * Pl_Lookup_Oper_Any_Type(int atom_op) { int op_mask = pl_atom_tbl[atom_op].prop.op_mask; if (op_mask & Make_Op_Mask(PREFIX)) return (OperInf *) Pl_Hash_Find(pl_oper_tbl, Make_Oper_Key(atom_op, PREFIX)); if (op_mask & Make_Op_Mask(INFIX)) return (OperInf *) Pl_Hash_Find(pl_oper_tbl, Make_Oper_Key(atom_op, INFIX)); if (op_mask & Make_Op_Mask(POSTFIX)) return (OperInf *) Pl_Hash_Find(pl_oper_tbl, Make_Oper_Key(atom_op, POSTFIX)); return NULL; }
/*-------------------------------------------------------------------------*/ OperInf *Delete_Oper(AtomInf *atom,int type) { int key=Make_Oper_Key(atom,type); return (OperInf *) Hash_Lookup(oper_tbl,(char *) &key,H_DELETE); }
/*-------------------------------------------------------------------------* * PL_LOOKUP_OPER * * * *-------------------------------------------------------------------------*/ OperInf * Pl_Lookup_Oper(int atom_op, int type) { if (!Check_Oper(atom_op, type)) return NULL; return (OperInf *) Pl_Hash_Find(pl_oper_tbl, Make_Oper_Key(atom_op, type)); }
/*-------------------------------------------------------------------------* * PL_DELETE_OPER * * * *-------------------------------------------------------------------------*/ OperInf * Pl_Delete_Oper(int atom_op, int type) { long key = Make_Oper_Key(atom_op, type); pl_atom_tbl[atom_op].prop.op_mask &= ~Make_Op_Mask(type); return (OperInf *) Pl_Hash_Delete(pl_oper_tbl, key); }
/*-------------------------------------------------------------------------*/ OperInf *Create_Oper(AtomInf *atom,int type,int prec,int left,int right) { OperInf oper_info; OperInf *oper; oper_info.a_t =Make_Oper_Key(atom,type); oper_info.prec =prec; oper_info.left =left; oper_info.right=right; oper=(OperInf *) Hash_Lookup(oper_tbl,(char *) &oper_info,H_UPDATE); if ((int) oper == -1) Fatal_Error(ERR_OPER_TBL_FULL); return oper; }
/*-------------------------------------------------------------------------* * PL_CREATE_OPER * * * *-------------------------------------------------------------------------*/ OperInf * Pl_Create_Oper(int atom_op, int type, int prec, int left, int right) { OperInf oper_info; OperInf *oper; Pl_Extend_Table_If_Needed(&pl_oper_tbl); oper_info.a_t = Make_Oper_Key(atom_op, type); oper_info.prec = prec; oper_info.left = left; oper_info.right = right; oper = (OperInf *) Pl_Hash_Insert(pl_oper_tbl, (char *) &oper_info, TRUE); pl_atom_tbl[atom_op].prop.op_mask |= Make_Op_Mask(type); return oper; }
/*-------------------------------------------------------------------------*/ OperInf *Lookup_Oper(AtomInf *atom,int type) { return (OperInf *) Hash_Fast_Find_Int(oper_tbl,Make_Oper_Key(atom,type)); }