From a54cf098f0c0d06bac846eeb715fb11b170b5b79 Mon Sep 17 00:00:00 2001 From: Guilherme Affonso Date: Mon, 8 Apr 2019 17:04:50 +0900 Subject: [PATCH 1/2] Add test init-ratio --- test/number.l | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/number.l b/test/number.l index 1dd45d676..1e31c32b6 100644 --- a/test/number.l +++ b/test/number.l @@ -45,6 +45,9 @@ (assert (eq (= 0 -0.0) t) "(= 0 -0.0) is true.") ) +(deftest init-ratio + (assert (= 1/2 (instance ratio :init 1 2)))) + (eval-when (load eval) (run-all-tests) (exit)) From dd90d9f3a677260e4099cb29d44ad448673d46e3 Mon Sep 17 00:00:00 2001 From: Guilherme Affonso Date: Sat, 6 Apr 2019 17:33:19 +0900 Subject: [PATCH 2/2] Add :init to ratio --- lib/eus.init.l | 2 +- lisp/Makefile.Alpha | 1 + lisp/Makefile.SunOS4.sub | 5 ++++- lisp/Makefile.generic2 | 5 ++++- lisp/l/compfiles.l | 2 +- lisp/l/eusstart.l | 1 + lisp/l/extnum.l | 6 ++++-- lisp/tool/compile_l.l | 3 ++- 8 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/eus.init.l b/lib/eus.init.l index e177e820c..3e575c48a 100644 --- a/lib/eus.init.l +++ b/lib/eus.init.l @@ -14,7 +14,7 @@ ( "readmacro" "object" "packsym" "common" "constants" "stream" "string" "loader" "pprint" "process" - "hashtab" "array" "mathtran" "eusdebug" "eusforeign" + "hashtab" "array" "mathtran" "eusdebug" "eusforeign" "extnum" "par" ;; TOPLEVEL "tty" "history" "toplevel" diff --git a/lisp/Makefile.Alpha b/lisp/Makefile.Alpha index 1cc8d3598..b887f7574 100644 --- a/lisp/Makefile.Alpha +++ b/lisp/Makefile.Alpha @@ -136,6 +136,7 @@ $(LDIR)/string.l: $(LDIR)/array.l: $(LDIR)/hashtab.l: $(LDIR)/eusforeign.l: +$(LDIR)/extnum.l: $(LDIR)/mathtran.l: $(LDIR)/toplevel.l: $(LDIR)/tty.l: diff --git a/lisp/Makefile.SunOS4.sub b/lisp/Makefile.SunOS4.sub index f6766ea46..075b1157e 100644 --- a/lisp/Makefile.SunOS4.sub +++ b/lisp/Makefile.SunOS4.sub @@ -55,7 +55,8 @@ LOBJECTS= $(OBJDIR)/readmacro.o\ $(OBJDIR)/coordinates.o \ $(OBJDIR)/string.o $(OBJDIR)/array.o \ $(OBJDIR)/hashtab.o \ - $(OBJDIR)/eusforeign.o $(OBJDIR)/mathtran.o \ + $(OBJDIR)/eusforeign.o $(OBJDIR)/extnum.o \ + $(OBJDIR)/mathtran.o \ $(OBJDIR)/toplevel.o \ $(OBJDIR)/tty.o $(OBJDIR)/history.o \ $(OBJDIR)/eushelp.o @@ -370,6 +371,7 @@ eustag : $(EUSDIR)/$(LDIR)/toplevel.l \ $(EUSDIR)/$(LDIR)/hashtab.l \ $(EUSDIR)/$(LDIR)/eusforeign.l \ + $(EUSDIR)/$(LDIR)/extnum.l \ $(EUSDIR)/$(LDIR)/mathtran.l \ $(EUSDIR)/$(GEODIR)/geopack.l \ $(EUSDIR)/$(GEODIR)/geobody.l \ @@ -437,6 +439,7 @@ $(OBJDIR)/string.o: $(LDIR)/string.l $(OBJDIR)/array.o: $(LDIR)/array.l $(OBJDIR)/hashtab.o: $(LDIR)/hashtab.l $(OBJDIR)/eusforeign.o: $(LDIR)/eusforeign.l +$(OBJDIR)/extnum.o: $(LDIR)/extnum.l $(OBJDIR)/mathtran.o: $(LDIR)/mathtran.l $(OBJDIR)/toplevel.o: $(LDIR)/toplevel.l $(OBJDIR)/tty.o: $(LDIR)/tty.l diff --git a/lisp/Makefile.generic2 b/lisp/Makefile.generic2 index 3c7cdabe0..0b5410059 100644 --- a/lisp/Makefile.generic2 +++ b/lisp/Makefile.generic2 @@ -54,7 +54,8 @@ LOBJECTS= $(OBJDIR)/readmacro.o\ $(OBJDIR)/coordinates.o \ $(OBJDIR)/string.o $(OBJDIR)/array.o \ $(OBJDIR)/hashtab.o \ - $(OBJDIR)/eusforeign.o $(OBJDIR)/mathtran.o \ + $(OBJDIR)/eusforeign.o $(OBJDIR)/extnum.o \ + $(OBJDIR)/mathtran.o \ $(OBJDIR)/toplevel.o \ $(OBJDIR)/tty.o $(OBJDIR)/history.o \ $(OBJDIR)/eushelp.o @@ -384,6 +385,7 @@ eustag : $(EUSDIR)/$(LDIR)/toplevel.l \ $(EUSDIR)/$(LDIR)/hashtab.l \ $(EUSDIR)/$(LDIR)/eusforeign.l \ + $(EUSDIR)/$(LDIR)/extnum.l \ $(EUSDIR)/$(LDIR)/mathtran.l \ $(EUSDIR)/$(GEODIR)/geopack.l \ $(EUSDIR)/$(GEODIR)/geobody.l \ @@ -453,6 +455,7 @@ $(OBJDIR)/string.o: $(LDIR)/string.l $(OBJDIR)/array.o: $(LDIR)/array.l $(OBJDIR)/hashtab.o: $(LDIR)/hashtab.l $(OBJDIR)/eusforeign.o: $(LDIR)/eusforeign.l +$(OBJDIR)/extnum.o: $(LDIR)/extnum.l $(OBJDIR)/mathtran.o: $(LDIR)/mathtran.l $(OBJDIR)/toplevel.o: $(LDIR)/toplevel.l $(OBJDIR)/tty.o: $(LDIR)/tty.l diff --git a/lisp/l/compfiles.l b/lisp/l/compfiles.l index 7089f7661..6cb8b337f 100644 --- a/lisp/l/compfiles.l +++ b/lisp/l/compfiles.l @@ -9,7 +9,7 @@ (compile-file "process.l" :cc nil) (compile-file "hashtab.l" :cc nil) (compile-file "array.l" :cc nil) -(compile-file "mathtran.l" :cc nil) +(compile-file "extnum.l" :cc nil) (compile-file "mathtran.l" :cc nil) (compile-file "eusdebug.l" :cc nil) (in-package "GEO") diff --git a/lisp/l/eusstart.l b/lisp/l/eusstart.l index 932556a6e..ed41d85f7 100644 --- a/lisp/l/eusstart.l +++ b/lisp/l/eusstart.l @@ -313,6 +313,7 @@ (system::exec-module-init "mathtran" "l/mathtran.l") (system::exec-module-init "eusdebug" "l/eusdebug.l") (system::exec-module-init "eusforeign" "l/eusforeign.l") +(system::exec-module-init "extnum" "l/extnum.l") (unless (find-package "GEOMETRY") (make-package "GEOMETRY" :nicknames '("GEO")) (in-package "GEOMETRY")) diff --git a/lisp/l/extnum.l b/lisp/l/extnum.l index d333e95b8..596579b15 100644 --- a/lisp/l/extnum.l +++ b/lisp/l/extnum.l @@ -1,4 +1,6 @@ (defmethod ratio - (:prin1 (&optional (strm t)) - (format strm "~d/~d" numerator denominator)) + (:init (num denom) + (setq numerator num + denominator denom) + self) ) diff --git a/lisp/tool/compile_l.l b/lisp/tool/compile_l.l index a09120d68..c9471d188 100644 --- a/lisp/tool/compile_l.l +++ b/lisp/tool/compile_l.l @@ -43,7 +43,8 @@ (comp::compile-file-if-src-newer "string.l" *objdir*) (comp::compile-file-if-src-newer "array.l" *objdir*) (comp::compile-file-if-src-newer "hashtab.l" *objdir*) -(comp::compile-file-if-src-newer "eusforeign.l" *objdir*) +(comp::compile-file-if-src-newer "eusforeign.l" *objdir*) +(comp::compile-file-if-src-newer "extnum.l" *objdir*) (comp::compile-file-if-src-newer "mathtran.l" *objdir*) (comp::compile-file-if-src-newer "toplevel.l" *objdir*) (comp::compile-file-if-src-newer "tty.l" *objdir*)