Commit Graph

106 Commits

Author SHA1 Message Date
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
sergei
0093517227 * sysutils: changed RunErrorToExcept to use table instead of case statement for OS exceptions. This is to be able to extract exception class alone for the upcoming SEH support.
* Some Delphi-compatible changes:
  * For floating point underflow condition, raise EUnderflow, not EOverflow.
  * For unknown codes, raise EInOutError, not Exception.
  * Added entries for EZeroDivide and EStackOverflow (actually raising EZeroDivide on floating-point division by zero requires further changes to System because currently both integer and float division by zero is mapped to the same code 200).

  

git-svn-id: trunk@19707 -
2011-11-29 18:41:13 +00:00
michael
c1ff89a7c2 * Fixed bug in ExeSearch, noted by Tomas
git-svn-id: trunk@19380 -
2011-10-05 07:06:57 +00:00
paul
abf9816a09 rtl: add basic implementation of TEncoding class
git-svn-id: trunk@19355 -
2011-10-04 05:06:32 +00:00
florian
d7f7a9bb76 * patch by Alexander Shishkin to clean up $ifopt usage by $push/$pop, resolves #20346
git-svn-id: trunk@19256 -
2011-09-27 20:22:40 +00:00
michael
a07b14853a * Changed ImplicitDir default from False to True
git-svn-id: trunk@17735 -
2011-06-13 09:07:17 +00:00
marco
92a7e1c781 * fix typos in windows implementation r17717
git-svn-id: trunk@17723 -
2011-06-11 22:26:42 +00:00
michael
6b42ee69a9 * Changed FileSearch to handle a set of options instead of boolean.
Options now include stripquotes
* Changed ExeSearch so dirlist is optional and PATH is used if omitted. 
  It uses stripQuotes on windows. (bug 19282)

git-svn-id: trunk@17717 -
2011-06-11 11:36:51 +00:00
florian
7de8972e5c * fix Sysutils.AssertErrorHandler as proposed by Martin Friebe in #19130, resolves #19310
git-svn-id: trunk@17470 -
2011-05-15 15:13:22 +00:00
sergei
6d89ec4ee4 * SysUtils unit, fixed return value of FileSetDate:
* return value of GetLastOSError if one is available, to be consistent with handle-based implementations and Delphi behavior.
  * otherwise, return -1

git-svn-id: trunk@16318 -
2010-11-09 09:52:42 +00:00
marco
49fc4795e3 * fix for mantis 16052 RFC4122 compliance of own random GUID creation. Part II
git-svn-id: trunk@15024 -
2010-03-20 14:08:10 +00:00
marco
b6048862b8 * fix for mantis 16052 RFC4122 compliance of own random GUID creation.
git-svn-id: trunk@15023 -
2010-03-20 13:03:45 +00:00
michael
01ed4a6745 * Implemented OnBeep to install custom beep handler
git-svn-id: trunk@14254 -
2009-11-22 17:33:56 +00:00
florian
5d8835861c + unicode functions for sysutils, makes tunistr6.pp compiling
git-svn-id: trunk@13402 -
2009-07-17 14:05:19 +00:00
Jonas Maebe
f6d452c2c0 * remove the RTL's installed signal handlers at the end of the system
unit's initialization code in case we're in a library
  + implemented InquireSignal(), AbandonSignalHandler(), HookSignal() and
    UnhookSignal() in the sysutils unit
  * for Kylix compatibility, these routines support operating on
    SIGINT and SIGQUIT as well, although they are not hooked by default
    by FPC. The run time errors/exception codes for these signals are
    resp. 217 and 233 (same as in Kylix; I changed ENoWideStringSupport
    to 234).
  * changed the BSD syscall version of fpsigaction to use pointer
    rather than "var" arguments (compatible with other targets, and
    required to be able to pass nil arguments inside the system unit)
  -> together fixes mantis #12704

git-svn-id: trunk@13077 -
2009-05-02 09:40:44 +00:00
joost
51b49d324e * Implemented function ExeSearch
git-svn-id: trunk@12947 -
2009-03-22 10:02:24 +00:00
joost
2c7d05d210 * Added ImplicitCurrentDir : Boolean = True parameter to FileSearch
git-svn-id: trunk@12946 -
2009-03-22 09:35:48 +00:00
Jonas Maebe
dbbd75ca47 * fixed setting EInoutError.ErrorCode (mantis #12575, thanks to
Bart Broersma for the analysis)

git-svn-id: trunk@12037 -
2008-11-09 09:46:47 +00:00
michael
d419c1078a * GetRandomBytes calls randomize only once, now thread safe too
git-svn-id: trunk@11125 -
2008-05-29 13:31:32 +00:00
michael
fb53b5e9f6 * GetRandomBytes calls random only once
git-svn-id: trunk@11123 -
2008-05-29 13:16:07 +00:00
marco
e57c36eaba * patch for #11110, unc drives and forcedirectories from Bart.
git-svn-id: trunk@10855 -
2008-05-01 15:41:36 +00:00
joost
1a4ee73146 * Added NoWideStringSupport runtime error
git-svn-id: trunk@10618 -
2008-04-08 21:19:52 +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
c424f27291 * patch by C Western for #10883
git-svn-id: trunk@10385 -
2008-02-24 20:00:08 +00:00
peter
3ffcb2244e * FileSearch needs to check first the file in the
current dir

git-svn-id: trunk@10128 -
2008-02-01 07:03:30 +00:00