Conversation
Agent-Logs-Url: https://github.com/corepunch/orca/sessions/57120e7a-e214-405c-86f8-5333ff5d653b Co-authored-by: corepunch <83646194+corepunch@users.noreply.github.com>
…xml file-loader registration Agent-Logs-Url: https://github.com/corepunch/orca/sessions/c1a79acc-0829-49bb-bc49-027298f41560 Co-authored-by: corepunch <83646194+corepunch@users.noreply.github.com>
Agent-Logs-Url: https://github.com/corepunch/orca/sessions/c1a79acc-0829-49bb-bc49-027298f41560 Co-authored-by: corepunch <83646194+corepunch@users.noreply.github.com>
|
@copilot You added Lisp files, where you use strings: |
…s to bare literals Agent-Logs-Url: https://github.com/corepunch/orca/sessions/26175dcf-d875-4d38-8302-ce38bf303643 Co-authored-by: corepunch <83646194+corepunch@users.noreply.github.com>
Updated in commit
|
… step titles Agent-Logs-Url: https://github.com/corepunch/orca/sessions/26175dcf-d875-4d38-8302-ce38bf303643 Co-authored-by: corepunch <83646194+corepunch@users.noreply.github.com>
|
@copilot Check Weather app, I believe we can totally use Lisp to replace moonscript and lua too |
There was a problem hiding this comment.
Pull request overview
This PR shifts UI asset loading toward a Lisp-first workflow by adding a Lisp UI loader (.lisp), exposing Lisp loading to Lua, and teaching the runtime binding compiler to accept Lisp-style S-expressions (e.g. (if ...), (bind ...)) by translating them into the existing expression syntax.
Changes:
- Added Lisp → ORCA expression translation in
Token_Createand introduced new runtime tests for Lisp-style bindings. - Added a new Lisp UI asset loader (
fs_lisp.c) plus a Lua entry point (filesystem.loadObjectFromLispString) and.lispfile loader registration. - Added/updated sample
.lispscreen assets and integrated Lisp loader coverage into headless test runs.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_properties.c | Adds runtime coverage for Token_Create and IF evaluation when expressions are written in Lisp form. |
| tests/test_lisp.lua | New headless Lua tests for the Lisp UI loader, bindings, and sample asset parsing. |
| source/filesystem/w_filesystem.c | Registers .lisp loader and exposes loadObjectFromLispString to Lua; removes .xml loader registration. |
| source/filesystem/fs_local.h | Declares FS_LoadObjectFromLisp* APIs. |
| source/filesystem/fs_lisp.c | New Lisp parser + object factory, including binding translation and attribute parsing changes. |
| source/core/property/property_program.c | Adds Lisp binding translation and invokes it from Token_Create as a front-end feature. |
| samples/Example/Screens/GetStartedPopup.lisp | Adds a Lisp popup template so extensionless modal paths can resolve via .lisp. |
| samples/Example/Screens/Application.lisp | Adds Lisp-form sample screen (and updates numeric atom style) used by tests and loader validation. |
| Makefile | Adds test-lisp target and includes Lisp tests in test-headless. |
| if (b->n + len + 1 > b->cap) { | ||
| size_t need = b->n + len + 1; | ||
| b->cap = b->cap ? b->cap * 2 : 256; | ||
| if (b->cap < need) b->cap = need; | ||
| b->s = realloc(b->s, b->cap); | ||
| } | ||
| if (!b->s) return; |
| if (eq && eq > l->str && eq[1] != '\0') { | ||
| /* Inline atom assignment, e.g. Width=1280 */ | ||
| char *key = strndup(l->str, (size_t)(eq - l->str)); | ||
| if (!key) { | ||
| Con_Error("Lisp: out of memory parsing attribute key (line %d)", l->line); | ||
| lsp_next(l); | ||
| continue; | ||
| } |
| } else if (alen > 1 && l->str[alen - 1] == '=') { | ||
| char *key = strndup(l->str, alen - 1); | ||
| lsp_next(l); | ||
|
|
| char *expr = lsp_translate_binding(l); | ||
| if (target && expr) { | ||
| struct lisp_attr *a = calloc(1, sizeof(*a)); | ||
| a->key = target; | ||
| a->binding = expr; | ||
| *attr_tail = a; | ||
| attr_tail = &a->next; | ||
| } else { | ||
| free(target); | ||
| free(expr); | ||
| } |
| void on_filesystem_module_registered(lua_State* L) | ||
| { | ||
| OBJ_RegisterFileLoader(".xml", _xml_file_loader); | ||
| OBJ_RegisterFileLoader(".css", _css_file_loader); | ||
| OBJ_RegisterFileLoader(".lisp", _lisp_file_loader); | ||
|
|
| lpcString_t p = _lisp_skip(code); | ||
| if (*p == '(') { | ||
| char *lisp = PROP_TranslateLispBinding(code); | ||
| if (lisp) { | ||
| struct token *result = _compile(lisp, "binding"); | ||
| free(lisp); | ||
| return result; | ||
| } | ||
| } |
| -- * Prefab placeholders (LayerPrefabPlaceholder) load templates correctly. | ||
| -- * Full parity check: Application.lisp produces the same named objects as | ||
| -- Application.xml when parsed. |
Checked in |
|
@copilot bindings (tokens) shall become Objects too, and process a message like ID_Binding_Evaluate when computing |
I can do this, but it’s a large architectural refactor beyond this PR’s scope. Please confirm you want a follow-up PR that introduces a Binding object/class (message-driven |
|
@copilot yes proceed, this will remove the binding parser code and streamline its execution |
|
@copilot don't worry about backwards compatibility, redo binding in example app |
Agent-Logs-Url: https://github.com/corepunch/orca/sessions/9cff1947-d103-4217-8c22-747a887980c8 Co-authored-by: corepunch <83646194+corepunch@users.noreply.github.com>
Agent-Logs-Url: https://github.com/corepunch/orca/sessions/9cff1947-d103-4217-8c22-747a887980c8 Co-authored-by: corepunch <83646194+corepunch@users.noreply.github.com>
Implemented in |
Agent-Logs-Url: https://github.com/corepunch/orca/sessions/d34fcc58-efa7-4920-b82c-b134af06e881 Co-authored-by: corepunch <83646194+corepunch@users.noreply.github.com>
Done in |
|
@copilot Replace xml with lisp in Example application |
Agent-Logs-Url: https://github.com/corepunch/orca/sessions/97c3a778-a987-4569-a8c0-52d51838ffc7 Co-authored-by: corepunch <83646194+corepunch@users.noreply.github.com>
Agent-Logs-Url: https://github.com/corepunch/orca/sessions/97c3a778-a987-4569-a8c0-52d51838ffc7 Co-authored-by: corepunch <83646194+corepunch@users.noreply.github.com>
Done in |
Both now translate to {path}:
(bind "Card.Title") → {Card.Title}
(Binding "Card.Title") → {Card.Title} (new alias)
Example usage:
(TextBlock Name="Title" Text=(Binding "Card.Title"))
(TextBlock Name="Value" ForegroundColor=(Binding "Card.PrimaryColor"))
This PR advances the Lisp-first UI loading work and updates binding execution to a message-driven object flow, then applies follow-up feedback to remove legacy binding markup compatibility and switch the active Example app runtime flow to Lisp assets.
Changes Made
Binding.Evaluateas a message-driven execution step so binding computation can run through Binding objects.{Binding ...}rewrite path), aligning runtime behavior with the non-legacy binding format.{Binding Path}to non-legacy{Path}syntax and updated corresponding layout assertions..lispassets:StartupScreennow points toExample/Screens/Application.lispPlaceholderTemplatereferences inApplication.lispnow point toExample/Prefabs/*.lispExample/Screens/GetStartedPopup.lispMetric.lispand updated references.core.h,core_properties.h,core_export.c) for the new Binding message and fields.Validation
make unitemake test-headless