aboutsummaryrefslogtreecommitdiff
path: root/environment.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-11-05 15:18:32 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-11-05 15:18:32 -0500
commitb8d7eabc023bf9db0150049d8e909086f6ad91bc (patch)
tree5b678c7949638b3f07095affc04611f0422ef8c7 /environment.c
parent2fa26e6af3ec1599396d9260ef44b0d035b1f686 (diff)
Deprecate bit-width integer/num literals in favor of using type
constructors
Diffstat (limited to 'environment.c')
-rw-r--r--environment.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/environment.c b/environment.c
index 47e30dba..6ae96291 100644
--- a/environment.c
+++ b/environment.c
@@ -48,7 +48,8 @@ env_t *new_compilation_unit(CORD libname)
arg_t, .name="message", .type=Type(OptionalType, .type=Type(TextType)),
.default_val=FakeAST(Null, .type=new(type_ast_t, .tag=VarTypeAST, .__data.VarTypeAST.name="Text")),
.next=new(arg_t, .name="code", .type=Type(IntType, .bits=TYPE_IBITS32),
- .default_val=FakeAST(Int, .bits=IBITS32, .str="1"))), .ret=Type(AbortType))}},
+ .default_val=FakeAST(InlineCCode, .code="1", .type=Type(IntType, .bits=TYPE_IBITS32)))),
+ .ret=Type(AbortType))}},
{"fail", {.code="fail", .type=Type(FunctionType, .args=new(arg_t, .name="message", .type=Type(CStringType)), .ret=Type(AbortType))}},
{"sleep", {.code="sleep_num", .type=Type(FunctionType, .args=new(arg_t, .name="seconds", .type=Type(NumType, .bits=TYPE_NBITS64)), .ret=Type(VoidType))}},
{"now", {.code="DateTime$now", .type=Type(FunctionType, .args=NULL, .ret=Type(DateTimeType))}},
@@ -237,7 +238,7 @@ env_t *new_compilation_unit(CORD libname)
#define F(name) {#name, #name"f", "func(n:Num32 -> Num32)"}
#define F2(name) {#name, #name"f", "func(x,y:Num32 -> Num32)"}
{"Num32", Type(NumType, .bits=TYPE_NBITS32), "Num32_t", "Num32$info", TypedArray(ns_entry_t,
- {"near", "Num32$near", "func(x,y:Num32, ratio=1e-9f32, min_epsilon=1e-9f32 -> Bool)"},
+ {"near", "Num32$near", "func(x,y:Num32, ratio=Num32(1e-9), min_epsilon=Num32(1e-9) -> Bool)"},
{"clamped", "Num32$clamped", "func(x,low,high:Num32 -> Num32)"},
{"format", "Num32$format", "func(n:Num32, precision=0 -> Text)"},
{"scientific", "Num32$scientific", "func(n:Num32, precision=0 -> Text)"},
@@ -301,12 +302,12 @@ env_t *new_compilation_unit(CORD libname)
{"year", "DateTime$year", "func(dt:DateTime,timezone=!Text -> Int)"},
)},
{"Path", Type(TextType, .lang="Path", .env=namespace_env(env, "Path")), "Text_t", "Text$info", TypedArray(ns_entry_t,
- {"append", "Path$append", "func(path:Path, text:Text, permissions=0o644[32])"},
- {"append_bytes", "Path$append_bytes", "func(path:Path, bytes:[Byte], permissions=0o644[32])"},
+ {"append", "Path$append", "func(path:Path, text:Text, permissions=Int32(0o644))"},
+ {"append_bytes", "Path$append_bytes", "func(path:Path, bytes:[Byte], permissions=Int32(0o644))"},
{"base_name", "Path$base_name", "func(path:Path -> Text)"},
{"by_line", "Path$by_line", "func(path:Path -> func(->Text?)?)"},
{"children", "Path$children", "func(path:Path, include_hidden=no -> [Path])"},
- {"create_directory", "Path$create_directory", "func(path:Path, permissions=0o755[32])"},
+ {"create_directory", "Path$create_directory", "func(path:Path, permissions=Int32(0o755))"},
{"escape_int", "Int$value_as_text", "func(i:Int -> Path)"},
{"escape_path", "Path$escape_path", "func(path:Path -> Path)"},
{"escape_text", "Path$escape_text", "func(text:Text -> Path)"},
@@ -327,8 +328,8 @@ env_t *new_compilation_unit(CORD libname)
{"resolved", "Path$resolved", "func(path:Path, relative_to=(./) -> Path)"},
{"subdirectories", "Path$children", "func(path:Path, include_hidden=no -> [Path])"},
{"unique_directory", "Path$unique_directory", "func(path:Path -> Path)"},
- {"write", "Path$write", "func(path:Path, text:Text, permissions=0o644[32])"},
- {"write_bytes", "Path$write_bytes", "func(path:Path, bytes:[Byte], permissions=0o644[32])"},
+ {"write", "Path$write", "func(path:Path, text:Text, permissions=Int32(0o644))"},
+ {"write_bytes", "Path$write_bytes", "func(path:Path, bytes:[Byte], permissions=Int32(0o644))"},
{"write_unique", "Path$write_unique", "func(path:Path, text:Text -> Path)"},
{"write_unique_bytes", "Path$write_unique_bytes", "func(path:Path, bytes:[Byte] -> Path)"},
@@ -357,7 +358,7 @@ env_t *new_compilation_unit(CORD libname)
{"int8", "RNG$int8", "func(rng:RNG, min=Int8.min, max=Int8.max -> Int8)"},
{"new", "RNG$new", "func(seed=(/dev/urandom):read_bytes(40)! -> RNG)"},
{"num", "RNG$num", "func(rng:RNG, min=0.0, max=1.0 -> Num)"},
- {"num32", "RNG$num32", "func(rng:RNG, min=0.0_f32, max=1.0_f32 -> Num32)"},
+ {"num32", "RNG$num32", "func(rng:RNG, min=Num32(0.0), max=Num32(1.0) -> Num32)"},
{"set_seed", "RNG$set_seed", "func(rng:RNG, seed:[Byte])"},
)},
{"Shell", Type(TextType, .lang="Shell", .env=namespace_env(env, "Shell")), "Shell_t", "Shell$info", TypedArray(ns_entry_t,