Annotation of OpenXM/src/k097/object.kk, Revision 1.1.1.1
1.1 maekawa 1: /* object.kk , 1997, 4/11. */
2: Protect("showln",0);
3:
4: class Object extends PrimitiveObject {
5: def new0() {
6: return(Object);
7: }
8: def showln() {
9: Println(this);
10: }
11: def getClass() {
12: sm1(" this 0 get /FunctionValue set ");
13: }
14: }
15:
16: sm1(" /ectag { dup isClass not { pop -1 } { lc } ifelse } def ");
17: def k00ecTag(a) { sm1(a," ectag /FunctionValue set "); }
18: def IsObject(a) {
19: if (!IsArray(a)) return(false);
20: if (Length(a) < 1) return(false);
21: if (k00ecTag(a[0]) == k00ecTag(Object[0])) return(true);
22: else return(false);
23: }
24: HelpAdd(["IsObject",["IsObject(a) return true if a is an Object."]]);
25:
26:
27:
28: /* class Gmp. Number theoretic functions.
29: 1997, 4/17
30: */
31: class Gmp extends Object {
32: def BitAnd(a,b) {
33: sm1("[(and) ",a," ",b," ] mpzext /FunctionValue set ");
34: }
35: def BitOr(a,b) {
36: sm1("[(ior) ",a," ",b," ] mpzext /FunctionValue set ");
37: }
38: def ModuloPower(base,ex,mmod) {
39: sm1("[(powm) ",base," ",ex," ",mmod," ] mpzext /FunctionValue set ");
40: }
41: def ProbabilisticPrimeP(p,reps) {
42: sm1("[(probab_prime_p) ",p," ",reps," ] mpzext /FunctionValue set ");
43: }
44: def Sqrt(a) {
45: sm1("[(sqrt) ",a, " ] mpzext /FunctionValue set ");
46: }
47: def Gcd(a,b) {
48: sm1("[(gcd) ",a," ",b," ] mpzext /FunctionValue set ");
49: }
50: def Div(a,b) {
51: sm1("[(tdiv_qr) ",a," ",b," ] mpzext /FunctionValue set ");
52: }
53: def Mod(a,b) {
54: sm1("[(tdiv_qr) ",a," ",b," ] mpzext 1 get /FunctionValue set ");
55: }
56: }
57:
58: HelpAdd(["Gmp.",
59: ["Gmp is a class which supports the following methods:",
60: "BitAnd, BitOr, ModuloPower, ProbabilisticPrimeP, Sqrt,",
61: "Gcd, Div, Mod.",
62: "Ex. r = Gmp.Gcd(5,8); ",
63: "These methods call functions of Gnu-MP package.",
64: "The Copyright notice is in kan96xx/gmp.",
65: "Note that there is no method to create an instance."]]);
66:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>