aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/lua
diff options
context:
space:
mode:
authorEduardo Julian2018-05-07 01:37:38 -0400
committerEduardo Julian2018-05-07 01:37:38 -0400
commitfebfa99c2823219c2e76d2c73b1fd8db8f6c9918 (patch)
treef521419a80b04f465c6c9c5020c2063e2e555895 /new-luxc/source/luxc/lang/translation/lua
parent3e2fddc6bfdda56dbe6947c476f85760b0811654 (diff)
- Implemented Deg functionality in pure Lux.
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/lua')
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux34
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux60
2 files changed, 0 insertions, 94 deletions
diff --git a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux
index a9849b557..d751c6781 100644
--- a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux
@@ -200,9 +200,6 @@
[frac//smallest Double::MIN_VALUE lua.float]
[frac//min (f/* -1.0 Double::MAX_VALUE) lua.float]
[frac//max Double::MAX_VALUE lua.float]
-
- [deg//min 0 lua.int]
- [deg//max -1 lua.int]
)
(do-template [<name> <expression>]
@@ -234,14 +231,6 @@
[int//mul lua.*]
[int//div lua.//]
[int//rem lua.%]
-
- [deg//add lua.+]
- [deg//sub lua.-]
- [deg//mul runtimeT.deg//*]
- [deg//div runtimeT.deg///]
- [deg//rem lua.-]
- [deg//scale lua.*]
- [deg//reciprocal lua.//]
)
(do-template [<name> <op>]
@@ -268,8 +257,6 @@
[int//= lua.=]
[int//< lua.<]
- [deg//= lua.=]
- [deg//< lua.<]
)
(def: frac//encode
@@ -287,7 +274,6 @@
(lua./ <divisor> inputO))]
[int//to-frac (lua.float 1.0)]
- [deg//to-frac (lua.bit-shl (lua.int 32) (lua.int 1))]
)
(do-template [<name> <transform>]
@@ -296,7 +282,6 @@
(|> inputO <transform>))]
[frac//to-int (<| (lua.apply "math.floor") (list))]
- [frac//to-deg runtimeT.deg//from-frac]
[text//hash runtimeT.text//hash]
)
@@ -462,23 +447,6 @@
(install "to-frac" (unary int//to-frac))
(install "char" (unary int//char)))))
-(def: deg-procs
- Bundle
- (<| (prefix "deg")
- (|> (dict.new text.Hash<Text>)
- (install "+" (binary deg//add))
- (install "-" (binary deg//sub))
- (install "*" (binary deg//mul))
- (install "/" (binary deg//div))
- (install "%" (binary deg//rem))
- (install "=" (binary deg//=))
- (install "<" (binary deg//<))
- (install "scale" (binary deg//scale))
- (install "reciprocal" (binary deg//reciprocal))
- (install "min" (nullary deg//min))
- (install "max" (nullary deg//max))
- (install "to-frac" (unary deg//to-frac)))))
-
(def: frac-procs
Bundle
(<| (prefix "frac")
@@ -496,7 +464,6 @@
(install "not-a-number" (nullary frac//not-a-number))
(install "positive-infinity" (nullary frac//positive-infinity))
(install "negative-infinity" (nullary frac//negative-infinity))
- (install "to-deg" (unary frac//to-deg))
(install "to-int" (unary frac//to-int))
(install "encode" (unary frac//encode))
(install "decode" (unary frac//decode)))))
@@ -585,7 +552,6 @@
(|> lux-procs
(dict.merge bit-procs)
(dict.merge int-procs)
- (dict.merge deg-procs)
(dict.merge frac-procs)
(dict.merge text-procs)
(dict.merge array-procs)
diff --git a/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux
index cd5d0c090..de2d574ec 100644
--- a/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux
@@ -197,65 +197,6 @@
(format @@bit//count
@@bit//logical-right-shift))
-(runtime: deg//low-mask
- (|> (lua.int 1)
- (lua.bit-shl (lua.int 32))
- (lua.- (lua.int 1))))
-
-(runtime: (deg//* param subject)
- (lua.block! (list (lua.local! "sL" (#.Some (lua.bit-and deg//low-mask subject)))
- (lua.local! "sH" (#.Some (bit//logical-right-shift (lua.int 32) subject)))
- (lua.local! "pL" (#.Some (lua.bit-and deg//low-mask param)))
- (lua.local! "pH" (#.Some (bit//logical-right-shift (lua.int 32) param)))
- (lua.local! "bottom" (#.Some (bit//logical-right-shift (lua.int 32)
- (lua.* "pL" "sL"))))
- (lua.local! "middle" (#.Some (lua.+ (lua.* "pL" "sH")
- (lua.* "pH" "sL"))))
- (lua.local! "top" (#.Some (lua.* "pH" "sH")))
- (lua.return! (|> "bottom"
- (lua.+ "middle")
- (bit//logical-right-shift (lua.int 32))
- (lua.+ "top"))))))
-
-(runtime: (deg//leading-zeroes input)
- (lua.block! (list (lua.local! "zeroes" (#.Some (lua.int 64)))
- (lua.while! (lua.not (lua.= (lua.int 0) input))
- (lua.block! (list (lua.set! "zeroes" (lua.- (lua.int 1) "zeroes"))
- (lua.set! input (bit//logical-right-shift (lua.int 1) input)))))
- (lua.return! "zeroes"))))
-
-(runtime: (deg/// param subject)
- (lua.if! (lua.= param subject)
- (lua.return! (lua.int -1))
- (lua.block! (list (lua.local! "min_shift" (#.Some (lua.apply "math.min" (list (deg//leading-zeroes param)
- (deg//leading-zeroes subject)))))
- (lua.return! (|> (lua.bit-shl "min_shift" subject)
- (lua.// (|> (lua.bit-shl "min_shift" param)
- (lua.bit-and deg//low-mask)))
- (lua.bit-shl (lua.int 32))))))))
-
-(runtime: (deg//from-frac input)
- (let [->int (|>> (list) (lua.apply "math.floor"))]
- (lua.block! (list (lua.local! "two32" (#.Some (lua.apply "math.pow" (list (lua.float 2.0) (lua.float 32.0)))))
- (lua.local! "shifted" (#.Some (|> input
- (lua.% (lua.float 1.0))
- (lua.* "two32"))))
- (lua.local! "low" (#.Some (|> "shifted"
- (lua.% (lua.float 1.0))
- (lua.* "two32")
- ->int)))
- (lua.local! "high" (#.Some (|> "shifted" ->int)))
- (lua.return! (lua.+ (lua.bit-shl (lua.int 32) "high")
- "low"))))))
-
-(def: runtime//deg
- Runtime
- (format @@deg//low-mask
- @@deg//*
- @@deg//leading-zeroes
- @@deg///
- @@deg//from-frac))
-
(runtime: (text//index subject param start)
(lua.block! (list (lua.local! "idx" (#.Some (lua.apply "string.find" (list subject param start (lua.bool true)))))
(lua.if! (lua.= lua.nil "idx")
@@ -447,7 +388,6 @@
(format runtime//lux
runtime//adt
runtime//bit
- runtime//deg
runtime//text
runtime//array
runtime//atom