Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
3.9 KiB

  1. //============== DAE: OS/2 Database Access Engine ===================
  2. //============== recint.h: Record Manager Internals ===================
  3. #define cbLVIntrinsicMost 1024
  4. #define cbRECRecordMost cbNodeMost - cbNullKeyData - JET_cbKeyMost
  5. // 4044 - 8 - 255 = 3781
  6. #define fidFixedLeast 1
  7. #define fidVarLeast 128
  8. #define fidTaggedLeast 256
  9. #define fidTaggedMost (0x7fff)
  10. #define fidFixedMost (fidVarLeast-1)
  11. #define fidVarMost (fidTaggedLeast-1)
  12. #define FFixedFid(fid) ((fid)<=fidFixedMost && (fid)>=fidFixedLeast)
  13. #define FVarFid(fid) ((fid)<=fidVarMost && (fid)>=fidVarLeast)
  14. #define FTaggedFid(fid) ((fid)<=fidTaggedMost && (fid)>=fidTaggedLeast)
  15. // Used to get offset from 2-byte VarOffset which includes null-bit
  16. #define ibVarOffset(ibVarOffs) ( (ibVarOffs) & 0x0fff)
  17. #define FVarNullBit(ibVarOffs) ( (ibVarOffs) & 0x8000)
  18. #define SetNullBit(ibVarOffs) ( (ibVarOffs) |= 0x8000)
  19. #define ResetNullBit(ibVarOffs) ( (ibVarOffs) &= 0x7fff)
  20. // Used to flip highest bit of signed fields when transforming.
  21. #define maskByteHighBit (1 << (sizeof(BYTE)*8-1))
  22. #define maskWordHighBit (1 << (sizeof(WORD)*8-1))
  23. #define maskDWordHighBit (1L << (sizeof(ULONG)*8-1))
  24. #define bFlipHighBit(b) ((BYTE)((b) ^ maskByteHighBit))
  25. #define wFlipHighBit(w) ((WORD)((w) ^ maskWordHighBit))
  26. #define ulFlipHighBit(ul) ((ULONG)((ul) ^ maskDWordHighBit))
  27. /* The following are disk structures -- so pack 'em
  28. /**/
  29. #pragma pack(1)
  30. /* long column id is big-endian long
  31. /**/
  32. typedef LONG LID;
  33. /* long value column in record format
  34. /**/
  35. typedef struct
  36. {
  37. BYTE fSeparated;
  38. union
  39. {
  40. LID lid;
  41. BYTE rgb[];
  42. };
  43. } LV;
  44. /* long value root data format
  45. /**/
  46. typedef struct
  47. {
  48. ULONG ulReference;
  49. ULONG ulSize;
  50. } LVROOT;
  51. #pragma pack()
  52. #define fIntrinsic (BYTE)0
  53. #define fSeparate (BYTE)1
  54. #define FFieldIsSLong( pb ) ( ((LV *)(pb))->fSeparated )
  55. #define LidOfLV( pb ) ( ((LV *)(pb))->lid )
  56. #define FlagIntrinsic( pb ) ( ((LV *)(pb))->fSeparated = fIntrinsic )
  57. #define FlagSeparate( pb ) ( ((LV *)(pb))->fSeparated = fSeparate )
  58. #define fLVReference 0
  59. #define fLVDereference 1
  60. #define ErrRECResetSLongValue( pfucb, plid ) \
  61. ErrRECAffectSeparateLV( pfucb, plid, fLVDereference )
  62. #define ErrRECReferenceLongValue( pfucb, plid ) \
  63. ErrRECAffectSeparateLV( pfucb, plid, fLVReference )
  64. #define ErrRECDereferenceLongValue( pfucb, plid ) \
  65. ErrRECAffectSeparateLV( pfucb, plid, fLVDereference )
  66. /* The following are disk structures -- so pack 'em
  67. /**/
  68. #pragma pack(1)
  69. // Record header (beginning of every data record)
  70. typedef struct _rechdr
  71. {
  72. BYTE fidFixedLastInRec; // highest fixed fid represented in record
  73. BYTE fidVarLastInRec; // highest var fid represented in record
  74. } RECHDR;
  75. // Structure imposed upon a tagged field occurance in a record
  76. typedef struct _tagfld
  77. {
  78. FID fid; // field id of occurance
  79. WORD cb; // length of following data
  80. BYTE rgb[]; // data (extends off the end of the structure)
  81. } TAGFLD;
  82. #pragma pack()
  83. ULONG UlChecksum( BYTE *pb, ULONG cb );
  84. ERR ErrRECChangeIndex( FUCB *pfucb, CHAR *szIndex );
  85. BOOL FRECIIllegalNulls( FDB *pfdb, LINE *plineRec );
  86. ERR ErrRECIRetrieve( FUCB *pfucb, FID *pfid, ULONG itagSequence, LINE *plineField, ULONG grbit );
  87. BOOL FOnCopyBuffer( FUCB *pfucb );
  88. ERR ErrRECIModifyField( FUCB *pfucb, FID fid, ULONG itagSequence, LINE *plineField );
  89. ERR ErrRECSetLongField(
  90. FUCB *pfucb,
  91. FID fid,
  92. ULONG itagSequence,
  93. LINE *plineField,
  94. JET_GRBIT grbit,
  95. LONG ibOffset,
  96. ULONG ulMax );
  97. ERR ErrRECRetrieveSLongField(
  98. FUCB *pfucb,
  99. LID lid,
  100. ULONG ibGraphic,
  101. BYTE *pb,
  102. ULONG cbMax,
  103. ULONG *pcbActual );
  104. ERR ErrRECDeleteLongFields( FUCB *pfucb, LINE *plineRecord );
  105. ERR ErrRECAffectLongFields( FUCB *pfucb, LINE *plineRecord, INT fAll );
  106. #define fSeparateAll (INT)0
  107. #define fReference (INT)1
  108. #define fDereference (INT)2
  109. #define fDereferenceRemoved (INT)3
  110. #define fDereferenceAdded (INT)4