#include "ex-compiler.h" #include static void pass_uses_clause (ExUsesClause *clause); static void pass_definition (ExDefinition *definition); static void pass_namespace (ExNamespace *namespace); static void pass_extension (ExExtension *extenstion); static void pass_request (ExRequest *request); static void pass_event (ExEvent *event); static void pass_type_def (ExTypeDef *type_def); static void pass_identifier (ExIdentifier *identifier); static void pass_type (ExType *type); static void pass_field (ExField *field); static void pass_error (ExError *error); void ex_pass (ExSpec *spec) { if (!spec) return; pass_uses_clause (spec->uses_clauses); pass_definition (spec->definitions); } static void pass_uses_clause (ExUsesClause *clause) { if (!clause) return; pass_uses_clause (clause->next); } static void pass_definition (ExDefinition *definition) { if (!definition) return; switch (definition->type) { case EX_DEFINITION_NAMESPACE: pass_namespace (definition->u.namespace); break; case EX_DEFINITION_EXTENSION: pass_extension (definition->u.extension); break; case EX_DEFINITION_REQUEST: pass_request (definition->u.request); break; case EX_DEFINITION_TYPE_DEF: pass_type_def (definition->u.type_def); break; case EX_DEFINITION_ERROR: pass_error (definition->u.error); break; case EX_DEFINITION_EVENT: pass_event (definition->u.event); break; } pass_definition (definition->next); } static void pass_namespace (ExNamespace *namespace) { if (!namespace) return; pass_definition (namespace->definitions); } static void pass_extension (ExExtension *extension) { if (!extension) return; pass_definition (extension->definitions); } static void pass_request (ExRequest *request) { if (!request) return; pass_field (request->parameters); pass_field (request->reply); pass_identifier (request->errors); } static void pass_type_def (ExTypeDef *type_def) { if (!type_def) return; pass_type (type_def->type); } static void pass_error (ExError *error) { if (!error) return; } static void pass_event (ExEvent *event) { if (!event) return; pass_field (event->fields); } static void pass_identifier (ExIdentifier *identifier) { if (!identifier) return; pass_identifier (identifier->next); } static void pass_type (ExType *type) { if (!type) return; switch (type->type) { case EX_TYPE_CARD8: break; case EX_TYPE_CARD16: break; case EX_TYPE_CARD32: break; case EX_TYPE_CARD64: break; case EX_TYPE_INT8: break; case EX_TYPE_INT16: break; case EX_TYPE_INT32: break; case EX_TYPE_INT64: break; case EX_TYPE_BOOLEAN: break; case EX_TYPE_ENUM: pass_identifier (type->u._enum.identifiers); break; case EX_TYPE_STRUCT: pass_field (type->u._struct.fields); break; case EX_TYPE_BITS: pass_identifier (type->u.bits.fields); break; case EX_TYPE_DERIVED_BITS: break; case EX_TYPE_MASKED_LIST: pass_field (type->u.masked_list.fields); break; case EX_TYPE_IDENTIFIER: break; case EX_TYPE_UNION: pass_field (type->u._struct.fields); break; case EX_TYPE_LIST: pass_type (type->u._list.type); break; case EX_TYPE_XID: break; } } static void pass_field (ExField *field) { if (!field) return; pass_type (field->type); pass_field (field->next); }