aboutsummaryrefslogtreecommitdiffstats
path: root/lcd4linux.c
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2005-03-30 04:57:50 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2005-03-30 04:57:50 +0000
commitf650bc134e5e1db71498bd4504a98331a99993d2 (patch)
tree51ba56fb654e4b61f180d15cc2017183c2e3a4ea /lcd4linux.c
parent5985c204a32bd6b9f69646dbe6110ffa0c55651b (diff)
downloadlcd4linux-f650bc134e5e1db71498bd4504a98331a99993d2.tar.gz
[lcd4linux @ 2005-03-30 04:57:50 by reinelt]
Evaluator speedup: use bsearch for finding functions and variables git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@521 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'lcd4linux.c')
-rw-r--r--lcd4linux.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lcd4linux.c b/lcd4linux.c
index d4885b1..65e4a66 100644
--- a/lcd4linux.c
+++ b/lcd4linux.c
@@ -1,4 +1,4 @@
-/* $Id: lcd4linux.c,v 1.76 2005/01/18 06:30:23 reinelt Exp $
+/* $Id: lcd4linux.c,v 1.77 2005/03/30 04:57:50 reinelt Exp $
*
* LCD4Linux
*
@@ -23,6 +23,9 @@
*
*
* $Log: lcd4linux.c,v $
+ * Revision 1.77 2005/03/30 04:57:50 reinelt
+ * Evaluator speedup: use bsearch for finding functions and variables
+ *
* Revision 1.76 2005/01/18 06:30:23 reinelt
* added (C) to all copyright statements
*
@@ -417,10 +420,14 @@ static void interactive_mode (void)
if (strlen(line)>0) {
if (Compile(line, &tree)!=-1) {
Eval (tree, &result);
- if (result.type==R_NUMBER) {
+ if (result.type == R_NUMBER) {
printf ("%g\n", R2N(&result));
- } else if (result.type==R_STRING) {
+ } else if (result.type == R_STRING) {
printf ("'%s'\n", R2S(&result));
+ } else if (result.type == (R_NUMBER|R_STRING)) {
+ printf ("'%s' (%g)\n", R2S(&result), R2N(&result));
+ } else {
+ printf ("internal error: unknown result type %d\n", result.type);
}
DelResult (&result);
}