2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
25 * (c) Copyright 1993, 1994 International Business Machines Corp. *
26 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
27 * (c) Copyright 1993, 1994 Novell, Inc. *
32 * $XConsortium: DtsDb.h /main/5 1996/08/28 14:32:17 rswiston $
34 * RESTRICTED CONFIDENTIAL INFORMATION:
36 * The information in this document is subject to special
37 * restrictions in a confidential disclosure agreement bertween
38 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
39 * document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
40 * Sun's specific written approval. This documment and all copies
41 * and derivative works thereof must be returned or destroyed at
44 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
51 #include <X11/Xresource.h>
52 #include <Dt/DbReader.h>
54 typedef int OtBoolean;
56 /* typedefs for casting comparison functions if needed */
57 typedef int (*_DtDtsDbFieldCompare)(DtDtsDbField **fld1, DtDtsDbField **fld2);
59 /* entry of a list of attribute/pairs */
63 _DtDtsDbFieldCompare compare;
67 DtDtsDbField **fieldList;
70 /* typedefs for casting record comparison functions if needed */
71 typedef int (*_DtDtsDbRecordCompare)(DtDtsDbRecord **rec1, DtDtsDbRecord **rec2);
73 /* a "database" of a collection of entrys (i.e. OBJECT-TYPE, ACTION, FILE-TYPE
74 This is a private Structure to the DtDtsDb component.
79 _DtDtsDbRecordCompare compare;
81 DtDtsDbRecord **recordList;
82 unsigned long ActionSequenceNumber;
85 /* for the mmaped database this the use_in_memory_db variable is used
86 to call the old API while the database is being built and is set to
87 false when the mmaped versions are being accessed.
90 extern int use_in_memory_db;
93 * adds a new database to the list of databases -- returns a pointer to the
94 * new database. If a database of the given name already exists it returns
95 * a pointer to that database.
97 extern DtDtsDbDatabase *_DtDtsDbAddDatabase( char *dbname );
99 /* returns the handle for the database where name is the Database name */
100 extern DtDtsDbDatabase *_DtDtsDbGet(char *name);
101 extern char **_DtDtsDbListDb(void);
103 /* Record Sort function:
104 * sorts the specified database, usually obtained from _DtDtsDbGet(), in the
105 * order specified by the comparison function. If (*compare) == 0 then
106 * _DtDtsDbCompareRecordNames() is used as the (*compare) function.
108 extern void _DtDtsDbRecordSort(DtDtsDbDatabase *database,
109 _DtDtsDbRecordCompare compare);
110 /* Field Sort function:
111 * sorts the specified Record in the order specified by the comparison function
112 * If (*compare) == 0 then _DtDtsDbCompareFieldNames() is used as the
113 * (*compare) function.
115 extern void _DtDtsDbFieldSort(DtDtsDbRecord *record,
116 _DtDtsDbFieldCompare compare);
118 /* Name Comparison functions:
119 * These routines can be passed in to the corresponding sort function to
123 extern int _DtDtsDbCompareRecordNames(DtDtsDbRecord **entry1, DtDtsDbRecord **entry2);
124 extern int _DtDtsDbCompareFieldNames(DtDtsDbField **entry1, DtDtsDbField **entry2);
126 /* retrieves the Record that matches the specified entry from the record */
127 extern DtDtsDbField *_DtDtsDbGetField(DtDtsDbRecord *record,
130 /* retrieves the entry of the specified entry from the specified database */
131 extern DtDtsDbRecord *_DtDtsDbGetRecord(DtDtsDbDatabase *database,
132 DtDtsDbRecord *value);
134 /* Get By Name functions:
135 * retrieves the entry of the specified name from the specified database
136 * ** IF ** the _DtDtsDb*Sort routine has been called with the corresponding
137 * _DtDtsDbCompare*Name comparison function. Otherwise use the standard
138 * _DtDtsDbGet* functions.
140 extern char *_DtDtsDbGetFieldByName(DtDtsDbRecord *record, char *name);
141 extern DtDtsDbRecord *_DtDtsDbGetRecordByName(DtDtsDbDatabase *database, char *name);
143 extern DtDtsDbRecord *_DtDtsDbAddRecord(DtDtsDbDatabase *db);
145 extern DtDtsDbField *_DtDtsDbAddField(DtDtsDbRecord *rec);
147 extern int _DtDtsDbDeleteDb(DtDtsDbDatabase *db);
148 extern int _DtDtsDbDeleteRecord(DtDtsDbRecord *rec, DtDtsDbDatabase *db);
149 extern int _DtDtsDbDeleteRecords(DtDtsDbDatabase *db);
150 extern int _DtDtsDbDeleteField(DtDtsDbField *fld, DtDtsDbRecord *rec);
151 extern int _DtDtsDbDeleteFields(DtDtsDbRecord *rec);