getTime API
This commit is contained in:
parent
eb2562c665
commit
14c339f9a4
@ -40,5 +40,7 @@ module.exports = () => {
|
|||||||
|
|
||||||
s.info = info;
|
s.info = info;
|
||||||
|
|
||||||
|
s.getTime = () => lib.getTime(cxt);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
};
|
};
|
||||||
|
@ -22,6 +22,7 @@ describe('dump', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
inst.on('finish', () => {
|
inst.on('finish', () => {
|
||||||
|
expect(inst.getTime()).to.eq(316n);
|
||||||
expect(dump).to.deep.eq([
|
expect(dump).to.deep.eq([
|
||||||
{ id: '"}G', time: 100, cmd: 14, value: 0n, mask: 0n },
|
{ id: '"}G', time: 100, cmd: 14, value: 0n, mask: 0n },
|
||||||
{ id: '"}G', time: 200, cmd: 15, value: 1n, mask: 0n },
|
{ id: '"}G', time: 200, cmd: 15, value: 1n, mask: 0n },
|
||||||
|
11
vcd.c
11
vcd.c
@ -196,11 +196,22 @@ METHOD(setTrigger) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
METHOD(getTime) {
|
||||||
|
ASSERT_ARGC(1)
|
||||||
|
struct vcd_parser_s *state;
|
||||||
|
ASSERT_EXTERNAL(args[0], state)
|
||||||
|
|
||||||
|
napi_value res;
|
||||||
|
ASSERT(res, napi_create_bigint_uint64(env, state->time, &res))
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
napi_value Init(napi_env env, napi_value exports) {
|
napi_value Init(napi_env env, napi_value exports) {
|
||||||
DECLARE_NAPI_METHOD("init", init)
|
DECLARE_NAPI_METHOD("init", init)
|
||||||
DECLARE_NAPI_METHOD("done", done)
|
DECLARE_NAPI_METHOD("done", done)
|
||||||
DECLARE_NAPI_METHOD("execute", execute)
|
DECLARE_NAPI_METHOD("execute", execute)
|
||||||
DECLARE_NAPI_METHOD("setTrigger", setTrigger)
|
DECLARE_NAPI_METHOD("setTrigger", setTrigger)
|
||||||
|
DECLARE_NAPI_METHOD("getTime", getTime)
|
||||||
return exports;
|
return exports;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user