Change also shell and server

Signed-off-by: Francis Bouvier <francis.bouvier@gmail.com>
This commit is contained in:
Francis Bouvier
2023-06-05 16:01:03 +02:00
parent e0eee45156
commit 2d71275a3c
2 changed files with 12 additions and 10 deletions

View File

@@ -2,13 +2,14 @@ const std = @import("std");
const jsruntime = @import("jsruntime");
const parser = @import("parser.zig");
const DOM = @import("dom.zig");
const html = @import("html_test.zig").html;
const html_test = @import("html_test.zig").html;
const socket_path = "/tmp/browsercore-server.sock";
var doc: DOM.HTMLDocument = undefined;
var doc: *parser.DocumentHTML = undefined;
var server: std.net.StreamServer = undefined;
fn execJS(
@@ -54,9 +55,9 @@ pub fn main() !void {
defer vm.deinit();
// document
doc = DOM.HTMLDocument.init();
defer doc.deinit();
try doc.parse(html);
doc = parser.documentHTMLInit();
defer parser.documentHTMLDeinit(doc);
try parser.documentHTMLParse(doc, html_test);
// remove socket file of internal server
// reuse_address (SO_REUSEADDR flag) does not seems to work on unix socket

View File

@@ -3,11 +3,12 @@ const std = @import("std");
const jsruntime = @import("jsruntime");
const Console = @import("jsruntime").Console;
const parser = @import("parser.zig");
const DOM = @import("dom.zig");
const html = @import("html_test.zig").html;
const html_test = @import("html_test.zig").html;
var doc: DOM.HTMLDocument = undefined;
var doc: *parser.DocumentHTML = undefined;
fn execJS(
alloc: std.mem.Allocator,
@@ -32,9 +33,9 @@ pub fn main() !void {
const apis = jsruntime.compile(DOM.Interfaces);
// document
doc = DOM.HTMLDocument.init();
defer doc.deinit();
try doc.parse(html);
doc = parser.documentHTMLInit();
defer parser.documentHTMLDeinit(doc);
try parser.documentHTMLParse(doc, html_test);
// create JS vm
const vm = jsruntime.VM.init();