aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/target
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/target/jvm/bytecode.lux8
-rw-r--r--stdlib/source/lux/target/jvm/constant.lux4
-rw-r--r--stdlib/source/lux/target/jvm/constant/pool.lux2
-rw-r--r--stdlib/source/lux/target/jvm/loader.lux24
-rw-r--r--stdlib/source/lux/target/jvm/reflection.lux22
-rw-r--r--stdlib/source/lux/target/lua.lux15
-rw-r--r--stdlib/source/lux/target/php.lux15
-rw-r--r--stdlib/source/lux/target/python.lux6
-rw-r--r--stdlib/source/lux/target/ruby.lux15
-rw-r--r--stdlib/source/lux/target/scheme.lux12
10 files changed, 40 insertions, 83 deletions
diff --git a/stdlib/source/lux/target/jvm/bytecode.lux b/stdlib/source/lux/target/jvm/bytecode.lux
index a319ef2a7..d79ba042a 100644
--- a/stdlib/source/lux/target/jvm/bytecode.lux
+++ b/stdlib/source/lux/target/jvm/bytecode.lux
@@ -1,6 +1,6 @@
(.module:
[lux (#- Type int)
- ["." host (#+ import:)]
+ ["." ffi (#+ import:)]
[abstract
[monoid (#+ Monoid)]
["." monad (#+ Monad do)]]
@@ -507,18 +507,18 @@
(def: float_bits
(-> java/lang/Float Int)
(|>> java/lang/Float::floatToRawIntBits
- host.int_to_long
+ ffi.int_to_long
(:coerce Int)))
(def: negative_zero_float_bits
- (|> -0.0 (:coerce java/lang/Double) host.double_to_float ..float_bits))
+ (|> -0.0 (:coerce java/lang/Double) ffi.double_to_float ..float_bits))
(def: #export (float value)
(-> java/lang/Float (Bytecode Any))
(if (i.= ..negative_zero_float_bits
(..float_bits value))
(..arbitrary_float value)
- (case (|> value host.float_to_double (:coerce Frac))
+ (case (|> value ffi.float_to_double (:coerce Frac))
(^template [<special> <instruction>]
[<special> (..bytecode $0 $1 @_ <instruction> [])])
([+0.0 _.fconst_0]
diff --git a/stdlib/source/lux/target/jvm/constant.lux b/stdlib/source/lux/target/jvm/constant.lux
index fbfbfebb3..5d44dfbd6 100644
--- a/stdlib/source/lux/target/jvm/constant.lux
+++ b/stdlib/source/lux/target/jvm/constant.lux
@@ -1,6 +1,6 @@
(.module:
[lux #*
- ["." host (#+ import:)]
+ ["." ffi (#+ import:)]
["@" target]
[abstract
[monad (#+ do)]
@@ -118,7 +118,7 @@
(~~ (template.splice <writer>)))))]
[integer_writer Integer [] [binaryF.bits/32]]
- [float_writer Float [java/lang/Float::floatToRawIntBits host.int_to_long (:coerce I64)] [i32.i32 binaryF.bits/32]]
+ [float_writer Float [java/lang/Float::floatToRawIntBits ffi.int_to_long (:coerce I64)] [i32.i32 binaryF.bits/32]]
[long_writer Long [] [binaryF.bits/64]]
[double_writer Double [java/lang/Double::doubleToRawLongBits] [binaryF.bits/64]]
[string_writer String [] [//index.writer]]
diff --git a/stdlib/source/lux/target/jvm/constant/pool.lux b/stdlib/source/lux/target/jvm/constant/pool.lux
index 95dac3986..8f378ed00 100644
--- a/stdlib/source/lux/target/jvm/constant/pool.lux
+++ b/stdlib/source/lux/target/jvm/constant/pool.lux
@@ -1,6 +1,6 @@
(.module:
[lux #*
- ["." host]
+ ["." ffi]
[abstract
[equivalence (#+ Equivalence)]
[monad (#+ Monad do)]]
diff --git a/stdlib/source/lux/target/jvm/loader.lux b/stdlib/source/lux/target/jvm/loader.lux
index a6a236e47..755f9526e 100644
--- a/stdlib/source/lux/target/jvm/loader.lux
+++ b/stdlib/source/lux/target/jvm/loader.lux
@@ -16,7 +16,7 @@
[collection
["." array]
["." dictionary (#+ Dictionary)]]]
- ["." host (#+ import: object do_to)]])
+ ["." ffi (#+ import: object do_to)]])
(type: #export Library
(Atom (Dictionary Text Binary)))
@@ -65,17 +65,17 @@
(with_expansions [<elemT> (as_is (java/lang/Class java/lang/Object))]
(def: java/lang/ClassLoader::defineClass
java/lang/reflect/Method
- (let [signature (|> (host.array <elemT> 4)
- (host.array_write 0 (:coerce <elemT>
- (host.class_for java/lang/String)))
- (host.array_write 1 (java/lang/Object::getClass (host.array byte 0)))
- (host.array_write 2 (:coerce <elemT>
- (java/lang/Integer::TYPE)))
- (host.array_write 3 (:coerce <elemT>
- (java/lang/Integer::TYPE))))]
+ (let [signature (|> (ffi.array <elemT> 4)
+ (ffi.array_write 0 (:coerce <elemT>
+ (ffi.class_for java/lang/String)))
+ (ffi.array_write 1 (java/lang/Object::getClass (ffi.array byte 0)))
+ (ffi.array_write 2 (:coerce <elemT>
+ (java/lang/Integer::TYPE)))
+ (ffi.array_write 3 (:coerce <elemT>
+ (java/lang/Integer::TYPE))))]
(do_to (java/lang/Class::getDeclaredMethod "defineClass"
signature
- (host.class_for java/lang/ClassLoader))
+ (ffi.class_for java/lang/ClassLoader))
(java/lang/reflect/AccessibleObject::setAccessible true)))))
(def: #export (define class_name bytecode loader)
@@ -87,12 +87,12 @@
(:coerce java/lang/Object
(|> 0
(:coerce (primitive "java.lang.Long"))
- host.long_to_int))
+ ffi.long_to_int))
(:coerce java/lang/Object
(|> bytecode
binary.size
(:coerce (primitive "java.lang.Long"))
- host.long_to_int))))]
+ ffi.long_to_int))))]
(java/lang/reflect/Method::invoke loader signature java/lang/ClassLoader::defineClass)))
(def: #export (new_library _)
diff --git a/stdlib/source/lux/target/jvm/reflection.lux b/stdlib/source/lux/target/jvm/reflection.lux
index bb0a388e9..07afd5df0 100644
--- a/stdlib/source/lux/target/jvm/reflection.lux
+++ b/stdlib/source/lux/target/jvm/reflection.lux
@@ -1,6 +1,6 @@
(.module:
[lux (#- type)
- ["." host (#+ import:)]
+ ["." ffi (#+ import:)]
["." type]
[abstract
["." monad (#+ do)]]
@@ -142,7 +142,7 @@
(-> (-> java/lang/reflect/Type (Try (/.Type Parameter)))
java/lang/reflect/Type
(Try (/.Type Class)))
- (<| (case (host.check java/lang/Class reflection)
+ (<| (case (ffi.check java/lang/Class reflection)
(#.Some class)
(let [class_name (|> class
(:coerce (java/lang/Class java/lang/Object))
@@ -163,10 +163,10 @@
(exception.throw ..not_a_class reflection)
(#try.Success (/.class class_name (list))))))
_)
- (case (host.check java/lang/reflect/ParameterizedType reflection)
+ (case (ffi.check java/lang/reflect/ParameterizedType reflection)
(#.Some reflection)
(let [raw (java/lang/reflect/ParameterizedType::getRawType reflection)]
- (case (host.check java/lang/Class raw)
+ (case (ffi.check java/lang/Class raw)
(#.Some raw)
(do {! try.monad}
[paramsT (|> reflection
@@ -186,11 +186,11 @@
(def: #export (parameter reflection)
(-> java/lang/reflect/Type (Try (/.Type Parameter)))
- (<| (case (host.check java/lang/reflect/TypeVariable reflection)
+ (<| (case (ffi.check java/lang/reflect/TypeVariable reflection)
(#.Some reflection)
(#try.Success (/.var (java/lang/reflect/TypeVariable::getName reflection)))
_)
- (case (host.check java/lang/reflect/WildcardType reflection)
+ (case (ffi.check java/lang/reflect/WildcardType reflection)
(#.Some reflection)
## TODO: Instead of having single lower/upper bounds, should
## allow for multiple ones.
@@ -198,7 +198,7 @@
(array.read 0 (java/lang/reflect/WildcardType::getUpperBounds reflection))]
(^template [<pattern> <kind>]
[<pattern>
- (case (host.check java/lang/reflect/GenericArrayType bound)
+ (case (ffi.check java/lang/reflect/GenericArrayType bound)
(#.Some _)
## TODO: Array bounds should not be "erased" as they
## are right now.
@@ -221,7 +221,7 @@
(def: #export (type reflection)
(-> java/lang/reflect/Type (Try (/.Type Value)))
- (<| (case (host.check java/lang/Class reflection)
+ (<| (case (ffi.check java/lang/Class reflection)
(#.Some reflection)
(let [class_name (|> reflection
(:coerce (java/lang/Class java/lang/Object))
@@ -243,7 +243,7 @@
(<t>.run /parser.value (|> class_name //name.internal //name.read))
(#try.Success (/.class class_name (list)))))))
_)
- (case (host.check java/lang/reflect/GenericArrayType reflection)
+ (case (ffi.check java/lang/reflect/GenericArrayType reflection)
(#.Some reflection)
(|> reflection
java/lang/reflect/GenericArrayType::getGenericComponentType
@@ -256,7 +256,7 @@
(def: #export (return reflection)
(-> java/lang/reflect/Type (Try (/.Type Return)))
(with_expansions [<else> (as_is (..type reflection))]
- (case (host.check java/lang/Class reflection)
+ (case (ffi.check java/lang/Class reflection)
(#.Some class)
(let [class_name (|> reflection
(:coerce (java/lang/Class java/lang/Object))
@@ -358,7 +358,7 @@
(def: #export deprecated?
(-> (array.Array java/lang/annotation/Annotation) Bit)
(|>> array.to_list
- (list.all (|>> (host.check java/lang/Deprecated)))
+ (list.all (|>> (ffi.check java/lang/Deprecated)))
list.empty?
not))
diff --git a/stdlib/source/lux/target/lua.lux b/stdlib/source/lux/target/lua.lux
index 4213cd339..144fc2d7b 100644
--- a/stdlib/source/lux/target/lua.lux
+++ b/stdlib/source/lux/target/lua.lux
@@ -1,7 +1,6 @@
(.module:
[lux (#- Location Code int if cond function or and not let ^)
["@" target]
- ["." host]
[abstract
[equivalence (#+ Equivalence)]
[hash (#+ Hash)]
@@ -27,21 +26,11 @@
[type
abstract]])
-(for {@.old (as_is (host.import: java/lang/CharSequence)
- (host.import: java/lang/String
- ["#::."
- (replace [java/lang/CharSequence java/lang/CharSequence] java/lang/String)]))}
- (as_is))
-
(def: nest
(-> Text Text)
(.let [nested_new_line (format text.new_line text.tab)]
- (for {@.old (|>> (format text.new_line)
- (:coerce java/lang/String)
- (java/lang/String::replace (:coerce java/lang/CharSequence text.new_line)
- (:coerce java/lang/CharSequence nested_new_line)))}
- (|>> (format text.new_line)
- (text.replace_all text.new_line nested_new_line)))))
+ (|>> (format text.new_line)
+ (text.replace_all text.new_line nested_new_line))))
(def: input_separator ", ")
diff --git a/stdlib/source/lux/target/php.lux b/stdlib/source/lux/target/php.lux
index 9ef2511a7..5b976a325 100644
--- a/stdlib/source/lux/target/php.lux
+++ b/stdlib/source/lux/target/php.lux
@@ -1,7 +1,6 @@
(.module:
[lux (#- Location Code Global static int if cond or and not comment for)
["@" target]
- ["." host]
[abstract
[equivalence (#+ Equivalence)]
[hash (#+ Hash)]
@@ -29,21 +28,11 @@
(def: input_separator ", ")
(def: statement_suffix ";")
-(.for {@.old (as_is (host.import: java/lang/CharSequence)
- (host.import: java/lang/String
- ["#::."
- (replace [java/lang/CharSequence java/lang/CharSequence] java/lang/String)]))}
- (as_is))
-
(def: nest
(-> Text Text)
(.let [nested_new_line (format text.new_line text.tab)]
- (.for {@.old (|>> (format text.new_line)
- (:coerce java/lang/String)
- (java/lang/String::replace (:coerce java/lang/CharSequence text.new_line)
- (:coerce java/lang/CharSequence nested_new_line)))}
- (|>> (format text.new_line)
- (text.replace_all text.new_line nested_new_line)))))
+ (|>> (format text.new_line)
+ (text.replace_all text.new_line nested_new_line))))
(def: block
(-> Text Text)
diff --git a/stdlib/source/lux/target/python.lux b/stdlib/source/lux/target/python.lux
index 1ae1cca64..77cc7cf28 100644
--- a/stdlib/source/lux/target/python.lux
+++ b/stdlib/source/lux/target/python.lux
@@ -1,7 +1,7 @@
(.module:
[lux (#- Location Code not or and list if cond int comment exec)
["@" target]
- ["." host]
+ ["." ffi]
[abstract
[equivalence (#+ Equivalence)]
[hash (#+ Hash)]
@@ -30,8 +30,8 @@
(-> Text Text)
(text.enclose ["(" ")"]))
-(for {@.old (as_is (host.import: java/lang/CharSequence)
- (host.import: java/lang/String
+(for {@.old (as_is (ffi.import: java/lang/CharSequence)
+ (ffi.import: java/lang/String
["#::."
(replace [java/lang/CharSequence java/lang/CharSequence] java/lang/String)]))}
(as_is))
diff --git a/stdlib/source/lux/target/ruby.lux b/stdlib/source/lux/target/ruby.lux
index 641cc8d2e..21a47c8d0 100644
--- a/stdlib/source/lux/target/ruby.lux
+++ b/stdlib/source/lux/target/ruby.lux
@@ -1,7 +1,6 @@
(.module:
[lux (#- Location Code static int if cond function or and not comment)
["@" target]
- ["." host]
[abstract
[equivalence (#+ Equivalence)]
[hash (#+ Hash)]
@@ -29,21 +28,11 @@
(def: input_separator ", ")
(def: statement_suffix ";")
-(for {@.old (as_is (host.import: java/lang/CharSequence)
- (host.import: java/lang/String
- ["#::."
- (replace [java/lang/CharSequence java/lang/CharSequence] java/lang/String)]))}
- (as_is))
-
(def: nest
(-> Text Text)
(.let [nested_new_line (format text.new_line text.tab)]
- (for {@.old (|>> (format text.new_line)
- (:coerce java/lang/String)
- (java/lang/String::replace (:coerce java/lang/CharSequence text.new_line)
- (:coerce java/lang/CharSequence nested_new_line)))}
- (|>> (format text.new_line)
- (text.replace_all text.new_line nested_new_line)))))
+ (|>> (format text.new_line)
+ (text.replace_all text.new_line nested_new_line))))
(abstract: #export (Code brand)
Text
diff --git a/stdlib/source/lux/target/scheme.lux b/stdlib/source/lux/target/scheme.lux
index 20bb08be3..408f1d9f1 100644
--- a/stdlib/source/lux/target/scheme.lux
+++ b/stdlib/source/lux/target/scheme.lux
@@ -1,7 +1,6 @@
(.module:
[lux (#- Code int or and if cond let)
["@" target]
- ["." host]
[abstract
[equivalence (#+ Equivalence)]
[hash (#+ Hash)]]
@@ -21,19 +20,10 @@
[type
abstract]])
-(for {@.old (as_is (host.import: java/lang/CharSequence)
- (host.import: java/lang/String
- ["#::."
- (replace [java/lang/CharSequence java/lang/CharSequence] java/lang/String)]))}
- (as_is))
-
(def: nest
(-> Text Text)
(.let [nested_new_line (format text.new_line text.tab)]
- (for {@.old (|>> (:coerce java/lang/String)
- (java/lang/String::replace (:coerce java/lang/CharSequence text.new_line)
- (:coerce java/lang/CharSequence nested_new_line)))}
- (text.replace_all text.new_line nested_new_line))))
+ (text.replace_all text.new_line nested_new_line)))
(abstract: #export (Code k)
Text