File: button_def.c

package info (click to toggle)
grpn 1.0.4-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 404 kB
  • ctags: 461
  • sloc: ansic: 5,522; makefile: 66
file content (127 lines) | stat: -rw-r--r-- 4,709 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*

Copyright (C) 1998  Paul Wilkins

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/
/*button_def.c  by Paul Wilkins 3/30/97 */

#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>

#include "buttons.h"
#include "editor.h"
#include "lcd.h"
#include "funcs.h"
#include "undo.h"



FuncInfo invisible1[] = {
   { "Cplx", "cplx", "Create a complex number.", 
      genericButtonCB, (void *)CplxStack },
   { "Cplx", "complex", "Create a complex number.",
      genericButtonCB, (void *)CplxStack },
   { "Mtrx", "mtrx", "Create or decompose a matrix.",
      genericButtonCB, (void *)MtrxStack },
   { "Mtrx", "matrix", "Create or decompose a matrix.", 
      genericButtonCB, (void *)MtrxStack },
   { "Undo", "undo", "Undo last command.  Up to 10 commands can be undone.", 
      genericButtonCB, (void *)UndoStack },
   { "Clear", "clear", "Clears and removes all numbers on the stack.",
      genericButtonCB, (void *)clearLCD },
   { "Quit", "quit", "Quit GRPN.", genericButtonCB, (void *)exit }
};
FuncInfo row2[] = {
   { "Enter", "dup", "Copy the number on the top of the stack.",
      genericButtonCB, (void *)PushStack },
   { "+/-", "neg", "Change sign.", plusMinusCB, NULL },
   { "EEX", NULL, "Mouse input: enter an exponent.",
      enterNumCB, (void *)'e' },
   { "DEL", NULL, "Mouse input: backspace.",
      genericButtonCB, (void *)deleteEditor },
   { "Drop", "drop", "Delete the number on the top of the stack.",
      genericButtonCB, (void *)PopStack },
   { "Swap", "swap", "Swap 2 numbers on the top of the stack.",
      genericButtonCB, (void *)SwapStack }
};
FuncInfo num789[] = {
   { "7", NULL, NULL, enterNumCB, (void *)'7' },
   { "8", NULL, NULL, enterNumCB, (void *)'8' },
   { "9", NULL, NULL, enterNumCB, (void *)'9' },
   { "/", NULL, NULL, genericButtonCB, (void *)DivStack },
   { "Pi", "pi", "The constant PI.", genericButtonCB, (void *)PiStack },
   { "Sin", "sin", "Trigonometric function Sin.",
      genericButtonCB, (void *)SinStack },
   { "Cos", "cos", "Trigonometric function Cos.",
      genericButtonCB, (void *)CosStack },
   { "Tan", "tan", "Trigonometric function Tan.",
      genericButtonCB, (void *)TanStack }
};
FuncInfo num456[] = {
   { "4", NULL, NULL, enterNumCB, (void *)'4' },
   { "5", NULL, NULL, enterNumCB, (void *)'5' },
   { "6", NULL, NULL, enterNumCB, (void *)'6' },
   { "x", NULL, NULL, genericButtonCB, (void *)MulStack },
   { "1/x", "inv", "Inverse.", genericButtonCB, (void *)InvStack },
   { "Asin", "asin", "Trigonometric function Arc-sin.",
      genericButtonCB, (void *)AsinStack },
   { "Acos", "acos", "Trigonometric function Arc-cos.",
      genericButtonCB, (void *)AcosStack },
   { "Atan", "atan", "Trigonometric function Arc-tan.",
      genericButtonCB, (void *)AtanStack }
};
FuncInfo num123[] = {
   { "1", NULL, NULL, enterNumCB, (void *)'1' },
   { "2", NULL, NULL, enterNumCB, (void *)'2' },
   { "3", NULL, NULL, enterNumCB, (void *)'3' },
   { "-", NULL, NULL, genericButtonCB, (void *)SubStack },
   { "Sqrt", "sqrt", "Square root.",
      genericButtonCB, (void *)SqrtStack },
   { "Nroot", "nroot", "N-th root.",
      genericButtonCB, (void *)NrootStack },
   { "Log", "log", "Log base 10.",
      genericButtonCB, (void *)LogStack },
   { "ln", "ln", "Natural log (log base e).",
      genericButtonCB, (void *)LnStack }
};
FuncInfo num0[] = {
   { "0", NULL, NULL, enterNumCB, (void *)'0' },
   { ".", NULL, NULL, enterNumCB, (void *)'.' },
   { NULL, NULL, NULL, NULL, NULL },
   { "+", NULL, NULL, genericButtonCB, (void *)AddStack },
   { "  2\nx  ", "sqr", "Square.", genericButtonCB, (void *)SqrStack },
   { "  x\ny  ", "pow", "Power.", genericButtonCB, (void *)PowStack },
   { "  x\n10 ", "tenx", "Ten to the power.",
      genericButtonCB, (void *)TenxStack },
   { "  x\ne  ", "exp", "e to the power.",
      genericButtonCB, (void *)ExpStack }
};

int NumButtonRows = 5;
int NumFunctionRows = 6;

struct RowInfo rowinf[] = {
   { 6, 6, row2 },
   { 8, 8, num789 },
   { 8, 8, num456 },
   { 8, 8, num123 },
   { 8, 8, num0 },
   { 7, 0, invisible1 }
};