Skip to content

Commit

Permalink
fixing up console.log
Browse files Browse the repository at this point in the history
  • Loading branch information
konsumer committed Oct 21, 2024
1 parent 4b0a211 commit c1a2283
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 0 additions & 2 deletions cart/as/null0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -825,10 +825,8 @@ declare function _null0_file_read(filename: ArrayBuffer, byteSize:UsizePointer,
function file_read(filename: string): ArrayBuffer {
const i = file_info(filename)
const ret = new ArrayBuffer(<i32>i.filesize)
console.log(`in AS: ${i.filesize.toString()} ${ret.byteLength.toString()}`)
const b = new UsizePointer()
_null0_file_read(String.UTF8.encode(filename, true), b, ret)
console.log(`in AS, from read: ${b.value.toString()}`)
return ret
}

Expand Down
1 change: 0 additions & 1 deletion cart/as/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export function load(): void {
y = 120 - (d.height/2)

const t = file_read("assets/cyber.txt")
console.log(`WASM ArrayBuffer size: ${t.byteLength.toString()}`)
console.log(String.UTF8.decode(t, false))
}

Expand Down
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
<!-- <null0-cart src="cart/c/colorbars.null0" fps></null0-cart> -->
<!-- <null0-cart src="cart/c/draw.null0" fps></null0-cart> -->
<!-- <null0-cart src="cart/c/hello.null0" fps></null0-cart> -->
<null0-cart src="cart/c/flappybird.null0" fps></null0-cart>
<!-- <null0-cart src="cart/c/flappybird.null0" fps></null0-cart> -->
<!-- <null0-cart src="cart/c/sound.null0" fps></null0-cart> -->
<!-- <null0-cart src="cart/example-as.null0" fps></null0-cart> -->
<null0-cart src="cart/example-as.null0" fps></null0-cart>
<!-- <null0-cart src="cart/c/typesizes.null0" fps></null0-cart> -->
<!-- <null0-cart src="cart/c/filesystem.null0"></null0-cart> -->
<!-- <null0-cart src="cart/c/justlog.null0"></null0-cart> -->
Expand Down
10 changes: 6 additions & 4 deletions docs/null0.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,12 @@ export async function setupCart (

// not exactly right, since it will add newlines, but this covers printf and stuff
text = text.replace(/\n*$/, '')
if (fd === 1) {
console.log(text)
} else {
console.error(text)
if (text.trim() !== '') {
if (fd === 1) {
console.log(text)
} else {
console.error(text)
}
}
}
return 0
Expand Down

0 comments on commit c1a2283

Please sign in to comment.