1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
* Copyright (c) 2025-2026 Anton Kundenko <singaraiona@gmail.com>
* All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* Create function objects. Name stored inline in nullmap[0..15].
* The function pointer is in the i64 field. */
ray_t* ;
ray_t* ;
ray_t* ;
/* Read builtin name from nullmap[2..15] (null-terminated, max 13 chars).
* Bytes 0-1 reserved for DAG opcode on all function types. */
static inline const char*
/* Global environment: symbol -> function object dict */
ray_err_t ;
void ;
ray_t* ;
/* User-facing binder. Refuses any name starting with `.` — that root is
* reserved for system namespaces (.sys, .os, .io, .ipc, …) populated by
* builtin registration. Returns RAY_ERR_RESERVED in that case. */
ray_err_t ;
/* Internal binder used by builtin registration. Identical to ray_env_set
* but WITHOUT the reserved-namespace guard. Do NOT call this from user-
* exposed paths; it is the intended way to populate `.sys` / `.os` etc.
* during ray_lang_init. */
ray_err_t ;
/* Flat variant of ray_env_bind: writes the binding directly into the
* global env hash without traversing dotted-segment dict upserts.
* Used to register every fully-qualified builtin name (`.sys.gc`,
* `.os.getenv`, …) alongside the root namespace dict, so prefix
* lookup (REPL completion + highlighter) enumerates them all. */
ray_err_t ;
/* True if a symbol's interned name starts with `.` — i.e. it belongs to
* the reserved namespace populated at startup by builtin registration.
* User-level binders (ray_env_set, ray_env_set_local, lambda parameter
* installer) refuse such names so system bindings can't be shadowed. */
bool ;
/* Resolve a name for a Rayfall expression (tree-walking eval or bytecode
* op_resolve): returns an OWNED ref (rc >= 1) that the caller must
* release, or NULL if undefined. Unlike ray_env_get which returns a
* borrowed ref and leaves refcount management to the caller, env_resolve
* retains before returning — so name-resolution sites can drop their
* manual ray_retain and still participate in the dotted-sym temporal
* extraction path (e.g. `trades.Time.dd`), which allocates fresh values
* mid-walk. */
ray_t* ;
/* Prefix lookup: scan global env + keywords for names starting with prefix.
* Fills results[] with pointers to interned name strings (valid until next
* sym table mutation). Returns count of matches (up to max_results).
* Results are sorted alphabetically. */
int64_t ;
/* True iff `name[0..len)` is an exact-match global env binding or
* keyword. Does NOT intern the probed string (unlike ray_env_get which
* would need a sym_id). Used by the REPL highlighter to decide whether
* to paint the current word green — the prefix-lookup API returns only
* the first-matching entry, which would misclassify `de` as non-builtin
* when an alphabetically-earlier `desc`/`del` hits the same prefix. */
bool ;
/* Iterate global environment entries.
* Fills sym_ids[] and vals[] with up to max_entries items.
* Returns count of entries written. */
int32_t ;
/* Iterate ONLY user-defined bindings (slots last written via ray_env_set,
* not ray_env_bind). Powers the journal snapshot — the .qdb file would
* otherwise carry every builtin, which is wasteful and breaks on reload
* because builtin function objects hold absolute pointers from the prior
* process. A user `(set + 42)` over a builtin flips the slot to user-
* defined, so explicit overrides are preserved. */
int32_t ;
/* Total number of bindings currently in the global env (builtins +
* user). Useful for sizing buffers before ray_env_list. */
int32_t ;
/* Local scope stack for lexical binding (let, do, lambda) */
ray_err_t ;
void ;
ray_err_t ;
/* RAY_ENV_H */