1 | /**************************************************************** |
---|
2 | * |
---|
3 | * FILE: MP_BigNum.c |
---|
4 | * Purpose: Dummy definition of the default BigNum routines |
---|
5 | * |
---|
6 | * Change Log: |
---|
7 | * 2/97 obachman Life begins for this file. |
---|
8 | * |
---|
9 | ***************************************************************/ |
---|
10 | |
---|
11 | #include "MP.h" |
---|
12 | #include <string.h> |
---|
13 | |
---|
14 | MP_BigIntOps_t imp_dummy_bigint_ops = |
---|
15 | { |
---|
16 | IMP_PutDummyBigInt, |
---|
17 | IMP_GetDummyBigInt, |
---|
18 | IMP_DummyBigIntToStr, |
---|
19 | IMP_DummyBigIntAsciiSize |
---|
20 | }; |
---|
21 | |
---|
22 | #if MP_DEFAULT_APINT_FORMAT == MP_DUMMY |
---|
23 | MP_BigIntOps_t imp_default_bigint_ops = |
---|
24 | { |
---|
25 | IMP_PutDummyBigInt, |
---|
26 | IMP_GetDummyBigInt, |
---|
27 | IMP_DummyBigIntToStr, |
---|
28 | IMP_DummyBigIntAsciiSize |
---|
29 | }; |
---|
30 | |
---|
31 | MP_BigNumFormat_t imp_default_bigint_format = MP_DUMMY; |
---|
32 | #endif |
---|
33 | |
---|
34 | MP_BigRealOps_t imp_dummy_bigreal_ops = |
---|
35 | { |
---|
36 | IMP_PutDummyBigReal, |
---|
37 | IMP_GetDummyBigReal, |
---|
38 | IMP_DummyBigRealToStr, |
---|
39 | IMP_DummyBigRealAsciiSize |
---|
40 | }; |
---|
41 | |
---|
42 | #if MP_DEFAULT_APREAL_FORMAT == MP_DUMMY |
---|
43 | MP_BigRealOps_t imp_default_bigreal_ops = |
---|
44 | { |
---|
45 | IMP_PutDummyBigReal, |
---|
46 | IMP_GetDummyBigReal, |
---|
47 | IMP_DummyBigRealToStr, |
---|
48 | IMP_DummyBigRealAsciiSize |
---|
49 | }; |
---|
50 | MP_BigNumFormat_t imp_default_bigreal_format = MP_DUMMY; |
---|
51 | #endif |
---|
52 | |
---|
53 | MP_Status_t IMP_PutDummyBigInt(MP_Link_pt link, MP_ApInt_t dummy) |
---|
54 | { |
---|
55 | return MP_SetError(link, MP_DummyBigNum); |
---|
56 | } |
---|
57 | |
---|
58 | MP_Status_t IMP_GetDummyBigInt(MP_Link_pt link, MP_ApInt_t *dummy) |
---|
59 | { |
---|
60 | return MP_SetError(link, MP_DummyBigNum); |
---|
61 | } |
---|
62 | |
---|
63 | #define DUMMY_BIGNUM_STR "MP_DummyBigNum" |
---|
64 | char* IMP_DummyBigIntToStr(MP_ApInt_t dummy, char *buf) |
---|
65 | { |
---|
66 | strcpy(buf, DUMMY_BIGNUM_STR); |
---|
67 | return buf; |
---|
68 | } |
---|
69 | |
---|
70 | long IMP_DummyBigIntAsciiSize(MP_ApInt_t dummy) |
---|
71 | { |
---|
72 | return strlen(DUMMY_BIGNUM_STR) + 1; |
---|
73 | } |
---|
74 | |
---|
75 | MP_Status_t IMP_PutDummyBigReal(MP_Link_pt link, MP_ApReal_t dummy) |
---|
76 | { |
---|
77 | return MP_SetError(link, MP_DummyBigNum); |
---|
78 | } |
---|
79 | |
---|
80 | MP_Status_t IMP_GetDummyBigReal(MP_Link_pt link, MP_ApReal_t *dummy) |
---|
81 | { |
---|
82 | return MP_SetError(link, MP_DummyBigNum); |
---|
83 | } |
---|
84 | |
---|
85 | #define DUMMY_BIGNUM_STR "MP_DummyBigNum" |
---|
86 | char* IMP_DummyBigRealToStr(MP_ApReal_t dummy, char *buf) |
---|
87 | { |
---|
88 | strcpy(buf, "MP_DummyBigNum"); |
---|
89 | return buf; |
---|
90 | } |
---|
91 | |
---|
92 | long IMP_DummyBigRealAsciiSize(MP_ApReal_t dummy) |
---|
93 | { |
---|
94 | return strlen(DUMMY_BIGNUM_STR) + 1; |
---|
95 | } |
---|
96 | |
---|