Add ovni_mark_set() to the API
Allows emitting a single event to change the value of the mark channel. The mark type must be defined as single without the MARK_FLAG_STACK flag.
This commit is contained in:
parent
90f8ae4188
commit
2c111fd98c
@ -150,6 +150,7 @@ void ovni_mark_type(int32_t type, long flags, const char *title);
|
||||
void ovni_mark_label(int32_t type, int64_t value, const char *label);
|
||||
void ovni_mark_push(int32_t type, int64_t value);
|
||||
void ovni_mark_pop(int32_t type, int64_t value);
|
||||
void ovni_mark_set(int32_t type, int64_t value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -478,6 +478,8 @@ mark_event(struct emu *emu)
|
||||
return chan_push(ch, value_int64(value));
|
||||
case ']':
|
||||
return chan_pop(ch, value_int64(value));
|
||||
case '=':
|
||||
return chan_set(ch, value_int64(value));
|
||||
default:
|
||||
err("unknown mark event value %c", emu->ev->v);
|
||||
return -1;
|
||||
|
@ -40,6 +40,7 @@ static struct ev_decl model_evlist[] = {
|
||||
|
||||
{ "OM[(i64 value, i32 type)", "push mark with value %{value} from type %{type}" },
|
||||
{ "OM](i64 value, i32 type)", "pop mark with value %{value} from type %{type}" },
|
||||
{ "OM=(i64 value, i32 type)", "set mark with value %{value} from type %{type}" },
|
||||
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
@ -1154,3 +1154,14 @@ ovni_mark_pop(int32_t type, int64_t value)
|
||||
ovni_payload_add(&ev, (uint8_t *) &type, sizeof(type));
|
||||
ovni_ev_add(&ev);
|
||||
}
|
||||
|
||||
void
|
||||
ovni_mark_set(int32_t type, int64_t value)
|
||||
{
|
||||
struct ovni_ev ev = {0};
|
||||
ovni_ev_set_clock(&ev, ovni_clock_now());
|
||||
ovni_ev_set_mcv(&ev, "OM=");
|
||||
ovni_payload_add(&ev, (uint8_t *) &value, sizeof(value));
|
||||
ovni_payload_add(&ev, (uint8_t *) &type, sizeof(type));
|
||||
ovni_ev_add(&ev);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user