sp_unify_xsb_i.h

00001 /* File:      sp_unify_xsb_i.h
00002 ** Author(s): Kostis Sagonas
00003 ** Contact:   xsb-contact@cs.sunysb.edu
00004 ** 
00005 ** Copyright (C) The Research Foundation of SUNY, 1986, 1993-1998
00006 ** 
00007 ** XSB is free software; you can redistribute it and/or modify it under the
00008 ** terms of the GNU Library General Public License as published by the Free
00009 ** Software Foundation; either version 2 of the License, or (at your option)
00010 ** any later version.
00011 ** 
00012 ** XSB is distributed in the hope that it will be useful, but WITHOUT ANY
00013 ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00014 ** FOR A PARTICULAR PURPOSE.  See the GNU Library General Public License for
00015 ** more details.
00016 ** 
00017 ** You should have received a copy of the GNU Library General Public License
00018 ** along with XSB; if not, write to the Free Software Foundation,
00019 ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00020 **
00021 ** $Id: sp_unify_xsb_i.h,v 1.4 2005/01/14 18:31:31 ruim Exp $
00022 ** 
00023 */
00024 
00025 
00026 /* to be used when cell op1 is known to contain an int */
00027 static inline xsbBool int_unify(CTXTdeclc Cell op1, Cell op2)
00028 {       /* No checking for interrupts is needed!       */
00029   XSB_Deref(op2);
00030   if (isref(op2)) {
00031     /* op2 is XSB_FREE:                       num ... free */
00032     bind_copy((CPtr)(op2), op1);
00033     return TRUE;
00034   }
00035   return (op1 == op2);
00036 }
00037 
00038 
00039 /* to be used when cell op1 is known to contain an atom */
00040 static inline xsbBool atom_unify(CTXTdeclc Cell op1, Cell op2)
00041 {       /* No checking for interrupts is needed!        */
00042   XSB_Deref(op2);
00043   if (isref(op2)) {
00044     /* op2 is XSB_FREE                      string ... free */
00045     bind_copy((CPtr)(op2), op1);
00046     return TRUE;
00047   }
00048   return (op1 == op2);
00049 }

Generated on Wed Jul 26 13:30:42 2006 for XSB by  doxygen 1.4.5