Skip to content

Commit 7511c2f

Browse files
ADD: update libs
1 parent 44dab0f commit 7511c2f

File tree

3 files changed

+39
-6
lines changed

3 files changed

+39
-6
lines changed

data_control/uJSON.pas

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(******************************************************************************)
22
(* uJSON.pas ??.??.???? *)
33
(* *)
4-
(* Version : 0.13 *)
4+
(* Version : 0.14 *)
55
(* *)
66
(* Author : Uwe Schächterle (Corpsman) *)
77
(* *)
@@ -40,6 +40,7 @@
4040
(* 0.12 = .Clone Function *)
4141
(* 0.13 = Erste Versuche eine Zeilennummer aus zu geben, wenn *)
4242
(* der JSON Text falsch ist.. *)
43+
(* 0.14 = Ignore \u tags instead of throwing an exception *)
4344
(* *)
4445
(******************************************************************************)
4546
Unit uJSON;
@@ -712,7 +713,8 @@
712713
If (achar = 't') Then achar := chr($09);
713714
If (achar = 'u') Then Begin
714715
//todo: das Auswerten des Unicode Zeichens fehlt noch !!
715-
Raise Exception.Create('parser does not support \u symbols in string.');
716+
achar := ' '; // Das Zeichen bauen wir um zu einem Leerzeichen -> nicht richtig, aber so können wir es "überlesen"
717+
aindex := aindex + 4; // Die 4 Zeichen welche nachfolgen und das UTF16 Zeichen bilden ignorieren wir mal ..
716718
End;
717719
interpretnext := false;
718720
End;

data_control/ueventer.pas

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(******************************************************************************)
22
(* Eventer 09.05.2019 *)
33
(* *)
4-
(* Version : 0.05 *)
4+
(* Version : 0.06 *)
55
(* *)
66
(* Author : Uwe Schächterle (Corpsman) *)
77
(* *)
@@ -26,6 +26,7 @@
2626
(* 0.03 - improve .click detection *)
2727
(* 0.04 - MouseEnter / MouseLeave *)
2828
(* 0.05 - Owner property public *)
29+
(* 0.06 - Click event only, if mouse down was also on element *)
2930
(* *)
3031
(* Known Bugs : none *)
3132
(* *)
@@ -198,7 +199,7 @@
198199
fOnMouseDownCapture: TMouseEvent;
199200
fOnMouseMoveCapture: TMouseMoveEvent;
200201
fOnMouseUpCapture: TMouseEvent;
201-
202+
fTransformedMouseDownPos: TPoint;
202203
{$IFDEF KeyEvents}
203204
fOnKeyDownCapture: TKeyEvent;
204205
fOnKeyUpCapture: TKeyEvent;
@@ -304,7 +305,13 @@
304305
End;
305306
For i := 0 To high(fEventer) Do Begin
306307
If i > high(fEventer) Then break; // Da im Event das Eventer element auch freigegeben werden darf, braucht es dieses if
307-
If PointInRect(point(x, y), fEventer[i].ClientRect) And fEventer[i].fVisible And fEventer[i].fEnabled Then Begin
308+
If
309+
// Das Element wurde im MouseDown bereits ausgewählt
310+
PointInRect(point(fTransformedMouseDownPos.x, fTransformedMouseDownPos.y), fEventer[i].ClientRect)
311+
// Das Element ist immer noch ausgewählt
312+
And PointInRect(point(x, y), fEventer[i].ClientRect)
313+
And fEventer[i].fVisible
314+
And fEventer[i].fEnabled Then Begin
308315
handled := true;
309316
If fMouseDownEventer = fEventer[i] Then fMouseDownEventer := Nil;
310317
fEventer[i].MouseUp(button, shift, x - fEventer[i].Left, y - fEventer[i].Top);
@@ -343,6 +350,7 @@
343350
x := p.x;
344351
y := p.y;
345352
End;
353+
fTransformedMouseDownPos := point(x, y);
346354
For i := 0 To high(fEventer) Do Begin
347355
fEventer[i].FFocus := false;
348356
End;

data_control/umathsolver.pas

+24-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(******************************************************************************)
22
(* umathsolver.pas ??.??.???? *)
33
(* *)
4-
(* Version : 0.09 *)
4+
(* Version : 0.10 *)
55
(* *)
66
(* Author : Uwe Schächterle (Corpsman) *)
77
(* *)
@@ -32,6 +32,7 @@
3232
(* 0.07 - Formatieren von Binärzahlen Nibble weise *)
3333
(* 0.08 - trunc, floor repariert *)
3434
(* 0.09 - a^b für a < 0 und b ganzzahlig *)
35+
(* 0.10 - rnd / random function *)
3536
(* *)
3637
(******************************************************************************)
3738

@@ -61,6 +62,7 @@
6162
* floor = Die nächst kleinere Integer Zahl
6263
* ceil = Die nächst größere Integer Zahl
6364
* round = Rundet zur nächsten Integer Zahl
65+
* rnd/random = Erzeugt eine Zufallszahl im Bereich [0 .. Param -1]
6466
*
6567
* Binäre Operanden
6668
* ^ = Exponenzieren
@@ -413,6 +415,25 @@
413415
Result_is_Float := false;
414416
End;
415417

418+
Function Random_Float(v1: Pointer): Pointer;
419+
Var
420+
res: pmp_float;
421+
tmp: mp_int;
422+
Begin
423+
new(res);
424+
mpf_init(res^);
425+
mpf_random(res^);
426+
mpf_mul(res^, pmp_float(v1)^, res^);
427+
If Not Result_is_Float Then Begin
428+
mp_init(tmp);
429+
mpf_trunc(res^, tmp);
430+
mpf_set_mpi(res^, tmp);
431+
mp_clear(tmp);
432+
End;
433+
result := res;
434+
Result_is_Float := false;
435+
End;
436+
416437
Function shift_left_Float(v1, v2: Pointer): Pointer;
417438
Var
418439
mull: mp_float;
@@ -806,6 +827,8 @@
806827
calc.AddUnOP('trunc', @trunc_Float);
807828
calc.AddUnOP('ceil', @Ceil_Float);
808829
calc.AddUnOP('round', @Round_Float);
830+
calc.AddUnOP('rnd', @Random_Float);
831+
calc.AddUnOP('random', @Random_Float);
809832

810833
calc.AddBinOP('^', @Pow_Float);
811834
calc.AddBinOP('shl', @shift_left_Float);

0 commit comments

Comments
 (0)