From f28d4c94798d88757227b8c517a05a6ca354dc6f Mon Sep 17 00:00:00 2001 From: marha Date: Sun, 26 Dec 2010 20:18:03 +0000 Subject: Update to xcalc-1.0.4.1 --- apps/xcalc/xcalc.c | 83 +++++++++++++++++------------------------------------- 1 file changed, 26 insertions(+), 57 deletions(-) (limited to 'apps/xcalc/xcalc.c') diff --git a/apps/xcalc/xcalc.c b/apps/xcalc/xcalc.c index 0f943115a..39547377c 100644 --- a/apps/xcalc/xcalc.c +++ b/apps/xcalc/xcalc.c @@ -1,4 +1,3 @@ -/* $XConsortium: xcalc.c,v 1.16 94/04/17 20:43:31 converse Exp $ */ /* Copyright (c) 1989 X Consortium @@ -28,7 +27,6 @@ other dealings in this Software without prior written authorization from the X Consortium. */ -/* $XFree86$ */ /* * xcalc.c - a hand calculator for the X Window system @@ -40,10 +38,9 @@ from the X Consortium. */ #include +#include #include #include -#include -#include #include #include #include @@ -53,18 +50,20 @@ from the X Consortium. #include #include #include "xcalc.h" -#include "actions.h" -#ifndef IEEE -extern signal_t fperr(); -extern signal_t illerr(); -#endif +static Boolean convert(Widget w, Atom *selection, Atom *target, Atom *type, + XtPointer *value, unsigned long *length, int *format); +static void create_keypad(Widget parent); +static void create_display(Widget parent); +static void create_calculator(Widget shell); +static void done(Widget w, Atom *selection, Atom *target); +static void lose(Widget w, Atom *selection); +static void Syntax(int argc, char **argv); /* * global data */ int rpn = 0; /* Reverse Polish Notation (HP mode) flag */ -#define LCD_STR_LEN 32 char dispstr[LCD_STR_LEN]; /* string to show up in the LCD */ Atom wm_delete_window; /* see ICCCM section 5.2.2 */ @@ -112,16 +111,10 @@ static XtResource Resources[] = { int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { Arg args[3]; - void create_calculator(); - void Quit(), Syntax(); - - XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); toplevel = XtAppInitialize(&xtcontext, "XCalc", Options, XtNumber(Options), @@ -136,7 +129,7 @@ main(argc, argv) create_calculator(toplevel); - XtAppAddActions(xtcontext, Actions, XtNumber(Actions)); + XtAppAddActions(xtcontext, Actions, ActionsCount); XtOverrideTranslations(toplevel, XtParseTranslationTable("WM_PROTOCOLS: quit()\n")); @@ -172,12 +165,8 @@ main(argc, argv) return 0; } -void create_calculator(shell) - Widget shell; +static void create_calculator(Widget shell) { - void create_display(); - void create_keypad(); - rpn = appResources.rpn; calculator = XtCreateManagedWidget(rpn ? "hp" : "ti", formWidgetClass, shell, (ArgList) NULL, ZERO); @@ -189,8 +178,7 @@ void create_calculator(shell) /* * Do the calculator data display widgets. */ -void create_display(parent) - Widget parent; +static void create_display(Widget parent) { Widget bevel, screen; static Arg args[] = { @@ -242,10 +230,9 @@ void create_display(parent) * these defaults in an environment-specific resource file. */ -void create_keypad(parent) - Widget parent; +static void create_keypad(Widget parent) { - static char *Keyboard[] = { + static const char *Keyboard[] = { "button1", "button2", "button3", "button4", "button5", "button6", "button7", "button8", "button9", "button10", "button11","button12","button13","button14","button15", @@ -272,8 +259,7 @@ void create_keypad(parent) /* * called by math routines to write to the liquid crystal display. */ -void draw(string) - char *string; +void draw(char *string) { Arg args[1]; @@ -283,9 +269,7 @@ void draw(string) /* * called by math routines to turn on and off the display indicators. */ -void setflag(indicator, on) - int indicator; - Boolean on; +void setflag(int indicator, Boolean on) { if (on) XtMapWidget(ind[indicator]); else XtUnmapWidget(ind[indicator]); @@ -294,7 +278,7 @@ void setflag(indicator, on) /* * ring the bell. */ -void ringbell() +void ringbell(void) { XBell(dpy, 0); } @@ -302,9 +286,8 @@ void ringbell() /* * die. */ -void Quit() +void Quit(void) { - extern void exit(); XtDestroyApplicationContext(xtcontext); exit(0); } @@ -312,12 +295,10 @@ void Quit() /* * recite and die. */ -void Syntax(argc, argv) - int argc; - char **argv; +static void Syntax(int argc, char **argv) { register int i; - extern void exit(); + (void) fprintf(stderr, "%s: unknown options:", argv[0]); for (i=1; i