summaryrefslogtreecommitdiff
path: root/upb/handlers.c
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2011-08-27 18:44:37 -0700
committerJoshua Haberman <jhaberman@gmail.com>2011-08-27 18:44:37 -0700
commit48fedab345674000dd2f8dd4d8356ee995d9263e (patch)
treeba5faf3637e6963d45168f1e532ac3c9734569c0 /upb/handlers.c
parentc03802b0f18a1a654f832ddff01a5bd78efbc4d6 (diff)
Add packed field support (untested).
Diffstat (limited to 'upb/handlers.c')
-rw-r--r--upb/handlers.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/upb/handlers.c b/upb/handlers.c
index b6d0244..28b72d5 100644
--- a/upb/handlers.c
+++ b/upb/handlers.c
@@ -182,6 +182,7 @@ void upb_dispatcher_init(upb_dispatcher *d, upb_handlers *h,
d->skip = skip;
d->exit = exit;
d->srcclosure = srcclosure;
+ d->top_is_implicit = false;
upb_status_init(&d->status);
}
@@ -191,6 +192,7 @@ upb_dispatcher_frame *upb_dispatcher_reset(upb_dispatcher *d, void *closure) {
d->top = d->stack;
d->top->closure = closure;
d->top->is_sequence = false;
+ d->top->is_packed = false;
return d->top;
}
@@ -240,6 +242,7 @@ upb_dispatcher_frame *upb_dispatch_startseq(upb_dispatcher *d,
++d->top;
d->top->f = f;
d->top->is_sequence = true;
+ d->top->is_packed = false;
d->top->closure = sflow.closure;
return d->top;
}
@@ -283,6 +286,7 @@ upb_dispatcher_frame *upb_dispatch_startsubmsg(upb_dispatcher *d,
++d->top;
d->top->f = f;
d->top->is_sequence = false;
+ d->top->is_packed = false;
d->top->closure = sflow.closure;
d->msgent = f->submsg;
d->dispatch_table = &d->msgent->fieldtab;
@@ -309,6 +313,12 @@ upb_dispatcher_frame *upb_dispatch_endsubmsg(upb_dispatcher *d) {
bool upb_dispatcher_stackempty(upb_dispatcher *d) {
return d->top == d->stack;
}
+bool upb_dispatcher_islegalend(upb_dispatcher *d) {
+ if (d->top == d->stack) return true;
+ if (d->top - 1 == d->stack &&
+ d->top->is_sequence && !d->top->is_packed) return true;
+ return false;
+}
void _upb_dispatcher_unwind(upb_dispatcher *d, upb_flow_t flow) {
upb_dispatcher_frame *frame = d->top;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback