Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Returns the JSON representation of a value given its raw ``addr`` and the ``TypeInfo`` of its type. Equivalent to ``sprint_json``, but takes an explicit ``(addr, TypeInfo&)`` pair instead of an ``any`` value, so it can be called from sites that hold only a ``void?`` and a TypeInfo pointer (e.g. typed dispatch tables) without a per-call-site daslang thunk.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Parses a JSON ``string`` and writes the result into the memory at ``addr`` using the supplied ``TypeInfo``. Equivalent to ``sscan_json``, but takes an explicit ``(addr, TypeInfo&)`` pair instead of an ``any`` destination, so it can be called from sites that hold only a ``void?`` and a TypeInfo pointer (e.g. typed dispatch tables) without a per-call-site daslang thunk. Returns ``true`` on successful parse.
2 changes: 2 additions & 0 deletions include/daScript/simulate/aot_builtin.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ namespace das {
DAS_API vec4f builtin_json_sscan ( Context & context, SimNode_CallBase * call, vec4f * args );
DAS_API char * builtin_print_data ( const void * data, const TypeInfo * typeInfo, Bitfield flags, Context * context, LineInfoArg * at );
DAS_API char * builtin_print_data_v ( float4 data, const TypeInfo * typeInfo, Bitfield flags, Context * context, LineInfoArg * at );
DAS_API char * builtin_json_sprint_at ( const void * addr, const TypeInfo & typeInfo, bool humanReadable, Context * context, LineInfoArg * at );
DAS_API bool builtin_json_sscan_at ( char * json, void * addr, const TypeInfo & typeInfo, Context * context, LineInfoArg * at );
DAS_API char * builtin_debug_type ( const TypeInfo * typeInfo, Context * context, LineInfoArg * at );
DAS_API char * builtin_debug_line ( const LineInfo & at, bool fully, Context * context, LineInfoArg * lineInfo );
DAS_API char * builtin_get_typeinfo_mangled_name ( const TypeInfo * typeInfo, Context * context, LineInfoArg * at );
Expand Down
40 changes: 40 additions & 0 deletions modules/dasLiveHost/src/dasLiveHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ static void clear_store_data_locked() {
++it;
}
}
for (auto it = g_state.store_strings.begin(); it != g_state.store_strings.end(); ) {
const auto & key = it->first;
if (key.compare(0, 12, "__live_vars_") == 0 ||
key.compare(0, 7, "__decs_") == 0) {
it = g_state.store_strings.erase(it);
} else {
++it;
}
}
}

// Exported C functions for the host executable to access state.
Expand Down Expand Up @@ -55,6 +64,13 @@ extern "C" {
++it;
}
}
for (auto it = g_state.store_strings.begin(); it != g_state.store_strings.end(); ) {
if (it->first.compare(0, 12, "__live_vars_") == 0) {
it = g_state.store_strings.erase(it);
} else {
++it;
}
}
}
DAS_EXPORT_DLL void live_host_clear_store() {
lock_guard<mutex> lock(g_state.store_mutex);
Expand Down Expand Up @@ -184,6 +200,21 @@ bool live_load_bytes(const char * key, TArray<uint8_t> & data, Context * ctx) {
return true;
}

void live_store_string(const char * key, const char * value) {
if (!key) return;
lock_guard<mutex> lock(g_state.store_mutex);
g_state.store_strings[key] = value ? value : "";
}

bool live_load_string(const char * key, char * & value, Context * ctx) {
if (!key) return false;
lock_guard<mutex> lock(g_state.store_mutex);
auto it = g_state.store_strings.find(key);
if (it == g_state.store_strings.end()) return false;
value = ctx->allocateString(it->second, nullptr);
return true;
}

// --- Command dispatch bridge ---
// Called from the live_api agent context. Since the HV handler runs on the main
// thread during tick(), the main context is idle and safe to call into.
Expand Down Expand Up @@ -378,6 +409,15 @@ class Module_LiveHost : public Module {
addExtern<DAS_BIND_FUN(live_load_bytes)>(*this, lib, "live_load_bytes",
SideEffects::modifyArgumentAndExternal, "das::live_load_bytes")
->args({"key", "data", "context"});
// String siblings of live_store_bytes / live_load_bytes — JSON-text rail
// for the LiveVarsPassMacro / dasImgui widget serializer pivot. Separate
// store from `store` so runtime-debugger output of JSON text stays readable.
addExtern<DAS_BIND_FUN(live_store_string)>(*this, lib, "live_store_string",
SideEffects::modifyExternal, "das::live_store_string")
->args({"key", "value"});
addExtern<DAS_BIND_FUN(live_load_string)>(*this, lib, "live_load_string",
SideEffects::modifyArgumentAndExternal, "das::live_load_string")
->args({"key", "value", "context"});

// GC
addExtern<DAS_BIND_FUN(live_collect_gc)>(*this, lib, "live_collect_gc",
Expand Down
8 changes: 8 additions & 0 deletions modules/dasLiveHost/src/dasLiveHost.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ namespace das {
// Persistent key-value store (survives reloads)
mutex store_mutex;
unordered_map<string, vector<uint8_t>> store;
// String-typed sibling of `store`. Used by live_store_string / live_load_string,
// the JSON-text rail for the LiveVarsPassMacro / dasImgui widget serializer
// pivot (PR1 of the sprint_json_at refactor). Kept separate from `store`
// so the runtime debugger can present JSON text directly without bytes-as-string
// squinting.
unordered_map<string, string> store_strings;

// Command dispatch bridge (set by host after compile)
Context * dispatch_context = nullptr;
Expand All @@ -63,6 +69,8 @@ namespace das {
const char * live_get_watched_file(int32_t index, Context * ctx);
void live_store_bytes(const char * key, const TArray<uint8_t> & data);
bool live_load_bytes(const char * key, TArray<uint8_t> & data, Context * ctx);
void live_store_string(const char * key, const char * value);
bool live_load_string(const char * key, char * & value, Context * ctx);
void live_collect_gc(Context * ctx);
void live_collect_string_gc(Context * ctx);
const char * live_dispatch_command_via_host(const char * cmd_json, Context * callerCtx);
Expand Down
4 changes: 3 additions & 1 deletion site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ site/
│ ├── cm/ # CodeMirror bundle: codemirror.min.{js,css}, simple-mode.js,
│ │ # daslang-keywords.js, daslang-mode.js, cm-forge.css (Forge theme)
│ ├── lz-string.min.js # share URL compressor (used by /playground/)
│ ├── forge-favicon.svg
│ ├── daslang.svg # master logo (single path, currentColor-tinted)
│ ├── daslang-favicon.svg # yellow-on-black tile favicon
│ ├── daslang.ico # multi-size .ico fallback
│ ├── profile_results.json # fetched by CI from borisbat/dasProfile (gitignored)
│ ├── news.json # generated by build_blog.py (gitignored)
│ └── wasm/ # daslang_static.{js,wasm} from CI (gitignored)
Expand Down
7 changes: 4 additions & 3 deletions site/blog/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{title}} — Daslang</title>
<meta name="description" content="{{description}}" />
<link rel="icon" type="image/svg+xml" href="{{root}}files/forge-favicon.svg" />
<link rel="icon" type="image/svg+xml" href="{{root}}files/daslang-favicon.svg" />
<link rel="alternate icon" type="image/x-icon" href="{{root}}files/daslang.ico" />
<link rel="alternate" type="application/atom+xml" title="Daslang blog" href="{{root}}blog/feed.xml" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
Expand All @@ -25,7 +26,7 @@
<div class="forge-container forge-nav__inner">
<div class="forge-nav__left">
<a class="forge-mark" href="{{root}}index.html">
<span class="forge-mark__glyph">&gt;</span>
<span class="forge-mark__glyph" aria-hidden="true"><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M 19,2 C 6.848484,12.699956 12.591844,7.4593088 6.8243462,13.056243 16.852307,10.274014 6.8079126,19.737584 5,22 L 17.120536,11.596175 C 6.7139271,14.121239 17.627482,3.775356 19,2 Z m -7,1 c -5,0 -9,4 -9,9 0,2.5 0.9875,4.80625 2.6875,6.40625 L 7.09375,17 C 5.79375,15.8 5,14 5,12 5,8.1 8.1,5 12,5 12.4,5 12.69375,4.99375 13.09375,5.09375 L 14.8125,3.40625 C 13.9125,3.20625 13,3 12,3 Z M 18.3125,5.59375 16.90625,7 C 18.20625,8.2 19,10 19,12 c 0,3.9 -3.1,7 -7,7 -0.4,0 -0.69375,0.0063 -1.09375,-0.09375 L 9.1875,20.59375 C 10.0875,20.79375 11,21 12,21 c 5,0 9,-4 9,-9 0,-2.5 -0.9875,-4.80625 -2.6875,-6.40625 z"/></svg></span>
<span>daslang</span>
<span class="forge-mark__tld">.io</span>
</a>
Expand Down Expand Up @@ -54,7 +55,7 @@
<div class="forge-container forge-footer__grid">
<div>
<a class="forge-mark" href="{{root}}index.html">
<span class="forge-mark__glyph">&gt;</span>
<span class="forge-mark__glyph" aria-hidden="true"><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M 19,2 C 6.848484,12.699956 12.591844,7.4593088 6.8243462,13.056243 16.852307,10.274014 6.8079126,19.737584 5,22 L 17.120536,11.596175 C 6.7139271,14.121239 17.627482,3.775356 19,2 Z m -7,1 c -5,0 -9,4 -9,9 0,2.5 0.9875,4.80625 2.6875,6.40625 L 7.09375,17 C 5.79375,15.8 5,14 5,12 5,8.1 8.1,5 12,5 12.4,5 12.69375,4.99375 13.09375,5.09375 L 14.8125,3.40625 C 13.9125,3.20625 13,3 12,3 Z M 18.3125,5.59375 16.90625,7 C 18.20625,8.2 19,10 19,12 c 0,3.9 -3.1,7 -7,7 -0.4,0 -0.69375,0.0063 -1.09375,-0.09375 L 9.1875,20.59375 C 10.0875,20.79375 11,21 12,21 c 5,0 9,-4 9,-9 0,-2.5 -0.9875,-4.80625 -2.6875,-6.40625 z"/></svg></span>
<span>daslang</span>
<span class="forge-mark__tld">.io</span>
</a>
Expand Down
7 changes: 4 additions & 3 deletions site/daspkg.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<meta name="description" content="The daslang package index. Bindings, bots, batteries — one daspkg install away. Rendered straight from the open daspkg-index repo." />
<meta name="keywords" content="daslang, daspkg, package manager, daslang packages, bindings" />

<link rel="icon" type="image/svg+xml" href="files/forge-favicon.svg" />
<link rel="icon" type="image/svg+xml" href="files/daslang-favicon.svg" />
<link rel="alternate icon" type="image/x-icon" href="files/daslang.ico" />
<link rel="alternate" type="application/atom+xml" title="Daslang blog" href="blog/feed.xml" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
Expand All @@ -26,7 +27,7 @@
<div class="forge-container forge-nav__inner">
<div class="forge-nav__left">
<a class="forge-mark" href="index.html">
<span class="forge-mark__glyph">&gt;</span>
<span class="forge-mark__glyph" aria-hidden="true"><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M 19,2 C 6.848484,12.699956 12.591844,7.4593088 6.8243462,13.056243 16.852307,10.274014 6.8079126,19.737584 5,22 L 17.120536,11.596175 C 6.7139271,14.121239 17.627482,3.775356 19,2 Z m -7,1 c -5,0 -9,4 -9,9 0,2.5 0.9875,4.80625 2.6875,6.40625 L 7.09375,17 C 5.79375,15.8 5,14 5,12 5,8.1 8.1,5 12,5 12.4,5 12.69375,4.99375 13.09375,5.09375 L 14.8125,3.40625 C 13.9125,3.20625 13,3 12,3 Z M 18.3125,5.59375 16.90625,7 C 18.20625,8.2 19,10 19,12 c 0,3.9 -3.1,7 -7,7 -0.4,0 -0.69375,0.0063 -1.09375,-0.09375 L 9.1875,20.59375 C 10.0875,20.79375 11,21 12,21 c 5,0 9,-4 9,-9 0,-2.5 -0.9875,-4.80625 -2.6875,-6.40625 z"/></svg></span>
<span>daslang</span>
<span class="forge-mark__tld">.io</span>
</a>
Expand Down Expand Up @@ -120,7 +121,7 @@ <h1>
<div class="forge-container forge-footer__grid">
<div>
<a class="forge-mark" href="index.html">
<span class="forge-mark__glyph">&gt;</span>
<span class="forge-mark__glyph" aria-hidden="true"><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M 19,2 C 6.848484,12.699956 12.591844,7.4593088 6.8243462,13.056243 16.852307,10.274014 6.8079126,19.737584 5,22 L 17.120536,11.596175 C 6.7139271,14.121239 17.627482,3.775356 19,2 Z m -7,1 c -5,0 -9,4 -9,9 0,2.5 0.9875,4.80625 2.6875,6.40625 L 7.09375,17 C 5.79375,15.8 5,14 5,12 5,8.1 8.1,5 12,5 12.4,5 12.69375,4.99375 13.09375,5.09375 L 14.8125,3.40625 C 13.9125,3.20625 13,3 12,3 Z M 18.3125,5.59375 16.90625,7 C 18.20625,8.2 19,10 19,12 c 0,3.9 -3.1,7 -7,7 -0.4,0 -0.69375,0.0063 -1.09375,-0.09375 L 9.1875,20.59375 C 10.0875,20.79375 11,21 12,21 c 5,0 9,-4 9,-9 0,-2.5 -0.9875,-4.80625 -2.6875,-6.40625 z"/></svg></span>
<span>daslang</span>
<span class="forge-mark__tld">.io</span>
</a>
Expand Down
7 changes: 4 additions & 3 deletions site/downloads.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<title>Downloads — Daslang</title>
<meta name="description" content="Daslang releases, repository, blog, and ecosystem links." />

<link rel="icon" type="image/svg+xml" href="files/forge-favicon.svg" />
<link rel="icon" type="image/svg+xml" href="files/daslang-favicon.svg" />
<link rel="alternate icon" type="image/x-icon" href="files/daslang.ico" />
<link rel="alternate" type="application/atom+xml" title="Daslang blog" href="blog/feed.xml" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
Expand All @@ -20,7 +21,7 @@
<div class="forge-container forge-nav__inner">
<div class="forge-nav__left">
<a class="forge-mark" href="index.html">
<span class="forge-mark__glyph">&gt;</span>
<span class="forge-mark__glyph" aria-hidden="true"><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M 19,2 C 6.848484,12.699956 12.591844,7.4593088 6.8243462,13.056243 16.852307,10.274014 6.8079126,19.737584 5,22 L 17.120536,11.596175 C 6.7139271,14.121239 17.627482,3.775356 19,2 Z m -7,1 c -5,0 -9,4 -9,9 0,2.5 0.9875,4.80625 2.6875,6.40625 L 7.09375,17 C 5.79375,15.8 5,14 5,12 5,8.1 8.1,5 12,5 12.4,5 12.69375,4.99375 13.09375,5.09375 L 14.8125,3.40625 C 13.9125,3.20625 13,3 12,3 Z M 18.3125,5.59375 16.90625,7 C 18.20625,8.2 19,10 19,12 c 0,3.9 -3.1,7 -7,7 -0.4,0 -0.69375,0.0063 -1.09375,-0.09375 L 9.1875,20.59375 C 10.0875,20.79375 11,21 12,21 c 5,0 9,-4 9,-9 0,-2.5 -0.9875,-4.80625 -2.6875,-6.40625 z"/></svg></span>
<span>daslang</span>
<span class="forge-mark__tld">.io</span>
</a>
Expand Down Expand Up @@ -172,7 +173,7 @@ <h2 class="forge-h2">Where to learn more.</h2>
<div class="forge-container forge-footer__grid">
<div>
<a class="forge-mark" href="index.html">
<span class="forge-mark__glyph">&gt;</span>
<span class="forge-mark__glyph" aria-hidden="true"><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M 19,2 C 6.848484,12.699956 12.591844,7.4593088 6.8243462,13.056243 16.852307,10.274014 6.8079126,19.737584 5,22 L 17.120536,11.596175 C 6.7139271,14.121239 17.627482,3.775356 19,2 Z m -7,1 c -5,0 -9,4 -9,9 0,2.5 0.9875,4.80625 2.6875,6.40625 L 7.09375,17 C 5.79375,15.8 5,14 5,12 5,8.1 8.1,5 12,5 12.4,5 12.69375,4.99375 13.09375,5.09375 L 14.8125,3.40625 C 13.9125,3.20625 13,3 12,3 Z M 18.3125,5.59375 16.90625,7 C 18.20625,8.2 19,10 19,12 c 0,3.9 -3.1,7 -7,7 -0.4,0 -0.69375,0.0063 -1.09375,-0.09375 L 9.1875,20.59375 C 10.0875,20.79375 11,21 12,21 c 5,0 9,-4 9,-9 0,-2.5 -0.9875,-4.80625 -2.6875,-6.40625 z"/></svg></span>
<span>daslang</span>
<span class="forge-mark__tld">.io</span>
</a>
Expand Down
4 changes: 4 additions & 0 deletions site/files/daslang-favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/files/daslang.ico
Binary file not shown.
3 changes: 3 additions & 0 deletions site/files/daslang.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 0 additions & 12 deletions site/files/forge-favicon.svg

This file was deleted.

36 changes: 26 additions & 10 deletions site/files/forge.css
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,11 @@ button { font: inherit; border: 0; background: none; color: inherit; cursor: poi
}
.forge-mark__glyph {
width: 22px; height: 22px;
border-radius: 4px;
background: linear-gradient(135deg, var(--amber), var(--amber-dim));
display: grid;
place-items: center;
color: var(--bg);
font-size: 13px;
font-weight: 800;
color: var(--amber);
display: block;
flex-shrink: 0;
}
.forge-mark__glyph svg { width: 100%; height: 100%; display: block; }
.forge-mark__tld { color: var(--fg-faint); font-weight: 400; }

/* ───── Hero ───── */
Expand All @@ -191,13 +188,29 @@ button { font: inherit; border: 0; background: none; color: inherit; cursor: poi
align-items: center;
}

.forge-kicker {
.forge-hero__lockup {
display: inline-flex;
align-items: center;
gap: 20px;
margin-bottom: 24px;
}
.forge-hero__glyph {
width: 64px;
height: 64px;
color: var(--amber);
display: block;
flex-shrink: 0;
}
.forge-hero__glyph svg { width: 100%; height: 100%; display: block; }
.forge-hero__eyebrow {
font-family: var(--font-mono);
font-size: 12px;
font-weight: 500;
color: var(--amber);
letter-spacing: 1.5px;
letter-spacing: 1.4px;
line-height: 1.15;
text-transform: uppercase;
margin-bottom: 20px;
max-width: 260px;
}

.forge-hero h1 {
Expand Down Expand Up @@ -1016,6 +1029,9 @@ button { font: inherit; border: 0; background: none; color: inherit; cursor: poi
.forge-hero { padding: 48px 0 64px; }
.forge-hero h1 { font-size: 38px; }
.forge-hero__lede { font-size: 15px; }
.forge-hero__lockup { gap: 14px; margin-bottom: 18px; }
.forge-hero__glyph { width: 44px; height: 44px; }
.forge-hero__eyebrow { font-size: 11px; }
.forge-hero__ctas { flex-direction: column; align-items: stretch; }
.forge-btn-primary, .forge-btn-secondary { justify-content: center; }
.forge-stats { gap: 18px; flex-wrap: wrap; }
Expand Down
Loading
Loading