* 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
ifndef COMPLETE
$(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg tokens.dat
$(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg
$(COMPILER) pp.pas
$(EXECPPAS)
$(MOVE) $(PPEXENAME) $(EXENAME)
else
$(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg tokens.dat
$(COMPILER) $(LOCALOPT) pp.pas
$(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg
$(COMPILER) pp.pas
$(EXECPPAS)
$(COMPILER) $(LOCALOPT) pp.pas
$(COMPILER) pp.pas
$(EXECPPAS)
$(COMPILER) $(LOCALOPT) pp.pas
$(COMPILER) pp.pas
$(EXECPPAS)
$(MOVE) $(PPEXENAME) $(EXENAME)
endif
tokens.dat : $(wildcard *.pas) $(wildcard *.inc)
$(COMPILER) $(LOCALOPT) tokendat.pas
$(COMPILER) tokendat.pas
./tokendat
# This target remakes the units with the currently made version
@ -403,7 +403,11 @@ $(M68KEXENAME): $(PASFILES) $(INCFILES)
#
# $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
# * NOAG386BIN default for TP
# * AG386* files were not compatible with TP, fixed.

View File

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

View File

@ -25,6 +25,7 @@ interface
uses
globtype;
const
tokenidlen=14;
tokheader=#8'Free Pascal Compiler -- Token data'#13#10#26;
@ -226,23 +227,41 @@ var tokeninfo:ptokenarray;
procedure inittokens;
procedure donetokens;
{$ifndef TP}
{$define IncludeTokens}
{$i tokendat.pas}
{$endif not TP}
implementation
uses globals;
{$ifndef TP}
{$undef IncludeTokens}
{$define IncludeCreateTokenIndex}
{$i tokendat.pas}
{$endif not TP}
procedure inittokens;
var f:file;
{$ifdef TP}
var
f:file;
header:string;
a:longint;
{$endif TP}
begin
{$ifdef TP}
assign(f,exepath+'tokens.dat');
reset(f,1);
{We are not sure that the msg file is loaded!}
if ioresult<>0 then
begin
close(f);
{ Very nice indeed !!! PM }
writeln('Fatal: File tokens.dat not found.');
halt(3);
end;
@ -260,19 +279,32 @@ begin
new(tokenidx);
blockread(f,tokenidx^,sizeof(tokenidx^));
close(f);
{$else not TP}
tokeninfo:=@arraytokeninfo;
new(tokenidx);
create_tokenidx;
{$endif not TP}
end;
procedure donetokens;
begin
{$ifdef TP}
dispose(tokeninfo);
{$else TP}
tokeninfo:=nil;
{$endif TP}
dispose(tokenidx);
end;
end.
{
$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
* NOAG386BIN default for TP
* AG386* files were not compatible with TP, fixed.