* use ' rather than " as quote character in generated shell scripts

on unix platforms, so that $ is not interpreted as the start of a
    variable name (several jvm assembler file names include $ signs)

   -- note: the behaviour of that code depended and still depends on
        on the platform for which the compiler was compiled, instead
        on the platform for which the script is generated. That still
        needs to be fixed

git-svn-id: branches/jvmbackend@19749 -
This commit is contained in:
Jonas Maebe 2011-12-04 15:43:37 +00:00
parent c9e6bc8d49
commit b3cf95faf6

View File

@ -915,9 +915,15 @@ implementation
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
FORBIDDEN_CHARS = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', FORBIDDEN_CHARS = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')',
'{', '}', '''', '`', '~']; '{', '}', '''', '`', '~'];
QUOTE_CHAR = '"';
{$ELSE} {$ELSE}
FORBIDDEN_CHARS = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', FORBIDDEN_CHARS = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')',
'{', '}', '''', ':', '\', '`', '~']; '{', '}', '''', ':', '\', '`', '~'];
{$ifdef unix}
QUOTE_CHAR = '''';
{$else}
QUOTE_CHAR = '"';
{$endif}
{$ENDIF} {$ENDIF}
var var
s1 : ansistring; s1 : ansistring;
@ -925,14 +931,14 @@ implementation
quoted : boolean; quoted : boolean;
begin begin
quoted:=false; quoted:=false;
s1:='"'; s1:=QUOTE_CHAR;
for i:=1 to length(s) do for i:=1 to length(s) do
begin begin
case s[i] of case s[i] of
'"' : QUOTE_CHAR :
begin begin
quoted:=true; quoted:=true;
s1:=s1+'\"'; s1:=s1+('\'+QUOTE_CHAR);
end; end;
' ', ' ',
#128..#255 : #128..#255 :
@ -948,7 +954,7 @@ implementation
end; end;
end; end;
if quoted then if quoted then
maybequoted:=s1+'"' maybequoted:=s1+QUOTE_CHAR
else else
maybequoted:=s; maybequoted:=s;
end; end;
@ -959,9 +965,15 @@ implementation
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
FORBIDDEN_CHARS = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', FORBIDDEN_CHARS = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')',
'{', '}', '''', '`', '~']; '{', '}', '''', '`', '~'];
QUOTE_CHAR = '"';
{$ELSE} {$ELSE}
FORBIDDEN_CHARS = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', FORBIDDEN_CHARS = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')',
'{', '}', '''', ':', '\', '`', '~']; '{', '}', '"', ':', '\', '`', '~'];
{$ifdef unix}
QUOTE_CHAR = '''';
{$else}
QUOTE_CHAR = '"';
{$endif}
{$ENDIF} {$ENDIF}
var var
s1 : string; s1 : string;
@ -969,14 +981,14 @@ implementation
quoted : boolean; quoted : boolean;
begin begin
quoted:=false; quoted:=false;
s1:='"'; s1:=QUOTE_CHAR;
for i:=1 to length(s) do for i:=1 to length(s) do
begin begin
case s[i] of case s[i] of
'"' : QUOTE_CHAR :
begin begin
quoted:=true; quoted:=true;
s1:=s1+'\"'; s1:=s1+('\'+QUOTE_CHAR);
end; end;
' ', ' ',
#128..#255 : #128..#255 :
@ -992,7 +1004,7 @@ implementation
end; end;
end; end;
if quoted then if quoted then
maybequoted:=s1+'"' maybequoted:=s1+QUOTE_CHAR
else else
maybequoted:=s; maybequoted:=s;
end; end;