xref: /freebsd/contrib/ncurses/include/hashed_db.h (revision aae38d10b4eebf81c0942947e8b83a9bb8651d88)
14a1a9510SRong-En Fan /****************************************************************************
2*aae38d10SBaptiste Daroussin  * Copyright (c) 2006-2014,2017 Free Software Foundation, Inc.              *
34a1a9510SRong-En Fan  *                                                                          *
44a1a9510SRong-En Fan  * Permission is hereby granted, free of charge, to any person obtaining a  *
54a1a9510SRong-En Fan  * copy of this software and associated documentation files (the            *
64a1a9510SRong-En Fan  * "Software"), to deal in the Software without restriction, including      *
74a1a9510SRong-En Fan  * without limitation the rights to use, copy, modify, merge, publish,      *
84a1a9510SRong-En Fan  * distribute, distribute with modifications, sublicense, and/or sell       *
94a1a9510SRong-En Fan  * copies of the Software, and to permit persons to whom the Software is    *
104a1a9510SRong-En Fan  * furnished to do so, subject to the following conditions:                 *
114a1a9510SRong-En Fan  *                                                                          *
124a1a9510SRong-En Fan  * The above copyright notice and this permission notice shall be included  *
134a1a9510SRong-En Fan  * in all copies or substantial portions of the Software.                   *
144a1a9510SRong-En Fan  *                                                                          *
154a1a9510SRong-En Fan  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
164a1a9510SRong-En Fan  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
174a1a9510SRong-En Fan  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
184a1a9510SRong-En Fan  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
194a1a9510SRong-En Fan  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
204a1a9510SRong-En Fan  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
214a1a9510SRong-En Fan  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
224a1a9510SRong-En Fan  *                                                                          *
234a1a9510SRong-En Fan  * Except as contained in this notice, the name(s) of the above copyright   *
244a1a9510SRong-En Fan  * holders shall not be used in advertising or otherwise to promote the     *
254a1a9510SRong-En Fan  * sale, use or other dealings in this Software without prior written       *
264a1a9510SRong-En Fan  * authorization.                                                           *
274a1a9510SRong-En Fan  ****************************************************************************/
284a1a9510SRong-En Fan 
294a1a9510SRong-En Fan /****************************************************************************
304a1a9510SRong-En Fan  *  Author: Thomas E. Dickey                        2006                    *
314a1a9510SRong-En Fan  ****************************************************************************/
324a1a9510SRong-En Fan 
334a1a9510SRong-En Fan /*
34*aae38d10SBaptiste Daroussin  * $Id: hashed_db.h,v 1.8 2017/07/22 16:22:49 tom Exp $
354a1a9510SRong-En Fan  */
364a1a9510SRong-En Fan 
374a1a9510SRong-En Fan #ifndef HASHED_DB_H
384a1a9510SRong-En Fan #define HASHED_DB_H 1
394a1a9510SRong-En Fan 
40*aae38d10SBaptiste Daroussin #include <ncurses_cfg.h>
41*aae38d10SBaptiste Daroussin 
424a1a9510SRong-En Fan #include <curses.h>
434a1a9510SRong-En Fan 
444a1a9510SRong-En Fan #if USE_HASHED_DB
454a1a9510SRong-En Fan 
46*aae38d10SBaptiste Daroussin #define DB_DBM_HSEARCH 0	/* quiet gcc -Wundef with db6 */
47*aae38d10SBaptiste Daroussin 
484a1a9510SRong-En Fan #include <db.h>
494a1a9510SRong-En Fan 
50*aae38d10SBaptiste Daroussin #ifndef DBM_SUFFIX
514a1a9510SRong-En Fan #define DBM_SUFFIX ".db"
524a1a9510SRong-En Fan #endif
534a1a9510SRong-En Fan 
544a1a9510SRong-En Fan #ifdef DB_VERSION_MAJOR
554a1a9510SRong-En Fan #define HASHED_DB_API DB_VERSION_MAJOR
564a1a9510SRong-En Fan #else
574a1a9510SRong-En Fan #define HASHED_DB_API 1		/* e.g., db 1.8.5 */
584a1a9510SRong-En Fan #endif
594a1a9510SRong-En Fan 
604a1a9510SRong-En Fan extern NCURSES_EXPORT(DB *) _nc_db_open(const char * /* path */, bool /* modify */);
614a1a9510SRong-En Fan extern NCURSES_EXPORT(bool) _nc_db_have_data(DBT * /* key */, DBT * /* data */, char ** /* buffer */, int * /* size */);
624a1a9510SRong-En Fan extern NCURSES_EXPORT(bool) _nc_db_have_index(DBT * /* key */, DBT * /* data */, char ** /* buffer */, int * /* size */);
634a1a9510SRong-En Fan extern NCURSES_EXPORT(int) _nc_db_close(DB * /* db */);
644a1a9510SRong-En Fan extern NCURSES_EXPORT(int) _nc_db_first(DB * /* db */, DBT * /* key */, DBT * /* data */);
654a1a9510SRong-En Fan extern NCURSES_EXPORT(int) _nc_db_next(DB * /* db */, DBT * /* key */, DBT * /* data */);
664a1a9510SRong-En Fan extern NCURSES_EXPORT(int) _nc_db_get(DB * /* db */, DBT * /* key */, DBT * /* data */);
674a1a9510SRong-En Fan extern NCURSES_EXPORT(int) _nc_db_put(DB * /* db */, DBT * /* key */, DBT * /* data */);
684a1a9510SRong-En Fan 
694a1a9510SRong-En Fan #endif
704a1a9510SRong-En Fan 
714a1a9510SRong-En Fan #endif /* HASHED_DB_H */
72