gcalctool r2304 - trunk/gcalctool
- From: rancell svn gnome org
- To: svn-commits-list gnome org
- Subject: gcalctool r2304 - trunk/gcalctool
- Date: Sat, 15 Nov 2008 04:52:52 +0000 (UTC)
Author: rancell
Date: Sat Nov 15 04:52:51 2008
New Revision: 2304
URL: http://svn.gnome.org/viewvc/gcalctool?rev=2304&view=rev
Log:
Move register storage out of global structure
Modified:
trunk/gcalctool/calctool.h
trunk/gcalctool/register.c
Modified: trunk/gcalctool/calctool.h
==============================================================================
--- trunk/gcalctool/calctool.h (original)
+++ trunk/gcalctool/calctool.h Sat Nov 15 04:52:51 2008
@@ -187,16 +187,8 @@
const char *tsep; /* Locale specific thousands separator. */
int tsep_count; /* Number of digits between separator. */
- char constant_names[MAX_CONSTANTS][MAXLINE]; /* Selectable constant names. */
- int constant_values[MAX_CONSTANTS][MP_SIZE]; /* Selectable constants. */
-
- char function_names[MAX_FUNCTIONS][MAXLINE]; /* Function names from .gcalctoolcf. */
- char function_values[MAX_FUNCTIONS][MAXLINE]; /* Function defs from .gcalctoolcf. */
-
int MPdisp_val[MP_SIZE]; /* Value of the current display. */
- int registers[MAX_REGISTERS][MP_SIZE]; /* Memory register values. */
-
enum base_type base; /* Current base: BIN, OCT, DEC or HEX. */
enum mode_type modetype; /* Current calculator mode. */
enum num_type dtype; /* Number display mode. */
Modified: trunk/gcalctool/register.c
==============================================================================
--- trunk/gcalctool/register.c (original)
+++ trunk/gcalctool/register.c Sat Nov 15 04:52:51 2008
@@ -21,9 +21,16 @@
#include "register.h"
#include "get.h"
-#include "calctool.h"
#include "mpmath.h"
+static char constant_names[MAX_CONSTANTS][MAXLINE]; /* Selectable constant names. */
+static int constant_values[MAX_CONSTANTS][MP_SIZE]; /* Selectable constants. */
+
+static char function_names[MAX_FUNCTIONS][MAXLINE]; /* Function names from .gcalctoolcf. */
+static char function_values[MAX_FUNCTIONS][MAXLINE]; /* Function defs from .gcalctoolcf. */
+
+static int registers[MAX_REGISTERS][MP_SIZE]; /* Memory register values. */
+
static const char *default_constants[][2] =
{
/* Translators: This is the label for the default constant, the number of miles in one kilometer (0.621) */
@@ -52,7 +59,7 @@
{
int i;
for (i = 0; i < MAX_REGISTERS; i++) {
- mp_set_from_integer(0, v->registers[i]);
+ mp_set_from_integer(0, registers[i]);
}
for (i = 0; i < MAX_CONSTANTS; i++) {
@@ -110,7 +117,7 @@
register_set(int index, int value[MP_SIZE])
{
if ((index >= 0) && (index <= 10))
- mp_set_from_mp(value, v->registers[index]);
+ mp_set_from_mp(value, registers[index]);
}
@@ -118,7 +125,7 @@
register_get(int index, int value[MP_SIZE])
{
if ((index >= 0) && (index <= 10))
- mp_set_from_mp(v->registers[index], value);
+ mp_set_from_mp(registers[index], value);
}
@@ -126,8 +133,8 @@
{
char key[MAXLINE], temp[MAXLINE];
- STRNCPY(v->constant_names[index], name, MAXLINE - 1);
- mp_set_from_mp(value, v->constant_values[index]);
+ STRNCPY(constant_names[index], name, MAXLINE - 1);
+ mp_set_from_mp(value, constant_values[index]);
SNPRINTF(key, MAXLINE, "constant%1dname", index);
set_resource(key, name);
@@ -142,13 +149,13 @@
const char *constant_get_name(int index)
{
- return v->constant_names[index];
+ return constant_names[index];
}
const int *constant_get_value(int index)
{
- return v->constant_values[index];
+ return constant_values[index];
}
@@ -156,8 +163,8 @@
{
char key[MAXLINE];
- STRNCPY(v->function_names[index], name, MAXLINE - 1);
- STRNCPY(v->function_values[index], value, MAXLINE - 1);
+ STRNCPY(function_names[index], name, MAXLINE - 1);
+ STRNCPY(function_values[index], value, MAXLINE - 1);
SNPRINTF(key, MAXLINE, "function%1dname", index);
set_resource(key, name);
@@ -168,11 +175,11 @@
const char *function_get_name(int index)
{
- return v->function_names[index];
+ return function_names[index];
}
const char *function_get_value(int index)
{
- return v->function_values[index];
+ return function_values[index];
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]