aboutsummaryrefslogtreecommitdiffstats
path: root/plugin_math.c
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2005-04-05 04:46:06 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2005-04-05 04:46:06 +0000
commitadd33a2a7f689611d2b76029a0d5597281f684bc (patch)
tree81f45c145885e757343d8d9b460ba350f35a6bfc /plugin_math.c
parentc49672b6b89a02dd5ed9c5203b534f8bd6e07509 (diff)
downloadlcd4linux-add33a2a7f689611d2b76029a0d5597281f684bc.tar.gz
[lcd4linux @ 2005-04-05 04:46:06 by reinelt]
ceil/floor patch from Maxime git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@526 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'plugin_math.c')
-rw-r--r--plugin_math.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/plugin_math.c b/plugin_math.c
index d1216a9..e5a3cc0 100644
--- a/plugin_math.c
+++ b/plugin_math.c
@@ -1,4 +1,4 @@
-/* $Id: plugin_math.c,v 1.7 2005/01/18 06:30:23 reinelt Exp $
+/* $Id: plugin_math.c,v 1.8 2005/04/05 04:46:06 reinelt Exp $
*
* math plugin
*
@@ -23,6 +23,9 @@
*
*
* $Log: plugin_math.c,v $
+ * Revision 1.8 2005/04/05 04:46:06 reinelt
+ * ceil/floor patch from Maxime
+ *
* Revision 1.7 2005/01/18 06:30:23 reinelt
* added (C) to all copyright statements
*
@@ -135,6 +138,18 @@ static void my_max (RESULT *result, RESULT *arg1, RESULT *arg2)
SetResult(&result, R_NUMBER, &value);
}
+static void my_floor (RESULT *result, RESULT *arg)
+{
+ double value = floor(R2N(arg));
+ SetResult(&result, R_NUMBER, &value);
+}
+
+static void my_ceil (RESULT *result, RESULT *arg)
+{
+ double value = ceil(R2N(arg));
+ SetResult(&result, R_NUMBER, &value);
+}
+
int plugin_init_math (void)
{
@@ -155,6 +170,10 @@ int plugin_init_math (void)
AddFunction ("min", 2, my_min);
AddFunction ("max", 2, my_max);
+ /* floor, ceil */
+ AddFunction ("floor", 1, my_floor);
+ AddFunction ("ceil", 1, my_ceil);
+
return 0;
}
amp;follow=1'>[lcd4linux @ 2004-03-12 13:58:14 by reinelt]reinelt1-468/+0 removed imon.c (has been replaced by plugin_imon.c) git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@394 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-11[lcd4linux @ 2004-03-11 06:39:58 by reinelt]reinelt16-133/+350 big patch from Martin: - reuse filehandles - memory leaks fixed - earlier busy-flag checking with HD44780 - reuse memory for strings in RESULT and hash - netdev_fast to wavid time-consuming regex git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@393 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-10[lcd4linux @ 2004-03-10 07:16:15 by reinelt]reinelt7-149/+693 MySQL plugin from Javier added git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@392 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-08[lcd4linux @ 2004-03-08 18:46:21 by hejl]hejl1-3/+6 Fixed bug introduced with "caching" the loadavg values git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@391 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-08[lcd4linux @ 2004-03-08 18:45:52 by hejl]hejl1-4/+7 fixed segfault when using string concatenation git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@390 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-08[lcd4linux @ 2004-03-08 16:26:26 by reinelt]reinelt5-14/+46 re-introduced \nnn (octal) characters in strings text widgets can have a 'update' speed of 0 which means 'never' (may be used for static content) git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@389 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-08[lcd4linux @ 2004-03-08 04:33:08 by reinelt]reinelt1-21/+41 string concatenation fixed git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@388 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-06[lcd4linux @ 2004-03-06 20:31:16 by reinelt]reinelt12-640/+946 Complete rewrite of the evaluator to get rid of the code from mark Morley (because of license issues). The new Evaluator does a pre-compile of expressions, and stores them in trees. Therefore it should be reasonable faster... git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@387 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-03[lcd4linux @ 2004-03-03 08:40:07 by hejl]hejl1-1/+6 Fixed memory leak in hash_get_regex git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@386 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-03[lcd4linux @ 2004-03-03 04:44:16 by reinelt]reinelt13-63/+96 changes (cosmetics?) to the big patch from Martin hash patch un-applied git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@385 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-03[lcd4linux @ 2004-03-03 03:47:04 by reinelt]reinelt46-167/+770 big patch from Martin Hejl: - use qprintf() where appropriate - save CPU cycles on gettimeofday() - add quit() functions to free allocated memory - fixed lots of memory leaks git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@384 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-03[lcd4linux @ 2004-03-03 03:41:02 by reinelt]reinelt1-9/+11 Crystalfontz Contrast issue fixed git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@383 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-03-01[lcd4linux @ 2004-03-01 04:29:51 by reinelt]reinelt4-24/+55 cfg_number() returns -1 on error, 0 if value not found (but default val used), and 1 if value was used from the configuration. HD44780 driver adopted to new cfg_number() Crystalfontz 631 driver nearly finished git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@382 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-02-29[lcd4linux @ 2004-02-29 17:09:53 by reinelt]reinelt5-15/+226 ChangeLog updated Version number bumped to 0.10.0 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@381 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-02-29[lcd4linux @ 2004-02-29 14:30:59 by reinelt]reinelt1-2/+10 icon visibility fix for generic graphics from Xavier git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@380 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-02-27[lcd4linux @ 2004-02-27 07:06:24 by reinelt]reinelt5-11/+200 new function 'qprintf()' (simple but quick snprintf() replacement) git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@379 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-02-27[lcd4linux @ 2004-02-27 06:07:55 by reinelt]reinelt2-21/+40 hash improvements from Martin git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@378 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2004-02-26[lcd4linux @ 2004-02-26 21:42:45 by reinelt]reinelt1-3/+12 memory leak fixes from Martin git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@377 3ae390bd-cb1e-0410-b409-cd5a39f66f1f