X-Git-Url: http://git.buserror.net/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=idlcomp%2Ftypes.cc;h=623b57607f0937bc96fe3f1842052b3abcee5a92;hb=ace23b1635b73fb54745a169363dd9e9fc81c96b;hp=c22d0bef92240b988a2b3cc6e5a4e1fae461bc8d;hpb=635cfedb4bbe270f114f7a4e5ab58b7d8e054f7d;p=polintos%2Fscott%2Fpriv.git 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)