Fixed some bugs

Upgraded exception handler, now using madCollection
This commit is contained in:
Christian Hammacher 2005-08-26 22:59:25 +00:00
parent b17f277a1b
commit 2a2d5697b8
9 changed files with 47 additions and 230 deletions

View File

@ -24,6 +24,7 @@
-$X+
-$YD
-$Z1
-GD
-cg
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-H+
@ -33,6 +34,7 @@
-K$00400000
-LE"c:\programme\borland\delphi7\Projects\Bpl"
-LN"c:\programme\borland\delphi7\Projects\Bpl"
-DmadExcept
-w-UNSAFE_TYPE
-w-UNSAFE_CODE
-w-UNSAFE_CAST

View File

@ -80,7 +80,7 @@ UnsafeType=0
UnsafeCode=0
UnsafeCast=0
[Linker]
MapFile=0
MapFile=3
OutputObjs=0
ConsoleApp=1
DebugInfo=0
@ -96,7 +96,7 @@ PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=vcl;rtl;vclx;vclie;xmlrtl;inetdbbde;inet;inetdbxpress;VclSmp;dbrtl;dbexpress;vcldb;dsnap;dbxcds;inetdb;bdertl;vcldbx;adortl;teeui;teedb;tee;ibxpress;visualclx;visualdbclx;vclactnband;vclshlctrls;Rave50CLX;Rave50VCL;dclOffice2k;Indy70;DJcl;FlatStyle_D5;DelphiX_for7;mxFlatPack_D7;tbx_d7;tb2k_d7;mbTBXLibPack;TntUnicodeVcl_R70;SynEdit_R7
Conditionals=
Conditionals=madExcept
DebugSourceDirs=
UsePackages=0
[Parameters]
@ -115,7 +115,7 @@ AutoIncBuild=1
MajorVer=1
MinorVer=0
Release=0
Build=6
Build=7
Debug=0
PreRelease=1
Special=0
@ -126,7 +126,7 @@ CodePage=1252
[Version Info Keys]
CompanyName=AMX Mod X Dev Team
FileDescription=
FileVersion=1.0.0.6
FileVersion=1.0.0.7
InternalName=
LegalCopyright=
LegalTrademarks=

View File

@ -1,6 +1,9 @@
program AMXX_Studio;
uses
madExcept,
madLinkDisAsm,
madScreenShot,
Forms,
Windows,
Messages,
@ -34,6 +37,14 @@ uses
UnitfrmConnGen in 'UnitfrmConnGen.pas' {frmConnGen},
UnitPlugins in 'UnitPlugins.pas';
{ Used components:
JVCL 3.0
FlatPack
FlatStyle
Toolbar2000, TBX, SpTBX, mbTBX Lib
Scintilla and DelphiSci
madExcept
{$R *.res}
var i: integer;

Binary file not shown.

View File

@ -287,7 +287,7 @@ end;
function Between(eText, eFirst, eSecond: String): String;
var eTemp: String;
begin
if (Pos(eFirst, eText) = 0) or (Pos(eSecond, eText) = 0) then
if (Pos(eFirst, eText) = 0) and (Pos(eSecond, eText) = 0) then
Result := ''
else begin
eTemp := eText;

View File

@ -113,7 +113,9 @@ begin
eString := RemoveStringsAndComments(Trim(eCode[i]), True);
end
{ Included }
else if (IsAtStart('#include', eString)) then begin
else if (IsAtStart('#include', Trim(eCode[i]), False)) then begin
eString := Trim(eCode[i]);
if Between(eString, '<', '>') <> '' then begin
eString := Between(eString, '<', '>');
if ExtractFileExt(eString) <> '' then
@ -164,8 +166,8 @@ begin
Result.CVars.AddObject(Between(eString, '"', '"'), TObject(i));
end
{ Defined }
else if (IsAtStart('#define', eString)) then begin
eString := Copy(eString, 8, Length(eString));
else if (IsAtStart('#define', Trim(eCode[i]))) then begin
eString := Copy(Trim(eCode[i]), 8, Length(Trim(eCode[i])));
eString := Trim(eString);
Result.CallTips.Add(eString + '-> ' + FileName);
if Pos(#32, eString) <> 0 then
@ -177,8 +179,8 @@ begin
end
{ Events (Part 1) }
else if (IsAtStart('register_event(', eString)) and (not IsRecursive) then begin
if CountChars(eString, '"') >= 4 then begin
eTemp := StringReplace(eString, '"' + Between(eString, '"', '"') + '"', '', []);
if CountChars(Trim(eCode[i]), '"') >= 4 then begin
eTemp := StringReplace(Trim(eCode[i]), '"' + Between(Trim(eCode[i]), '"', '"') + '"', '', []);
ePreEvents.Add(Between(eString, '"', '"'));
end;
end;

View File

@ -1,6 +1,6 @@
object frmMain: TfrmMain
Left = 312
Top = 331
Left = 254
Top = 332
Width = 888
Height = 640
Caption = 'AMXX-Studio'
@ -4180,45 +4180,45 @@ object frmMain: TfrmMain
ImageIndex = -1
TabItem = 'tiTools'
object spcBottom2: TImage
Left = 2
Left = 0
Top = 447
Width = 169
Width = 173
Height = 2
Align = alBottom
end
object spcLeft2: TImage
Left = 2
Top = 2
Left = 0
Top = 0
Width = 3
Height = 445
Height = 447
Align = alLeft
end
object spcRight2: TImage
Left = 168
Top = 2
Left = 170
Top = 0
Width = 3
Height = 445
Height = 447
Align = alRight
end
object pnlDock: TSpTBXMultiDock
Left = 5
Top = 2
Width = 163
Height = 445
Left = 3
Top = 0
Width = 167
Height = 447
Position = dpxClient
object pnlCodeExplorer: TSpTBXDockablePanel
Left = 0
Top = 0
Caption = 'Code-Explorer'
DockedWidth = 159
DockedWidth = 163
DockPos = 0
TabOrder = 0
OnVisibleChanged = pnlCodeExplorerVisibleChanged
object trvExplorer: TTreeView
Left = 0
Top = 26
Width = 159
Height = 184
Width = 163
Height = 186
Align = alClient
Images = ilImages
Indent = 19
@ -4246,16 +4246,16 @@ object frmMain: TfrmMain
end
object pnlCodeInspector: TSpTBXDockablePanel
Left = 0
Top = 214
Top = 216
Caption = 'Code-Inspector'
DockedWidth = 159
DockPos = 214
DockedWidth = 163
DockPos = 216
TabOrder = 1
OnVisibleChanged = pnlCodeInspectorVisibleChanged
object jviCode: TJvInspector
Left = 0
Top = 26
Width = 159
Width = 163
Height = 185
Align = alClient
Divider = 80

View File

@ -118,7 +118,7 @@ begin
eCache.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'config\Cache.cfg');
for i := 1 to ParamCount do begin
if eCache.IndexOf(ParamStr(i)) = -1 then
eCache.Add(ParamStr(i));
eCache.Add(ParamStr(i));
end;
for i := 0 to eCache.Count -1 do begin

View File

@ -1,198 +0,0 @@
unit UnitfrmTextAnalyze;
interface
uses SysUtils, Classes;
type TPAWNParseResult = class
public
end
function ParseCodePAWN(eCode: TStringList): TPAWNParseResult;
implementation
function ParseCodePAWN(eCode: TStringList): TPAWNParseResult;
var i, k: integer;
eTrimmed, eLowered, eNoComments: String;
eStr, ePreEvents: TStringList;
eStartLine, eBracesOpen: Integer;
eTemp: String;
begin
Synchronize(GetCodeAndPos);
eConstants.Clear;
eDefined.Clear;
eCVars.Clear;
eIncluded.Clear;
eMethodsDefault.Clear;
eMethodsEvents.Clear;
eStocks.Clear;
eNatives.Clear;
eForwards.Clear;
eVariables.Clear;
ePreEvents.Clear;
eBracesOpen := 0;
eCurrLine := 0;
eStartLine := -1;
for i := 0 to eCode.Count -1 do begin
eTrimmed := Trim(eCode[i]);
eLowered := LowerCase(eTrimmed);
eNoComments := RemoveStringsAndComments(eTrimmed);
{ Constants and Variables }
if (Pos('new ', eLowered) = 1) and (eBracesOpen = 0) then begin // const or variable
Delete(eTrimmed, 1, 4);
eLowered := Trim(eTrimmed);
// we don't need braces so delete them...
while (CountChars(eTrimmed, '{') = CountChars(eTrimmed, '}')) and (CountChars(eTrimmed, '{') <> 0) and (Pos('{', eTrimmed) < Pos('}', eTrimmed)) do
eTrimmed := StringReplace(eTrimmed, '{' + Between(eTrimmed, '{', '}') + '}', '', [rfReplaceAll]);
while (CountChars(eTrimmed, '[') = CountChars(eTrimmed, ']')) and (CountChars(eTrimmed, '[') <> 0) and (Pos('[', eTrimmed) < Pos(']', eTrimmed)) do
eTrimmed := StringReplace(eTrimmed, '[' + Between(eTrimmed, '[', ']') + ']', '', [rfReplaceAll]);
// done? okay, split all items if there are more than one; and if not, it's okay...
eStr.Text := StringReplace(eTrimmed, ',', #13, [rfReplaceAll]);
for k := 0 to eStr.Count -1 do begin
if Trim(eStr[k]) <> '' then begin
if Pos(':', eStr[k]) <> 0 then
eStr[k] := Copy(eStr[k], Pos(':', eStr[k]) +1, Length(eStr[k]));
eStr[k] := Trim(RemoveSemicolon(eStr[k]));
if Pos('=', eStr[k]) <> 0 then // constant
eConstants.AddObject(Copy(eStr[k], 1, Pos('=', eStr[k]) -1), TObject(i))
else
eVariables.AddObject(eStr[k], TObject(i));
end;
end;
end
{ Included }
else if Pos('#include ', eLowered) = 1 then begin
if Between(eTrimmed, '<', '>') <> '' then begin
eTrimmed := Between(eTrimmed, '<', '>');
if ExtractFileExt(eTrimmed) <> '' then
ChangeFileExt(eTrimmed, '');
end
else if Between(eTrimmed, '"', '"') <> '' then begin
eTrimmed := Between(eTrimmed, '"', '"');
if ExtractFileExt(eTrimmed) <> '' then
ChangeFileExt(eTrimmed, '');
end
else begin
eTrimmed := Copy(eTrimmed, 9, Length(eTrimmed));
if ExtractFileExt(eTrimmed) <> '' then
ChangeFileExt(eTrimmed, '');
end;
eTrimmed := Trim(eTrimmed);
eIncluded.AddObject(eTrimmed, TObject(i));
end
{ CVars }
else if Pos('register_cvar(', eLowered) = 1 then begin
if Between(eTrimmed, '"', '"') <> '' then
eCVars.AddObject(Between(eTrimmed, '"', '"'), TObject(i));
end
{ Defined }
else if Pos('#define ', eLowered) = 1 then begin
eTrimmed := Copy(eTrimmed, 8, Length(eTrimmed));
eTrimmed := Trim(eTrimmed);
if Pos(#32, eTrimmed) <> 0 then
eTrimmed := Copy(eTrimmed, 1, Pos(#32, eTrimmed) -1);
eDefined.AddObject(eTrimmed, TObject(i));
end
{ Events (Part 1) }
else if Pos('register_event(', eLowered) = 1 then begin
if CountChars(eLowered, '"') >= 4 then
ePreEvents.Add(Between(eTrimmed, '"', '"'));
end;
{ Functions, this is adapted from AMXX-Edit v2 [see TextAnalyze.pas] }
if Pos('{', eNoComments) <> 0 then begin
if eStartLine = -1 then
eStartLine := i;
Inc(eBracesOpen, CountChars(eTrimmed, '{'));
end;
if Pos('}', eNoComments) <> 0 then begin
Inc(eBracesOpen, -CountChars(eTrimmed, '}'));
if (eBracesOpen = 0) then begin
eTemp := Trim(StringReplace(eCode[eStartLine], '{', '', [rfReplaceAll]));
// Analyze type
k := 0;
if Pos('public ', LowerCase(eTemp)) = 1 then
k := 1
else if Pos('stock ', LowerCase(eTemp)) = 1 then
k := 2
else if Pos('native ', LowerCase(eTemp)) = 1 then
k := 3
else if Pos('forward ', LowerCase(eTemp)) = 1 then
k := 4;
// Remove type
if (Pos(#32, eTemp) <> 0) and (Pos(#32, eTemp) < Pos('(', eTemp)) then
eTemp := Copy(eCode[eStartLine], Pos(#32, eCode[eStartLine]) +1, Length(eCode[eStartLine]));
// Copy function-name
if Pos('(', eTemp) <> 0 then
eTemp := Copy(eTemp, 1, Pos('(', eTemp) -1);
// Remove return-type
if Pos(':', eTemp) <> 0 then
Delete(eTemp, 1, Pos(':', eTemp));
eTemp := Trim(eTemp);
if eTemp <> '' then begin
case k of
0: eMethodsDefault.AddObject(eTemp, TObject(i)); // Default Method
1: begin
k := ePreEvents.IndexOf(eTemp);
if k <> -1 then begin
eMethodsEvents.AddObject(eTemp, ePreEvents.Objects[k]);
ePreEvents.Delete(k);
end
else
eMethodsDefault.AddObject(eTemp, TObject(i));
end;
2: eStocks.AddObject(eTemp, TObject(i));
3: eNatives.AddObject(eTemp, TObject(i));
4: eForwards.AddObject(eTemp, TObject(i));
end;
end;
eStartLine := -1;
eBracesOpen := -2;
end;
end;
if (Pos('forward ', eLowered) = 1) or (Pos('public ', eLowered) = 1) or (Pos('native ', eLowered) = 1) or (Pos('stock ', eLowered) = 1) then begin
eBracesOpen := 0;
if ((Pos('{', eLowered) = 0)) or (Pos('{', eLowered) <> 0) and (Pos('}', eLowered) <> 0) then begin
eTemp := eTrimmed;
// Remove type
if (Pos(#32, eTemp) <> 0) and (Pos(#32, eTemp) < Pos('(', eTemp)) then
eTemp := Copy(eTemp, Pos(#32, eTemp) +1, Length(eTemp));
// Copy function-name
if Pos('(', eTemp) <> 0 then
eTemp := Copy(eTemp, 1, Pos('(', eTemp) -1);
// Remove return-type
if Pos(':', eTemp) <> 0 then
Delete(eTemp, 1, Pos(':', eTemp));
eTemp := Trim(eTemp);
if eTemp <> '' then begin
if Pos('forward', eLowered) = 1 then
eForwards.AddObject(eTrimmed, TObject(i))
else if Pos('public', eLowered) = 1 then begin
k := ePreEvents.IndexOf(eTemp);
if k <> -1 then begin
eMethodsEvents.AddObject(eTemp, ePreEvents.Objects[k]);
ePreEvents.Delete(k);
end
else
eMethodsDefault.Add(eTemp);
end
else if Pos('native', eLowered) = 1 then
eNatives.AddObject(eTemp, TObject(i))
else if Pos('stock', eLowered) = 1 then
eStocks.AddObject(eTemp, TObject(i))
else
eMethodsDefault.AddObject(eTemp, TObject(i));
end;
end;
end;
Sleep(5);
end;
end;
end.