variable.h
上传用户:xiaoan1112
上传日期:2013-04-11
资源大小:19621k
文件大小:8k
源码类别:

操作系统开发

开发平台:

Visual C++

  1. /*** 
  2. * Variable.h - QB5-specific type definitions and data for the Variable Manager
  3. *
  4. * Copyright <C> 1985, 1986, 1987 Microsoft Corporation
  5. *
  6. *******************************************************************************/
  7. #undef VARIABLE_H /* it will have been defined as 0 in switch.h */
  8. #define VARIABLE_H -1 /* to prevent duplicate #include's */
  9. /* Array Descriptor definition */
  10. typedef struct dm {
  11. ushort cElements; /* Count of elements for this dimension */
  12. ushort iLbound; /* Lower bound of this dimension */
  13. } dm;
  14. typedef struct ad {
  15. char far *pData; /* Address of data */
  16. ushort pNext;
  17. ushort cPhysical;
  18. uchar cDims; /* Count of dimensions of the array */
  19. char fFeatures; /* For future features that impact the ad */
  20. ushort oAdjusted; /* Adjusted offset */
  21. ushort cbElement; /* Size of a single array element */
  22. char tDM; /* First byte of Dimension specific information */
  23. } ad;
  24. /* fFeatures flag definitions */
  25. #define FADF_STATIC 0x40 /* Array is a $STATIC array */
  26. #define FADF_SD 0x80 /* Array is a string array */
  27. /* Common Block entry */
  28. /* NOTE: code exists (in context.asm) to adjust backpointers in grs.bdtPrs,
  29. grs.bdtMrs, or grs.bdtComBlk - - - one piece of code handles all
  30. three table types, and counts on the fact that the entry types
  31. for the latter two tables have 3 bd's, bdtPrs has a single bd, and 
  32. that these bd's are adjacent, and at the beginning of the entry.
  33. This code is also written to make a special check which assumes
  34. bdValue is the last bd in this structure. */
  35. typedef struct com {
  36. ushort ogNam; /* [5] This is the name of the common data block.
  37.    [5] In the case of unnamed common, this field
  38.    [5] contains a 0.       */
  39. bd bdType;  /* This is the owner field for the type block,
  40.    which has entries for all the values. For
  41.    format of this table, see ..idcommon.doc    */
  42. bd bdValue; /* This is the owner field for the data block,
  43.    which holds the actual values of common
  44.    variables    */
  45. ushort oTypCur;  /* Current offset into type table  */
  46. ushort oValCur;  /* Current offset into value table */
  47. } com;
  48. /* value part of a scaler COMMON variable */
  49. typedef struct comRef {
  50. ushort oCommon; /* Offset into table of COMMON blocks if fCommon  */
  51. ushort oValue; /* Offset into COMMON block oCommon  */
  52. } comRef;
  53. /* value part of a COMMON array variable */
  54. typedef struct aCom {
  55. ushort oCommon;   // Offset into table of COMMON blocks if fCommon
  56. uchar cDims;    // Dimension count - set by varmgr at var creation
  57. uchar filler1;
  58. ushort oValue;    // Offset into COMMON block oCommon
  59. } aCom;
  60. #if !VARMGR_H
  61. #include "varmgr.h" /* include generic QB .h file */
  62. #endif
  63. #define VAR_INIT_SIZE 10 /* number of bytes to initially grow var table by 
  64. when creating a new entry - - - a large number
  65. lowers the number of vars the user can add and 
  66. still continue, a small number increase the
  67. chance that the initial request will ultimately
  68. be too small */
  69. #define ONamOf(pVar) *((ushort *)((char *)pVar + VAR_oNam))
  70. #define OHashLinkOf(pVar) *((ushort *)((char *)pVar + VAR_oHashLink))
  71. #define FlagsOf(pVar) *((ushort *)((char *)pVar + VAR_flags))
  72. #define ValueOf(pVar,valType) ((val *)((char *)pVar + VAR_value))->valType
  73. #define OTypOf(pVar) (FlagsOf(pVar) & 0x07 ? 
  74. FlagsOf(pVar) & 0x07 : 
  75. *((ushort *)((char *)pVar + VAR_oTyp)))
  76. /* flag constants used for the flags word in the above (var) structure
  77. NOTE: These flags overlap with another set of flag constants defined below;
  78. Do not change these without changing equiv.s (of the same name) below.
  79. */
  80. #define FV_STATIC 0x01   /* TRUE implies array is $STATIC array */
  81. #define FV_TYP_MASK 0x07  /* used to mask off all but oTyp bits from flags */
  82. #define FVFUN 0x0008 /* FUNCTION - DEF FN or a FUNCTION */
  83. #define FVCOMMON 0x0010 /* COMMON variable                           */
  84. #define FVSTATIC 0x0020 /* variable used in a STATIC statement */
  85. #define FVSHARED 0x0040 /* If entry in a tPV, value is an oMV, else ... */
  86. #define FVFORMAL 0x0080 /* TRUE if var is a procedure formal */
  87. #define FV_STATICSET 0x0100 /* TRUE implies $STATIC flag set (in oHashLink) */
  88. #define FVEVEREXPLICIT 0x0200 /* TRUE if var was EVER referenced explicitly */
  89. #define FVARRAY 0x0400 /* Variable is an array */
  90. #define FVINDEXED 0x0800 /* TRUE if var name was followed with a '(' */
  91. #define FVVALUESTORED 0x1000 /* TRUE if actual value is stored in entry; if
  92.  FALSE, value is an oMV or an oFrame */
  93. #define FVDECLDVAR 0x2000 /* TRUE if var was explicitly declared */
  94. #define FVREDIRECT 0x4000 /* TRUE if there's likely an old oVar in pcode */
  95. #define FVCONST 0x8000 /* TRUE if defining a CONSTant */
  96. /* Global inputs and outputs to the MakeVariable routine. 
  97. The constants given below are used with the global mkVar.flags
  98. NOTE: These flags overlap with another set of flag constants defined above;
  99. Do not change these without changing equiv.s (of the same name) above.
  100. */
  101. #define FVFUNCTION 0x0008 /* TRUE if in a FUNCTION definition or declare */
  102. #define FVCOMMON 0x0010 /* TRUE if input is from a COMMON declaration */
  103. #define FVSTATIC 0x0020 /* TRUE if input is from a STATIC statement */
  104. #define FVSHARED 0x0040 /* TRUE if SHARED keyword associated with var */
  105. #define FVFORMAL 0x0080 /* TRUE if a formal in a proc def. or declare */
  106. #define FVIMPLICIT 0x0100 /* TRUE if user didn't explicitly type variable
  107. NOTE: This is NOT an input; it's set
  108. by MakeVariable as if it were */
  109. #define FVLVAL 0x0200 /* TRUE if on left side, or in INPUT, READ stmt */
  110. #define FVFORCEARRAY 0x0400 /* TRUE if input variable is DEFINITLY an array */
  111. #define FVINDEXED 0x0800 /* TRUE if input could be an array or Function */
  112. #define FVDIM     0x1000 /* TRUE if input found in a DIM statement */
  113. #define FVASCLAUSE 0x2000 /* TRUE if var type declared via an AS clause */
  114. #define FVFNNAME 0x4000 /* TRUE if var name is of the form FNxxxx. 
  115. NOTE: This is NOT an input; it's set 
  116. by MakeVariable as if it were */
  117. #define FVCONST 0x8000 /* TRUE if var entry is for a CONSTant */
  118. /*  Global inputs and outputs to the MakeVariable routine.
  119.     The below constants match existing FV constants (above), and are
  120.     present to allow parser and rude scanner changes go in without switches.
  121. */
  122. #define FVI_FUNCTION 0x0008 /* [2] */
  123. #define FVI_COMMON 0x0010 /* [2] */
  124. #define FVI_STATIC 0x0020 /* [2] */
  125. #define FVI_SHARED 0x0040 /* [2] */
  126. #define FVI_FORMAL 0x0080 /* [2] */
  127. #define FVI_IMPLICIT 0x0100 /* [2] */
  128. #define FVI_LVAL 0x0200 /* [2] */
  129. #define FVI_ARRAY 0x0400 /* [2] */
  130. #define FVI_INDEXED 0x0800 /* [2] */
  131. #define FVI_DIM     0x1000 /* [2] */
  132. #define FVI_ASCLAUSE 0x2000 /* [2] */
  133. #define FVI_FNNAME 0x4000 /* [2] */
  134. #define FVI_CONST 0x8000 /* [2] */
  135. /*
  136. oTypComMax and oValComMax are used by the scanner to trim
  137. a BLANK common block during a CHAIN.  They are initially
  138. 0, and get set to the max by the scanner.  They are reset
  139. by ResetCommon, and the txtmgr calls SsTrimCommon to trim
  140. back the block at the end of SystemScan. */
  141. extern ushort oTypComMax; /* Max oTyp for all BLANK Common declarations */
  142. extern ushort oValComMax; /* Max oVal for all BLANK Common declarations */
  143. ushort FAR  MakeCommon(ushort);
  144. VOID NEAR ClearCommon(VOID);
  145. VOID NEAR ResetCommon(VOID);
  146. /* Non-RELEASE support, used with vardebug.c */