aboutsummaryrefslogtreecommitdiffstats
path: root/plugin_math.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugin_math.c')
-rw-r--r--plugin_math.c66
1 files changed, 25 insertions, 41 deletions
diff --git a/plugin_math.c b/plugin_math.c
index a2b53f9..413ee4e 100644
--- a/plugin_math.c
+++ b/plugin_math.c
@@ -1,4 +1,5 @@
-/* $Id: plugin_math.c,v 1.9 2005/05/08 04:32:44 reinelt Exp $
+/* $Id: plugin_math.c 755 2007-01-21 06:40:23Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/branches/0.10.1/plugin_math.c $
*
* math plugin
*
@@ -21,46 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- *
- * $Log: plugin_math.c,v $
- * Revision 1.9 2005/05/08 04:32:44 reinelt
- * CodingStyle added and applied
- *
- * 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
- *
- * Revision 1.6 2004/06/26 12:05:00 reinelt
- *
- * uh-oh... the last CVS log message messed up things a lot...
- *
- * Revision 1.5 2004/06/26 09:27:21 reinelt
- *
- * added '-W' to CFLAGS
- * changed all C++ comments to C ones
- * cleaned up a lot of signed/unsigned mistakes
- *
- * Revision 1.4 2004/03/06 20:31:16 reinelt
- * 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...
- *
- * Revision 1.3 2004/03/03 03:47:04 reinelt
- * 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
- *
- * Revision 1.2 2004/01/29 04:40:02 reinelt
- * every .c file includes "config.h" now
- *
- * Revision 1.1 2003/12/19 05:50:34 reinelt
- * added plugin_math.c and plugin_string.c
- *
*/
/*
@@ -153,6 +114,26 @@ static void my_ceil(RESULT * result, RESULT * arg)
SetResult(&result, R_NUMBER, &value);
}
+static void my_decode(RESULT * result, int argc, RESULT * argv[])
+{
+ int index;
+
+ if (argc < 2) {
+ error("decode(): wrong number of parameters");
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ index = R2N(argv[0]);
+
+ if (index < 0 || index >= argc - 1) {
+ SetResult(&result, R_STRING, "");
+ return;
+ }
+
+ CopyResult(&result, argv[index + 1]);
+}
+
int plugin_init_math(void)
{
@@ -177,6 +158,9 @@ int plugin_init_math(void)
AddFunction("floor", 1, my_floor);
AddFunction("ceil", 1, my_ceil);
+ /* decode */
+ AddFunction("decode", -1, my_decode);
+
return 0;
}