Sie sind auf Seite 1von 5

PAL built in functions, classes, types and constants ==================================================== More documentation is available at: http://www.dwscript.com/libdocu/LibDocu.

html Please not that not all of these units are available in PAL. Unit: unVCLGUIFunctions ======================= procedure ShowMessage(Msg : String); function InputBox(Caption : String; Prompt : String; Def : String):String; procedure ErrorDlg(Msg : String); procedure InformationDlg(Msg : String); function QuestionDlg(Msg : String):Boolean; function OkCancelDlg(Msg : String):Boolean; #################################################### Unit: dws2FileFunctions ======================= procedure SaveStringToFile(Filename : String; Data : String); function LoadStringFromFile(Filename : String):String; procedure AppendStringToFile(Filename : String; Data : String); function FileExists(Filename : String):Boolean; function DeleteFile(Filename : String):Boolean; function RenameFile(OldName : String; NewName : String):Boolean; procedure ChDir(NewDir : String); function CreateDir(Dir : String):Boolean; function RemoveDir(Dir : String):Boolean; function GetCurrentDir:String; function SetCurrentDir(Dir : String):Boolean; function FileSearch(Name : String; DirList : String):String; function ExtractFileDrive(FileName : String):String; function ExtractFileDir(FileName : String):String; function ExtractFileName(FileName : String):String; function ExtractFilePath(FileName : String):String; function ExtractFileExt(FileName : String):String; function ChangeFileExt(FileName : String; Ext : String):String; ####################################################

Unit: dws2MathFunctions ======================= function function function function function function function function function Sin(a : Float):Float; Sinh(a : Float):Float; Cos(a : Float):Float; Cosh(a : Float):Float; Tan(a : Float):Float; Tanh(a : Float):Float; ArcSin(a : Float):Float; ArcSinh(a : Float):Float; ArcCos(a : Float):Float;

function function function function function function function function function function function function function function function function function function function

ArcCosh(a : Float):Float; ArcTan(a : Float):Float; ArcTanh(a : Float):Float; Cotan(a : Float):Float; Hypot(x : Float; y : Float):Float; Inc(var a : Integer; b : Integer):Float; Abs(a : Float):Float; Exp(a : Float):Float; Ln(a : Float):Float; Log2(a : Float):Float; Log10(a : Float):Float; LogN(n : Float; x : Float):Float; Sqrt(v : Float):Float; Sqr(v : Float):Float; Int(v : Float):Float; Frac(v : Float):Float; Trunc(v : Float):Float; Round(v : Float):Float; Power(base : Float; exponent : Float):Float;

function DegToRad(v : Float):Float; function RadToDeg(v : Float):Float; function Max(v1 : Float; v2 : Float):Float; function Min(v1 : Float; v2 : Float):Float; function Pi:Float; function Random:Float; function RandomInt(Range : Integer):Integer; procedure Randomize; function RandG(mean : Float; stdDev : Float):Float; function RandSeed:Integer; function SetRandSeed(Seed:Integer);

####################################################

Unit: dws2StringFunctions ========================= function IntToStr(v : Integer):String; function StrToInt(str : String):Integer; function StrToIntDef(str : String; Def : Integer):Integer; function IntToHex(v : Integer; Digits : Integer):Integer; function FloatToStr(v : Float):String; function StrToFloat(str : String):Float; function StrToFloatDef(str : String; Def :Float):Float; function Chr(x : Integer):String; function Ord(s : String):String; function CharAt(s : String; x : Integer):String; procedure SetCharAt(var S : String; x : Integer; c : String); procedure Delete(var S : String; Index : Integer; Len : Integer); procedure Insert(src : String; var Dest : String; Index : Integer); function LowerCase(Str : String):String; function AnsiLowerCase(Str : String):String;

function function function function function function function function function function function function function function

UpperCase(Str : String):String; AnsiUpperCase(Str : String):String; Pos(SubStr : String; Str : string):Integer; Length(Str : String):Integer; TrimLeft(Str : String):String; TrimRight(Str : String):String; Trim(Str : String):String; CompareText(Str1 : String; Str2 : String):Integer; AnsiCompareText(Str1 : String; Str2 : String):Integer; CompareStr(Str1 : String; Str2 : String):Integer; AnsiCompareStr(Str1 : String; Str2 : String):Integer; IsDelimiter(delims : String; s : String; Index : Integer):Boolean; LastDelimiter(delims : String; s : String):Boolean; QuotedStr(Str : String):String;

####################################################

Unit: dws2TimeFunctions ======================= function Now: DateTime; function Date: DateTime; function Time: DateTime; function DateTimeToStr(dt: DateTime):string; function StrToDateTime(str : String): DateTime; function DateToStr(Date: DateTime):String ; function StrToDate(Str : String): DateTime; function TimeToStr(Time : DateTime):String; function StrToTime(Str : String): DateTime; function DayOfWeek(dt : DateTime):Integer; function FormatDateTime(Format : String; dt : DateTime):String; function IsLeapYear(Year : Integer):Boolean; function IncMonth(dt : DateTime; nm : Integer):DateTime; procedure DecodeDate(dt : DateTime; var yy,mm,dd : Integer); function EncodeDate(yy, mm, dd : Integer):DateTime; procedure DecodeTime(dt : DateTime; var hh, mm, ss, ms : Integer); function EncodeTime(hh, mm, ss, ms : Integer):DateTime;

####################################################

Unit: dws2GlobalVarsFunctions ============================= function ReadGlobalVar(Name : String):Variant; function ReadGlobalVarDef(Name : String; Def : Variant):Variant; function WriteGlobalVar(Name : String; Val : Variant); procedure CleanupGlobalVars; #################################################### @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

General expresions & syntax Declaring variables: const A = 'Hello world!'; const A = 123; var var var var var V V V V V : : : : : Integer; String; Array[1..5] of Integer; Array of Integer; TMyClass;

var V : Integer = 1; var V : String = 'Hello world!'; Math: m := a + b; m := a - b; m := a * b; m := a / b; {Float only} m := a div b; {Integer only; Discards remainder} m := a mod b; Integer only; Only remainder} m := -m; Logic: not a a or b a and b a xor b a < b a <= b a > b a >= b a <> b a = b

Casting: float(x) TDateTime(x) Type checking: a is TMyClass a as TMyClass Selection: if ({logic expression} then {Do stuff} else {Do stuff}; case {Value} of 1 : {Do stuff} 2..4 : {Do stuff} else {Do stuf}

end; Loops: var C : Integer; For C := A to B do begin {Do stuff} end; while ({Logic expresion is True}) do begin {Do stuff} end; repeat until ({Logic expresion is True}); ####################################################