SRL Archive - Suggestions

WriteFMT(fmt: string; x: array of __Pointer);


Nava2

2010-04-17 17:53:13

Should be a simple add, makes some cleaner code too.


WriteLn(Format('I like %d and %e.', [5247, sqrt(2)]));
//to:
WriteFMT('I like %d and %e.', [5247, sqrt(2)]);

Just a small thing.

i luffs yeww

2010-04-17 18:38:09

I don't see much use. Just shortens it by seven characters..

Nava2

2010-04-17 19:20:04

If there is RaiseExceptionFMT why not have WriteFMT?

Nava2

2010-04-17 21:50:14

also:

diff --git a/Units/MMLAddon/PSInc/Wrappers/math.inc b/Units/MMLAddon/PSInc/Wrappers/math.inc
index 7ae1342..3f08bdd 100644
--- a/Units/MMLAddon/PSInc/Wrappers/math.inc
+++ b/Units/MMLAddon/PSInc/Wrappers/math.inc
@@ -155,3 +155,18 @@ function ps_floor(e : extended) : integer; extdecl;
begin;
result := floor(e);
end;
+
+function ps_log2(x: extended): extended; extdec1;
+begin
+ result := log2(x);
+end;
+
+function ps_log10(x: extended): extended; extdec1;
+begin
+ result := log10(x);
+end;
+
+function ps_logn(x, n: extended): extended; extdec1;
+begin
+ result := logn(x, n);
+end;
diff --git a/Units/MMLAddon/PSInc/Wrappers/other.inc b/Units/MMLAddon/PSInc/Wrappers/other.inc
index 80df22d..cd2bf02 100644
--- a/Units/MMLAddon/PSInc/Wrappers/other.inc
+++ b/Units/MMLAddon/PSInc/Wrappers/other.inc
@@ -118,6 +118,7 @@ procedure ps_TerminateScript; extdecl;
begin;
CurrThread.Terminate;
end;
+
function ps_GetTimeRunning: LongWord; extdecl;
begin;
result := GetTickCount - CurrThread.StartTime;
diff --git a/Units/MMLAddon/PSInc/psexportedmethods.inc b/Units/MMLAddon/PSInc/psexportedmethods.inc
index b85d2d8..f9e8bfe 100644
--- a/Units/MMLAddon/PSInc/psexportedmethods.inc
+++ b/Units/MMLAddon/PSInc/psexportedmethods.inc
@@ -49,6 +49,9 @@ AddFunction(nil,'function Round(e:extended) : integer');
AddFunction(@ps_ceil,'function ceil(e : extended) : integer');
AddFunction(@ps_floor,'function floor(e : extended) : integer');
AddFunction(@ps_pow,'function pow(base,exponent : extended) : extended');
+AddFunction(@ps_log2,'function log2(x: Extended): Extended');
+AddFunction(@ps_log10,'function log10(x: Extended): Extended');
+AddFunction(@ps_logn,'function logN(x, base: Extended): Extended');
AddFunction(@ps_max,'function Max(a, b: Integer): Integer;');
AddFunction(@ps_min,'function Min(a, b: Integer): Integer;');
AddFunction(@ps_minE,'function MinE(a, b: extended): Extended;');

I have a patch as well.

mastaraymond

2010-04-17 22:54:41

It's in there..
Format

Wizzup?

2010-04-18 06:37:22

I don't think we need WriteFMT, since we already have writeln() and format.

Nava2

2010-04-18 10:34:44

What about my stuff for log2, log10, and logn?

mastaraymond

2010-04-18 12:33:02


program new;
procedure WriteFMT(const str : string; const Args : array of ___Pointer);
begin
writeln(Format(str,args));
end;
begin
writeFMT('TestMe %d',[5]);
end.

Nava2

2010-04-18 14:23:52

What about the log stuff….

mastaraymond

2010-04-18 14:31:12

From: Nava2
What about the log stuff….

Is z3h added

Atlest, just LogN and Ln.. I think the other two are to trivial to be added :D

Nava2

2010-04-18 14:42:14

Cool, thanks bro.