Created
August 18, 2022 07:38
-
-
Save valstu/8db7a8f15c0b2e4e6cbc7e24422add15 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@external("env", "_g") | |
export declare function GUARD(id: i32, maxiter: i32): i32 | |
@external("env", "accept") | |
export declare function ACCEPT(read_ptr: string, read_len: i32, err: i64): i64 | |
@external("env", "trace") | |
export declare function TRACE(mread_ptr: string, mread_len: i32, dread_ptr: string, dread_len: i32, as_hex: i32): i64 | |
//////////////////// | |
export function LOG (text: string): void { | |
TRACE(text, text.length * 2, text, text.length * 2, 0) | |
} | |
export function OK (text: string = 'OK'): void { | |
ACCEPT(text, text.length * 2, 0) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { GUARD, LOG, OK } from './lib'; | |
export function cbak(reserved: i32): i64 { | |
return 0 | |
} | |
export function hook(reserved: i32): i64 { | |
for (let i = 0; GUARD(10, 10), i < 3; i++) { | |
LOG('-- LOOP :D --') | |
} | |
OK('-- OK :) --') | |
GUARD(1, 1) | |
return 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment