vista.h 12 KB

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