+ ansi string constants fixed

+ switch $H partial implemented
This commit is contained in:
florian 1998-07-18 17:11:07 +00:00
parent c635ab47c7
commit ce8b39ae1f
5 changed files with 72 additions and 25 deletions

View File

@ -37,7 +37,7 @@ interface
implementation
uses
cobjects,verbose,
cobjects,verbose,globals,
symtable,aasm,i386,
hcodegen,cgai386,temp_gen,tgeni386,cgi386;
@ -190,24 +190,32 @@ implementation
getmem(pc,length(p^.values^)+3);
move(p^.values^,pc^,length(p^.values^)+1);
pc[length(p^.values^)+1]:=#0;
{$else UseAnsiString}
pc:=getpcharcopy(p);
{$endif UseAnsiString}
concat_constlabel(lastlabel,conststring);
{$ifdef UseAnsiString}
{$ifdef debug}
consts^.concat(new(pai_asm_comment,init('Header of ansistring')));
{$endif debug}
consts^.concat(new(pai_const,init_32bit(p^.length)));
consts^.concat(new(pai_const,init_32bit(p^.length)));
consts^.concat(new(pai_const,init_32bit(-1)));
{ to overcome this problem we set the length explicitly }
{ with the ending null char }
consts^.concat(new(pai_string,init_length_pchar(pc,p^.length+1)));
{$else UseAnsiString}
{ we still will have a problem if there is a #0 inside the pchar }
consts^.concat(new(pai_string,init_length_pchar(pc,length(p^.values^)+2)));
{$else UseAnsiString}
if cs_ansistrings in aktswitches then
begin
concat_constlabel(lastlabel,conststring);
consts^.concat(new(pai_const,init_32bit(p^.length)));
consts^.concat(new(pai_const,init_32bit(p^.length)));
consts^.concat(new(pai_const,init_32bit(-1)));
getmem(pc,p^.length+1);
move(p^.values^,pc^,p^.length+1);
{ to overcome this problem we set the length explicitly }
{ with the ending null char }
consts^.concat(new(pai_string,init_length_pchar(pc,p^.length+1)));
end
else
begin
getmem(pc,p^.length+3);
move(p^.values^,pc[1],p^.length+1);
pc[0]:=chr(p^.length);
concat_constlabel(lastlabel,conststring);
{ to overcome this problem we set the length explicitly }
{ with the ending null char }
consts^.concat(new(pai_string,init_length_pchar(pc,p^.length+2)));
end;
{$endif UseAnsiString}
end;
end;
@ -328,7 +336,11 @@ implementation
end.
{
$Log$
Revision 1.5 1998-06-25 08:48:07 florian
Revision 1.6 1998-07-18 17:11:07 florian
+ ansi string constants fixed
+ switch $H partial implemented
Revision 1.5 1998/06/25 08:48:07 florian
* first version of rtti support
Revision 1.4 1998/06/08 13:13:31 pierre

View File

@ -1498,7 +1498,10 @@ unit pass_1;
{why this !!! lost of dummy type definitions
one per const string !!!
p^.resulttype:=new(pstringdef,init(length(p^.values^)));}
p^.resulttype:=cstringdef;
if cs_ansistrings in aktswitches then
p^.resulttype:=cansistringdef
else
p^.resulttype:=cstringdef;
p^.location.loc:=LOC_MEM;
end;
@ -5040,7 +5043,11 @@ unit pass_1;
end.
{
$Log$
Revision 1.39 1998-07-14 21:46:47 peter
Revision 1.40 1998-07-18 17:11:09 florian
+ ansi string constants fixed
+ switch $H partial implemented
Revision 1.39 1998/07/14 21:46:47 peter
* updated messages file
Revision 1.38 1998/07/14 14:46:50 peter

View File

@ -82,6 +82,7 @@ unit pdecl;
sym : psym;
ps : pconstset;
pd : pdouble;
sp : pstring;
begin
consume(_CONST);
@ -109,7 +110,15 @@ unit pdecl;
end;
stringconstn:
{values is disposed with p so I need a copy !}
{$ifdef USEANSISTRING} begin
getmem(sp,p^.length+1);
move(p^.values^,sp^[1],p^.length);
sp^[0]:=chr(p^.length);
symtablestack^.insert(new(pconstsym,init(name,conststring,longint(sp),nil)));
end;
{$else USEANSISTRING}
symtablestack^.insert(new(pconstsym,init(name,conststring,longint(stringdup(p^.values^)),nil)));
{$endif USEANSISTRING}
realconstn : begin
new(pd);
pd^:=p^.valued;
@ -1864,7 +1873,11 @@ unit pdecl;
end.
{
$Log$
Revision 1.32 1998-07-14 21:46:50 peter
Revision 1.33 1998-07-18 17:11:11 florian
+ ansi string constants fixed
+ switch $H partial implemented
Revision 1.32 1998/07/14 21:46:50 peter
* updated messages file
Revision 1.31 1998/07/14 14:46:53 peter

View File

@ -36,6 +36,8 @@
MMX instructions
EXTERN_MSG Don't compile the msgfiles in the compiler, always
use external messagefiles
NOAG386INT no Intel Assembler output
NOAG386NSM no NASM output
-----------------------------------------------------------------
Required switches for a i386 compiler be compiled by Free Pascal Compiler:
@ -106,8 +108,7 @@ uses
{$ifopt o+}
Overlay,ppovin,
{$else}
{ warn when not $O+ is used }
- You must compile with the $O+ switch
{$error You must compile with the $O+ switch}
{$endif}
{$endif useoverlay}
{$ifdef lock}
@ -192,16 +193,22 @@ uses
{$O cg386ld}
{$O cg386mat}
{$O cg386set}
{$ifndef NOOPT}
{$O aopt386}
{$endif NOOPT}
{$O cgai386}
{$O i386}
{$O ra386dir}
{$O ra386int}
{$O ra386att}
{$O tgeni386}
{$ifndef NoAg386Int}
{$O ag386int}
{$endif NoAg386Int}
{$O ag386att}
{$ifndef NoAg386Nsm}
{$O ag386nsm}
{$endif}
{$endif}
{$ifdef m68k}
{$O opts68k}
@ -392,7 +399,11 @@ begin
end.
{
$Log$
Revision 1.20 1998-07-14 14:46:55 peter
Revision 1.21 1998-07-18 17:11:12 florian
+ ansi string constants fixed
+ switch $H partial implemented
Revision 1.20 1998/07/14 14:46:55 peter
* released NEWINPUT
Revision 1.19 1998/07/07 11:20:04 peter

View File

@ -71,7 +71,7 @@ const
{E} (typesw:programglobal; setsw:cs_fp_emulation; proc:nil),
{F} (typesw:unsupported; setsw:cs_none; proc:nil),
{G} (typesw:unsupported; setsw:cs_none; proc:nil),
{H} (typesw:unsupported; setsw:cs_none; proc:nil),
{H} (typesw:local; setsw:cs_ansistrings; proc:nil),
{I} (typesw:local; setsw:cs_iocheck; proc:nil),
{J} (typesw:illegal; setsw:cs_none; proc:nil),
{K} (typesw:unsupported; setsw:cs_none; proc:nil),
@ -161,7 +161,11 @@ end;
end.
{
$Log$
Revision 1.5 1998-06-04 23:52:00 peter
Revision 1.6 1998-07-18 17:11:13 florian
+ ansi string constants fixed
+ switch $H partial implemented
Revision 1.5 1998/06/04 23:52:00 peter
* m68k compiles
+ .def file creation moved to gendef.pas so it could also be used
for win32