? buildit.ksh
? env.sh
Index: gcalctool/calctool.h
===================================================================
RCS file: /cvs/gnome/gcalctool/gcalctool/calctool.h,v
retrieving revision 1.43
diff -u -r1.43 calctool.h
--- gcalctool/calctool.h	26 Nov 2003 20:29:52 -0000	1.43
+++ gcalctool/calctool.h	3 Dec 2003 22:12:02 -0000
@@ -330,6 +330,7 @@
 int key_equal(struct button *, struct button);
 int main(int, char **);
 
+void add_tsep();
 void beep();
 void clear_display(int);
 void display_prop_sheet();
Index: gcalctool/display.c
===================================================================
RCS file: /cvs/gnome/gcalctool/gcalctool/display.c,v
retrieving revision 1.33
diff -u -r1.33 display.c
--- gcalctool/display.c	26 Nov 2003 20:29:52 -0000	1.33
+++ gcalctool/display.c	3 Dec 2003 22:12:02 -0000
@@ -28,6 +28,68 @@
 static char *make_fixed(int *, int, int);
 
 
+/* Add in the thousand separators characters if required and if we are
+ * currently in the decimal numeric base.
+ */
+
+void
+add_tsep()
+{
+    if (v->show_tsep && v->base == DEC) {
+	char *dstp, *radixp, *srcp;
+	int n;
+
+	/* Process the fractional part (if any). */
+	srcp = v->fnum + strlen(v->fnum) - 1;
+	dstp = v->tnum;
+	if ((radixp = strchr(v->fnum, v->radix_char)) != NULL) {
+            while (*srcp != v->radix_char) {
+    		*dstp++ = *srcp--;
+            }
+            *dstp++ = *srcp--;	   /* Copy over the radix char. */
+    	}
+
+    	/* Process the integer part, add in thousand separators. */
+    	n = 0;
+    	while (srcp >= v->fnum) {
+            *dstp++ = *srcp--;
+            n++;
+            if (n == 3 && srcp >= v->fnum) {
+		*dstp++ = ',';
+		n = 0;
+            }
+	}
+	*dstp++ = '\0';
+
+	/* Move from scratch pad to fnum, reversing the character order. */
+	srcp = v->tnum + strlen(v->tnum) - 1;
+	dstp = v->fnum;
+	while (srcp >= v->tnum) {
+            *dstp++ = *srcp--;
+	}
+	*dstp++ = '\0';
+    }
+}
+
+
+/* Remove the thousands separators (if any) in-situ. */
+
+void
+remove_tsep(char *str) {
+    char *srcp = str;
+    char *dstp = str;
+
+    while (*srcp != '\0') {
+        if (*srcp == ',') {
+            srcp++;
+            continue;
+        }
+        *dstp++ = *srcp++;
+    }
+    *dstp++ = '\0';
+}
+
+
 int
 char_val(char chr)
 {
@@ -174,44 +236,7 @@
         *optr = '\0';
     }
 
-/* Add in the thousand separators characters if required and if we are
- * currently in the decimal numeric base.
- */
-
-    if (v->show_tsep && v->base == DEC) {
-        char *dstp, *radixp, *srcp;
-        int n;
-
-        /* Process the fractional part (if any). */
-        srcp = v->fnum + strlen(v->fnum) - 1;
-        dstp = v->tnum;
-        if ((radixp = strchr(v->fnum, v->radix_char)) != NULL) {
-            while (*srcp != v->radix_char) {
-                *dstp++ = *srcp--;
-            }
-            *dstp++ = *srcp--;     /* Copy over the radix char. */
-        }
-
-        /* Process the integer part, add in thousand separators. */
-        n = 0;
-        while (srcp >= v->fnum) {
-            *dstp++ = *srcp--;
-            n++;
-            if (n == 3 && srcp >= v->fnum) {
-                *dstp++ = ',';
-                n = 0;
-            }
-        }
-        *dstp++ = '\0';
-
-        /* Move from scratch pad to fnum, reversing the character order. */
-        srcp = v->tnum + strlen(v->tnum) - 1;
-	dstp = v->fnum;
-        while (srcp >= v->tnum) {
-            *dstp++ = *srcp--;
-        }
-        *dstp++ = '\0';
-    }
+    add_tsep();
 
     return(v->fnum);
 }
@@ -368,6 +393,9 @@
     i = 0;
     mpcim(&i, MPval);
     mpcim(&basevals[(int) base], MPbase);
+
+    remove_tsep(str);
+
     optr = str;
     while ((inum = char_val(*optr)) >= 0) {
         mpmul(MPval, MPbase, MPval);
Index: gcalctool/functions.c
===================================================================
RCS file: /cvs/gnome/gcalctool/gcalctool/functions.c,v
retrieving revision 1.30
diff -u -r1.30 functions.c
--- gcalctool/functions.c	26 Nov 2003 17:34:54 -0000	1.30
+++ gcalctool/functions.c	3 Dec 2003 22:12:02 -0000
@@ -407,6 +407,12 @@
 
     set_display(v->display);
     MPstr_to_num(v->display, v->base, v->MPdisp_val);
+
+    if (v->dtype == FIX) {
+        STRCPY(v->fnum, v->display);
+        add_tsep();
+        set_display(v->fnum);
+    }
 }
 
 
Index: gcalctool/gtk.c
===================================================================
RCS file: /cvs/gnome/gcalctool/gcalctool/gtk.c,v
retrieving revision 1.106
diff -u -r1.106 gtk.c
--- gcalctool/gtk.c	26 Nov 2003 20:29:52 -0000	1.106
+++ gcalctool/gtk.c	3 Dec 2003 22:12:02 -0000
@@ -466,6 +466,12 @@
     } else {
         process_item(n);
     }
+
+    if (v->new_input && v->dtype == FIX) {
+        STRCPY(v->fnum, v->display);
+        add_tsep();
+        set_display(v->fnum);
+    }
 }
 
 
