From 11357d4fb5f3a4d4d3ab7db3837b702e3f300b67 Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Fri, 30 May 2025 15:25:31 -0500 Subject: [PATCH] actor files now .ce; module files now .cm; add toml encoder/decoder and test --- .gitignore | 8 +- CLAUDE.md | 10 +- Makefile | 2 +- benchmarks/{nota.js => nota.ce} | 0 benchmarks/{wota.js => wota.ce} | 0 .../{wota_nota_json.js => wota_nota_json.ce} | 0 ...wnload_actor.js => http_download_actor.ce} | 0 examples/{nat.js => nat.ce} | 0 examples/{nat_client.js => nat_client.ce} | 0 meson.build | 14 +- prosperon/{_sdl_video.js => _sdl_video.ce} | 0 prosperon/{camera.js => camera.cm} | 0 prosperon/{clay.js => clay.cm} | 0 prosperon/{color.js => color.cm} | 0 prosperon/{controller.js => controller.cm} | 0 prosperon/{device.js => device.cm} | 0 prosperon/{draw2d.js => draw2d.cm} | 0 prosperon/{dull.js => dull.ce} | 0 prosperon/{emitter.js => emitter.cm} | 0 .../bunnymark/{config.js => config.cm} | 0 .../examples/bunnymark/{main.js => main.ce} | 0 .../examples/chess/{config.js => config.cm} | 0 prosperon/examples/chess/{grid.js => grid.cm} | 0 prosperon/examples/chess/{main.js => main.ce} | 0 .../chess/{movement.js => movement.cm} | 0 .../examples/chess/{pieces.js => pieces.cm} | 0 .../examples/chess/{rules.js => rules.cm} | 0 .../examples/pong/{config.js => config.cm} | 0 prosperon/examples/pong/{main.js => main.ce} | 0 .../examples/snake/{config.js => config.cm} | 0 prosperon/examples/snake/{main.js => main.ce} | 0 .../{steam_example.js => steam_example.ce} | 0 .../examples/tetris/{config.js => config.cm} | 0 .../examples/tetris/{main.js => main.ce} | 0 prosperon/{geometry.js => geometry.cm} | 0 prosperon/{graphics.js => graphics.cm} | 0 prosperon/{imgui.js => imgui.cm} | 0 prosperon/{lcdsprite.js => lcdsprite.cm} | 0 prosperon/{moth.js => moth.ce} | 0 prosperon/{rasterize.js => rasterize.cm} | 0 .../resources.js => prosperon/resources.cm | 0 prosperon/{scenetree.js => scenetree.cm} | 0 prosperon/{sdl_gpu.js => sdl_gpu.cm} | 0 prosperon/{sound.js => sound.cm} | 0 prosperon/{spline.js => spline.cm} | 0 prosperon/{sprite.js => sprite.cm} | 0 .../tests/{animation.js => animation.ce} | 0 .../tests/{bunnymark.js => bunnymark.ce} | 0 prosperon/tests/{camera.js => camera.ce} | 0 ...era_colorspace.js => camera_colorspace.ce} | 0 ...onvert.js => camera_colorspace_convert.ce} | 0 .../tests/{camera_info.js => camera_info.ce} | 0 prosperon/tests/{draw2d.js => draw2d.ce} | 0 .../tests/{prosperon.js => prosperon.ce} | 0 prosperon/tests/{steam.js => steam.ce} | 0 prosperon/tests/{surface.js => surface.ce} | 0 ...ce_colorspace.js => surface_colorspace.ce} | 0 prosperon/tests/{webcam.js => webcam.ce} | 0 prosperon/tests/{window.js => window.ce} | 0 prosperon/{tween.js => tween.cm} | 0 prosperon/{video.js => video.cm} | 0 scripts/{base.js => base.cm} | 0 scripts/{cmd.js => cmd.cm} | 0 scripts/{debug.js => debug.cm} | 0 scripts/{dmon.js => dmon.cm} | 0 scripts/{doc.js => doc.cm} | 0 scripts/{docstrings.js => docstrings.cm} | 0 scripts/{enet.js => enet.cm} | 0 scripts/{engine.js => engine.cm} | 102 +++++------ scripts/{event.js => event.cm} | 0 scripts/{http.js => http.cm} | 0 scripts/{io.js => io.cm} | 0 scripts/{js.js => js.cm} | 0 scripts/{json.js => json.cm} | 0 scripts/{math.js => math.cm} | 0 scripts/{miniz.js => miniz.cm} | 0 scripts/{nota.js => nota.cm} | 0 scripts/{os.js => os.cm} | 0 scripts/{parseq.js => parseq.cm} | 0 scripts/{time.js => time.cm} | 0 scripts/toml.cm | 169 ++++++++++++++++++ scripts/{util.js => util.cm} | 0 scripts/vendor.ce | 3 + scripts/{wota.js => wota.cm} | 0 source/cell.c | 7 +- source/qjs_actor.c | 1 + tests/{blob.js => blob.ce} | 0 tests/{comments.js => comments.ce} | 2 +- tests/{contact.js => contact.ce} | 0 tests/{delay.js => delay.ce} | 0 tests/{empty.js => empty.ce} | 0 tests/{http.js => http.ce} | 0 tests/{https.js => https.ce} | 2 +- tests/mod1.cm | 1 + tests/{nota.js => nota.ce} | 0 tests/{overling.js => overling.ce} | 2 +- tests/{parseq.js => parseq.ce} | 2 +- tests/{portal.js => portal.ce} | 0 tests/{portalspawner.js => portalspawner.ce} | 4 +- tests/{qr.js => qr.ce} | 0 tests/{qr_drag.js => qr_drag.ce} | 0 tests/{reply.js => reply.ce} | 0 tests/{send.js => send.ce} | 2 +- tests/{spawn_actor.js => spawn_actor.ce} | 0 tests/{spawnee.js => spawnee.ce} | 0 tests/{spawner.js => spawner.ce} | 2 +- ...t_actor_access.js => test_actor_access.ce} | 2 +- tests/{test_args.js => test_args.ce} | 0 ...est_child_actor.js => test_child_actor.ce} | 0 ...est_event_watch.js => test_event_watch.ce} | 0 tests/{test_module.js => test_module.ce} | 0 tests/{test_use_args.js => test_use_args.ce} | 0 tests/toml.ce | 121 +++++++++++++ tests/{underling.js => underling.ce} | 0 tests/{unneeded.js => unneeded.ce} | 0 tests/user.ce | 9 + tests/{wota.js => wota.ce} | 0 117 files changed, 376 insertions(+), 89 deletions(-) rename benchmarks/{nota.js => nota.ce} (100%) rename benchmarks/{wota.js => wota.ce} (100%) rename benchmarks/{wota_nota_json.js => wota_nota_json.ce} (100%) rename examples/{http_download_actor.js => http_download_actor.ce} (100%) rename examples/{nat.js => nat.ce} (100%) rename examples/{nat_client.js => nat_client.ce} (100%) rename prosperon/{_sdl_video.js => _sdl_video.ce} (100%) rename prosperon/{camera.js => camera.cm} (100%) rename prosperon/{clay.js => clay.cm} (100%) rename prosperon/{color.js => color.cm} (100%) rename prosperon/{controller.js => controller.cm} (100%) rename prosperon/{device.js => device.cm} (100%) rename prosperon/{draw2d.js => draw2d.cm} (100%) rename prosperon/{dull.js => dull.ce} (100%) rename prosperon/{emitter.js => emitter.cm} (100%) rename prosperon/examples/bunnymark/{config.js => config.cm} (100%) rename prosperon/examples/bunnymark/{main.js => main.ce} (100%) rename prosperon/examples/chess/{config.js => config.cm} (100%) rename prosperon/examples/chess/{grid.js => grid.cm} (100%) rename prosperon/examples/chess/{main.js => main.ce} (100%) rename prosperon/examples/chess/{movement.js => movement.cm} (100%) rename prosperon/examples/chess/{pieces.js => pieces.cm} (100%) rename prosperon/examples/chess/{rules.js => rules.cm} (100%) rename prosperon/examples/pong/{config.js => config.cm} (100%) rename prosperon/examples/pong/{main.js => main.ce} (100%) rename prosperon/examples/snake/{config.js => config.cm} (100%) rename prosperon/examples/snake/{main.js => main.ce} (100%) rename prosperon/examples/{steam_example.js => steam_example.ce} (100%) rename prosperon/examples/tetris/{config.js => config.cm} (100%) rename prosperon/examples/tetris/{main.js => main.ce} (100%) rename prosperon/{geometry.js => geometry.cm} (100%) rename prosperon/{graphics.js => graphics.cm} (100%) rename prosperon/{imgui.js => imgui.cm} (100%) rename prosperon/{lcdsprite.js => lcdsprite.cm} (100%) rename prosperon/{moth.js => moth.ce} (100%) rename prosperon/{rasterize.js => rasterize.cm} (100%) rename scripts/resources.js => prosperon/resources.cm (100%) rename prosperon/{scenetree.js => scenetree.cm} (100%) rename prosperon/{sdl_gpu.js => sdl_gpu.cm} (100%) rename prosperon/{sound.js => sound.cm} (100%) rename prosperon/{spline.js => spline.cm} (100%) rename prosperon/{sprite.js => sprite.cm} (100%) rename prosperon/tests/{animation.js => animation.ce} (100%) rename prosperon/tests/{bunnymark.js => bunnymark.ce} (100%) rename prosperon/tests/{camera.js => camera.ce} (100%) rename prosperon/tests/{camera_colorspace.js => camera_colorspace.ce} (100%) rename prosperon/tests/{camera_colorspace_convert.js => camera_colorspace_convert.ce} (100%) rename prosperon/tests/{camera_info.js => camera_info.ce} (100%) rename prosperon/tests/{draw2d.js => draw2d.ce} (100%) rename prosperon/tests/{prosperon.js => prosperon.ce} (100%) rename prosperon/tests/{steam.js => steam.ce} (100%) rename prosperon/tests/{surface.js => surface.ce} (100%) rename prosperon/tests/{surface_colorspace.js => surface_colorspace.ce} (100%) rename prosperon/tests/{webcam.js => webcam.ce} (100%) rename prosperon/tests/{window.js => window.ce} (100%) rename prosperon/{tween.js => tween.cm} (100%) rename prosperon/{video.js => video.cm} (100%) rename scripts/{base.js => base.cm} (100%) rename scripts/{cmd.js => cmd.cm} (100%) rename scripts/{debug.js => debug.cm} (100%) rename scripts/{dmon.js => dmon.cm} (100%) rename scripts/{doc.js => doc.cm} (100%) rename scripts/{docstrings.js => docstrings.cm} (100%) rename scripts/{enet.js => enet.cm} (100%) rename scripts/{engine.js => engine.cm} (91%) rename scripts/{event.js => event.cm} (100%) rename scripts/{http.js => http.cm} (100%) rename scripts/{io.js => io.cm} (100%) rename scripts/{js.js => js.cm} (100%) rename scripts/{json.js => json.cm} (100%) rename scripts/{math.js => math.cm} (100%) rename scripts/{miniz.js => miniz.cm} (100%) rename scripts/{nota.js => nota.cm} (100%) rename scripts/{os.js => os.cm} (100%) rename scripts/{parseq.js => parseq.cm} (100%) rename scripts/{time.js => time.cm} (100%) create mode 100644 scripts/toml.cm rename scripts/{util.js => util.cm} (100%) create mode 100644 scripts/vendor.ce rename scripts/{wota.js => wota.cm} (100%) rename tests/{blob.js => blob.ce} (100%) rename tests/{comments.js => comments.ce} (91%) rename tests/{contact.js => contact.ce} (100%) rename tests/{delay.js => delay.ce} (100%) rename tests/{empty.js => empty.ce} (100%) rename tests/{http.js => http.ce} (100%) rename tests/{https.js => https.ce} (96%) create mode 100644 tests/mod1.cm rename tests/{nota.js => nota.ce} (100%) rename tests/{overling.js => overling.ce} (91%) rename tests/{parseq.js => parseq.ce} (95%) rename tests/{portal.js => portal.ce} (100%) rename tests/{portalspawner.js => portalspawner.ce} (52%) rename tests/{qr.js => qr.ce} (100%) rename tests/{qr_drag.js => qr_drag.ce} (100%) rename tests/{reply.js => reply.ce} (100%) rename tests/{send.js => send.ce} (91%) rename tests/{spawn_actor.js => spawn_actor.ce} (100%) rename tests/{spawnee.js => spawnee.ce} (100%) rename tests/{spawner.js => spawner.ce} (74%) rename tests/{test_actor_access.js => test_actor_access.ce} (91%) rename tests/{test_args.js => test_args.ce} (100%) rename tests/{test_child_actor.js => test_child_actor.ce} (100%) rename tests/{test_event_watch.js => test_event_watch.ce} (100%) rename tests/{test_module.js => test_module.ce} (100%) rename tests/{test_use_args.js => test_use_args.ce} (100%) create mode 100644 tests/toml.ce rename tests/{underling.js => underling.ce} (100%) rename tests/{unneeded.js => unneeded.ce} (100%) create mode 100644 tests/user.ce rename tests/{wota.js => wota.ce} (100%) diff --git a/.gitignore b/.gitignore index c87415ee..0a0984af 100644 --- a/.gitignore +++ b/.gitignore @@ -13,20 +13,16 @@ Jenkinsfile *.gz *.tar .nova/ -packer* primum -sokol-shdc* source/shaders/*.h -core.cdb -primum.exe core.cdb.h jsc .DS_Store *.html .vscode *.icns -game.zip icon.ico steam/ subprojects/*/ -build_dbg/ \ No newline at end of file +build_dbg/ +.cell diff --git a/CLAUDE.md b/CLAUDE.md index a1f4d51e..ab1dfde9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -5,7 +5,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Build Commands ### Build variants -- `make debug` - Build debug version (uses meson debug configuration) +- `make` - Make and install debug version. Usually all that's needed. - `make fast` - Build optimized version - `make release` - Build release version with LTO and optimizations - `make small` - Build minimal size version @@ -13,10 +13,10 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co - `make crosswin` - Cross-compile for Windows using mingw32 ### Testing -- `meson test -C build_dbg` - Run all tests in debug build -- `meson test -C build_` - Run tests in specific build variant -- `./build_dbg/prosperon tests/.js` - Run specific test -- Available tests: `spawn_actor`, `empty`, `nota`, `wota`, `portalspawner`, `overling`, `send`, `delay` +After install with 'make', just run 'cell' and point it at the actor you want to launch. "cell tests/toml" runs the actor "tests/toml.js" + +## Scripting language +This is called "cell", but it is is a variant of javascript and extremely similar. ### Common development commands - `meson setup build_` - Configure build directory diff --git a/Makefile b/Makefile index 203cd546..610947c2 100755 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ debug: FORCE meson setup build_dbg -Dbuildtype=debug - meson install -C build_dbg + meson install --only-changed -C build_dbg fast: FORCE meson setup build_fast diff --git a/benchmarks/nota.js b/benchmarks/nota.ce similarity index 100% rename from benchmarks/nota.js rename to benchmarks/nota.ce diff --git a/benchmarks/wota.js b/benchmarks/wota.ce similarity index 100% rename from benchmarks/wota.js rename to benchmarks/wota.ce diff --git a/benchmarks/wota_nota_json.js b/benchmarks/wota_nota_json.ce similarity index 100% rename from benchmarks/wota_nota_json.js rename to benchmarks/wota_nota_json.ce diff --git a/examples/http_download_actor.js b/examples/http_download_actor.ce similarity index 100% rename from examples/http_download_actor.js rename to examples/http_download_actor.ce diff --git a/examples/nat.js b/examples/nat.ce similarity index 100% rename from examples/nat.js rename to examples/nat.ce diff --git a/examples/nat_client.js b/examples/nat_client.ce similarity index 100% rename from examples/nat_client.js rename to examples/nat_client.ce diff --git a/meson.build b/meson.build index f7b985ef..2ca8409b 100644 --- a/meson.build +++ b/meson.build @@ -339,18 +339,6 @@ cell_dep = declare_dependency( link_with: cell ) -copy_tests = custom_target( - 'copy_tests', - output: 'tests', - command: [ - 'cp', '-rf', - join_paths(meson.project_source_root(), 'tests'), - meson.project_build_root() - ], - build_always_stale: true, - build_by_default: true -) - tests = [ 'spawn_actor', 'empty', @@ -363,5 +351,5 @@ tests = [ ] foreach file : tests - test(file, cell, args:['tests/' + file + '.js'], depends:copy_tests) + test(file, cell, args:['tests/' + file]) endforeach diff --git a/prosperon/_sdl_video.js b/prosperon/_sdl_video.ce similarity index 100% rename from prosperon/_sdl_video.js rename to prosperon/_sdl_video.ce diff --git a/prosperon/camera.js b/prosperon/camera.cm similarity index 100% rename from prosperon/camera.js rename to prosperon/camera.cm diff --git a/prosperon/clay.js b/prosperon/clay.cm similarity index 100% rename from prosperon/clay.js rename to prosperon/clay.cm diff --git a/prosperon/color.js b/prosperon/color.cm similarity index 100% rename from prosperon/color.js rename to prosperon/color.cm diff --git a/prosperon/controller.js b/prosperon/controller.cm similarity index 100% rename from prosperon/controller.js rename to prosperon/controller.cm diff --git a/prosperon/device.js b/prosperon/device.cm similarity index 100% rename from prosperon/device.js rename to prosperon/device.cm diff --git a/prosperon/draw2d.js b/prosperon/draw2d.cm similarity index 100% rename from prosperon/draw2d.js rename to prosperon/draw2d.cm diff --git a/prosperon/dull.js b/prosperon/dull.ce similarity index 100% rename from prosperon/dull.js rename to prosperon/dull.ce diff --git a/prosperon/emitter.js b/prosperon/emitter.cm similarity index 100% rename from prosperon/emitter.js rename to prosperon/emitter.cm diff --git a/prosperon/examples/bunnymark/config.js b/prosperon/examples/bunnymark/config.cm similarity index 100% rename from prosperon/examples/bunnymark/config.js rename to prosperon/examples/bunnymark/config.cm diff --git a/prosperon/examples/bunnymark/main.js b/prosperon/examples/bunnymark/main.ce similarity index 100% rename from prosperon/examples/bunnymark/main.js rename to prosperon/examples/bunnymark/main.ce diff --git a/prosperon/examples/chess/config.js b/prosperon/examples/chess/config.cm similarity index 100% rename from prosperon/examples/chess/config.js rename to prosperon/examples/chess/config.cm diff --git a/prosperon/examples/chess/grid.js b/prosperon/examples/chess/grid.cm similarity index 100% rename from prosperon/examples/chess/grid.js rename to prosperon/examples/chess/grid.cm diff --git a/prosperon/examples/chess/main.js b/prosperon/examples/chess/main.ce similarity index 100% rename from prosperon/examples/chess/main.js rename to prosperon/examples/chess/main.ce diff --git a/prosperon/examples/chess/movement.js b/prosperon/examples/chess/movement.cm similarity index 100% rename from prosperon/examples/chess/movement.js rename to prosperon/examples/chess/movement.cm diff --git a/prosperon/examples/chess/pieces.js b/prosperon/examples/chess/pieces.cm similarity index 100% rename from prosperon/examples/chess/pieces.js rename to prosperon/examples/chess/pieces.cm diff --git a/prosperon/examples/chess/rules.js b/prosperon/examples/chess/rules.cm similarity index 100% rename from prosperon/examples/chess/rules.js rename to prosperon/examples/chess/rules.cm diff --git a/prosperon/examples/pong/config.js b/prosperon/examples/pong/config.cm similarity index 100% rename from prosperon/examples/pong/config.js rename to prosperon/examples/pong/config.cm diff --git a/prosperon/examples/pong/main.js b/prosperon/examples/pong/main.ce similarity index 100% rename from prosperon/examples/pong/main.js rename to prosperon/examples/pong/main.ce diff --git a/prosperon/examples/snake/config.js b/prosperon/examples/snake/config.cm similarity index 100% rename from prosperon/examples/snake/config.js rename to prosperon/examples/snake/config.cm diff --git a/prosperon/examples/snake/main.js b/prosperon/examples/snake/main.ce similarity index 100% rename from prosperon/examples/snake/main.js rename to prosperon/examples/snake/main.ce diff --git a/prosperon/examples/steam_example.js b/prosperon/examples/steam_example.ce similarity index 100% rename from prosperon/examples/steam_example.js rename to prosperon/examples/steam_example.ce diff --git a/prosperon/examples/tetris/config.js b/prosperon/examples/tetris/config.cm similarity index 100% rename from prosperon/examples/tetris/config.js rename to prosperon/examples/tetris/config.cm diff --git a/prosperon/examples/tetris/main.js b/prosperon/examples/tetris/main.ce similarity index 100% rename from prosperon/examples/tetris/main.js rename to prosperon/examples/tetris/main.ce diff --git a/prosperon/geometry.js b/prosperon/geometry.cm similarity index 100% rename from prosperon/geometry.js rename to prosperon/geometry.cm diff --git a/prosperon/graphics.js b/prosperon/graphics.cm similarity index 100% rename from prosperon/graphics.js rename to prosperon/graphics.cm diff --git a/prosperon/imgui.js b/prosperon/imgui.cm similarity index 100% rename from prosperon/imgui.js rename to prosperon/imgui.cm diff --git a/prosperon/lcdsprite.js b/prosperon/lcdsprite.cm similarity index 100% rename from prosperon/lcdsprite.js rename to prosperon/lcdsprite.cm diff --git a/prosperon/moth.js b/prosperon/moth.ce similarity index 100% rename from prosperon/moth.js rename to prosperon/moth.ce diff --git a/prosperon/rasterize.js b/prosperon/rasterize.cm similarity index 100% rename from prosperon/rasterize.js rename to prosperon/rasterize.cm diff --git a/scripts/resources.js b/prosperon/resources.cm similarity index 100% rename from scripts/resources.js rename to prosperon/resources.cm diff --git a/prosperon/scenetree.js b/prosperon/scenetree.cm similarity index 100% rename from prosperon/scenetree.js rename to prosperon/scenetree.cm diff --git a/prosperon/sdl_gpu.js b/prosperon/sdl_gpu.cm similarity index 100% rename from prosperon/sdl_gpu.js rename to prosperon/sdl_gpu.cm diff --git a/prosperon/sound.js b/prosperon/sound.cm similarity index 100% rename from prosperon/sound.js rename to prosperon/sound.cm diff --git a/prosperon/spline.js b/prosperon/spline.cm similarity index 100% rename from prosperon/spline.js rename to prosperon/spline.cm diff --git a/prosperon/sprite.js b/prosperon/sprite.cm similarity index 100% rename from prosperon/sprite.js rename to prosperon/sprite.cm diff --git a/prosperon/tests/animation.js b/prosperon/tests/animation.ce similarity index 100% rename from prosperon/tests/animation.js rename to prosperon/tests/animation.ce diff --git a/prosperon/tests/bunnymark.js b/prosperon/tests/bunnymark.ce similarity index 100% rename from prosperon/tests/bunnymark.js rename to prosperon/tests/bunnymark.ce diff --git a/prosperon/tests/camera.js b/prosperon/tests/camera.ce similarity index 100% rename from prosperon/tests/camera.js rename to prosperon/tests/camera.ce diff --git a/prosperon/tests/camera_colorspace.js b/prosperon/tests/camera_colorspace.ce similarity index 100% rename from prosperon/tests/camera_colorspace.js rename to prosperon/tests/camera_colorspace.ce diff --git a/prosperon/tests/camera_colorspace_convert.js b/prosperon/tests/camera_colorspace_convert.ce similarity index 100% rename from prosperon/tests/camera_colorspace_convert.js rename to prosperon/tests/camera_colorspace_convert.ce diff --git a/prosperon/tests/camera_info.js b/prosperon/tests/camera_info.ce similarity index 100% rename from prosperon/tests/camera_info.js rename to prosperon/tests/camera_info.ce diff --git a/prosperon/tests/draw2d.js b/prosperon/tests/draw2d.ce similarity index 100% rename from prosperon/tests/draw2d.js rename to prosperon/tests/draw2d.ce diff --git a/prosperon/tests/prosperon.js b/prosperon/tests/prosperon.ce similarity index 100% rename from prosperon/tests/prosperon.js rename to prosperon/tests/prosperon.ce diff --git a/prosperon/tests/steam.js b/prosperon/tests/steam.ce similarity index 100% rename from prosperon/tests/steam.js rename to prosperon/tests/steam.ce diff --git a/prosperon/tests/surface.js b/prosperon/tests/surface.ce similarity index 100% rename from prosperon/tests/surface.js rename to prosperon/tests/surface.ce diff --git a/prosperon/tests/surface_colorspace.js b/prosperon/tests/surface_colorspace.ce similarity index 100% rename from prosperon/tests/surface_colorspace.js rename to prosperon/tests/surface_colorspace.ce diff --git a/prosperon/tests/webcam.js b/prosperon/tests/webcam.ce similarity index 100% rename from prosperon/tests/webcam.js rename to prosperon/tests/webcam.ce diff --git a/prosperon/tests/window.js b/prosperon/tests/window.ce similarity index 100% rename from prosperon/tests/window.js rename to prosperon/tests/window.ce diff --git a/prosperon/tween.js b/prosperon/tween.cm similarity index 100% rename from prosperon/tween.js rename to prosperon/tween.cm diff --git a/prosperon/video.js b/prosperon/video.cm similarity index 100% rename from prosperon/video.js rename to prosperon/video.cm diff --git a/scripts/base.js b/scripts/base.cm similarity index 100% rename from scripts/base.js rename to scripts/base.cm diff --git a/scripts/cmd.js b/scripts/cmd.cm similarity index 100% rename from scripts/cmd.js rename to scripts/cmd.cm diff --git a/scripts/debug.js b/scripts/debug.cm similarity index 100% rename from scripts/debug.js rename to scripts/debug.cm diff --git a/scripts/dmon.js b/scripts/dmon.cm similarity index 100% rename from scripts/dmon.js rename to scripts/dmon.cm diff --git a/scripts/doc.js b/scripts/doc.cm similarity index 100% rename from scripts/doc.js rename to scripts/doc.cm diff --git a/scripts/docstrings.js b/scripts/docstrings.cm similarity index 100% rename from scripts/docstrings.js rename to scripts/docstrings.cm diff --git a/scripts/enet.js b/scripts/enet.cm similarity index 100% rename from scripts/enet.js rename to scripts/enet.cm diff --git a/scripts/engine.js b/scripts/engine.cm similarity index 91% rename from scripts/engine.js rename to scripts/engine.cm index ab021f4f..019371fd 100644 --- a/scripts/engine.js +++ b/scripts/engine.cm @@ -1,8 +1,10 @@ (function engine() { globalThis.cell = prosperon - cell.hidden.console.print("HELLO\n") cell.DOC = cell.hidden.DOCSYM +var MOD_EXT = '.cm' +var ACTOR_EXT = '.ce' + globalThis.pi = 3.1415926535897932 function caller_data(depth = 0) @@ -22,7 +24,7 @@ function caller_data(depth = 0) return {file,line} } - +cell.id ??= "newguy" function console_rec(line, file, msg) { return `[${cell.id.slice(0,5)}] [${file}:${line}]: ${msg}\n` @@ -97,17 +99,10 @@ if (!io.exists('.cell')) { os.exit(1); } -io.mount("scripts") - -var RESPATH = 'scripts/resources.js' -var canonical = io.realdir(RESPATH) + 'resources.js' -var content = io.slurp(RESPATH) -var resources = js.eval(RESPATH, `(function setup_resources(io){${content}})`).call({}, io) +io.mount(".cell/modules", "") var use_cache = {} -use_cache['resources'] = resources - function print_api(obj) { for (var prop in obj) { if (!obj.hasOwnProperty(prop)) continue @@ -122,7 +117,7 @@ function print_api(obj) { var res_cache = {} -var BASEPATH = 'scripts/base.js' +var BASEPATH = 'scripts/base' + MOD_EXT var script = io.slurp(BASEPATH) var fnname = "base" script = `(function ${fnname}() { ${script}; })` @@ -132,19 +127,9 @@ var inProgress = {} var loadingStack = [] globalThis.use = function use(file, ...args) { - // Normalize the request - remove .js extension if present - var request_name = file - if (file.endsWith('.js')) { - request_name = file.substring(0, file.length - 3) - } - - // Check cache first - both 'transform' and 'transform.js' should return same cached value - for (var cached_key in use_cache) { - if (cached_key === file || cached_key === request_name || - cached_key === request_name + '.js' || - (cached_key.endsWith('.js') && cached_key.substring(0, cached_key.length - 3) === request_name)) { - return use_cache[cached_key] - } + // Check cache first + if (use_cache[file]) { + return use_cache[file] } // Check for circular dependencies @@ -159,11 +144,13 @@ globalThis.use = function use(file, ...args) { ) } - // Try to find the script file - var path = resources.find_script(request_name) + var path = null + if (io.exists(file + MOD_EXT) && !io.is_directory(file + MOD_EXT)) { + path = file + MOD_EXT + } // Check if there's an embedded module - var embed_mod = use_embed(request_name) + var embed_mod = use_embed(file) // If no script and no embedded module, error if (!path && !embed_mod) { @@ -173,28 +160,26 @@ globalThis.use = function use(file, ...args) { // If only embedded module exists, return it if (!path && embed_mod) { use_cache[file] = embed_mod - use_cache[request_name] = embed_mod - if (file !== request_name) { - use_cache[request_name + '.js'] = embed_mod - } return embed_mod } // If we have a script path, check for circular dependency if (inProgress[path]) { - throw new Error(`Circular dependency detected while loading "${file}"`) + throw new Error( + `Circular dependency detected while loading "${file}".\n` + + `Module chain: ${loadingStack.join(" -> ")}\n` + + `Cycle specifically: ${cyclePath.join(" -> ")}` + ) + } inProgress[path] = true loadingStack.push(file) // Determine the compiled file path in .cell directory - var compiledPath = path + '.o' + var compiledPath = ".cell/build/" + io.realdir(path) + "/" + path + '.o' - // Ensure .cell directory exists - if (!io.exists('.cell')) { - io.mkdir('.cell') - } + io.mkdir(compiledPath.dir()) // Check if compiled version exists and is newer than source var useCompiled = false @@ -210,7 +195,6 @@ globalThis.use = function use(file, ...args) { var mod_name = path.name() if (useCompiled) { - // Load compiled bytecode var compiledBlob = io.slurpbytes(compiledPath) fn = js.compile_unblob(compiledBlob) fn = js.eval_compile(fn) @@ -245,13 +229,8 @@ globalThis.use = function use(file, ...args) { loadingStack.pop() delete inProgress[path] - // Cache under all possible keys - use_cache[path] = ret + // Cache the result use_cache[file] = ret - use_cache[request_name] = ret - if (file !== request_name && !file.endsWith('.js')) { - use_cache[request_name + '.js'] = ret - } return ret } @@ -286,7 +265,7 @@ stone.p = function(object) return Object.isFrozen(object) } -var DOCPATH = 'scripts/doc.js' +var DOCPATH = 'scripts/doc' + MOD_EXT var script = io.slurp(DOCPATH) var fnname = "doc" script = `(function ${fnname}() { ${script}; })` @@ -648,11 +627,6 @@ if (overling) actor_prep(overling, {type:'greet', actor: $_}) if (!cell.args.program) os.exit(1) -if (typeof cell.args.program !== 'string') - cell.args.program = 'main.js'; - -actor_mod.setname(cell.args.program) - function destroyself() { log.spam(`Got the message to destroy self.`) dying = true @@ -731,9 +705,31 @@ function enet_check() //enet_check(); // Finally, run the program -var prog = resources.find_script(cell.args.program) -prog = io.slurp(prog) -var prog_script = `(function ${cell.args.program.name()}($_) { ${prog} })` +actor_mod.setname(cell.args.program) + +var prog = null +var progPath = cell.args.program + +if (io.exists(progPath + ACTOR_EXT) && !io.is_directory(progPath + ACTOR_EXT)) { + prog = progPath + ACTOR_EXT +} else if (io.exists(progPath) && io.is_directory(progPath)) { + var mainPath = progPath + '/main' + ACTOR_EXT + if (io.exists(mainPath) && !io.is_directory(mainPath)) { + prog = mainPath + } +} + +if (!prog) + throw new Error(cell.args.program + " not found."); + +// Mount the directory containing the program +var progDir = prog.substring(0, prog.lastIndexOf('/')) +if (progDir && progDir !== '.') { + io.mount(progDir, "") +} + +var progContent = io.slurp(prog) +var prog_script = `(function ${cell.args.program.name()}($_) { ${progContent} })` var val = js.eval(cell.args.program, prog_script)($_) if (val) throw new Error('Program must not return anything'); diff --git a/scripts/event.js b/scripts/event.cm similarity index 100% rename from scripts/event.js rename to scripts/event.cm diff --git a/scripts/http.js b/scripts/http.cm similarity index 100% rename from scripts/http.js rename to scripts/http.cm diff --git a/scripts/io.js b/scripts/io.cm similarity index 100% rename from scripts/io.js rename to scripts/io.cm diff --git a/scripts/js.js b/scripts/js.cm similarity index 100% rename from scripts/js.js rename to scripts/js.cm diff --git a/scripts/json.js b/scripts/json.cm similarity index 100% rename from scripts/json.js rename to scripts/json.cm diff --git a/scripts/math.js b/scripts/math.cm similarity index 100% rename from scripts/math.js rename to scripts/math.cm diff --git a/scripts/miniz.js b/scripts/miniz.cm similarity index 100% rename from scripts/miniz.js rename to scripts/miniz.cm diff --git a/scripts/nota.js b/scripts/nota.cm similarity index 100% rename from scripts/nota.js rename to scripts/nota.cm diff --git a/scripts/os.js b/scripts/os.cm similarity index 100% rename from scripts/os.js rename to scripts/os.cm diff --git a/scripts/parseq.js b/scripts/parseq.cm similarity index 100% rename from scripts/parseq.js rename to scripts/parseq.cm diff --git a/scripts/time.js b/scripts/time.cm similarity index 100% rename from scripts/time.js rename to scripts/time.cm diff --git a/scripts/toml.cm b/scripts/toml.cm new file mode 100644 index 00000000..9ccb7442 --- /dev/null +++ b/scripts/toml.cm @@ -0,0 +1,169 @@ +// Simple TOML parser for shop.toml +// Supports basic TOML features needed for the module system + +function parse_toml(text) { + var lines = text.split('\n') + var result = {} + var current_section = result + var current_section_name = '' + + for (var i = 0; i < lines.length; i++) { + var line = lines[i].trim() + + // Skip empty lines and comments + if (!line || line.startsWith('#')) continue + + // Section header + if (line.startsWith('[') && line.endsWith(']')) { + var section_path = line.slice(1, -1).split('.') + current_section = result + current_section_name = section_path.join('.') + + for (var j = 0; j < section_path.length; j++) { + var key = section_path[j] + if (!current_section[key]) { + current_section[key] = {} + } + current_section = current_section[key] + } + continue + } + + // Key-value pair + var eq_index = line.indexOf('=') + if (eq_index > 0) { + var key = line.substring(0, eq_index).trim() + var value = line.substring(eq_index + 1).trim() + + // Parse value + if (value.startsWith('"') && value.endsWith('"')) { + // String - unescape quotes + current_section[key] = value.slice(1, -1).replace(/\\"/g, '"') + } else if (value.startsWith('[') && value.endsWith(']')) { + // Array + current_section[key] = parse_array(value) + } else if (value === 'true' || value === 'false') { + // Boolean + current_section[key] = value === 'true' + } else if (!isNaN(Number(value))) { + // Number + current_section[key] = Number(value) + } else { + // Unquoted string + current_section[key] = value + } + } + } + + return result +} + +function parse_array(str) { + // Remove brackets + str = str.slice(1, -1).trim() + if (!str) return [] + + var items = [] + var current = '' + var in_quotes = false + + for (var i = 0; i < str.length; i++) { + var char = str[i] + + if (char === '"' && (i === 0 || str[i-1] !== '\\')) { + in_quotes = !in_quotes + current += char + } else if (char === ',' && !in_quotes) { + items.push(parse_value(current.trim())) + current = '' + } else { + current += char + } + } + + if (current.trim()) { + items.push(parse_value(current.trim())) + } + + return items +} + +function parse_value(str) { + if (str.startsWith('"') && str.endsWith('"')) { + return str.slice(1, -1).replace(/\\"/g, '"') + } else if (str === 'true' || str === 'false') { + return str === 'true' + } else if (!isNaN(Number(str))) { + return Number(str) + } else { + return str + } +} + +function encode_toml(obj) { + var result = [] + + function encode_value(value) { + if (typeof value === 'string') { + return '"' + value.replace(/"/g, '\\"') + '"' + } else if (typeof value === 'boolean') { + return value ? 'true' : 'false' + } else if (typeof value === 'number') { + return String(value) + } else if (Array.isArray(value)) { + var items = [] + for (var i = 0; i < value.length; i++) { + items.push(encode_value(value[i])) + } + return '[' + items.join(', ') + ']' + } + return String(value) + } + + // First pass: encode top-level simple values + var keys = Object.keys(obj) + for (var i = 0; i < keys.length; i++) { + var key = keys[i] + var value = obj[key] + if (value === null || typeof value !== 'object' || Array.isArray(value)) { + result.push(key + ' = ' + encode_value(value)) + } + } + + // Second pass: encode nested objects + function encode_section(obj, path) { + var keys = Object.keys(obj) + + for (var i = 0; i < keys.length; i++) { + var key = keys[i] + var value = obj[key] + + if (value !== null && typeof value === 'object' && !Array.isArray(value)) { + // Nested object - create section + var section_path = path ? path + '.' + key : key + result.push('[' + section_path + ']') + + // First encode direct properties of this section + var section_keys = Object.keys(value) + for (var j = 0; j < section_keys.length; j++) { + var sk = section_keys[j] + var sv = value[sk] + if (sv === null || typeof sv !== 'object' || Array.isArray(sv)) { + result.push(sk + ' = ' + encode_value(sv)) + } + } + + // Then encode nested sections + encode_section(value, section_path) + } + } + } + + encode_section(obj, '') + return result.join('\n') +} + +return { + decode: parse_toml, + encode: encode_toml +} \ No newline at end of file diff --git a/scripts/util.js b/scripts/util.cm similarity index 100% rename from scripts/util.js rename to scripts/util.cm diff --git a/scripts/vendor.ce b/scripts/vendor.ce new file mode 100644 index 00000000..ef21de1b --- /dev/null +++ b/scripts/vendor.ce @@ -0,0 +1,3 @@ +log.console(`not implemented.sorry.`) + +$_.stop() \ No newline at end of file diff --git a/scripts/wota.js b/scripts/wota.cm similarity index 100% rename from scripts/wota.js rename to scripts/wota.cm diff --git a/source/cell.c b/source/cell.c index 69c6bb8a..ba337548 100644 --- a/source/cell.c +++ b/source/cell.c @@ -40,7 +40,7 @@ int tracy_profiling_enabled = 0; -#define ENGINE "engine.js" +#define ENGINE "engine.cm" static cell_rt **ready_queue = NULL; static cell_rt **main_ready_queue = NULL; @@ -202,7 +202,10 @@ int prosperon_mount_core(void) eocd_pos = i; break; } - if (eocd_pos < 0) return fprintf(stderr, "EOCD not found\n"), free(zip_buffer_global), 0; + if (eocd_pos < 0) { + free(zip_buffer_global); + return 0; + } uint16_t comment_length = zip_buffer_global[eocd_pos + 20] | (zip_buffer_global[eocd_pos + 21] << 8); int eocd_size = 22 + comment_length; diff --git a/source/qjs_actor.c b/source/qjs_actor.c index b24ca6c3..60e8a8eb 100644 --- a/source/qjs_actor.c +++ b/source/qjs_actor.c @@ -154,6 +154,7 @@ JSC_CCALL(os_unneeded, JSC_CCALL(os_destroy, cell_rt *rt = JS_GetContextOpaque(js); rt->need_stop = 1; + set_actor_state(rt); ) JSC_SCALL(actor_setname, diff --git a/tests/blob.js b/tests/blob.ce similarity index 100% rename from tests/blob.js rename to tests/blob.ce diff --git a/tests/comments.js b/tests/comments.ce similarity index 91% rename from tests/comments.js rename to tests/comments.ce index 8448a5c8..d4a644b4 100644 --- a/tests/comments.js +++ b/tests/comments.ce @@ -10,7 +10,7 @@ function load_comment_from_api_requestor(id) { $_.receiver(tree => { var child_reqs = tree.children.map(child => cb => { - $_.start(e => send(e.actor, child, cb), "tests/comments.js") + $_.start(e => send(e.actor, child, cb), "tests/comments") }) var job = parseq.par_all({ diff --git a/tests/contact.js b/tests/contact.ce similarity index 100% rename from tests/contact.js rename to tests/contact.ce diff --git a/tests/delay.js b/tests/delay.ce similarity index 100% rename from tests/delay.js rename to tests/delay.ce diff --git a/tests/empty.js b/tests/empty.ce similarity index 100% rename from tests/empty.js rename to tests/empty.ce diff --git a/tests/http.js b/tests/http.ce similarity index 100% rename from tests/http.js rename to tests/http.ce diff --git a/tests/https.js b/tests/https.ce similarity index 96% rename from tests/https.js rename to tests/https.ce index 87508338..c44edf54 100644 --- a/tests/https.js +++ b/tests/https.ce @@ -45,5 +45,5 @@ $_.start(e => { // Start status checking after a small delay $_.delay(checkin, 0.01) } -}, "examples/http_download_actor.js") +}, "examples/http_download_actor") diff --git a/tests/mod1.cm b/tests/mod1.cm new file mode 100644 index 00000000..0d8c04d9 --- /dev/null +++ b/tests/mod1.cm @@ -0,0 +1 @@ +return "ok!" \ No newline at end of file diff --git a/tests/nota.js b/tests/nota.ce similarity index 100% rename from tests/nota.js rename to tests/nota.ce diff --git a/tests/overling.js b/tests/overling.ce similarity index 91% rename from tests/overling.js rename to tests/overling.ce index 43b49cea..10589e1c 100644 --- a/tests/overling.js +++ b/tests/overling.ce @@ -10,4 +10,4 @@ $_.start(e => { $_.stop(e.actor) } -}, "tests/underling.js"); +}, "tests/underling"); diff --git a/tests/parseq.js b/tests/parseq.ce similarity index 95% rename from tests/parseq.js rename to tests/parseq.ce index 3e5be79f..5971625a 100644 --- a/tests/parseq.js +++ b/tests/parseq.ce @@ -31,5 +31,5 @@ $_.start(e => { log.console(`took ${os.now()-st} secs`) }); -}, "tests/comments.js") +}, "tests/comments") diff --git a/tests/portal.js b/tests/portal.ce similarity index 100% rename from tests/portal.js rename to tests/portal.ce diff --git a/tests/portalspawner.js b/tests/portalspawner.ce similarity index 52% rename from tests/portalspawner.js rename to tests/portalspawner.ce index 09358a2e..22f05061 100644 --- a/tests/portalspawner.js +++ b/tests/portalspawner.ce @@ -1,9 +1,9 @@ // Creates a portal and a separate actor to contact -//os.createprocess(["./prosperon", "tests/portal.js"]) +//os.createprocess(["./prosperon", "tests/portal"]) //$_.delay(_ => { -// os.createprocess(["./prosperon", "tests/contact.js"]) +// os.createprocess(["./prosperon", "tests/contact"]) // $_.stop() // $_.delay($_.stop, 0.1) //}, 0.2) diff --git a/tests/qr.js b/tests/qr.ce similarity index 100% rename from tests/qr.js rename to tests/qr.ce diff --git a/tests/qr_drag.js b/tests/qr_drag.ce similarity index 100% rename from tests/qr_drag.js rename to tests/qr_drag.ce diff --git a/tests/reply.js b/tests/reply.ce similarity index 100% rename from tests/reply.js rename to tests/reply.ce diff --git a/tests/send.js b/tests/send.ce similarity index 91% rename from tests/send.js rename to tests/send.ce index 859975db..6ceff41e 100644 --- a/tests/send.js +++ b/tests/send.ce @@ -6,4 +6,4 @@ $_.start(e => { log.console(`Original sender got message back: ${json.encode(msg)}. Stopping!`) $_.stop() }) -}, "tests/reply.js") +}, "tests/reply") diff --git a/tests/spawn_actor.js b/tests/spawn_actor.ce similarity index 100% rename from tests/spawn_actor.js rename to tests/spawn_actor.ce diff --git a/tests/spawnee.js b/tests/spawnee.ce similarity index 100% rename from tests/spawnee.js rename to tests/spawnee.ce diff --git a/tests/spawner.js b/tests/spawner.ce similarity index 74% rename from tests/spawner.js rename to tests/spawner.ce index cb44df20..d47daf1d 100644 --- a/tests/spawner.js +++ b/tests/spawner.ce @@ -2,7 +2,7 @@ function spawnem() { for (var i = 0; i < 10; i++) - $_.start(_ => {}, "tests/spawnee.js") + $_.start(_ => {}, "tests/spawnee") } with ([1,2,3]) { diff --git a/tests/test_actor_access.js b/tests/test_actor_access.ce similarity index 91% rename from tests/test_actor_access.js rename to tests/test_actor_access.ce index 25cebc08..7a51bb33 100644 --- a/tests/test_actor_access.js +++ b/tests/test_actor_access.ce @@ -8,7 +8,7 @@ if (typeof $_ !== 'undefined') { log.console(" $_.clock is a", typeof $_.clock); // Test spawning another actor - var child = this.spawn('test_child_actor.js'); + var child = this.spawn('test_child_actor'); // Test using a module var testModule = use('test_module'); diff --git a/tests/test_args.js b/tests/test_args.ce similarity index 100% rename from tests/test_args.js rename to tests/test_args.ce diff --git a/tests/test_child_actor.js b/tests/test_child_actor.ce similarity index 100% rename from tests/test_child_actor.js rename to tests/test_child_actor.ce diff --git a/tests/test_event_watch.js b/tests/test_event_watch.ce similarity index 100% rename from tests/test_event_watch.js rename to tests/test_event_watch.ce diff --git a/tests/test_module.js b/tests/test_module.ce similarity index 100% rename from tests/test_module.js rename to tests/test_module.ce diff --git a/tests/test_use_args.js b/tests/test_use_args.ce similarity index 100% rename from tests/test_use_args.js rename to tests/test_use_args.ce diff --git a/tests/toml.ce b/tests/toml.ce new file mode 100644 index 00000000..5664c030 --- /dev/null +++ b/tests/toml.ce @@ -0,0 +1,121 @@ +var toml = use('toml') + +// Test basic types +var basic_obj = { + string_value: "hello world", + number_value: 42, + float_value: 3.14, + bool_true: true, + bool_false: false, + array_mixed: ["string", 123, true, false] +} + +log.console("Testing basic types...") +var encoded = toml.encode(basic_obj) +log.console("Encoded:") +log.console(encoded) +log.console("") + +var decoded = toml.decode(encoded) +log.console("Decoded:") +log.console(JSON.stringify(decoded, null, 2)) +log.console("") + +// Test nested objects +var nested_obj = { + name: "Test Config", + version: 1.0, + database: { + host: "localhost", + port: 5432, + credentials: { + username: "admin", + password: "secret123" + } + }, + servers: { + alpha: { + ip: "192.168.1.1", + port: 8080 + }, + beta: { + ip: "192.168.1.2", + port: 8081 + } + }, + features: ["auth", "api", "websocket"] +} + +log.console("Testing nested objects...") +encoded = toml.encode(nested_obj) +log.console("Encoded:") +log.console(encoded) +log.console("") + +decoded = toml.decode(encoded) +log.console("Decoded:") +log.console(JSON.stringify(decoded, null, 2)) +log.console("") + +// Test edge cases +var edge_cases = { + empty_string: "", + string_with_quotes: 'She said "Hello"', + empty_array: [], + single_array: [42], + nested_empty: { + section: {} + } +} + +log.console("Testing edge cases...") +encoded = toml.encode(edge_cases) +log.console("Encoded:") +log.console(encoded) +log.console("") + +decoded = toml.decode(encoded) +log.console("Decoded:") +log.console(JSON.stringify(decoded, null, 2)) +log.console("") + +// Verify round-trip conversion +log.console("Verifying round-trip conversion...") +function deep_equal(a, b) { + if (a === b) return true + if (a == null || b == null) return false + if (typeof a !== typeof b) return false + + if (typeof a === 'object') { + var keys_a = Object.keys(a) + var keys_b = Object.keys(b) + if (keys_a.length !== keys_b.length) return false + + for (var i = 0; i < keys_a.length; i++) { + if (!deep_equal(a[keys_a[i]], b[keys_a[i]])) return false + } + return true + } + + return false +} + +var test_cases = [basic_obj, nested_obj, edge_cases] +var all_passed = true + +for (var i = 0; i < test_cases.length; i++) { + var original = test_cases[i] + var round_trip = toml.decode(toml.encode(original)) + var passed = deep_equal(original, round_trip) + log.console("Test case " + (i + 1) + ": " + (passed ? "PASSED" : "FAILED")) + if (!passed) { + all_passed = false + log.console("Original:", JSON.stringify(original)) + log.console("Round-trip:", JSON.stringify(round_trip)) + } +} + +log.console("") +log.console("Overall result: " + (all_passed ? "ALL TESTS PASSED" : "SOME TESTS FAILED")) + +$_.stop() \ No newline at end of file diff --git a/tests/underling.js b/tests/underling.ce similarity index 100% rename from tests/underling.js rename to tests/underling.ce diff --git a/tests/unneeded.js b/tests/unneeded.ce similarity index 100% rename from tests/unneeded.js rename to tests/unneeded.ce diff --git a/tests/user.ce b/tests/user.ce new file mode 100644 index 00000000..f84986a1 --- /dev/null +++ b/tests/user.ce @@ -0,0 +1,9 @@ +var spline = use('extramath/spline') + +log.console('module import worked') + +var mod = use('mod1') + +log.console('local import worked') + +$_.stop() diff --git a/tests/wota.js b/tests/wota.ce similarity index 100% rename from tests/wota.js rename to tests/wota.ce