Annotation of win32/sql/oracle/include/oci/sx3.h, revision 1.1
1.1 ! parser 1: /*
! 2: * $Header: /var/lib/cvsroot/parser3/parser3/src/sql/oracle/oracle32/include/oci/sx3.h,v 1.1 2001/08/22 14:02:20 parser Exp $
! 3: */
! 4:
! 5: /* Copyright (c) Oracle Corporation 1997, 1998, 1999. All Rights Reserved. */
! 6:
! 7: /*
! 8: NAME
! 9: sx3.h - System dependent eXternal definitions for disk data structures.
! 10: (Solaris version).
! 11:
! 12: DESCRIPTION
! 13: System dependent definitions and declarations used in all Oracle disk
! 14: data structures.
! 15:
! 16: RELATED DOCUMENTS
! 17:
! 18: INSPECTION STATUS
! 19: Inspection date:
! 20: Inspection status:
! 21: Estimated increasing cost defects per page:
! 22: Rule sets:
! 23:
! 24: ACCEPTANCE REVIEW STATUS
! 25: Review date:
! 26: Review status:
! 27: Reviewers:
! 28:
! 29: PUBLIC FUNCTIONS
! 30: None
! 31:
! 32: PRIVATE FUNCTIONS
! 33: None
! 34:
! 35: EXAMPLES
! 36: N/A
! 37:
! 38: NOTES
! 39:
! 40: This file contains system dependent definitions and declarations of
! 41: data types used in on-disk structures. On-disk structures should be
! 42: defined in separate header files and can only use data types defined
! 43: in this file. On-disk structures should not use any native types or
! 44: any other type not defined in this file (but defined in sx.h).
! 45:
! 46: Separating the definitions of on-disk data types allows us to keep
! 47: them compatible across different versions. The key purpose of this
! 48: file is to restrict the data types which can go on disk and to make sure
! 49: that their sizes remain the same across different versions.
! 50:
! 51: The -MAXVAL and -MINVAL constants represent the numerical range of
! 52: the relevant data type on the current port, i.e. the value of such
! 53: symbol may change from one port to another. The MIN-MAXVAL and
! 54: MAX-MINVAL constants represent the numerical range of the relevant
! 55: data type across all ports, i.e. the value of these should never be
! 56: changed by porters. Note that MAXSB1MINVAL is -127, instead of
! 57: -128, to support one's ** complement arithmetic architectures.
! 58:
! 59:
! 60: DEVELOPERS: This file has been created to separate all the valid
! 61: data types that can go on on-disk structures. All the types in
! 62: this file are guaranteed to be of the same size across different
! 63: versions, specifically while migrating from 32 bit to 64 bit.
! 64: This is very important to maintain the consistency of data on
! 65: the disk. All on-disk structures should be defined in separate
! 66: header files (*3.h) and *3.h can only include other *3.h header
! 67: files. New data types d*word, dptr_t, dboolean and dsize_t have been
! 68: defined to be used in place of *word, ptr_t, boolean and size_t. All
! 69: the existing references to *word, size_t, boolean and ptr_t in on-disk
! 70: structures have to be replaced with d*word, dsize_t, dboolean and
! 71: dptr_t as word, size_t, boolean and ptr_t could be of different sizes
! 72: in different versions. d*word, dsize_t, dboolean and dptr_t are currently
! 73: defined to have the same size as the existing type and are guaranteed to
! 74: remain the same size in all future versions, like in 64 bit versions.
! 75:
! 76: The d*word, dsize_t, dboolean and dptr_t data types should never be used in
! 77: any new data structures. Also dptr_t is defined as a non pointer type
! 78: to preserve the size. So it should never be used to store a pointer.
! 79: It is provided as a place holder to preserve the size of the structure.
! 80:
! 81: RELATED NOTE: Normal alignment macros like slalsu should never be used
! 82: for on-disk data types. You should use a new set of alignment macros
! 83: defined in sl.h. Instead of slalsu, slalsd, slalpu and slalpd you should
! 84: use sldalsu, sldalsd, sldalpu and sldalpd respectively.
! 85:
! 86:
! 87: PRODUCT LINE DEVELOPERS: This file is solaris specific and
! 88: product lines have to modify this file to reflect their platform. In
! 89: this file the datatypes eb1, ub1, sb1, eb2, ub2, sb2, eb4, ub4, sb4
! 90: must be defined so that they are always of same size for a
! 91: particular platform across different versions. For eg: In solaris
! 92: ub1, ub2, ub4 occupy 1, 2 and 4 bytes respectively. While porting to
! 93: different versions for solaris (say to 64 bit), porters have to make
! 94: sure that they always occupy 1,2 and 4 bytes. If the native data
! 95: type associated with these types are changed to preserve the sizes,
! 96: then literals MIN & MAXVALS have to be changed accordingly. While
! 97: porting to 64 bit, only the definitions of *b1,*b2 and *b4 can be
! 98: changed to preserve their sizes. All other datatypes must not be
! 99: changed.
! 100:
! 101: dword, dsize_t, dboolean and dptr_t are defined to provide backward
! 102: compatibility with word, size_t, boolean and ptr_t. Their definitions
! 103: must be set such that their size is the same as existing word, size_t,
! 104: boolean and ptr_t and should never be changed in the future. For example
! 105: in solaris ptr_t (defined as void *) has the same size as unsigned long
! 106: which is 4 bytes. So dptr_t is defined as ub4 and as ub4's size will
! 107: be constant in the future so will be dsize_t's size. The definition
! 108: of d* should never be changed once they have been defined for a
! 109: particular product line.
! 110:
! 111: MODIFIED (MM/DD/YY)
! 112: tsaulys 02/10/99 - move obsolete types and macros
! 113: dcolello 08/25/98 - WIN32COMMON: port
! 114: kkarun 08/14/98 - Rollback 667803
! 115: tsaulys 07/31/98 - do not use text for C++ (when LUSEMFC defined)
! 116: skabraha 05/08/98 - no more 1's complement support
! 117: skabraha 04/17/98 - changing xb4 to int
! 118: skabraha 01/27/98 - adding M_IDEN and SLMXFNMLEN
! 119: skabraha 10/28/97 - Defining some datatypes to garbage
! 120: skabraha 10/16/97 - Creation
! 121:
! 122:
! 123: */
! 124:
! 125:
! 126: #ifndef SX3_ORACLE
! 127: #define SX3_ORACLE
! 128:
! 129: #ifndef ORALIMITS
! 130: # include <limits.h>
! 131: # define ORALIMITS
! 132: #endif /* !ORALIMITS */
! 133:
! 134: /*
! 135: ** Note: this is the WIN32COMMON version of sx3.h. Always make sure that
! 136: ** WIN32COMMON is defined. It is not defined yet if this file is included
! 137: ** first for whatever reason.
! 138: */
! 139: #ifndef WIN32COMMON
! 140: #define WIN32COMMON
! 141: #endif
! 142:
! 143: #ifdef WIN32COMMON
! 144: /* make sure stdlib.h is included to avoid warning with max()/min() macros */
! 145: #ifndef ORASTDLIB
! 146: # include <stdlib.h>
! 147: # define ORASTDLIB
! 148: #endif
! 149: #endif /* WIN32COMMON */
! 150:
! 151:
! 152: /* All references to size_t has to be replaced with dsize_t. size_t should not
! 153: * be used in any disk structures. To enforce this size_t is defined to
! 154: * an invalid type here. It is redefined to a valid type in sx.h from the
! 155: * included file stddef.h.
! 156: */
! 157:
! 158: #ifdef size_t
! 159: # undef size_t
! 160: #endif /* size_t */
! 161:
! 162:
! 163: #define size_t size_t_may_not_be_used_here
! 164:
! 165: /* As olint accepts most of the datatypes on its own here we are #defining
! 166: * the unwanted data types to garbage to catch its usage. These will be
! 167: * #undefed in the beginning of sx.h.
! 168: */
! 169:
! 170: #ifndef SX3_GARBAGE_DEFS
! 171: # define SX3_GARBAGE_DEFS
! 172:
! 173: # define uword uword_may_not_be_used_here
! 174: # define sword sword_may_not_be_used_here
! 175: # define ubig_ora ubig_ora_may_not_be_used_here
! 176: # define sbig_ora sbig_ora_may_not_be_used_here
! 177: # define ub8 ub8_may_not_be_used_here
! 178: # define sb8 sb8_may_not_be_used_here
! 179: # ifndef WIN32COMMON
! 180: # define boolean boolean_may_not_be_used_here
! 181: # else /* WIN32COMMON */
! 182: # undef boolean
! 183: # endif /* WIN32COMMON */
! 184: # define ptr_t ptr_t_may_not_be_used_here
! 185:
! 186: #endif /* SX3_GARBAGE_DEFS */
! 187:
! 188: /**-------------------------------------------------------------------------**/
! 189: /** DATA TYPE DEFINITIONS **/
! 190: /**-------------------------------------------------------------------------**/
! 191:
! 192: /* We #define while linting as lint complains while casting between
! 193: * two datatypes which have been typedefed to compatible types.
! 194: */
! 195:
! 196: /* xb1 definitions. xb1 will be exactly one byte - at least 8 bits,
! 197: * possibly more. sizeof(ub1) is guaranteed to be 1
! 198: */
! 199:
! 200: #ifndef lint
! 201: typedef unsigned char ub1; /* use where unsigned important */
! 202: typedef signed char sb1; /* use where signed important */
! 203: #else
! 204: #define ub1 unsigned char
! 205: #define sb1 signed char
! 206: #endif /* LINT */
! 207:
! 208: #define UB1MAXVAL ((ub1)UCHAR_MAX)
! 209: #define UB1MINVAL ((ub1) 0)
! 210: #define SB1MAXVAL ((sb1)SCHAR_MAX)
! 211: #define SB1MINVAL ((sb1)SCHAR_MIN)
! 212: #define MINUB1MAXVAL ((ub1) 255)
! 213: #define MAXUB1MINVAL ((ub1) 0)
! 214: #define MINSB1MAXVAL ((sb1) 127)
! 215: #define MAXSB1MINVAL ((sb1) -127)
! 216:
! 217:
! 218: /* xb2 definitions. xb2 will be atleast 2 bytes, possible more */
! 219:
! 220: #ifndef lint
! 221: typedef unsigned short ub2; /* use where unsigned important */
! 222: typedef signed short sb2; /* use where signed important */
! 223: #else
! 224: #define ub2 unsigned short
! 225: #define sb2 signed short
! 226: #endif /* LINT */
! 227:
! 228: #define UB2MAXVAL ((ub2)USHRT_MAX)
! 229: #define UB2MINVAL ((ub2) 0)
! 230: #define SB2MAXVAL ((sb2) SHRT_MAX)
! 231: #define SB2MINVAL ((sb2) SHRT_MIN)
! 232: #define MINUB2MAXVAL ((ub2) 65535)
! 233: #define MAXUB2MINVAL ((ub2) 0)
! 234: #define MINSB2MAXVAL ((sb2) 32767)
! 235: #define MAXSB2MINVAL ((sb2)-32767)
! 236:
! 237:
! 238: /* xb4 definitions. xb4 will be atleast 4 bytes, possibly more */
! 239:
! 240: #ifndef lint
! 241: typedef unsigned int ub4; /* use where unsigned important */
! 242: typedef signed int sb4; /* use where signed important */
! 243: #else
! 244: #define ub4 unsigned int
! 245: #define sb4 signed int
! 246: #endif /* LINT */
! 247:
! 248: #define UB4MAXVAL ((ub4)UINT_MAX)
! 249: #define UB4MINVAL ((ub4) 0)
! 250: #define SB4MAXVAL ((sb4) INT_MAX)
! 251: #define SB4MINVAL ((sb4) INT_MIN)
! 252: #define MINUB4MAXVAL ((ub4) 4294967295)
! 253: #define MAXUB4MINVAL ((ub4) 0)
! 254: #define MINSB4MAXVAL ((sb4) 2147483647)
! 255: #define MAXSB4MINVAL ((sb4)-2147483647)
! 256:
! 257:
! 258: /* number of bits in a byte */
! 259: #define UB1BITS CHAR_BIT
! 260: #define UB1MASK ((1 << ((uword)CHAR_BIT)) - 1)
! 261:
! 262: /* This definition has been moved from s.h as it is used by on-disk
! 263: * data structures. The macros for bitvec are in s.h.
! 264: */
! 265: typedef ub1 bitvec;
! 266:
! 267: /* BITVEC - to size bitvec arrays */
! 268: #define BITVEC(n) (((n)+(UB1BITS-1))>>3)
! 269:
! 270: /* human readable (printable) characters. oratext should always be one byte */
! 271: /*
! 272: * Update for C++ design: change text to oratext
! 273: * typedef unsigned char text;
! 274: */
! 275:
! 276: #ifdef lint
! 277: # define oratext unsigned char
! 278: #else
! 279: typedef unsigned char oratext;
! 280: #endif
! 281:
! 282: /* macros defining min & max */
! 283:
! 284: #ifdef WIN32COMMON
! 285: #ifndef max
! 286: #define max(x, y) (((x) < (y)) ? (y) : (x))
! 287: #endif
! 288: #else
! 289: #define max(x, y) (((x) < (y)) ? (y) : (x))
! 290: #endif
! 291: #define min(x, y) (((x) < (y)) ? (x) : (y))
! 292:
! 293: /**-------------------------------------------------------------------------**/
! 294: /** ALTERNATE DATA TYPES FOR THOSE OBSOLETED FOR ON_DISK DATA STRUCTURES **/
! 295: /**-------------------------------------------------------------------------**/
! 296:
! 297: /* Developers should replace all existing references to *word, ptr_t, boolean
! 298: * and size_t in disk data structures with d*word, dptr_t, dboolean and
! 299: * dsize_t respectively. These types are guaranteed to be of the same size
! 300: * across different versions on a platform.
! 301: *
! 302: * d*word, dsize_t, dboolean and dptr_t should never be used in new data structures.
! 303: * They should only be used to preserve the sizes of existing data
! 304: * structures.
! 305: *
! 306: * WARNING: dptr_t has been defined to be a non-pointer datatype so that we
! 307: * can guarantee that the size remains same!!!
! 308: */
! 309:
! 310:
! 311: /* PRODUCT LINE DEVELOPERS: Change this typedef to a type which has the
! 312: * same size as the current size of *word in your platform. Once the size
! 313: * of d*word has been defined, it should always be of the same size in
! 314: * all future versions (irrespective of the size of *word in later versions)
! 315: *
! 316: * For example in Solaris uword is defined as having 4 bytes. Hence d*word is
! 317: * defined as *b4. This definition will NOT be changed in the future, thus
! 318: * preserving the size.
! 319: */
! 320:
! 321: /* deword is defined as eb4. As ebx is defined later in the obselete section
! 322: * the definition of deword was moved there.
! 323: */
! 324:
! 325: #ifndef lint
! 326: typedef ub4 duword;
! 327: typedef sb4 dsword;
! 328: /* word is an obselete datatype. But it still needs to be changed to dword */
! 329: typedef dsword dword;
! 330:
! 331: #else
! 332: #define duword ub4
! 333: #define dsword sb4
! 334: #define dword dsword
! 335: #endif /*LINT */
! 336:
! 337: #define DUWORDMAXVAL UB4MAXVAL
! 338: #define DUWORDMINVAL UB4MINVAL
! 339: #define DSWORDMAXVAL SB4MAXVAL
! 340: #define DSWORDMINVAL SB4MINVAL
! 341: #define MINDUWORDMAXVAL MINUB4MAXVAL
! 342: #define MAXDUWORDMINVAL MAXUB4MINVAL
! 343: #define MINDSWORDMAXVAL MINSB4MAXVAL
! 344: #define MAXDSWORDMINVAL MAXSB4MINVAL
! 345: #define DWORDMAXVAL DSWORDMAXVAL
! 346: #define DWORDMINVAL DSWORDMINVAL
! 347:
! 348:
! 349:
! 350: /* PRODUCT LINE DEVELOPERS: Change this typedef to a type which has the
! 351: * same size as the current size of size_t in your platform. Once the size
! 352: * of dsize_t has been defined, it should always be of the same size in all
! 353: * future versions (irrespective of the size of size_t in later versions)
! 354: *
! 355: * For example in Solaris size_t is defined as unsigned int which is
! 356: * the same as ub4. Hence it is defined as ub4.
! 357: */
! 358:
! 359: #ifndef lint
! 360: typedef ub4 dsize_t;
! 361: # else
! 362: # define dsize_t ub4
! 363: #endif /*LINT */
! 364:
! 365: # define DSIZE_TMAXVAL UB4MAXVAL
! 366: # define MINDSIZE_TMAXVAL (dsize_t)65535
! 367:
! 368:
! 369: /* PRODUCT LINE DEVELOPERS: Change this typedef to a type which has the
! 370: * same size as the current size of boolean in your platform. Once the size
! 371: * of dboolean has been defined, it should always be of the same size in all
! 372: * future versions (irrespective of the size of boolean in later versions)
! 373: *
! 374: * For example in Solaris boolean is defined as int which is 4 bytes. Hence
! 375: * dboolean is defined as sb4.
! 376: */
! 377:
! 378: #ifndef lint
! 379: typedef sb4 dboolean;
! 380: # else
! 381: # define dboolean sb4
! 382: #endif /*LINT */
! 383:
! 384:
! 385: /*
! 386: * PRODUCT LINE DEVELOPERS: Change this typedef to a type which has the
! 387: * same size as the size of ptr_t in the existing version. Once the size of
! 388: * dptr_t has been defined it should always be of the same size in all future
! 389: * versions, irrrespective of the size of ptr_t in later versions.
! 390: *
! 391: * For example in Solaris the pointer is a 4 byte quantity and hence dptr_t
! 392: * is defined as ub4.
! 393: *
! 394: * WARNING! dptr_t has been defined to be a non-pointer datatype so that
! 395: * we can guarantee that the size remains same! So it should never be used
! 396: * to store a pointer. It should only be used as a place holder to preserve
! 397: * the size of the structure.
! 398: */
! 399:
! 400:
! 401: #ifndef lint
! 402: typedef ub4 dptr_t;
! 403: #else
! 404: #define dptr_t ub4
! 405: #endif /* lint */
! 406:
! 407:
! 408: /* SLMXFNMLEN: Maximum file name length */
! 409: #ifdef AIXRIOS
! 410: # define SLMXFNMLEN 256
! 411: #else
! 412: # define SLMXFNMLEN 512
! 413: #endif /* AIXRIOS */
! 414:
! 415:
! 416: /**-------------------------------------------------------------------------**/
! 417: /** OBSOLETE DATA TYPES **/
! 418: /**-------------------------------------------------------------------------**/
! 419:
! 420: /* OBSOLETE: The following data types have been obsoleted. They should
! 421: * not be used in any new code. Types word, b1, b2, & b4 were
! 422: * considered to be synonyms of eword, eb1, eb2 & eb4, but which
! 423: * actually had to be implemented as sword, sb1, sb2, & sb4 for
! 424: * backward compatibility of old code.
! 425: */
! 426:
! 427: /* ebx definitions */
! 428:
! 429: #ifndef lint
! 430: typedef char eb1;
! 431: typedef short eb2;
! 432: typedef int eb4;
! 433: typedef eb4 deword;
! 434: #else
! 435: # define eb1 char
! 436: # define eb2 short
! 437: # define eb4 int
! 438: # define deword eb4
! 439: #endif
! 440:
! 441: #define EB1MAXVAL ((eb1)SCHAR_MAX)
! 442: #define EB1MINVAL ((eb1) 0)
! 443: #define MINEB1MAXVAL ((eb1) 127)
! 444: #define MAXEB1MINVAL ((eb1) 0)
! 445: #define EB2MAXVAL ((eb2) SHRT_MAX)
! 446: #define EB2MINVAL ((eb2) 0)
! 447: #define MINEB2MAXVAL ((eb2) 32767)
! 448: #define MAXEB2MINVAL ((eb2) 0)
! 449: #define EB4MAXVAL ((eb4) INT_MAX)
! 450: #define EB4MINVAL ((eb4) 0)
! 451: #define MINEB4MAXVAL ((eb4) 2147483647)
! 452: #define MAXEB4MINVAL ((eb4) 0)
! 453: #define DEWORDMAXVAL EB4MAXVAL
! 454: #define DEWORDMINVAL EB4MINVAL
! 455: #define MINDEWORDMAXVAL MINEB4MAXVAL
! 456: #define MAXDEWORDMINVAL MAXEB4MINVAL
! 457:
! 458:
! 459: /* bx definitions */
! 460:
! 461: #ifndef lint
! 462: typedef sb1 b1;
! 463: #else
! 464: #define b1 sb1
! 465: #endif /* lint */
! 466: #define B1MAXVAL SB1MAXVAL
! 467: #define B1MINVAL SB1MINVAL
! 468:
! 469: #ifndef lint
! 470: typedef sb2 b2;
! 471: #else
! 472: #define b2 sb2
! 473: #endif /* lint */
! 474: #define B2MAXVAL SB2MAXVAL
! 475: #define B2MINVAL SB2MINVAL
! 476:
! 477: #ifndef lint
! 478: typedef sb4 b4;
! 479: #else
! 480: #define b4 sb4
! 481: #endif /* lint */
! 482: # define B4MAXVAL SB4MAXVAL
! 483: # define B4MINVAL SB4MINVAL
! 484:
! 485:
! 486: #ifndef uiXT
! 487: /* Since the use of BITS16 and BITS32 conflict with X Windows definitions, */
! 488: /* they need to disappear when Xt-based toolkits are being compiled. */
! 489:
! 490: /* OBSOLETE: BITS8/16/32 are synonyms of ub1/2/4, which are preferred */
! 491: typedef ub1 BITS8; /* Can hold 8 bits */
! 492: typedef ub2 BITS16; /* Can hold 16 bits */
! 493: typedef ub4 BITS32; /* Can hold 32 bits */
! 494: #endif /* uiXT */
! 495:
! 496: /* OBSOLETE: For C++ users who are using Microsoft Foundation Classes, the
! 497: * obsolete Oracle type text conflicts with a reserved keyword. If LUSEMFC is
! 498: * defined, the Oracle definition of text is not used.
! 499: */
! 500: #if !defined(LUSEMFC)
! 501: # ifdef lint
! 502: # define text unsigned char
! 503: # define OraText unsigned char
! 504: # else
! 505: typedef oratext text;
! 506: typedef oratext OraText;
! 507: # endif /* lint */
! 508: #endif /* !LUSEMFC */
! 509:
! 510: /* OBSOLETE:
! 511: ** M_IDEN - maximum identifier size
! 512: **
! 513: ** This constant is generic, and should NEVER be changed.
! 514: */
! 515: #define M_IDEN 30
! 516:
! 517:
! 518: #endif /* SX3_ORACLE */
! 519:
! 520:
E-mail: