Пример #1
0
/*-------------------------------------------------------------------------*
 * 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;
}
Пример #2
0
/*-------------------------------------------------------------------------*/
OperInf *Delete_Oper(AtomInf *atom,int type)

{
 int key=Make_Oper_Key(atom,type);

 return (OperInf *) Hash_Lookup(oper_tbl,(char *) &key,H_DELETE);
}
Пример #3
0
/*-------------------------------------------------------------------------*
 * 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));
}
Пример #4
0
/*-------------------------------------------------------------------------*
 * 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);
}
Пример #5
0
/*-------------------------------------------------------------------------*/
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;
}
Пример #6
0
/*-------------------------------------------------------------------------*
 * 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;
}
Пример #7
0
/*-------------------------------------------------------------------------*/
OperInf *Lookup_Oper(AtomInf *atom,int type)

{
 return (OperInf *) Hash_Fast_Find_Int(oper_tbl,Make_Oper_Key(atom,type));
}