summaryrefslogtreecommitdiff
path: root/compiler/pbase.pas
diff options
context:
space:
mode:
authorjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2011-08-20 08:35:47 +0000
committerjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2011-08-20 08:35:47 +0000
commit1e7f8a79163fbde1acdf3000f08b574f33081e5c (patch)
tree71c79e6bf5b482ff4dcf9430ea38d4cd7346f9b3 /compiler/pbase.pas
parent62af3e07646d5a9f45421691e33d3d6cb20d2e99 (diff)
downloadfpc-1e7f8a79163fbde1acdf3000f08b574f33081e5c.tar.gz
* the default string type for the JVM target is no longer automatically
unicodestring = java.lang.String. The reason this was the default in the past is that this was the first string type that was implemented, and without it being the default most code involving string operations would fail. Now the default strings types are the same as for other targets + new {$modeswitch unicodestrings} directive, that when activated *together* with {$h+}, 1) changes char into an alias for widechar 2) changes string into an alias for unicodestring 3) changes the preferred string evaluation type (in case of uncertainty) to unicodestring {$modeswitch unicodestrings} with {$h-} does not change anything at all regarding the string type (it still changes the char type) + new uuchar unit that redefines char as widechar, and which is automatically included by the compiler if {$modeswitch unicodestrings} is enabled git-svn-id: http://svn.freepascal.org/svn/fpc/branches/jvmbackend@18781 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/pbase.pas')
-rw-r--r--compiler/pbase.pas24
1 files changed, 19 insertions, 5 deletions
diff --git a/compiler/pbase.pas b/compiler/pbase.pas
index c885b7b982..101e3ec1c0 100644
--- a/compiler/pbase.pas
+++ b/compiler/pbase.pas
@@ -264,16 +264,30 @@ implementation
consume(_POINT);
case token of
_ID:
- searchsym_in_module(tunitsym(srsym).module,pattern,srsym,srsymtable);
+ { system.char? (char=widechar comes from the implicit
+ uuchar unit -> override) }
+ if (pattern='CHAR') and
+ (tmodule(tunitsym(srsym).module).globalsymtable=systemunit) then
+ begin
+ if m_default_unicodestring in current_settings.modeswitches then
+ searchsym_in_module(tunitsym(srsym).module,'WIDECHAR',srsym,srsymtable)
+ else
+ searchsym_in_module(tunitsym(srsym).module,'ANSICHAR',srsym,srsymtable)
+ end
+ else
+ searchsym_in_module(tunitsym(srsym).module,pattern,srsym,srsymtable);
_STRING:
begin
{ system.string? }
if tmodule(tunitsym(srsym).module).globalsymtable=systemunit then
begin
- if cs_unicodestrings in current_settings.localswitches then
- searchsym_in_module(tunitsym(srsym).module,'UNICODESTRING',srsym,srsymtable)
- else if cs_ansistrings in current_settings.localswitches then
- searchsym_in_module(tunitsym(srsym).module,'ANSISTRING',srsym,srsymtable)
+ if cs_refcountedstrings in current_settings.localswitches then
+ begin
+ if m_default_unicodestring in current_settings.modeswitches then
+ searchsym_in_module(tunitsym(srsym).module,'UNICODESTRING',srsym,srsymtable)
+ else
+ searchsym_in_module(tunitsym(srsym).module,'ANSISTRING',srsym,srsymtable)
+ end
else
searchsym_in_module(tunitsym(srsym).module,'SHORTSTRING',srsym,srsymtable);
tokentoconsume:=_STRING;