Skip to content

Commit

Permalink
No more missing functions yay!
Browse files Browse the repository at this point in the history
  • Loading branch information
lupyuen committed May 25, 2023
1 parent 8bbbb22 commit e99593d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Binary file modified lvglwasm.wasm
Binary file not shown.
28 changes: 28 additions & 0 deletions lvglwasm.zig
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,17 @@ fn createWidgetsUnwrapped() !void {
c.lv_obj_align(label, c.LV_ALIGN_CENTER, 0, -30);
}

///////////////////////////////////////////////////////////////////////////////
// LVGL Porting Layer for WebAssembly

/// TODO: Return the number of elapsed milliseconds
export fn millis() u32 {
elapsed_ms += 1;
return elapsed_ms;
}

var elapsed_ms: u32 = 0;

///////////////////////////////////////////////////////////////////////////////
// Panic Handler

Expand Down Expand Up @@ -203,6 +214,23 @@ const debug = std.log.debug;
// C Standard Library
// From zig-macos-x86_64-0.10.0-dev.2351+b64a1d5ab/lib/zig/c.zig

export fn memset(dest: ?[*]u8, c2: u8, len: usize) callconv(.C) ?[*]u8 {
@setRuntimeSafety(false);

if (len != 0) {
var d = dest.?;
var n = len;
while (true) {
d.* = c2;
n -= 1;
if (n == 0) break;
d += 1;
}
}

return dest;
}

export fn memcpy(noalias dest: ?[*]u8, noalias src: ?[*]const u8, len: usize) callconv(.C) ?[*]u8 {
@setRuntimeSafety(false);

Expand Down

0 comments on commit e99593d

Please sign in to comment.