/* %Z%%M% %I% %E% */ /* * Copyright (c) 1991, 1992, 1995 by Wayne C. Gramlich. * All rights reserved. * * Permission to use, copy, modify, distribute, and sell this software * for any purpose is hereby granted without fee provided that the above * copyright notice and this permission are retained. The author makes * no representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. */ /* * This file contains code for converting expression tree types into * call tree types: */ #ifndef CALL_DEFS_H #include "call_defs.h" #endif #ifndef ERROR_EXPORTS_H #include "error_exports.h" #endif #ifndef GENERATE_EXPORTS_H #include "generate_exports.h" #endif #ifndef HEAP_EXPORTS_H #include "heap_exports.h" #endif #ifndef LIBC_EXPORTS_H #include "libc_exports.h" #endif #ifndef LINT_H #include "lint.h" #endif #ifndef MSG_EXPORTS_H #include "msg_exports.h" #endif #ifndef ROUTINE_DEFS_H #include "routine_defs.h" #endif #ifndef STR_EXPORTS_H #include "str_exports.h" #endif #ifndef STRVEC_EXPORTS_H #include "strvec_exports.h" #endif #ifndef TABLE_EXPORTS_H #include "table_exports.h" #endif #ifndef TYPE_DEFS_H #include "type_defs.h" #endif #ifndef UNIX_ASSERT_H #include "unix_assert.h" #endif #ifndef VECTOR_DEFS_H #include "vector_defs.h" #endif LOCAL void type_def_convert(Type_def, Convert); /* * type_def_convert(type_def, convert) * This routine will do all of the book-keeping needed for the * automatically generated routines associated with "type_def" * using "convert". */ /* ARGSUSED */ LOCAL void type_def_convert( Type_def type_def, Convert convert) { /* type_def_routines_convert(type_def, convert); */ } /* * type_defs_convert(type_defs, convert) * This routine will do all of the book-keeping needed for automatically * generated routines associated with each type definition in "type_defs" * using "convert". */ void type_defs_convert( Type_defs type_defs, Convert convert) { int index; Routine_type routine_type; Vec(Type_routine) routine_types; int size; Table(Str, Type_ref) synonyms; Type_def type_def; Type_ref type_ref; size = vec_size(Type_def, type_defs); for (index = 0; index < size; index++) { type_def = vec_fetch(Type_def, type_defs, index); /* Temporarily insert all routine types into synonym table: */ synonyms = convert->synonyms; routine_types = type_def->routine_types; VEC_LOOP(Routine_type, routine_types, routine_type) { type_proto_needed(routine_type->type_proto, convert->type_tables); type_ref = routine_type->type_proto->type_ref; if (table_insert(Str, Type_ref, synonyms, routine_type->name, type_ref)) { msg_out(convert->msg, type_def->position, "%s is already defined"); } } generate_routines_convert(type_def, convert); /* Remove the synonyms: */ VEC_LOOP(Routine_type, routine_types, routine_type) { assert(table_delete(Str, Type_ref, synonyms, routine_type->name) == 0); } } VEC_LOOP(Type_def, type_defs, type_def) { type_def_convert(type_def, convert); } }