aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 08:09:40 +0000
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 08:09:40 +0000
commita3e9e53e64a1aa5692bca2b60bcbff6a0fcfdba1 (patch)
tree2598c50e36e488935211c2e304b720a58315bacb /src/lib
parentembed: tests, editor support and docs; js vm file access; test fixes (diff)
lsp: quick fixes for hints and bare library names; comment cleanup
an undefined bare name that a module exports now says which one: "put_c is used but never defined; did you mean to include rt and use rt.put_c?", and the import quick fix is titled the same way and marked preferred when it is the only one, so the editor's auto-fix applies it. hints gain quick fixes that keep the program's meaning: an unused parameter, or a local with no other use, is renamed to _; a constant local with one declarator becomes const; a power-of-two multiply becomes a parenthesized shift (not when a * / or % binds its left operand); and let p = rt.new(n) with a small constant becomes let p[n]. the hints no longer fire for _ discards or for locals already declared const. whole-line /* */ comments in zc sources are // comments now, and //: is gone from the maintained sources: the notes it marked were mostly the documentation of the declaration below, which hovers now show. section headers are separated from the declarations after them.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/std.zc32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/lib/std.zc b/src/lib/std.zc
index f232422..dfa9841 100644
--- a/src/lib/std.zc
+++ b/src/lib/std.zc
@@ -13,12 +13,12 @@ include rt, run;
// the constructors arena(n) and bnew(n) and the argv helpers are plain
// functions, because an owned result has to carry its .u tag.
-//: ---- the command line and the environment ----
+// ---- the command line and the environment ----
-//: argc and argv, envc and envp, as passed to main by c. a zc string is
-//: one character per word, so an array of them is char*[?]. libinit() fills
-//: these and the runtime calls it before main, if the program has one (an
-//: image built by build_image, or a check-mode document, does not).
+// argc and argv, envc and envp, as passed to main by c. a zc string is
+// one character per word, so an array of them is char*[?]. libinit() fills
+// these and the runtime calls it before main, if the program has one (an
+// image built by build_image, or a check-mode document, does not).
int argc;
char*[?] argv;
@@ -59,7 +59,7 @@ int libinit() {
return 0;
}
-//: ---- capturing output ----
+// ---- capturing output ----
// capture.start() redirects everything the program writes into a string and
// returns it. writes go to the buffer instead of the terminal until end()
@@ -90,7 +90,7 @@ struct capture {
}
}
-//: ---- character strings ----
+// ---- character strings ----
struct Text {
// the number written in decimal at the start of s. a leading '-' makes it
@@ -246,7 +246,7 @@ struct Text {
}
}
-//: ---- numbers ----
+// ---- numbers ----
// plain integer helpers. none of them can fail: an out of range result wraps
// the same way the arithmetic does.
@@ -331,9 +331,9 @@ struct Num {
}
}
-//: ---- the host ----
+// ---- the host ----
-//: the argument block for Host.raw: the number, then its six arguments.
+// the argument block for Host.raw: the number, then its six arguments.
int rawblk[7];
struct Host {
@@ -378,7 +378,7 @@ struct Host {
}
}
-//: ---- byte strings ----
+// ---- byte strings ----
// the same helpers for packed byte strings. character-string helpers above are unchanged.
// a packed byte string has type bstr; len_s reads its stored byte length.
@@ -468,7 +468,7 @@ struct Bytes {
}
}
-//: ---- arenas ----
+// ---- arenas ----
// a region that is freed all at once.
// n: its capacity in words; values below 1 allocate one word
@@ -489,7 +489,7 @@ struct Arena {
static int reset(word a) { return rt.arena_reset(a); }
}
-//: ---- growable byte buffers ----
+// ---- growable byte buffers ----
// a byte buffer stores its length and capacity in two words, followed by the
// bytes, packed.
@@ -537,9 +537,9 @@ struct Buf {
}
}
-//: array algorithms borrow their input and visit elements in index order.
-//: map and filter return independent handles. reference elements are shared
-//: with the collector, so freeing the input does not invalidate the result.
+// array algorithms borrow their input and visit elements in index order.
+// map and filter return independent handles. reference elements are shared
+// with the collector, so freeing the input does not invalidate the result.
// the first index equal to value, or -1 when no element matches.
int array_find<T>(fixed T[?].m source, T value) {