Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add :init to ratio #373

Merged
merged 2 commits into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/eus.init.l
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions lisp/Makefile.Alpha
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion lisp/Makefile.SunOS4.sub
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion lisp/Makefile.generic2
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lisp/l/compfiles.l
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions lisp/l/eusstart.l
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
6 changes: 4 additions & 2 deletions lisp/l/extnum.l
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
(defmethod ratio
(:prin1 (&optional (strm t))
(format strm "~d/~d" numerator denominator))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Affonso-Gui why you removed prin1 ?, please also update doc/test

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed prin1 because

  1. printratio is already doing the job https://github.com/euslisp/EusLisp/blob/master/lisp/c/printer.c#L219-L226
  2. extnum.l and its :prin1 method are currently not being loaded in euslisp.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@k-okada Added test code. There seems to be no ratio-related documentation to be updated. We can add some if that is the case, preferentially in #359 (am planning on working on that PR this week)

(:init (num denom)
(setq numerator num
denominator denom)
self)
)
3 changes: 2 additions & 1 deletion lisp/tool/compile_l.l
Original file line number Diff line number Diff line change
Expand Up @@ -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*)
Expand Down
3 changes: 3 additions & 0 deletions test/number.l
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down