aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/r
diff options
context:
space:
mode:
authorEduardo Julian2018-07-31 20:22:15 -0400
committerEduardo Julian2018-07-31 20:22:15 -0400
commit7e44ee8a2cfb14e35f6283a9eb8d6a2ddc8bd99a (patch)
tree98a12aa5a9fd347c1070612a2a1dae69dae879b1 /new-luxc/source/luxc/lang/translation/r
parenteea58ee669f69fddf2cef9e1675c41959e2e0a55 (diff)
Now implementing process functionality in stdlib instead of the compiler.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux18
-rw-r--r--new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux57
-rw-r--r--new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux18
-rw-r--r--new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux14
4 files changed, 0 insertions, 107 deletions
diff --git a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux
index d8f4f4662..d8b383ff2 100644
--- a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux
@@ -371,23 +371,6 @@
(install "read" (unary box//read))
(install "write" (binary box//write)))))
-## [[Processes]]
-(def: (process//parallelism-level [])
- Nullary
- (r.int 1))
-
-(def: (process//schedule [milli-secondsO procedureO])
- Binary
- (runtimeT.process//schedule milli-secondsO procedureO))
-
-(def: process-procs
- Bundle
- (<| (prefix "process")
- (|> (dict.new text.Hash<Text>)
- (install "parallelism-level" (nullary process//parallelism-level))
- (install "schedule" (binary process//schedule))
- )))
-
## [Bundles]
(def: #export procedures
Bundle
@@ -400,5 +383,4 @@
(dict.merge array-procs)
(dict.merge io-procs)
(dict.merge box-procs)
- (dict.merge process-procs)
)))
diff --git a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux
index ee46836cb..dff7c4ae1 100644
--- a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux
@@ -774,62 +774,6 @@
($_ r.then
@@box//write))
-(def: process//incoming
- SVar
- (r.var (lang.normalize-name "process//incoming")))
-
-(def: (list-append! value rlist)
- (-> Expression SVar Expression)
- (r.set-nth! (|> (@@ rlist) r.length (r.+ (r.int 1)))
- value
- rlist))
-
-(runtime: (process//loop _)
- (let [empty (r.list (list))]
- (with-vars [queue process]
- (let [migrate-incoming! ($_ r.then
- (r.set! queue empty)
- (<| (r.for-in process (@@ process//incoming))
- (list-append! (@@ process) queue))
- (r.set! process//incoming empty))
- consume-queue! (<| (r.for-in process (@@ queue))
- (r.apply (list ..unit) (@@ process)))]
- ($_ r.then
- migrate-incoming!
- consume-queue!
- (r.when (|> (r.length (@@ queue)) (r.> (r.int 0)))
- (process//loop ..unit)))))))
-
-(runtime: (process//schedule milli-seconds procedure)
- (r.if (r.= (r.int 0) (@@ milli-seconds))
- ($_ r.then
- (list-append! (@@ procedure) process//incoming)
- ..unit)
- (let [to-seconds (|>> (r./ (r.float 1_000.0)))
- to-millis (|>> (r.* (r.float 1_000.0)))]
- (with-vars [start now seconds _arg elapsed-time]
- ($_ r.then
- (r.set! start current-time-float)
- (r.set! seconds (to-seconds (int//to-float (@@ milli-seconds))))
- (list-append! (r.function (list _arg)
- ($_ r.then
- (r.set! now current-time-float)
- (r.set! elapsed-time (|> (@@ now) (r.- (@@ start))))
- (r.if (|> (@@ elapsed-time) (r.>= (@@ seconds)))
- (@@ procedure)
- (process//schedule (to-millis (@@ elapsed-time))
- (@@ procedure)))))
- process//incoming)
- ..unit)))))
-
-(def: runtime//process
- Runtime
- ($_ r.then
- (r.set! process//incoming (r.list (list)))
- @@process//loop
- @@process//schedule
- ))
-
(def: runtime
Runtime
($_ r.then
@@ -846,7 +790,6 @@
runtime//array
runtime//box
runtime//io
- runtime//process
))
(def: #export artifact Text (format prefix ".r"))
diff --git a/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux
index 96d42a4a9..1f995b44b 100644
--- a/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux
@@ -412,23 +412,6 @@
(install "read" (unary box//read))
(install "write" (binary box//write)))))
-## [[Processes]]
-(def: (process//parallelism-level [])
- Nullary
- (ruby.int 1))
-
-(def: (process//schedule [milli-secondsO procedureO])
- Binary
- (runtimeT.process//schedule milli-secondsO procedureO))
-
-(def: process-procs
- Bundle
- (<| (prefix "process")
- (|> (dict.new text.Hash<Text>)
- (install "parallelism-level" (nullary process//parallelism-level))
- (install "schedule" (binary process//schedule))
- )))
-
## [Bundles]
(def: #export procedures
Bundle
@@ -441,5 +424,4 @@
(dict.merge array-procs)
(dict.merge io-procs)
(dict.merge box-procs)
- (dict.merge process-procs)
)))
diff --git a/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux
index 32ab5b10c..02de3dc7b 100644
--- a/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux
@@ -230,19 +230,6 @@
Runtime
(format @@box//write))
-(runtime: (process//schedule milli-seconds procedure)
- (ruby.block!
- (list (format "(Thread.new {"
- (ruby.when! (ruby.not (ruby.= (ruby.int 0) milli-seconds))
- (ruby.statement (ruby.apply "sleep" (list (ruby./ (ruby.float 1_000.0) milli-seconds)))))
- (ruby.statement (ruby.call (list ..unit) procedure))
- "})")
- (ruby.return! ..unit))))
-
-(def: runtime//process
- Runtime
- @@process//schedule)
-
(def: runtime
Runtime
(format runtime//lux "\n"
@@ -251,7 +238,6 @@
runtime//text "\n"
runtime//array "\n"
runtime//box "\n"
- runtime//process "\n"
))
(def: #export artifact Text (format prefix ".rb"))