From f650bc134e5e1db71498bd4504a98331a99993d2 Mon Sep 17 00:00:00 2001 From: reinelt Date: Wed, 30 Mar 2005 04:57:50 +0000 Subject: [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 --- lcd4linux.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lcd4linux.c') 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); } -- cgit v1.2.3