00001 /**************************************************************************** 00002 * File : libdb.h 00003 * Author : Adam Cheyer 00004 * Updated : 3/1/98 00005 * 00006 *****************************************************************************/ 00007 /* 00008 * Copyright (C) 2006 SRI International 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with this library; if not, write to the Free Software 00022 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00023 * 00024 * SRI International: 333 Ravenswood Ave, Menlo Park, CA 94025 00025 */ 00026 00027 /* Make sure only loaded once... */ 00028 #ifndef _LIBDB_H_INCLUDED 00029 #define _LIBDB_H_INCLUDED 00030 00031 #ifdef __cplusplus 00032 extern "C" { 00033 #endif 00034 00035 #ifdef IS_DLL 00036 #define EXTERN __declspec(dllexport) 00037 #else 00038 #define EXTERN extern 00039 #endif 00040 00041 /* Requires libicl.h */ 00042 #include "libicl.h" 00043 00044 00045 #define DB_HASH_TABLE_SIZE 100 00046 00047 typedef struct iclDatabase { 00048 int magic_cookie; 00049 ICLListType *row[DB_HASH_TABLE_SIZE]; 00050 } ICLDatabase; 00051 00052 00053 EXTERN ICLDatabase * db_NewDB(); 00054 EXTERN int db_FreeDB(ICLDatabase *db); 00055 EXTERN int db_Assert(ICLDatabase *db, ICLTerm *term, 00056 ICLTerm *params); 00057 EXTERN int db_Retract(ICLDatabase *db, ICLTerm *term, 00058 ICLTerm *params); 00059 EXTERN int db_Solve(ICLDatabase *db, ICLTerm *term, 00060 ICLTerm *params, ICLTerm **answers); 00061 EXTERN int db_PrintDB(ICLDatabase *db); 00062 00063 EXTERN int db_IsValid(ICLDatabase *db); 00064 00065 #ifdef __cplusplus 00066 } 00067 #endif 00068 00069 #endif