gcalctool r2299 - trunk/gcalctool
- From: rancell svn gnome org
- To: svn-commits-list gnome org
- Subject: gcalctool r2299 - trunk/gcalctool
- Date: Sun, 9 Nov 2008 12:42:46 +0000 (UTC)
Author: rancell
Date: Sun Nov 9 12:42:45 2008
New Revision: 2299
URL: http://svn.gnome.org/viewvc/gcalctool?rev=2299&view=rev
Log:
Refactoring code
Modified:
trunk/gcalctool/calctool.c
trunk/gcalctool/calctool.h
trunk/gcalctool/ce_parser.c
trunk/gcalctool/ce_parser.h
trunk/gcalctool/ce_parser.y
trunk/gcalctool/display.c
trunk/gcalctool/functions.c
trunk/gcalctool/get.c
trunk/gcalctool/get.h
trunk/gcalctool/gtk.c
trunk/gcalctool/mp-convert.c
trunk/gcalctool/mp.c
trunk/gcalctool/mp.h
trunk/gcalctool/mpmath.c
trunk/gcalctool/mpmath.h
trunk/gcalctool/register.c
trunk/gcalctool/register.h
Modified: trunk/gcalctool/calctool.c
==============================================================================
--- trunk/gcalctool/calctool.c (original)
+++ trunk/gcalctool/calctool.c Sun Nov 9 12:42:45 2008
@@ -42,447 +42,96 @@
// FIXME: Sort this list
/* Note that none of these strings can be translated as the parser expects them to be correct */
+/* id, symname flags */
struct button buttons[NKEYS] = {
-
-/* id,
- symname
- func
- flags
- */
-
-{
- KEY_0,
- "0",
- NUMBER
-},
-{
- KEY_1,
- "1",
- NUMBER
-},
-{
- KEY_2,
- "2",
- NUMBER
-},
-{
- KEY_3,
- "3",
- NUMBER
-},
-{
- KEY_4,
- "4",
- NUMBER
-},
-{
- KEY_5,
- "5",
- NUMBER
-},
-{
- KEY_6,
- "6",
- NUMBER
-},
-{
- KEY_7,
- "7",
- NUMBER
-},
-{
- KEY_8,
- "8",
- NUMBER
-},
-{
- KEY_9,
- "9",
- NUMBER
-},
-{
- KEY_A,
- "A",
- NUMBER
-},
-{
- KEY_B,
- "B",
- NUMBER
-},
-{
- KEY_C,
- "C",
- NUMBER
-},
-{
- KEY_D,
- "D",
- NUMBER
-},
-{
- KEY_E,
- "E",
- NUMBER
-},
-{
- KEY_F,
- "F",
- NUMBER
-},
-{
- KEY_NUMERIC_POINT,
- ".",
- NUMBER
-},
-{
- KEY_CALCULATE,
- NULL,
- 0
-},
-{
- KEY_CLEAR,
- NULL,
- 0
-},
-{
- KEY_CLEAR_ENTRY,
- NULL,
- 0
-},
-{
- KEY_START_BLOCK,
- "(",
- 0
-},
-{
- KEY_END_BLOCK,
- ")",
- 0
-},
-{
- KEY_ADD,
- "+",
- 0
-},
-{
- KEY_SUBTRACT,
- "-",
- 0
-},
-{
- KEY_MULTIPLY,
- "*",
- 0
-},
-{
- KEY_DIVIDE,
- "/",
- 0
-},
-{
- KEY_BACKSPACE,
- NULL,
- 0
-},
-{
- KEY_DELETE,
- NULL,
- 0
-},
-{
- KEY_CHANGE_SIGN,
- NULL,
- 0
-},
-{
- KEY_INTEGER,
- "Int",
- FUNC
-},
-{
- KEY_FRACTION,
- "Frac",
- FUNC
-},
-{
- KEY_PERCENTAGE,
- "%",
- 0
-},
-{
- KEY_SQUARE,
- "^2",
- POSTFIXOP
-},
-{
- KEY_SQUARE_ROOT,
- "Sqrt",
- FUNC
-},
-{
- KEY_RECIPROCAL,
- NULL,
- 0
-},
-{
- KEY_E_POW_X,
- "e^",
- PREFIXOP
-},
-{
- KEY_10_POW_X,
- "10^",
- PREFIXOP
-},
-{
- KEY_X_POW_Y,
- "^",
- POSTFIXOP
-},
-{
- KEY_FACTORIAL,
- "!",
- POSTFIXOP
-},
-{
- KEY_RANDOM,
- "Rand",
- 0
-},
-{
- KEY_SIN,
- "Sin",
- FUNC
-},
-{
- KEY_SINH,
- "Sinh",
- FUNC
-},
-{
- KEY_ASIN,
- "Asin",
- FUNC
-},
-{
- KEY_ASINH,
- "Asinh",
- FUNC
-},
-{
- KEY_COS,
- "Cos",
- FUNC
-},
-{
- KEY_COSH,
- "Cosh",
- FUNC
-},
-{
- KEY_ACOS,
- "Acos",
- FUNC
-},
-{
- KEY_ACOSH,
- "Acosh",
- FUNC
-},
-{
- KEY_TAN,
- "Tan",
- FUNC
-},
-{
- KEY_TANH,
- "Tanh",
- FUNC
-},
-{
- KEY_ATAN,
- "Atan",
- FUNC
-},
-{
- KEY_TAN,
- "Atanh",
- FUNC
-},
-{
- KEY_NATURAL_LOGARITHM,
- "Ln",
- FUNC
-},
-{
- KEY_LOGARITHM,
- "Log",
- FUNC
-},
-{
- KEY_LOGARITHM2,
- "Log2",
- FUNC
-},
-{
- KEY_ABSOLUTE_VALUE,
- "Abs",
- FUNC
-},
-{
- KEY_MASK_16,
- "u16",
- FUNC
-},
-{
- KEY_MASK_32,
- "u32",
- FUNC
-},
-{
- KEY_MODULUS_DIVIDE,
- " Mod ",
- 0
-},
-{
- KEY_EXPONENTIAL,
- "e",
- 0
-},
-{
- KEY_NOT,
- "~",
- 0
-},
-{
- KEY_OR,
- " OR ",
- 0
-},
-{
- KEY_AND,
- " AND ",
- 0
-},
-{
- KEY_XOR,
- " XOR ",
- 0
-},
-{
- KEY_XNOR,
- " XNOR ",
- 0
-},
-{
- KEY_FINC_CTRM,
- "Ctrm",
- 0
-},
-{
- KEY_FINC_DDB,
- "Ddb",
- 0
-},
-{
- KEY_FINC_FV,
- "Fv",
- 0
-},
-{
- KEY_FINC_GPM,
- "Gpm",
- 0
-},
-{
- KEY_FINC_PMT,
- "Pmt",
- 0
-},
-{
- KEY_FINC_PV,
- "Pv",
- 0
-},
-{
- KEY_FINC_RATE,
- "Rate",
- 0
-},
-{
- KEY_FINC_SLN,
- "Sln",
- 0
-},
-{
- KEY_FINC_SYD,
- "Syd",
- 0
-},
-{
- KEY_FINC_TERM,
- "Term",
- 0
-},
-{
- KEY_SHIFT,
- NULL,
- 0
-},
-{
- KEY_STORE,
- NULL,
- 0
-},
-{
- KEY_RECALL,
- NULL,
- 0
-},
-{
- KEY_EXCHANGE,
- NULL,
- 0
-},
-{
- KEY_SET_ACCURACY,
- NULL,
- 0
-},
-{
- KEY_SET_BASE,
- NULL,
- 0
-},
-{
- KEY_SET_NUMBERTYPE,
- NULL,
- 0
-},
-{
- KEY_UNDO,
- NULL,
- 0
-},
-{
- KEY_REDO,
- NULL,
- 0
-},
-{
- KEY_CONSTANT,
- NULL,
- 0
-},
-{
- KEY_FUNCTION,
- NULL,
- 0
-},
+{ KEY_0, "0", NUMBER },
+{ KEY_1, "1", NUMBER },
+{ KEY_2, "2", NUMBER },
+{ KEY_3, "3", NUMBER },
+{ KEY_4, "4", NUMBER },
+{ KEY_5, "5", NUMBER },
+{ KEY_6, "6", NUMBER },
+{ KEY_7, "7", NUMBER },
+{ KEY_8, "8", NUMBER },
+{ KEY_9, "9", NUMBER },
+{ KEY_A, "A", NUMBER },
+{ KEY_B, "B", NUMBER },
+{ KEY_C, "C", NUMBER },
+{ KEY_D, "D", NUMBER },
+{ KEY_E, "E", NUMBER },
+{ KEY_F, "F", NUMBER },
+{ KEY_NUMERIC_POINT, ".", NUMBER },
+{ KEY_CALCULATE, NULL, 0 },
+{ KEY_CLEAR, NULL, 0 },
+{ KEY_CLEAR_ENTRY, NULL, 0 },
+{ KEY_START_BLOCK, "(", 0 },
+{ KEY_END_BLOCK, ")", 0 },
+{ KEY_ADD, "+", 0 },
+{ KEY_SUBTRACT, "-", 0 },
+{ KEY_MULTIPLY, "*", 0 },
+{ KEY_DIVIDE, "/", 0 },
+{ KEY_BACKSPACE, NULL, 0 },
+{ KEY_DELETE, NULL, 0 },
+{ KEY_CHANGE_SIGN, NULL, 0 },
+{ KEY_INTEGER, "Int", FUNC },
+{ KEY_FRACTION, "Frac", FUNC },
+{ KEY_PERCENTAGE, "%", 0 },
+{ KEY_SQUARE, "^2", 0 },
+{ KEY_SQUARE_ROOT, "Sqrt", FUNC },
+{ KEY_RECIPROCAL, NULL, 0 },
+{ KEY_E_POW_X, "e^", PREFIXOP },
+{ KEY_10_POW_X, "10^", PREFIXOP },
+{ KEY_X_POW_Y, "^", 0 },
+{ KEY_FACTORIAL, "!", 0 },
+{ KEY_RANDOM, "Rand", 0 },
+{ KEY_SIN, "Sin", FUNC },
+{ KEY_SINH, "Sinh", FUNC },
+{ KEY_ASIN, "Asin", FUNC },
+{ KEY_ASINH, "Asinh", FUNC },
+{ KEY_COS, "Cos", FUNC },
+{ KEY_COSH, "Cosh", FUNC },
+{ KEY_ACOS, "Acos", FUNC },
+{ KEY_ACOSH, "Acosh", FUNC },
+{ KEY_TAN, "Tan", FUNC },
+{ KEY_TANH, "Tanh", FUNC },
+{ KEY_ATAN, "Atan", FUNC },
+{ KEY_TAN, "Atanh", FUNC },
+{ KEY_NATURAL_LOGARITHM, "Ln", FUNC },
+{ KEY_LOGARITHM, "Log", FUNC },
+{ KEY_LOGARITHM2, "Log2", FUNC },
+{ KEY_ABSOLUTE_VALUE, "Abs", FUNC },
+{ KEY_MASK_16, "u16", FUNC },
+{ KEY_MASK_32, "u32", FUNC },
+{ KEY_MODULUS_DIVIDE, " Mod ", 0 },
+{ KEY_EXPONENTIAL, "e", 0 },
+{ KEY_NOT, "~", 0 },
+{ KEY_OR, " OR ", 0 },
+{ KEY_AND, " AND ", 0 },
+{ KEY_XOR, " XOR ", 0 },
+{ KEY_XNOR, " XNOR ", 0 },
+{ KEY_FINC_CTRM, "Ctrm", 0 },
+{ KEY_FINC_DDB, "Ddb", 0 },
+{ KEY_FINC_FV, "Fv", 0 },
+{ KEY_FINC_GPM, "Gpm", 0 },
+{ KEY_FINC_PMT, "Pmt", 0 },
+{ KEY_FINC_PV, "Pv", 0 },
+{ KEY_FINC_RATE, "Rate", 0 },
+{ KEY_FINC_SLN, "Sln", 0 },
+{ KEY_FINC_SYD , "Syd", 0 },
+{ KEY_FINC_TERM, "Term", 0 },
+{ KEY_SHIFT, NULL, 0 },
+{ KEY_STORE, NULL, 0 },
+{ KEY_RECALL, NULL, 0 },
+{ KEY_EXCHANGE, NULL, 0 },
+{ KEY_SET_ACCURACY, NULL, 0 },
+{ KEY_SET_BASE, NULL, 0 },
+{ KEY_SET_NUMBERTYPE, NULL, 0 },
+{ KEY_UNDO, NULL, 0 },
+{ KEY_REDO, NULL, 0 },
+{ KEY_CONSTANT, NULL, 0 },
+{ KEY_FUNCTION, NULL, 0 }
};
-
/* Calctools' customised math library error-handling routine. */
void
@@ -523,8 +172,8 @@
}
-void
-usage(char *progname)
+static void
+usage(const char *progname)
{
/* Translators: This message is displayed on the command line when
help is requested. %1$s and $3$s are replaced with the name
@@ -548,7 +197,7 @@
if (argv[0][0] == '-') {
switch (argv[0][1]) {
case 'E' : /* MP errors to stderr. */
- v->MPerrors = TRUE;
+ mp_set_show_errors(TRUE);
break;
case 'a' :
@@ -585,18 +234,6 @@
static void
-init_constant(int n, const gchar *name, const gchar *value)
-{
- gchar *str = g_strdup(value);
-
- STRNCPY(v->con_names[n], name, MAXLINE - 1);
-
- MPstr_to_num(str, 10, v->MPcon_vals[n]);
- g_free(str);
-}
-
-
-static void
init_state(void)
{
int acc, i, size;
@@ -607,37 +244,11 @@
v->dtype = FIX; /* Initial number display mode. */
v->ttype = DEG; /* Initial trigonometric type. */
v->modetype = BASIC; /* Initial calculator mode. */
- v->MPerrors = FALSE; /* No error information. */
acc = MAX_DIGITS + 12; /* MP internal accuracy. */
size = MP_SIZE;
mpset(acc, size, size);
v->error = 0; /* No calculator error initially. */
-
- /* Translators: This is the label for the default constant, the number of miles in one kilometer (0.621) */
- init_constant(0, _("Kilometer-to-mile conversion factor"), "0.621");
- /* Translators: This is the label for the default constant, the square root of 2 (1.41421) */
- init_constant(1, _("square root of 2"), "1.4142135623");
- /* Translators: This is the label for the default constant, Euler's number (2.71828) */
- init_constant(2, _("Euler's Number (e)"), "2.7182818284");
- /* Translators: This is the label for the default constant, Ï (3.14159) */
- init_constant(3, _("Ï"), "3.1415926536");
- /* Translators: This is the label for the default constant, the number of inches in a centimeter (0.39370) */
- init_constant(4, _("Centimeter-to-inch conversion factor"), "0.3937007");
- /* Translators: This is the label for the default constant, the number of degrees in a radian (57.2958) */
- init_constant(5, _("degrees in a radian"), "57.295779513");
- /* Translators: This is the label for the default constant, 2 to the power of 20 (1048576) */
- init_constant(6, _("2 ^ 20"), "1048576.0");
- /* Translators: This is the label for the default constant, the number of ounces in one gram (0.0353) */
- init_constant(7, _("Gram-to-ounce conversion factor"), "0.0353");
- /* Translators: This is the label for the default constant, the number of British Thermal Units in one Kilojoule (0.948) */
- init_constant(8, _("Kilojoule-to-British-thermal-unit conversion factor"), "0.948");
- /* Translators: This is the label for the default constant, the number of cubic inches in one cubic centimeter (0.0610) */
- init_constant(9, _("Cubic-centimeter-to-cubic-inch conversion factor"), "0.0610");
-
- for (i = 0; i < MAX_REGISTERS; i++) {
- mp_set_from_integer(0, v->MPmvals[i]);
- }
}
@@ -653,11 +264,6 @@
textdomain(GETTEXT_PACKAGE);
v->progname = argv[0]; /* Save programs name. */
- if ((ptr = strrchr(argv[0], '/')) != NULL) {
- v->appname = strdup(ptr+1);
- } else {
- v->appname = strdup(argv[0]);
- }
srand48((long) time((time_t *) 0)); /* Seed random number generator. */
@@ -668,11 +274,13 @@
init_state();
get_options(argc, argv); /* Get command line arguments. */
- ui_init(&argc, &argv); /* Initialise UI */
resources_init(); /* Initialise configuration */
+ register_init();
+ read_resources(); /* Read resources from merged database. */
+
+ ui_init(&argc, &argv); /* Initialise UI */
display_init(&v->display);
- read_resources(); /* Read resources from merged database. */
ui_load();
ui_start(); /* Display the calculator. */
Modified: trunk/gcalctool/calctool.h
==============================================================================
--- trunk/gcalctool/calctool.h (original)
+++ trunk/gcalctool/calctool.h Sun Nov 9 12:42:45 2008
@@ -169,7 +169,6 @@
enum button_flags {
NUMBER = (1 << 3), /* Number button */
FUNC = (1 << 6), /* Function */
- POSTFIXOP = (1 << 14), /* Unary postfix operation */
PREFIXOP = (1 << 15), /* Unary prefix operation */
};
@@ -180,8 +179,6 @@
};
struct calcVars { /* Calctool variables and options. */
- char *appname; /* Application name for resources. */
- char *home; /* Pathname for users home directory. */
char *progname; /* Name of this program. */
GCDisplay display;
@@ -190,20 +187,19 @@
const char *tsep; /* Locale specific thousands separator. */
int tsep_count; /* Number of digits between separator. */
- char fun_names[MAX_FUNCTIONS][MAXLINE]; /* Function names from .gcalctoolcf. */
- char fun_vals[MAX_FUNCTIONS][MAXLINE]; /* Function defs from .gcalctoolcf. */
- char con_names[MAX_CONSTANTS][MAXLINE]; /* Selectable constant names. */
- int MPcon_vals[MAX_CONSTANTS][MP_SIZE]; /* Selectable constants. */
+ 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 MPerrors; /* If set, output errors to stderr. */
int MPdisp_val[MP_SIZE]; /* Value of the current display. */
- int MPlast_input[MP_SIZE]; /* Previous number input by user. */
- int MPmvals[MAX_REGISTERS][MP_SIZE]; /* Memory register values. */
- int MPresult[MP_SIZE]; /* Current calculator total value. */
+
+ 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. */
+ enum num_type dtype; /* Number display mode. */
enum trig_type ttype; /* Trig. type (deg, grad or rad). */
int accuracy; /* Number of digits precision (Max 9). */
Modified: trunk/gcalctool/ce_parser.c
==============================================================================
--- trunk/gcalctool/ce_parser.c (original)
+++ trunk/gcalctool/ce_parser.c Sun Nov 9 12:42:45 2008
@@ -74,7 +74,7 @@
int
-ce_udf_parse(char *expression)
+ce_udf_parse(const char *expression)
{
int dummy[MP_SIZE];
Modified: trunk/gcalctool/ce_parser.h
==============================================================================
--- trunk/gcalctool/ce_parser.h (original)
+++ trunk/gcalctool/ce_parser.h Sun Nov 9 12:42:45 2008
@@ -41,7 +41,7 @@
int ceparse(); /* dummy definition. */
int ceerror(char *s);
int ce_parse(const char *expression, int result[MP_SIZE]);
-int ce_udf_parse(char *expression);
+int ce_udf_parse(const char *expression);
void reset_ce_tokeniser();
Modified: trunk/gcalctool/ce_parser.y
==============================================================================
--- trunk/gcalctool/ce_parser.y (original)
+++ trunk/gcalctool/ce_parser.y Sun Nov 9 12:42:45 2008
@@ -119,11 +119,11 @@
}
| value '=' tSTO '(' tNUMBER ')' {
int val = mp_cast_to_int($5);
- do_sto_reg(val, $1);
+ register_set(val, $1);
}
| value tSTO '(' tNUMBER ')' {
int val = mp_cast_to_int($4);
- do_sto_reg(val, $1);
+ register_set(val, $1);
}
| tCLR {
display_reset(&v->display);
@@ -208,7 +208,7 @@
;
reg:
- tREG {do_rcl_reg($1, $$);}
+ tREG {register_get($1, $$);}
;
func:
@@ -242,7 +242,7 @@
rcl:
tRCL '(' tNUMBER ')' {
int val = mp_cast_to_int($3);
- do_rcl_reg(val, $$);
+ register_get(val, $$);
}
;
Modified: trunk/gcalctool/display.c
==============================================================================
--- trunk/gcalctool/display.c (original)
+++ trunk/gcalctool/display.c Sun Nov 9 12:42:45 2008
@@ -192,9 +192,7 @@
display_reset(GCDisplay *display)
{
v->error = 0; /* Currently no display error. */
- mp_set_from_integer(0, v->MPresult); /* No previous result yet. */
mp_set_from_integer(0, v->MPdisp_val);
- mp_set_from_integer(0, v->MPlast_input);
display_clear(display);
}
@@ -432,7 +430,7 @@
for (i = 0; i < 10; i++) {
SNPRINTF(buf, MAX_DISPLAY, "R%d", i);
if (exp_has_postfix(e->expression, buf)) {
- do_rcl_reg(i, MP_reg);
+ register_get(i, MP_reg);
make_number(buf2, MAX_DISPLAY, MP_reg, v->base, FALSE);
/* Remove "Rx" postfix and replace with backspaced number */
SNPRINTF(buf, MAX_DISPLAY, "%.*s%s", strlen(e->expression) - 2, e->expression - 3, buf2);
@@ -504,7 +502,7 @@
/* Replace registers with values. */
for (i = 0; i < 10; i++) {
SNPRINTF(reg, 3, "R%d", i);
- do_rcl_reg(i, MP_reg);
+ register_get(i, MP_reg);
make_number(xx, MAX_LOCALIZED, MP_reg, v->base, FALSE);
t = str_replace(str, reg, xx);
free(str);
Modified: trunk/gcalctool/functions.c
==============================================================================
--- trunk/gcalctool/functions.c (original)
+++ trunk/gcalctool/functions.c Sun Nov 9 12:42:45 2008
@@ -30,6 +30,7 @@
#include "functions.h"
#include "get.h"
+#include "register.h"
#include "mp.h"
#include "mpmath.h"
#include "display.h"
@@ -61,16 +62,12 @@
static void
do_function(int index) /* Perform a user defined function. */
{
- char *str;
int ret;
assert(index >= 0);
assert(index <= 9);
- str = v->fun_vals[index];
- assert(str);
- ret = ce_udf_parse(str);
-
+ ret = ce_udf_parse(function_get_value(index));
if (!ret) {
ui_set_statusbar("", "");
} else {
@@ -138,8 +135,8 @@
ui_set_statusbar(_("No sane value to store"),
"gtk-dialog-error");
} else {
- mp_set_from_mp(v->MPmvals[index], MPtemp);
- mp_set_from_mp(MPexpr, v->MPmvals[index]);
+ register_get(index, MPtemp);
+ register_set(index, MPexpr);
mp_set_from_mp(MPtemp, display_get_answer(&v->display));
display_set_string(&v->display, "Ans", -1);
display_refresh(&v->display);
@@ -178,10 +175,14 @@
static void
do_sto(int index)
{
- if (display_is_usable_number(&v->display, v->MPmvals[index])) {
+ int temp[MP_SIZE];
+
+ if (display_is_usable_number(&v->display, temp)) {
ui_set_statusbar(_("No sane value to store"),
"gtk-dialog-error");
}
+ else
+ register_set(index, temp);
ui_make_registers();
}
@@ -262,7 +263,7 @@
break;
case KEY_CONSTANT:
- make_number(buf, MAXLINE, v->MPcon_vals[arg], v->base, FALSE);
+ make_number(buf, MAXLINE, constant_get_value(arg), v->base, FALSE);
display_insert(&v->display, buf);
break;
Modified: trunk/gcalctool/get.c
==============================================================================
--- trunk/gcalctool/get.c (original)
+++ trunk/gcalctool/get.c Sun Nov 9 12:42:45 2008
@@ -33,23 +33,24 @@
#include <gconf/gconf-client.h>
#include "get.h"
+#include "register.h"
#include "mpmath.h"
#define EQUAL(a, b) (strlen(a)==strlen(b)) & !strcmp(a, b)
/* Various string values read/written as X resources. */
-char *Rbstr[MAXBASES] = { "BIN", "OCT", "DEC", "HEX" };
-char *Rdstr[MAXDISPMODES] = { "ENG", "FIX", "SCI" };
-char *Rmstr[MAXMODES] = { "BASIC", "ADVANCED", "FINANCIAL",
- "SCIENTIFIC", "PROGRAMMING" };
-char *Rtstr[MAXTRIGMODES] = { "DEG", "GRAD", "RAD" };
+const char *Rbstr[MAXBASES] = { "BIN", "OCT", "DEC", "HEX" };
+const char *Rdstr[MAXDISPMODES] = { "ENG", "FIX", "SCI" };
+const char *Rmstr[MAXMODES] = { "BASIC", "ADVANCED", "FINANCIAL",
+ "SCIENTIFIC", "PROGRAMMING" };
+const char *Rtstr[MAXTRIGMODES] = { "DEG", "GRAD", "RAD" };
static GConfClient *client = NULL;
char *
-get_resource(char *key)
+get_resource(const char *key)
{
char key_name[MAXLINE];
SNPRINTF(key_name, MAXLINE, "/apps/gcalctool/%s", key);
@@ -58,7 +59,7 @@
void
-set_resource(char *key, char *value)
+set_resource(const char *key, const char *value)
{
char key_name[MAXLINE];
SNPRINTF(key_name, MAXLINE, "/apps/gcalctool/%s", key);
@@ -67,7 +68,7 @@
void
-set_int_resource(char *key, int value)
+set_int_resource(const char *key, int value)
{
char intvalue[MAXLINE];
SNPRINTF(intvalue, MAXLINE, "%d", value);
@@ -76,7 +77,7 @@
void
-set_boolean_resource(char *key, int value)
+set_boolean_resource(const char *key, int value)
{
if (value) {
set_resource(key, "true");
@@ -87,7 +88,7 @@
char *
-convert(char *line) /* Convert .gcalctoolcf line to ascii values. */
+convert(const char *line) /* Convert .gcalctoolcf line to ascii values. */
{
static char output[MAXLINE]; /* Converted output record. */
int i; /* Position within input line. */
@@ -109,7 +110,7 @@
int
-get_boolean_resource(char *key, int *boolval)
+get_boolean_resource(const char *key, int *boolval)
{
char *val, tempstr[MAXLINE];
int len, n;
@@ -139,7 +140,7 @@
/* Get integer resource from database. */
int
-get_int_resource(char *key, int *intval)
+get_int_resource(const char *key, int *intval)
{
char *val;
@@ -161,7 +162,7 @@
const char *
get_radix()
{
- char *radix;
+ const char *radix;
setlocale(LC_NUMERIC, "");
if ((radix = nl_langinfo(RADIXCHAR)) != NULL) {
@@ -179,7 +180,7 @@
/* Get a string resource from database. */
static int
-get_str_resource(char *key, char *strval)
+get_str_resource(const char *key, char *strval)
{
char *val;
int i, len;
@@ -250,7 +251,9 @@
for (i = 0; i < MAX_REGISTERS; i++) {
SNPRINTF(key, MAXLINE, "register%d", i);
if (get_str_resource(key, str)) {
- MPstr_to_num(str, 10, v->MPmvals[i]);
+ int temp[MP_SIZE];
+ MPstr_to_num(str, 10, temp);
+ register_set(i, temp);
}
}
Modified: trunk/gcalctool/get.h
==============================================================================
--- trunk/gcalctool/get.h (original)
+++ trunk/gcalctool/get.h Sun Nov 9 12:42:45 2008
@@ -35,24 +35,23 @@
#define R_XPOS "xposition"
#define R_YPOS "yposition"
-extern char *Rbstr[]; /* Base mode X resource strings. */
-extern char *Rdstr[]; /* Display mode X resource strings. */
-extern char *Rmstr[]; /* Mode mode X resource strings. */
-extern char *Rtstr[]; /* Trig mode X resource strings. */
-extern char *Rsstr[]; /* Syntax resource strings. */
+extern const char *Rbstr[]; /* Base mode X resource strings. */
+extern const char *Rdstr[]; /* Display mode X resource strings. */
+extern const char *Rmstr[]; /* Mode mode X resource strings. */
+extern const char *Rtstr[]; /* Trig mode X resource strings. */
+extern const char *Rsstr[]; /* Syntax resource strings. */
void resources_init();
void read_resources();
-char *convert(char *);
-void usage(char *);
+char *convert(const char *);
-void set_resource(char *key, char *value);
-void set_int_resource(char *key, int value);
-void set_boolean_resource(char *key, int value);
-
-char *get_resource(char *key);
-int get_int_resource(char *key, int *value);
-int get_boolean_resource(char *key, int *value);
+void set_resource(const char *key, const char *value);
+void set_int_resource(const char *key, int value);
+void set_boolean_resource(const char *key, int value);
+
+char *get_resource(const char *key);
+int get_int_resource(const char *key, int *value);
+int get_boolean_resource(const char *key, int *value);
const char *get_radix();
const char *get_tsep();
Modified: trunk/gcalctool/gtk.c
==============================================================================
--- trunk/gcalctool/gtk.c (original)
+++ trunk/gcalctool/gtk.c Sun Nov 9 12:42:45 2008
@@ -42,6 +42,7 @@
#include "mpmath.h"
#include "display.h"
#include "get.h"
+#include "register.h"
#define MAX_ACCELERATORS 8
struct button_widget {
@@ -955,6 +956,7 @@
return FALSE;
}
+
void
ui_set_display(char *str, int cursor)
{
@@ -1006,7 +1008,6 @@
* When the error condition is cleared, resensitise everything, setting
* the numeric base buttons correctly.
*/
-
void
ui_set_error_state(gboolean error)
{
@@ -1303,37 +1304,6 @@
}
-static void
-put_constant(int n, char *con_value, char *con_name)
-{
- char key[MAXLINE];
- char *cstr = g_strdup(con_value);
-
- /* NOTE: Constants are written out with no thousands separator and with a
- radix character of ".". */
-
- SNPRINTF(key, MAXLINE, "constant%1dvalue", n);
- set_resource(key, cstr);
- g_free(cstr);
-
- SNPRINTF(key, MAXLINE, "constant%1dname", n);
- set_resource(key, con_name);
-}
-
-
-static void
-put_function(int n, char *fun_value, char *fun_name)
-{
- char key[MAXLINE];
-
- SNPRINTF(key, MAXLINE, "function%1dvalue", n);
- set_resource(key, fun_value);
-
- SNPRINTF(key, MAXLINE, "function%1dname", n);
- set_resource(key, fun_name);
-}
-
-
/*ARGSUSED*/
static void
constant_menu_cb(GtkMenuItem *menu)
@@ -1508,11 +1478,11 @@
int i;
for (i = 0; i < MAX_CONSTANTS; i++) {
- make_number(value, MAXLINE, v->MPcon_vals[i], DEC, TRUE);
+ make_number(value, MAXLINE, constant_get_value(i), DEC, TRUE);
SNPRINTF(mline, MAXLINE,
"<span weight=\"bold\">%s_%1d:</span> %s [%s]", _("C"), i,
value,
- v->con_names[i]);
+ constant_get_name(i));
gtk_label_set_markup_with_mnemonic(GTK_LABEL(X->constant_menu_labels[i]), mline);
}
}
@@ -1525,10 +1495,15 @@
int i;
for (i = 0; i < MAX_FUNCTIONS; i++) {
- if (strlen(v->fun_vals[i]) != 0) {
+ const char *name, *value;
+
+ name = function_get_name(i);
+ value = function_get_value(i);
+
+ if (strlen(value) != 0) {
SNPRINTF(mline, MAXLINE,
"<span weight=\"bold\">%s_%1d:</span> %s [%s]",
- _("F"), i, v->fun_vals[i], v->fun_names[i]);
+ _("F"), i, value, name);
gtk_widget_show(gtk_widget_get_parent(X->function_menu_labels[i]));
gtk_label_set_markup_with_mnemonic(GTK_LABEL(X->function_menu_labels[i]), mline);
}
@@ -1553,13 +1528,13 @@
if (id == GTK_RESPONSE_ACCEPT) {
if (gtk_tree_model_get_iter_first(X->constants_model, &iter)) {
do {
+ int temp[MP_SIZE];
gtk_tree_model_get(X->constants_model, &iter,
COLUMN_NUMBER, &number,
COLUMN_VALUE, &value,
COLUMN_DESCRIPTION, &description, -1);
- MPstr_to_num(value, 10, v->MPcon_vals[number]);
- STRNCPY(v->con_names[number], description, MAXLINE - 1);
- put_constant(number, value, description);
+ MPstr_to_num(value, 10, temp);
+ constant_set(number, description, temp);
} while (gtk_tree_model_iter_next(X->constants_model, &iter));
}
}
@@ -1595,9 +1570,7 @@
COLUMN_NUMBER, &number,
COLUMN_VALUE, &value,
COLUMN_DESCRIPTION, &description, -1);
- STRNCPY(v->fun_vals[number], convert(value), MAXLINE - 1);
- STRNCPY(v->fun_names[number], description, MAXLINE - 1);
- put_function(number, value, description);
+ function_set(number, description, convert(value));
} while (gtk_tree_model_iter_next(X->functions_model, &iter));
}
}
@@ -1628,12 +1601,12 @@
for (i = 0; i < MAX_CONSTANTS; i++) {
gtk_list_store_append(model, &iter);
- make_number(constant, MAXLINE, v->MPcon_vals[i], DEC, TRUE);
+ make_number(constant, MAXLINE, constant_get_value(i), DEC, TRUE);
gtk_list_store_set(model, &iter,
COLUMN_NUMBER, i,
COLUMN_EDITABLE, TRUE,
COLUMN_VALUE, constant,
- COLUMN_DESCRIPTION, v->con_names[i],
+ COLUMN_DESCRIPTION, constant_get_name(i),
-1);
}
@@ -1657,8 +1630,8 @@
gtk_list_store_set(model, &iter,
COLUMN_NUMBER, i,
COLUMN_EDITABLE, TRUE,
- COLUMN_VALUE, v->fun_vals[i],
- COLUMN_DESCRIPTION, v->fun_names[i],
+ COLUMN_VALUE, function_get_value(i),
+ COLUMN_DESCRIPTION, function_get_name(i),
-1);
}
@@ -1673,11 +1646,15 @@
int n;
for (n = 0; n < MAX_REGISTERS; n++) {
- make_number(mval, MAXLINE, v->MPmvals[n], v->base, TRUE);
+ int temp[MP_SIZE];
+
+ register_get(n, temp);
+ make_number(mval, MAXLINE, temp, v->base, TRUE);
gtk_entry_set_width_chars(GTK_ENTRY(X->regs[n]), strlen(mval));
gtk_entry_set_text(GTK_ENTRY(X->regs[n]), mval);
+
SNPRINTF(key, MAXLINE, "register%d", n);
- make_number(value, MAXLINE, v->MPmvals[n], DEC, TRUE);
+ make_number(value, MAXLINE, temp, DEC, TRUE);
set_resource(key, value);
}
}
@@ -1776,10 +1753,11 @@
int i;
for (i = 0; i < MAX_REGISTERS; i++) {
- make_number(value, MAXLINE, v->MPmvals[i], v->base, TRUE);
+ int temp[MP_SIZE];
+ register_get(i, temp);
+ make_number(value, MAXLINE, temp, v->base, TRUE);
SNPRINTF(mstr, MAXLINE, "<span weight=\"bold\">%s_%d:</span> %s",
- /* Translators: R is the short form of register used inter alia
- in popup menus */
+ /* Translators: R is the short form of register used inter alia in popup menus */
_("R"), i, value);
gtk_label_set_markup_with_mnemonic(GTK_LABEL(X->memory_store_labels[i]), mstr);
gtk_label_set_markup_with_mnemonic(GTK_LABEL(X->memory_recall_labels[i]), mstr);
@@ -1787,31 +1765,6 @@
}
}
-
-static void
-get_constant(int n)
-{
- char nkey[MAXLINE], *nline;
- char vkey[MAXLINE], *vline;
-
- SNPRINTF(nkey, MAXLINE, "constant%1dname", n);
- if ((nline = get_resource(nkey)) == NULL) {
- return;
- }
-
- SNPRINTF(vkey, MAXLINE, "constant%1dvalue", n);
- if ((vline = get_resource(vkey)) == NULL) {
- g_free(nline);
- return;
- }
-
- MPstr_to_num(vline, 10, v->MPcon_vals[n]);
- STRNCPY(v->con_names[n], nline, MAXLINE - 1);
- g_free(nline);
- g_free(vline);
-}
-
-
static void
get_display() /* The Copy function key has been pressed. */
{
@@ -1834,30 +1787,6 @@
}
-static void
-get_function(int n)
-{
- char nkey[MAXLINE], *nline;
- char vkey[MAXLINE], *vline;
-
- SNPRINTF(nkey, MAXLINE, "function%1dname", n);
- if ((nline = get_resource(nkey)) == NULL) {
- return;
- }
-
- SNPRINTF(vkey, MAXLINE, "function%1dvalue", n);
- if ((vline = get_resource(vkey)) == NULL) {
- g_free(nline);
- return;
- }
-
- STRNCPY(v->fun_vals[n], convert(vline), MAXLINE - 1);
- STRNCPY(v->fun_names[n], nline, MAXLINE - 1);
- g_free(nline);
- g_free(vline);
-}
-
-
static gboolean
check_for_localized_numeric_point(int keyval)
{
@@ -2763,25 +2692,11 @@
}
-static void
-read_cfdefs() /* Read constant/function definitions. */
-{
- int n;
-
- for (n = 0; n < MAX_CONSTANTS; n++) {
- get_constant(n);
- }
- for (n = 0; n < MAX_FUNCTIONS; n++) {
- STRNCPY(v->fun_vals[n], "", MAXLINE - 1); /* Initially empty function strings. */
- get_function(n);
- }
-}
-
-
void
ui_init(int *argc, char ***argv)
{
gchar *path;
+ const gchar *home;
X = (XVars) LINT_CAST(calloc(1, sizeof(struct Xobject)));
@@ -2791,8 +2706,8 @@
gtk_rc_get_default_files();
- v->home = (char *) g_get_home_dir();
- path = g_build_path(v->home, RCNAME, NULL);
+ home = g_get_home_dir();
+ path = g_build_path(home, RCNAME, NULL);
gtk_rc_parse(path);
g_free(path);
@@ -2807,8 +2722,6 @@
char text[MAXLINE];
GtkWidget *widget;
- read_cfdefs();
-
/* Create main gcalctool window. */
create_kframe();
Modified: trunk/gcalctool/mp-convert.c
==============================================================================
--- trunk/gcalctool/mp-convert.c (original)
+++ trunk/gcalctool/mp-convert.c Sun Nov 9 12:42:45 2008
@@ -523,7 +523,7 @@
mp_set_from_integer(inum, MP2);
mpdiv(MP2, MP1, MP1);
mp_add(MPval, MP1, MPval);
- optr++;
+ optr++;
}
}
Modified: trunk/gcalctool/mp.c
==============================================================================
--- trunk/gcalctool/mp.c (original)
+++ trunk/gcalctool/mp.c Sun Nov 9 12:42:45 2008
@@ -27,6 +27,9 @@
#include "calctool.h"
#include "display.h"
+/* True if errors should be printed to stderr */
+static int mp_show_errors = 0;
+
static int mp_compare_mp_to_float(const int *, float);
static int pow_ii(int, int);
@@ -39,6 +42,13 @@
static void mpovfl(int *, const char *);
static void mpunfl(int *);
+
+void
+mp_set_show_errors(int show_errors)
+{
+ mp_show_errors = show_errors;
+}
+
/* SETS Y = ABS(X) FOR MP NUMBERS X AND Y */
void
mp_abs(const int *x, int *y)
@@ -800,7 +810,7 @@
{
va_list args;
- if (v->MPerrors) {
+ if (mp_show_errors) {
va_start(args, format);
(void)vfprintf(stderr, format, args);
va_end(args);
@@ -1780,7 +1790,7 @@
static void
mpovfl(int *x, const char *error)
{
- if (v->MPerrors) {
+ if (mp_show_errors) {
FPRINTF(stderr, "%s", error);
}
Modified: trunk/gcalctool/mp.h
==============================================================================
--- trunk/gcalctool/mp.h (original)
+++ trunk/gcalctool/mp.h Sun Nov 9 12:42:45 2008
@@ -47,6 +47,8 @@
# define __attribute__(x) /*NOTHING*/
#endif
+void mp_set_show_errors(int show_errors);
+
void mperr(const char *format, ...) __attribute__((format(printf, 1, 2)));
int mp_compare_mp_to_mp(const int *x, const int *y);
Modified: trunk/gcalctool/mpmath.c
==============================================================================
--- trunk/gcalctool/mpmath.c (original)
+++ trunk/gcalctool/mpmath.c Sun Nov 9 12:42:45 2008
@@ -432,7 +432,7 @@
*/
void
-make_fixed(char *target, int target_len, int *MPnumber, int base, int cmax, int toclear)
+make_fixed(char *target, int target_len, const int *MPnumber, int base, int cmax, int toclear)
{
char half[MAXLINE], *optr;
int MP1base[MP_SIZE], MP1[MP_SIZE], MP2[MP_SIZE], MPval[MP_SIZE];
@@ -504,7 +504,7 @@
/* Convert engineering or scientific number in the given base. */
void
-make_eng_sci(char *target, int target_len, int *MPnumber, int base)
+make_eng_sci(char *target, int target_len, const int *MPnumber, int base)
{
char half[MAXLINE], fixed[MAX_DIGITS], *optr;
int MP1[MP_SIZE], MPatmp[MP_SIZE], MPval[MP_SIZE];
@@ -600,7 +600,7 @@
/* Convert MP number to character string in the given base. */
void
-make_number(char *target, int target_len, int *MPnumber, int base, int ignoreError)
+make_number(char *target, int target_len, const int *MPnumber, int base, int ignoreError)
{
double val;
Modified: trunk/gcalctool/mpmath.h
==============================================================================
--- trunk/gcalctool/mpmath.h (original)
+++ trunk/gcalctool/mpmath.h Sun Nov 9 12:42:45 2008
@@ -67,7 +67,7 @@
is_natural(int MPnum[MP_SIZE]);
// FIXME: These should be merged together
-void make_fixed(char *, int, int *, int, int, int);
-void make_number(char *, int, int *, int, int);
+void make_fixed(char *, int, const int *, int, int, int);
+void make_number(char *, int, const int *, int, int);
#endif /*MPMATH_H*/
Modified: trunk/gcalctool/register.c
==============================================================================
--- trunk/gcalctool/register.c (original)
+++ trunk/gcalctool/register.c Sun Nov 9 12:42:45 2008
@@ -20,19 +20,159 @@
*/
#include "register.h"
+#include "get.h"
#include "calctool.h"
+#include "mpmath.h"
+
+static const char *default_constants[][2] =
+{
+ /* Translators: This is the label for the default constant, the number of miles in one kilometer (0.621) */
+ { N_("Kilometer-to-mile conversion factor"), "0.621" },
+ /* Translators: This is the label for the default constant, the square root of 2 (1.41421) */
+ { N_("square root of 2"), "1.4142135623" },
+ /* Translators: This is the label for the default constant, Euler's number (2.71828) */
+ { N_("Euler's Number (e)"), "2.7182818284" },
+ /* Translators: This is the label for the default constant, Ï (3.14159) */
+ { N_("Ï"), "3.1415926536" },
+ /* Translators: This is the label for the default constant, the number of inches in a centimeter (0.39370) */
+ { N_("Centimeter-to-inch conversion factor"), "0.3937007" },
+ /* Translators: This is the label for the default constant, the number of degrees in a radian (57.2958) */
+ { N_("degrees in a radian"), "57.295779513" },
+ /* Translators: This is the label for the default constant, 2 to the power of 20 (1048576) */
+ { N_("2 ^ 20"), "1048576.0" },
+ /* Translators: This is the label for the default constant, the number of ounces in one gram (0.0353) */
+ { N_("Gram-to-ounce conversion factor"), "0.0353" },
+ /* Translators: This is the label for the default constant, the number of British Thermal Units in one Kilojoule (0.948) */
+ { N_("Kilojoule-to-British-thermal-unit conversion factor"), "0.948" },
+ /* Translators: This is the label for the default constant, the number of cubic inches in one cubic centimeter (0.0610) */
+ { N_("Cubic-centimeter-to-cubic-inch conversion factor"), "0.0610" }
+};
+
+void register_init()
+{
+ int i;
+ for (i = 0; i < MAX_REGISTERS; i++) {
+ mp_set_from_integer(0, v->registers[i]);
+ }
+
+ for (i = 0; i < MAX_CONSTANTS; i++) {
+ char nkey[MAXLINE], *nline;
+ char vkey[MAXLINE], *vline = NULL;
+ int value[MP_SIZE];
+
+ SNPRINTF(nkey, MAXLINE, "constant%1dname", i);
+ nline = get_resource(nkey);
+ if (nline) {
+ SNPRINTF(vkey, MAXLINE, "constant%1dvalue", i);
+ vline = get_resource(vkey);
+ if (vline == NULL)
+ g_free(nline);
+ }
+
+ if (nline && vline) {
+ MPstr_to_num(vline, 10, value);
+ constant_set(i, nline, value);
+ g_free(nline);
+ g_free(vline);
+ }
+ else {
+ MPstr_to_num(default_constants[i][1], 10, value);
+ constant_set(i, default_constants[i][0], value);
+ }
+ }
+
+ for (i = 0; i < MAX_FUNCTIONS; i++) {
+ char nkey[MAXLINE], *nline;
+ char vkey[MAXLINE], *vline;
+
+ SNPRINTF(nkey, MAXLINE, "function%1dname", i);
+ nline = get_resource(nkey);
+ if (nline) {
+ SNPRINTF(vkey, MAXLINE, "function%1dvalue", i);
+ vline = get_resource(vkey);
+ if (vline == NULL)
+ g_free(nline);
+ }
+
+ if (nline && vline) {
+ function_set(i, nline, convert(vline));
+ g_free(nline);
+ g_free(vline);
+ }
+ else {
+ function_set(i, "", "");
+ }
+ }
+}
+
void
-do_sto_reg(int reg, int value[MP_SIZE])
+register_set(int index, int value[MP_SIZE])
{
- if ((reg >= 0) && (reg <= 10))
- mp_set_from_mp(value, v->MPmvals[reg]);
+ if ((index >= 0) && (index <= 10))
+ mp_set_from_mp(value, v->registers[index]);
}
void
-do_rcl_reg(int reg, int value[MP_SIZE])
+register_get(int index, int value[MP_SIZE])
+{
+ if ((index >= 0) && (index <= 10))
+ mp_set_from_mp(v->registers[index], value);
+}
+
+
+void constant_set(int index, const char *name, int value[MP_SIZE])
+{
+ char key[MAXLINE], temp[MAXLINE];
+
+ STRNCPY(v->constant_names[index], name, MAXLINE - 1);
+ mp_set_from_mp(value, v->constant_values[index]);
+
+ SNPRINTF(key, MAXLINE, "constant%1dname", index);
+ set_resource(key, name);
+
+ /* NOTE: Constants are written out with no thousands separator and with a
+ radix character of ".". */
+ make_number(temp, MAXLINE, value, 10, TRUE);
+ SNPRINTF(key, MAXLINE, "constant%1dvalue", index);
+ set_resource(key, temp);
+}
+
+
+const char *constant_get_name(int index)
+{
+ return v->constant_names[index];
+}
+
+
+const int *constant_get_value(int index)
+{
+ return v->constant_values[index];
+}
+
+
+void function_set(int index, const char *name, const char *value)
+{
+ char key[MAXLINE];
+
+ STRNCPY(v->function_names[index], name, MAXLINE - 1);
+ STRNCPY(v->function_values[index], value, MAXLINE - 1);
+
+ SNPRINTF(key, MAXLINE, "function%1dname", index);
+ set_resource(key, name);
+ SNPRINTF(key, MAXLINE, "function%1dvalue", index);
+ set_resource(key, value);
+}
+
+
+const char *function_get_name(int index)
+{
+ return v->function_names[index];
+}
+
+
+const char *function_get_value(int index)
{
- if ((reg >= 0) && (reg <= 10))
- mp_set_from_mp(v->MPmvals[reg], value);
+ return v->function_values[index];
}
Modified: trunk/gcalctool/register.h
==============================================================================
--- trunk/gcalctool/register.h (original)
+++ trunk/gcalctool/register.h Sun Nov 9 12:42:45 2008
@@ -24,7 +24,16 @@
#include "mp.h"
-void do_rcl_reg(int reg, int value[MP_SIZE]);
-void do_sto_reg(int reg, int value[MP_SIZE]);
+void register_init();
+void register_set(int index, int value[MP_SIZE]);
+void register_get(int index, int value[MP_SIZE]);
+
+void constant_set(int index, const char *name, int value[MP_SIZE]);
+const char *constant_get_name(int index);
+const int *constant_get_value(int index);
+
+void function_set(int index, const char *name, const char *value);
+const char *function_get_name(int index);
+const char *function_get_value(int index);
#endif /*REGISTER_H*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]