* browser updates from gabor

This commit is contained in:
peter 1999-02-22 11:51:32 +00:00
parent d9aa2e2e58
commit 4133cbf1d3
9 changed files with 728 additions and 146 deletions

View File

@ -64,12 +64,15 @@ type
TSymbol = object(TObject)
Name : PString;
Typ : tsymtyp;
ParamCount : Sw_integer;
Params : PPointerArray;
Params : PString;
References : PReferenceCollection;
Items : PSymbolCollection;
constructor Init(const AName: string; ATyp: tsymtyp; AParamCount: Sw_integer; AParams: PPointerArray);
procedure SetParams(AParamCount: Sw_integer; AParams: PPointerArray);
DType : PString;
VType : PString;
Ancestor : PString;
IsRecord : boolean;
IsClass : boolean;
constructor Init(const AName: string; ATyp: tsymtyp; AParams: string);
function GetReferenceCount: Sw_integer;
function GetReference(Index: Sw_integer): PReference;
function GetItemCount: Sw_integer;
@ -113,7 +116,7 @@ implementation
uses
Drivers,Views,App,
globtype,globals,files,comphook;
aasm,globtype,globals,files,comphook;
{****************************************************************************
Helpers
@ -127,6 +130,35 @@ begin
GetStr:=P^;
end;
function IntToStr(L: longint): string;
var S: string;
begin
Str(L,S);
IntToStr:=S;
end;
function UpcaseStr(S: string): string;
var I: integer;
begin
for I:=1 to length(S) do
S[I]:=Upcase(S[I]);
UpcaseStr:=S;
end;
function FloatToStr(E: extended): string;
var S: string;
begin
Str(E:0:24,S);
if Pos('.',S)>0 then
begin
while (length(S)>0) and (S[length(S)]='0') do
Delete(S,length(S),1);
if (length(S)>0) and (S[length(S)]='.') then
Delete(S,length(S),1);
end;
if S='' then S:='0';
FloatToStr:=S;
end;
{****************************************************************************
TStoreCollection
@ -136,6 +168,7 @@ function TStoreCollection.Add(const S: string): PString;
var P: PString;
Index: Sw_integer;
begin
if S='' then P:=nil else
if Search(@S,Index) then P:=At(Index) else
begin
P:=NewStr(S);
@ -261,11 +294,10 @@ end;
TSymbol
****************************************************************************}
constructor TSymbol.Init(const AName: string; ATyp: tsymtyp; AParamCount: Sw_integer; AParams: PPointerArray);
constructor TSymbol.Init(const AName: string; ATyp: tsymtyp; AParams: string);
begin
inherited Init;
Name:=NewStr(AName); Typ:=ATyp;
SetParams(AParamCount,AParams);
New(References, Init(20,50));
if ATyp in RecordTypes then
begin
@ -273,18 +305,6 @@ begin
end;
end;
procedure TSymbol.SetParams(AParamCount: Sw_integer; AParams: PPointerArray);
begin
if AParams=nil then AParamCount:=0 else
if AParamCount=0 then AParams:=nil;
ParamCount:=AParamCount;
if (ParamCount>0) and (AParams<>nil) then
begin
GetMem(Params, ParamCount*4);
Move(AParams^,Params^,ParamCount*4);
end;
end;
function TSymbol.GetReferenceCount: Sw_integer;
var Count: Sw_integer;
begin
@ -329,15 +349,27 @@ begin
S:=S+' ';
end;
S:=S+' '+GetName;
if ParamCount>0 then
if IsRecord then
S:=S+' = record'
else
if Ancestor<>nil then
begin
S:=S+'(';
for I:=1 to ParamCount do
begin
S:=S+GetStr(Params^[I-1]);
if I<>ParamCount then S:=S+', ';
end;
S:=S+')';
S:=S+' = ';
if IsClass then
S:=S+'class'
else
S:=S+'object';
if Ancestor^<>'.' then
S:=S+'('+Ancestor^+')';
end
else
begin
if Assigned(DType) then
S:=S+' = '+DType^;
if Assigned(Params) then
S:=S+'('+Params^+')';
if Assigned(VType) then
S:=S+': '+VType^;
end;
GetText:=S;
end;
@ -349,7 +381,10 @@ begin
abstractsym : S:='abst';
varsym : S:='var';
typesym : S:='type';
procsym : S:='proc';
procsym : if VType=nil then
S:='proc'
else
S:='func';
unitsym : S:='unit';
programsym : S:='prog';
constsym : S:='const';
@ -376,8 +411,14 @@ begin
Dispose(Items, Done);
if assigned(Name) then
DisposeStr(Name);
if assigned(Params) then
FreeMem(Params,ParamCount*4);
{ if assigned(Params) then
DisposeStr(Params);
if assigned(VType) then
DisposeStr(VType);
if assigned(DType) then
DisposeStr(DType);
if assigned(Ancestor) then
DisposeStr(Ancestor);}
end;
@ -415,8 +456,8 @@ end;
procedure CreateBrowserCol;
procedure ProcessSymTable(var Owner: PSymbolCollection; Table: PSymTable);
var I,J,defcount, symcount: longint;
procedure ProcessSymTable(OwnerSym: PSymbol; var Owner: PSymbolCollection; Table: PSymTable);
var I,J,defcount,symcount: longint;
Ref: PRef;
Sym,ParSym: PSym;
Symbol: PSymbol;
@ -424,6 +465,255 @@ procedure CreateBrowserCol;
ParamCount: Sw_integer;
Params: array[0..20] of PString;
inputfile : pinputfile;
Idx: sw_integer;
S: string;
procedure SetVType(Symbol: PSymbol; VType: string);
begin
Symbol^.VType:=TypeNames^.Add(VType);
end;
procedure SetDType(Symbol: PSymbol; DType: string);
begin
Symbol^.DType:=TypeNames^.Add(DType);
end;
function GetDefinitionStr(def: pdef): string; forward;
function GetEnumDefStr(def: penumdef): string;
var Name: string;
esym: penumsym;
Count: integer;
begin
Name:='(';
esym:=def^.First; Count:=0;
while (esym<>nil) do
begin
if Count>0 then Name:=Name+', ';
Name:=Name+esym^.name;
esym:=esym^.next; Inc(Count);
end;
Name:=Name+')';
GetEnumDefStr:=Name;
end;
function GetArrayDefStr(def: parraydef): string;
var Name: string;
begin
Name:='array ['+IntToStr(def^.lowrange)+'..'+IntToStr(def^.highrange)+'] of ';
if assigned(def^.definition) then
Name:=Name+GetDefinitionStr(def^.definition);
GetArrayDefStr:=Name;
end;
function GetFileDefStr(def: pfiledef): string;
var Name: string;
begin
Name:='';
case def^.filetype of
ft_text : Name:='text';
ft_untyped : Name:='file';
ft_typed : Name:='file of '+GetDefinitionStr(def^.typed_as);
end;
GetFileDefStr:=Name;
end;
function GetStringDefStr(def: pstringdef): string;
var Name: string;
begin
Name:='';
case def^.string_typ of
st_shortstring :
if def^.len=255 then
Name:='shortstring'
else
Name:='string['+IntToStr(def^.len)+']';
st_longstring :
Name:='longstring';
st_ansistring :
Name:='ansistring';
st_widestring :
Name:='widestring';
else ;
end;
GetStringDefStr:=Name;
end;
function retdefassigned(def: pabstractprocdef): boolean;
var OK: boolean;
begin
OK:=false;
if assigned(def^.retdef) then
if UpcaseStr(GetDefinitionStr(def^.retdef))<>'VOID' then
OK:=true;
retdefassigned:=OK;
end;
function GetAbsProcParmDefStr(def: pabstractprocdef): string;
var Name: string;
dc: pdefcoll;
Count: integer;
CurName: string;
begin
Name:='';
dc:=def^.para1; Count:=0;
while dc<>nil do
begin
CurName:='';
case dc^.paratyp of
vs_Value : ;
vs_Const : CurName:=CurName+'const ';
vs_Var : CurName:=CurName+'var ';
end;
if assigned(dc^.data) then
CurName:=CurName+GetDefinitionStr(dc^.data);
if dc^.next<>nil then
CurName:=', '+CurName;
Name:=CurName+Name;
dc:=dc^.next; Inc(Count);
end;
GetAbsProcParmDefStr:=Name;
end;
function GetAbsProcDefStr(def: pabstractprocdef): string;
var Name: string;
begin
Name:=GetAbsProcParmDefStr(def);
if Name<>'' then Name:='('+Name+')';
if retdefassigned(def) then
Name:='function'+Name+': '+GetDefinitionStr(def^.retdef)
else
Name:='procedure'+Name;
GetAbsProcDefStr:=Name;
end;
function GetProcDefStr(def: pprocdef): string;
var DName: string;
J: integer;
begin
{ DName:='';
if assigned(def) then
begin
if assigned(def^.parast) then
begin
with def^.parast^ do
for J:=1 to number_symbols do
begin
if J<>1 then DName:=DName+', ';
ParSym:=GetsymNr(J);
if ParSym=nil then Break;
DName:=DName+ParSym^.Name;
end;
end
end;}
DName:=GetAbsProcDefStr(def);
GetProcDefStr:=DName;
end;
function GetProcVarDefStr(def: pprocvardef): string;
begin
GetProcVarDefStr:=GetAbsProcDefStr(def);
end;
function GetSetDefStr(def: psetdef): string;
var Name: string;
begin
Name:='';
case def^.settype of
normset : Name:='set';
smallset : Name:='set';
varset : Name:='varset';
end;
Name:=Name+' of ';
Name:=Name+GetDefinitionStr(def^.setof);
GetSetDefStr:=Name;
end;
function GetDefinitionStr(def: pdef): string;
var Name: string;
sym: psym;
begin
Name:='';
if def<>nil then
begin
if assigned(def^.sym) then
Name:=def^.sym^.name;
if Name='' then
case def^.deftype of
arraydef :
Name:=GetArrayDefStr(parraydef(def));
stringdef :
Name:=GetStringDefStr(pstringdef(def));
enumdef :
Name:=GetEnumDefStr(penumdef(def));
procdef :
Name:=GetProcDefStr(pprocdef(def));
procvardef :
Name:=GetProcVarDefStr(pprocvardef(def));
filedef :
Name:=GetFileDefStr(pfiledef(def));
setdef :
Name:=GetSetDefStr(psetdef(def));
end;
end;
GetDefinitionStr:=Name;
end;
function GetEnumItemName(Sym: penumsym): string;
var Name: string;
ES: penumsym;
begin
Name:='';
if assigned(sym) and assigned(sym^.definition) then
if assigned(sym^.definition^.sym) then
begin
{ ES:=sym^.definition^.First;
while (ES<>nil) and (ES^.Value<>sym^.Value) do
ES:=ES^.next;
if assigned(es) and (es^.value=sym^.value) then
Name:=}
Name:=sym^.definition^.sym^.name;
if Name<>'' then
Name:=Name+'('+IntToStr(sym^.value)+')';
end;
GetEnumItemName:=Name;
end;
function GetConstValueName(sym: pconstsym): string;
var Name: string;
begin
Name:='';
{ if assigned(sym^.definition) then
if assigned(sym^.definition^.sym) then
Name:=sym^.definition^.sym^.name;}
if Name='' then
case sym^.consttype of
constord :
Name:=sym^.definition^.sym^.name+'('+IntToStr(sym^.value)+')';
conststring :
Name:=''''+GetStr(PString(sym^.Value))+'''';
constreal:
Name:=FloatToStr(PBestReal(sym^.Value)^);
constbool:
{ if boolean(sym^.Value)=true then
Name:='TRUE'
else
Name:='FALSE';}
Name:='Longbool('+IntToStr(sym^.Value)+')';
constint:
Name:=IntToStr(sym^.value);
constchar:
Name:=''''+chr(sym^.Value)+'''';
constset:
{ Name:=SetToStr(pnormalset(sym^.Value))};
constnil: ;
end;
GetConstValueName:=Name;
end;
procedure ProcessDefIfStruct(definition: pdef);
begin
if assigned(definition) then
begin
case definition^.deftype of
recorddef :
if precdef(definition)^.symtable<>Table then
ProcessSymTable(Symbol,Symbol^.Items,precdef(definition)^.symtable);
objectdef :
if precdef(definition)^.symtable<>Table then
ProcessSymTable(Symbol,Symbol^.Items,pobjectdef(definition)^.publicsyms);
pointerdef :
with ppointerdef(definition)^ do
if assigned(definition) then
if assigned(definition^.sym) then
ProcessDefIfStruct(definition^.sym^.definition);
end;
end;
end;
begin
if not Assigned(Table) then
Exit;
@ -440,47 +730,98 @@ procedure CreateBrowserCol;
Sym:=Table^.GetsymNr(I);
if Sym=nil then Continue;
ParamCount:=0;
New(Symbol, Init(Sym^.Name,Sym^.Typ,0,nil));
New(Symbol, Init(Sym^.Name,Sym^.Typ,''));
case Sym^.Typ of
varsym :
with pvarsym(sym)^ do
begin
if assigned(definition) then
if assigned(definition^.sym) then
SetVType(Symbol,definition^.sym^.name)
else
SetVType(Symbol,GetDefinitionStr(definition));
ProcessDefIfStruct(definition);
end;
constsym :
SetDType(Symbol,GetConstValueName(pconstsym(sym)));
enumsym :
if assigned(penumsym(sym)^.definition) then
SetDType(Symbol,GetEnumItemName(penumsym(sym)));
unitsym :
begin
{ ProcessSymTable(Symbol^.Items,punitsym(sym)^.unitsymtable);}
end;
syssym :
{ if assigned(Table^.Name) then
if Table^.Name^='SYSTEM' then}
begin
Symbol^.Params:=TypeNames^.Add('...');
end;
funcretsym :
if Assigned(OwnerSym) then
with pfuncretsym(sym)^ do
if assigned(funcretdef) then
if assigned(funcretdef^.sym) then
SetVType(OwnerSym,funcretdef^.sym^.name);
procsym :
with pprocsym(sym)^ do
if assigned(definition) then
begin
if assigned(definition^.parast) then
begin
with definition^.parast^ do
for J:=1 to number_symbols do
begin
ParSym:=GetsymNr(J);
if ParSym=nil then Break;
Inc(ParamCount);
Params[ParamCount-1]:=TypeNames^.Add(ParSym^.Name);
end;
Symbol^.SetParams(ParamCount,PPointerArray(@Params));
ProcessSymTable(Symbol^.Items,definition^.parast);
end;
if assigned(definition^.localst) and
(definition^.localst^.symtabletype<>staticsymtable) then
ProcessSymTable(Symbol^.Items,definition^.localst);
with pprocsym(sym)^ do
if assigned(definition) then
begin
ProcessSymTable(Symbol,Symbol^.Items,definition^.parast);
if assigned(definition^.parast) then
begin
Symbol^.Params:=TypeNames^.Add(GetAbsProcParmDefStr(definition));
end
else { param-definition is NOT assigned }
if assigned(Table^.Name) then
if Table^.Name^='SYSTEM' then
begin
Symbol^.Params:=TypeNames^.Add('...');
end;
if assigned(definition^.localst) and
(definition^.localst^.symtabletype<>staticsymtable) then
ProcessSymTable(Symbol,Symbol^.Items,definition^.localst);
end;
end;
typesym :
begin
with ptypesym(sym)^ do
if assigned(definition) then
case definition^.deftype of
arraydef :
SetDType(Symbol,GetArrayDefStr(parraydef(definition)));
enumdef :
SetDType(Symbol,GetEnumDefStr(penumdef(definition)));
procdef :
SetDType(Symbol,GetProcDefStr(pprocdef(definition)));
procvardef :
SetDType(Symbol,GetProcVarDefStr(pprocvardef(definition)));
objectdef :
ProcessSymTable(Symbol^.Items,pobjectdef(definition)^.publicsyms);
with pobjectdef(definition)^ do
begin
if childof=nil then
S:='.'
else
S:=childof^.name^;
Symbol^.Ancestor:=TypeNames^.Add(S);
Symbol^.IsClass:=(options and oo_is_class)<>0;
ProcessSymTable(Symbol,Symbol^.Items,pobjectdef(definition)^.publicsyms);
end;
recorddef :
ProcessSymTable(Symbol^.Items,precdef(definition)^.symtable);
begin
Symbol^.IsRecord:=true;
ProcessSymTable(Symbol,Symbol^.Items,precdef(definition)^.symtable);
end;
filedef :
SetDType(Symbol,GetFileDefStr(pfiledef(definition)));
setdef :
SetDType(Symbol,GetSetDefStr(psetdef(definition)));
end;
end;
end;
Ref:=Sym^.defref;
while assigned(Ref) do
while Assigned(Symbol) and assigned(Ref) do
begin
inputfile:=get_source_file(ref^.moduleindex,ref^.posinfo.fileindex);
if Assigned(inputfile) and Assigned(inputfile^.name) then
@ -491,6 +832,7 @@ procedure CreateBrowserCol;
end;
Ref:=Ref^.nextref;
end;
if Assigned(Symbol) then
Owner^.Insert(Symbol);
end;
end;
@ -502,37 +844,25 @@ var
begin
DisposeBrowserCol;
NewBrowserCol;
{ T:=SymTableStack;
while assigned(T) do
begin
New(UnitS, Init(T^.Name^,unitsym, 0, nil));
Modules^.Insert(UnitS);
ProcessSymTable(UnitS^.Items,T);
T:=T^.Next;
end;}
hp:=pmodule(loaded_units.first);
while assigned(hp) do
begin
t:=psymtable(hp^.globalsymtable);
if assigned(t) then
begin
New(UnitS, Init(T^.Name^,unitsym, 0, nil));
New(UnitS, Init(T^.Name^,unitsym,''));
Modules^.Insert(UnitS);
ProcessSymTable(UnitS^.Items,T);
ProcessSymTable(UnitS,UnitS^.Items,T);
if cs_local_browser in aktmoduleswitches then
begin
t:=psymtable(hp^.localsymtable);
if assigned(t) then
begin
{New(UnitS, Init(T^.Name^,unitsym, 0, nil));
Modules^.Insert(UnitS);}
ProcessSymTable(UnitS^.Items,T);
end;
ProcessSymTable(UnitS,UnitS^.Items,T);
end;
end;
hp:=pmodule(hp^.next);
end;
end;
@ -569,7 +899,10 @@ begin
end.
{
$Log$
Revision 1.6 1999-02-04 09:31:59 pierre
Revision 1.7 1999-02-22 11:51:32 peter
* browser updates from gabor
Revision 1.6 1999/02/04 09:31:59 pierre
+ added objects and records symbol tables
Revision 1.5 1999/02/03 09:44:32 pierre

View File

@ -214,6 +214,8 @@ begin
if WasVisible=false then
ProgramInfoWindow^.Show;
ProgramInfoWindow^.MakeFirst;}
if Assigned(ProgramInfoWindow) then
ProgramInfoWindow^.ClearMessages;
CompilationPhase:=cpCompiling;
New(SD, Init);
@ -272,7 +274,10 @@ end;
end.
{
$Log$
Revision 1.12 1999-02-22 11:29:36 pierre
Revision 1.13 1999-02-22 11:51:33 peter
* browser updates from gabor
Revision 1.12 1999/02/22 11:29:36 pierre
+ added col info in MessageItem
+ grep uses HighLightExts and should work for linux

View File

@ -120,6 +120,7 @@ const
cmSaveINI = 2012;
cmSaveAsINI = 2013;
cmSwitchesMode = 2014;
cmBrowser = 2015;
cmHelpContents = 2100;
cmHelpIndex = 2101;
@ -131,6 +132,10 @@ const
cmOpenAtCursor = 2200;
cmBrowseAtCursor = 2201;
cmEditorOptions = 2202;
cmBrowserOptions = 2203;
cmTrackReference = 2300;
cmGotoReference = 2301;
{ Help constants }
hcSourceWindow = 8000;
@ -175,6 +180,7 @@ const
hcCalculator = hcShift+cmCalculator;
hcAsciiTable = hcShift+cmAsciiTable;
hcGrep = hcShift+cmGrep;
hcBrowser = hcShift+cmBrowser;
hcSwitchesMode = hcShift+cmSwitchesMode;
hcAbout = hcShift+cmAbout;
@ -275,7 +281,10 @@ implementation
END.
{
$Log$
Revision 1.11 1999-02-20 15:18:28 peter
Revision 1.12 1999-02-22 11:51:34 peter
* browser updates from gabor
Revision 1.11 1999/02/20 15:18:28 peter
+ ctrl-c capture with confirm dialog
+ ascii table in the tools menu
+ heapviewer

View File

@ -159,6 +159,7 @@ begin
hcLinker : S:='Set linker options';
hcDebugger : S:='Set debug information options';
hcDirectories : S:='Set paths for units, include, object and generated files';
hcBrowser : S:='Specify global browser settings';
hcTools : S:='Create or change tools';
hcEnvironmentMenu:S:='Specify environment settins';
@ -370,7 +371,10 @@ end;
END.
{
$Log$
Revision 1.9 1999-02-19 18:43:45 peter
Revision 1.10 1999-02-22 11:51:35 peter
* browser updates from gabor
Revision 1.9 1999/02/19 18:43:45 peter
+ open dialog supports mask list
Revision 1.8 1999/02/11 19:07:21 pierre

View File

@ -20,7 +20,7 @@ uses
Drivers,Views,App,Gadgets,
{$ifdef EDITORS}Editors,{$else}WEditor,{$endif}
Comphook,
FPViews;
FPViews,FPSymbol;
type
TIDEApp = object(TApplication)
@ -74,6 +74,7 @@ type
procedure Tools;
procedure Grep;
procedure EditorOptions(Editor: PEditor);
procedure BrowserOptions(Browser: PBrowserWindow);
procedure Mouse;
procedure Colors;
procedure OpenINI;
@ -119,7 +120,7 @@ uses
Systems,BrowCol,Version,
WHelp,WHlpView,WINI,
FPConst,FPVars,FPUtils,FPSwitch,FPIni,FPIntf,FPCompile,FPHelp,
FPTemplt,FPCalc,FPUsrScr,FPSymbol,FPTools,FPDebug,FPRedir;
FPTemplt,FPCalc,FPUsrScr,FPTools,FPDebug,FPRedir;
function IDEUseSyntaxHighlight(Editor: PFileEditor): boolean; {$ifndef FPC}far;{$endif}
@ -243,6 +244,7 @@ begin
NewItem('~L~inker...','', kbNoKey, cmLinker, hcLinker,
NewItem('De~b~ugger...','', kbNoKey, cmDebugger, hcDebugger,
NewItem('~D~irectories...','', kbNoKey, cmDirectories, hcDirectories,
NewItem('Bro~w~ser...','',kbNoKey, cmBrowser, hcBrowser,
NewItem('~T~ools...','', kbNoKey, cmTools, hcTools,
NewLine(
NewSubMenu('~E~nvironment', hcEnvironmentMenu, NewMenu(
@ -256,7 +258,7 @@ begin
NewItem('~O~pen...','', kbNoKey, cmOpenINI, hcOpenINI,
NewItem('~S~ave','', kbNoKey, cmSaveINI, hcSaveINI,
NewItem('Save ~a~s...','', kbNoKey, cmSaveAsINI, hcSaveAsINI,
nil)))))))))))))),
nil))))))))))))))),
NewSubMenu('~W~indow', hcWindowMenu, NewMenu(
NewItem('~T~ile','', kbNoKey, cmTile, hcTile,
NewItem('C~a~scade','', kbNoKey, cmCascade, hcCascade,
@ -388,6 +390,8 @@ begin
cmTools : Tools;
cmEditor : EditorOptions(nil);
cmEditorOptions : EditorOptions(Event.InfoPtr);
cmBrowser : BrowserOptions(nil);
cmBrowserOptions : BrowserOptions(Event.InfoPtr);
cmMouse : Mouse;
cmColors : Colors;
cmOpenINI : OpenINI;
@ -682,7 +686,10 @@ end;
END.
{
$Log$
Revision 1.18 1999-02-22 02:15:13 peter
Revision 1.19 1999-02-22 11:51:36 peter
* browser updates from gabor
Revision 1.18 1999/02/22 02:15:13 peter
+ default extension for save in the editor
+ Separate Text to Find for the grep dialog
* fixed redir crash with tp7

View File

@ -537,6 +537,80 @@ begin
Dispose(D, Done);
end;
procedure TIDEApp.BrowserOptions(Browser: PBrowserWindow);
var D: PCenterDialog;
R,R2,R3 : TRect;
PreS: string[15];
CB1,CB2: PCheckBoxes;
RB1,RB2: PRadioButtons;
begin
if Browser=nil then
begin
PreS:='';
end
else
begin
PreS:='Local ';
end;
R.Assign(0,0,56,15);
New(D, Init(R, PreS+'Browser Options'));
with D^ do
begin
GetExtent(R); R.Grow(-2,-2);
R.B.Y:=R.A.Y+1+3; R2.Copy(R); Inc(R2.A.Y);
New(CB1, Init(R2,
NewSItem(RExpand('~L~abels',21+2),
NewSItem('~C~onstants',
NewSItem('~T~ypes',
NewSItem('~V~ariables',
NewSItem('~P~rocedures',
NewSItem('~I~nherited',
nil)))))))
);
Insert(CB1);
R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
Insert(New(PLabel, Init(R2, 'Symbols', CB1)));
R.Move(0,R.B.Y-R.A.Y+1);
R.B.Y:=R.A.Y+1+2; R2.Copy(R);
R3.Copy(R2); R3.B.X:=R3.A.X+(R3.B.X-R3.A.X) div 2-1; Inc(R3.A.Y);
New(RB1, Init(R3,
NewSItem('~N~ew browser',
NewSItem('~R~eplace current',
nil)))
);
Insert(RB1);
R3.Move(0,-1); R3.B.Y:=R3.A.Y+1;
Insert(New(PLabel, Init(R3, 'Sub-browsing', RB1)));
R3.Copy(R2); R3.A.X:=R3.B.X-(R3.B.X-R3.A.X) div 2+1; Inc(R3.A.Y);
New(RB2, Init(R3,
NewSItem('~S~cope',
NewSItem('R~e~ference',
nil)))
);
Insert(RB2);
R3.Move(0,-1); R3.B.Y:=R3.A.Y+1;
Insert(New(PLabel, Init(R3, 'Preferred pane', RB2)));
R.Move(0,R.B.Y-R.A.Y+1);
R.B.Y:=R.A.Y+1+1; R2.Copy(R); Inc(R2.A.Y);
New(CB2, Init(R2,
NewSItem(RExpand('~Q~ualified symbols',21+2),
NewSItem('S~o~rt always',
nil)))
);
Insert(CB2);
R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
Insert(New(PLabel, Init(R2, 'Display', CB2)));
end;
InsertButtons(D);
CB1^.Select;
if Desktop^.ExecView(D)=cmOK then
begin
end;
Dispose(D, Done);
end;
procedure TIDEApp.Mouse;
var R,R2: TRect;
D: PCenterDialog;
@ -722,7 +796,10 @@ end;
{
$Log$
Revision 1.16 1999-02-18 13:44:32 peter
Revision 1.17 1999-02-22 11:51:37 peter
* browser updates from gabor
Revision 1.16 1999/02/18 13:44:32 peter
* search fixed
+ backward search
* help fixes

View File

@ -34,7 +34,11 @@ type
constructor Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar);
procedure HandleEvent(var Event: TEvent); virtual;
procedure GotoItem(Item: sw_integer); virtual;
procedure TrackItem(Item: sw_integer); virtual;
function GetPalette: PPalette; virtual;
private
function TrackReference(R: PReference): boolean; virtual;
function GotoReference(R: PReference): boolean; virtual;
end;
PSymbolScopeView = ^TSymbolScopeView;
@ -44,6 +48,8 @@ type
procedure HandleEvent(var Event: TEvent); virtual;
procedure Draw; virtual;
procedure LookUp(S: string); virtual;
procedure GotoItem(Item: sw_integer); virtual;
procedure TrackItem(Item: sw_integer); virtual;
private
Symbols: PSymbolCollection;
LookupStr: string;
@ -56,8 +62,7 @@ type
function GetText(Item,MaxLen: Sw_Integer): String; virtual;
procedure SelectItem(Item: Sw_Integer); virtual;
procedure GotoItem(Item: sw_integer); virtual;
procedure GotoSource; virtual;
procedure TrackSource; virtual;
procedure TrackItem(Item: sw_integer); virtual;
private
References: PReferenceCollection;
end;
@ -307,6 +312,8 @@ begin
case Event.KeyCode of
kbEnter :
GotoItem(Focused);
kbSpaceBar :
TrackItem(Focused);
kbRight,kbLeft :
if HScrollBar<>nil then
HScrollBar^.HandleEvent(Event);
@ -328,12 +335,64 @@ begin
GetPalette:=@P;
end;
procedure TSymbolView.GotoItem(Item: sw_integer);
begin
SelectItem(Item);
end;
procedure TSymbolView.TrackItem(Item: sw_integer);
begin
SelectItem(Item);
end;
function LastBrowserWindow: PBrowserWindow;
var BW: PBrowserWindow;
procedure IsBW(P: PView); {$ifndef FPC}far;{$endif}
begin
if (P^.HelpCtx=hcBrowserWindow) then
BW:=pointer(P);
end;
begin
BW:=nil;
Desktop^.ForEach(@IsBW);
LastBrowserWindow:=BW;
end;
function TSymbolView.TrackReference(R: PReference): boolean;
var W: PSourceWindow;
BW: PBrowserWindow;
P: TPoint;
begin
Message(Desktop,evBroadcast,cmClearLineHighlights,nil);
Desktop^.Lock;
P.X:=R^.Position.X-1; P.Y:=R^.Position.Y-1;
W:=TryToOpenFile(nil,R^.GetFileName,P.X,P.Y);
if W<>nil then
begin
BW:=LastBrowserWindow;
if BW=nil then
W^.Select
else
begin
Desktop^.Delete(W);
Desktop^.InsertBefore(W,BW^.NextView);
end;
W^.Editor^.SetHighlightRow(P.Y);
end;
Desktop^.UnLock;
TrackReference:=W<>nil;
end;
function TSymbolView.GotoReference(R: PReference): boolean;
var W: PSourceWindow;
begin
Desktop^.Lock;
W:=TryToOpenFile(nil,R^.GetFileName,R^.Position.X-1,R^.Position.Y-1);
if W<>nil then W^.Select;
Desktop^.UnLock;
GotoReference:=W<>nil;
end;
{****************************************************************************
TSymbolScopeView
****************************************************************************}
@ -358,7 +417,7 @@ begin
ClearEvent(Event);
end;
else
if Event.CharCode in[#32..#255] then
if Event.CharCode in[#33..#255] then
begin
LookUp(LookUpStr+Event.CharCode);
ClearEvent(Event);
@ -396,6 +455,20 @@ begin
DrawView;
end;
procedure TSymbolScopeView.GotoItem(Item: sw_integer);
begin
SelectItem(Item);
end;
procedure TSymbolScopeView.TrackItem(Item: sw_integer);
var S: PSymbol;
begin
if Range=0 then Exit;
S:=List^.At(Focused);
if (S^.References<>nil) and (S^.References^.Count>0) then
TrackReference(S^.References^.At(0));
end;
function TSymbolScopeView.GetText(Item,MaxLen: Sw_Integer): String;
var S: string;
begin
@ -435,66 +508,21 @@ begin
GetText:=copy(S,1,MaxLen);
end;
procedure TSymbolReferenceView.GotoSource;
var R: PReference;
W: PSourceWindow;
begin
if Range=0 then Exit;
R:=References^.At(Focused);
Desktop^.Lock;
W:=TryToOpenFile(nil,R^.GetFileName,R^.Position.X-1,R^.Position.Y-1);
if W<>nil then W^.Select;
Desktop^.UnLock;
end;
function LastBrowserWindow: PBrowserWindow;
var BW: PBrowserWindow;
procedure IsBW(P: PView); {$ifndef FPC}far;{$endif}
begin
if (P^.HelpCtx=hcBrowserWindow) then
BW:=pointer(P);
end;
begin
BW:=nil;
Desktop^.ForEach(@IsBW);
LastBrowserWindow:=BW;
end;
procedure TSymbolReferenceView.TrackSource;
var R: PReference;
W: PSourceWindow;
BW: PBrowserWindow;
P: TPoint;
begin
Message(Desktop,evBroadcast,cmClearLineHighlights,nil);
if Range=0 then Exit;
R:=References^.At(Focused);
Desktop^.Lock;
P.X:=R^.Position.X-1; P.Y:=R^.Position.Y-1;
W:=TryToOpenFile(nil,R^.GetFileName,P.X,P.Y);
if W<>nil then
begin
BW:=LastBrowserWindow;
if BW=nil then
W^.Select
else
begin
Desktop^.Delete(W);
Desktop^.InsertBefore(W,BW^.NextView);
end;
W^.Editor^.SetHighlightRow(P.Y);
end;
Desktop^.UnLock;
end;
procedure TSymbolReferenceView.GotoItem(Item: sw_integer);
begin
GotoSource;
if Range=0 then Exit;
GotoReference(List^.At(Item));
end;
procedure TSymbolReferenceView.TrackItem(Item: sw_integer);
begin
if Range=0 then Exit;
TrackReference(List^.At(Item));
end;
procedure TSymbolReferenceView.SelectItem(Item: Sw_Integer);
begin
TrackSource;
GotoItem(Item);
end;
@ -729,6 +757,26 @@ begin
S^.Items,S^.References);
end;
end;
{ evCommand :
begin
DontClear:=false;
case Event.Command of
cmGotoSymbol :
if Event.InfoPtr=ScopeView then
if ReferenceView<>nil then
if ReferenceView^.Range>0 then
ReferenceView^.GotoItem(0);
cmTrackSymbol :
if Event.InfoPtr=ScopeView then
if (ScopeView<>nil) and (ScopeView^.Range>0) then
begin
S:=ScopeView^.At(ScopeView^.Focused);
if (S^.References<>nil) and (S^.References^.Count>0) then
TrackItem(S^.References^.At(0));
else DontClear:=true;
end;
if DontClear=false then ClearEvent(Event);
end;}
evKeyDown :
begin
DontClear:=false;
@ -863,8 +911,8 @@ end;
END.
{
$Log$
Revision 1.10 1999-02-19 15:43:20 peter
* compatibility fixes for FV
Revision 1.11 1999-02-22 11:51:38 peter
* browser updates from gabor
Revision 1.9 1999/02/18 13:44:34 peter
* search fixed

View File

@ -235,6 +235,7 @@ type
LogLB : PMessageListBox;
constructor Init;
procedure AddMessage(AClass: longint; Msg, Module: string; Line,Column: longint);
procedure ClearMessages;
procedure SizeLimits(var Min, Max: TPoint); virtual;
procedure Close; virtual;
procedure HandleEvent(var Event: TEvent); virtual;
@ -2539,12 +2540,12 @@ begin
if ClassS<>'' then
ClassS:=RExpand(ClassS,0)+': ';
S:=ClassS;
if (Module<>nil) and (ID<>0) then
S:=NameAndExtOf(Module^)+'('+IntToStr(ID)+') '+S;
if Text<>nil then S:=S+Text^;
if (Module<>nil) {and (ID<>0)} then
S:=S+Module^+' ('+IntToStr(ID)+'): ';
if Text<>nil then S:=ClassS+Text^;
if length(S)>MaxLen then S:=copy(S,1,MaxLen-2)+'..';
GetText:=S;
end;
end;
constructor TProgramInfoWindow.Init;
var R,R2: TRect;
@ -2583,6 +2584,12 @@ begin
LogLB^.AddItem(New(PCompilerMessage, Init(AClass, Msg, Module, Line,Column)));
end;
procedure TProgramInfoWindow.ClearMessages;
begin
LogLB^.Clear;
ReDraw;
end;
procedure TProgramInfoWindow.SizeLimits(var Min, Max: TPoint);
begin
inherited SizeLimits(Min,Max);
@ -3284,7 +3291,10 @@ end;
END.
{
$Log$
Revision 1.18 1999-02-22 11:29:38 pierre
Revision 1.19 1999-02-22 11:51:39 peter
* browser updates from gabor
Revision 1.18 1999/02/22 11:29:38 pierre
+ added col info in MessageItem
+ grep uses HighLightExts and should work for linux

View File

@ -4,12 +4,101 @@ uses Test2;
const A = 1234;
B = $1234;
ConstBool1 = true;
ConstBool2 = boolean(5);
ConstChar = 'A';
ConstSet = ['A'..'Z'];
ConstSet2 = [15..254];
ConstFloat = 3.1415;
type
PObj = ^TObj;
TObj = object
constructor Init;
function Func: boolean;
procedure Proc; virtual;
destructor Done; virtual;
private
Z: integer;
end;
TObj2 = object(TObj)
procedure Proc; virtual;
end;
TClass = class
constructor Create;
end;
TClass2 = class(TClass)
end;
EnumTyp = (enum1,enum2,enum3);
ArrayTyp = array[1..10] of EnumTyp;
ProcTyp = function(A: word; var B: longint; const C: EnumTyp): real;
SetTyp = set of EnumTyp;
const
ConstOrd = enum1;
var Hello : word;
X: PRecord;
Bool: boolean;
T : TRecord;
Str20 : string[20];
Str255: string;
ArrayW: array[2..45] of word;
ArrayVar: ArrayTyp;
EnumVar: (enumElem1,enumElem2,enumElem3);
EnumVar2: EnumTyp;
FileVar: file;
FileVarR: file of TRecord;
FileVarW: file of word;
ProcVar: procedure;
ProcVarD: function(X: real): boolean;
ProcVarI: ProcTyp;
SetVarD: set of char;
SetVarI: SetTyp;
Float1: real;
Float2: double;
Float3: comp;
Float4: extended;
Pointer1: pointer;
Pointer2: PObj;
ClassVar1: TClass;
ClassVar2: TClass2;
Obj1: TObj;
Obj2: TObj2;
function Func1(x,z : word;y : boolean): shortint;
constructor TObj.Init;
begin
Z:=1;
end;
function TObj.Func: boolean;
begin
Func:=true;
end;
procedure TObj.Proc;
begin
if Func=false then Halt;
end;
destructor TObj.Done;
begin
end;
procedure TObj2.Proc;
begin
Z:=4;
end;
constructor TClass.Create;
begin
end;
function Func1(x,z : word; var y : boolean; const r: TRecord): shortint;
procedure test_local(c,f : longint);
var
@ -33,6 +122,6 @@ BEGIN
For i:=0 to paramcount do
writeln('Paramstr(',i,') = ',Paramstr(i));
writeln(IsOdd(3));
writeln(Func1(5,5,true));
writeln(Func1(5,5,Bool,T));
Halt;
END.