Commit Graph

57 Commits

Author SHA1 Message Date
Rika Ichinose
0b97f169b0 Remove conditionals that rely on not defined(FPC_HAS_CPSTRING). 2024-11-04 10:28:33 +00:00
florian
cb44d7d4e2 * some cleanup
git-svn-id: trunk@43765 -
2019-12-23 21:52:06 +00:00
Jonas Maebe
c8839d487b * fixed accidentally committed (harmless) typo in r32202
git-svn-id: trunk@32226 -
2015-11-04 13:03:45 +00:00
Jonas Maebe
4decb81ac4 * correctly handle code page names specified in upper case (mantis #28934)
git-svn-id: trunk@32202 -
2015-10-30 15:10:26 +00:00
Jonas Maebe
525685617c * unicode2ascii: give an internalerror when trying to convert to UTF-8, as
this routine does not support this (and isn't/shouldn't be used for that
    purpose in the compiler)

git-svn-id: trunk@31882 -
2015-09-28 22:15:00 +00:00
Jonas Maebe
05bf826342 + support UTF-8 in ascii2unicode(), this fixes the UTF-16 output of
resourcestring data .rsj files in case the source file is interpreted as
    UTF-8. Previously, the individual UTF-8 bytes were each stored in a
    separate widechar in the Json file (mantis #28717)

  * due to the fact that rstconv didn't use the cwstring unit on Unix, rstconv
    until now just concatenated the bytes stored in the widechars of the Json
    file on those platforms, i.e., the strings put in the resource file were
    byte for byte equal to what was in the source file. On Windows, these bytes
    were interpreted as individual widechars, converted to the
    DefaultSystemCodePage and then written. This means that for anything but
    ISO-8859-1 (where every widechar from #0000 to #0255 maps to #0 to #255),
    the output got corrupted.

    In order to keep compatibility with the old behaviour whereby rstconv wrote
    the resource strings using the same encoding as in the source file (except
    if the data got completely corrupted, in which case compatibility is
    useless), we now store all resourcestrings twice in the .rsj file: once as
    the exact byte sequence from the source file, and once (properly) encoded
    in UTF-16.

    By default, rstconv will use the byte string and just write that one to the
    resource file. Additionally, there is a new -p option that accepts a code
    page name (see rstconv -h for the list of supported names), which can be
    used to make rstconv use the UTF-16 version and convert that to the desired
    code page (as long as the system on which rstconv runs supports that
    codepage).

    And this also finally resolves mantis #6477.

git-svn-id: trunk@31881 -
2015-09-28 22:14:56 +00:00
Jonas Maebe
fdf76bc606 * ascii2unicode: consistently use the cp parameter
git-svn-id: trunk@31878 -
2015-09-28 22:14:44 +00:00
yury
432248cbf1 * Removed lot of unused vars.
git-svn-id: trunk@31732 -
2015-09-17 12:48:58 +00:00
Jonas Maebe
6dd2fe0320 * converted widestr.charlength() to use system.Utf8CodePointLen()
git-svn-id: trunk@30050 -
2015-03-01 17:12:27 +00:00
Tomas Hajny
2be0cc8aae * avoid crashes when displaying help with an unsupported system codepage
git-svn-id: trunk@30040 -
2015-02-28 23:15:56 +00:00
Tomas Hajny
dbbce18f56 * fix determination of help line length with codepage set to UTF-8 (the string conversion routine in widestr.pas doesn't work for UTF-8 :-((( )
git-svn-id: trunk@30039 -
2015-02-28 22:54:48 +00:00
Tomas Hajny
1ecf8dcfa1 * improved paging of help pages so that lines are not missed with 80x25 windows due to lines overflowing the window width
git-svn-id: trunk@30026 -
2015-02-27 19:26:23 +00:00
Tomas Hajny
9fb4db7a2f * add support for Latin-2 character sets (ISO & IBM)
git-svn-id: trunk@27304 -
2014-03-27 22:48:13 +00:00
paul
f9c3c598b6 compiler: remove big codepage maps from the compiler executable - they will be loaded from -FM path when needed
git-svn-id: trunk@26388 -
2014-01-05 06:06:18 +00:00
paul
93883d1264 compiler: load binary unicode mappings in cpavailable() call instead of separate loadbinarycp() call
git-svn-id: trunk@26379 -
2014-01-04 16:42:20 +00:00
paul
52d1cbc544 compiler:
+ add -FM command line option to pass directory for unicode binary files
  + enable dynamic loading of charset files (don't disable runtime charset files for the moment)

git-svn-id: trunk@26378 -
2014-01-04 15:44:18 +00:00
paul
e379daaf9c compiler, rtl: move cpXXXX.pas files from compiler to RTL\charmaps directory and cleanup them, enable charmaps building for the majority of targets
git-svn-id: trunk@23799 -
2013-03-12 01:35:25 +00:00
yury
849095f5e5 + Added Greek code page 1253 to the compiler to have support for the third modern code page (in addition to cp1251 and cp1252). It is needed to be able to define "type AnsiString(1253)" in tests. Previously I used cp1252 for tests with Euro symbol conversions. But for unknown reason cp1252 does not have the Euro symbol with code $80 on Unix systems (libiconv bug?). In other hand cp1253 has the Euro symbol with code $80 as expected.
git-svn-id: trunk@23615 -
2013-02-14 11:29:47 +00:00
paul
32fc7118d4 compiler: add US-ASCII codepage
git-svn-id: trunk@22419 -
2012-09-18 01:32:24 +00:00
Jonas Maebe
aee5380ae0 * merged trunk up to r20882
o support for the new codepage-aware ansistrings in the jvm branch
   o empty ansistrings are now always represented by a nil pointer rather than
     by an empty string, because an empty string also has a code page which
     can confuse code (although this will make ansistrings harder to use
     in Java code)
   o more string helpers code shared between the general and jvm rtl
   o support for indexbyte/word in the jvm rtl (warning: first parameter
     is an open array rather than an untyped parameter there, so
     indexchar(pcharvar^,10,0) will be equivalent to
     indexchar[pcharvar^],10,0) there, which is different from what is
     intended; changing it to an untyped parameter wouldn't help though)
   o default() support is not yet complete
   o calling fpcres is currently broken due to limitations in
     sysutils.executeprocess() regarding handling unix quoting and
     the compiler using the same command lines for scripts and directly
     calling external programs
   o compiling the Java compiler currently requires adding ALLOW_WARNINGS=1
     to the make command line

git-svn-id: branches/jvmbackend@20887 -
2012-04-15 15:54:10 +00:00
florian
73a084d662 * fixes bootstrapping with 2.6.0
git-svn-id: trunk@19491 -
2011-10-15 12:42:33 +00:00
paul
a99ffb3097 compiler: apply patches from Inoussa and Jonas:
defcmp: Address code paged' string type comparison taking care of the code page
  ncnv: Remove un-needed code page comparison to CP_UTF8, some fixes regarding shortstrings and wide char/string 
  ncon: For the case of tstringconstnode.changestringtype (ncon.pas) where the code page are of CP_NONE or 0 no translation is done as :
    * CP_NONE is compatible to all
    * For 0 the raw bytes are just copied.
 My changes:
  - change ascii2unicode to allow pass source codepage, 
  - convert in both cases when source or destination is UTF8

git-svn-id: trunk@19457 -
2011-10-11 01:21:07 +00:00
florian
a6d01c09aa * make compiler compilable with 2.4.4 rtl
git-svn-id: trunk@19269 -
2011-09-28 18:54:32 +00:00
paul
4d3da666db compiler: replace string codepage comparison to numeric. store codepage as number in current settings
git-svn-id: trunk@19144 -
2011-09-19 00:48:43 +00:00
paul
1db610ecbd merge r17434 from cpstrnew branch by michael:
* Patch from Inoussa to fix constant strings with codepage

git-svn-id: trunk@19109 -
2011-09-17 13:19:59 +00:00
Jonas Maebe
446d91eaab + ansistring support. Items of note:
o support for ansistring constants. It's done via a detour because the
      JVM only supports UTF-16 string constants (no array of byte or anything
      like that): store every ansicharacter in the lower 8 bits of an
      UTF-16 constant string, and at run time copy the characters to an
      ansistring. The alternative is to generate code that stores every
      character separately to an array.
    o the base ansistring support is implemented in a class called
      AnsistringClass, and an ansistring is simply an instance of this
      class under the hood
    o the compiler currently does generate nil pointers as empty
      ansistrings unlike for unicodestrings, where we always
      explicitly generate an empty string. The reason is that
      unicodestrings are the same as JLString and hence common
      for Java interoperation, while ansistrings are unlikely to
      be used in interaction with external Java code

  * fixed indentation

git-svn-id: branches/jvmbackend@18562 -
2011-08-20 08:10:39 +00:00
Jonas Maebe
45d25bbe77 * fixed storing/loading widestring constant nodes into/from ppu files
(mantis #15909)
  * fixed storing/loading widestring constants into/from token streams
  * made storing/loading widestring constant nodes into/from ppu files
    endian safe

git-svn-id: trunk@15017 -
2010-03-14 13:27:00 +00:00
florian
b178b08ba7 Merged revisions 11665-11738 via svnmerge from
http://svn.freepascal.org/svn/fpc/branches/unicodestring

........
  r11665 | florian | 2008-08-30 13:30:17 +0200 (Sat, 30 Aug 2008) | 1 line
  
  * continued to work on unicodestring type support
........
  r11666 | florian | 2008-08-30 19:02:26 +0200 (Sat, 30 Aug 2008) | 2 lines
  
  * expectloc for wide/ansi/unicode strings is LOC_CONSTANT or LOC_REGISTER now
........
  r11667 | florian | 2008-08-30 20:42:37 +0200 (Sat, 30 Aug 2008) | 1 line
  
  * more unicodestring stuff fixed, test results on win32 are already good
........
  r11670 | florian | 2008-08-30 23:21:48 +0200 (Sat, 30 Aug 2008) | 2 lines
  
  * first fixes for unix bootstrapping
........
  r11683 | ivost | 2008-09-01 12:46:39 +0200 (Mon, 01 Sep 2008) | 2 lines
  
      * fixed 64bit bug in iconvenc.pas
........
  r11689 | florian | 2008-09-01 23:12:34 +0200 (Mon, 01 Sep 2008) | 1 line
  
  * fixed several errors when building on unix
........
  r11694 | florian | 2008-09-03 20:32:43 +0200 (Wed, 03 Sep 2008) | 1 line
  
  * fixed unix compilation
........
  r11695 | florian | 2008-09-03 21:01:04 +0200 (Wed, 03 Sep 2008) | 1 line
  
  * bootstrapping fix
........
  r11696 | florian | 2008-09-03 21:07:18 +0200 (Wed, 03 Sep 2008) | 1 line
  
  * more bootstrapping fixed
........
  r11698 | florian | 2008-09-03 22:47:54 +0200 (Wed, 03 Sep 2008) | 1 line
  
  + two missing compiler procs exported
........
  r11701 | florian | 2008-09-04 16:42:34 +0200 (Thu, 04 Sep 2008) | 2 lines
  
  + lazarus project for the linux rtl
........
  r11702 | florian | 2008-09-04 16:43:27 +0200 (Thu, 04 Sep 2008) | 2 lines
  
  + set unicode string procedures
........
  r11707 | florian | 2008-09-04 23:23:02 +0200 (Thu, 04 Sep 2008) | 2 lines
  
  * fixed several type casting stuff
........
  r11712 | florian | 2008-09-05 22:46:03 +0200 (Fri, 05 Sep 2008) | 1 line
  
  * fixed unicodestring compilation on windows after recent unix changes
........
  r11713 | florian | 2008-09-05 23:35:12 +0200 (Fri, 05 Sep 2008) | 1 line
  
  + UnicodeString support for Variants
........
  r11715 | florian | 2008-09-06 20:59:54 +0200 (Sat, 06 Sep 2008) | 1 line
  
  * patch by Martin Schreiber for UnicodeString streaming
........
  r11716 | florian | 2008-09-06 22:22:55 +0200 (Sat, 06 Sep 2008) | 2 lines
  
  * fixed test
........
  r11717 | florian | 2008-09-07 10:25:51 +0200 (Sun, 07 Sep 2008) | 1 line
  
  * fixed typo when converting tunicodestring to punicodechar
........
  r11718 | florian | 2008-09-07 11:29:52 +0200 (Sun, 07 Sep 2008) | 3 lines
  
  * fixed writing of UnicodeString properties
  * moved some helper routines to unicode headers
........
  r11734 | florian | 2008-09-09 22:38:55 +0200 (Tue, 09 Sep 2008) | 1 line
  
  * fixed bootstrapping
........
  r11735 | florian | 2008-09-10 11:25:28 +0200 (Wed, 10 Sep 2008) | 2 lines
  
  * first fixes for persisten unicodestrings
........
  r11736 | florian | 2008-09-10 14:31:00 +0200 (Wed, 10 Sep 2008) | 3 lines
  
  Initialized merge tracking via "svnmerge" with revisions "1-11663" from 
  http://svn.freepascal.org/svn/fpc/trunk
........
  r11737 | florian | 2008-09-10 21:06:57 +0200 (Wed, 10 Sep 2008) | 3 lines
  
  * fixed unicodestring <-> variant handling
  * fixed unicodestring property reading
........

git-svn-id: trunk@11739 -
2008-09-10 20:14:31 +00:00
Jonas Maebe
3f81a4ed65 * make code page name parsing case insensitive (mantis #8930)
git-svn-id: trunk@8610 -
2007-09-22 20:54:49 +00:00
Jonas Maebe
815cd2b39d + support for widestring manager based widechar conversions
(widechar<->char, widechar<>*string), based on patch from
    Rimgaudas Laucius (mantis #7758)
  * no longer perform compile-time widechar/string->char/ansi/
    shortstring conversions if they would destroy information
    (they can't cope with widechars with ord>=128). This means
    that you can now properly constant widechars/widestrings
    in source code with a {$codepage } set without risking that
    the compiler will mangle everything afterwards
  * support ESysEINVAL return code from iconv (happens if last
    multibyte char is incomplete)
  * fixed writing of widechars (were converted to char -> lost
    information)

git-svn-id: trunk@8274 -
2007-08-12 20:01:08 +00:00
peter
c020d709b4 * default widestring-ansistring conversion needs to use the same algorithm
as the rtl to behave the same on compile time and runtime

git-svn-id: trunk@8161 -
2007-07-23 21:57:48 +00:00
florian
9f56a89617 + added cyrillic code page tables
+ support -Fm<x> to load unicode tables from rtl/ucmaps, they must be in the same dir as the compiler though

git-svn-id: trunk@7420 -
2007-05-22 19:38:39 +00:00
florian
85d63d9fa9 * settings refactored
git-svn-id: trunk@5094 -
2006-10-30 18:02:58 +00:00
peter
d07f470b71 * remove ifdef fpc
git-svn-id: trunk@4819 -
2006-10-07 13:43:34 +00:00
Jonas Maebe
d593c10adf * fixed crashes in asciichar2unicode() and ascii2unicode() in case
the current codepage is utf-8

git-svn-id: trunk@4102 -
2006-07-06 14:24:22 +00:00
Jonas Maebe
9b4ce0a501 * donewidestring has var instead of out parameter
git-svn-id: trunk@2535 -
2006-02-12 15:02:46 +00:00
florian
0907a1ef80 * fixed compilerwidestring concatenation
git-svn-id: trunk@1876 -
2005-12-04 18:29:07 +00:00
florian
9c717f2a35 * some warning about uninitialized vars fixed by using out instead of var
git-svn-id: trunk@141 -
2005-05-29 15:18:30 +00:00
fpc
790a4fe2d3 * log and id tags removed
git-svn-id: trunk@42 -
2005-05-21 09:42:41 +00:00
fpc
50778076c3 initial import
git-svn-id: trunk@1 -
2005-05-16 18:37:41 +00:00
peter
e417e34496 * truncate log 2005-02-14 17:13:06 +00:00
mazen
581b52422c - remove $IFDEF DELPHI and related code
- remove $IFDEF FPCPROCVAR and related code
2004-10-15 09:14:16 +00:00
florian
8a9758c5e2 * logs truncated 2004-06-20 08:55:28 +00:00
florian
588e2c38bf * dwarf branch merged 2004-06-16 20:07:06 +00:00
peter
12efb6d19e * strlenint is replaced with sizeint 2004-05-02 11:48:46 +00:00
carl
67486c96c3 * fixes for Delphi 6 compilation
(warning : Some features do not work under Delphi)
2002-10-05 12:43:23 +00:00
florian
4f7b35be5b + source code page support 2002-07-20 17:11:48 +00:00
peter
06ebac4e27 * readded missing revisions 2002-05-18 13:34:04 +00:00
carl
21b3a10f02 + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
+ try to fix temp allocation (still in ifdef)
+ generic constructor calls
+ start of tassembler / tmodulebase class cleanup
2002-05-16 19:46:34 +00:00
peter
2992e1819c * removed old logs and updated copyright year 2002-05-14 19:34:38 +00:00