@@ -567,7 +567,7 @@ TIdentifier = record
567567 NumDefines: integer = 1 ; // NumDefines = AddDefines
568568
569569 NumTok, NumIdent, NumTypes, NumPredefIdent, NumStaticStrChars, NumUnits, NumBlocks, NumProc,
570- BlockStackTop, CodeSize, CodePosStackTop, BreakPosStackTop, VarDataSize , Pass, ShrShlCnt,
570+ BlockStackTop, CodeSize, CodePosStackTop, BreakPosStackTop, _VarDataSize , Pass, ShrShlCnt,
571571 NumStaticStrCharsTmp, AsmBlockIndex, IfCnt, CaseCnt, IfdefLevel, run_func: Integer;
572572
573573 iOut: integer = -1 ;
@@ -675,12 +675,64 @@ TIdentifier = record
675675
676676 function StrToInt (const a: string): Int64;
677677
678+ type TTokenIndex = Integer;
679+ procedure IncVarDataSize (const tokenIndex: TTokenIndex; const size: Integer);
680+
681+ function GetVarDataSize : Integer;
682+ procedure SetVarDataSize (const tokenIndex: TTokenIndex; const size: Integer);
683+
684+ var TraceFile: TextFile;
685+ procedure LogTrace (message: String);
686+
678687// ----------------------------------------------------------------------------
679688
680689implementation
681690
682691uses SysUtils, Messages;
683692
693+ procedure LogTrace (message: String);
694+ begin
695+ { $IFDEF USETRACEFILE}
696+ Writeln(traceFile, message);
697+ { $ENDIF}
698+ end ;
699+
700+ // ----------------------------------------------------------------------------
701+ // ----------------------------------------------------------------------------
702+
703+ function GetVarDataSize : Integer;
704+ begin
705+ Result := _VarDataSize;
706+ end ;
707+
708+
709+ procedure SetVarDataSize (const tokenIndex: TTokenIndex; const size: Integer);
710+ var token: TToken;
711+ // var GetSourceFileLocationString: String;
712+
713+ begin
714+ _VarDataSize := size;
715+ token:= Tok[tokenIndex];
716+
717+ (*
718+ GetSourceFileLocationString := UnitName[ token.UnitIndex].Path;
719+
720+ if (token.line>0) then
721+ begin
722+ GetSourceFileLocationString:=GetSourceFileLocationString+ ' ( line ' + IntToStr(token.Line) + ', column ' + IntToStr(token.Column) + ')';
723+ end;
724+
725+
726+ // LogTrace(Format('SetVarDataSize: TokenIndex=%d: %s %s VarDataSize=%d', [tokenIndex, GetSourceFileLocationString,'TODO', _VarDataSize]));
727+ *)
728+ end ;
729+
730+
731+ procedure IncVarDataSize (const tokenIndex: TTokenIndex; const size: Integer);
732+ begin
733+ SetVarDataSize(tokenIndex, _VarDataSize + size);
734+ end ;
735+
684736// ----------------------------------------------------------------------------
685737
686738
0 commit comments