Exemple #1
0
static upb_sflow_t PyUpb_Message_StartSequence(void *m, upb_value fval) {
  PyObject **seq = PyUpb_Accessor_GetPtr(m, fval);
  PyTypeObject *type = ((PyUpb_MessageType*)Py_TYPE(m))->alt_type;
  if (!*seq) *seq = type->tp_alloc(type, 0);
  upb_stdmsg_sethas(m, fval);
  return UPB_CONTINUE_WITH(*seq);
}
Exemple #2
0
static upb_sflow_t PyUpb_Message_StartSubmessage(void *m, upb_value fval) {
  PyObject **submsg = PyUpb_Accessor_GetPtr(m, fval);
  PyTypeObject *type = Py_TYPE(m);
  if (!*submsg) *submsg = type->tp_alloc(type, 0);
  upb_stdmsg_sethas(m, fval);
  return UPB_CONTINUE_WITH(*submsg);
}
Exemple #3
0
upb_sflow_t upb_stdmsg_startsubmsg_r(void *a, upb_value fval) {
  assert(a != NULL);
  const upb_fielddef *f = upb_value_getfielddef(fval);
  void **subm = upb_stdarray_append((upb_stdarray*)a, sizeof(void*));
  upb_stdmsg_recycle(subm, upb_downcast_msgdef(f->def));
  return UPB_CONTINUE_WITH(*subm);
}
Exemple #4
0
static upb_sflow_t PyUpb_Message_StartRepeatedSubmessage(
    void *a, upb_value fval) {
  (void)fval;
  PyObject **elem = upb_stdarray_append(a, sizeof(void*));
  PyTypeObject *type = ((PyUpb_MessageType*)Py_TYPE(a))->alt_type;
  if (!*elem) *elem = type->tp_alloc(type, 0);
  return UPB_CONTINUE_WITH(*elem);
}
Exemple #5
0
static upb_sflow_t upb_textprinter_startsubmsg(void *_p, upb_value fval) {
  upb_textprinter *p = _p;
  upb_fielddef *f = upb_value_getfielddef(fval);
  upb_textprinter_indent(p);
  CHECK(upb_bytesink_printf(p->bytesink, &p->status, UPB_STRFMT " {", UPB_STRARG(f->name)));
  if(!p->single_line) upb_bytesink_putstr(p->bytesink, UPB_STRLIT("\n"), &p->status);
  p->indent_depth++;
  return UPB_CONTINUE_WITH(_p);
err:
  return UPB_S_BREAK;
}
Exemple #6
0
upb_sflow_t upb_stdmsg_startsubmsg(void *_m, upb_value fval) {
  assert(_m != NULL);
  char *m = _m;
  const upb_fielddef *f = upb_value_getfielddef(fval);
  void **subm = (void*)&m[f->offset];
  if (!upb_stdmsg_has(m, fval)) {
    upb_stdmsg_recycle(subm, upb_downcast_msgdef(f->def));
    upb_stdmsg_sethas(m, fval);
  }
  return UPB_CONTINUE_WITH(*subm);
}
Exemple #7
0
upb_sflow_t upb_stdmsg_startseq(void *_m, upb_value fval) {
  char *m = _m;
  const upb_fielddef *f = upb_value_getfielddef(fval);
  upb_stdarray **arr = (void*)&m[f->offset];
  if (!upb_stdmsg_has(_m, fval)) {
    if (!*arr) {
      *arr = malloc(sizeof(**arr));
      (*arr)->size = 0;
      (*arr)->ptr = NULL;
    }
    (*arr)->len = 0;
    upb_stdmsg_sethas(m, fval);
  }
  return UPB_CONTINUE_WITH(*arr);
}
Exemple #8
0
static upb_sflow_t startsubmsg(void *_m, upb_value fval) {
  (void)_m;
  (void)fval;
  return UPB_CONTINUE_WITH(NULL);
}