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