Resolve many build warnings
[oweals/cde.git] / cde / lib / DtSearch / raima / vista.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
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)
10  * any later version.
11  *
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
16  * details.
17  *
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
22  */
23 /*
24  *   COMPONENT_NAME: austext
25  *
26  *   FUNCTIONS: P1
27  *              POINTER_ASSIGN
28  *              POINTER_INIT
29  *              Pi
30  *              Piv
31  *              Pv
32  *              int
33  *
34  *   ORIGINS: 27,157
35  *
36  *   (C) COPYRIGHT International Business Machines Corp. 1995, 1996
37  *   All Rights Reserved
38  *   US Government Users Restricted Rights - Use, duplication or
39  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
40  */
41 /*----------------------------------------------------------------------
42   $TOG: vista.h /main/7 1998/04/03 17:10:52 mgreess $
43   vista.h: db_VISTA standard header file
44
45    This file should be included in all programs which use db_VISTA.  It
46    contains database status/error code definitions and standard type
47    definitions.
48
49    This file should only include user-oriented constructs.
50
51    (C) Copyright 1984, 1985, 1986, 1987 by Raima Corp.
52
53 ----------------------------------------------------------------------*/
54
55 /* ********************** EDIT HISTORY *******************************
56
57  SCR    DATE    INI                   DESCRIPTION
58 ----- --------- --- -----------------------------------------------------
59       03-AUG-88 RTK Multi-tasking support - see "#ifdef MULTI_TASK"
60       08-AUG-88 RTK Declared globals rn_dba, rn_type, and ft_offset to
61                     support recfrst, recnext, etc in ONE_DB mode.
62       16-Sep-88 RSC Fixed DBN_Dx to use variable # of arg macros.
63       28-Sep-88 WLW Corrected the db_VERSION to 3.10 from 3.01.
64       11-Oct-88 RSC Fixed DBN_Dx to use variable # of arg macros (again)
65       11-Oct-88 RSC Fixed ONE_DB to compile correctly
66       17-Oct-88 RSC Replaced MSC with ANSI, moved compiler check to dbtype
67   439 17-Nov-88 RSC Placed some multi-tasking stuff within MULTI_TASK
68   441 06-Dec-88 RSC Modifications to make gen lockmgr work with 3.10
69       26-Jan-89 RSC Add defn for UINT (for lockmgr)
70   420 13-Feb-89 WLW Removed unused prototypes of {Make,Free}ProcInstance
71  *
72  * $Log$
73  * Revision 1.2  1995/10/17  18:33:01  miker
74  * Added global db_oflag, changed values of db_VERSION and dbd_VERSION:
75  * - Allow access to read-only databases.
76  * - Expand maximum file names from 48 to 240 chars (DtSrFILENMLEN).
77  * - Disable transaction processing (NO_TRANS) to obviate need
78  *   for vista.taf and vista.log files.
79  * - Disregard all environment variables.
80  * - Replace default dberr.c with one that doesn't read stdin.
81  * - Rename library from libvista to prevent confusion with old code.
82  * - Prefix all vista utility names with "dt...", also to deconfuse.
83  *
84  */
85 #if defined(linux)
86 # define __SVR4_I386_ABI_L1__
87 #endif
88 #include <limits.h>     /* pickup WORD_BIT, LONG_BIT */
89 #if defined(linux) || defined(CSRG_BASED)
90 # undef __SVR4_I386_ABI_L1__
91 # ifndef WORD_BIT
92 # define WORD_BIT 32
93 # endif
94 # ifndef LONG_BIT
95 # define LONG_BIT 32
96 # endif
97 #endif
98
99 #define db_VERSION "3.dt"       /* was "3.10" */
100 #define dbd_VERSION "V3.dt\032" /* was "V3.00\032" */
101
102 /* -------------------status codes-------------------- */
103 /* user errors */
104 #define S_DBOPEN    -1    /* database not opened */
105 #define S_INVSET    -2    /* invalid set */
106 #define S_INVREC    -3    /* invalid record */
107 #define S_INVDB     -4    /* invalid database */
108 #define S_INVFLD    -5    /* invalid field name */
109 #define S_INVADDR   -6    /* invalid db_address */
110 #define S_NOCR      -7    /* no current record */
111 #define S_NOCO      -8    /* set has no current owner */
112 #define S_NOCM      -9    /* set has no current member */
113 #define S_KEYREQD   -10   /* key value required */
114 #define S_BADTYPE   -11   /* invalid lock type */
115 #define S_HASMEM    -12   /* record is owner of non-empty set(s) */
116 #define S_ISMEM     -13   /* record is member of set(s) */
117 #define S_ISOWNED   -14   /* member already owned */
118 #define S_ISCOMKEY  -15   /* field is a compound key */
119 #define S_NOTCON    -16   /* record not connected to set */
120 #define S_NOTKEY    -17   /* field is not a valid key */
121 #define S_INVOWN    -18   /* record not legal owner of set */
122 #define S_INVMEM    -19   /* record not legal member of set */
123 #define S_SETPAGES  -20   /* error in d_setpages (database open or bad param) */
124 #define S_INCOMPAT  -21   /* incompatible dictionary file */
125 #define S_DELSYS    -22   /* illegal attempt to delete system record */
126 #define S_NOTFREE   -23   /* attempt to locked previously locked rec or set */
127 #define S_NOTLOCKED -24   /* attempt to access unlocked record or set */
128 #define S_TRANSID   -25   /* transaction id not be supplied */
129 #define S_TRACTIVE  -26   /* transaction already active */
130 #define S_TRNOTACT  -27   /* transaction not currently active */
131 #define S_TRLOCKS   -28   /* transaction cannot begin due to locked files */
132 #define S_TRFREE    -29   /* attempt to free a lock inside a transaction */
133 #define S_TRCHANGES -30   /* too many pages changed within transaction */
134 #define S_NOTRANS   -31   /* attempted update outside of transaction */
135 #define S_EXCLUSIVE -32   /* functions requires exclusive db access */
136 #define S_STATIC    -33   /* Attempted to write lock a static file */
137 #define S_USERID    -34   /* No user id exists */
138 #define S_NAMELEN   -35   /* database file/path name too long */
139 #define S_RENAME    -36   /* invalid file number was passed to d_renfile */
140 #define S_NOTOPTKEY -37   /* field is not an optional key */
141 #define S_BADFIELD  -38   /* field not defined in current record type */
142 #define S_COMKEY    -39   /* record/field has/in a compound key */
143 #define S_INVNUM    -40   /* invalid record or set number */
144 #define S_TIMESTAMP -41   /* record or set not timestamped */
145 #define S_BADUSERID -42   /* invalid user id - not alphanumeric */
146 #define S_NONETBIOS -43   /* NetBIOS is not installed on machine */
147 #define S_BADBDPATH -44   /* bad # of elements in DBDPATH */
148 #define S_BADBFPATH -45   /* bad # of elements in DBFPATH */
149 #define S_NOTYPE    -46   /* No current record type */
150 #define S_INVSORT   -47   /* Invalid country table sort string */
151 #define S_DBCLOSE   -48   /* database not closed */
152
153 /* system errors */
154 #define S_NOSPACE   -900  /* no more space on file */
155 #define S_SYSERR    -901  /* system error */
156 #define S_FAULT     -902  /* page fault -- changed during usage */
157 #define S_NOWORK    -903  /* no working file set in dio */
158 #define S_NOMEMORY  -904  /* unable to allocate sufficient memory */
159 #define S_NOFILE    -905  /* unable to locate a file */
160 #define S_DBLACCESS -906  /* unable to access db lock file */
161 #define S_DBLERR    -907  /* db lock file open/access error */
162 #define S_BADLOCKS  -908  /* inconsistent database locks */
163 #define S_RECLIMIT  -909  /* file record limit reached */
164 #define S_KEYERR    -910  /* key file inconsistency detected */
165 #define S_USERLIMIT -911  /* Max concurrent user limit reached */
166 #define S_FSEEK     -912  /* Bad seek on database file */
167 #define S_INVFILE   -913  /* Invalid file specified */
168 #define S_BADREAD   -914  /* Bad read on database/overflow file */
169 #define S_NETSYNC   -915  /* Network synchronization error */
170 #define S_DEBUG     -916  /* Debugging check interrupt */
171 #define S_NETERR    -917  /* Network communications error */
172 #define S_RECOVERY  -918  /* Auto-recovery is in process */
173 #define S_BADWRITE  -919  /* Bad write on database/overflow file */
174 #define S_NOLOCKMGR -920  /* Unable to open lockmgr session */
175 #define S_DUPUSERID -921  /* DBUSERID is already used by another user */
176 #define S_LMBUSY    -922  /* The lock manager is busy */
177
178 /* function statuses */
179 #define S_OKAY      0     /* normal return, okay */
180 #define S_EOS       1     /* end of set */
181 #define S_NOTFOUND  2     /* record not found */
182 #define S_DUPLICATE 3     /* duplicate key */
183 #define S_KEYSEQ    4     /* field type used out of sequence in d_keynext */
184 #define S_UNAVAIL   5     /* database file currently unavailable */
185 #define S_DELETED   6     /* record/set deleted since last accessed */
186 #define S_UPDATED   7     /* record/set updated since last accessed */
187 #define S_LOCKED    8     /* current record's lock bit is set */
188 #define S_UNLOCKED  9     /* current record's lock bit is clear */
189
190 /* In order to share databases among heterogenous machines,
191  * certain integer types must be defined that are invariably
192  * 2 and 4 bytes on all architectures.
193  * Note WORD_BIT == 32 does not guarantee short == 16.
194  */
195
196 #ifdef LONG
197 #undef LONG
198 #endif
199
200 #if   (WORD_BIT == 16)
201   typedef int             INT;
202   typedef unsigned int    UINT;
203 #elif (WORD_BIT == 32)
204   typedef short           INT;
205   typedef unsigned short  UINT;
206 #else
207 #error Unable to typedef INT and UINT
208 #endif
209
210 #if (LONG_BIT == 32)
211   typedef long            LONG;
212   typedef unsigned long   ULONG;
213 #elif   (WORD_BIT == 32)
214   typedef int             LONG;
215   typedef unsigned int    ULONG;
216 #else
217 #error Unable to typedef LONG and ULONG
218 #endif
219
220 typedef LONG    BOOLEAN;
221
222 #define MAXRECORDS 16777215
223 #define NULL_DBA 0
224
225 /* db_VISTA database address */
226 #define DB_ADDR LONG  
227
228 /* db_VISTA file number */
229 #define FILE_NO INT   
230
231 /* file address: page or record number */
232 #define F_ADDR LONG   
233
234 /* record number indicator */
235 #define RECMARK 10000
236 /* field number indicator = rec * FLDMARK + fld_in_rec */
237 #define FLDMARK 1000
238 /* set number indicator - must be greater than RECMARK */
239 #define SETMARK 20000
240
241 /* runtime option flags */
242 #define DCHAINUSE  0x01
243 #define TRLOGGING  0x02
244 #define ARCLOGGING 0x04
245 #define IGNORECASE 0x08
246
247 /* grouped lock request packet */
248 extern int db_status;
249 #ifndef NO_TRANS
250 extern int rlb_status;
251 #endif
252
253 /* Mike Russell's custom open() flag.  Default is O_RDWR.
254  * Change to O_RDONLY prior to d_open() if not updating
255  * the databases, if their permissions do not allow
256  * writing, if they're on cd-roms, etc.
257  * Not used internally for open functions that are known
258  * to require write permissions (eg initializations),
259  * or known to be read-only.
260  */
261 extern int db_oflag;
262
263 /* Use the 'const' keyword unless told otherwise */
264 #ifndef NO_CONST
265 #define CONST const
266 #else
267 #define CONST /**/
268 #endif
269
270 #ifndef GENERAL                 /* GENERAL lockmgr */
271 #ifdef MSC                      /* MSC */
272 #ifndef NO_EXT_KEYWORDS            /* NO_EXT_KEYWORDS */
273 #ifndef PASCAL                        /* PASCAL */
274 #define PASCAL pascal
275 #endif                                /* PASCAL */
276 #ifndef CDECL                         /* CDECL */
277 #define CDECL cdecl
278 #endif                                /* CDECL */
279 #endif                             /* NO_EXT_KEYWORDS */
280 #endif                          /* MSC */
281 #endif                          /* GENERAL lockmgr */
282
283 #ifndef FAR
284 #define FAR /**/
285 #endif
286
287 #ifndef PASCAL
288 #define PASCAL /**/
289 #endif
290
291 #ifndef CDECL
292 #define CDECL /**/
293 #endif
294
295 #define EXTERNAL_FIXED    FAR PASCAL
296 #define EXTERNAL_VARIABLE FAR CDECL
297 #define INTERNAL_FIXED    PASCAL
298 #define INTERNAL_VARIABLE CDECL
299
300 typedef int (FAR PASCAL *FARPROC)();
301 typedef char *HANDLE;
302
303 #ifdef NO_DBN_PARM
304 #ifdef DBN_IN_LIB
305 #define EXTERNAL_DBN EXTERNAL_VARIABLE
306 #else
307 #define EXTERNAL_DBN EXTERNAL_FIXED
308 #endif
309 #else
310 #define EXTERNAL_DBN EXTERNAL_VARIABLE
311 #endif
312
313 #define LOCK_DESC /**/
314 #define POINTER_INIT()          {  NULL  }
315 #define POINTER_ASSIGN(a)       {  a  }
316
317 typedef struct {char FAR *ptr; LOCK_DESC} CHAR_P;
318 typedef struct {DB_ADDR FAR *ptr; LOCK_DESC} DB_ADDR_P;
319 #ifdef MULTI_TASK
320 typedef struct {struct TASK_S FAR *ptr; LOCK_DESC} TASK_P;
321 typedef struct {char FAR *ptr; LOCK_DESC} QFAKE_P;
322 typedef struct {
323    TASK_P v;
324    QFAKE_P q;
325 } DB_TASK;
326 #endif
327
328
329 /* Allow for function prototyping */
330 #ifdef LINT_ARGS
331 #define P0      void    /* parameterless function */
332 #define P1(t)   t       /* first (or only) parameter in function */
333 #define Pi(t)   ,t      /* subsequent (2,3,...) parameter in function */
334 #ifdef ANSI
335 #define Piv(t)  ,...    /* begining of variable number of parameters */
336 #define Pv(t)   /**/    /* function has 0 or more parameters */
337 #else
338 #define Piv(t)  ,       /* [XENIX] begining of variable number of parameters */
339 #define Pv(t)   ,       /* [XENIX] function has 0 or more parameters */
340 #endif
341 #else
342 #define P0      /**/
343 #define P1(t)   /**/
344 #define Pi(t)   /**/
345 #define Piv(t)  /**/
346 #define Pv(t)   /**/
347 #endif
348
349 #ifdef  ONE_DB
350 #define NO_DBN
351 #endif
352
353 #ifdef NO_DBN_PARM 
354 #define NO_DBN
355 #endif
356
357 #ifndef NO_DBN
358 #define DBN_D1 Pv(int)
359 #define DBN_FIX_D1 P1(int)
360 #define DBN_Dn Piv(int)
361 #else
362 #define DBN_D1 P0
363 #define DBN_FIX_D1 /**/
364 #define DBN_Dn /**/
365 #endif
366
367 #ifdef MULTI_TASK
368 #define TASK_DBN_D1 P1(DB_TASK) DBN_Dn
369 #define TASK_D1 P1(DB_TASK)
370 #define TASK_Di Pi(DB_TASK)
371 #define TASK_PTR_D1 P1(DB_TASK FAR *)
372 #define TASK_PTR_Di Pi(DB_TASK FAR *)
373 #define CURRTASK_PARM            , Currtask
374 #define CURRTASK_ONLY            Currtask
375 #else
376 #define TASK_DBN_D1 DBN_D1
377 #define TASK_D1 P0
378 #define TASK_Di /**/
379 #define TASK_PTR_D1 P0
380 #define TASK_PTR_Di /**/
381 #define CURRTASK_PARM            /**/
382 #define CURRTASK_ONLY            /**/
383 #endif
384
385 #define LOCK_D1 /**/
386 #define LOCK_Di /**/
387
388 typedef struct {
389    int  item;  /* record or set number */
390    char type;  /* lock type: 'r', 'w', 'x', 'k' */
391 } LOCK_REQUEST;
392
393
394 #include "dproto.h"
395 #ifdef MULTI_TASK
396 #include "task.h"
397 #endif
398
399 /* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC vista.h */