************************系统实用例程******************************** Delphi / Kylix 跨平台运行时库(System Utilities)
Copyright (c) 1995-2002 Borland Softwrare Corporation
******************************************************************* SysUtils单元;
1.常量(Const)
1)文件打开方式
{$以下用于Linux环境}
麦马大学fmOpenRead = O_RDONLY;
fmOpenWrite = O_WRONLY;
fmOpenReadWrite = O_RDWR;
// fmShareCompat 不被支持
fmShareExclusive = $0010;
fmShareDenyWrite = $0020;
// fmShareDenyRead 不被支持
fmShareDenyNone = $0030;
{$ENDIF}
{$以下用于MsWindows}
fmOpenRead = $0000;
fmOpenWrite = $0001;
fmOpenReadWrite = $0002;
fmShareCompat = $0000 platform; // DOS 兼容模式不portable
fmShareExclusive = $0010;
fmShareDenyWrite = $0020;
fmShareDenyRead = $0030 platform; // 只写在所有平台上都不被支持
fmShareDenyNone = $0040;
{$ENDIF}
2)文件属性
faReadOnly = $00000001 platform;
faHidden = $00000002 platform;
faSysFile = $00000004 platform;
faV olumeID = $00000008 platform;
faDirectory = $00000010;
faArchive = $00000020 platform;
faSymLink = $00000040 platform;
faAnyFile = $0000003F;
3)时间单位
HoursPerDay = 24; 每天24小时
MinsPerHour = 60; 每小时60分
SecsPerMin = 60; 每分钟60秒
MSecsPerSec = 1000; 每秒1000毫秒
MinsPerDay = HoursPerDay * MinsPerHour; 每天的分钟数
SecsPerDay = MinsPerDay * SecsPerMin; 每天秒数
MSecsPerDay = SecsPerDay * MSecsPerSec; 每天毫秒数
DateDelta = 693594; 每天介于1/1/0001 和12/31/1899 之间
UnixDateDelta = 25569; { 介于TDateTime 基数(12/31/1899) 和Unix time_t 基数(1/1/1970)之间的天数}
2.类型定义(type)
TSysCharSet = t of Char; //设置字符类型标准:所有ANSI字符的集合
TIntegerSet = t of 0..SizeOf(Integer) * 8 - 1; { 设定整数的访问类型:0-31的整数集合} //类型转换
// WordRec使访问一个Word类型变量或者其他16位变量(SmallInt)的高位和低位字节变得更容易
WordRec = packed record
ca Integer of
0: (Lo, Hi: Byte);
1: (Bytes: array [0..1] of Byte);
major的名词end;
LongRec使访问一个LongWord类型变量或者其它32位变量(Single)高位和低位字变得更容易。
LongRec = packed record
ca Integer of
0: (Lo, Hi: Word);
1: (Words: array [0..1] of Word);
2: (Bytes: array [0..3] of Byte);
end;
Int64Rec使访问一个Int64类型变量或者其它64位变量(Double)高位和低位字变得更容易。
Int64Rec = packed record
ca Integer of
0: (Lo, Hi: Cardinal);
1: (Cardinals: array [0..1] of Cardinal);
2: (Words: array [0..3] of Word);
3: (Bytes: array [0..7] of Byte);
end;
//一般数组
PByteArray = ^TByteArray;
TByteArray = array[0..32767] of Byte;
PWordArray = ^TWordArray;
TWordArray = array[0..16383] of Word;
TProcedure = procedure; //一般程序指针
TFileName = type string; //一般文件类型
TSearchRec = record //用于搜索记录的结构(由函数FindFirst, FindNext, 和FindClo 使用)Time: Integer;
Size: Integer;
Attr: Integer;
Name: TFileName;
ExcludeAttr: Integer;
{$以下用于MsWindows平台}
FindHandle: THandle platform;
FindData: TWin32FindData platform;
{$ENDIF}
{$以下用于Linux环境}
Mode: mode_t platform;
FindHandle: Pointer platform;
PathOnly: String platform;
大樟树Pattern: String platform;
{$ENDIF}
end;
霍启刚爷爷
TFloatV alue = (fvExtended, fvCurrency); 浮点类型格式化代码
TFloatFormat = (ffGeneral, ffExponent, ffFixed, ffNumber, ffCurrency); FloatToText格式化代码TFloatRec = packed record // FloatToDecimal 结果的记录型结构
Exponent: Smallint;
Negative: Boolean;
Digits: array[0..20] of Char;
end;
TTimeStamp = record //日期和时间的记录结构
Time: Integer; 从0:00开始的的毫秒数
Date: Integer; {从1/1/0001以后的天的加数}
end;
TMbcsByteType = (mbSingleByte, mbLeadByte, mbTrailByte); 多字节字符集的字节类型TSysLocale = packed record //本地系统信息记录类型
DefaultLCID: Integer;
PriLangID: Integer;
SubLangID: Integer;
FarEast: Boolean;
MiddleEast: Boolean;
腑end;
{$以下用于MsWindows平台}
TLangRec = packed record //被使用的语言
FName: string;
FLCID: LCID;
FExt: string;
end;
TLanguages = class //存储系统支持的语言
private
……..
Public
…….
end platform;
{$ENDIF}
{以下用于Linux环境}
TEraRange = record
StartDate : Integer; // 从12/31/1899 (TDateTime 基数)的全部天数
EndDate : Integer; //从12/31/1899 (TDateTime 基数)的全部天数
Direction : Char;
end;
{$ENDIF}
Exception = class(TObject) //异常
private
……..
public
…
…….
end;
ExceptClass = class of Exception;
EAbort = class(Exception);
EHeapException = class(Exception)
private
AllowFree: Boolean;
public
procedure FreeInstance; override;
end;
EOutOfMemory = class(EHeapException); EInOutError = class(Exception)
public
ErrorCode: Integer;
end;
苏炳添肌肉
{以下用于MsWindows平台}
PExceptionRecord = ^TExceptionRecord; TExceptionRecord = record
ExceptionCode: Cardinal;
ExceptionFlags: Cardinal;
ExceptionRecord: PExceptionRecord;
ExceptionAddress: Pointer;
NumberParameters: Cardinal;
宋佳兴ExceptionInformation: array[0..14] of Cardinal; end;
{$ENDIF}
EExternal = class(Exception)
public
{$以下用于MsWindows平台}
ExceptionRecord: PExceptionRecord platform;
绿豆芽怎么炒{$ENDIF}
{$以下用于Linux环境}
ExceptionAddress: LongWord platform;
AccessAddress: LongWord platform;
SignalNumber: Integer platform;
{$ENDIF}
end;
EExternalException = class(EExternal);
EIntError = class(EExternal);
EDivByZero = class(EIntError);
ERangeError = class(EIntError);
EIntOverflow = class(EIntError);
EMathError = class(EExternal);
EInvalidOp = class(EMathError);
EZeroDivide = class(EMathError);
EOverflow = class(EMathError);
EUnderflow = class(EMathError);