Commit Graph

967 Commits

Author SHA1 Message Date
michael
2a048692a5 * Patch from Mark Morgan LLoyd, adding some functions (part 2)
git-svn-id: trunk@26855 -
2014-02-23 18:32:09 +00:00
michael
0ecee7cd3f * Patch from Mark Morgan LLoyd, adding some functions
git-svn-id: trunk@26854 -
2014-02-23 18:27:00 +00:00
michael
d91da3bd6b * Patch from Petr-K to take into account modifier - for short date format (bug id 25731)
git-svn-id: trunk@26814 -
2014-02-18 21:23:13 +00:00
marco
f09374a197 * winsock(and -2), sockets and gpm to rtl-extra.
git-svn-id: trunk@26426 -
2014-01-11 19:45:37 +00:00
marco
dea2c743d5 * Initial active version of
rtl-extra : objects matrix ucomplex
   rtl-objpas: convutil(s) dateutil(s) stdconvs variants varutils
   

git-svn-id: trunk@26398 -
2014-01-05 19:20:15 +00:00
Jonas Maebe
729ac297e4 * declare the code page names as ansistring instead of rawbytestring and
force the checked names to CP_ACP, so perform string conversions on
    the names after the compiler bug has been fixed that sets the code
    page of rawbytestring typed constants to CP_NONE

git-svn-id: trunk@26396 -
2014-01-05 18:26:04 +00:00
marco
a001e12d04 * rtl-console initial version.
git-svn-id: trunk@26372 -
2014-01-03 22:19:02 +00:00
marco
0bb6469b80 * remove accidentally inserted BOM, as reported by M. Ring.
git-svn-id: trunk@26358 -
2014-01-02 14:34:28 +00:00
marco
ebe262762a * Clean out of $i textrec and filerec includes that are redundant now that cpstrrtl exposes
those records via system. 

git-svn-id: trunk@26356 -
2014-01-02 13:26:09 +00:00
marco
996e802606 * fix memleak pthread_attr, Mantis #25416 by Henry Vermaak.
git-svn-id: trunk@26220 -
2013-12-11 21:47:02 +00:00
Jonas Maebe
679c6bd27e * fixed formatting
git-svn-id: trunk@26149 -
2013-11-27 20:27:20 +00:00
Jonas Maebe
cddc31a1a8 * also allow 'cpXXXX' in addition to 'CPXXXX' code page names (mantis #15169)
git-svn-id: trunk@26148 -
2013-11-27 20:27:16 +00:00
Jonas Maebe
cada770f9e * changed return value in case of failure in ThreadManager.SemaphoreInit
from nil to pointer(-1), because nil/0 is a valid return value for
    sem_open() on some platforms

git-svn-id: trunk@26079 -
2013-11-13 16:51:11 +00:00
svenbarth
fbceb574eb Fix for Mantis #25041 . Correctly set CurrentThreadVar for those tthread.inc incarnations that don't use the default ThreadProc in classes.inc (this should be changed in the future though...). In addition to Unix systems as described by the bug report this also involved BeOS and Netware LibC.
+ added test

git-svn-id: trunk@25511 -
2013-09-17 18:02:12 +00:00
nickysn
129fddf800 * fixed compilation of unit crt on linux
git-svn-id: trunk@25507 -
2013-09-17 11:25:47 +00:00
nickysn
96c7a9325a * CrtOpen, CrtClose, CrtRead, CrtWrite and CrtReturn changed to procedures, instead of functions
git-svn-id: trunk@25506 -
2013-09-17 11:17:29 +00:00
Jonas Maebe
f9f041d470 * SystemOldNAme -> SystemOldName
git-svn-id: branches/cpstrrtl@25304 -
2013-08-19 22:04:33 +00:00
Jonas Maebe
af3f12f60c * rawbytestring/unicodestring versions of findfirst/findnext/findclose
o these routines are now generic wrappers in filutil.inc, and call
     the platform-dependent internalfindfirst/next/close routines
   o on unix, the fnmatch routine got proper support for UTF-8 matching
     (e.g., it won't match a partial UTF-8 code point to a "?" wildcard)
   o for NativeNT, a similar (untested) UTF-16 version has been added
  + test for the above
  * rawbytestring/unicodestring versions of fileage

git-svn-id: branches/cpstrrtl@25302 -
2013-08-19 22:04:25 +00:00
Jonas Maebe
29132f45b7 * synchronised with trunk up to r25167 (fixes glib compilation via r25164,
and occasional crashes in executeprocess on libc platforms via r25167)

git-svn-id: branches/cpstrrtl@25169 -
2013-07-24 14:24:49 +00:00
Jonas Maebe
832b902df6 * ordered the declarations the same was as in bunxh.inc, so it's easier
to see what's missing
  + added missing declarations for fpexecv (causing an unnecessary
    slowdown in executeprocess due to it calling the ansistring overload),
    fplink, fpwait and fpsetrlimit
  * changed sigset parameters of FpSigSuspend and FpSigTimedWait from const
    into constref, since they must be passed by reference

git-svn-id: trunk@25167 -
2013-07-24 13:49:35 +00:00
Jonas Maebe
3fdb3092af + defaultfilesystemcodepage support for dynlibs
+ unicodestring overloads for (safe)loadlibrary()

git-svn-id: branches/cpstrrtl@25162 -
2013-07-22 21:45:34 +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
953e088c14 + unicodestring support for POpen(), and DefaultFileSystemCodePage support
for POpen(RawByteString)

git-svn-id: branches/cpstrrtl@25134 -
2013-07-19 16:29:13 +00:00
Jonas Maebe
8538f48fda * made the ansistring parameters of the fp*() overloads constant, changed
them to rawbytestring and added DefaultFileSystemCodePage conversions

git-svn-id: branches/cpstrrtl@25133 -
2013-07-19 16:28:49 +00:00
Jonas Maebe
155aafc255 * moved SYSUTILS_HAS_ANSISTR/UNICODESTR_FILEUTIL_IMPL define to interface
so declarations can also depend on it and similar defines (not yet the
    case)
  + added SYSUTILS_HAS_ANSISTR_ENVVAR_IMPL/SYSUTILS_HAS_UNICODESTR_ENVVAR_IMPL
    to indicate whether the platform-dependent part of the unit provides
    an ansistring/unicodestring interface to get environment variables
  + Windows version of getenvironmentvariable(unicodestring)
  + generic ansistring/unicodestring versions of GetEnvironmentVariable()
    in case the platform doesn't provide them
  * result of GetEnvironmentString() is ansistring/unicodestring depending
    on the state of the FPC_RTL_UNICODE define

git-svn-id: branches/cpstrrtl@25116 -
2013-07-16 14:16:34 +00:00
Jonas Maebe
eeb98a0c0f - removed platform-specific implementations of GetCurrentDir, SetCurrentDir,
CreateDir and RemoveDir, and implemented a generic one (based on the OS/2
    version) in the shared sysutils code (so that the filesystem code page
    support for the system unit routines can be reused)
  * include both ansistring and unicodestring versions of the above routines,
    and of ForceDirectories. Exception: GetCurrentDir, which cannot be
    overloaded based on function result and whose return type currently
    dependends on the FPC_UNICODE_RTL define

git-svn-id: branches/cpstrrtl@25113 -
2013-07-16 14:15:55 +00:00
Jonas Maebe
06d9b35ed3 * don't truncate the result of GetEnvironmentVariable to 255 characters
git-svn-id: branches/cpstrrtl@25105 -
2013-07-15 09:21:51 +00:00
Jonas Maebe
26b2149ced * converted the following sysutils routines to unicodestring and
rawbytestring: FileExists, DirectoryExists, FileSetDate, FileGetAttr,
    FileSetAttr, DeleteFile, RenameFile, FileSearch, ExeSearch,
    FileIsReadOnly

git-svn-id: branches/cpstrrtl@25078 -
2013-07-09 19:01:45 +00:00
Jonas Maebe
d66d15aad3 + added mkdir/chdir/rmdir(rawbytestring) and (unicodestring) to the system unit
* renamed platform-specific pchar versions of those rouines to do_*() and
    changed them to either rawbytestring or unicodestring depending on the
    FPCRTL_FILESYSTEM_SINGLE_BYTE_API/FPCRTL_FILESYSTEM_TWO_BYTE_API setting
  * implemented generic shortstring versions of those routines on top of either
    rawbytestring or unicodestring depending on the API-kind (in case of the
    embedded target, if ansistring are not supported they will map directly
    to shortstring routines instead)
  * all platform-specific *dir() routines with rawbytestring parameters now
    receive their parameters in DefaultFileSystemCodePage
  - removed no longer required ansistring variants from the objpas unit
  - removed no longer required FPC_SYS_MKDIR etc aliases
  * factored out empty string and inoutres<>0 checks from platform-specific
    *dir() routines to generic ones
  o platform-specific notes:
   o amiga/morphos: check new pathconv(rawbytestring) function
   o macos TODO: convert PathArgToFSSpec (and the routines it calls) to
     rawbytestring
   o nativent: added SysUnicodeStringToNtStr() function
   o wii: convert dirio callbacks to use rawbytestring to avoid conversion
  + test for unicode mk/ch/rm/getdir()

git-svn-id: branches/cpstrrtl@25048 -
2013-07-04 22:28:37 +00:00
sergei
40045e6269 - Removed unused variables
git-svn-id: trunk@25005 -
2013-06-28 11:53:10 +00:00
Jonas Maebe
62ee16278b * changed getdir(ansistring):ansistring to
getdir(rawbytestring):rawbytestring so it can accept strings in any
    encoding and cleanly return results in DefaultRTLFileSystemCodePage
  + getdir(unicodestring):unicodestring
  * renamed the getdir implementation of all platforms except for embedded-
    without-ansistring-support to do_getdir(), and depending on the
    FPCRTL_FILESYSTEM_SINGLE_BYTE_API/FPCRTL_FILESYSTEM_TWO_BYTE_API define
    changed its shortstring parameter to ansistring or unicodestring. The
    do_getdir(rawbytestring) routine should just set the code page of the
    return value to DefaultFileSystemCodePage without conversion (not
    DefaultRTLFileSystemCodePage with conversion, that conversion is performed
    in getdir if necessary; this avoids double conversions in case
    getdir(unicodestring) is called)
  + generic getdir(shortstring) for platforms supporting either ansistrings or widestrings
  o platform maintainers:
   o OS/2: adjust code to supports paths > 255 characters if those are supported
   o Wii: adjust used callback to use rawbytestring to support paths > 255 characters and
     avoid shortstring->rawbytestring conversion overhead
   o Windows: GetCurrentDirectoryW is now always used (to prevent data loss)

git-svn-id: branches/cpstrrtl@24993 -
2013-06-27 21:37:47 +00:00
Jonas Maebe
ecd3cba02b * synchronised with trunk up to r24912
o resolved conflict in updated morphos sysutils unit
   o moved code that had been added to the now deleted  sysunix.inc to the
     unix-specific block of the fpwidestring unit's init code

git-svn-id: branches/cpstrrtl@24913 -
2013-06-17 20:50:02 +00:00
marco
07e23b8401 * mousebutton 4 and 5 support (gpm only?) Mantis #13469
git-svn-id: trunk@24164 -
2013-04-06 18:58:05 +00:00
Jonas Maebe
f00d9f6f84 * correct dlopen flag values for Darwin (patch by lks, mantis #23979)
git-svn-id: trunk@23771 -
2013-03-10 10:22:43 +00:00
marco
9f53738142 * fill in purpose of the unit in comment, updated copyright
git-svn-id: trunk@23725 -
2013-03-08 09:18:26 +00:00
pierre
f4b6625145 + Use __setlocale_mb_len_max_32 for netbsd as suggested by linker warning
git-svn-id: trunk@23696 -
2013-03-05 11:40:24 +00:00
yury
5bf237afc1 * Turn off assigning UnixGetModuleByAddrHook for Android, since dladdr() function is not available on old (1.x) Android versions.
git-svn-id: trunk@23695 -
2013-03-05 00:00:02 +00:00
yury
5e369ae7fc * Use UTF-8 as fallback code page on linux and ASCII on other unix systems.
git-svn-id: trunk@23680 -
2013-03-02 09:51:05 +00:00
yury
c4ba95b227 * Use CP_ASCII as fallback in GetSystemCodepage to be compatible with cwstring.
git-svn-id: trunk@23676 -
2013-03-01 08:44:05 +00:00
yury
b0d79b7854 * Use UTF-8 as fallback in GetSystemCodepage.
git-svn-id: trunk@23673 -
2013-02-28 19:48:56 +00:00
yury
2b2a68446d * Added new unit unixcp. It contains stuff from winiconv.inc - a table to map Windows code page identifiers to locale names on unix. Also GetSystemCodePage function in this unit can be used to detect which code page is used currently.
* Build unixcp for all unix-like systems.
* Use the unixcp unit in cwstring instead of winiconv.inc.
- Deleted winiconv.inc
- Reverted r22410,r22411,r22428. The compiler will use the unixcp unit to get a default code page for ansistrings.

git-svn-id: trunk@23670 -
2013-02-28 18:21:28 +00:00
yury
d26f0552a0 * Sync with trunk r23404.
* Regenerated makefiles.

git-svn-id: branches/targetandroid@23405 -
2013-01-16 13:21:51 +00:00
yury
7322164c0a * I've found that libc on Android does not implement widechar case functions such as towupper(). Such functions are just wrappers over regular char functions. Therefore the whole cwstring unit is useless for Android. For now I've added stub cwstring unit for Android and reverted all Android specific changes in unix/cwstring.pp. Later, Unicode manager for Androud should be implemented using libicuuc, which is default Android lib.
git-svn-id: branches/targetandroid@23301 -
2013-01-02 18:47:09 +00:00
yury
b480479b8c * Android does not have libiconv, so don't use it in cwstring unit. For now support only UTF-8 code page in ansistrings. Later it is possible to use libicuuc for code page conversions on Android.
git-svn-id: branches/targetandroid@23299 -
2013-01-02 17:38:08 +00:00
svenbarth
764f36a179 Extend TThread with (class) methods and (class) properties from Delphi 2007 and newer.
Especially for the introduction of the Queue method the internal Synchronize handling was modified. Instead of handling only one event there is now a queue of events which is walked completely when CheckSynchronize is called. Each entry in the queue can carry a PRTLEvent which will be signaled when the contained method has been executed and thus Synchronize methods can still be blocking.
Exceptions inside the queued methods are either handed back to the calling method for Synchronize events or raised directly (after leaving the queue in a valid state) to the caller of CheckSynchronize.

The way platform specific adjustments can be made to TThread was changed. Instead of implementing the Constructor and Destructor directly one now implements the methods SysCreate and SysDestroy which are called from the Constructor and Destructor respectively. All RTLs were adjusted for this and should be controlled by the platform maintainers for correct compilation (Unix works).

The new method NameThreadForDebugging has two overloaded variants: one with the thread name as AnsiString and one with the thread name as UnicodeString.
By default the AnsiString variant calls the UnicodeString variant and the latter needs to be implemented. This can be changed by defining THREADNAME_IS_ANSISTRING for a platform. Then the UnicodeString variant calls the AnsiString one and the AnsiString one needs to be implemented.

Also added was a global property CPUCount for the System unit. This property returns the number of virtual cores of the system.

New methods and functions that should be implemented per platform are:
System.GetCPUCount (default returns 1)
Classes.TThread.GetSystemTimes (default zeros the struct)
Classes.TThread.NameThreadForDebugging (default does nothing)

More detailed information about the added methods will be available in the feature announcement mail.

git-svn-id: trunk@23227 -
2012-12-27 16:16:17 +00:00
svenbarth
e914ec7f00 Add platform independant support for "GetTickCount" and "GetTickCount64" to unit "SysUtils". "GetTickCount" is declared as deprecated from the beginning and thus "GetTickCount64" should be used instead.
The default implementation of "GetTickCount" just uses the lower 32-Bit from the result of "GetTickCount64". 
The default implementation of "GetTickCount64" is based upon "Now" for systems that support a floating point unit (and thus "Now"). 
Other systems can define a "SysTimerTick" function which is used instead if "HAS_SYSTIMERTICK" is defined.

The Windows implementation of "GetTickCount" uses Windows' "GetTickCount" function. 
The implemenation of "GetTickCount64" checks whether the system is a Windows Vista or newer and then uses Windows' "GetTickCount64" function. Otherwise Windows' "GetTickCount" is used also.

The Unix implementation of "GetTickCount" is the default one. 
The "GetTickCount64" implementation uses "fpgettimeofday".

git-svn-id: trunk@23215 -
2012-12-23 16:12:57 +00:00
sergei
1415569ecb - Removed UnixToWinAge, since revision 444 it does not change its argument, but wastes a lot of CPU cycles converting it from local time and back.
git-svn-id: trunk@23145 -
2012-12-15 08:38:41 +00:00
Jonas Maebe
d3d0df6e4d * terminate with an error when initializing a critical section and recursive
mutexes are not available, since one of the expected properties of
    (Delphi/Windows-compatible) critical sections is that they ar
    re-entrant (mantis #23334)

git-svn-id: trunk@23011 -
2012-11-18 10:23:44 +00:00
Jonas Maebe
676db6d377 * removed stray try/finally statement (mantis #23333)
git-svn-id: trunk@23010 -
2012-11-18 10:23:38 +00:00
Jonas Maebe
8bf71af3b1 * fixed compatilation on Haiku Alpha4 (patch by Olivier Coursière,
mantis #23300)

git-svn-id: trunk@22969 -
2012-11-10 20:26:46 +00:00