Skip to content

Commit c0481f8

Browse files
authored
Merge pull request #218 from peterdell/way2js4
Way2js4 - Minimize differences to origin
2 parents 1c93a51 + 343a1dd commit c0481f8

18 files changed

+22187
-19132
lines changed

origin/Common.pas

Lines changed: 833 additions & 787 deletions
Large diffs are not rendered by default.

origin/Diagnostic.pas

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
Unit Diagnostic;
1+
unit Diagnostic;
22

33
interface
44

55
{$i define.inc}
66

77
// ----------------------------------------------------------------------------
88

9-
procedure Diagnostics;
9+
procedure Diagnostics;
1010

1111
// ----------------------------------------------------------------------------
1212

@@ -18,11 +18,12 @@ implementation
1818

1919

2020
procedure Diagnostics;
21-
var i, CharIndex, ChildIndex: Integer;
22-
DiagFile: textfile;
21+
var
22+
i, CharIndex, ChildIndex: Integer;
23+
DiagFile: textfile;
2324
begin
2425

25-
AssignFile(DiagFile, ChangeFileExt( UnitName[1].Name, '.txt') );
26+
AssignFile(DiagFile, ChangeFileExt(UnitName[1].Name, '.txt'));
2627
Rewrite(DiagFile);
2728

2829
WriteLn(DiagFile);
@@ -32,52 +33,58 @@ procedure Diagnostics;
3233
WriteLn(DiagFile);
3334

3435
for i := 1 to NumTok do
35-
begin
36+
begin
3637
Write(DiagFile, i: 6, UnitName[Tok[i].UnitIndex].Name: 30, Tok[i].Line: 6, GetSpelling(i): 30);
3738
if Tok[i].Kind = INTNUMBERTOK then
3839
WriteLn(DiagFile, ' = ', Tok[i].Value)
3940
else if Tok[i].Kind = FRACNUMBERTOK then
40-
WriteLn(DiagFile, ' = ', Tok[i].FracValue: 8: 4)
41-
else if Tok[i].Kind = IDENTTOK then
42-
WriteLn(DiagFile, ' = ', Tok[i].Name^)
43-
else if Tok[i].Kind = CHARLITERALTOK then
44-
WriteLn(DiagFile, ' = ', Chr(Tok[i].Value))
45-
else if Tok[i].Kind = STRINGLITERALTOK then
46-
begin
47-
Write(DiagFile, ' = ');
48-
for CharIndex := 1 to Tok[i].StrLength do
49-
Write(DiagFile, StaticStringData[Tok[i].StrAddress - CODEORIGIN + (CharIndex - 1)]);
50-
WriteLn(DiagFile);
51-
end
52-
else
53-
WriteLn(DiagFile);
54-
end;// for
41+
WriteLn(DiagFile, ' = ', Tok[i].FracValue: 8: 4)
42+
else if Tok[i].Kind = IDENTTOK then
43+
WriteLn(DiagFile, ' = ', Tok[i].Name^)
44+
else if Tok[i].Kind = CHARLITERALTOK then
45+
WriteLn(DiagFile, ' = ', Chr(Tok[i].Value))
46+
else if Tok[i].Kind = STRINGLITERALTOK then
47+
begin
48+
Write(DiagFile, ' = ');
49+
for CharIndex := 1 to Tok[i].StrLength do
50+
Write(DiagFile, StaticStringData[Tok[i].StrAddress - CODEORIGIN + (CharIndex - 1)]);
51+
WriteLn(DiagFile);
52+
end
53+
else
54+
WriteLn(DiagFile);
55+
end;// for
5556

5657
WriteLn(DiagFile);
5758
WriteLn(DiagFile, 'Identifier list: ');
5859
WriteLn(DiagFile);
59-
WriteLn(DiagFile, '#': 6, 'Block': 6, 'Name': 30, 'Kind': 15, 'Type': 15, 'Items/Params': 15, 'Value/Addr': 15, 'Dead': 5);
60+
WriteLn(DiagFile, '#': 6, 'Block': 6, 'Name': 30, 'Kind': 15, 'Type': 15, 'Items/Params': 15,
61+
'Value/Addr': 15, 'Dead': 5);
6062
WriteLn(DiagFile);
6163

6264
for i := 1 to NumIdent do
63-
begin
65+
begin
6466
Write(DiagFile, i: 6, Ident[i].Block: 6, Ident[i].Name: 30, Spelling[Ident[i].Kind]: 15);
65-
if Ident[i].DataType <> 0 then Write(DiagFile, Spelling[Ident[i].DataType]: 15) else Write(DiagFile, 'N/A': 15);
67+
if Ident[i].DataType <> 0 then Write(DiagFile, Spelling[Ident[i].DataType]: 15)
68+
else
69+
Write(DiagFile, 'N/A': 15);
6670
Write(DiagFile, Ident[i].NumAllocElements: 15, IntToHex(Ident[i].Value, 8): 15);
67-
if (Ident[i].Kind in [PROCEDURETOK, FUNCTIONTOK, CONSTRUCTORTOK, DESTRUCTORTOK]) and not Ident[i].IsNotDead then WriteLn(DiagFile, 'Yes': 5) else WriteLn(DiagFile, '': 5);
68-
end;
71+
if (Ident[i].Kind in [PROCEDURETOK, FUNCTIONTOK, CONSTRUCTORTOK, DESTRUCTORTOK]) and not Ident[i].IsNotDead then
72+
WriteLn(DiagFile, 'Yes': 5)
73+
else
74+
WriteLn(DiagFile, '': 5);
75+
end;
6976

7077
WriteLn(DiagFile);
7178
WriteLn(DiagFile, 'Call graph: ');
7279
WriteLn(DiagFile);
7380

7481
for i := 1 to NumBlocks do
75-
begin
82+
begin
7683
Write(DiagFile, i: 6, ' ---> ');
7784
for ChildIndex := 1 to CallGraph[i].NumChildren do
7885
Write(DiagFile, CallGraph[i].ChildBlock[ChildIndex]: 5);
7986
WriteLn(DiagFile);
80-
end;
87+
end;
8188

8289
WriteLn(DiagFile);
8390
CloseFile(DiagFile);

0 commit comments

Comments
 (0)