1 | #include "config.h" |
---|
2 | |
---|
3 | #include <auxiliary.h> |
---|
4 | #include <coeffs.h> |
---|
5 | #include <numbers.h> |
---|
6 | #include <output.h> |
---|
7 | #include <omalloc.h> |
---|
8 | |
---|
9 | |
---|
10 | #include <longrat.h> |
---|
11 | #include <gnumpc.h> |
---|
12 | #include <shortfl.h> |
---|
13 | |
---|
14 | |
---|
15 | int main() |
---|
16 | { |
---|
17 | const n_coeffType type = nRegister( n_Q, nlInitChar); assume( type == n_Q ); |
---|
18 | // const n_coeffType type = nRegister( n_long_C, ngcInitChar); assume( type == n_long_C ); |
---|
19 | // const n_coeffType type = nRegister( n_R, nrInitChar); assume( type == n_R ); |
---|
20 | |
---|
21 | |
---|
22 | const coeffs r = nInitChar( type, NULL ); |
---|
23 | |
---|
24 | assume( r != NULL ); |
---|
25 | |
---|
26 | nSetChar( r ); |
---|
27 | |
---|
28 | assume( getCoeffType(r) == type ); |
---|
29 | |
---|
30 | assume( r->cfInit != NULL ); |
---|
31 | assume( r->cfWrite != NULL ); |
---|
32 | assume( r->cfAdd != NULL ); |
---|
33 | assume( r->cfDelete != NULL ); |
---|
34 | |
---|
35 | |
---|
36 | if( type == n_Q ) |
---|
37 | { |
---|
38 | assume( r->cfInit == nlInit ); |
---|
39 | assume( r->cfWrite == nlWrite ); |
---|
40 | assume( r->cfAdd == nlAdd ); |
---|
41 | assume( r->cfDelete == nlDelete ); |
---|
42 | } |
---|
43 | else if( type == n_long_C ) |
---|
44 | { |
---|
45 | assume( r->cfInit == ngcInit ); |
---|
46 | assume( r->cfWrite == ngcWrite ); |
---|
47 | assume( r->cfAdd == ngcAdd ); |
---|
48 | assume( r->cfDelete == ngcDelete ); |
---|
49 | } |
---|
50 | else if( type == n_R ) |
---|
51 | { |
---|
52 | assume( r->cfInit == nrInit ); |
---|
53 | assume( r->cfWrite == nrWrite ); |
---|
54 | assume( r->cfAdd == nrAdd ); |
---|
55 | // assume( r->cfDelete == nrDelete ); // No? |
---|
56 | } else |
---|
57 | { |
---|
58 | // ... |
---|
59 | } |
---|
60 | |
---|
61 | |
---|
62 | |
---|
63 | number a = r->cfInit(666, r); |
---|
64 | number b = r->cfAdd( a, a, r); |
---|
65 | |
---|
66 | StringSetS("a: ");r->cfWrite( a, r );PrintS(StringAppend("\n")); |
---|
67 | StringSetS("b: "); r->cfWrite( b, r );PrintS(StringAppend("\n")); |
---|
68 | |
---|
69 | r->cfDelete( &a, r); |
---|
70 | r->cfDelete( &b, r); |
---|
71 | |
---|
72 | nKillChar( r ); |
---|
73 | |
---|
74 | return 0; |
---|
75 | } |
---|