compiler: output ansistring constants in explicit codepage if codepage is explicitly defined using either $codepage directive or compiler switch or for SystemCodepage modeswitch

git-svn-id: trunk@19462 -
This commit is contained in:
paul 2011-10-11 08:58:56 +00:00
parent 6ec879219e
commit 21ac5dfb3b
5 changed files with 18 additions and 11 deletions

View File

@ -139,7 +139,7 @@ interface
cs_support_c_operators, cs_support_c_operators,
{ generation } { generation }
cs_profile,cs_debuginfo,cs_compilesystem, cs_profile,cs_debuginfo,cs_compilesystem,
cs_lineinfo,cs_implicit_exceptions, cs_lineinfo,cs_implicit_exceptions,cs_explicit_codepage,
{ linking } { linking }
cs_create_smart,cs_create_dynamic,cs_create_pic, cs_create_smart,cs_create_dynamic,cs_create_pic,
{ browser switches are back } { browser switches are back }

View File

@ -292,7 +292,7 @@ implementation
if cp=CP_NONE then if cp=CP_NONE then
cp:=0; cp:=0;
{ for delphiuncode mode output CP_ACP constants in the compiler codepage } { for delphiuncode mode output CP_ACP constants in the compiler codepage }
if (cp=0) and (m_systemcodepage in current_settings.modeswitches) then if (cp=0) and (cs_explicit_codepage in current_settings.moduleswitches) then
cp:=current_settings.sourcecodepage; cp:=current_settings.sourcecodepage;
entry := PHashSetItem(TTagHashSet(pool).FindOrAdd(value_str,len,cp)) entry := PHashSetItem(TTagHashSet(pool).FindOrAdd(value_str,len,cp))
end end

View File

@ -867,11 +867,12 @@ begin
'c' : 'c' :
begin begin
if (upper(more)='UTF8') or (upper(more)='UTF-8') then if (upper(more)='UTF8') or (upper(more)='UTF-8') then
init_settings.sourcecodepage:=CP_UTF8 init_settings.sourcecodepage:=CP_UTF8
else if not(cpavailable(more)) then else if not(cpavailable(more)) then
Message1(option_code_page_not_available,more) Message1(option_code_page_not_available,more)
else else
init_settings.sourcecodepage:=codepagebyname(more); init_settings.sourcecodepage:=codepagebyname(more);
include(init_settings.moduleswitches,cs_explicit_codepage);
end; end;
'C' : 'C' :
RCCompiler := More; RCCompiler := More;

View File

@ -1370,14 +1370,15 @@ unit scandir;
Message(scan_w_switch_is_global) Message(scan_w_switch_is_global)
else else
begin begin
current_scanner.skipspace; current_scanner.skipspace;
s:=current_scanner.readcomment; s:=current_scanner.readcomment;
if (upper(s)='UTF8') or (upper(s)='UTF-8') then if (upper(s)='UTF8') or (upper(s)='UTF-8') then
current_settings.sourcecodepage:=CP_UTF8 current_settings.sourcecodepage:=CP_UTF8
else if not(cpavailable(s)) then else if not(cpavailable(s)) then
Message1(option_code_page_not_available,s) Message1(option_code_page_not_available,s)
else else
current_settings.sourcecodepage:=codepagebyname(s); current_settings.sourcecodepage:=codepagebyname(s);
include(current_settings.moduleswitches,cs_explicit_codepage);
end; end;
end; end;

View File

@ -348,8 +348,12 @@ implementation
if m_systemcodepage in current_settings.modeswitches then if m_systemcodepage in current_settings.modeswitches then
begin begin
current_settings.sourcecodepage:=DefaultSystemCodePage; current_settings.sourcecodepage:=DefaultSystemCodePage;
include(current_settings.moduleswitches,cs_explicit_codepage);
if changeinit then if changeinit then
begin
init_settings.sourcecodepage:=DefaultSystemCodePage; init_settings.sourcecodepage:=DefaultSystemCodePage;
include(init_settings.moduleswitches,cs_explicit_codepage);
end;
end; end;
end; end;
@ -2650,6 +2654,7 @@ In case not, the value returned can be arbitrary.
inc(inputpointer,3); inc(inputpointer,3);
message(scan_c_switching_to_utf8); message(scan_c_switching_to_utf8);
current_settings.sourcecodepage:=CP_UTF8; current_settings.sourcecodepage:=CP_UTF8;
include(current_settings.moduleswitches,cs_explicit_codepage);
end; end;
line_no:=1; line_no:=1;