environment variables are set
* if no LC_*/LANG environment variables are set, let cwstring fall back to
unixcp.GetSystemCodePage
o this is mainly to avoid problems on OS X, where under certain
circumstances these variables are not set for GUI programs and
as a result we set the system code page to ASCII
git-svn-id: trunk@29257 -
functionality with RTLEvent:
o the thread manager semaphore functionality isn't used for anything else,
and the main difference between mutex/condvar and semaphores is that the
latter can be used for IPC (while the thread manager is always used
within a single process) and that they are counting (but since a thread
can only suspend itself nowadays, it cannot be suspended recursively)
o OS X sandboxing does not support the use of semaphores (or rather: Apple
does not allow sandboxing rules that enable the use of IPC semaphores in
the appstore)
git-svn-id: trunk@28965 -
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 -
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 -
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 -
+ 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 -
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 -
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 -
* 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 -
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 -
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 -
* 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 -
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 -
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 -
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 -
The WinCE implementation converts the rawbytestring arguments to
unicodestring and calls unicode OS APIs, while the others convert
unicodestring arguments to DefaultFileSystemCodePage and call
single byte OS APIs
+ test for the above
git-svn-id: branches/cpstrrtl@22467 -
RTL units. Comes with a FPCRTL_FILESYSTEM_UTF8 define that can be
activated for targets whose single byte filesystem interface enforces
UTF-8; included in inc/systemh.inc and unix/cwstring.pp until now
+ DefaultFileSystemCodePage variable that holds the code page used for
communicating with the OS single byte file system APIs, and for the
strings returned by those same APIs. Initialized with
o the result of GetACP in the system unit of Windows platforms, except for
WinCE which uses UTF-8 since its file system OS API calls already use
the UTF-16 versions
o CP_UTF8 on Unix platforms with FPCRTL_FILESYSTEM_UTF8 defined, and with
DefaultSystemCodePage on other Unix platforms
o DefaultSystemCodePage on Java/Android JVM targets
+ DefaultRTLFileSystemCodePage variable that holds the code page used to
encode strings returned by RTL routines that return filenames obtained
from OS API calls. By default the same as DefaultFileSystemCodePage on
all platforms. Separate from DefaultFileSystemCodePage for clarity on
platforms that may use either utf-16 or single byte OS API calls to
send/receive file names (such as most Windows platforms)
+ new scpFileSystemSingleByte enum that can be passed to
GetStandardCodePage() to get the default code page for OS single byte file
system APIs, with implementations for Unix and Windows
+ SetMultiByteFileSystemCodePage() procedure to override the value of
DefaultFileSystemCodePage
In principle, in the long run unchanged programs only using generic
ansistrings and unicodestrings should (mostly) behave the same as in
FPC 2.6.0 as far as RTL-level file system APIs are concerned if
they set DefaultFileSystemCodePage and DefaultRTLFileSystemCodePage
to DefaultSystemCodePage at the start of their execution
git-svn-id: branches/cpstrrtl@22466 -
(there's a dummy entry with code page 0 for UTF-8 in the table for
when 0 is searched, but when going from string to number that
entry has to be skipped so the real UTF-8 entry is used)
git-svn-id: trunk@22245 -
overflow (don't know what the y-coordinate is at that point, because the
window may be wider than the artificial screenwidth) (mantis #20880)
git-svn-id: trunk@21925 -
* added some new minor deprecations (mostly unused constants that are
potentially not crossplatform, and an shortstring version of a function)
git-svn-id: trunk@21321 -
- do not compile ipc unit for android, not supported
- fix geterrnolocation external name
- implement dummy getdomainname; does not exist in android
- remove wrong 'if defined(android)' clauses
git-svn-id: branches/targetandroid@21065 -
o AIX-specific codepage names
o AIX/ppc32 uses a 16 bit wchar_t
o special support for handling cp866 on AIX: AIX only supports converting
cp866 from/to ISO8859-5 -> always use that code page as an intermediate
one on AIX (it's lossy, but better than completely failing)
* in case the default system code page cannot be detected, fall back to
UTF-8
git-svn-id: trunk@20839 -
- 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 -
This change is required since CodePage to CodePage name conversions are required in other parts of RTL. Moreover those codepage identifiers are windows codepage identifiers and thus must be compatible with codepage identifiers used by delphi.
git-svn-id: trunk@19330 -
- fixed a platform modifier in ipc.pp
- fixed different layout sigaction record in libc. (field order)
- fixed many bad use_libc fixes in linux. Most of these were only checked
for compilation, not linking. (e.g. futex doesn't link)
git-svn-id: trunk@18042 -
* also fixes CharLengthPChar() for non-BeOS by initialising the mbstate
parameter passed to mbrlen() to 0 (otherwise its contents are interpreted
as already valid, containing information about the current shiftstate etc)
git-svn-id: trunk@16552 -
Pablo Alfaro (mantis #14075, also fixes#13363):
* ipc msgtyp is clong, not cint
* TIPC_Perm and TSEMid_ds are different on 64 bit systems
* fixed passing semun arguments (have to be passed by value, not reference)
* fixed the order of parameters to msg* syscalls, and don't use
TIPC_Kludge for msgrcv syscall (only for ipccall.inc variants)
* use new operation variants on 64 bit platforms in ipccall.inc
* introduced use kernel_mode/uid/gid_t types for use by the Linux ipc
records
* fixed type of TSEMid_ds.sem_base for Darwin
* added {$packrecords c} to ipc unit, and {$packrecords 4} around
certain structs for Darwin as in the C headers
* fixed passing semun argument to semctl for libc platforms (by
value, not reference)
git-svn-id: trunk@16336 -
cwstring (fixes webtbs/tw17591.pp on unix platforms)
* enhanced webtbs/tw17591.pp so it also (superficially) checks the
correctness of the called routines, and add cwstring for unix platforms
git-svn-id: trunk@16298 -
+ Add sched_yield to linux unit
- Remove clone for m68k from linux unit (unimplemented assembler section)
+ Add fpsigtimedwait to baseunix unit
git-svn-id: trunk@15602 -
pthread_self(), because it's a procvar under Linux and hence otherwise
the value of the procvar instead of the function result will be
taken (mantis #15821)
git-svn-id: trunk@15049 -
tested on FreeBSD (general Unix) and Windows. Note that Haiku seems
to have a native threadmgr rather than the Unix one. Will notify
maintainer (Olivier)
git-svn-id: trunk@15026 -
* Haiku's nl_langinfo implementation is now used under Haiku instead of
the BeOS stub.
* Fix linking to iconv in the iconvenc package. The prefix has change
since the previous Haiku's version.
git-svn-id: trunk@14995 -