1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
9 mvl_init(MacroValidatorList
* out_pValidators
)
11 out_pValidators
->pFirst
= 0;
12 out_pValidators
->nextFreeIdentifier
= 1;
16 mvl_destruct(MacroValidatorList
* out_pValidators
)
18 MacroValidator
* pV
= out_pValidators
->pFirst
;
19 MacroValidator
* pDel
;
20 for ( pDel
= out_pValidators
->pFirst
;
26 pDel
->pMacro
->flag
&= (~ISACTIVE
);
32 #define INVALID_TILL_ENDOFROW 32000
34 /* If in_pTokenWhereMacroBecomesValid == 0, the macro is at row end
35 and therefore there does not exist any token, where the macro becomes
36 valid again. It is revalidated, when the row was processed complete.
39 mvl_add( MacroValidatorList
* inout_pValidators
,
41 Token
* in_pTokenWhereMacroBecomesValid
)
44 MacroValidator
* pNew
= new(MacroValidator
);
45 pNew
->pMacro
= in_pMacro
;
47 if (in_pTokenWhereMacroBecomesValid
== 0)
49 pNew
->nTokenWhereMacroBecomesValid
= INVALID_TILL_ENDOFROW
;
51 else if (in_pTokenWhereMacroBecomesValid
->identifier
> 0)
53 pNew
->nTokenWhereMacroBecomesValid
= in_pTokenWhereMacroBecomesValid
->identifier
;
57 pNew
->nTokenWhereMacroBecomesValid
= inout_pValidators
->nextFreeIdentifier
;
58 in_pTokenWhereMacroBecomesValid
->identifier
= inout_pValidators
->nextFreeIdentifier
;
59 inout_pValidators
->nextFreeIdentifier
++;
62 pNew
->pNext
= inout_pValidators
->pFirst
;
63 inout_pValidators
->pFirst
= pNew
;
67 mvl_check( MacroValidatorList
* inout_pValidators
,
68 Token
* inout_pTokenToCheck
)
70 MacroValidator
* pV
; /* Running pointer */
71 MacroValidator
* pCheckedOnes
; /* Here new list is built. */
74 for ( pV
= inout_pValidators
->pFirst
;
76 pV
= inout_pValidators
->pFirst
)
78 inout_pValidators
->pFirst
= pV
->pNext
;
80 if (pV
->nTokenWhereMacroBecomesValid
== inout_pTokenToCheck
->identifier
)
82 pV
->pMacro
->flag
&= (~ISACTIVE
);
87 pV
->pNext
= pCheckedOnes
;
92 /* Assign new built list (too old ones were removed) to
95 inout_pValidators
->pFirst
= pCheckedOnes
;
100 tokenrow_zeroTokenIdentifiers(Tokenrow
* trp
)
103 for (tp
= trp
->bp
; tp
< trp
->lp
; tp
++)
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */