Comments and the README example spell the text type str.
This commit is contained in:
parent
b92e91bcaa
commit
49e6ac6512
@ -182,7 +182,7 @@ problems:
|
||||
$ flan import-c test/headers/sample.h
|
||||
(declare-c set-seed [seed u32] "set_seed")
|
||||
(declare-c add-ints [a i32 b i32] i32 "add_ints")
|
||||
(declare-c name-length [text string] i32 "name_length")
|
||||
(declare-c name-length [text str] i32 "name_length")
|
||||
...
|
||||
;; 9 imported, 12 refused, of 22 functions in test/headers/sample.h
|
||||
;; refused owned-text: owned_text returns char *, which the caller owns and
|
||||
|
||||
@ -1951,7 +1951,7 @@ let source = {flan|
|
||||
;; stopped being true when `Vec` landed, and most of the list has moved up into
|
||||
;; the building section above: join, concat, split, to-lower, to-upper, repeat
|
||||
;; and replace are all written now, and `string-from-bytes` turned out to be
|
||||
;; the `string` builtin all along — (string (slice v)) is the round trip,
|
||||
;; the `str` builtin all along — (str (slice v)) is the round trip,
|
||||
;; and the layouts being identical is exactly why it is free.
|
||||
;;
|
||||
;; What is left is refused for four *different* reasons, which is why they are
|
||||
|
||||
@ -778,7 +778,7 @@ void flan_dev_watch_end(void) {
|
||||
/* These are the whole feature for a scalar, and they are what a program can
|
||||
* use today:
|
||||
*
|
||||
* (declare-c watch-i64 [name string x i64] i32 "flan_dev_watch_i64")
|
||||
* (declare-c watch-i64 [name str x i64] i32 "flan_dev_watch_i64")
|
||||
* ...
|
||||
* (watch-i64 "ticks" ticks)
|
||||
*
|
||||
@ -901,7 +901,7 @@ void flan_dev_watch_reset(void) {
|
||||
/* Reachable from a program by [declare-c], the same as the four scalars and
|
||||
* for the same reason — no arm in the checker, nothing the compiler learns:
|
||||
*
|
||||
* (declare-c watch-num-i64 [name string x i64] i32 "flan_dev_watch_num_i64")
|
||||
* (declare-c watch-num-i64 [name str x i64] i32 "flan_dev_watch_num_i64")
|
||||
* ...
|
||||
* (watch-num-i64 "cell" (at grid i))
|
||||
*
|
||||
|
||||
@ -2682,7 +2682,7 @@ flan_dyn flan_dyn_rem(flan_dyn a, flan_dyn b, const uint8_t *loc,
|
||||
*
|
||||
* Numbers against numbers, text against text, and nothing else. Text orders
|
||||
* bytewise, which is [memcmp] with the shorter one first on a tie — the same
|
||||
* order a sort of a [(Vec string)] would want and the only order that needs no
|
||||
* order a sort of a [(Vec str)] would want and the only order that needs no
|
||||
* locale, no collation table and no argument.
|
||||
*
|
||||
* A number against a text traps rather than answering. The temptation is to
|
||||
|
||||
@ -71,7 +71,7 @@ void flan_handler_pop(flan_handler *h) {
|
||||
*
|
||||
* A handler that matched through a parent link is not handed the condition,
|
||||
* whose layout is its own type's, but a view laid out as the prelude's
|
||||
* (defstruct Error [name string message string]) — the parent's type is
|
||||
* (defstruct Error [name str message str]) — the parent's type is
|
||||
* Error-shaped, which the checker requires. The view's message is the
|
||||
* condition with its values: [message] for the runtime's own conditions,
|
||||
* which format their sentence before signalling; what [render] prints for a
|
||||
@ -388,7 +388,7 @@ typedef struct { const uint8_t *ptr; int64_t len; } flan_slice;
|
||||
|
||||
static int rt_argc;
|
||||
static char **rt_argv;
|
||||
static flan_slice *rt_args; /* argv as [string], built once, never freed */
|
||||
static flan_slice *rt_args; /* argv as [str], built once, never freed */
|
||||
|
||||
void flan_rt_init(int32_t argc, char **argv) {
|
||||
rt_argc = (int)argc;
|
||||
@ -1487,7 +1487,7 @@ void flan_arith_error(const uint8_t *loc, int64_t loclen, int32_t op,
|
||||
* is the price of never pinning a module for it.
|
||||
*
|
||||
* The condition must agree field for field with the prelude's
|
||||
* (defstruct StaleCall [callee string compiled string current string]),
|
||||
* (defstruct StaleCall [callee str compiled str current str]),
|
||||
* the same hand-kept agreement flan_bounds_cond has with BoundsError. */
|
||||
|
||||
typedef struct { flan_slice callee, compiled, current; } flan_stale_cond;
|
||||
@ -1551,7 +1551,7 @@ void flan_stale_call(const char *site, const char *callee, const char *want,
|
||||
* `type` is copied and never freed, for flan_stale_call's reason: the text
|
||||
* lives in the image of the module that compiled the call, which may be a
|
||||
* thunk that is unloaded once it returns. Must agree with the prelude's
|
||||
* (defstruct NullCall :parent Error [type string]). */
|
||||
* (defstruct NullCall :parent Error [type str]). */
|
||||
|
||||
typedef struct { flan_slice type; } flan_nullcall_cond;
|
||||
|
||||
@ -3529,7 +3529,7 @@ int8_t flan_map_init(flan_map *m, flan_allocator *a, int64_t ksize,
|
||||
m->alloc = a;
|
||||
m->epoch = (int64_t)a->epoch;
|
||||
/* No block until something is put in it: an empty map that is never written
|
||||
* costs nothing, which is what makes a (defonce m (Map string i32)) free. */
|
||||
* costs nothing, which is what makes a (defonce m (Map str i32)) free. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
2
vendor/edn/provide.flan
vendored
2
vendor/edn/provide.flan
vendored
@ -66,7 +66,7 @@
|
||||
(defn- joined3 [a str b str c str] str
|
||||
(joined a (joined b c)))
|
||||
|
||||
;; Copied out, and not `(string (i64->bytes n))`. The prelude's note over
|
||||
;; Copied out, and not `(str (i64->bytes n))`. The prelude's note over
|
||||
;; append-i64 is the reason: i64->bytes renders into one shared static buffer
|
||||
;; in the runtime, so two of its results cannot be held at once — and `where`
|
||||
;; below holds a line and a column at the same time, which read as the same
|
||||
|
||||
2
vendor/edn/read.flan
vendored
2
vendor/edn/read.flan
vendored
@ -118,7 +118,7 @@
|
||||
|
||||
;; A map's key is a whole value, read by the same recursion as anything
|
||||
;; else — :a and "a" are two keys, [0 0] can key a map, and the old
|
||||
;; (Map string Value) narrowing that collapsed them is gone with the type
|
||||
;; (Map str Value) narrowing that collapsed them is gone with the type
|
||||
;; that forced it.
|
||||
(= (.kind t) tok-map-open)
|
||||
(let [m {}
|
||||
|
||||
4
vendor/json/json.flan
vendored
4
vendor/json/json.flan
vendored
@ -140,7 +140,7 @@
|
||||
;;;; the only place that still knows the offset of the offending backslash;
|
||||
;;;; string-of works over a literal the cursor has already accepted and cannot
|
||||
;;;; fail on its contents. That is also Odin's split — its scan_escape runs in
|
||||
;;;; get_token — and it is why string-of is an (Option string) on the token's
|
||||
;;;; get_token — and it is why string-of is an (Option str) on the token's
|
||||
;;;; kind alone and not on its bytes.
|
||||
|
||||
;; ── Token kinds ─────────────────────────────────────────────────────
|
||||
@ -661,7 +661,7 @@
|
||||
;; free-all and under the heap it is a block nobody has freed. There is no
|
||||
;; third owner.
|
||||
;;
|
||||
;; The builder is a (Vec u8) and the answer is (string (slice b)) taken ONCE
|
||||
;; The builder is a (Vec u8) and the answer is (str (slice b)) taken ONCE
|
||||
;; at the end. That ordering is load-bearing rather than stylistic: a push
|
||||
;; after the slice has been taken can grow the Vec into a new block, and in an
|
||||
;; arena the old block is still mapped, so the already-taken string would go on
|
||||
|
||||
2
vendor/json/provide.flan
vendored
2
vendor/json/provide.flan
vendored
@ -51,7 +51,7 @@
|
||||
(defn- joined3 [a str b str c str] str
|
||||
(joined a (joined b c)))
|
||||
|
||||
;; Copied out, and not `(string (i64->bytes n))`: the prelude's note over
|
||||
;; Copied out, and not `(str (i64->bytes n))`: the prelude's note over
|
||||
;; append-i64 is the reason — i64->bytes renders into one shared static buffer
|
||||
;; in the runtime, so two of its results cannot be held at once, and `where`
|
||||
;; holds a line and a column at the same time.
|
||||
|
||||
2
vendor/raylib/raylib.flan
vendored
2
vendor/raylib/raylib.flan
vendored
@ -1621,7 +1621,7 @@
|
||||
;; FilePathList is an array of C strings raylib owns until the matching
|
||||
;; Unload call. It crosses the way a returned string does: each path is copied
|
||||
;; into the context allocator, raylib's list is released before the function
|
||||
;; returns, and the caller gets a (Vec string) with nothing of raylib's left
|
||||
;; returns, and the caller gets a (Vec str) with nothing of raylib's left
|
||||
;; to unload. `free` on the Vec releases the Vec; the paths live until their
|
||||
;; allocator's free-all, as (bytes s) does.
|
||||
(defstruct FilePathList [capacity u32 count u32 paths (Ptr (Ptr i8))])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user