📄 context.inc
字号:
;***
;context.inc
;
; Copyright <C> 1985, 1986, 1987 Microsoft Corporation
;
; NOTE: When making changes to this file, be sure to make equivalent
; changes to file CONTEXT.H
; NOTE: For comments, see file CONTEXT.H
;
;
;*******************************************************************************
CONTEXT_INC = -1 ;remember that this file has been included
IncludeOnce heap
IncludeOnce pointers
IncludeOnce sb
;**======================================================================**
;**== External Interface to Context Mgr Component ==**
;**======================================================================**
;**==================== text descriptor (TXD_) ============================
;
;Definition of text table descriptor. Both modules and procedures have
;text tables. All text-offset (otx...) fields in this descriptor are
;maintained by the text manager during edit operations, and by the scanner
;during pcode expansion/contraction.
;For all linked lists through the pcode, (otx...Link), the link is always
;a text offset to a pcode's 1st operand, NOT to the 1st byte of the pcode.
;This speeds up traversal of the list.
;
;=======================================================================*
TXD STRUC ;offset ;offset
TXD_bdlText_cbLogical DW 0 ;00 ;00
TXD_bdlText_seg DW 0 ;02 ;02
TXD_bdlText_dummy DW 0 ;04
TXD_bdlText_cPhysical DW 0 ;06 ;04
TXD_otxLabLink DW 0 ;08 ;06
TXD_otxDefTypeLink DW 0 ;0a ;08
TXD_otxTypeLink DW 0 ;0c ;0a
TXD_otxReParseLink DW 0 ;0e ;0c
TXD_cLines DW 0 ;10 ;0e
TXD_cLinesIncl DW 0 ;12 ;10
TXD_lnCursor DW 0 ;14 ;12
TXD_scanState DB 0 ;16 ;14
TXD_flags DB 0 ;17 ;15
TXD ENDS ;18 ;16
TXD_bdlText EQU TXD_bdlText_cbLogical
;Define place to keep address of compiled code
TXD_oCompiled EQU TXD_otxLabLink
TXD_segCompiled EQU TXD_otxDefTypeLink
TXD_bdlText_status equ TXD_bdlText_seg
FTX_mrs EQU 01H ;TRUE if text table is mrs, not prs
FTX_asChg EQU 02H ;TRUE if PreScanAsChg needs to be called
; before we scan this text table again
;The following FTX_Tmp... flags are used temporarily within the scope of
;SaveDeclares(). If another function needs to make temporary use of a flag,
;it can use these bits as well, as long as it assumes they contain garbage
;on entry and exit.
;
FTX_TmpDecl EQU 4 ;Used by SaveDeclares in text mgr.
FTX_TmpRef EQU 8 ;Used by SaveDeclares in text mgr.
;**==================== Procedure Register Set (PRS) =======================
;The there is a procedure register set for each SUB, DEF and FUNCTION in the
;program.
;
;For SUB's and FUNCTION's, there is only one procedure per name, regardless
;of FUNCTION type or module of definition.
;There is at most one DEF FN per module per type per name.
;FUNCTIONs and SUBs are global to the program. DEF FNs are local to a module.
;
;Prs's must exist whenever there is pcode (even if no variable tables
;exist), because pcode's contain references to entries.
;Prs's are used at runtime for procedure invocations for identifying
;the new module. Prs's are built only at the request of the parser/
;user-interface.
;
;While a procedure is loaded into prsCur, its entry in the Rs table
;should not be referenced or updated.
;==========================================================================
;Flag constants used with the PRS_flags byte, below
FP_STATIC EQU 80h
FP_CDECL EQU 40h
FP_DEFINED EQU 20h
FP_ENDPROC EQU 10h
FP_DECLARED EQU 08h
FP_DEFSCANNED EQU 04H
; Flag constants used with the PRS_flags2 byte, below
; NOTE: only flags 08H - 80H are available, as flags2 is overlaid over oType
FP_RefDeleted EQU 80h
FP_AUTO EQU 40h
FP_ExeTree EQU 20h
PRS STRUC
;Begin of zero fill
PRS_cbFrameVars DW 0 ;00
PRS_cbFrameTemp DW 0 ;02
PRS_ogNam DW 0 ;04 ;
PRS_procType DB 0 ;08
PRS_oType DB 0 ;09
PRS_flags DB 0 ;0a
PRS_cwParams DB 0 ;0b
;Begin of UNDEFINED fill
PRS_oVarHash DW 0 ;0c
PRS_oMrs DW 0 ;0e
PRS_oRsDef DW 0 ;10
PRS_otxDef DW 0 ;12
PRS_oPrsNext DW 0 ;14 ;
PRS_txd DB SIZE TXD DUP(0) ;16
PRS ENDS
PRS_flags2 EQU PRS_oType ; share this byte - - - low nibble
; is for oTyp, high nibble is flags
M_PT_OTYPE EQU 07H ;[20] mask to allow access to PRS_oType
;enumerations for PRS_procType:
PT_SUB EQU 1
PT_FUNCTION EQU 2
PT_DEFFN EQU 3
PT_NOT_PROC EQU 4
; eb api constants
;**==================== Module Register Set (MRS) ============================
;The Module Register Set either directly contains or is the owner of all
;information about a particular module.
;
;The global Rs table contains both prs's and mrs's, each linked together.
;Entries are not compressed, due to the number of structures that have offsets
;into this table.
;
;While a module is loaded into mrsCur, its entry in the global Rs table
;should not be referenced or updated.
;============================================================================**
OGNAM_UNNAMED EQU 0 ; ogNam for an unnamed mrs
OGNAM_GMRS EQU 1 ; an invalid ogNam to be used as
; the ogNam of the global mrs
OGNAM_CLIPBOARD EQU 2 ; ogNam for clipboard mrs
OGNAM_IMMEDIATE EQU 3 ; ognam for Immediate window
OGNAM_PSEUDO_MAX EQU 3 ; max psuedo ogNam value
OMRS_GLOBAL EQU 0
;Flag constants used with the MRS_flags byte, below
FM_OptionBase1 EQU 01h
FM_VARNEW EQU 02h
FM_asChg EQU 04h
FM_TEMPORARY EQU 08h
FM_AllSsRude EQU 10h
FM_LinksOk EQU 20H
FM_MustVisit EQU 40H
FM_Visited EQU 80H
;NOTE: all flags except FM_asChg get set to 0 by BinaryLoad().
; When adding flags, make sure this is desired
;Flag constants used with the MRS_flags2 byte, below. These are file related
FM2_Modified EQU 01h
FM2_NewFile EQU 02h
FM2_Include EQU 04h
FM2_NoPcode EQU 08h
FM2_File EQU 10h
FM2_AsciiLoaded EQU 20h
FM2_ReInclude EQU 40h
FM2_EntabSource EQU 80h
;NOTE: all flags except FM2_EntabSource get set to 0 by BinaryLoad().
; When adding flags, make sure this is desired
;Flag constants used with the MRS_flags3 byte, below.
FM3_NotFound EQU 01h
FM3_Translated EQU 04h
;NOTE: This flags are NOT saved by BinarySave/Load.
MRS STRUC
;Begin of zero fill
;------------------
MRS_cbFrameVars DW 0
MRS_cbFrameTemp DW 0
MRS_ogNam DW 0
MRS_bdVar DB SIZE BD DUP(0)
MRS_flags DB 0
MRS_flags2 DB 0
MRS_flags3 DB 0
MRS_dummy1 DB 0
;Begin of UNDEFINED fill
MRS_oMrsNext DW 0
MRS_otxHandler DW 0
MRS_bdlNam_cbLogical DW 0
MRS_bdlNam_seg DW 0
MRS_bdlNam_dummy DW 0
MRS_bdlNam_cPhysical DW 0
MRS_txd DB SIZE TXD DUP(0)
MRS_otxDefFnLink DW 0
MRS_oPastLastVar DW 0
MRS_data_otxFirst DW 0
MRS_data_otxCur DW 0
MRS_data_oLineCur DW 0
MRS ENDS
MRS_bdlNam EQU MRS_bdlNam_cbLogical
MRS_bdlNam_status equ MRS_bdlNam_seg
;**==================== Global Register Set (GRS) ========================
;The global register set owns heap entries which define the current context.
;
;Only one module table entry and procedure table entry may be active at any
;one time. A module table entry MUST be active, and a procedure entry MAY
;be active. These tables are managed by swapping a new mrs into mrsCur or
;swapping a new procedure into prsCur.
;
;While a module or procedure is loaded into mrsCur or prsCur, its entry
;in the global Rs table should not be referenced or updated.
;
;=======================================================================**
GRSTYPE STRUC
;Begin of zero fill ;QB5 EB
GRS_fScan DB 0 ;00 00
GRS_fDirect DB 0 ;01 01
GRS_bdRs DB SIZE BD DUP(0)
GRS_bdtComBlk DB SIZE BD DUP(0)
GRS_flags DB 0 ;0e 0c
GRS_filler DB 0 ;1f 0d
;Begin of UNDEFINED fill
GRS_oMrsMain DW 0 ;10 0e
GRS_oRsCur DW 0 ;12 10
GRS_pMrsCur DW 0
GRS_pRsCur DW 0
GRS_offsetTxdSeg DW 0 ;14 12
GRS_oMrsCur DW 0 ;16 14
GRS_oPrsCur DW 0 ;18 16
GRS_otxCur DW 0 ;1a 18
GRS_oRsCONT DW 0 ;1c 1a
GRS_otxCONT DW 0 ;1e 1c
GRS_oRsContTxtTbl DW 0 ;20 1e
GRS_bdlDirect_cbLogical DW 0 ;22 20
GRS_bdlDirect_seg DW 0 ;24 22
GRS_bdlDirect_dummy DW 0
GRS_bdlDirect_cPhysical DW 0 ;26 24
GRS_flagsDir DB 0 ;28 2a
GRSTYPE ENDS
GRS_bdlDirect EQU GRS_bdlDirect_cbLogical
GRS_bdlDirect_status equ GRS_bdlDirect_seg
;GRS_flags enumerations
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -