xref: /dflybsd-src/contrib/ncurses/include/hashed_db.h (revision 0cadad7e49c6219b0de0675ef6a6f44683d177d4)
11d102085SJan Lentfer /****************************************************************************
2*32bb5217SDaniel Fojt  * Copyright 2020 Thomas E. Dickey                                          *
3*32bb5217SDaniel Fojt  * Copyright 2006-2014,2017 Free Software Foundation, Inc.                  *
41d102085SJan Lentfer  *                                                                          *
51d102085SJan Lentfer  * Permission is hereby granted, free of charge, to any person obtaining a  *
61d102085SJan Lentfer  * copy of this software and associated documentation files (the            *
71d102085SJan Lentfer  * "Software"), to deal in the Software without restriction, including      *
81d102085SJan Lentfer  * without limitation the rights to use, copy, modify, merge, publish,      *
91d102085SJan Lentfer  * distribute, distribute with modifications, sublicense, and/or sell       *
101d102085SJan Lentfer  * copies of the Software, and to permit persons to whom the Software is    *
111d102085SJan Lentfer  * furnished to do so, subject to the following conditions:                 *
121d102085SJan Lentfer  *                                                                          *
131d102085SJan Lentfer  * The above copyright notice and this permission notice shall be included  *
141d102085SJan Lentfer  * in all copies or substantial portions of the Software.                   *
151d102085SJan Lentfer  *                                                                          *
161d102085SJan Lentfer  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
171d102085SJan Lentfer  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
181d102085SJan Lentfer  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
191d102085SJan Lentfer  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
201d102085SJan Lentfer  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
211d102085SJan Lentfer  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
221d102085SJan Lentfer  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
231d102085SJan Lentfer  *                                                                          *
241d102085SJan Lentfer  * Except as contained in this notice, the name(s) of the above copyright   *
251d102085SJan Lentfer  * holders shall not be used in advertising or otherwise to promote the     *
261d102085SJan Lentfer  * sale, use or other dealings in this Software without prior written       *
271d102085SJan Lentfer  * authorization.                                                           *
281d102085SJan Lentfer  ****************************************************************************/
291d102085SJan Lentfer 
301d102085SJan Lentfer /****************************************************************************
311d102085SJan Lentfer  *  Author: Thomas E. Dickey                        2006                    *
321d102085SJan Lentfer  ****************************************************************************/
331d102085SJan Lentfer 
341d102085SJan Lentfer /*
35*32bb5217SDaniel Fojt  * $Id: hashed_db.h,v 1.9 2020/02/02 23:34:34 tom Exp $
361d102085SJan Lentfer  */
371d102085SJan Lentfer 
381d102085SJan Lentfer #ifndef HASHED_DB_H
391d102085SJan Lentfer #define HASHED_DB_H 1
401d102085SJan Lentfer 
41*32bb5217SDaniel Fojt #include <ncurses_cfg.h>
42*32bb5217SDaniel Fojt 
431d102085SJan Lentfer #include <curses.h>
441d102085SJan Lentfer 
451d102085SJan Lentfer #if USE_HASHED_DB
461d102085SJan Lentfer 
473468e90cSJohn Marino #define DB_DBM_HSEARCH 0	/* quiet gcc -Wundef with db6 */
483468e90cSJohn Marino 
491d102085SJan Lentfer #include <db.h>
501d102085SJan Lentfer 
51*32bb5217SDaniel Fojt #ifndef DBM_SUFFIX
521d102085SJan Lentfer #define DBM_SUFFIX ".db"
531d102085SJan Lentfer #endif
541d102085SJan Lentfer 
551d102085SJan Lentfer #ifdef DB_VERSION_MAJOR
561d102085SJan Lentfer #define HASHED_DB_API DB_VERSION_MAJOR
571d102085SJan Lentfer #else
581d102085SJan Lentfer #define HASHED_DB_API 1		/* e.g., db 1.8.5 */
591d102085SJan Lentfer #endif
601d102085SJan Lentfer 
611d102085SJan Lentfer extern NCURSES_EXPORT(DB *) _nc_db_open(const char * /* path */, bool /* modify */);
621d102085SJan Lentfer extern NCURSES_EXPORT(bool) _nc_db_have_data(DBT * /* key */, DBT * /* data */, char ** /* buffer */, int * /* size */);
631d102085SJan Lentfer extern NCURSES_EXPORT(bool) _nc_db_have_index(DBT * /* key */, DBT * /* data */, char ** /* buffer */, int * /* size */);
641d102085SJan Lentfer extern NCURSES_EXPORT(int) _nc_db_close(DB * /* db */);
651d102085SJan Lentfer extern NCURSES_EXPORT(int) _nc_db_first(DB * /* db */, DBT * /* key */, DBT * /* data */);
661d102085SJan Lentfer extern NCURSES_EXPORT(int) _nc_db_next(DB * /* db */, DBT * /* key */, DBT * /* data */);
671d102085SJan Lentfer extern NCURSES_EXPORT(int) _nc_db_get(DB * /* db */, DBT * /* key */, DBT * /* data */);
681d102085SJan Lentfer extern NCURSES_EXPORT(int) _nc_db_put(DB * /* db */, DBT * /* key */, DBT * /* data */);
691d102085SJan Lentfer 
701d102085SJan Lentfer #endif
711d102085SJan Lentfer 
721d102085SJan Lentfer #endif /* HASHED_DB_H */
73