Commit Graph

178 Commits

Author SHA1 Message Date
Jonas Maebe
ddf08b4eb7 * call TranslatePlaceholderCP() when comparing code pages to avoid
unnecessary conversions between CP_ACP and the current actual
    DefaultSystemCodePage
  * call TranslatePlaceholderCP() when changing the code page of a
    text file because in some cases this code page is passed directly
    to widestringmanager.Wide2AnsiMoveProc() (which does not perform any
    translation itself)

git-svn-id: trunk@26316 -
2013-12-29 19:18:36 +00:00
Jonas Maebe
df6a2dce00 + unicodestring support for assign/erase/rename
+ codepage support for textrec/filerec and the above routines
  * textrec/filerec now store the filename by default using widechar. It is
    possible to switch back to ansichars using the FPC_ANSI_TEXTFILEREC define.
    In that case, from now on the filename will always be stored in
    DefaultFileSystemEncoding
  * fixed potential buffer overflows and non-null-terminated file names in
    textrec/filerec
  + dodirseparators(pwidechar), changed the dodirseparators(pchar/pwidechar)
    parameters into var-parameters and gave those routines an extra parameter
    that indicates whether the p(wide)char can be changed in place if
    necessary or whether a copy must be made first (avoids us having to make
    all strings always unique everywhere, because they might be changed on
    some platforms via a pchar)
  * do_open/do_erase/do_rename got extra boolean parameters indicating whether
    the passed pchars point to data that can be freely changed (to pass on to
    dodirseparators() if applicable)
  * objects.pp: force assign(pchar) to be called, because
    assign(array[0..255]) cannot choose between pchar and rawbytestring
    versions (and removing the pchar version means that assign(pchar) will
    be mapped to assign(shortstring) in {$h-})
  * fixed up some routines in other units that depend on the format of
    the textrec/filerec.name field

git-svn-id: branches/cpstrrtl@25137 -
2013-07-19 16:30:51 +00:00
Jonas Maebe
a5273abc9c + support for CP_OEMCP
* changed all mappings from CP_ACP to DefaultSystemCodePage to calls to the
    new TranslatePlaceholderCP() routine (which also handles CP_OEMCP)
  * removed unnecessary CP_ACP adaptations in fpc_AnsiStr_Concat_multi()
    for JVM target (now handled in the ansistring to unicodestring conversion
    routine)

git-svn-id: branches/cpstrrtl@25091 -
2013-07-12 17:18:24 +00:00
florian
0e41df598e * merge i8086 branch by Nikolay Nikolov
git-svn-id: trunk@24324 -
2013-04-25 20:23:51 +00:00
nickysn
8b6b832677 + added helper functions for read/readln longint/longword on 16/8-bit cpus
git-svn-id: branches/i8086@24047 -
2013-03-28 23:56:47 +00:00
nickysn
697de721ef + added write/writeln helpers in the RTL for writing longints/longwords on 16/8-bit CPUs
git-svn-id: branches/i8086@24006 -
2013-03-25 23:21:42 +00:00
Jonas Maebe
e1e11f81e3 * fixed using readstr/writestr inside routines called from the parameter
list of another readstr/writestr expression (mantis #23912)

git-svn-id: trunk@23888 -
2013-03-17 14:23:33 +00:00
florian
d5985b4f0e * patch by Christophe Staïesse to implement more ISO-like read behaviour in iso mode, resolves #24060
git-svn-id: trunk@23884 -
2013-03-17 08:27:21 +00:00
florian
81e0e3114c * throw an error if threadvars are used but not supported
* fix building for arm-embedded

git-svn-id: trunk@23452 -
2013-01-19 15:17:47 +00:00
florian
420cd9bd27 + support for <text>^ in iso mode
git-svn-id: trunk@22512 -
2012-10-01 17:18:51 +00:00
florian
088a7229aa * use ValSInt parameter as code parameter in val calls to make the code cross platform
git-svn-id: trunk@22148 -
2012-08-20 20:12:04 +00:00
paul
1af45d7ec0 rtl: don't perform unneeded string conversions if string codepage matches codepage to convert (thanks to Sergey)
git-svn-id: trunk@21987 -
2012-07-31 01:24:36 +00:00
Jonas Maebe
aa9aeeada0 * fixed compilation on platforms without ansistring support since assigning
one ansistring to another requires a helper (mantis #21260, patch by
    Koenraad Lelong)

git-svn-id: trunk@20369 -
2012-02-17 13:16:32 +00:00
florian
6a1a2d3464 * get rid of some feature checks, probably the whole feature stuff is plainly the wrong way, embedded rtl compiles again, resolves #20913
git-svn-id: trunk@19907 -
2011-12-29 14:06:30 +00:00
Jonas Maebe
f67d7f08fc * use temporary location to construct writestr() string, because the
final destination may also be used in the other arguments
    (mantis #20744)

git-svn-id: trunk@19678 -
2011-11-24 19:56:21 +00:00
paul
60de075ebe rtl: initialize CodePage field of ReadStr/WriteStr Text variables
git-svn-id: trunk@19567 -
2011-10-31 07:07:24 +00:00
paul
5c00cdf40d rtl: correct ifdef for a code which assigns a codepage to textrec to use FPC_HAS_CPSTRING
git-svn-id: trunk@19548 -
2011-10-27 01:24:00 +00:00
florian
72425b49c9 * fixes bootstrapping with upcoming 2.6.x
git-svn-id: trunk@19547 -
2011-10-26 19:26:10 +00:00
paul
b7185a554c rtl:
- replace ifndef ver2_4 with ifdef FPC_HAS_CPSTRING for places with TextRec.CodePage access
  - convert codepages for Read and Write text file operations

git-svn-id: trunk@19545 -
2011-10-25 08:40:49 +00:00
paul
e08c68f308 rtl: set codepages for TextRec field when Text file is opened + update this field for standard IO files when cwstring is used
git-svn-id: trunk@19543 -
2011-10-25 06:27:54 +00:00
paul
2254dad68a rtl: add SetTextCodePage, GetTextCodePage functions which set/get TTextRec.CodePage field
git-svn-id: trunk@19541 -
2011-10-25 02:16:34 +00:00
paul
7a998aec3a compiler, rtl: add a codepage argument fpc_Read_Text_AnsiStr to create new AnsiString with the codepage of passed AnsiString argument
git-svn-id: trunk@19210 -
2011-09-24 17:43:30 +00:00
paul
9e0ad7baae merge r17318 from cpstrnew branch by florian:
* compilation fix by Inoussa OUEDRAOGO, resolves #19160

git-svn-id: trunk@19104 -
2011-09-17 13:01:20 +00:00
paul
2023b618ac merge r14131 from cpstrnew branch by paul:
rtl: do WriteStr without codepage conversion

git-svn-id: trunk@19092 -
2011-09-17 11:36:44 +00:00
Jonas Maebe
f4c31ecf3c + widestringmanager.codepointlengthproc added, which can be used to
determine the length of a multi-byte character. The return values
    are defined to be the same as those of POSIX' mblen: -1 =
    invalid/incomplete sequence, 0 = #0, > 0 = length of sequence in
    bytes.
  + default implementation for widestringmanager.codepointlengthproc
    (assumes all code points have length 1) and Unix implementation
    (based on mb(r)len); Windows implementation is still required
  * replaced default implementation of
    widestringmanager.CharLengthPCharProc with strlen() of the input
    instead of an error (correct if all code points have length 1,
    still needs Windows implementation)
  + implemented fpc_text_read_{wide,unicode}str() and
    fpc_text_read_widechar() (mantis #18163); fpc_text_read_widechar()
    uses the new widestringmanager.codepointlengthproc()
  + unicodestring support for readstr/writestr
  * fixed declaration of fpc_Write_Text_UnicodeStr (unicodestring
    instead of widestring parameter)
  * extended test/twide*.pp tests to test the new/fixed functionality

git-svn-id: trunk@16533 -
2010-12-10 14:10:01 +00:00
florian
18011b99cc o patch by Sven Barth, resolves #17827
* text.inc used Std*Handle without checking if the feature CONSOLEIO is present, fixed
  * OpenStdIO should use the type THandle for the hdl parameter, fixed

git-svn-id: trunk@16309 -
2010-11-06 19:47:17 +00:00
tom_at_work
19baf7d3e0 * changes to alignment for enumeration rtti record members: we need a Tconstptrint alignment before the MinValue/MaxValue members because the entire record needs that alignment due to some pointers inside
* changes to alignment for ordinal enumeration value to string accelerator tables so that we can define a single Pascal record to describe them for cleaner code
* some warnings in enumeration rtti generation indicating that if you change the code, you also have to change that in the RTL
* call fpc_shortstr_enum_intern in fpc_write_text_enum instead of copy&paste
* clean up code in fpc_shortstr_enum_intern:
  * unify data structures for lookup/search accelerator tables made possible by alignment changes in ncgrtti.pas
  * make clear that this is a partial copy&paste of the typinfo unit, also fix some alignment issues by introducing a fake inner record of Tenum_typedata
  * temporarily disable range checking for accesses to array[0..0] members of internal data structures
  * some documentation

git-svn-id: trunk@16229 -
2010-10-26 22:00:15 +00:00
mazen
b127fc154a * Fixed spell error revealed by lintian.
git-svn-id: trunk@16094 -
2010-10-06 20:33:57 +00:00
florian
9e053edf2e * fix iso i/o with unix style line feeds
git-svn-id: trunk@15706 -
2010-08-03 21:43:36 +00:00
florian
79fa2eb539 * support of iso pascal like i/o in iso mode
git-svn-id: trunk@15685 -
2010-07-31 20:46:27 +00:00
florian
c506913e9b * iso conformant writing of floats (using e instead of E) in iso mode
git-svn-id: trunk@15684 -
2010-07-31 20:45:55 +00:00
florian
d0ea23f39e * write false/true lower case in iso mode
git-svn-id: trunk@15678 -
2010-07-31 20:40:43 +00:00
Jonas Maebe
ab8b32dafb - removed PARAOUTFILE define and ifdefs
git-svn-id: trunk@12898 -
2009-03-15 12:31:02 +00:00
florian
1b79f2ebcf * improved feature defines
+ basic consoleio support for the embedded target

git-svn-id: trunk@12637 -
2009-02-01 12:44:25 +00:00
Jonas Maebe
afafe33266 + readded FPC_WRITE_TEXT_ANSISTR alias removed in r12322, because it's
required by the variant code

git-svn-id: trunk@12337 -
2008-12-11 12:31:23 +00:00
Jonas Maebe
53a638ad9f - removed no longer needed alias names
git-svn-id: trunk@12322 -
2008-12-10 19:24:01 +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
Vincent Snijders
783a1ce4e7 * fixed typos in comment
git-svn-id: trunk@11613 -
2008-08-18 22:23:32 +00:00
florian
e165741d56 * formatting
git-svn-id: trunk@10865 -
2008-05-02 18:41:40 +00:00
yury
86eef577f1 * Fixed fpc_write_text_enum on ARM. TTypeInfo is packed record.
git-svn-id: trunk@10768 -
2008-04-23 12:17:56 +00:00
tom_at_work
33bba100fc * fix writing of enums for 64 bit platforms that do not require proper alignment
git-svn-id: trunk@10742 -
2008-04-20 20:27:57 +00:00
tom_at_work
20737f0ac1 fix webts/tw10033 on ppc64:
* correctly write rtti for enumerations (missing alignment instructions on CPUs requiring proper alignment, breaking on architectures with 64 bit pointers)
* fix hardcoded offsets in fpc_write_text_enum
* updated example program

git-svn-id: trunk@10728 -
2008-04-19 22:06:18 +00:00
micha
461c8fb09f * fix enum rtti info alignment for proper alignment required archs
git-svn-id: trunk@10471 -
2008-03-09 21:53:46 +00:00
micha
83b7f81f81 + add no-fpu support to compiler/rtl for powerpc-linux (-Cfnone)
git-svn-id: trunk@10422 -
2008-03-02 12:59:02 +00:00
florian
f8c9052c21 * fixed writeln(<enum>) for 64 bit systems, resolves #10033
git-svn-id: trunk@10305 -
2008-02-11 21:05:08 +00:00
Jonas Maebe
39463b45ad * fixed writestr io-check comment
git-svn-id: trunk@9110 -
2007-11-03 17:05:47 +00:00
yury
e62c6cfcc4 * Fixed warnings and notes.
git-svn-id: trunk@9041 -
2007-11-01 14:16:43 +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
Jonas Maebe
ceaaa0e552 * fixed writing of widestrings
git-svn-id: trunk@7645 -
2007-06-13 13:00:25 +00:00
peter
48fa078f15 * simplified and optimzied check for eol
git-svn-id: trunk@7502 -
2007-05-28 17:39:53 +00:00