From: Brendan Hansen Date: Wed, 5 Apr 2023 18:34:55 +0000 (-0500) Subject: updated: many pages and dependencies X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=5b984461fe90a646d56bde16e7d9dc39eec8c75f;p=onyxlang.io.git updated: many pages and dependencies --- diff --git a/onyx-pkg.ini b/onyx-pkg.ini index 3d256dd..2161be1 100644 --- a/onyx-pkg.ini +++ b/onyx-pkg.ini @@ -17,9 +17,9 @@ build_cmd= library= [dependencies] -git://onyxlang.io/repo/http-server=0.1.19 -git://onyxlang.io/repo/postgres-orm=0.0.24 -git://onyxlang.io/repo/otmp=0.0.6 +git://onyxlang.io/repo/http-server=0.1.22 +git://onyxlang.io/repo/postgres-orm=0.0.25 +git://onyxlang.io/repo/otmp=0.0.7 [dependency_folders] git://onyxlang.io/repo/http-server=http-server diff --git a/src/app.onyx b/src/app.onyx index 5038434..4b977df 100644 --- a/src/app.onyx +++ b/src/app.onyx @@ -1,11 +1,14 @@ +use core {package, *} +use runtime +use otmp +use http +use http.server {Req :: Request, Res :: Response, route} + #inject runtime.vars { Enable_Heap_Debug :: true Debug :: true } -use core -use http.server {Req :: Request, Res :: Response, route} - reg: otmp.TemplateRegistry; #inject Res { render :: (r: &Res, template: str, vars: any) { @@ -20,6 +23,12 @@ reg: otmp.TemplateRegistry; res->render("pages/homepage", null); } + +@route.{.GET, "/ovmwasm"} +(req: &Req, res: &Res) { + res->render("pages/ovmwasm", null); +} + @route.{.GET, "/docs"} (req: &Req, res: &Res) { res->render("pages/docs", null); @@ -30,33 +39,38 @@ reg: otmp.TemplateRegistry; res->render("pages/docs/install", null); } -@route.{.GET, "/news"} +@route.{.GET, "/news/:article"} (req: &Req, res: &Res) { - if a := req.query->get_opt("a"); a { - filename := tprintf("www/news-articles/{}.html", a.value); - if os.file_exists(filename) { - article := os.get_contents(filename); - defer delete(&article); - - res->render("pages/news_article", &.{ - article = article - }); - } + // TODO: Safety / error checking here + filename := tprintf("www/news-articles/{}.html", req.url_params["article"]); + + if os.file_exists(filename) { + article := os.get_contents(filename); + defer delete(&article); + + res->render("pages/news_article", &.{ + article = article + }); } else { - articles := make([..] str); + res->status(404); + } +} - for os.list_directory("www/news-articles") { - name := it->name(); - if string.ends_with(name, ".html") { - articles << string.temp_copy(name[0 .. name.length-5]); - } - } +@route.{.GET, "/news"} +(req: &Req, res: &Res) { + articles := make([..] str); - res->render("pages/news", &.{ - articles = articles - }); + for os.list_directory("www/news-articles") { + name := it->name(); + if string.ends_with(name, ".html") { + articles << string.temp_copy(name[0 .. name.length-5]); + } } + + res->render("pages/news", &.{ + articles = articles + }); } main :: () { @@ -89,7 +103,7 @@ main :: () { logger := http.server.logger(); app->pipe(&logger); - app->serve(8080); + app->serve(8081); println("Server stopping..."); } diff --git a/www/news-articles/ovmwasm.html b/www/news-articles/ovmwasm.html new file mode 100644 index 0000000..834dc50 --- /dev/null +++ b/www/news-articles/ovmwasm.html @@ -0,0 +1,35 @@ +
+

Onyx's Custom Runtime

+ +

+ As Onyx targets WebAssembly (WASM) exclusively, running code outside of the browser requires a WASM embedder. + The job of the embedder is to translate the WASM Virtual Instruction Set Architecture into a "real" architecture that can be executed on the host system. + There are many great WASM embedders that exist for running WASM outside the browser. Here's a small, non-comprehensive list: +

+ + +

+ All of these embedders are great in their own way, but the one thing they are not great at is providing a great developer experience for Onyx. For this reason, Onyx maintains support for two WASM embedders: Wasmer and OVM-Wasm. Wasmer is used as the faster, production-ready embedder, while OVM-Wasm is used as the development embedder. +

+ +

+ OVM-Wasm stands for Onyx Virtual Machine for WASM. The Onyx Virtual Machine (OVM) started as a separate project with the goal of providing a separate compile-target for Onyx; however, to reduce complexity, OVM-Wasm was created as a wrapper around OVM, that provides a wasm-c-api compatible interface, making it a WASM embedder. + Since OVM-Wasm is entirely specific to Onyx and can be easily modified to suit the needs of developing Onyx. + It has more features compared to a normal WASM embedder, such a debugging interface that is compatible with the Debug Adapter Protocol. +

+ +

+ Currently, it does not run as fast as it could. + This is due to several reason, but largely because it simply compiles WebAssembly down to an interpreted instruction stream, not machine-native instructions. + This was done to make OVM-Wasm more portable, but does come at a significant performance cost. + To compound onto this fact, the instruction stream itself is not optimized at all. + It is the most literal, WASM to OVM conversion possible. + This helps make the initial startup time faster, but does incur wasted performance. + It is on the (rather large) list of to-dos to add simple optimizations to the embedding process to make OVM-Wasm not horribly slow. +

+
diff --git a/www/static/css/new_style.css b/www/static/css/new_style.css index 5d9af00..6db2f8a 100644 --- a/www/static/css/new_style.css +++ b/www/static/css/new_style.css @@ -62,6 +62,14 @@ a:visited { margin: 0 auto; } +.container > p { + margin-top: 20px; +} + +.container ul { + padding-left: 20px; +} + .container.center { display: flex; justify-content: center; @@ -102,6 +110,7 @@ code { /* Nagivation */ .navbar-container { max-width: 1200px; + width: 1200px; margin: 0 auto; } @@ -187,3 +196,10 @@ navbar a { text-align: justify; } + +main { + min-height: 100vh; + display: grid; + grid-template-rows: auto 1fr auto; +} + diff --git a/www/static/vendor/highlight.min.js b/www/static/vendor/highlight.min.js index 6ed9a7a..5f9e666 100644 --- a/www/static/vendor/highlight.min.js +++ b/www/static/vendor/highlight.min.js @@ -2579,10 +2579,10 @@ var hljs = (function () { "for", "while", "do", "switch", "case", "break", "continue", "return", "defer", "fallthrough", - "as", "cast", "sizeof", "alignof", "typeof" + "cast", "sizeof", "alignof", "typeof" ], literal: "true false null null_proc null_str", - type: "i8 u8 i16 u16 i32 u32 i64 u64 f32 f64 rawptr str cstr i8x16 i16x8 i32x4 i64x2 f32x4 f64x2 v128 type_expr any", + type: "i8 u8 i16 u16 i32 u32 i64 u64 f32 f64 rawptr str cstr dyn_str i8x16 i16x8 i32x4 i64x2 f32x4 f64x2 v128 type_expr any", built_in: "math map set array random iter list conv type_info", }, diff --git a/www/templates/pages/404.html b/www/templates/pages/404.html index 0d5307b..42b2056 100644 --- a/www/templates/pages/404.html +++ b/www/templates/pages/404.html @@ -1,8 +1,8 @@ {{block "content"}} -{% partial "partials/navbar" %} -
+ {% partial "partials/navbar" %} +

404 - Page not found

diff --git a/www/templates/pages/docs.html b/www/templates/pages/docs.html index 2282374..d791f2a 100644 --- a/www/templates/pages/docs.html +++ b/www/templates/pages/docs.html @@ -6,8 +6,11 @@ diff --git a/www/templates/pages/docs/install.html b/www/templates/pages/docs/install.html index cf3233b..95e01ed 100644 --- a/www/templates/pages/docs/install.html +++ b/www/templates/pages/docs/install.html @@ -2,26 +2,39 @@

Installing Onyx

+

+ Online + Linux + Windows + MacOS +

-
+

Try Online

Onyx is available to try online for free in Onyx Playground. - It allows you learn the syntax from examples, without installing the language. + It allows you learn the syntax from examples, without installing the language onto your system.

-
+

Linux

+

+

-
+

Windows

+

+

-
+

MacOS

+

+ MacOS support is not being actively worked on at the moment. In theory, if the compiler would work on MacOS, WebAssembly binaries would have no problem running using Wasmer, Wasmtime, or a similar runtime. Onyx is always open for contributions from others on its pull requests. +

diff --git a/www/templates/pages/homepage.html b/www/templates/pages/homepage.html index 2738a2a..8ca5ca9 100644 --- a/www/templates/pages/homepage.html +++ b/www/templates/pages/homepage.html @@ -17,12 +17,12 @@
  • Runs everywhere using WebAssembly
  • Fast compilation times (300,000+ lines / second)
  • -
  • Self-hosted, debuggable runtime using OVM-Wasm
  • +
  • Self-hosted, debuggable runtime using OVM-Wasm
  • Secure runtime using Wasmer
-
use core
+    
use core {println}
 
 main :: () {
     f := factorial(10);
@@ -45,7 +45,7 @@ factorial :: (n: i32) -> i32 {
     

Portable

-

By targetting WASM, Onyx can used in the browser, or natively with a custom runtime.

+

By targetting WASM, Onyx can be used in the browser, or natively with a custom runtime.

Data-Oriented

diff --git a/www/templates/pages/news.html b/www/templates/pages/news.html index a715cdd..3a2022a 100644 --- a/www/templates/pages/news.html +++ b/www/templates/pages/news.html @@ -6,7 +6,7 @@ diff --git a/www/templates/pages/news_article.html b/www/templates/pages/news_article.html index e4c63d0..db9362f 100644 --- a/www/templates/pages/news_article.html +++ b/www/templates/pages/news_article.html @@ -1,8 +1,8 @@ {{block "content"}} -{% partial "partials/navbar" %} -
+ {% partial "partials/navbar" %} +
{% $article %}
diff --git a/www/templates/pages/normal_page.html b/www/templates/pages/normal_page.html index 076e684..96e6d61 100644 --- a/www/templates/pages/normal_page.html +++ b/www/templates/pages/normal_page.html @@ -2,7 +2,9 @@
{% partial "partials/navbar" %} -{% block "page_content" %} +
+ {% block "page_content" %} +
{% partial "partials/footer" %}