Commit Graph

130 Commits

Author SHA1 Message Date
Rika Ichinose
7f4420495b TMarshal & TMarshaller, strange things from Delphi. 2023-07-22 15:24:27 +02:00
Michael VAN CANNEYT
4336599c3a * Char -> AnsiChar 2023-07-14 17:26:10 +02:00
Michael Van Canneyt
6ff542a13e * SafeFormat and helper function to convert array of const to string in a safe manner 2023-03-31 22:13:05 +02:00
florian
18e0979379 + Exception.GetBaseException 2021-11-23 23:01:06 +01:00
florian
34cd1212ea * cosmetics
git-svn-id: trunk@46744 -
2020-09-01 20:32:46 +00:00
florian
01302bc47d * subroutines working with an OS dependend time stamp use an int64 now, so the 2038 problem
on unixes can be tackled

git-svn-id: trunk@44010 -
2020-01-21 20:59:20 +00:00
marco
defabdc80d * bug #36497, minor stylistic cleanup from Cyrax that replaces some pwidechar with punicodechar
git-svn-id: trunk@43826 -
2019-12-31 16:35:32 +00:00
svenbarth
176a63b67b * fix for Mantis #35862: free the list of functions added with AddTerminateProc to avoid memory leaks
+ added test

git-svn-id: trunk@42457 -
2019-07-19 15:55:21 +00:00
marco
15fcd0ab61 * remove old ifdefs
git-svn-id: trunk@39642 -
2018-08-19 14:54:58 +00:00
michael
ab84f09591 * Fix bug #39521. Generic functions only in trunk
git-svn-id: trunk@39525 -
2018-07-29 21:43:03 +00:00
michael
1e3f44965f * Added generic IfThen, as proposed by Thaddy de Koning, bug id #34012
git-svn-id: trunk@39521 -
2018-07-29 09:35:54 +00:00
pierre
31620a9c94 Add ESigQuit Exception class and use it in exceptmap
git-svn-id: trunk@38586 -
2018-03-21 10:28:33 +00:00
pierre
250e924ad3 + Add RTE 236 for thread errors:
inc/systemh.inc and java/jsystemh.inc:
    + Add reThreadError (and also reNoDynLibsSupport) to TRuntimeError.
    * Add new values to RuntimeErrorExitCodes after extension of TRuntimeError
  inc/system.inc and java/jsystem.inc:
    * use RTE 236 in fpc_threaderror.
  objpas/sysconst.pp and objpas/sysutils/stre.inc:
    + Add SThreadError string constant.
  objpas/sysutils/sysutilh.inc:
    + Add EThreadError class.
  objpas/sysutils/sysutils.inc
    + Add 236 to EThreadError conversion to exeptmap.

git-svn-id: trunk@38584 -
2018-03-21 10:19:04 +00:00
michael
77caa28bab * Fix bug #33204
git-svn-id: trunk@38327 -
2018-02-24 11:12:11 +00:00
pierre
ec45d8617c Fix wince rtl compilation (fix for bug report 32859)
git-svn-id: trunk@37778 -
2017-12-21 17:45:20 +00:00
nickysn
5409450195 + ported and enabled compilation of unit sysutils for win16
git-svn-id: trunk@37734 -
2017-12-15 16:58:49 +00:00
pierre
e325284160 Fix compilation failure for systems that do not have dynlibs
git-svn-id: trunk@37056 -
2017-08-25 07:28:35 +00:00
michael
a4c4ce1764 * Capture result in SafeLoadLibrary
git-svn-id: trunk@37050 -
2017-08-24 09:27:49 +00:00
michael
b6700f68b8 * Fix bug #32314 (SafeLoadLibrary does nothing on other platforms than windows)
git-svn-id: trunk@37049 -
2017-08-24 08:46:07 +00:00
marco
f0a02cdaf9 * reengineered utf8-less fix for #0031257
git-svn-id: trunk@36293 -
2017-05-22 13:58:43 +00:00
michael
3e96806f7e Renamed DisposeAndNil to FreeMemAndNil
git-svn-id: trunk@33378 -
2016-03-29 07:55:58 +00:00
michael
92b8bf97c0 * Added DisposeAndNil (bug ID 28895)
git-svn-id: trunk@33377 -
2016-03-29 07:33:28 +00:00
marco
66608fec02 * unicode executeprocess from work during Lazarus convention in IJsselstein
git-svn-id: trunk@33290 -
2016-03-19 17:59:42 +00:00
michael
4a32135563 * no type helpers in version 2.6.*
git-svn-id: trunk@32263 -
2015-11-07 09:54:43 +00:00
michael
fde42ca8ef * Type helpers, compatible to Delphi XE 8
git-svn-id: trunk@32262 -
2015-11-07 09:40:54 +00:00
michael
81fa382c42 * Rename WriteExceptionToStdErr -> WriteErrorsToStdErr
git-svn-id: trunk@30555 -
2015-04-12 15:37:46 +00:00
michael
bda3626025 * Write unhandled exceptions to StdErr. Option to revert back to old behaviour (Bug ID 17346)
git-svn-id: trunk@30140 -
2015-03-08 09:37:35 +00:00
Tomas Hajny
329f788f58 * added conditional possibility of displaying the last OS error in information displayed for unhandled exceptions
git-svn-id: trunk@29622 -
2015-02-04 01:33:14 +00:00
svenbarth
2d454dc8fa Move DynLibs support to System unit using a manager approach like for Threads, WideStrings, etc.. This is needed so that we can support features like "delayed" and loading of dynamic packages.
Each port that allows the usage of dynamic libraries should call InitSystemDynLibs during initialization of the System unit.
The DynLibs unit has been adjusted to be a forwarder for the functions that now reside in the System unit (for backwards compatiblity just in case). Additionally the unit will register the DynLibsManager if it doesn't reside in the System unit anyway.
Currently only the Windows targets (Win32, Win64 and WinCE) implement the DynLibsManager inside the System unit. For other systems using the LoadLibrary, etc. functions will lead to a run error/exception.
If a port wants to implement its own DynLibsManager then it needs to define DISABLE_NO_DYNLIBS_MANAGER. TLibHandle, NilHandle and optionally TOrdinalEntry (it's set to SizeUInt otherwise) should be defined in sysdlh.inc which needs to be enabled using the define FPC_SYSTEM_HAS_SYSDLH (because there are targets which have FEATURE_DYNLIBS enabled, but don't support them... e.g. powerpc-wii -.-).
The DynLibsManager contains methods for loading a library based on a RawByteString and based on a UnicodeString. BOTH should be implemented, but internally one can forward to the other.
The loading by ordinal *can* be be implemented. If it is set to Nil then the implementation of GetProcAddress(lib,ordinal) will return Nil.

+ new functions SetDynLibsManager and GetDynLibsManager to set and retrieve the current DynLibsManager
* provide interface of DynLibs unit in unit System

git-svn-id: trunk@29613 -
2015-02-03 20:00:00 +00:00
pierre
bde3bb4f5b Give a different output if Obj is not a vlaid class
git-svn-id: trunk@29045 -
2014-11-09 22:14:13 +00:00
sergei
b16c6f8ced * i386 and x86_64 changes for Delphi compatibility:
* 'mxcsr' variable made public and renamed to DefaultMXCSR.
  * GetSSECSR and SetSSECSR renamed to GetMXCSR and SetMXCSR, respectively. Previous names continue to exist as deprecated aliases.

git-svn-id: trunk@27656 -
2014-04-25 15:10:12 +00:00
nickysn
a176c2d4f5 + add overloaded versions of HexStr(pointer) for i8086 near and far pointers
- rm ifdefs for i8086 far code memory model when doing stack traces. The
  compiler will now choose the correct overload of HexStr according to the
  CodePointer type.

git-svn-id: trunk@27163 -
2014-03-16 17:40:31 +00:00
nickysn
73494f004d * the Exception constructors' AHelpContext parameter changed from Integer to
Longint

git-svn-id: trunk@27043 -
2014-03-09 13:09:25 +00:00
michael
77b771e91b * Let ToString return something meaningful for Exception
git-svn-id: trunk@26969 -
2014-03-06 13:34:40 +00:00
nickysn
5e09b7a56f * SysUtils functions related to exceptions and stacktraces updated to use CodePointer
git-svn-id: trunk@25515 -
2013-09-17 21:58:53 +00:00
Jonas Maebe
5b09435055 * explicitly call several windows *A() versions of APIs so the intended
routine is called even when we compile with -dFPC_UNICODE_RTL

git-svn-id: branches/cpstrrtl@25308 -
2013-08-19 22:47:12 +00:00
Jonas Maebe
2da7c3f05c * changed declarations in finah.inc and diskh.inc from ansistring to
rawbytestring
  * DoDirSeparators() and GetDirs() marked as "rtlproc" so they can accept
    non-rawbytestring arguments as their var-parameters

git-svn-id: branches/cpstrrtl@25306 -
2013-08-19 22:04:40 +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
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
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
1da05d1553 * declared CharInSet(ansichar,tsyscharset) as inline
* moved the inclusion of sysansi.inc to before the inclusion of all other
    sysutils include files so the inline body of CharInSet is available

git-svn-id: branches/cpstrrtl@25000 -
2013-06-27 21:38:13 +00:00
Jonas Maebe
b08d8091b2 * made fexpand unicodestring-safe (use charinset instead of "in" --
"widechar in set" compiles, but results in a runtime conversion of
    the widechar into an ansistring and then getting the first character
    of that ansistring, which is horribly slow -- and Delphi-incompatible,
    but introduced a long time ago because of bug #7758)
  * replaced all "in" operations in sysutils fina.inc with CharInSet for
    the same reason
  * replaced all "string" declarations in finah.inc/fina.inc with "PathStr"
    and "pchar" with "PathPChar", and include them twice in sysutilh.inc/
    sysutils.inc, once with PathStr=UnicodeString/PathPChar=PWideChar and
    once with PathStr=AnsiString/PathPChar=PAnsiChar (not rawbytestring
    because there are several routines with var-parameters and then the
    string type has to match exactly; the "rtlproc" modifier could circumvent
    this, but should be used sparingly, and additionally the routine's
    internals would then first also have to be reviewed to ensure that at
    no point they start mixing in strings with the defaultsystemcodepage
    (e.g. directory separators) without first adjusting their codepage)
  * call GetShortPathNameA or GetShortPathNameW in ExtractShortPathName on
    Windows depending on whether we are parsing the RawByteString/UnicodeString
    version of fina.inc
  + ExpandUNCFileName(unicode) version for Windows, let its
    ExpandUNCFileName(ansistring) call the unicode version (avoid data loss
    due to ansi conversion) and convert the result to
    DefaultRTLFileSystemCodePage (to have no more data loss than what's
    specified by the user)

git-svn-id: branches/cpstrrtl@24999 -
2013-06-27 21:38:10 +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
svenbarth
db6385ef33 Added exception EObjectCheck for object reference check (runtime error 210).
rtl/objpas/sysconst.pp:
  + add resourcestring SObjectCheckError
rtl/objpas/sysutilh.inc:
  + add new Exception descendant EObjectCheck
rtl/objpas/sysutils.inc:
  + use EObjectCheck with message SObjectCheckError for runtime error 210

git-svn-id: trunk@23656 -
2013-02-24 22:22:38 +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
Jonas Maebe
a3c936fe5f + rawbytestring/unicodestring overloads for FileCreate and FileOpen.
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 -
2012-09-27 07:54:25 +00:00
michael
789a6452c9 * Implemented overloaded variant of fileage function
git-svn-id: trunk@21867 -
2012-07-11 10:42:23 +00:00
marco
1f40ff2362 * overloaded version of raiselastoserror that allows custom errorcodes
to be raised, patch by Cytax, Mantis #21092

git-svn-id: trunk@20084 -
2012-01-15 11:54:12 +00:00
sergei
abdbe49861 + SysUtils part of SEH (enabled only for win64)
* EExternal.ExceptionRecord changed from field to property and made available on all Windows, not just win32.
* CatchUnhandledException: removed AnsiString variable, ideally there should be no memory allocations in this code path.

git-svn-id: trunk@19849 -
2011-12-14 10:47:26 +00:00
sergei
e62cd71a2f * Fixed cycling with 2.4.4 after r19707 (2.4.4 does not define FPC_HAS_FEATURE_RESOURCES, so related stuff is not compiled)
git-svn-id: trunk@19711 -
2011-11-30 10:49:47 +00:00