From b082c75daa291d72fe67076a6da3efc6bf62e009 Mon Sep 17 00:00:00 2001 From: Raymond Date: Tue, 27 Apr 2010 20:30:51 +0200 Subject: [PATCH] Hex-conversion functions added. --- Units/MMLAddon/PSInc/Wrappers/math.inc | 10 ++++++++++ Units/MMLAddon/PSInc/psexportedmethods.inc | 2 ++ 2 files changed, 12 insertions(+) diff --git a/Units/MMLAddon/PSInc/Wrappers/math.inc b/Units/MMLAddon/PSInc/Wrappers/math.inc index 486dbce..cdfecb9 100644 --- a/Units/MMLAddon/PSInc/Wrappers/math.inc +++ b/Units/MMLAddon/PSInc/Wrappers/math.inc @@ -163,3 +163,13 @@ function ps_ln(x : extended) : extended;extdecl; begin result := ln(x); end; + +function ps_inttohex(value : integer) : string; +begin + result := IntToHex(value,1); +end; + +function ps_hextoint(hex : string) : integer; +begin + result := StrToInt('$' + hex); +end; diff --git a/Units/MMLAddon/PSInc/psexportedmethods.inc b/Units/MMLAddon/PSInc/psexportedmethods.inc index 2be7e8b..4263505 100644 --- a/Units/MMLAddon/PSInc/psexportedmethods.inc +++ b/Units/MMLAddon/PSInc/psexportedmethods.inc @@ -71,6 +71,8 @@ AddFunction(@ps_FixD,'function FixD(Degrees : extended) : Extended;'); AddFunction(@ps_InRange,'function InRange(const value,min,max : integer) : boolean;'); AddFunction(@ps_logn,'function logn(base, x : extended): extended;'); AddFunction(@ps_ln,'function ln(x : extended) : extended;'); +AddFunction(@ps_inttohex,'function IntToHex(number : integer) : string'); +AddFunction(@ps_hextoint,'function HexToInt(Hex : string) : integer'); {window} SetCurrSection('Window');