gcalctool r2161 - trunk/gcalctool
- From: rancell svn gnome org
- To: svn-commits-list gnome org
- Subject: gcalctool r2161 - trunk/gcalctool
- Date: Sat, 9 Aug 2008 06:44:52 +0000 (UTC)
Author: rancell
Date: Sat Aug 9 06:44:52 2008
New Revision: 2161
URL: http://svn.gnome.org/viewvc/gcalctool?rev=2161&view=rev
Log:
Typdef up some structures
Modified:
trunk/gcalctool/display.c
trunk/gcalctool/display.h
Modified: trunk/gcalctool/display.c
==============================================================================
--- trunk/gcalctool/display.c (original)
+++ trunk/gcalctool/display.c Sat Aug 9 06:44:52 2008
@@ -1,3 +1,4 @@
+
/* $Header$
*
* Copyright (c) 1987-2008 Sun Microsystems, Inc. All Rights Reserved.
@@ -31,7 +32,7 @@
#include "ce_parser.h" // For ce_parse()
#include "register.h"
-static struct exprm_state *
+static GCDisplayState *
get_state(GCDisplay *display)
{
return &(display->h.e[display->h.current]);
@@ -227,7 +228,7 @@
void
display_set_string(GCDisplay *display, const char *value, int cursor)
{
- struct exprm_state *e;
+ GCDisplayState *e;
e = get_state(display);
free(e->expression);
@@ -238,7 +239,7 @@
void
display_set_cursor(GCDisplay *display, int cursor)
{
- struct exprm_state *e;
+ GCDisplayState *e;
e = get_state(display);
e->cursor = cursor;
@@ -251,9 +252,9 @@
}
static void
-copy_state(struct exprm_state *dst, struct exprm_state *src)
+copy_state(GCDisplayState *dst, GCDisplayState *src)
{
- MEMCPY(dst, src, sizeof(struct exprm_state));
+ MEMCPY(dst, src, sizeof(GCDisplayState));
dst->expression = strdup(src->expression);
}
@@ -367,7 +368,7 @@
display_backspace(GCDisplay *display)
{
char buf[MAX_DISPLAY] = "", buf2[MAX_DISPLAY], *t;
- struct exprm_state *e = get_state(display);
+ GCDisplayState *e = get_state(display);
int i, MP_reg[MP_SIZE], cursor;
cursor = display_get_cursor(display);
@@ -434,7 +435,7 @@
{
int i, MP_reg[MP_SIZE];
char localized[MAX_LOCALIZED], *str, reg[3], *t;
- struct exprm_state *e;
+ GCDisplayState *e;
char x[MAX_LOCALIZED], xx[MAX_LOCALIZED], ans[MAX_LOCALIZED];
int cursor = display_get_cursor(display);
@@ -496,7 +497,7 @@
{
int i;
- memset(&(display->h), 0, sizeof(struct exprm_state_history)); /* clear expression mode state history */
+ memset(&(display->h), 0, sizeof(GCDisplayHistory)); /* clear expression mode state history */
for (i = 0; i < UNDO_HISTORY_LENGTH; i++)
display->h.e[i].expression = strdup("");
}
Modified: trunk/gcalctool/display.h
==============================================================================
--- trunk/gcalctool/display.h (original)
+++ trunk/gcalctool/display.h Sat Aug 9 06:44:52 2008
@@ -30,24 +30,24 @@
#define MAX_DISPLAY 512
/* Expression mode state */
-struct exprm_state {
+typedef struct {
int ans[MP_SIZE]; /* Previously calculated answer */
char *expression; /* Expression entered by user */
int cursor;
-};
+} GCDisplayState;
/* Circular list of Arithmetic Precedence Mode states*/
-struct exprm_state_history {
+typedef struct {
unsigned int begin;
unsigned int end;
unsigned int current;
- struct exprm_state e[UNDO_HISTORY_LENGTH]; /* Expression mode state */
-};
+ GCDisplayState e[UNDO_HISTORY_LENGTH]; /* Expression mode state */
+} GCDisplayHistory;
typedef struct
{
- char display[MAX_DISPLAY]; /* Current calculator display. */
- struct exprm_state_history h; /* History of expression mode states */
+ char display[MAX_DISPLAY]; /* Current calculator display. */
+ GCDisplayHistory h; /* History of expression mode states */
} GCDisplay;
void display_init(GCDisplay *);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]