Browse Source

* Allow widechar sets, reduce to ansichar set

Michaël Van Canneyt 2 years ago
parent
commit
56006aa002
5 changed files with 373 additions and 354 deletions
  1. 3 0
      compiler/msg/errore.msg
  2. 3 2
      compiler/msgidx.inc
  3. 355 350
      compiler/msgtxt.inc
  4. 11 2
      compiler/ptype.pas
  5. 1 0
      rtl/inc/systemh.inc

+ 3 - 0
compiler/msg/errore.msg

@@ -1651,6 +1651,9 @@ parser_e_promising_exports_not_supported_on_current_platform=03367_E_Declaring e
 % Promising exports are WebAssembly-specific. They are not allowed on other platforms.
 % Promising exports are WebAssembly-specific. They are not allowed on other platforms.
 parser_e_suspending_externals_not_supported_on_current_platform=03368_E_Declaring externals as 'suspending' is WebAssembly-specific and is not supported on the current platform
 parser_e_suspending_externals_not_supported_on_current_platform=03368_E_Declaring externals as 'suspending' is WebAssembly-specific and is not supported on the current platform
 % Suspending externals are WebAssembly-specific. They are not allowed on other platforms.
 % Suspending externals are WebAssembly-specific. They are not allowed on other platforms.
+parser_w_widechar_set_reduced=03369_W_Reducing Widechar set to single-byte AnsiChar set.
+% The base type of a set can only have 255 elements. Sets of wide characters
+% are reduced to sets of 1-byte characters.
 %
 %
 % \end{description}
 % \end{description}
 %
 %

+ 3 - 2
compiler/msgidx.inc

@@ -482,6 +482,7 @@ const
   parser_e_wasm_ref_types_can_only_be_passed_by_value=03366;
   parser_e_wasm_ref_types_can_only_be_passed_by_value=03366;
   parser_e_promising_exports_not_supported_on_current_platform=03367;
   parser_e_promising_exports_not_supported_on_current_platform=03367;
   parser_e_suspending_externals_not_supported_on_current_platform=03368;
   parser_e_suspending_externals_not_supported_on_current_platform=03368;
+  parser_w_widechar_set_reduced=03369;
   type_e_mismatch=04000;
   type_e_mismatch=04000;
   type_e_incompatible_types=04001;
   type_e_incompatible_types=04001;
   type_e_not_equal_types=04002;
   type_e_not_equal_types=04002;
@@ -1167,9 +1168,9 @@ const
   option_info=11024;
   option_info=11024;
   option_help_pages=11025;
   option_help_pages=11025;
 
 
-  MsgTxtSize = 91554;
+  MsgTxtSize = 91613;
 
 
   MsgIdxMax : array[1..20] of longint=(
   MsgIdxMax : array[1..20] of longint=(
-    28,109,369,134,102,63,148,38,223,71,
+    28,109,370,134,102,63,148,38,223,71,
     68,20,30,1,1,1,1,1,1,1
     68,20,30,1,1,1,1,1,1,1
   );
   );

File diff suppressed because it is too large
+ 355 - 350
compiler/msgtxt.inc


+ 11 - 2
compiler/ptype.pas

@@ -1320,8 +1320,17 @@ implementation
                   Message(sym_e_ill_type_decl_set);
                   Message(sym_e_ill_type_decl_set);
                orddef :
                orddef :
                  begin
                  begin
-                   if (torddef(tt2).ordtype<>uvoid) and
-                      (torddef(tt2).ordtype<>uwidechar) and
+                   if (torddef(tt2).ordtype=uwidechar) then
+                     begin
+                     if (m_default_unicodestring in current_settings.modeswitches) then
+                       begin
+                       Message(parser_w_widechar_set_reduced);
+                       def:=csetdef.create(cansichartype,torddef(cansichartype).low.svalue,torddef(cansichartype).high.svalue,true);
+                       end
+                     else
+                       Message(sym_e_ill_type_decl_set);  
+                     end
+                   else if (torddef(tt2).ordtype<>uvoid) and
                       (torddef(tt2).low>=0) then
                       (torddef(tt2).low>=0) then
                      // !! def:=csetdef.create(tt2,torddef(tt2.def).low,torddef(tt2.def).high),true)
                      // !! def:=csetdef.create(tt2,torddef(tt2.def).low,torddef(tt2.def).high),true)
                      if Torddef(tt2).high>int64(high(byte)) then
                      if Torddef(tt2).high>int64(high(byte)) then

+ 1 - 0
rtl/inc/systemh.inc

@@ -546,6 +546,7 @@ Type
 { Zero - terminated strings }
 { Zero - terminated strings }
 
 
 {$IF DECLARED(AnsiChar)}
 {$IF DECLARED(AnsiChar)}
+=======
 // Compiler defines AnsiChar and WideChar, not AnsiChar
 // Compiler defines AnsiChar and WideChar, not AnsiChar
 {$IFDEF UNICODERTL}
 {$IFDEF UNICODERTL}
   Char = WideChar;
   Char = WideChar;

Some files were not shown because too many files changed in this diff