summaryrefslogtreecommitdiff
path: root/math/grpn/patches/patch-ab
blob: 656f53df8c5ce16f004d770cfb5508522f151f76 (plain)
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
$NetBSD: patch-ab,v 1.2 2002/05/12 23:21:54 dmcmahill Exp $

adds physical constants:  k,q,e0,mu0,c.  

*** button_def.c.orig	Wed Apr  3 22:46:10 2002
--- button_def.c	Fri Apr 26 10:56:28 2002
***************
*** 34,39 ****
--- 34,49 ----
  extern void baseCmdCB(GtkWidget *, gpointer);
  
  FuncInfo invisible1[] = {
+    { "k", "k", "Boltzmann's constant (Joules/Kelvin).",
+       genericButtonCB, (void *)BoltzmannStack },
+    { "q", "q", "Electron Charge (coulomb).",
+       genericButtonCB, (void *)ChargeStack },
+    { "e0", "e0", "Free space permitivitty (Farads/meter).",
+       genericButtonCB, (void *)E0Stack },
+    { "mu0", "mu0", "Free space permeability (Henries/meter).",
+       genericButtonCB, (void *)Mu0Stack },
+    { "c", "c", "Free space speed of light (meters/second).",
+       genericButtonCB, (void *)LightSpeedStack },
     { "Hex", "hex", "Hexidecimal display mode.",
        baseCmdCB, (void *)HEXIDECIMAL },
     { "Dec", "dec", "Decimal display mode.",
***************
*** 137,143 ****
     { 8, 8, num456 },
     { 8, 8, num123 },
     { 8, 8, num0 },
!    { 14, 0, invisible1 }
  };
  
  
--- 147,153 ----
     { 8, 8, num456 },
     { 8, 8, num123 },
     { 8, 8, num0 },
!    { 19, 0, invisible1 }
  };
  
  
*** constant.c.orig	Wed Apr  3 22:46:11 2002
--- constant.c	Fri Apr 26 10:51:06 2002
***************
*** 24,29 ****
--- 24,34 ----
  #include "real.h"
  #include "complex.h"
  
+ Real *realBoltzmann;
+ Real *realCharge;
+ Real *realE0;
+ Real *realMu0;
+ Real *realLightSpeed;
  Real *realPi;
  Real *realPi2;
  Real *realZero;
***************
*** 35,43 ****
--- 40,56 ----
  Real *real180Pi;
  Cmplx *cmplxI;
  
+ #define LIGHTSPEED	2.997923e8
+ #define MU0				(4*M_PI*1.0e-7)
+ 
  void setup_constant(){
     Real *tmp;
  
+    realBoltzmann = setRealDouble(newReal(), 1.380622e-23);
+    realCharge = setRealDouble(newReal(), 1.6021917e-19);
+    realE0 = setRealDouble(newReal(), 1.0/(LIGHTSPEED*LIGHTSPEED*MU0));
+    realMu0 = setRealDouble(newReal(), MU0);
+    realLightSpeed = setRealDouble(newReal(), LIGHTSPEED);
     realPi = setRealDouble(newReal(), M_PI);
     realPi2 = setRealDouble(newReal(), M_PI/2.0);
     realZero = setRealDouble(newReal(), 0.0);
*** constant.h.orig	Wed Apr  3 22:46:11 2002
--- constant.h	Fri Apr 26 10:55:24 2002
***************
*** 22,27 ****
--- 22,32 ----
  #ifndef __CONSTANT_H
  #define __CONSTANT_H
  
+ extern Real *realBoltzmann;
+ extern Real *realCharge;
+ extern Real *realE0;
+ extern Real *realMu0;
+ extern Real *realLightSpeed;
  extern Real *realPi;
  extern Real *realPi2;
  extern Real *realZero;
*** funcs.c.orig	Wed Apr  3 22:46:11 2002
--- funcs.c	Fri Apr 26 10:39:46 2002
***************
*** 95,100 ****
--- 95,165 ----
  
  }
  
+ void BoltzmannStack(){
+    Number *n1;
+ 
+    finishEditor();
+ 
+    SaveStackState(0);
+ 
+    n1 = setNumberReal(newNumber(), realBoltzmann);
+    Push(n1);
+ 
+    UndoStackState(1);
+ }
+ 
+ void ChargeStack(){
+    Number *n1;
+ 
+    finishEditor();
+ 
+    SaveStackState(0);
+ 
+    n1 = setNumberReal(newNumber(), realCharge);
+    Push(n1);
+ 
+    UndoStackState(1);
+ }
+ 
+ void E0Stack(){
+    Number *n1;
+ 
+    finishEditor();
+ 
+    SaveStackState(0);
+ 
+    n1 = setNumberReal(newNumber(), realE0);
+    Push(n1);
+ 
+    UndoStackState(1);
+ }
+ 
+ void Mu0Stack(){
+    Number *n1;
+ 
+    finishEditor();
+ 
+    SaveStackState(0);
+ 
+    n1 = setNumberReal(newNumber(), realMu0);
+    Push(n1);
+ 
+    UndoStackState(1);
+ }
+ 
+ void LightSpeedStack(){
+    Number *n1;
+ 
+    finishEditor();
+ 
+    SaveStackState(0);
+ 
+    n1 = setNumberReal(newNumber(), realLightSpeed);
+    Push(n1);
+ 
+    UndoStackState(1);
+ }
+ 
  void PiStack(){
     Number *n1;
  
*** funcs.h.orig	Wed Apr  3 22:46:11 2002
--- funcs.h	Fri Apr 26 10:40:27 2002
***************
*** 41,46 ****
--- 41,51 ----
  void PopStack();
  void PushStack();
  
+ void BoltzmannStack();
+ void ChargeStack();
+ void E0Stack();
+ void Mu0Stack();
+ void LightSpeedStack();
  void PiStack();
  
  void NegStack();
*** CHANGES.orig	Wed Apr  3 22:37:30 2002
--- CHANGES	Fri Apr 26 16:46:35 2002
***************
*** 29,31 ****
--- 29,38 ----
  
  v1.1.2
     Add db10 and db20 commands.
+ 
+ v1.1.2nb1
+    Add k,q,e0,mu0, and c commands for Boltzmann's constant
+    (Joules/Kelvin), electron charge (coulomb), free space
+    permitivitty (Farads/meter), free space permeability
+ 	(Henries/meter), and the speed of light in a vacuum 
+ 	(meters/second).
*** help.c.orig	Wed Apr  3 22:46:11 2002
--- help.c	Fri Apr 26 16:47:46 2002
***************
*** 28,34 ****
  
  #define HELP_TXT \
  "\n\
! GRPN  v1.1.2\n\
  \n\
  By: Paul Wilkins\n\
      paul.wilkins@analog.com\n\
--- 28,34 ----
  
  #define HELP_TXT \
  "\n\
! GRPN  v1.1.2nb1\n\
  \n\
  By: Paul Wilkins\n\
      paul.wilkins@analog.com\n\