* tokens.dat only used for TP, and also removed from

compiler dependencies
This commit is contained in:
pierre 1999-09-03 08:37:34 +00:00
parent 1777e0c901
commit 29bdd631a1
3 changed files with 64 additions and 14 deletions

View File

@ -275,23 +275,23 @@ msg: msgtxt.inc
# Make only the compiler # Make only the compiler
ifndef COMPLETE ifndef COMPLETE
$(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg tokens.dat $(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg
$(COMPILER) pp.pas $(COMPILER) pp.pas
$(EXECPPAS) $(EXECPPAS)
$(MOVE) $(PPEXENAME) $(EXENAME) $(MOVE) $(PPEXENAME) $(EXENAME)
else else
$(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg tokens.dat $(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg
$(COMPILER) $(LOCALOPT) pp.pas $(COMPILER) pp.pas
$(EXECPPAS) $(EXECPPAS)
$(COMPILER) $(LOCALOPT) pp.pas $(COMPILER) pp.pas
$(EXECPPAS) $(EXECPPAS)
$(COMPILER) $(LOCALOPT) pp.pas $(COMPILER) pp.pas
$(EXECPPAS) $(EXECPPAS)
$(MOVE) $(PPEXENAME) $(EXENAME) $(MOVE) $(PPEXENAME) $(EXENAME)
endif endif
tokens.dat : $(wildcard *.pas) $(wildcard *.inc) tokens.dat : $(wildcard *.pas) $(wildcard *.inc)
$(COMPILER) $(LOCALOPT) tokendat.pas $(COMPILER) tokendat.pas
./tokendat ./tokendat
# This target remakes the units with the currently made version # This target remakes the units with the currently made version
@ -403,7 +403,11 @@ $(M68KEXENAME): $(PASFILES) $(INCFILES)
# #
# $Log$ # $Log$
# Revision 1.36 1999-09-02 18:47:41 daniel # Revision 1.37 1999-09-03 08:37:34 pierre
# * tokens.dat only used for TP, and also removed from
# compiler dependencies
#
# Revision 1.36 1999/09/02 18:47:41 daniel
# * Could not compile with TP, some arrays moved to heap # * Could not compile with TP, some arrays moved to heap
# * NOAG386BIN default for TP # * NOAG386BIN default for TP
# * AG386* files were not compatible with TP, fixed. # * AG386* files were not compatible with TP, fixed.

View File

@ -21,12 +21,18 @@
**************************************************************************** ****************************************************************************
} }
{$ifdef TP}
program tokendat; program tokendat;
uses tokens,globtype; uses tokens,globtype;
{$define IncludeTokens}
{$define IncludeCreateTokenIndex}
{$endif TP}
{$ifdef IncludeTokens}
const const
tokeninfo:array[ttoken] of tokenrec=( arraytokeninfo:array[ttoken] of tokenrec=(
(str:'' ;special:true ;keyword:m_none), (str:'' ;special:true ;keyword:m_none),
{ Operators which can be overloaded } { Operators which can be overloaded }
(str:'+' ;special:true ;keyword:m_none), (str:'+' ;special:true ;keyword:m_none),
@ -198,6 +204,7 @@ const
(str:'INITIALIZATION';special:false;keyword:m_initfinal), (str:'INITIALIZATION';special:false;keyword:m_initfinal),
(str:'RESOURCESTRING';special:false;keyword:m_class) (str:'RESOURCESTRING';special:false;keyword:m_class)
); );
{$endif IncludeTokens}
{Header is designed both to identify the file and to display a nice {Header is designed both to identify the file and to display a nice
message when you use the type command on it. message when you use the type command on it.
@ -209,6 +216,8 @@ Explanation:
#26 End of file. Causes type to stop reading the file. #26 End of file. Causes type to stop reading the file.
} }
{$ifdef IncludeCreateTokenIndex}
procedure create_tokenidx; procedure create_tokenidx;
{ create an index with the first and last token for every possible token { create an index with the first and last token for every possible token
@ -220,15 +229,17 @@ begin
fillchar(tokenidx^,sizeof(tokenidx^),0); fillchar(tokenidx^,sizeof(tokenidx^),0);
for t:=low(ttoken) to high(ttoken) do for t:=low(ttoken) to high(ttoken) do
begin begin
if not tokeninfo[t].special then if not arraytokeninfo[t].special then
begin begin
if ord(tokenidx^[length(tokeninfo[t].str),tokeninfo[t].str[1]].first)=0 then if ord(tokenidx^[length(arraytokeninfo[t].str),arraytokeninfo[t].str[1]].first)=0 then
tokenidx^[length(tokeninfo[t].str),tokeninfo[t].str[1]].first:=t; tokenidx^[length(arraytokeninfo[t].str),arraytokeninfo[t].str[1]].first:=t;
tokenidx^[length(tokeninfo[t].str),tokeninfo[t].str[1]].last:=t; tokenidx^[length(arraytokeninfo[t].str),arraytokeninfo[t].str[1]].last:=t;
end; end;
end; end;
end; end;
{$endif IncludeCreateTokenIndex}
{$ifdef TP}
const headerstr:string[length(tokheader)]=tokheader; const headerstr:string[length(tokheader)]=tokheader;
var f:file; var f:file;
@ -251,3 +262,6 @@ begin
close(f); close(f);
dispose(tokenidx); dispose(tokenidx);
end. end.
{$endif TP}

View File

@ -25,6 +25,7 @@ interface
uses uses
globtype; globtype;
const const
tokenidlen=14; tokenidlen=14;
tokheader=#8'Free Pascal Compiler -- Token data'#13#10#26; tokheader=#8'Free Pascal Compiler -- Token data'#13#10#26;
@ -226,23 +227,41 @@ var tokeninfo:ptokenarray;
procedure inittokens; procedure inittokens;
procedure donetokens; procedure donetokens;
{$ifndef TP}
{$define IncludeTokens}
{$i tokendat.pas}
{$endif not TP}
implementation implementation
uses globals; uses globals;
{$ifndef TP}
{$undef IncludeTokens}
{$define IncludeCreateTokenIndex}
{$i tokendat.pas}
{$endif not TP}
procedure inittokens; procedure inittokens;
var f:file; {$ifdef TP}
var
f:file;
header:string; header:string;
a:longint; a:longint;
{$endif TP}
begin begin
{$ifdef TP}
assign(f,exepath+'tokens.dat'); assign(f,exepath+'tokens.dat');
reset(f,1); reset(f,1);
{We are not sure that the msg file is loaded!} {We are not sure that the msg file is loaded!}
if ioresult<>0 then if ioresult<>0 then
begin begin
close(f); close(f);
{ Very nice indeed !!! PM }
writeln('Fatal: File tokens.dat not found.'); writeln('Fatal: File tokens.dat not found.');
halt(3); halt(3);
end; end;
@ -260,19 +279,32 @@ begin
new(tokenidx); new(tokenidx);
blockread(f,tokenidx^,sizeof(tokenidx^)); blockread(f,tokenidx^,sizeof(tokenidx^));
close(f); close(f);
{$else not TP}
tokeninfo:=@arraytokeninfo;
new(tokenidx);
create_tokenidx;
{$endif not TP}
end; end;
procedure donetokens; procedure donetokens;
begin begin
{$ifdef TP}
dispose(tokeninfo); dispose(tokeninfo);
{$else TP}
tokeninfo:=nil;
{$endif TP}
dispose(tokenidx); dispose(tokenidx);
end; end;
end. end.
{ {
$Log$ $Log$
Revision 1.12 1999-09-02 18:47:49 daniel Revision 1.13 1999-09-03 08:37:34 pierre
* tokens.dat only used for TP, and also removed from
compiler dependencies
Revision 1.12 1999/09/02 18:47:49 daniel
* Could not compile with TP, some arrays moved to heap * Could not compile with TP, some arrays moved to heap
* NOAG386BIN default for TP * NOAG386BIN default for TP
* AG386* files were not compatible with TP, fixed. * AG386* files were not compatible with TP, fixed.