* bugfix for multiline string constants

This commit is contained in:
olle 2004-03-17 12:03:00 +00:00
parent 4a0a19d733
commit ea51b18d9b
2 changed files with 83 additions and 73 deletions

View File

@ -503,7 +503,7 @@ implementation
begin begin
AsmWrite(#9#9'DB'#9); AsmWrite(#9#9'DB'#9);
quoted:=false; quoted:=false;
for i:=counter to counter+line_length do for i:=counter to counter+line_length-1 do
begin begin
{ it is an ascii character. } { it is an ascii character. }
if (ord(tai_string(hp).str[i])>31) and if (ord(tai_string(hp).str[i])>31) and
@ -534,7 +534,8 @@ implementation
counter := counter+line_length; counter := counter+line_length;
end; { end for j:=0 ... } end; { end for j:=0 ... }
{ do last line of lines } { do last line of lines }
AsmWrite(#9#9'DB'#9); if counter<tai_string(hp).len then
AsmWrite(#9#9'DB'#9);
quoted:=false; quoted:=false;
for i:=counter to tai_string(hp).len-1 do for i:=counter to tai_string(hp).len-1 do
begin begin
@ -882,7 +883,10 @@ initialization
end. end.
{ {
$Log$ $Log$
Revision 1.46 2004-02-27 10:21:05 florian Revision 1.47 2004-03-17 12:03:00 olle
* bugfix for multiline string constants
Revision 1.46 2004/02/27 10:21:05 florian
* top_symbol killed * top_symbol killed
+ refaddr to treference added + refaddr to treference added
+ refsymbol to treference added + refsymbol to treference added

View File

@ -933,84 +933,87 @@ var
AsmWriteLn(#9'dc.d'#9'"'+double2str(tai_real_64bit(hp).value)+'"'); AsmWriteLn(#9'dc.d'#9'"'+double2str(tai_real_64bit(hp).value)+'"');
ait_string: ait_string:
begin begin
{NOTE When a single quote char is encountered, it is {NOTE When a single quote char is encountered, it is
replaced with a numeric ascii value. It could also replaced with a numeric ascii value. It could also
have been replaced with the escape seq of double quotes. have been replaced with the escape seq of double quotes.
Backslash seems to be used as an escape char, although Backslash seems to be used as an escape char, although
this is not mentioned in the PPCAsm documentation.} this is not mentioned in the PPCAsm documentation.}
counter := 0; counter := 0;
lines := tai_string(hp).len div line_length; lines := tai_string(hp).len div line_length;
{ separate lines in different parts } { separate lines in different parts }
if tai_string(hp).len > 0 then if tai_string(hp).len > 0 then
Begin begin
for j := 0 to lines-1 do for j := 0 to lines-1 do
begin begin
AsmWrite(#9'dc.b'#9); AsmWrite(#9'dc.b'#9);
quoted:=false; quoted:=false;
for i:=counter to counter+line_length do for i:=counter to counter+line_length-1 do
begin begin
{ it is an ascii character. } { it is an ascii character. }
if (ord(tai_string(hp).str[i])>31) and if (ord(tai_string(hp).str[i])>31) and
(ord(tai_string(hp).str[i])<128) and (ord(tai_string(hp).str[i])<128) and
(tai_string(hp).str[i]<>'''') and (tai_string(hp).str[i]<>'''') and
(tai_string(hp).str[i]<>'\') then (tai_string(hp).str[i]<>'\') then
begin begin
if not(quoted) then if not(quoted) then
begin begin
if i>counter then if i>counter then
AsmWrite(',');
AsmWrite('''');
end;
AsmWrite(tai_string(hp).str[i]);
quoted:=true;
end { if > 31 and < 128 and ord('"') }
else
begin
if quoted then
AsmWrite('''');
if i>counter then
AsmWrite(','); AsmWrite(',');
quoted:=false; AsmWrite('''');
AsmWrite(tostr(ord(tai_string(hp).str[i]))); end;
end; AsmWrite(tai_string(hp).str[i]);
end; { end for i:=0 to... } quoted:=true;
if quoted then AsmWrite(''''); end { if > 31 and < 128 and ord('"') }
AsmWrite(target_info.newline); else
counter := counter+line_length; begin
end; { end for j:=0 ... } if quoted then
{ do last line of lines } AsmWrite('''');
AsmWrite(#9'dc.b'#9);
quoted:=false;
for i:=counter to tai_string(hp).len-1 do
begin
{ it is an ascii character. }
if (ord(tai_string(hp).str[i])>31) and
(ord(tai_string(hp).str[i])<128) and
(tai_string(hp).str[i]<>'''') and
(tai_string(hp).str[i]<>'\') then begin
if not(quoted) then
begin
if i>counter then if i>counter then
AsmWrite(','); AsmWrite(',');
AsmWrite(''''); quoted:=false;
end; AsmWrite(tostr(ord(tai_string(hp).str[i])));
AsmWrite(tai_string(hp).str[i]); end;
quoted:=true; end; { end for i:=0 to... }
end { if > 31 and < 128 and " } if quoted then AsmWrite('''');
else AsmLn;
begin counter := counter+line_length;
if quoted then end; { end for j:=0 ... }
AsmWrite('''');
if i>counter then { do last line of lines }
AsmWrite(','); if counter < tai_string(hp).len then
quoted:=false; AsmWrite(#9'dc.b'#9);
AsmWrite(tostr(ord(tai_string(hp).str[i]))); quoted:=false;
end; for i:=counter to tai_string(hp).len-1 do
end; { end for i:=0 to... } begin
if quoted then { it is an ascii character. }
AsmWrite(''''); if (ord(tai_string(hp).str[i])>31) and
end; (ord(tai_string(hp).str[i])<128) and
AsmLn; (tai_string(hp).str[i]<>'''') and
(tai_string(hp).str[i]<>'\') then
begin
if not(quoted) then
begin
if i>counter then
AsmWrite(',');
AsmWrite('''');
end;
AsmWrite(tai_string(hp).str[i]);
quoted:=true;
end { if > 31 and < 128 and " }
else
begin
if quoted then
AsmWrite('''');
if i>counter then
AsmWrite(',');
quoted:=false;
AsmWrite(tostr(ord(tai_string(hp).str[i])));
end;
end; { end for i:=0 to... }
if quoted then
AsmWrite('''');
end;
AsmLn;
end; end;
ait_label: ait_label:
begin begin
@ -1359,7 +1362,10 @@ initialization
end. end.
{ {
$Log$ $Log$
Revision 1.33 2004-03-02 00:57:01 olle Revision 1.34 2004-03-17 12:03:31 olle
* bugfix for multiline string constants
Revision 1.33 2004/03/02 00:57:01 olle
+ adding missing log msg: misc fixes + adding missing log msg: misc fixes
Revision 1.32 2004/03/02 00:36:33 olle Revision 1.32 2004/03/02 00:36:33 olle