[gcalctool/gcalctool-newui2] ...



commit b3adc6911b9ea32213916f4b9eff8e4e5e2d9d17
Author: Robert Ancell <robert ancell gmail com>
Date:   Wed Sep 23 14:25:25 2009 +1000

    ...

 src/calctool.c  |   40 ++---------------
 src/calctool.h  |   15 +------
 src/display.c   |  136 +++++++++++++++++-------------------------------------
 src/display.h   |    6 +-
 src/functions.c |   59 ++++--------------------
 src/gtk.c       |   40 +---------------
 src/mp-binary.c |    5 ++
 src/ui.h        |    7 +--
 8 files changed, 69 insertions(+), 239 deletions(-)
---
diff --git a/src/calctool.c b/src/calctool.c
index cbecf1d..3e4df9e 100644
--- a/src/calctool.c
+++ b/src/calctool.c
@@ -20,12 +20,10 @@
  *  02111-1307, USA.
  */
 
+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <stdlib.h>
-#include <assert.h>
 #include <sys/types.h>
-#include <math.h>
 #include <glib-object.h>
 
 #include "calctool.h"
@@ -34,12 +32,9 @@
 #include "display.h"
 #include "functions.h"
 #include "ui.h"
-#include "mp.h"
 #include "register.h"
 #include "mp-equation.h"
 
-time_t time();
-
 /* Calctool variables and options. */
 static CalculatorVariables calc_state;
 CalculatorVariables *v;
@@ -69,7 +64,7 @@ solve(const char *equation)
         exit(1);
     }
     else {
-        mp_cast_to_string(&result, v->base, 9, 1, result_str, MAXLINE);
+        mp_cast_to_string(&result, 10, 9, 1, result_str, MAXLINE);
         printf("%s\n", result_str);
         exit(0);
     }
@@ -173,18 +168,12 @@ get_options(int argc, char *argv[])
 static void
 init_state(void)
 {
-    int acc, i;
     /* Translators: Digits localized for the given language */
     const char *digit_values = _("0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F");
     const char *default_digits[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"};
     gchar **digits;
     gboolean use_default_digits = FALSE;
-
-    acc              = MAX_DIGITS + 12;     /* MP internal accuracy. */
-
-    v->error         = FALSE;          /* No calculator error initially. */
-    
-    v->base          = 10;
+    int i;
 
     digits = g_strsplit(digit_values, ",", -1);
     for (i = 0; i < 16; i++) {
@@ -196,31 +185,10 @@ init_state(void)
             v->digits[i] = strdup(digits[i]);
     }
     g_strfreev(digits);
+
     v->radix         = get_radix();    /* Locale specific radix string. */
     v->tsep          = get_tsep();     /* Locale specific thousands separator. */
     v->tsep_count    = get_tsep_count();
-    
-    if (get_int_resource(R_ACCURACY, &i))
-        v->accuracy = i;
-    else
-        v->accuracy = DEFAULT_ACCURACY;
-    if (v->accuracy < 0 || v->accuracy > MAXACC) {
-       /* Translators: A log message displayed when an invalid accuracy
-        is read from the configuration */
-       fprintf(stderr, _("%s: accuracy should be in the range 0-%d\n"), 
-               v->progname, MAXACC);
-       v->accuracy = DEFAULT_ACCURACY;
-    }
-
-    if (get_enumerated_resource(R_TRIG, Rtstr, &i))
-       v->ttype = (MPAngleUnit) i;
-    else
-       v->ttype = MP_DEGREES;
-
-    if (get_int_resource(R_WORDLEN, &i))
-       v->wordlen = i;
-    else
-       v->wordlen = 64;
 }
 
 
diff --git a/src/calctool.h b/src/calctool.h
index b2cfbc5..925e34a 100644
--- a/src/calctool.h
+++ b/src/calctool.h
@@ -35,14 +35,10 @@
 #define MAX_DIGITS     200         /* Maximum displayable number of digits. */
 #define MAX_LOCALIZED  (MAX_DIGITS * (1 + MB_LEN_MAX) + MB_LEN_MAX)
 
-#define DEFAULT_ACCURACY 9
-
 #ifndef MAXLINE
 #define MAXLINE        512        /* Length of character strings. */
 #endif
 
-#define MAXACC         99         /* Max. number of digits after numeric point. */
-
 #define MAX_FUNCTIONS 10
 #define MAX_REGISTERS 10         /* Maximum number of memory registers. */
 
@@ -55,8 +51,6 @@
 #undef FALSE
 #define FALSE          0
 
-#define MPMATH_ERR		    	20001
-
 /* Calctool variables and options. */
 typedef struct {
     char *progname;           /* Name of this program. */
@@ -67,15 +61,8 @@ typedef struct {
     const char *radix;        /* Locale specific radix string. */
     const char *tsep;         /* Locale specific thousands separator. */
     int tsep_count;           /* Number of digits between separator. */
-
-    int base;                 /* Numeric base (2, 8, 10 or 16). */
-    MPAngleUnit ttype;        /* Angle unit type */
-    int wordlen;              /* Length of word for bitwise operations */
-    int accuracy;             /* Number of digits precision. */
-
-    int error;                /* true if there is a display error */
 } CalculatorVariables;
 
 extern CalculatorVariables *v; /* Calctool variables and options. */
 
-#endif /*CALCTOOL_H*/
+#endif /* CALCTOOL_H */
diff --git a/src/display.c b/src/display.c
index 2ab56ac..e5be9ed 100644
--- a/src/display.c
+++ b/src/display.c
@@ -30,15 +30,12 @@
 
 #include "display.h"
 
-#include "get.h"
 #include "mp.h"
 #include "functions.h"
 #include "ui.h"
 #include "mp-equation.h" // For mp_equation_parse()
 #include "register.h"
 
-static const char *display_types[] = { "ENG", "FIX", "SCI", NULL };
-
 static GCDisplayState *
 get_state(GCDisplay *display)
 {
@@ -80,7 +77,7 @@ str_replace(char *str, char *from, char *to)
 
 /* Add in the thousand separators characters if required */
 static void
-localize_expression(char *dest, const char *src, int dest_length, int *cursor)
+localize_expression(GCDisplay *display, char *dest, const char *src, int dest_length, int *cursor)
 {
     GString *output;
     const char *c, *d;
@@ -109,7 +106,7 @@ localize_expression(char *dest, const char *src, int dest_length, int *cursor)
             g_string_append_unichar(output, g_utf8_get_char(c));
             
             /* Insert separator after nth digit */
-            if (v->display.show_tsep && v->base == 10 &&
+            if (display->show_tsep && display->format == DEC &&
                 !after_radix && digit_count > 1 && digit_count % v->tsep_count == 1) {
                 g_string_append(output, v->tsep);
                 if (new_cursor > read_cursor) {
@@ -146,7 +143,6 @@ localize_expression(char *dest, const char *src, int dest_length, int *cursor)
 void
 display_clear(GCDisplay *display)
 {
-    v->error = 0;
     display_set_string(display, "", -1);
 }
 
@@ -166,11 +162,11 @@ gboolean display_get_integer(GCDisplay *display, gint64 *value)
 
     text = display_get_text(display);
     if (display_is_result(display)) {
-        display_make_number(display, buf, MAX_DISPLAY, display_get_answer(display), v->base, FALSE);
+        display_make_number(display, buf, MAX_DISPLAY, display_get_answer(display));
         text = buf;
     }
-    
-    *value = g_ascii_strtoll(text, &endptr, v->base);
+
+    *value = g_ascii_strtoll(text, &endptr, 10);
     if(*endptr != '\0' || ((*value == G_MAXINT64 || *value == G_MININT64) && errno == ERANGE))
         return FALSE;
     return TRUE;
@@ -182,11 +178,10 @@ gboolean display_get_unsigned_integer(GCDisplay *display, guint64 *value)
     const char *text;
     char buf[MAX_DISPLAY];
     gchar *endptr;
-    guint bases[] = {2, 8, 10, 16};
 
     text = display_get_text(display);
     if (display_is_result(display)) {
-        display_make_number(display, buf, MAX_DISPLAY, display_get_answer(display), v->base, FALSE);
+        display_make_number(display, buf, MAX_DISPLAY, display_get_answer(display));
         text = buf;
     }
     
@@ -194,7 +189,7 @@ gboolean display_get_unsigned_integer(GCDisplay *display, guint64 *value)
     if(strncmp(text, "-", strlen("-")) == 0 || strncmp(text, "â??", strlen("â??")) == 0)
         return FALSE;
 
-    *value = g_ascii_strtoull(text, &endptr, bases[v->base]);
+    *value = g_ascii_strtoull(text, &endptr, 10);
     if(*endptr != '\0' || (*value == G_MAXUINT64 && errno == ERANGE))
         return FALSE;
     return TRUE;
@@ -214,11 +209,12 @@ display_get_cursor(GCDisplay *display)
 }
 
 
+// FIXME: Looses accuracy
 void
-display_set_number(GCDisplay *display, const MPNumber *MPval)
+display_set_number(GCDisplay *display, const MPNumber *x)
 {
    char text[MAX_DISPLAY];
-   display_make_number(display, text, MAX_DISPLAY, MPval, v->base, FALSE);
+   display_make_number(display, text, MAX_DISPLAY, x);
    display_set_string(display, text, -1);
 }
 
@@ -241,13 +237,13 @@ display_make_text(GCDisplay *display, char *localized, int length, int *cursor)
     /* Substitute answer register */
     if (display_is_result(display)) {
         char temp[MAX_LOCALIZED];
-        display_make_number(display, temp, MAX_LOCALIZED, &e->ans, v->base, TRUE);
+        display_make_number(display, temp, MAX_LOCALIZED, &e->ans);
         str = strdup(temp);
     }
     else
         str = strdup(e->expression);
 
-    localize_expression(localized, str, length, cursor);
+    localize_expression(display, localized, str, length, cursor);
     free(str);
 }
 
@@ -295,7 +291,7 @@ display_set_cursor(GCDisplay *display, int cursor)
 void
 display_set_error(GCDisplay *display, const char *message)
 {
-    ui_set_statusbar(message, "gtk-dialog-error");
+    ui_set_statusbar(message);
 }
 
 
@@ -373,9 +369,9 @@ void display_pop(GCDisplay *display)
 {
     if (display->h.current != display->h.begin) {
         display->h.current = ((display->h.current - 1) % UNDO_HISTORY_LENGTH);
-        ui_set_statusbar("", "");
+        ui_set_statusbar("");
     } else {
-        ui_set_statusbar(_("No undo history"), "gtk-dialog-warning");
+        ui_set_statusbar(_("No undo history"));
     }
     update_undo_redo_button_sensitivity(display);
     
@@ -388,9 +384,9 @@ display_unpop(GCDisplay *display)
 {
     if (display->h.current != display->h.end) {
         display->h.current = ((display->h.current + 1) % UNDO_HISTORY_LENGTH);
-        ui_set_statusbar("", "");
+        ui_set_statusbar("");
     } else {
-        ui_set_statusbar(_("No redo steps"), "gtk-dialog-warning");
+        ui_set_statusbar(_("No redo steps"));
     }
     update_undo_redo_button_sensitivity(display);
     get_state(display)->cursor = -1;
@@ -462,7 +458,7 @@ void
 display_insert_number(GCDisplay *display, int cursor_start, int cursor_end, const MPNumber *value)
 {
     char text[MAX_DISPLAY];
-    display_make_number(display, text, MAX_DISPLAY, value, v->base, FALSE);
+    display_make_number(display, text, MAX_DISPLAY, value);
     display_insert(display, cursor_start, cursor_end, text);
 }
 
@@ -487,7 +483,7 @@ display_backspace(GCDisplay *display, int cursor_start, int cursor_end)
         len = g_utf8_strlen(ui_get_display(), -1);
         
         if (display_is_result(display)) {
-            display_make_number(display, buf, MAX_DISPLAY, &e->ans, v->base, FALSE);
+            display_make_number(display, buf, MAX_DISPLAY, &e->ans);
             e->expression = str_replace(e->expression, "ans", buf);
         }
 
@@ -560,22 +556,10 @@ display_init(GCDisplay *display)
    
     memset(display, 0, sizeof(GCDisplay));
    
-    display->base = 10;
-
-    if (get_boolean_resource(R_ZEROES, &i))
-        display->show_zeroes = i;
-    else
-        display->show_zeroes = FALSE;         
-
-    if (get_boolean_resource(R_TSEP, &i))
-        display->show_tsep = i;
-    else
-        display->show_tsep = FALSE;
-
-    if (get_enumerated_resource(R_DISPLAY, display_types, &i))
-       display->format = (DisplayFormat) i;
-    else
-       display->format = FIX;
+    display->show_zeroes = FALSE;         
+    display->show_tsep = FALSE;
+    display->format = DEC;
+    display->accuracy = 9;
 
     for (i = 0; i < UNDO_HISTORY_LENGTH; i++)
         display->h.e[i].expression = strdup("");
@@ -584,7 +568,7 @@ display_init(GCDisplay *display)
 
 void display_set_accuracy(GCDisplay *display, int accuracy)
 {
-    set_int_resource(R_ACCURACY, accuracy);
+    display->accuracy = accuracy;
     get_state(display)->cursor = -1;
     display_refresh(display);   
 }
@@ -593,7 +577,6 @@ void display_set_accuracy(GCDisplay *display, int accuracy)
 void display_set_show_thousands_separator(GCDisplay *display, gboolean visible)
 {
     display->show_tsep = visible;
-    set_boolean_resource(R_TSEP, visible);
     display_set_cursor(display, -1);
     display_refresh(display);
 }
@@ -602,15 +585,6 @@ void display_set_show_thousands_separator(GCDisplay *display, gboolean visible)
 void display_set_show_trailing_zeroes(GCDisplay *display, gboolean visible)
 {
     display->show_zeroes = visible;
-    set_boolean_resource(R_ZEROES, visible);
-    get_state(display)->cursor = -1;
-    display_refresh(display);
-}
-
-
-void display_set_base(GCDisplay *display, int base)
-{
-    display->base = base;
     get_state(display)->cursor = -1;
     display_refresh(display);
 }
@@ -618,8 +592,7 @@ void display_set_base(GCDisplay *display, int base)
 
 void display_set_format(GCDisplay *display, DisplayFormat type)
 {
-    v->display.format = type;
-    set_enumerated_resource(R_DISPLAY, display_types, (int) type);
+    display->format = type;
     get_state(display)->cursor = -1;
     display_refresh(display);
 }
@@ -674,7 +647,7 @@ make_eng_sci(GCDisplay *display, char *target, int target_len, const MPNumber *x
         }
     }
  
-    mp_cast_to_string(&mantissa, base_, v->accuracy, !v->display.show_zeroes, fixed, MAX_DIGITS);
+    mp_cast_to_string(&mantissa, base_, display->accuracy, !display->show_zeroes, fixed, MAX_DIGITS);
     g_string_append(string, fixed);
     g_string_append(string, "Ã?10^");
  
@@ -706,51 +679,28 @@ make_eng_sci(GCDisplay *display, char *target, int target_len, const MPNumber *x
 }
 
 
-/* Convert MP number to character string in the given base. */
+/* Convert MP number to character string. */
 void
-display_make_number(GCDisplay *display, char *target, int target_len, const MPNumber *x, int base, int ignoreError)
+display_make_number(GCDisplay *display, char *target, int target_len, const MPNumber *x)
 {
-    double val, max_fix;
-    
-    /*  NOTE: display_make_number can currently set v->error when converting to a double.
-     *        This is to provide the same look&feel as V3 even though gcalctool
-     *        now does internal arithmetic to "infinite" precision.
-     *
-     *  XXX:  Needs to be improved. Shouldn't need to convert to a double in
-     *        order to do these tests.
-     */
-
-    double number = mp_cast_to_double(x);
-    
-    val = fabs(number);
-    if (v->error && !ignoreError) {
-        target[0] = '\0';
-        return;
-    }
-
-    switch (base)
-    {
-    case 2:
-        max_fix = 1.298074214e+33;
+    switch(display->format) {
+    case DEC:
+        mp_cast_to_string(x, 10, display->accuracy, !display->show_zeroes, target, target_len);
         break;
-    case 8:
-        max_fix = 2.037035976e+90;
+    case BIN:
+        mp_cast_to_string(x, 2, display->accuracy, !display->show_zeroes, target, target_len);
         break;
-    case 10:
-        max_fix = 1.000000000e+100;
+    case OCT:
+        mp_cast_to_string(x, 8, display->accuracy, !display->show_zeroes, target, target_len);
         break;
-    default:
-    case 16:
-        max_fix = 2.582249878e+120;
+    case HEX:
+        mp_cast_to_string(x, 16, display->accuracy, !display->show_zeroes, target, target_len);
+        break;
+    case SCI:
+        make_eng_sci(display, target, target_len, x, 10);
+        break;
+    case ENG:
+        make_eng_sci(display, target, target_len, x, 10);
         break;
-    }
-
-    // FIXME: Do this based on the number of digits, not actual values
-    if ((display->format == ENG) ||
-        (display->format == SCI) ||
-        (display->format == FIX && val != 0.0 && (val > max_fix))) {
-        make_eng_sci(display, target, target_len, x, base);
-    } else {
-        mp_cast_to_string(x, base, v->accuracy, !v->display.show_zeroes, target, target_len);
     }
 }
diff --git a/src/display.h b/src/display.h
index c0a5c8e..3173a23 100644
--- a/src/display.h
+++ b/src/display.h
@@ -45,7 +45,7 @@ typedef struct {
 } GCDisplayHistory;
 
 /* Number display mode. */
-typedef enum { ENG, FIX, SCI, MAXDISPMODES } DisplayFormat;
+typedef enum { DEC, BIN, OCT, HEX, SCI, ENG } DisplayFormat;
 
 typedef struct
 {
@@ -53,7 +53,7 @@ typedef struct
     int show_tsep;         /* Set if the thousands separator should be shown. */
     int show_zeroes;       /* Set if trailing zeroes should be shown. */
     DisplayFormat format;  /* Number display mode. */
-    int base;
+    int accuracy;          /* Number of digits to show */
 } GCDisplay;
 
 void display_init(GCDisplay *);
@@ -93,6 +93,6 @@ gboolean display_is_usable_number(GCDisplay *display, MPNumber *);
 
 const char *display_get_text(GCDisplay *display);
 
-void display_make_number(GCDisplay *display, char *target, int target_len, const MPNumber *MPnumber, int base, int ignoreError);
+void display_make_number(GCDisplay *display, char *target, int target_len, const MPNumber *x);
 
 #endif /* DISPLAY_H */
diff --git a/src/functions.c b/src/functions.c
index c18200a..f8d417d 100644
--- a/src/functions.c
+++ b/src/functions.c
@@ -36,37 +36,6 @@
 #include "mp-equation.h"
 #include "ui.h"
 
-typedef enum {
-    NUMBER       = (1 << 0),   /* Number button */
-    FUNC         = (1 << 1),   /* Function */
-} ButtonFlags;
-
-typedef struct {
-    int id;
-    char *symname;           /* Expression function name */
-    ButtonFlags flags; /* Misc flags */
-} Function;
-
-// FIXME: Sort this list
-/* Note that none of these strings can be translated as the parser expects them to be correct */
-/* id, symname flags */
-static Function functions[NFUNCTIONS] = {
-{ FN_TEXT,              NULL, 0 },
-{ FN_CALCULATE,         NULL, 0 },
-{ FN_CLEAR,             NULL, 0 },
-{ FN_BACKSPACE,         NULL, 0 },
-{ FN_DELETE,            NULL, 0 },
-{ FN_TOGGLE_BIT,        NULL, 0 },
-{ FN_SHIFT,             NULL, 0 },
-{ FN_STORE,             NULL, 0 },
-{ FN_RECALL,            NULL, 0 },
-{ FN_UNDO,              NULL, 0 },
-{ FN_REDO,              NULL, 0 },
-{ FN_PASTE,             NULL, 0 },
-{ FN_INSERT_CHARACTER,  NULL, 0 }
-};
-
-
 static int
 get_variable(const char *name, MPNumber *z, void *data)
 {
@@ -104,8 +73,8 @@ parse(const char *text, MPNumber *z)
     MPEquationOptions options;
 
     memset(&options, 0, sizeof(options));
-    options.wordlen = v->wordlen;
-    options.angle_units = v->ttype;
+    options.wordlen = 32; // FIXME: v->wordlen;
+    options.angle_units = MP_DEGREES; // FIXME v->ttype;
     options.get_variable = get_variable;
     options.set_variable = set_variable;
 
@@ -192,11 +161,10 @@ do_shift(int count)
 {
     MPNumber z;
 
-    if (!display_is_usable_number(&v->display, &z) || !mp_is_integer(&z)) {
+    if (!display_is_usable_number(&v->display, &z)) {
         /* Translators: This message is displayed in the status bar when a bit
            shift operation is performed and the display does not contain a number */
-        ui_set_statusbar(_("No sane value to do bitwise shift"),
-                         "gtk-dialog-error");
+        ui_set_statusbar(_("No sane value to do bitwise shift"));
     }
     else {
         mp_shift(&z, count, display_get_answer(&v->display));
@@ -211,8 +179,7 @@ do_sto(int index)
     MPNumber temp;
     
     if (!display_is_usable_number(&v->display, &temp))
-        ui_set_statusbar(_("No sane value to store"),
-                         "gtk-dialog-error");
+        ui_set_statusbar(_("No sane value to store"));
     else
         register_set_value(index, &temp);
 }
@@ -226,7 +193,7 @@ do_expression(int function, int arg, int cursor_start, int cursor_end)
     int enabled;
     guint64 bit_value;
     
-    switch (functions[function].id) {
+    switch (function) {
         case FN_UNDO:
             display_pop(&v->display);
             return;
@@ -244,19 +211,11 @@ do_expression(int function, int arg, int cursor_start, int cursor_end)
     display_set_cursor(&v->display, cursor_start);
     ans = display_get_answer(&v->display);
 
-    ui_set_statusbar("", "");
-
-    /* Starting a number after a calculation clears the display */
-    if (display_is_result(&v->display)) {
-        if (functions[function].flags & NUMBER) {
-            display_clear(&v->display);
-        }
-    }
+    ui_set_statusbar("");
 
-    switch (functions[function].id) {
+    switch (function) {
         case FN_CLEAR:
             display_clear(&v->display);
-            ui_set_error_state(FALSE);
             mp_set_from_string("0", ans);
             break;
 
@@ -375,7 +334,7 @@ do_expression(int function, int arg, int cursor_start, int cursor_end)
                         break;
                 }
                 if (message)
-                    ui_set_statusbar(message, "gtk-dialog-error");
+                    ui_set_statusbar(message);
             }
             break;
 
diff --git a/src/gtk.c b/src/gtk.c
index 1eaa182..0a523fe 100644
--- a/src/gtk.c
+++ b/src/gtk.c
@@ -461,9 +461,8 @@ ui_set_mode(ModeType mode)
 
 
 void 
-ui_set_statusbar(const gchar *text, const gchar *imagename)
+ui_set_statusbar(const gchar *text)
 {
-    //gtk_image_set_from_stock(image, imagename, GTK_ICON_SIZE_BUTTON);    
     gtk_text_buffer_set_text(X.info_buffer, text, -1);
 }
 
@@ -526,41 +525,6 @@ ui_set_display(char *str, int cursor)
 }
 
 
-/* When an error condition occurs:
- *
- * - make insensitive all buttons except Clr.
- * - make all Scientific mode toggles and checkboxes insensitive.
- * - make all menubar items insensitive except:
- *     Calculator->Quit
- *     Help->Contents
- *
- * When the error condition is cleared, resensitise everything, setting
- * the numeric base buttons correctly.
- */
-void
-ui_set_error_state(gboolean error)
-{
-    v->error = error;
-
-    gtk_widget_set_sensitive(GET_WIDGET("copy_menu"),            !v->error);
-    gtk_widget_set_sensitive(GET_WIDGET("paste_menu"),           !v->error); 
-//    gtk_widget_set_sensitive(GET_WIDGET("undo_menu"),            !v->error);
-//    gtk_widget_set_sensitive(GET_WIDGET("redo_menu"),            !v->error);
-    gtk_widget_set_sensitive(GET_WIDGET("view_basic_menu"),      !v->error); 
-    gtk_widget_set_sensitive(GET_WIDGET("view_advanced_menu"),   !v->error); 
-    gtk_widget_set_sensitive(GET_WIDGET("view_financial_menu"),  !v->error); 
-    gtk_widget_set_sensitive(GET_WIDGET("view_scientific_menu"), !v->error);
-    gtk_widget_set_sensitive(GET_WIDGET("about_menu"), !v->error);
-}
-
-
-void
-ui_beep()
-{
-    gdk_beep();
-}
-
-
 G_MODULE_EXPORT
 void
 about_cb(GtkWidget *widget)
@@ -818,7 +782,7 @@ update_memory_menus()
         /* Translators: R is the short form of register used inter alia in popup menus */        
         register_prefix = _("R");
         
-        display_make_number(&v->display, value, MAXLINE, register_get_value(i), v->base, TRUE);
+        display_make_number(&v->display, value, MAXLINE, register_get_value(i));
         if (name[0] != '\0')
             SNPRINTF(mstr, MAXLINE, "<span weight=\"bold\">%s_%d:</span>    %s [%s]", register_prefix, i, value, name);
         else
diff --git a/src/mp-binary.c b/src/mp-binary.c
index bf5cbc4..5992d38 100644
--- a/src/mp-binary.c
+++ b/src/mp-binary.c
@@ -125,6 +125,11 @@ mp_shift(const MPNumber *x, int count, MPNumber *z)
 {
     int i, multiplier = 1;
     
+    if (!mp_is_integer(x)) {
+        mperr(_("Shift only possible on integer values"));
+        return;
+    }
+    
     if (count >= 0) {
         for (i = 0; i < count; i++)
             multiplier *= 2;
diff --git a/src/ui.h b/src/ui.h
index 9efbd79..6c624dd 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -35,11 +35,8 @@ void ui_set_undo_enabled(gboolean, gboolean);
 
 void ui_set_display(char *, int);
 void ui_set_bitfield(int enabled, guint64 bits);
-gchar *ui_get_display(void);
-
-void ui_set_error_state(gboolean);
-void ui_set_statusbar(const gchar *, const gchar *);
+void ui_set_statusbar(const gchar *);
 
-void ui_beep(void);
+gchar *ui_get_display(void);
 
 #endif /* UI_H */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]