X-Git-Url: http://git.buserror.net/cgi-bin/gitweb.cgi?p=polintos%2Fscott%2Fpriv.git;a=blobdiff_plain;f=idlcomp%2Ftypes.cc;fp=idlcomp%2Ftypes.cc;h=623b57607f0937bc96fe3f1842052b3abcee5a92;hp=c22d0bef92240b988a2b3cc6e5a4e1fae461bc8d;hb=39d6852ead7a839f9e15e21e517dfd7a795e5cdd;hpb=cc1bee96fd874ff2c85c765f81ec2f4ba4584b9d diff --git a/idlcomp/types.cc b/idlcomp/types.cc index c22d0be..623b576 100644 --- a/idlcomp/types.cc +++ b/idlcomp/types.cc @@ -348,6 +348,45 @@ void Struct::add_elem(Datum *d) def.num_entries++; } +bool Struct::is_plain_data() +{ + if (!plain_data) { + plain_data = 1; + for (Struct::entries_iterator i = entries_begin(); i != entries_end(); ++i) + { + Datum *d = *i; + if (d->is_array() && !d->def.flags.field.Inline) + goto complex; + + if (!d->type) + continue; + + Type *type = dynamic_cast(d->type->get_concrete_sym()); + assert(type); + + if (dynamic_cast(type)) + goto complex; + + Struct *str = dynamic_cast(type); + if (str) { + if (!d->def.flags.field.Inline) + goto complex; + + // FIXME: check for inline struct loops + if (str->is_plain_data()) + goto complex; + } + } + } + + assert(plain_data == 1 || plain_data == 2); + return plain_data == 1; + +complex: + plain_data = 2; + return false; +} + Param *Param::declare(const String *name, NameSpace *parent, StrList *TYPE, CompiledParam::Flags flags, Array *array)