1{ 2 This file is part of the Free Pascal run time library. 3 Copyright (c) 2003 by Florian Klaempfl 4 member of the Free Pascal development team 5 6 See the file COPYING.FPC, included in this distribution, 7 for details about the copyright. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 13 **********************************************************************} 14{$mode objfpc} 15unit SysConst; 16 17interface 18 19{$ifdef FPC_HAS_FEATURE_ANSISTRINGS} 20{$H+} 21resourcestring 22{$else FPC_HAS_FEATURE_ANSISTRINGS} 23const 24{$endif FPC_HAS_FEATURE_ANSISTRINGS} 25 26{ from old str*.inc files } 27 SListIndexError = 'List index (%d) out of bounds'; 28 SParamIsNegative = 'Parameter "%s" cannot be negative.'; 29 SListCapacityError = 'List capacity (%d) exceeded.'; 30 SAbortError = 'Operation aborted'; 31 SAbstractError = 'Abstract method called'; 32 SAccessDenied = 'Access denied'; 33 SAccessViolation = 'Access violation'; 34 SArgumentMissing = 'Missing argument in format "%s"'; 35 SAssertError = '%s (%s, line %d)'; 36 SAssertionFailed = 'Assertion failed'; 37 SBusError = 'Bus error or misaligned data access'; 38 SCannotCreateEmptyDir = 'Cannot create empty directory'; 39 SControlC = 'Control-C hit'; 40 SDiskFull = 'Disk Full'; 41 SDispatchError = 'No variant method call dispatch'; 42 SDivByZero = 'Division by zero'; 43 SEndOfFile = 'Read past end of file'; 44 SErrInvalidDateMonthWeek = 'Year %d, month %d, Week %d and day %d is not a valid date.'; 45 SerrInvalidHourMinuteSecMsec = '%d:%d:%d.%d is not a valid time specification'; 46 SErrInvalidDateWeek = '%d %d %d is not a valid dateweek'; 47 SErrInvalidDayOfWeek = '%d is not a valid day of the week'; 48 SErrInvalidDayOfWeekInMonth = 'Year %d Month %d NDow %d DOW %d is not a valid date'; 49 SErrInvalidDayOfYear = 'Year %d does not have a day number %d'; 50 SErrInvalidTimeStamp = 'Invalid date/timestamp : "%s"'; 51 SInvalidJulianDate = '%f Julian cannot be represented as a DateTime'; 52 SErrIllegalDateFormatString = '"%s" is not a valid date format string'; 53 SErrInvalidTimeFormat = '"%s" is not a valid time'; 54 SExceptionErrorMessage = 'Exception at %p: %s'; 55 SExceptionStack = 'Exception stack error'; 56 SExecuteProcessFailed = 'Failed to execute "%s", error code: %d'; 57 SExternalException = 'External exception %x'; 58 SFileNotAssigned = 'File not assigned'; 59 SFileNotFound = 'File not found'; 60 SFileNotOpen = 'File not open'; 61 SFileNotOpenForInput = 'File not open for input'; 62 SFileNotOpenForOutput = 'File not open for output'; 63 SInValidFileName = 'Invalid filename'; 64 SIntOverflow = 'Arithmetic overflow'; 65 SIntfCastError = 'Interface not supported'; 66 SInvalidArgIndex = 'Invalid argument index in format "%s"'; 67 SInvalidBCD = '%x is an invalid BCD value'; 68 SInvalidBoolean = '"%s" is not a valid boolean.'; 69 SInvalidCast = 'Invalid type cast'; 70 SinvalidCurrency = 'Invalid currency: "%s"'; 71 SInvalidDateTime = '"%s" is not a valid date/time value.'; 72 SInvalidDateTimeFloat = '%f is not a valid date/time value.'; 73 SInvalidDrive = 'Invalid drive specified'; 74 SInvalidFileHandle = 'Invalid file handle'; 75 SInvalidFloat = '"%s" is an invalid float'; 76 SInvalidFormat = 'Invalid format specifier : "%s"'; 77 SInvalidGUID = '"%s" is not a valid GUID value'; 78 SInvalidInput = 'Invalid input'; 79 SInvalidInteger = '"%s" is an invalid integer'; 80 SInvalidOp = 'Invalid floating point operation'; 81 SInvalidPointer = 'Invalid pointer operation'; 82 SInvalidVarCast = 'Invalid variant type cast'; 83 SInvalidVarNullOp = 'Invalid NULL variant operation'; 84 SInvalidVarOp = 'Invalid variant operation'; 85 SInvalidBinaryVarOp = 'Invalid variant operation %s %s %s'; 86 SInvalidUnaryVarOp = 'Invalid variant operation %s %s'; 87 SInvalidVarOpWithHResultWithPrefix = 'Invalid variant operation (%s%.8x)'+LineEnding+'%s'; 88 SNoError = 'No error.'; 89 SNoThreadSupport = 'Threads not supported. Recompile program with thread driver.'; 90 SNoDynLibsSupport = 'Dynamic libraries not supported. Recompile program with dynamic library driver.'; 91 SMissingWStringManager = 'Widestring manager not available. Recompile program with appropriate manager.'; 92 SSigQuit = 'SIGQUIT signal received.'; 93 SObjectCheckError = 'Object reference is Nil'; 94 SOSError = 'System error, (OS Code %d):'+LineEnding+'%s'; 95 SOutOfMemory = 'Out of memory'; 96 SOverflow = 'Floating point overflow'; 97 SPrivilege = 'Privileged instruction'; 98 SRangeError = 'Range check error'; 99 SStackOverflow = 'Stack overflow'; 100 SSafecallException = 'Exception in safecall method'; 101 SiconvError = 'iconv error'; 102 SThreadError = 'Thread error'; 103 104 STooManyOpenFiles = 'Too many open files'; 105 SUnKnownRunTimeError = 'Unknown Run-Time error : %3.3d'; 106 SUnderflow = 'Floating point underflow'; 107 SUnkOSError = 'An operating system call failed.'; 108 SUnknown = 'Unknown run-time error code: '; 109 SUnknownErrorCode = 'Unknown error code: %d'; 110 SVarArrayBounds = 'Variant array bounds error'; 111 SVarArrayCreate = 'Variant array cannot be created'; 112 SVarArrayLocked = 'Variant array locked'; 113 SVarBadType = 'Invalid variant type'; 114 SVarInvalid = 'Invalid argument'; 115 SVarInvalid1 = 'Invalid argument: %s'; 116 SVarNotArray = 'Variant doesn''t contain an array'; 117 SVarNotImplemented = 'Operation not supported'; 118 SVarOutOfMemory = 'Variant operation ran out memory'; 119 SVarOverflow = 'Variant overflow'; 120 SVarParamNotFound = 'Variant Parameter not found'; 121 SVarTypeAlreadyUsedWithPrefix = 'Custom variant type (%s%.4x) already used by %s'; 122 SVarTypeConvertOverflow = 'Overflow while converting variant of type (%s) into type (%s)'; 123 SVarTypeCouldNotConvert = 'Could not convert variant of type (%s) into type (%s)'; 124 SVarTypeNotUsableWithPrefix = 'Custom variant type (%s%.4x) is not usable'; 125 SVarTypeOutOfRangeWithPrefix = 'Custom variant type (%s%.4x) is out of range'; 126 SVarTypeRangeCheck1 = 'Range check error for variant of type (%s)'; 127 SVarTypeRangeCheck2 = 'Range check error while converting variant of type (%s) into type (%s)'; 128 SVarTypeTooManyCustom = 'Too many custom variant types have been registered'; 129 SVarUnexpected = 'Unexpected variant error'; 130 SZeroDivide = 'Floating point division by zero'; 131 132 SFallbackError = 'An error, whose error code is larger than can be returned to the OS, has occurred'; 133 134 SNoToolserver = 'Toolserver is not installed, cannot execute Tool'; 135 136 SNotValidCodePageName = '%s is not a valid code page name'; 137 SInvalidCount = 'invalid count [%d]'; 138 SCharacterIndexOutOfBounds = 'character index out of bounds [%d]'; 139 SInvalidDestinationArray = 'invalid destination array'; 140 SInvalidDestinationIndex = 'invalid destination index [%d]'; 141 142 SNoArrayMatch = 'Can''t match any allowed value at pattern position %d, string position %d.'; 143 SNoCharMatch = 'Mismatch char "%s" <> "%s" at pattern position %d, string position %d.'; 144 SHHMMError = 'mm in a sequence hh:mm is interpreted as minutes. No longer versions allowed! (Position : %d).' ; 145 SFullpattern = 'Couldn''t match entire pattern string. Input too short at pattern position %d.'; 146 SPatternCharMismatch = 'Pattern mismatch char "%s" at position %d.'; 147 148 SShortMonthNameJan = 'Jan'; 149 SShortMonthNameFeb = 'Feb'; 150 SShortMonthNameMar = 'Mar'; 151 SShortMonthNameApr = 'Apr'; 152 SShortMonthNameMay = 'May'; 153 SShortMonthNameJun = 'Jun'; 154 SShortMonthNameJul = 'Jul'; 155 SShortMonthNameAug = 'Aug'; 156 SShortMonthNameSep = 'Sep'; 157 SShortMonthNameOct = 'Oct'; 158 SShortMonthNameNov = 'Nov'; 159 SShortMonthNameDec = 'Dec'; 160 161 SLongMonthNameJan = 'January'; 162 SLongMonthNameFeb = 'February'; 163 SLongMonthNameMar = 'March'; 164 SLongMonthNameApr = 'April'; 165 SLongMonthNameMay = 'May'; 166 SLongMonthNameJun = 'June'; 167 SLongMonthNameJul = 'July'; 168 SLongMonthNameAug = 'August'; 169 SLongMonthNameSep = 'September'; 170 SLongMonthNameOct = 'October'; 171 SLongMonthNameNov = 'November'; 172 SLongMonthNameDec = 'December'; 173 174 SShortDayNameMon = 'Mon'; 175 SShortDayNameTue = 'Tue'; 176 SShortDayNameWed = 'Wed'; 177 SShortDayNameThu = 'Thu'; 178 SShortDayNameFri = 'Fri'; 179 SShortDayNameSat = 'Sat'; 180 SShortDayNameSun = 'Sun'; 181 182 SLongDayNameMon = 'Monday'; 183 SLongDayNameTue = 'Tuesday'; 184 SLongDayNameWed = 'Wednesday'; 185 SLongDayNameThu = 'Thursday'; 186 SLongDayNameFri = 'Friday'; 187 SLongDayNameSat = 'Saturday'; 188 SLongDayNameSun = 'Sunday'; 189 190Function GetRunError(Errno : Word) : String; 191 192Implementation 193 194Function GetRunError(Errno : Word) : String; 195 196begin 197 Case Errno Of 198 0 : Result:=SNoError; 199 1 : Result:=SOutOfMemory; 200 2 : Result:=SFileNotFound; 201 3 : Result:=SInvalidFileName; 202 4 : Result:=STooManyOpenFiles; 203 5 : Result:=SAccessDenied; 204 6 : Result:=SInvalidFileHandle; 205 15 : Result:=SInvalidDrive; 206 100 : Result:=SEndOfFile; 207 101 : Result:=SDiskFull; 208 102 : Result:=SFileNotAssigned; 209 103 : Result:=SFileNotOpen; 210 104 : Result:=SFileNotOpenForInput; 211 105 : Result:=SFileNotOpenForOutput; 212 106 : Result:=SInvalidInput; 213 200 : Result:=SDivByZero; 214 201 : Result:=SRangeError; 215 203 : Result:=SOutOfMemory; 216 204 : Result:=SInvalidPointer; 217 205 : Result:=SOverFlow; 218 206 : Result:=SUnderFlow; 219 207 : Result:=SInvalidOp; 220 211 : Result:=SAbstractError; 221 214 : Result:=SBusError; 222 215 : Result:=SIntOverFlow; 223 216 : Result:=SAccessViolation; 224 217 : Result:=SPrivilege; 225 218 : Result:=SControlC; 226 219 : Result:=SInvalidCast; 227 220 : Result:=SInvalidVarCast; 228 221 : Result:=SInvalidVarOp; 229 222 : Result:=SDispatchError; 230 223 : Result:=SVarArrayCreate; 231 224 : Result:=SVarNotArray; 232 225 : Result:=SVarArrayBounds; 233 227 : Result:=SAssertionFailed; 234 228 : Result:=SExternalException; 235 229 : Result:=SIntfCastError; 236 230 : Result:=SSafecallException; 237 231 : Result:=SExceptionStack; 238 232 : Result:=SNoThreadSupport; 239 233 : Result:=SMissingWStringManager; 240 235 : Result:=SNoDynLibsSupport; 241 242 255 : Result:=SFallbackError; 243 244 {Error codes larger than 255 cannot be returned as an exit code to the OS, 245 for some OS's. If this happens, error 255 is returned instead. 246 Errors for which it is important that they can be distinguished, 247 shall be below 255} 248 249 {Error in the range 900 - 999 is considered platform specific} 250 251 900 : Result:=SNoToolserver; {Mac OS specific} 252 253 end; 254 If length(Result)=0 then 255 begin 256 Str(Errno:3,Result); 257 Result:=SUnknown+Result; 258 end; 259end; 260 261end. 262