diff -ruN p2/Changelog p3/Changelog --- p2/Changelog 1970-01-01 01:00:00.000000000 +0100 +++ p3/Changelog 2006-12-05 17:38:49.000000000 +0100 @@ -0,0 +1,103 @@ +2006-12-05: October Snapshot: Patchlevel 3 + + * Major upgrade of DICE to newly released version 3.1.0: + Fixes several problems, including those addressed in the second patch + and a stack underflow problem that became apparent in the DOpE + package provided with the additional EMSCB source tarball + See Changelog file in the DICE source tree included in this snapshot + + * Adaptations to new DICE version in various user-level packages: + * Instead of [prealloc], IDL interfaces now use [prealloc_client] and/or + [prealloc_server]; see Section 1.6.4 of the DICE user manual for more + details + * Reverted preliminary fixes for loader and names package from + patchlevel 2 + + * roottask: + * Fixed the use of incorrect constants in the client library + * Fixed client-side and server-side code of rmgr_set_task_id(): + This function no longer registers a new name, but just tries to set the + quota for a given task + * Added missing bounds checking on names registry + * Removed obsolete code for handling old sigma0 protocol + + * Fixed C++ compatibility of libio interface: + adapted packages: generic_io, l4io + + * Fixed typo in inline documentation of sigma0 lib's header file + concering cacheable/noncacheable memory mappings + * Added missing documentation of 'all_sects_writable' directive in + loader package + * C++ compatibility fix in semaphore library + * Fixes related to C standards and removal of obsolete code for older + compilers in the the l4sys system-call bindings + * Added ptest test case for names package + * Minor fixes in log package + * Changed default configuration of non-driver L4Linux so that it indeed + does not touch any hardware (i.e., removed serial driver) + + * Fixes in the EMSCB tarball: + * Fixed C++ compatibility of libio interface: + adapted packages: dde_linux, dde_linux26 + * Minor fixes in lxfuxlibc and l4vfs packages + + +2006-11-20: October Snapshot: Patchlevel 2 + + * Fix DICE-related problems in the names and loader packages: + Add missing CORBA_alloc() and CORBA_free() + + +2006-10-27: October Snapshot: Patchlevel 1 + + * Fix for Fiasco: Clear reference to previosly freed I/O page table entries + * Fix for Fiasco: Enable 4K stacks in order to avoid stack underflows + + +2006-10-16: October Snapshot with IPC-Mon Support + + * Fiasco: + * Mapping database supports memory, I/O, and capability spaces + * Support for mapping and unmapping task capabilities + * Improved support for mapping and unmapping of superpages + * Support for unmapping memory-mapped I/O pages and I/O flexpages + * Support for querying dirty and accessed flags + * Support for "directed unmap" + * Support for reclaiming unused kernel memory from slab allocaters + + * Task capabilities (IPC-Mon) support in user-level packages: + * ipcmon package provides a capability-fault handler and client library + * roottask, simple_ts, and loader packages and system-call bindings + adapted for task capabilities + + * Upgrade to L4linux 2.6.18 + * Upgrade to new version of DICE + + +2006-07-13: July Snapshot: Patchlevel 1 + + * Extension to allow running multiple instances of the ORe network + switch; includes changes for both ORe and L4Linux + + +2006-06-30: July Snapshot + + * Fast IPC path in Fiasco + * Sigma0 extension for MTRR support (cacheable memory-mapped I/O) + * Upgrade to L4linux 2.6.17 + * L4Env build directories support + * DICE messagebuffer changed to support X.2 + * Dynamic loading of applications via ldso + * Development overview document added + + +2006-06-09: March Snapshot: Patchlevel 1 + + * Fix for memory leak in ORe + + +2006-03-31: March Snapshot + + * First snapshot released! + * Includes: Fiasco, L4Env core, L4Linux, DICE + diff -ruN p2/l4/COPYING p3/l4/COPYING --- p2/l4/COPYING 2003-06-02 16:48:06.000000000 +0200 +++ p3/l4/COPYING 2006-11-30 10:46:17.000000000 +0100 @@ -1,3 +1,13 @@ + + NOTE! This License shall not affect user programs that use the micro-kernel +API to invoke kernel-operations or services provided in other address +spaces - this is merely considered normal use of the kernel or +accompanying user-level services, and does not fall under the heading of +"derivative work". + +----------------------------------------------------------------------- + + GNU GENERAL PUBLIC LICENSE Version 2, June 1991 diff -ruN p2/l4/pkg/COPYING p3/l4/pkg/COPYING --- p2/l4/pkg/COPYING 1996-06-24 16:15:23.000000000 +0200 +++ p3/l4/pkg/COPYING 2006-11-30 10:46:17.000000000 +0100 @@ -1,8 +1,18 @@ + + NOTE! This License shall not affect user programs that use the micro-kernel +API to invoke kernel-operations or services provided in other address +spaces - this is merely considered normal use of the kernel or +accompanying user-level services, and does not fall under the heading of +"derivative work". + +----------------------------------------------------------------------- + + GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -291,7 +301,7 @@ the "copyright" line and a pointer to where the full notice is found. - Copyright (C) 19yy + Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -305,14 +315,15 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff -ruN p2/l4/pkg/dde_linux/lib/src/pci.c p3/l4/pkg/dde_linux/lib/src/pci.c --- p2/l4/pkg/dde_linux/lib/src/pci.c 2006-05-24 17:39:00.000000000 +0200 +++ p3/l4/pkg/dde_linux/lib/src/pci.c 2006-11-30 10:53:27.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: pci.c,v 1.20 2006/05/24 15:39:00 cw183155 Exp $ */ +/* $Id: pci.c,v 1.20.4.1 2006/11/30 09:53:27 cw183155 Exp $ */ /*****************************************************************************/ /** * \file dde_linux/lib/src/pci.c @@ -112,7 +112,7 @@ linus->device = l4io->device; linus->subsystem_vendor = l4io->sub_vendor; linus->subsystem_device = l4io->sub_device; - linus->class = l4io->class; + linus->class = l4io->dev_class; linus->irq = l4io->irq; for (i = 0; i < 12; i++) diff -ruN p2/l4/pkg/dm_generic/idl/dm_generic.idl p3/l4/pkg/dm_generic/idl/dm_generic.idl --- p2/l4/pkg/dm_generic/idl/dm_generic.idl 2006-10-01 12:31:23.000000000 +0200 +++ p3/l4/pkg/dm_generic/idl/dm_generic.idl 2006-11-30 10:58:00.000000000 +0100 @@ -1,5 +1,5 @@ /* -*- c -*- */ -/* $Id: dm_generic.idl,v 1.12 2006/10/01 10:31:23 ra3 Exp $ */ +/* $Id: dm_generic.idl,v 1.12.2.1 2006/11/30 09:58:00 cw183155 Exp $ */ /*****************************************************************************/ /** * \file dm_generic/idl/dm_generic.idl @@ -253,7 +253,7 @@ */ /***********************************************************************/ long get_name([in] unsigned long ds_id, - [out, string, prealloc] char ** name); + [out, string, prealloc_client] char ** name); /***********************************************************************/ /** diff -ruN p2/l4/pkg/dm_mem/idl/dm_mem.idl p3/l4/pkg/dm_mem/idl/dm_mem.idl --- p2/l4/pkg/dm_mem/idl/dm_mem.idl 2005-11-19 19:28:35.000000000 +0100 +++ p3/l4/pkg/dm_mem/idl/dm_mem.idl 2006-11-30 10:58:00.000000000 +0100 @@ -1,5 +1,5 @@ /* -*- c -*- */ -/* $Id: dm_mem.idl,v 1.7 2005/11/19 18:28:35 adam Exp $ */ +/* $Id: dm_mem.idl,v 1.7.6.1 2006/11/30 09:58:00 cw183155 Exp $ */ /*****************************************************************************/ /** * \file dm_mem/idl/dm_mem.idl @@ -185,7 +185,7 @@ long info([in] unsigned long ds_id, [out] l4_size_t *size, [out] l4_threadid_t *owner, - [out, string, prealloc] char ** name, + [out, string, prealloc_client] char ** name, [out] l4_uint32_t *next_id); }; }; diff -ruN p2/l4/pkg/dm_phys/server/src/debug.c p3/l4/pkg/dm_phys/server/src/debug.c --- p2/l4/pkg/dm_phys/server/src/debug.c 2006-10-16 14:04:58.000000000 +0200 +++ p3/l4/pkg/dm_phys/server/src/debug.c 2006-11-30 10:58:00.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: debug.c,v 1.20 2006/10/16 12:04:58 adam Exp $ */ +/* $Id: debug.c,v 1.20.2.1 2006/11/30 09:58:00 cw183155 Exp $ */ /*****************************************************************************/ /** * \file dm_phys/server/src/debug.c @@ -68,26 +68,6 @@ *sum += ds->size; } -static char _dm_phys_get_name_buf[L4DM_DS_NAME_MAX_LEN + 1]; -static int _dm_phys_get_name_buf_used; - -/* TAG:preallocfix */ -void * -CORBA_alloc(unsigned long size) -{ - if (_dm_phys_get_name_buf_used) - return NULL; - _dm_phys_get_name_buf_used = 1; - return _dm_phys_get_name_buf; -} - -/* TAG:preallocfix */ -void -CORBA_free(void *b) -{ - _dm_phys_get_name_buf_used = 0; -} - /***************************************************************************** *** DMphys IDL server functions *****************************************************************************/ @@ -168,12 +148,7 @@ } /* return name */ - /* As the name has the [prealloc] attribute, memory for it has been - * allocated. Thus, simply copy the name. - * TAG:preallocfix - * */ - if (*name) - strncpy(*name, dmphys_ds_get_name(ds), L4DM_DS_NAME_MAX_LEN); + *name = dmphys_ds_get_name(ds); /* done */ return 0; diff -ruN p2/l4/pkg/dm_phys/server/src/info.c p3/l4/pkg/dm_phys/server/src/info.c --- p2/l4/pkg/dm_phys/server/src/info.c 2006-10-16 14:04:58.000000000 +0200 +++ p3/l4/pkg/dm_phys/server/src/info.c 2006-11-30 10:58:00.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: info.c,v 1.4 2006/10/16 12:04:58 adam Exp $ */ +/* $Id: info.c,v 1.4.2.1 2006/11/30 09:58:00 cw183155 Exp $ */ /*****************************************************************************/ /** * \file dm_phys/server/src/info.c @@ -71,7 +71,7 @@ *size = 0; *owner = L4_INVALID_ID; - **name = 0; /* TAG:preallocfix */ + *name = ""; *next_id = desc->id; return 0; } @@ -83,8 +83,7 @@ *size = dmphys_ds_get_size(ds); *owner = dsmlib_get_owner(ds->desc); - if (*name) /* TAG:preallocfix */ - strncpy(*name, dmphys_ds_get_name(ds), L4DM_DS_NAME_MAX_LEN); + *name = dmphys_ds_get_name(ds); *next_id = desc->ds_next ? desc->ds_next->id : L4DM_INVALID_DATASPACE.id; return 0; } diff -ruN p2/l4/pkg/generic_io/doc/generic_io.cfg p3/l4/pkg/generic_io/doc/generic_io.cfg --- p2/l4/pkg/generic_io/doc/generic_io.cfg 2003-05-28 19:02:40.000000000 +0200 +++ p3/l4/pkg/generic_io/doc/generic_io.cfg 2006-11-30 10:53:27.000000000 +0100 @@ -10,13 +10,13 @@ ALIASES = "krishna=\test krishna:" "lars=\test lars:" INPUT = refman.dox \ - ../include/ARCH-x86/types.h ../include/ARCH-x86/libio.h + ../include/types.h ../include/libio.h -STRIP_CODE_COMMENTS = YES -MACRO_EXPANSION = YES -EXPAND_ONLY_PREDEF = YES -TAB_SIZE = 2 -QUIET = YES +STRIP_CODE_COMMENTS = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +TAB_SIZE = 2 +QUIET = YES GENERATE_HTML = YES HTML_OUTPUT = html @@ -26,7 +26,7 @@ HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO -GENERATE_LATEX = NO -#GENERATE_LATEX = YES +GENERATE_LATEX = NO +#GENERATE_LATEX = YES GENERATE_RTF = NO GENERATE_MAN = NO diff -ruN p2/l4/pkg/generic_io/doc/generic_io-if.cfg p3/l4/pkg/generic_io/doc/generic_io-if.cfg --- p2/l4/pkg/generic_io/doc/generic_io-if.cfg 2003-05-28 19:02:39.000000000 +0200 +++ p3/l4/pkg/generic_io/doc/generic_io-if.cfg 2006-11-30 10:53:27.000000000 +0100 @@ -1,32 +1,32 @@ # -*-Makefile-*- -PROJECT_NAME = "L4Env Generic I/O Server IPC Interface" -PROJECT_NUMBER = "Version 0.4" +PROJECT_NAME = "L4Env Generic I/O Server IPC Interface" +PROJECT_NUMBER = "Version 0.4" -OUTPUT_DIRECTORY = generic_io-if -OUTPUT_LANGUAGE = English -EXTRACT_ALL = NO - -ALIASES = "krishna=\test krishna:" "lars=\test lars:" - -INPUT = interface.dox \ - ../idl/generic_io.idl - -STRIP_CODE_COMMENTS = YES -ALPHABETICAL_INDEX = NO -TAB_SIZE = 2 -QUIET = YES - - -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_HEADER = -HTML_FOOTER = footer.html -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO - -GENERATE_LATEX = NO -#GENERATE_LATEX = YES -GENERATE_RTF = NO -GENERATE_MAN = NO +OUTPUT_DIRECTORY = generic_io-if +OUTPUT_LANGUAGE = English +EXTRACT_ALL = NO + +ALIASES = "krishna=\test krishna:" "lars=\test lars:" + +INPUT = interface.dox \ + ../idl/generic_io.idl + +STRIP_CODE_COMMENTS = YES +ALPHABETICAL_INDEX = NO +TAB_SIZE = 2 +QUIET = YES + + +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_HEADER = +HTML_FOOTER = footer.html +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO + +GENERATE_LATEX = NO +#GENERATE_LATEX = YES +GENERATE_RTF = NO +GENERATE_MAN = NO diff -ruN p2/l4/pkg/generic_io/doc/generic_io-internal.cfg p3/l4/pkg/generic_io/doc/generic_io-internal.cfg --- p2/l4/pkg/generic_io/doc/generic_io-internal.cfg 2003-05-28 19:02:40.000000000 +0200 +++ p3/l4/pkg/generic_io/doc/generic_io-internal.cfg 2006-11-30 10:53:27.000000000 +0100 @@ -1,39 +1,39 @@ # -*-Makefile-*- -PROJECT_NAME = "L4Env Generic I/O Server API Internals" -PROJECT_NUMBER = "Version 0.4" +PROJECT_NAME = "L4Env Generic I/O Server API Internals" +PROJECT_NUMBER = "Version 0.4" -OUTPUT_DIRECTORY = generic_io-internal -OUTPUT_LANGUAGE = English -EXTRACT_ALL = NO -EXTRACT_PRIVATE = YES -EXTRACT_STATIC = YES - -ALIASES = "krishna=\test krishna:" "lars=\test lars:" - -INPUT = internal.dox \ - ../lib/clientlib - -FILE_PATTERNS = *.h *.c - -STRIP_CODE_COMMENTS = YES -SOURCE_BROWSER = YES -MACRO_EXPANSION = YES -EXPAND_ONLY_PREDEF = YES -PREDEFINED = NO_DOX \ - __attribute__(x)= -TAB_SIZE = 2 -QUIET = YES - -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_HEADER = -HTML_FOOTER = footer.html -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO - -GENERATE_LATEX = NO -#GENERATE_LATEX = YES -GENERATE_RTF = NO -GENERATE_MAN = NO +OUTPUT_DIRECTORY = generic_io-internal +OUTPUT_LANGUAGE = English +EXTRACT_ALL = NO +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES + +ALIASES = "krishna=\test krishna:" "lars=\test lars:" + +INPUT = internal.dox \ + ../lib/clientlib + +FILE_PATTERNS = *.h *.c + +STRIP_CODE_COMMENTS = YES +SOURCE_BROWSER = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +PREDEFINED = NO_DOX \ + __attribute__(x)= +TAB_SIZE = 2 +QUIET = YES + +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_HEADER = +HTML_FOOTER = footer.html +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO + +GENERATE_LATEX = NO +#GENERATE_LATEX = YES +GENERATE_RTF = NO +GENERATE_MAN = NO diff -ruN p2/l4/pkg/generic_io/include/ARCH-amd64/libio.h p3/l4/pkg/generic_io/include/ARCH-amd64/libio.h --- p2/l4/pkg/generic_io/include/ARCH-amd64/libio.h 2006-06-26 09:44:22.000000000 +0200 +++ p3/l4/pkg/generic_io/include/ARCH-amd64/libio.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,276 +0,0 @@ -/* $Id: libio.h,v 1.1 2006/06/26 07:44:22 aw11 Exp $ */ -/*****************************************************************************/ -/** - * \file generic_io/include/ARCH-x86/libio.h - * \brief L4Env I/O Client API - * - * \date 05/28/2003 - * \author Christian Helmuth - * - */ -/* (c) 2003 Technische Universitaet Dresden - * This file is part of DROPS, which is distributed under the terms of the - * GNU General Public License 2. Please see the COPYING file for details. - */ - -#ifndef __GENERIC_IO_INCLUDE_ARCH_X86_LIBIO_H_ -#define __GENERIC_IO_INCLUDE_ARCH_X86_LIBIO_H_ - -/* L4 includes */ -#include -#include - -/*****************************************************************************/ -/** Initialize IO library. - * \ingroup grp_misc - * - * \param io_info_addr mapping address of io info page: - * - 0: libio queries RM for appropriate region - * - -1: no mapping is done at all - * - otherwise \a io_info_addr is used; area has to be - * prereserved at RM - * \param drv_type short driver description - * - * \retval io_info_addr actual mapping address (or -1 if no mapping) - * - * \return 0 on success, negative error code otherwise - * - * This initializes libio: - * - * - register driver according to drv_type - * - request and map io info page - * - * Before io info page is mapped into client's address space any potentially - * mapping at the given address is FLUSHED! \a io_info_addr has to be pagesize - * aligned. - */ -/*****************************************************************************/ -int l4io_init(l4io_info_t **io_info_addr, l4io_drv_t drv_type); - -/*****************************************************************************/ -/** - * \brief Request I/O memory region. - * \ingroup grp_res - * - * \param start begin of mem region - * \param len size of mem region - * \retval offset offset with memory region - * - * \return virtual address of mapped region; 0 on error - */ -/*****************************************************************************/ -l4_addr_t l4io_request_mem_region(l4_addr_t start, l4_size_t len, int flags, - l4_umword_t *offset); - -/******************************************************************************/ -/** - * \brief Search I/O memory region for an address. - * \ingroup grp_res - * - * \param addr Address to search for - * \retval start Start of memory region if found - * \retval len Length of memory region if found. - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_search_mem_region(l4_addr_t addr, - l4_addr_t *start, l4_size_t *len); - -/******************************************************************************/ -/** - * \brief Release I/O memory region. - * \ingroup grp_res - * - * \param start begin of mem region - * \param len size of mem region - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_release_mem_region(l4_addr_t start, l4_size_t len); - -/*****************************************************************************/ -/** - * \brief Request I/O port region. - * \ingroup grp_res - * - * \param start begin of port region - * \param len size of port region - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_request_region(l4_addr_t start, l4_size_t len); - -/*****************************************************************************/ -/** - * \brief Release I/O port region. - * \ingroup grp_res - * - * \param start begin of port region - * \param len size of port region - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_release_region(l4_addr_t start, l4_size_t len); - -/*****************************************************************************/ -/** - * \brief Request ISA DMA channel. - * \ingroup grp_res - * - * \param channel ISA DMA channel number - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_request_dma(unsigned int channel); - -/*****************************************************************************/ -/** - * \brief Release ISA DMA channel. - * \ingroup grp_res - * - * \param channel ISA DMA channel number - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_release_dma(unsigned int channel); - -/******************************************************************************/ -/** - * \brief Find PCI device on given bus and slot. - * \ingroup grp_pci - * - * \param bus PCI bus number - * \param slot PCI slot number - * - * \retval pci_dev - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_pci_find_slot(unsigned int bus, unsigned int slot, - l4io_pci_dev_t * pci_dev); - -/*****************************************************************************/ -/** - * \brief Find PCI device on given vendor and device ids. - * \ingroup grp_pci - * - * \param vendor vendor id or ~0 for any - * \param device device id or ~0 for any - * \param start previous PCI device found, or 0 for new search - * - * \retval pci_dev - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_pci_find_device(unsigned short vendor, unsigned short device, - l4io_pdev_t start, l4io_pci_dev_t * pci_dev); - -/*****************************************************************************/ -/** - * \brief Find PCI device on given class id. - * \ingroup grp_pci - * - * \param class class id - * \param start previous PCI device found, or 0 for new search - * - * \retval pci_dev - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_pci_find_class(unsigned long class, - l4io_pdev_t start, l4io_pci_dev_t * pci_dev); - -/*****************************************************************************/ -/** - * \brief Initialize PCI device. - * \ingroup grp_pci - * - * \param pdev PCI device handle - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_pci_enable(l4io_pdev_t pdev); - -/*****************************************************************************/ -/** - * \brief Finalize PCI device. - * \ingroup grp_pci - * - * \param pdev PCI device handle - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_pci_disable(l4io_pdev_t pdev); - -/*****************************************************************************/ -/** - * \brief Enable busmastering for PCI device. - * \ingroup grp_pci - * - * \param pdev PCI device handle - */ -/*****************************************************************************/ -void l4io_pci_set_master(l4io_pdev_t pdev); - -/*****************************************************************************/ -/** - * \brief Set PM state for PCI device. - * \ingroup grp_pci - * - * \param pdev PCI device handle - * \param state new PM state - * - * \return old PM state - */ -/*****************************************************************************/ -int l4io_pci_set_pm(l4io_pdev_t pdev, int state); - -/*****************************************************************************/ -/** - * \name Read PCI configuration registers. - * \ingroup grp_pci - * - * \param pdev PCI device handle - * \param pos PCI configuration register - * - * \retval val register value - * - * \return 0 on success; negative error code otherwise - * - * @{ */ -/*****************************************************************************/ -int l4io_pci_readb_cfg(l4io_pdev_t pdev, int pos, l4_uint8_t * val); -int l4io_pci_readw_cfg(l4io_pdev_t pdev, int pos, l4_uint16_t * val); -int l4io_pci_readl_cfg(l4io_pdev_t pdev, int pos, l4_uint32_t * val); - -/** @} */ -/*****************************************************************************/ -/** - * \name Write PCI configuration registers. - * \ingroup grp_pci - * - * \param pdev PCI device handle - * \param pos PCI configuration register - * \param val register value - * - * \return 0 on success; negative error code otherwise - * - * @{ */ -/*****************************************************************************/ -int l4io_pci_writeb_cfg(l4io_pdev_t pdev, int pos, l4_uint8_t val); -int l4io_pci_writew_cfg(l4io_pdev_t pdev, int pos, l4_uint16_t val); -int l4io_pci_writel_cfg(l4io_pdev_t pdev, int pos, l4_uint32_t val); -/** @} */ - -#endif diff -ruN p2/l4/pkg/generic_io/include/ARCH-amd64/types.h p3/l4/pkg/generic_io/include/ARCH-amd64/types.h --- p2/l4/pkg/generic_io/include/ARCH-amd64/types.h 2006-07-11 13:23:04.000000000 +0200 +++ p3/l4/pkg/generic_io/include/ARCH-amd64/types.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,149 +0,0 @@ -/* $Id: types.h,v 1.2 2006/07/11 11:23:04 aw11 Exp $ */ -/*****************************************************************************/ -/** - * \file generic_io/include/ARCH-x86/types.h - * \brief L4Env I/O Client API Types - * - * \date 05/28/2003 - * \author Christian Helmuth - * - */ -/* (c) 2003 Technische Universitaet Dresden - * This file is part of DROPS, which is distributed under the terms of the - * GNU General Public License 2. Please see the COPYING file for details. - */ - -#ifndef __GENERIC_IO_INCLUDE_ARCH_X86_TYPES_H_ -#define __GENERIC_IO_INCLUDE_ARCH_X86_TYPES_H_ - -/* L4 includes */ -#include - -/*****************************************************************************/ -/** - * \brief IO driver types. - * \ingroup grp_misc - * - * One dword encoding driver source and type. - * - * This is a proposal/idea. A final version of driver/server descriptions - * had to be more extensive and _not_ only for driver servers. - * - * 0x00000000 is reserved. - * - * -# src - * - 00 ... native L4 - * - 01 ... Linux - * - 10 ... OSKit - * - 11 ... others - * -# dsi - * - 7:4 ... major version - * - 3:0 ... minor version - * -# blk/class - * - 0xxxxxxx ... character device - * - x0000000 ... serio - * - x0000100 ... snd - * - 1xxxxxxx ... block device - */ -/*****************************************************************************/ -typedef struct l4io_drv -{ - unsigned src:2; /**< source of driver */ - unsigned dsi:8; /**< DSI version supported */ - unsigned class:8; /**< driver class */ - unsigned padding:14; /**< place holder */ -} l4io_drv_t; - -#define L4IO_DRV_INVALID ((l4io_drv_t){0,0,0,0}) /**< invalid type */ - -/*****************************************************************************/ -/** - * \brief PCI resources (regions). - * \ingroup grp_misc - */ -/*****************************************************************************/ -typedef struct l4io_res -{ - unsigned long start; /**< begin of region */ - unsigned long end; /**< end of region */ - unsigned long flags; /**< flags for PCI resource regions */ -} l4io_res_t; - -/*****************************************************************************/ -/** - * \brief PCI device handle. - * \ingroup grp_misc - */ -/*****************************************************************************/ -typedef unsigned short l4io_pdev_t; - -/*****************************************************************************/ -/** - * \brief PCI device information (struct). - * \ingroup grp_misc - */ -/*****************************************************************************/ -typedef struct l4io_pci_dev -{ - unsigned char bus; /* PCI bus number */ - unsigned char devfn; /* encoded device [7:3] & function [2:0] index */ - unsigned short vendor; - unsigned short device; - unsigned short sub_vendor; - unsigned short sub_device; - unsigned long class; /* 3 bytes: (base,sub,prog-if) */ - - unsigned long irq; -#define L4IO_PCIDEV_RES 12 /**< number of PCI resource regions */ - l4io_res_t res[L4IO_PCIDEV_RES]; /* resource regions used by device: - * 0-5 standard PCI regions (base addresses) - * 6 expansion ROM - * 7-10 unused for devices */ - char name[80]; - char slot_name[8]; - - l4io_pdev_t handle; /* handle for this device */ -} l4io_pci_dev_t; - -/*****************************************************************************/ -/** - * \brief I/O Info Page Structure. - * \ingroup grp_misc - * - * This is the L4Env's I/O server info page. - * We have 4KB and fill it 0...L4_PAGESIZE-1. - * - * \krishna DDE libraries (resp. all io clients) have to do some assembler - * magic to put their symbols at the right place. (look into package \c dde_test - * resp. \c io \c (examples/dummy/)) - */ -/*****************************************************************************/ -struct l4io_info -{ -union -{ -struct -{ - unsigned long magic; /**< magic number */ - volatile unsigned long jiffies; /**< jiffies */ - unsigned long hz; /**< update frequency for jiffies (HZ) */ - volatile struct { - long tv_sec, tv_usec; - } xtime; /**< xtime */ -// l4_uint8_t padding[L4_PAGESIZE - 24]; /**< place holder */ - unsigned long omega0; /**< omega0 flag (1 if started) */ -}; - -char padding[L4_PAGESIZE]; -}; - -}__attribute__ ((aligned(L4_PAGESIZE))); - -typedef struct l4io_info l4io_info_t; /**< io info page type */ - -#define L4IO_INFO_MAGIC 0x496f6f49 /**< io magic is "IooI" */ - -#define L4IO_MEM_CACHED 0x0001 -#define L4IO_MEM_WRITE_COMBINED 0x0003 - -#endif diff -ruN p2/l4/pkg/generic_io/include/ARCH-arm/libio.h p3/l4/pkg/generic_io/include/ARCH-arm/libio.h --- p2/l4/pkg/generic_io/include/ARCH-arm/libio.h 2004-12-09 22:58:20.000000000 +0100 +++ p3/l4/pkg/generic_io/include/ARCH-arm/libio.h 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -#include diff -ruN p2/l4/pkg/generic_io/include/ARCH-arm/types.h p3/l4/pkg/generic_io/include/ARCH-arm/types.h --- p2/l4/pkg/generic_io/include/ARCH-arm/types.h 2004-12-09 22:58:20.000000000 +0100 +++ p3/l4/pkg/generic_io/include/ARCH-arm/types.h 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -#include diff -ruN p2/l4/pkg/generic_io/include/ARCH-x86/libio.h p3/l4/pkg/generic_io/include/ARCH-x86/libio.h --- p2/l4/pkg/generic_io/include/ARCH-x86/libio.h 2006-06-14 17:28:33.000000000 +0200 +++ p3/l4/pkg/generic_io/include/ARCH-x86/libio.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,278 +0,0 @@ -/* $Id: libio.h,v 1.7 2006/06/14 15:28:33 fm3 Exp $ */ -/*****************************************************************************/ -/** - * \file generic_io/include/ARCH-x86/libio.h - * \brief L4Env I/O Client API - * - * \date 05/28/2003 - * \author Christian Helmuth - * - */ -/* (c) 2003 Technische Universitaet Dresden - * This file is part of DROPS, which is distributed under the terms of the - * GNU General Public License 2. Please see the COPYING file for details. - */ - -#ifndef __GENERIC_IO_INCLUDE_ARCH_X86_LIBIO_H_ -#define __GENERIC_IO_INCLUDE_ARCH_X86_LIBIO_H_ - -/* L4 includes */ -#include -#include - -/*****************************************************************************/ -/** Initialize IO library. - * \ingroup grp_misc - * - * \param io_info_addr mapping address of io info page: - * - 0: libio queries RM for appropriate region - * - -1: no mapping is done at all - * - otherwise \a io_info_addr is used; area has to be - * prereserved at RM - * \param drv_type short driver description - * - * \retval io_info_addr actual mapping address (or -1 if no mapping) - * - * \return 0 on success, negative error code otherwise - * - * This initializes libio: - * - * - register driver according to drv_type - * - request and map io info page - * - * Before io info page is mapped into client's address space any potentially - * mapping at the given address is FLUSHED! \a io_info_addr has to be pagesize - * aligned. - */ -/*****************************************************************************/ -int l4io_init(l4io_info_t **io_info_addr, l4io_drv_t drv_type); - -/*****************************************************************************/ -/** - * \brief Request I/O memory region. - * \ingroup grp_res - * - * \param start begin of mem region - * \param len size of mem region - * \param flags bit 0=1: map region cachable otherwise uncacheable - * bit 1=1: allocate MTRR and enable write combining - * \retval offset offset with memory region - * - * \return virtual address of mapped region; 0 on error - */ -/*****************************************************************************/ -l4_addr_t l4io_request_mem_region(l4_addr_t start, l4_size_t len, int flags, - l4_umword_t *offset); - -/******************************************************************************/ -/** - * \brief Search I/O memory region for an address. - * \ingroup grp_res - * - * \param addr Address to search for - * \retval start Start of memory region if found - * \retval len Length of memory region if found. - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_search_mem_region(l4_addr_t addr, - l4_addr_t *start, l4_size_t *len); - -/******************************************************************************/ -/** - * \brief Release I/O memory region. - * \ingroup grp_res - * - * \param start begin of mem region - * \param len size of mem region - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_release_mem_region(l4_addr_t start, l4_size_t len); - -/*****************************************************************************/ -/** - * \brief Request I/O port region. - * \ingroup grp_res - * - * \param start begin of port region - * \param len size of port region - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_request_region(l4_addr_t start, l4_size_t len); - -/*****************************************************************************/ -/** - * \brief Release I/O port region. - * \ingroup grp_res - * - * \param start begin of port region - * \param len size of port region - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_release_region(l4_addr_t start, l4_size_t len); - -/*****************************************************************************/ -/** - * \brief Request ISA DMA channel. - * \ingroup grp_res - * - * \param channel ISA DMA channel number - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_request_dma(unsigned int channel); - -/*****************************************************************************/ -/** - * \brief Release ISA DMA channel. - * \ingroup grp_res - * - * \param channel ISA DMA channel number - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_release_dma(unsigned int channel); - -/******************************************************************************/ -/** - * \brief Find PCI device on given bus and slot. - * \ingroup grp_pci - * - * \param bus PCI bus number - * \param slot PCI slot number - * - * \retval pci_dev - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_pci_find_slot(unsigned int bus, unsigned int slot, - l4io_pci_dev_t * pci_dev); - -/*****************************************************************************/ -/** - * \brief Find PCI device on given vendor and device ids. - * \ingroup grp_pci - * - * \param vendor vendor id or ~0 for any - * \param device device id or ~0 for any - * \param start previous PCI device found, or 0 for new search - * - * \retval pci_dev - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_pci_find_device(unsigned short vendor, unsigned short device, - l4io_pdev_t start, l4io_pci_dev_t * pci_dev); - -/*****************************************************************************/ -/** - * \brief Find PCI device on given class id. - * \ingroup grp_pci - * - * \param class class id - * \param start previous PCI device found, or 0 for new search - * - * \retval pci_dev - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_pci_find_class(unsigned long class, - l4io_pdev_t start, l4io_pci_dev_t * pci_dev); - -/*****************************************************************************/ -/** - * \brief Initialize PCI device. - * \ingroup grp_pci - * - * \param pdev PCI device handle - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_pci_enable(l4io_pdev_t pdev); - -/*****************************************************************************/ -/** - * \brief Finalize PCI device. - * \ingroup grp_pci - * - * \param pdev PCI device handle - * - * \return 0 on success; negative error code otherwise - */ -/*****************************************************************************/ -int l4io_pci_disable(l4io_pdev_t pdev); - -/*****************************************************************************/ -/** - * \brief Enable busmastering for PCI device. - * \ingroup grp_pci - * - * \param pdev PCI device handle - */ -/*****************************************************************************/ -void l4io_pci_set_master(l4io_pdev_t pdev); - -/*****************************************************************************/ -/** - * \brief Set PM state for PCI device. - * \ingroup grp_pci - * - * \param pdev PCI device handle - * \param state new PM state - * - * \return old PM state - */ -/*****************************************************************************/ -int l4io_pci_set_pm(l4io_pdev_t pdev, int state); - -/*****************************************************************************/ -/** - * \name Read PCI configuration registers. - * \ingroup grp_pci - * - * \param pdev PCI device handle - * \param pos PCI configuration register - * - * \retval val register value - * - * \return 0 on success; negative error code otherwise - * - * @{ */ -/*****************************************************************************/ -int l4io_pci_readb_cfg(l4io_pdev_t pdev, int pos, l4_uint8_t * val); -int l4io_pci_readw_cfg(l4io_pdev_t pdev, int pos, l4_uint16_t * val); -int l4io_pci_readl_cfg(l4io_pdev_t pdev, int pos, l4_uint32_t * val); - -/** @} */ -/*****************************************************************************/ -/** - * \name Write PCI configuration registers. - * \ingroup grp_pci - * - * \param pdev PCI device handle - * \param pos PCI configuration register - * \param val register value - * - * \return 0 on success; negative error code otherwise - * - * @{ */ -/*****************************************************************************/ -int l4io_pci_writeb_cfg(l4io_pdev_t pdev, int pos, l4_uint8_t val); -int l4io_pci_writew_cfg(l4io_pdev_t pdev, int pos, l4_uint16_t val); -int l4io_pci_writel_cfg(l4io_pdev_t pdev, int pos, l4_uint32_t val); -/** @} */ - -#endif diff -ruN p2/l4/pkg/generic_io/include/ARCH-x86/types.h p3/l4/pkg/generic_io/include/ARCH-x86/types.h --- p2/l4/pkg/generic_io/include/ARCH-x86/types.h 2006-06-14 17:28:33.000000000 +0200 +++ p3/l4/pkg/generic_io/include/ARCH-x86/types.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,140 +0,0 @@ -/* $Id: types.h,v 1.7 2006/06/14 15:28:33 fm3 Exp $ */ -/*****************************************************************************/ -/** - * \file generic_io/include/ARCH-x86/types.h - * \brief L4Env I/O Client API Types - * - * \date 05/28/2003 - * \author Christian Helmuth - * - */ -/* (c) 2003 Technische Universitaet Dresden - * This file is part of DROPS, which is distributed under the terms of the - * GNU General Public License 2. Please see the COPYING file for details. - */ - -#ifndef __GENERIC_IO_INCLUDE_ARCH_X86_TYPES_H_ -#define __GENERIC_IO_INCLUDE_ARCH_X86_TYPES_H_ - -/* L4 includes */ -#include - -/*****************************************************************************/ -/** - * \brief IO driver types. - * \ingroup grp_misc - * - * One dword encoding driver source and type. - * - * This is a proposal/idea. A final version of driver/server descriptions - * had to be more extensive and _not_ only for driver servers. - * - * 0x00000000 is reserved. - * - * -# src - * - 00 ... native L4 - * - 01 ... Linux - * - 10 ... OSKit - * - 11 ... others - * -# dsi - * - 7:4 ... major version - * - 3:0 ... minor version - * -# blk/class - * - 0xxxxxxx ... character device - * - x0000000 ... serio - * - x0000100 ... snd - * - 1xxxxxxx ... block device - */ -/*****************************************************************************/ -typedef struct l4io_drv -{ - unsigned src:2; /**< source of driver */ - unsigned dsi:8; /**< DSI version supported */ - unsigned class:8; /**< driver class */ - unsigned padding:14; /**< place holder */ -} l4io_drv_t; - -#define L4IO_DRV_INVALID ((l4io_drv_t){0,0,0,0}) /**< invalid type */ - -/*****************************************************************************/ -/** - * \brief PCI resources (regions). - * \ingroup grp_misc - */ -/*****************************************************************************/ -typedef struct l4io_res -{ - unsigned long start; /**< begin of region */ - unsigned long end; /**< end of region */ - unsigned long flags; /**< flags for PCI resource regions */ -} l4io_res_t; - -/*****************************************************************************/ -/** - * \brief PCI device handle. - * \ingroup grp_misc - */ -/*****************************************************************************/ -typedef unsigned short l4io_pdev_t; - -/*****************************************************************************/ -/** - * \brief PCI device information (struct). - * \ingroup grp_misc - */ -/*****************************************************************************/ -typedef struct l4io_pci_dev -{ - unsigned char bus; /* PCI bus number */ - unsigned char devfn; /* encoded device [7:3] & function [2:0] index */ - unsigned short vendor; - unsigned short device; - unsigned short sub_vendor; - unsigned short sub_device; - unsigned long class; /* 3 bytes: (base,sub,prog-if) */ - - unsigned long irq; -#define L4IO_PCIDEV_RES 12 /**< number of PCI resource regions */ - l4io_res_t res[L4IO_PCIDEV_RES]; /* resource regions used by device: - * 0-5 standard PCI regions (base addresses) - * 6 expansion ROM - * 7-10 unused for devices */ - char name[80]; - char slot_name[8]; - - l4io_pdev_t handle; /* handle for this device */ -} l4io_pci_dev_t; - -/*****************************************************************************/ -/** - * \brief I/O Info Page Structure. - * \ingroup grp_misc - * - * This is the L4Env's I/O server info page. - * We have 4KB and fill it 0...L4_PAGESIZE-1. - * - * \krishna DDE libraries (resp. all io clients) have to do some assembler - * magic to put their symbols at the right place. (look into package \c dde_test - * resp. \c io \c (examples/dummy/)) - */ -/*****************************************************************************/ -struct l4io_info -{ - l4_uint32_t magic; /**< magic number */ - volatile l4_uint32_t jiffies; /**< jiffies */ - l4_uint32_t hz; /**< update frequency for jiffies (HZ) */ - volatile struct { - long tv_sec, tv_usec; - } xtime; /**< xtime */ - l4_uint8_t padding[L4_PAGESIZE - 24]; /**< place holder */ - l4_uint32_t omega0; /**< omega0 flag (1 if started) */ -} __attribute__ ((aligned(L4_PAGESIZE))); - -typedef struct l4io_info l4io_info_t; /**< io info page type */ - -#define L4IO_INFO_MAGIC 0x496f6f49 /**< io magic is "IooI" */ - -#define L4IO_MEM_CACHED 0x0001 -#define L4IO_MEM_WRITE_COMBINED 0x0003 - -#endif diff -ruN p2/l4/pkg/generic_io/include/libio.h p3/l4/pkg/generic_io/include/libio.h --- p2/l4/pkg/generic_io/include/libio.h 1970-01-01 01:00:00.000000000 +0100 +++ p3/l4/pkg/generic_io/include/libio.h 2006-11-30 10:53:27.000000000 +0100 @@ -0,0 +1,282 @@ +/* $Id: libio.h,v 1.1.2.1 2006/11/30 09:53:27 cw183155 Exp $ */ +/*****************************************************************************/ +/** + * \file generic_io/include/ARCH-x86/libio.h + * \brief L4Env I/O Client API + * + * \date 05/28/2003 + * \author Christian Helmuth + * + */ +/* (c) 2003 Technische Universitaet Dresden + * This file is part of DROPS, which is distributed under the terms of the + * GNU General Public License 2. Please see the COPYING file for details. + */ + +#ifndef __GENERIC_IO_INCLUDE_ARCH_X86_LIBIO_H_ +#define __GENERIC_IO_INCLUDE_ARCH_X86_LIBIO_H_ + +/* L4 includes */ +#include +#include + +EXTERN_C_BEGIN + +/*****************************************************************************/ +/** Initialize IO library. + * \ingroup grp_misc + * + * \param io_info_addr mapping address of io info page: + * - 0: libio queries RM for appropriate region + * - -1: no mapping is done at all + * - otherwise \a io_info_addr is used; area has to be + * prereserved at RM + * \param drv_type short driver description + * + * \retval io_info_addr actual mapping address (or -1 if no mapping) + * + * \return 0 on success, negative error code otherwise + * + * This initializes libio: + * + * - register driver according to drv_type + * - request and map io info page + * + * Before io info page is mapped into client's address space any potentially + * mapping at the given address is FLUSHED! \a io_info_addr has to be pagesize + * aligned. + */ +/*****************************************************************************/ +int l4io_init(l4io_info_t **io_info_addr, l4io_drv_t drv_type); + +/*****************************************************************************/ +/** + * \brief Request I/O memory region. + * \ingroup grp_res + * + * \param start begin of mem region + * \param len size of mem region + * \param flags bit 0=1: map region cachable otherwise uncacheable + * bit 1=1: allocate MTRR and enable write combining + * \retval offset offset with memory region + * + * \return virtual address of mapped region; 0 on error + */ +/*****************************************************************************/ +l4_addr_t l4io_request_mem_region(l4_addr_t start, l4_size_t len, int flags, + l4_umword_t *offset); + +/******************************************************************************/ +/** + * \brief Search I/O memory region for an address. + * \ingroup grp_res + * + * \param addr Address to search for + * \retval start Start of memory region if found + * \retval len Length of memory region if found. + * + * \return 0 on success; negative error code otherwise + */ +/*****************************************************************************/ +int l4io_search_mem_region(l4_addr_t addr, + l4_addr_t *start, l4_size_t *len); + +/******************************************************************************/ +/** + * \brief Release I/O memory region. + * \ingroup grp_res + * + * \param start begin of mem region + * \param len size of mem region + * + * \return 0 on success; negative error code otherwise + */ +/*****************************************************************************/ +int l4io_release_mem_region(l4_addr_t start, l4_size_t len); + +/*****************************************************************************/ +/** + * \brief Request I/O port region. + * \ingroup grp_res + * + * \param start begin of port region + * \param len size of port region + * + * \return 0 on success; negative error code otherwise + */ +/*****************************************************************************/ +int l4io_request_region(l4_addr_t start, l4_size_t len); + +/*****************************************************************************/ +/** + * \brief Release I/O port region. + * \ingroup grp_res + * + * \param start begin of port region + * \param len size of port region + * + * \return 0 on success; negative error code otherwise + */ +/*****************************************************************************/ +int l4io_release_region(l4_addr_t start, l4_size_t len); + +/*****************************************************************************/ +/** + * \brief Request ISA DMA channel. + * \ingroup grp_res + * + * \param channel ISA DMA channel number + * + * \return 0 on success; negative error code otherwise + */ +/*****************************************************************************/ +int l4io_request_dma(unsigned int channel); + +/*****************************************************************************/ +/** + * \brief Release ISA DMA channel. + * \ingroup grp_res + * + * \param channel ISA DMA channel number + * + * \return 0 on success; negative error code otherwise + */ +/*****************************************************************************/ +int l4io_release_dma(unsigned int channel); + +/******************************************************************************/ +/** + * \brief Find PCI device on given bus and slot. + * \ingroup grp_pci + * + * \param bus PCI bus number + * \param slot PCI slot number + * + * \retval pci_dev + * + * \return 0 on success; negative error code otherwise + */ +/*****************************************************************************/ +int l4io_pci_find_slot(unsigned int bus, unsigned int slot, + l4io_pci_dev_t * pci_dev); + +/*****************************************************************************/ +/** + * \brief Find PCI device on given vendor and device ids. + * \ingroup grp_pci + * + * \param vendor vendor id or ~0 for any + * \param device device id or ~0 for any + * \param start previous PCI device found, or 0 for new search + * + * \retval pci_dev + * + * \return 0 on success; negative error code otherwise + */ +/*****************************************************************************/ +int l4io_pci_find_device(unsigned short vendor, unsigned short device, + l4io_pdev_t start, l4io_pci_dev_t * pci_dev); + +/*****************************************************************************/ +/** + * \brief Find PCI device on given class id. + * \ingroup grp_pci + * + * \param dev_class device class id + * \param start previous PCI device found, or 0 for new search + * + * \retval pci_dev + * + * \return 0 on success; negative error code otherwise + */ +/*****************************************************************************/ +int l4io_pci_find_class(unsigned long dev_class, + l4io_pdev_t start, l4io_pci_dev_t * pci_dev); + +/*****************************************************************************/ +/** + * \brief Initialize PCI device. + * \ingroup grp_pci + * + * \param pdev PCI device handle + * + * \return 0 on success; negative error code otherwise + */ +/*****************************************************************************/ +int l4io_pci_enable(l4io_pdev_t pdev); + +/*****************************************************************************/ +/** + * \brief Finalize PCI device. + * \ingroup grp_pci + * + * \param pdev PCI device handle + * + * \return 0 on success; negative error code otherwise + */ +/*****************************************************************************/ +int l4io_pci_disable(l4io_pdev_t pdev); + +/*****************************************************************************/ +/** + * \brief Enable busmastering for PCI device. + * \ingroup grp_pci + * + * \param pdev PCI device handle + */ +/*****************************************************************************/ +void l4io_pci_set_master(l4io_pdev_t pdev); + +/*****************************************************************************/ +/** + * \brief Set PM state for PCI device. + * \ingroup grp_pci + * + * \param pdev PCI device handle + * \param state new PM state + * + * \return old PM state + */ +/*****************************************************************************/ +int l4io_pci_set_pm(l4io_pdev_t pdev, int state); + +/*****************************************************************************/ +/** + * \name Read PCI configuration registers. + * \ingroup grp_pci + * + * \param pdev PCI device handle + * \param pos PCI configuration register + * + * \retval val register value + * + * \return 0 on success; negative error code otherwise + * + * @{ */ +/*****************************************************************************/ +int l4io_pci_readb_cfg(l4io_pdev_t pdev, int pos, l4_uint8_t * val); +int l4io_pci_readw_cfg(l4io_pdev_t pdev, int pos, l4_uint16_t * val); +int l4io_pci_readl_cfg(l4io_pdev_t pdev, int pos, l4_uint32_t * val); + +/** @} */ +/*****************************************************************************/ +/** + * \name Write PCI configuration registers. + * \ingroup grp_pci + * + * \param pdev PCI device handle + * \param pos PCI configuration register + * \param val register value + * + * \return 0 on success; negative error code otherwise + * + * @{ */ +/*****************************************************************************/ +int l4io_pci_writeb_cfg(l4io_pdev_t pdev, int pos, l4_uint8_t val); +int l4io_pci_writew_cfg(l4io_pdev_t pdev, int pos, l4_uint16_t val); +int l4io_pci_writel_cfg(l4io_pdev_t pdev, int pos, l4_uint32_t val); +/** @} */ + +EXTERN_C_END + +#endif diff -ruN p2/l4/pkg/generic_io/include/types.h p3/l4/pkg/generic_io/include/types.h --- p2/l4/pkg/generic_io/include/types.h 1970-01-01 01:00:00.000000000 +0100 +++ p3/l4/pkg/generic_io/include/types.h 2006-11-30 10:53:28.000000000 +0100 @@ -0,0 +1,145 @@ +/*****************************************************************************/ +/** + * \file generic_io/include/types.h + * \brief L4Env I/O Client API Types + * + * \date 05/28/2003 + * \author Christian Helmuth + * + */ +/* (c) 2003 Technische Universitaet Dresden + * This file is part of DROPS, which is distributed under the terms of the + * GNU General Public License 2. Please see the COPYING file for details. + */ + +#ifndef __GENERIC_IO_INCLUDE_ARCH_X86_TYPES_H_ +#define __GENERIC_IO_INCLUDE_ARCH_X86_TYPES_H_ + +/* L4 includes */ +#include +#include + +/*****************************************************************************/ +/** + * \brief IO driver types. + * \ingroup grp_misc + * + * One dword encoding driver source and type. + * + * This is a proposal/idea. A final version of driver/server descriptions + * had to be more extensive and _not_ only for driver servers. + * + * 0x00000000 is reserved. + * + * -# src + * - 00 ... native L4 + * - 01 ... Linux + * - 10 ... OSKit + * - 11 ... others + * -# dsi + * - 7:4 ... major version + * - 3:0 ... minor version + * -# blk/class + * - 0xxxxxxx ... character device + * - x0000000 ... serio + * - x0000100 ... snd + * - 1xxxxxxx ... block device + */ +/*****************************************************************************/ +typedef struct l4io_drv +{ + unsigned src:2; /**< source of driver */ + unsigned dsi:8; /**< DSI version supported */ + unsigned drv_class:8; /**< driver class */ + unsigned padding:14; /**< place holder */ +} l4io_drv_t; + +#define L4IO_DRV_INVALID ((l4io_drv_t){0,0,0,0}) /**< invalid type */ + +/*****************************************************************************/ +/** + * \brief PCI resources (regions). + * \ingroup grp_misc + */ +/*****************************************************************************/ +typedef struct l4io_res +{ + unsigned long start; /**< begin of region */ + unsigned long end; /**< end of region */ + unsigned long flags; /**< flags for PCI resource regions */ +} l4io_res_t; + +/*****************************************************************************/ +/** + * \brief PCI device handle. + * \ingroup grp_misc + */ +/*****************************************************************************/ +typedef unsigned short l4io_pdev_t; + +/*****************************************************************************/ +/** + * \brief PCI device information (struct). + * \ingroup grp_misc + */ +/*****************************************************************************/ +typedef struct l4io_pci_dev +{ + unsigned char bus; /* PCI bus number */ + unsigned char devfn; /* encoded device [7:3] & function [2:0] index */ + unsigned short vendor; + unsigned short device; + unsigned short sub_vendor; + unsigned short sub_device; + unsigned dev_class; /* 3 bytes: (base,sub,prog-if) */ + + unsigned long irq; +#define L4IO_PCIDEV_RES 12 /**< number of PCI resource regions */ + l4io_res_t res[L4IO_PCIDEV_RES]; /* resource regions used by device: + * 0-5 standard PCI regions (base addresses) + * 6 expansion ROM + * 7-10 unused for devices */ + char name[80]; + char slot_name[8]; + + l4io_pdev_t handle; /* handle for this device */ +} l4io_pci_dev_t; + +/*****************************************************************************/ +/** + * \brief I/O Info Page Structure. + * \ingroup grp_misc + * + * This is the L4Env's I/O server info page. + * We have 4KB and fill it 0...L4_PAGESIZE-1. + * + * \krishna DDE libraries (resp. all io clients) have to do some assembler + * magic to put their symbols at the right place. (look into package \c dde_test + * resp. \c io \c (examples/dummy/)) + */ +/*****************************************************************************/ +struct l4io_info +{ + union + { + struct + { + unsigned long magic; /**< magic number */ + volatile unsigned long jiffies; /**< jiffies */ + unsigned long hz; /**< update frequency for jiffies (HZ) */ + volatile struct { long tv_sec, tv_usec; } xtime; /**< xtime */ + unsigned long omega0; /**< omega0 flag (1 if started) */ + }; + + char padding[L4_PAGESIZE]; + }; +}__attribute__ ((aligned(L4_PAGESIZE))); + +typedef struct l4io_info l4io_info_t; /**< io info page type */ + +#define L4IO_INFO_MAGIC 0x496f6f49 /**< io magic is "IooI" */ + +#define L4IO_MEM_CACHED 0x0001 +#define L4IO_MEM_WRITE_COMBINED 0x0003 + +#endif diff -ruN p2/l4/pkg/generic_io/lib/clientlib/init.c p3/l4/pkg/generic_io/lib/clientlib/init.c --- p2/l4/pkg/generic_io/lib/clientlib/init.c 2006-09-30 22:48:55.000000000 +0200 +++ p3/l4/pkg/generic_io/lib/clientlib/init.c 2006-11-30 10:53:28.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: init.c,v 1.21 2006/09/30 20:48:55 adam Exp $ */ +/* $Id: init.c,v 1.21.2.1 2006/11/30 09:53:28 cw183155 Exp $ */ /*****************************************************************************/ /** * \file generic_io/lib/clientlib/init.c @@ -127,12 +127,12 @@ } LOGd(CONFIG_LOG_INFOPAGE_MAPPING, - "magic: %08x (%c%c%c%c)", + "magic: %08lx (%c%c%c%c)", (*addr)->magic, - ((*addr)->magic) >> 24, - ((*addr)->magic) >> 16 & 0xff, - ((*addr)->magic) >> 8 & 0xff, - ((*addr)->magic) & 0xff); + (char)(((*addr)->magic) >> 24), + (char)(((*addr)->magic) >> 16 & 0xff), + (char)(((*addr)->magic) >> 8 & 0xff), + (char)(((*addr)->magic) & 0xff)); return 0; } diff -ruN p2/l4/pkg/ipreg/idl/ipreg.idl p3/l4/pkg/ipreg/idl/ipreg.idl --- p2/l4/pkg/ipreg/idl/ipreg.idl 2006-06-29 13:27:38.000000000 +0200 +++ p3/l4/pkg/ipreg/idl/ipreg.idl 2006-11-30 11:25:28.000000000 +0100 @@ -7,5 +7,5 @@ [in, string, max_is(IPREG_MAX_ADDR_LEN)] char *addr); int query( [in, string, max_is(IPREG_MAX_NAME_LEN)] char *name, - [out, string, max_is(IPREG_MAX_ADDR_LEN), prealloc] char **addr); + [out, string, max_is(IPREG_MAX_ADDR_LEN), prealloc_client] char **addr); }; diff -ruN p2/l4/pkg/l4io/examples/dummy_cpp/main.cc p3/l4/pkg/l4io/examples/dummy_cpp/main.cc --- p2/l4/pkg/l4io/examples/dummy_cpp/main.cc 1970-01-01 01:00:00.000000000 +0100 +++ p3/l4/pkg/l4io/examples/dummy_cpp/main.cc 2006-11-30 10:53:28.000000000 +0100 @@ -0,0 +1,160 @@ +/** + * \file l4io/examples/dummy_cpp/main.cc + * \brief L4Env I/O client example (dumb C++ dummy) + * + * \author Christian Helmuth + * + */ +/* (c) 2006 Technische Universitaet Dresden + * This file is part of DROPS, which is distributed under the terms of the + * GNU General Public License 2. Please see the COPYING file for details. + */ + +/* L4 includes */ +#include +#include +#include +#include /* read time-stamp counter */ + +#include + +char LOG_tag[9] = "io_dummy"; + +/* exported by libio */ +extern unsigned long jiffies; +extern unsigned long HZ; + +static l4io_info_t *io_info_addr = NULL; + +/* use symbol "jiffies" for measurement */ +static void measure_jiffies(unsigned int num) +{ + unsigned long stamp; + + LOG_Enter("HZ = %lu jiffies = %lu @ %p num = %u", HZ, jiffies, &jiffies, num); + + l4_calibrate_tsc(); + + for (; num; num--) { + l4_cpu_time_t stamp0 = 0; + l4_cpu_time_t diff; + + stamp0 = l4_rdtsc(); + /* wait HZ jiffies (1 s) */ + stamp = jiffies + HZ; + while (jiffies < stamp) l4_usleep(900*(stamp-jiffies)); + diff = l4_rdtsc(); + + diff -= stamp0; + + LOG_printf("period = %lu jiffies (%u ms) ... xtime = {%ld, %ld}\n", + HZ, ((l4_uint32_t) l4_tsc_to_ns(diff)) / 1000000, + io_info_addr->xtime.tv_sec, io_info_addr->xtime.tv_usec); + } +} + +static const char * get_class_string(unsigned dev_class) +{ + /* check class code and if appropriate also sub-class code */ + switch (dev_class >> 16) { + case 0x01: + /* mass storage */ + switch ((dev_class >> 8) & 0xff) { + case 0x00: return "SCSI storage controller"; + case 0x01: return "IDE interface"; + case 0x05: return "ATA controller"; + default: return "Unknown mass storage controller"; + } + case 0x02: + /* network */ + switch ((dev_class >> 8) & 0xff) { + case 0x00: return "Ethernet controller"; + default: return "Unknown network controller"; + } + case 0x03: return "Display controller"; + case 0x04: + /* multimedia */ + switch ((dev_class >> 8) & 0xff) { + case 0x00: return "Multimedia video device"; + case 0x01: return "Multimedia audio device"; + default: return "Unknown multimedia controller"; + } + case 0x05: return "Memory controller"; + case 0x06: + /* bridge */ + switch ((dev_class >> 8) & 0xff) { + case 0x00: return "Host bridge"; + case 0x01: return "PCI/ISA bridge"; + case 0x04: return "PCI/PCI bridge"; + case 0x05: return "PCI/PCMCIA bridge"; + case 0x07: return "PCI/Cardbus bridge"; + default: return "Unknown bridge"; + } + case 0x07: + /* Simple communication */ + switch ((dev_class >> 8) & 0xff) { + case 0x03: return "Modem"; + default: return "Unknown simple communication controller"; + } + case 0x0c: + /* Serial bus */ + switch ((dev_class >> 8) & 0xff) { + case 0x00: return "Firewire controller"; + case 0x03: + /* USB controller */ + switch (dev_class & 0xff) { + case 0x00: return "USB UHCI controller"; + case 0x10: return "USB OHCI controller"; + case 0x20: return "USB EHCI controller"; + default: return "Unknown USB controller"; + } + case 0x05: return "SMBus controller"; + default: return "Unknown serial bus controller"; + } + + default: return "Unknown class"; + } +} + +static void list_pcidevs() +{ + LOG_printf("PCI device list:\n"); + l4io_pdev_t start = 0; + + while (true) { + l4io_pci_dev_t pci_dev; + + int err = l4io_pci_find_device(~0, ~0, start, &pci_dev); + if (err) break; + + LOG_printf(" %02x:%02x.%x %s: %s\n", + pci_dev.bus, pci_dev.devfn >> 3, pci_dev.devfn & 0x7, + get_class_string(pci_dev.dev_class), pci_dev.name); + + start = pci_dev.handle; + } +} + +int main(void) +{ + int error; + l4io_drv_t drv = L4IO_DRV_INVALID; + + LOG("Hello World! io_dummy is up ..."); + + if ((error = l4io_init(&io_info_addr, drv))) { + LOG_Error("initalizing libio: %d (%s)", error, l4env_strerror(-error)); + return 1; + } + + LOG("libio was initialized."); + if (io_info_addr->omega0) + LOG_printf("L4IO is running an omega0.\n"); + else + LOG_printf("L4IO doesn't handle Interrupts.\n"); + + list_pcidevs(); + measure_jiffies(99); + + return 0; +} diff -ruN p2/l4/pkg/l4io/examples/dummy_cpp/Makefile p3/l4/pkg/l4io/examples/dummy_cpp/Makefile --- p2/l4/pkg/l4io/examples/dummy_cpp/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ p3/l4/pkg/l4io/examples/dummy_cpp/Makefile 2006-11-30 10:53:28.000000000 +0100 @@ -0,0 +1,13 @@ +PKGDIR ?= ../.. +L4DIR ?= $(PKGDIR)/../.. + +TARGET = l4io_dummy_cpp +DEFAULT_RELOC = 0x00900000 +SYSTEMS = x86-l4v2 + +LIBS = -lio +SRC_CC = main.cc + +include $(L4DIR)/mk/prog.mk + +CXXFLAGS += -fno-rtti -fno-exceptions diff -ruN p2/l4/pkg/l4io/examples/Makefile p3/l4/pkg/l4io/examples/Makefile --- p2/l4/pkg/l4io/examples/Makefile 2002-10-24 15:18:57.000000000 +0200 +++ p3/l4/pkg/l4io/examples/Makefile 2006-11-30 10:53:28.000000000 +0100 @@ -1,5 +1,5 @@ -PKGDIR ?= .. -L4DIR ?= $(PKGDIR)/../.. -TARGET = dummy +PKGDIR ?= .. +L4DIR ?= $(PKGDIR)/../.. +TARGET = dummy dummy_cpp include $(L4DIR)/mk/subdir.mk diff -ruN p2/l4/pkg/l4io/server/lib-pci/include/asm/segment.h p3/l4/pkg/l4io/server/lib-pci/include/asm/segment.h --- p2/l4/pkg/l4io/server/lib-pci/include/asm/segment.h 1970-01-01 01:00:00.000000000 +0100 +++ p3/l4/pkg/l4io/server/lib-pci/include/asm/segment.h 2006-11-30 10:53:28.000000000 +0100 @@ -0,0 +1,13 @@ +#ifndef _LIBPCI_ASM_SEGMENT_H_ +#define _LIBPCI_ASM_SEGMENT_H_ + +#include_next + +static inline short bios_get_cs(void) +{ + unsigned cs; + asm volatile ("mov %%cs, %0" : "=r"(cs)); + return cs; +} + +#endif diff -ruN p2/l4/pkg/l4io/server/lib-pci/src/glue.c p3/l4/pkg/l4io/server/lib-pci/src/glue.c --- p2/l4/pkg/l4io/server/lib-pci/src/glue.c 2006-03-01 17:36:26.000000000 +0100 +++ p3/l4/pkg/l4io/server/lib-pci/src/glue.c 2006-11-30 10:53:29.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: glue.c,v 1.27 2006/03/01 16:36:26 ch12 Exp $ */ +/* $Id: glue.c,v 1.27.6.1 2006/11/30 09:53:29 cw183155 Exp $ */ /*****************************************************************************/ /** * \file l4io/server/lib-pci/src/glue.c @@ -580,7 +580,7 @@ l4io->device = linus->device; l4io->sub_vendor = linus->subsystem_vendor; l4io->sub_device = linus->subsystem_device; - l4io->class = linus->class; + l4io->dev_class = linus->class; l4io->irq = linus->irq; for (i = 0; i < 12; i++) diff -ruN p2/l4/pkg/l4io/server/src/main.c p3/l4/pkg/l4io/server/src/main.c --- p2/l4/pkg/l4io/server/src/main.c 2006-08-14 11:37:32.000000000 +0200 +++ p3/l4/pkg/l4io/server/src/main.c 2006-11-30 10:53:29.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.32 2006/08/14 09:37:32 aw11 Exp $ */ +/* $Id: main.c,v 1.32.2.1 2006/11/30 09:53:29 cw183155 Exp $ */ /*****************************************************************************/ /** * \file l4io/server/src/main.c @@ -125,7 +125,7 @@ LOGd(DEBUG_REGDRV, "registering "l4util_idfmt" {%x, %x, %x}", l4util_idstr(c->c_l4id), (unsigned char) c->drv.src, - (unsigned char) c->drv.dsi, (unsigned char) c->drv.class); + (unsigned char) c->drv.dsi, (unsigned char) c->drv.drv_class); for (p = &io_self; p->next; p = p->next) ; diff -ruN p2/l4/pkg/l4io/server/src/res.c p3/l4/pkg/l4io/server/src/res.c --- p2/l4/pkg/l4io/server/src/res.c 2006-08-14 11:43:13.000000000 +0200 +++ p3/l4/pkg/l4io/server/src/res.c 2006-11-30 10:53:29.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: res.c,v 1.34 2006/08/14 09:43:13 aw11 Exp $ */ +/* $Id: res.c,v 1.34.2.1 2006/11/30 09:53:29 cw183155 Exp $ */ /*****************************************************************************/ /** * \file l4io/server/src/res.c @@ -250,7 +250,7 @@ { io_res_t *tmp, *n, *p; /* predecessor */ - for (tmp=*root, p=NULL; tmp; p=tmp) + for (tmp=*root, p=NULL; tmp;) { n = tmp->next; if (l4_tasknum_equal(tmp->client->c_l4id, c->c_l4id)) diff -ruN p2/l4/pkg/l4sys/include/ARCH-amd64/L4API-l4v2/syscalls.h p3/l4/pkg/l4sys/include/ARCH-amd64/L4API-l4v2/syscalls.h --- p2/l4/pkg/l4sys/include/ARCH-amd64/L4API-l4v2/syscalls.h 2006-06-08 15:25:22.000000000 +0200 +++ p3/l4/pkg/l4sys/include/ARCH-amd64/L4API-l4v2/syscalls.h 2006-11-30 11:00:21.000000000 +0100 @@ -407,6 +407,19 @@ l4_privctrl(l4_umword_t cmd, l4_umword_t param); +/** + * Internal prototypes + */ +L4_INLINE void +__do_l4_thread_ex_regs(l4_umword_t val0, + l4_umword_t rip, + l4_umword_t rsp, + l4_threadid_t *preempter, + l4_threadid_t *pager, + l4_umword_t *old_rflags, + l4_umword_t *old_rip, + l4_umword_t *old_rsp); + /***************************************************************************** *** Implementation *****************************************************************************/ diff -ruN p2/l4/pkg/l4sys/include/ARCH-amd64/L4API-l4v2/syscalls-l42-gcc3-nopic.h p3/l4/pkg/l4sys/include/ARCH-amd64/L4API-l4v2/syscalls-l42-gcc3-nopic.h --- p2/l4/pkg/l4sys/include/ARCH-amd64/L4API-l4v2/syscalls-l42-gcc3-nopic.h 2006-07-11 14:04:31.000000000 +0200 +++ p3/l4/pkg/l4sys/include/ARCH-amd64/L4API-l4v2/syscalls-l42-gcc3-nopic.h 2006-11-30 11:00:21.000000000 +0100 @@ -1,5 +1,5 @@ /* - * $Id: syscalls-l42-gcc3-nopic.h,v 1.6 2006/07/11 12:04:31 aw11 Exp $ + * $Id: syscalls-l42-gcc3-nopic.h,v 1.6.2.1 2006/11/30 10:00:21 cw183155 Exp $ */ #ifndef __L4_SYSCALLS_L42_GCC3_NOPIC_H__ @@ -74,15 +74,15 @@ /* * L4 lthread_ex_regs */ -static inline void +L4_INLINE void __do_l4_thread_ex_regs(l4_umword_t val0, - l4_umword_t rip, - l4_umword_t rsp, - l4_threadid_t *preempter, - l4_threadid_t *pager, - l4_umword_t *old_rflags, - l4_umword_t *old_rip, - l4_umword_t *old_rsp) + l4_umword_t rip, + l4_umword_t rsp, + l4_threadid_t *preempter, + l4_threadid_t *pager, + l4_umword_t *old_rflags, + l4_umword_t *old_rip, + l4_umword_t *old_rsp) { __asm__ __volatile__ ( L4_SYSCALL(lthread_ex_regs) diff -ruN p2/l4/pkg/l4sys/include/ARCH-arm/L4API-l4x0/ipc_api.h p3/l4/pkg/l4sys/include/ARCH-arm/L4API-l4x0/ipc_api.h --- p2/l4/pkg/l4sys/include/ARCH-arm/L4API-l4x0/ipc_api.h 2006-06-12 11:36:44.000000000 +0200 +++ p3/l4/pkg/l4sys/include/ARCH-arm/L4API-l4x0/ipc_api.h 2006-11-30 11:00:22.000000000 +0100 @@ -524,7 +524,7 @@ l4_timeout_t timeout, l4_msgdope_t *result) { - register l4_umword_t _res asm("r0"); + register l4_umword_t _res asm("r0") = 0; register l4_umword_t _snd_desc asm("r1") = ~0U; register l4_umword_t _rcv_desc asm("r2") = (l4_umword_t)rcv_msg | L4_IPC_OPEN_IPC; register l4_umword_t _timeout asm("r3") = timeout.raw; @@ -551,6 +551,7 @@ "=r"(_w2) : "i"(L4_SYSCALL_IPC), + "0"(_res), "1"(_snd_desc), "2"(_rcv_desc), "3"(_timeout) diff -ruN p2/l4/pkg/l4sys/include/ARCH-arm/syscalls.h p3/l4/pkg/l4sys/include/ARCH-arm/syscalls.h --- p2/l4/pkg/l4sys/include/ARCH-arm/syscalls.h 2005-10-05 11:13:39.000000000 +0200 +++ p3/l4/pkg/l4sys/include/ARCH-arm/syscalls.h 2006-11-30 11:00:21.000000000 +0100 @@ -1,5 +1,5 @@ /* - * $Id: syscalls.h,v 1.8 2005/10/05 09:13:39 fm3 Exp $ + * $Id: syscalls.h,v 1.8.10.1 2006/11/30 10:00:21 cw183155 Exp $ */ #ifndef __L4_SYSCALLS_H__ @@ -89,6 +89,18 @@ l4_privctrl(l4_umword_t cmd, l4_umword_t param); +/** + * Internal prototypes + */ +L4_INLINE void +__do_l4_thread_ex_regs(l4_umword_t val0, + l4_umword_t ip, + l4_umword_t sp, + l4_threadid_t *preempter, + l4_threadid_t *pager, + l4_umword_t *old_cpsr, + l4_umword_t *old_ip, + l4_umword_t *old_sp); /*---------------------------------------------------------------------------- * Implementation diff -ruN p2/l4/pkg/l4sys/include/ARCH-arm/syscalls_impl.h p3/l4/pkg/l4sys/include/ARCH-arm/syscalls_impl.h --- p2/l4/pkg/l4sys/include/ARCH-arm/syscalls_impl.h 2005-10-01 21:55:28.000000000 +0200 +++ p3/l4/pkg/l4sys/include/ARCH-arm/syscalls_impl.h 2006-11-30 11:00:21.000000000 +0100 @@ -144,7 +144,7 @@ ); } -static inline void +L4_INLINE void __do_l4_thread_ex_regs(l4_umword_t val0, l4_umword_t ip, l4_umword_t sp, diff -ruN p2/l4/pkg/l4sys/include/ARCH-x86/L4API-l4secv2emu/ipc.h p3/l4/pkg/l4sys/include/ARCH-x86/L4API-l4secv2emu/ipc.h --- p2/l4/pkg/l4sys/include/ARCH-x86/L4API-l4secv2emu/ipc.h 2006-06-08 15:25:50.000000000 +0200 +++ p3/l4/pkg/l4sys/include/ARCH-x86/L4API-l4secv2emu/ipc.h 2006-11-30 11:00:22.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: ipc.h,v 1.6 2006/06/08 13:25:50 fm3 Exp $ */ +/* $Id: ipc.h,v 1.6.4.1 2006/11/30 10:00:22 cw183155 Exp $ */ /*****************************************************************************/ /** * \file l4sys/include/ARCH-x86/L4API-l4v2/ipc.h @@ -408,14 +408,8 @@ #ifdef PROFILE # include "ipc-l42-profile.h" #else -# if GCC_VERSION < 295 -# error gcc >= 2.95 required -# elif GCC_VERSION < 302 -# ifdef __PIC__ -# include "ipc-l42-gcc295-pic.h" -# else -# include "ipc-l42-gcc295-nopic.h" -# endif +# if GCC_VERSION < 302 +# error gcc >= 3.0.2 required # else # ifdef __PIC__ # include "ipc-l42-gcc3-pic.h" diff -ruN p2/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/ipc.h p3/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/ipc.h --- p2/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/ipc.h 2006-06-12 11:36:45.000000000 +0200 +++ p3/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/ipc.h 2006-11-30 11:00:22.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: ipc.h,v 1.22 2006/06/12 09:36:45 fm3 Exp $ */ +/* $Id: ipc.h,v 1.22.4.1 2006/11/30 10:00:22 cw183155 Exp $ */ /*****************************************************************************/ /** * \file l4sys/include/ARCH-x86/L4API-l4v2/ipc.h @@ -705,14 +705,8 @@ #ifdef PROFILE # include "ipc-l42-profile.h" #else -# if GCC_VERSION < 295 -# error gcc >= 2.95 required -# elif GCC_VERSION < 302 -# ifdef __PIC__ -# include "ipc-l42-gcc295-pic.h" -# else -# include "ipc-l42-gcc295-nopic.h" -# endif +# if GCC_VERSION < 302 +# error gcc >= 3.0.2 required # else # ifdef __PIC__ # include "ipc-l42-gcc3-pic.h" diff -ruN p2/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/syscalls.h p3/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/syscalls.h --- p2/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/syscalls.h 2006-10-12 23:05:07.000000000 +0200 +++ p3/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/syscalls.h 2006-11-30 11:00:22.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: syscalls.h,v 1.31 2006/10/12 21:05:07 adam Exp $ */ +/* $Id: syscalls.h,v 1.31.2.1 2006/11/30 10:00:22 cw183155 Exp $ */ /*****************************************************************************/ /** * \file l4sys/include/ARCH-x86/L4API-l4v2/syscalls.h @@ -443,6 +443,26 @@ l4_privctrl(l4_umword_t cmd, l4_umword_t param); +/** + * Internal prototypes + */ +L4_INLINE void +__do_l4_thread_ex_regs(l4_umword_t val0, + l4_umword_t eip, + l4_umword_t esp, + l4_threadid_t *preempter, + l4_threadid_t *pager, + l4_umword_t *old_eflags, + l4_umword_t *old_eip, + l4_umword_t *old_esp); +L4_INLINE l4_taskid_t +__do_l4_task_new(l4_taskid_t destination, + l4_umword_t mcp_or_new_chief_and_flags, + l4_umword_t esp, + l4_umword_t eip, + l4_threadid_t pager); + + /***************************************************************************** *** Implementation *****************************************************************************/ @@ -454,14 +474,8 @@ #ifdef PROFILE #include "syscalls-l42-profile.h" #else -# if GCC_VERSION < 295 -# error gcc >= 2.95 required -# elif GCC_VERSION < 302 -# ifdef __PIC__ -# include "syscalls-l42-gcc295-pic.h" -# else -# include "syscalls-l42-gcc295-nopic.h" -# endif +# if GCC_VERSION < 302 +# error gcc >= 3.0.2 required # else # ifdef __PIC__ # include "syscalls-l42-gcc3-pic.h" diff -ruN p2/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/syscalls-l42-gcc3-nopic.h p3/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/syscalls-l42-gcc3-nopic.h --- p2/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/syscalls-l42-gcc3-nopic.h 2006-10-12 23:05:07.000000000 +0200 +++ p3/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/syscalls-l42-gcc3-nopic.h 2006-11-30 11:00:22.000000000 +0100 @@ -1,5 +1,5 @@ /* - * $Id: syscalls-l42-gcc3-nopic.h,v 1.19 2006/10/12 21:05:07 adam Exp $ + * $Id: syscalls-l42-gcc3-nopic.h,v 1.19.2.1 2006/11/30 10:00:22 cw183155 Exp $ */ #ifndef __L4_SYSCALLS_L42_GCC3_NOPIC_H__ @@ -86,7 +86,7 @@ /* * L4 lthread_ex_regs */ -static inline void +L4_INLINE void __do_l4_thread_ex_regs(l4_umword_t val0, l4_umword_t eip, l4_umword_t esp, @@ -204,7 +204,7 @@ /* * L4 task new */ -static inline l4_taskid_t +L4_INLINE l4_taskid_t __do_l4_task_new(l4_taskid_t destination, l4_umword_t mcp_or_new_chief_and_flags, l4_umword_t esp, @@ -289,4 +289,3 @@ } #endif - diff -ruN p2/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/syscalls-l42-gcc3-pic.h p3/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/syscalls-l42-gcc3-pic.h --- p2/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/syscalls-l42-gcc3-pic.h 2006-10-12 23:05:07.000000000 +0200 +++ p3/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/syscalls-l42-gcc3-pic.h 2006-11-30 11:00:22.000000000 +0100 @@ -1,5 +1,5 @@ /* - * $Id: syscalls-l42-gcc3-pic.h,v 1.12 2006/10/12 21:05:07 adam Exp $ + * $Id: syscalls-l42-gcc3-pic.h,v 1.12.2.1 2006/11/30 10:00:22 cw183155 Exp $ */ #ifndef __L4_SYSCALLS_L42_GCC3_PIC_H__ @@ -93,7 +93,7 @@ /* * L4 lthread_ex_regs */ -static inline void +L4_INLINE void __do_l4_thread_ex_regs(l4_umword_t val0, l4_umword_t eip, l4_umword_t esp, @@ -219,7 +219,7 @@ /* * L4 task new */ -static inline l4_taskid_t +L4_INLINE l4_taskid_t __do_l4_task_new(l4_taskid_t destination, l4_umword_t mcp_or_new_chief_and_flags, l4_umword_t esp, diff -ruN p2/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/syscalls-l42-profile.h p3/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/syscalls-l42-profile.h --- p2/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/syscalls-l42-profile.h 2005-04-10 12:30:41.000000000 +0200 +++ p3/l4/pkg/l4sys/include/ARCH-x86/L4API-l4v2/syscalls-l42-profile.h 2006-11-30 11:00:22.000000000 +0100 @@ -1,9 +1,9 @@ /* - * $Id: syscalls-l42-profile.h,v 1.3 2005/04/10 10:30:41 adam Exp $ + * $Id: syscalls-l42-profile.h,v 1.3.10.1 2006/11/30 10:00:22 cw183155 Exp $ */ -#ifndef __L4_SYSCALLS_L42_GCC295_NOPIC_PROFILE_H__ -#define __L4_SYSCALLS_L42_GCC295_NOPIC_PROFILE_H__ +#ifndef __L4_SYSCALLS_L42_PROFILE_H__ +#define __L4_SYSCALLS_L42_PROFILE_H__ #ifdef __cplusplus extern "C" { @@ -131,4 +131,3 @@ } #endif - diff -ruN p2/l4/pkg/l4sys/include/compiler.h p3/l4/pkg/l4sys/include/compiler.h --- p2/l4/pkg/l4sys/include/compiler.h 2006-06-14 15:30:19.000000000 +0200 +++ p3/l4/pkg/l4sys/include/compiler.h 2006-11-30 11:00:21.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: compiler.h,v 1.9 2006/06/14 13:30:19 ra3 Exp $ */ +/* $Id: compiler.h,v 1.9.4.1 2006/11/30 10:00:21 cw183155 Exp $ */ /*****************************************************************************/ /** * \file l4sys/include/compiler.h @@ -100,4 +100,7 @@ #define L4_DEPRECATED #endif +#define L4_stringify_helper(x) #x +#define L4_stringify(x) L4_stringify_helper(x) + #endif /* !__L4_COMPILER_H__ */ diff -ruN p2/l4/pkg/loader/doc/loader.dox p3/l4/pkg/loader/doc/loader.dox --- p2/l4/pkg/loader/doc/loader.dox 2005-05-13 12:09:57.000000000 +0200 +++ p3/l4/pkg/loader/doc/loader.dox 2006-11-30 11:08:48.000000000 +0100 @@ -378,7 +378,7 @@ /*! \page p_tut_5 Step 5: Kill L4 task An terminated L4 task does not automatically release all resources it uses but we have to kill it explicitly. The \e exit() function of the -OSKit support libraries does nothing else than going into \e l4_sleep() +support libraries does nothing else than going into \e l4_sleep() forever. \todo Kill L4 task automatically on exit() when started by L4 loader. @@ -481,6 +481,11 @@ Make sure that the binary is mapped using 4kB pages. Useful for performance comparisons. +\par all_sects_writable + Map all program segments writable to application. Normally this is + switched off and read-only program segments (e.g., text segment) are + mapped read-only. + \par rebootable Allows the application to reboot the machine.
@@ -612,7 +617,7 @@ \par Requires: -OSKit 1.0, rmgr, names, l4util, l4sys, DICE, L4 environment +roottask, names, l4util, l4sys, DICE, L4 environment \author Frank Mehnert */ diff -ruN p2/l4/pkg/loader/idl/loader.idl p3/l4/pkg/loader/idl/loader.idl --- p2/l4/pkg/loader/idl/loader.idl 2004-12-08 18:48:22.000000000 +0100 +++ p3/l4/pkg/loader/idl/loader.idl 2006-11-30 11:08:48.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: loader.idl,v 1.15 2004/12/08 17:48:22 fm3 Exp $ */ +/* $Id: loader.idl,v 1.15.6.1 2006/11/30 10:08:48 cw183155 Exp $ */ /*! * \file loader/idl/loader.idl * \brief Loader interface @@ -57,7 +57,7 @@ [in] l4_threadid_t fprov, [in] unsigned long flags, [out, max_is(MAX_TASK_ID)] l4_taskid_t task_ids[], - [out, string, prealloc] char** error_msg); + [out, string, prealloc_client] char** error_msg); /** Continue task which was not completely started. * @@ -95,7 +95,7 @@ * \retval l4env_page l4env_infopage of process * \return 0 on success */ long info([in] unsigned long task_id, [in] unsigned long flags, - [out, string, init_with_in] char** fname, + [out, string, prealloc_client] char** fname, [out] l4dm_dataspace_t *l4env_page); /** Open a library. diff -ruN p2/l4/pkg/loader/server/src/app.c p3/l4/pkg/loader/server/src/app.c --- p2/l4/pkg/loader/server/src/app.c 2006-10-16 14:21:46.000000000 +0200 +++ p3/l4/pkg/loader/server/src/app.c 2006-11-30 11:08:49.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: app.c,v 1.128 2006/10/16 12:21:46 adam Exp $ */ +/* $Id: app.c,v 1.128.2.1 2006/11/30 10:08:49 cw183155 Exp $ */ /** * \file loader/server/src/app.c * \brief start, stop, kill, etc. applications @@ -2062,8 +2062,7 @@ /* terminate list */ *a++ = 0; - if (*fname) /* TAG:preallocfix */ - **fname = 0; + *fname = ""; /* detach dataspace */ l4rm_detach((void *)l4env_addr); @@ -2094,8 +2093,7 @@ /* copy application's L4 infopage information */ memcpy((void*)l4env_addr, app->env, sizeof(l4env_infopage_t)); - if (*fname)/* TAG:preallocfix */ - strncpy(*fname, (char*)app->fname, 1024); + *fname = (char*)app->fname; /* detach dataspace */ l4rm_detach((void *)l4env_addr); diff -ruN p2/l4/pkg/loader/server/src/idl.c p3/l4/pkg/loader/server/src/idl.c --- p2/l4/pkg/loader/server/src/idl.c 2006-11-20 11:06:15.000000000 +0100 +++ p3/l4/pkg/loader/server/src/idl.c 2006-11-30 11:08:49.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: idl.c,v 1.25 2006/04/08 22:05:39 adam Exp $ */ +/* $Id: idl.c,v 1.25.4.2 2006/11/30 10:08:49 cw183155 Exp $ */ /** * \file loader/server/src/idl.c * \brief implemented IDL interface support functions @@ -234,28 +234,11 @@ #endif } -void * -CORBA_alloc(unsigned long s) -{ - static char buf[1024]; - return buf; -} - -void -CORBA_free(void *p) -{ -} - /** IDL server loop */ void server_loop(void) { - CORBA_Server_Environment env = dice_default_server_environment; - - env.malloc = (dice_malloc_func) CORBA_alloc; - env.free = (dice_free_func) CORBA_free; - - l4loader_app_server_loop(&env); + l4loader_app_server_loop(NULL); for (;;) ; } diff -ruN p2/l4/pkg/log/include/log_printf.h p3/l4/pkg/log/include/log_printf.h --- p2/l4/pkg/log/include/log_printf.h 2005-09-05 16:55:30.000000000 +0200 +++ p3/l4/pkg/log/include/log_printf.h 2006-11-30 11:16:00.000000000 +0100 @@ -15,12 +15,7 @@ #include -/* Ugly workaround for the different stdarg versions */ -#ifdef _FLUX_X86_C_STDARG_H_ -typedef __flux_va_list LOG_va_list; -#else typedef va_list LOG_va_list; -#endif extern int LOG_vprintf(const char*,LOG_va_list); extern int LOG_printf(const char*, ...) diff -ruN p2/l4/pkg/log/lib/src/log_printf.c p3/l4/pkg/log/lib/src/log_printf.c --- p2/l4/pkg/log/lib/src/log_printf.c 2005-09-21 17:08:16.000000000 +0200 +++ p3/l4/pkg/log/lib/src/log_printf.c 2006-11-30 11:16:00.000000000 +0100 @@ -115,7 +115,7 @@ int i; lock_buffer(); - /* use external _doprnt from the oskit */ + global_buffer.printed = 0; LOG_doprnt(format, list, 16, printchar, (char *)&global_buffer); i = global_buffer.printed; diff -ruN p2/l4/pkg/lxfuxlibc/server/fuxfprov/main.c p3/l4/pkg/lxfuxlibc/server/fuxfprov/main.c --- p2/l4/pkg/lxfuxlibc/server/fuxfprov/main.c 2005-11-18 14:19:02.000000000 +0100 +++ p3/l4/pkg/lxfuxlibc/server/fuxfprov/main.c 2006-11-30 11:16:00.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.14 2005/11/18 13:19:02 ra3 Exp $ */ +/* $Id: main.c,v 1.14.6.1 2006/11/30 10:16:00 cw183155 Exp $ */ /** * \file lxfuxlibc/server/fuxfprov/main.c * \brief L4 file provider using native Linux syscalls under Fiasco-UX @@ -142,7 +142,7 @@ { if ((fread = gzread(fd, buf, sizeof(buf))) == -1) { - printf("Error decoding file %s: -%d\n", fname, lx_errno); + printf("Error reading (or decoding) file %s: -%d\n", fname, lx_errno); return -L4_EIO; } if (fread == 0) diff -ruN p2/l4/pkg/names/examples/demo/demo.c p3/l4/pkg/names/examples/demo/demo.c --- p2/l4/pkg/names/examples/demo/demo.c 2005-10-26 15:04:43.000000000 +0200 +++ p3/l4/pkg/names/examples/demo/demo.c 2006-11-30 11:05:02.000000000 +0100 @@ -117,12 +117,12 @@ - printf(__FILE__" Done.\n"); + printf("Done.\n"); if (names_waitfor_name("DEMO2", &id, 8000)) - printf(__FILE__"waitfor OK\n"); + printf("waitfor OK\n"); else - printf(__FILE__"waitfor ~OK\n"); + printf("waitfor FAILED (but expected)\n"); l4_sleep(-1); - printf(__FILE__" end\n"); + printf("end\n"); return 0; }; diff -ruN p2/l4/pkg/names/idl/names.idl p3/l4/pkg/names/idl/names.idl --- p2/l4/pkg/names/idl/names.idl 2004-09-19 16:38:01.000000000 +0200 +++ p3/l4/pkg/names/idl/names.idl 2006-11-30 11:05:02.000000000 +0100 @@ -60,7 +60,8 @@ * \return 0 on error, != 0 on success */ long query_id([in] l4_threadid_t id, - [out, string, prealloc, max_is(NAMES_MAX_NAME_LEN)] char **name); + [out, string, prealloc_client, max_is(NAMES_MAX_NAME_LEN)] + char **name); /** Query names for a name and ID by number. * @@ -71,7 +72,8 @@ * \return 0 on error, != 0 on success */ long query_nr([in] int nr, - [out, string, prealloc, max_is(NAMES_MAX_NAME_LEN)] char **name, + [out, string, prealloc_client, max_is(NAMES_MAX_NAME_LEN)] + char **name, [out] l4_threadid_t *id); /** Requests names to dump its internal database. diff -ruN p2/l4/pkg/names/ptest/expected.txt p3/l4/pkg/names/ptest/expected.txt --- p2/l4/pkg/names/ptest/expected.txt 1970-01-01 01:00:00.000000000 +0100 +++ p3/l4/pkg/names/ptest/expected.txt 2006-11-30 11:05:02.000000000 +0100 @@ -0,0 +1,47 @@ +names_de| Registering ABCGEFG OK +names_de| Registering ABCGEFG FAILED!!! (but expected) +names_de| Registering ABCGEFG2 OK +names_de| Querying ABCGEFG -> 8.00 +names_de| Querying names -> 6.00 +names_de| Querying ABCGEFG2 -> 8.00 +names_de| Querying 5.0 -> 5.00 stdlogV05 +names_de| Query all: kernel idler (0.00), sigma0 (2.00), rmgr.pager (4.00), rmg +names_de: r.service (4.01), rmgr.irq00 (4.10), rmgr.irq01 (4.11), rmgr.irq02 (4 +names_de: .12), rmgr.irq03 (4.13), rmgr.irq04 (4.14), rmgr.irq05 (4.15), rmgr.i +names_de: rq06 (4.16), rmgr.irq07 (4.17), rmgr.irq08 (4.18), rmgr.irq09 (4.19), +names_de: rmgr.irq0A (4.1A), rmgr.irq0B (4.1B), rmgr.irq0C (4.1C), rmgr.irq0D +names_de: (4.1D), rmgr.irq0E (4.1E), rmgr.irq0F (4.1F), names (6.00), log.flush +names_de: (5.01), ABCGEFG (8.00), log.flushsig (5.02), stdlogV05 (5.00), ABCGE +names_de: FG2 (8.00) +names_de| Unregistering ABCGEFG OK +names_de| Querying ABCGEFG FAILED!!! (but expected) +names_de| Unregistering ABCGEFG FAILED!!! (but expected) +names_de| Requesting dump from names: +names | dumping names server: +names | taskid:0.00 name:kernel idler +names | taskid:2.00 name:sigma0 +names | taskid:4.00 name:rmgr.pager +names | taskid:4.01 name:rmgr.service +names | taskid:4.10 name:rmgr.irq00 +names | taskid:4.11 name:rmgr.irq01 +names | taskid:4.12 name:rmgr.irq02 +names | taskid:4.13 name:rmgr.irq03 +names | taskid:4.14 name:rmgr.irq04 +names | taskid:4.15 name:rmgr.irq05 +names | taskid:4.16 name:rmgr.irq06 +names | taskid:4.17 name:rmgr.irq07 +names | taskid:4.18 name:rmgr.irq08 +names | taskid:4.19 name:rmgr.irq09 +names | taskid:4.1A name:rmgr.irq0A +names | taskid:4.1B name:rmgr.irq0B +names | taskid:4.1C name:rmgr.irq0C +names | taskid:4.1D name:rmgr.irq0D +names | taskid:4.1E name:rmgr.irq0E +names | taskid:4.1F name:rmgr.irq0F +names | taskid:6.00 name:names +names | taskid:5.01 name:log.flush +names | taskid:5.02 name:log.flushsig +names | taskid:5.00 name:stdlogV05 +names | taskid:8.00 name:ABCGEFG2 +names_de| Done. +names_de| waitfor FAILED (but expected) diff -ruN p2/l4/pkg/names/ptest/Makefile p3/l4/pkg/names/ptest/Makefile --- p2/l4/pkg/names/ptest/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ p3/l4/pkg/names/ptest/Makefile 2006-11-30 11:05:02.000000000 +0100 @@ -0,0 +1,11 @@ +PKGDIR = .. +L4DIR ?= $(PKGDIR)/../.. + +EXPECTED_OUT = $(SRC_DIR)/expected.txt + +TEST_SERVER = names_demo + +SYSTEMS = x86-l4v2 +TIMEOUT = 60 + +include $(L4DIR)/mk/runux.mk diff -ruN p2/l4/pkg/names/server/src/names.c p3/l4/pkg/names/server/src/names.c --- p2/l4/pkg/names/server/src/names.c 2006-11-20 11:06:15.000000000 +0100 +++ p3/l4/pkg/names/server/src/names.c 2006-11-30 11:05:02.000000000 +0100 @@ -435,23 +435,9 @@ } } -void * -CORBA_alloc(unsigned long s) -{ - static char buf[128]; - return buf; -} - -void -CORBA_free(void *p) -{ -} - int main(int argc, char* argv[]) { - CORBA_Server_Environment env = dice_default_server_environment; - /* first: use the own output function, because we do not know who is the logserver. */ logsrv_outfunc = LOG_outstring; @@ -481,13 +467,9 @@ } #endif - - env.malloc = (dice_malloc_func) CORBA_alloc; - env.free = (dice_free_func) CORBA_free; - DEBUGMSG(2) printf("Entering server loop.\n"); - names_server_loop(&env); + names_server_loop(NULL); return 0; } diff -ruN p2/l4/pkg/ore/idl/ore_rxtx.idl p3/l4/pkg/ore/idl/ore_rxtx.idl --- p2/l4/pkg/ore/idl/ore_rxtx.idl 2006-03-09 21:55:46.000000000 +0100 +++ p3/l4/pkg/ore/idl/ore_rxtx.idl 2006-11-30 11:14:30.000000000 +0100 @@ -27,7 +27,7 @@ * ORE_NONBLOCKING_CALL for non-blocking rx */ [allow_reply_only] - int recv([out,prealloc,ref,size_is(real_size), max_is(2000)] char **buf, + int recv([out,prealloc_client,ref,size_is(real_size), max_is(2000)] char **buf, [in] l4_size_t size, [out] l4_size_t *real_size, [in] int rx_blocking); diff -ruN p2/l4/pkg/roottask/lib/src/libroot.c p3/l4/pkg/roottask/lib/src/libroot.c --- p2/l4/pkg/roottask/lib/src/libroot.c 2006-10-01 01:03:30.000000000 +0200 +++ p3/l4/pkg/roottask/lib/src/libroot.c 2006-12-01 17:29:59.000000000 +0100 @@ -286,7 +286,7 @@ rmgr_set_task_id(const char *modname, l4_threadid_t tid) { DICE_DECLARE_ENV(env); - return rmgr_get_task_id_call(&rmgr_id, modname, &tid, &env); + return rmgr_set_task_id_call(&rmgr_id, modname, &tid, &env); } /** @@ -299,10 +299,10 @@ { DICE_DECLARE_ENV(env); l4_threadid_t ntid = L4_NIL_ID; - l4_threadid_t nil = L4_NIL_ID; + l4_threadid_t inv = L4_INVALID_ID; if (rmgr_task_new_call(&rmgr_id, &tid, mcp_or_chief, esp, eip, - &pager, &nil, -1, &ntid, &env)) + &pager, &inv, -1, &ntid, &env)) return L4_NIL_ID; return ntid; @@ -338,10 +338,10 @@ { DICE_DECLARE_ENV(env); l4_threadid_t ntid = L4_NIL_ID;; - l4_threadid_t nil = L4_NIL_ID; + l4_threadid_t inv = L4_INVALID_ID; if (rmgr_task_new_call(&rmgr_id, &tid, mcp_or_chief, esp, eip, - &pager, &nil, sched_param.sched_param, &ntid, &env)) + &pager, &inv, sched_param.sched_param, &ntid, &env)) return L4_NIL_ID; return ntid; diff -ruN p2/l4/pkg/roottask/server/src/init.c p3/l4/pkg/roottask/server/src/init.c --- p2/l4/pkg/roottask/server/src/init.c 2006-10-13 12:03:12.000000000 +0200 +++ p3/l4/pkg/roottask/server/src/init.c 2006-11-30 11:22:41.000000000 +0100 @@ -100,12 +100,7 @@ &sfpage.snd_base, &sfpage.fpage.fpage, L4_IPC_NEVER, &result); #else - // old - error = l4_ipc_call(my_pager, - L4_IPC_SHORT_MSG, 1, 1, - L4_IPC_MAPMSG((l4_umword_t)k, L4_LOG2_PAGESIZE), - &sfpage.snd_base, &sfpage.fpage.fpage, - L4_IPC_NEVER, &result); +#error Update your sigma0/libsigma0 #endif if (error) @@ -374,11 +369,7 @@ #ifdef SIGMA0_REQ_MAGIC if (MEM_MAX && mem_high > MEM_MAX) #else -#ifdef ARCH_arm - if (mem_high > (1024 << 20)) -#else - if (mem_high > (1024 << 20)) -#endif +#error Update your sigma0/libsigma0 #endif mem_high = MEM_MAX; diff -ruN p2/l4/pkg/roottask/server/src/names.c p3/l4/pkg/roottask/server/src/names.c --- p2/l4/pkg/roottask/server/src/names.c 2006-02-15 10:53:51.000000000 +0100 +++ p3/l4/pkg/roottask/server/src/names.c 2006-12-01 17:29:59.000000000 +0100 @@ -11,7 +11,14 @@ void names_set(l4_threadid_t task, const char *name) { + if (max_modules_names >= MODS_MAX) + { + printf("ROOTTASK: ERROR: too many names to register:" + " '%s' not registered\n", name); + return; + } module_ids[max_modules_names] = task; + snprintf(module_names[max_modules_names], sizeof(module_names[0]), "%s", name); max_modules_names++; diff -ruN p2/l4/pkg/roottask/server/src/quota.c p3/l4/pkg/roottask/server/src/quota.c --- p2/l4/pkg/roottask/server/src/quota.c 2006-02-24 14:11:26.000000000 +0100 +++ p3/l4/pkg/roottask/server/src/quota.c 2006-12-01 17:29:59.000000000 +0100 @@ -152,7 +152,7 @@ return 0; } -void +int cfg_quota_copy(unsigned i, const char *name) { int j; @@ -161,8 +161,10 @@ if (is_program_in_cmdline(name, cfg_quota[j].name)) { quota[i] = cfg_quota[j].quota; - return; + return 0; } + + return -1; } void diff -ruN p2/l4/pkg/roottask/server/src/quota.h p3/l4/pkg/roottask/server/src/quota.h --- p2/l4/pkg/roottask/server/src/quota.h 2006-02-24 14:11:26.000000000 +0100 +++ p3/l4/pkg/roottask/server/src/quota.h 2006-12-01 17:29:59.000000000 +0100 @@ -48,7 +48,7 @@ } __attribute__((packed)) quota_t; const char * cfg_quota_set(const char *name, const quota_t * const q); -void cfg_quota_copy(unsigned i, const char *name); +int cfg_quota_copy(unsigned i, const char *name); void quota_init(void); void quota_init_log_mcp(int log_mcp); void quota_init_mcp(int mcp); diff -ruN p2/l4/pkg/roottask/server/src/rmgr.c p3/l4/pkg/roottask/server/src/rmgr.c --- p2/l4/pkg/roottask/server/src/rmgr.c 2006-10-13 17:49:22.000000000 +0200 +++ p3/l4/pkg/roottask/server/src/rmgr.c 2006-12-01 17:29:59.000000000 +0100 @@ -360,12 +360,9 @@ l4util_idstr(*tid), modname); if (task_owner(tid->id.task) == _dice_corba_obj->id.task) - { - names_set(id, modname); - cfg_quota_copy(id.id.task, modname); - } + return cfg_quota_copy(id.id.task, modname); - return 0; + return -1; } long diff -ruN p2/l4/pkg/semaphore/include/semaphore.h p3/l4/pkg/semaphore/include/semaphore.h --- p2/l4/pkg/semaphore/include/semaphore.h 2006-03-01 11:12:26.000000000 +0100 +++ p3/l4/pkg/semaphore/include/semaphore.h 2006-11-30 11:16:31.000000000 +0100 @@ -1,4 +1,4 @@ -/* $Id: semaphore.h,v 1.14 2006/03/01 10:12:26 mp26 Exp $ */ +/* $Id: semaphore.h,v 1.14.6.1 2006/11/30 10:16:31 cw183155 Exp $ */ /*****************************************************************************/ /** * \file semaphore/include/semaphore.h @@ -61,15 +61,6 @@ } l4semaphore_t; /***************************************************************************** - *** global data - *****************************************************************************/ - -/** - * Semaphore thread id - */ -extern l4_threadid_t l4semaphore_thread_l4_id; - -/***************************************************************************** *** defines *****************************************************************************/ @@ -126,11 +117,20 @@ /// with timeout #define L4SEMAPHORE_RELEASETIMED 0x00000004 ///< remove thread that timed out +__BEGIN_DECLS; + /***************************************************************************** - *** prototypes + *** global data *****************************************************************************/ -__BEGIN_DECLS; +/** + * Semaphore thread id + */ +extern l4_threadid_t l4semaphore_thread_l4_id; + +/***************************************************************************** + *** prototypes + *****************************************************************************/ /*****************************************************************************/ /** diff -ruN p2/l4/pkg/sigma0/server/src/ARCH-x86/memmap.c p3/l4/pkg/sigma0/server/src/ARCH-x86/memmap.c --- p2/l4/pkg/sigma0/server/src/ARCH-x86/memmap.c 2006-06-29 12:40:16.000000000 +0200 +++ p3/l4/pkg/sigma0/server/src/ARCH-x86/memmap.c 2006-11-30 11:20:53.000000000 +0100 @@ -44,7 +44,7 @@ { case SIGMA0_REQ_ID_FPAGE_RAM: // dedicated fpage cached RAM case SIGMA0_REQ_ID_FPAGE_IOMEM: // dedicated fpage uncached I/O mem - case SIGMA0_REQ_ID_FPAGE_IOMEM_CACHED: // dedicated fpage uncached I/O mem + case SIGMA0_REQ_ID_FPAGE_IOMEM_CACHED: // dedicated fpage cached I/O mem { int super = fp.fp.size >= L4_LOG2_SUPERPAGESIZE; int shift = super ? L4_SUPERPAGESHIFT : L4_PAGESHIFT; diff -ruN p2/l4/tool/dice/ChangeLog p3/l4/tool/dice/ChangeLog --- p2/l4/tool/dice/ChangeLog 2006-08-04 15:59:39.000000000 +0200 +++ p3/l4/tool/dice/ChangeLog 2006-11-30 10:41:04.000000000 +0100 @@ -1,9 +1,21 @@ $Log, ChangeLog,v $ 3.1.0 - - add --disable-verbose option to configure + - replace -C option with -x corba (conforms to gcc and easier to extend) + - fix recognition of unnamed union/struct fields in C parser + - changed verboseness levels: + -v1 only print options + -v2 + verbose compiler output (same as -v) + -v3 + verbose parser output + -v4 + verbose scanner output + - add --disable-verbose option to configure (requires automake 1.9) - reimplemented [sched_donate] function attribute to modify time donation during IPC + - implement send-only function in socket back-end (Stephen Kell) + - add receive timeout in socket back-end (Stephen Kell) + - more C++-ification (using more STL functionality) + - replace [prealloc] by [prealloc_client] and [prealloc_server]. + - several bug fixes 3.0.0 - changed --verbose Option handling diff -ruN p2/l4/tool/dice/configure.in p3/l4/tool/dice/configure.in --- p2/l4/tool/dice/configure.in 2006-08-09 14:00:49.000000000 +0200 +++ p3/l4/tool/dice/configure.in 2006-11-30 10:41:04.000000000 +0100 @@ -3,7 +3,7 @@ AC_PREREQ(2.50) AC_INIT(src/main.cpp) -AM_INIT_AUTOMAKE(dice, 3.0.0) +AM_INIT_AUTOMAKE(dice, 3.1.0) AM_CONFIG_HEADER(config.h) dnl Test for AIX diff -ruN p2/l4/tool/dice/debian/changelog p3/l4/tool/dice/debian/changelog --- p2/l4/tool/dice/debian/changelog 2005-07-08 17:36:32.000000000 +0200 +++ p3/l4/tool/dice/debian/changelog 2006-11-30 10:41:04.000000000 +0100 @@ -1,3 +1,9 @@ +dice (3.1.0-1) unstable; urgency=low + + * New upstream release. + + -- Adam Lackorzynski Wed, 29 Nov 2006 13:56:30 +0100 + dice (2.2.9-1) unstable; urgency=low * New upstream release. diff -ruN p2/l4/tool/dice/doc/user-man/section1.tex p3/l4/tool/dice/doc/user-man/section1.tex --- p2/l4/tool/dice/doc/user-man/section1.tex 2006-08-14 17:43:12.000000000 +0200 +++ p3/l4/tool/dice/doc/user-man/section1.tex 2006-11-30 16:30:32.000000000 +0100 @@ -539,10 +539,10 @@ you know the receive buffer for the variable sized parameter before calling the client stub, you may want to give this buffer to the client stub, so the data is copied directly into this buffer. This can be done using -\verb|prealloc| attribute: +\verb|prealloc_client| attribute: \begin{verbatim} -[out, prealloc, size_is(len), ref] char** str, +[out, prealloc_client, size_is(len), ref] char** str, [out, in] int *len \end{verbatim} @@ -562,6 +562,21 @@ \verb|out| parameter even though it is preallocated and thus no memory allocation is necessary in the stub.} +Note: The \verb|prealloc_client| attribute also has the counter-part +\verb|prealloc_server|. Using this attribute will generate code that +allocates memory for the parameter in the server side dispatcher function. +The allocated memory is then handed to the component function for using. +Because the environment's \verb|malloc| (or the \verb|CORBA_alloc|) function +is used for this parameter on every invocation of the respective operation, +the memory should eventually be freed. This is automatically done by the +generated code. It registers the allocated memory pointer in the +environment's pointer list. This list is iterated after the +receipt\footnote{Freeing the memory before sending the message is not possible, +because the memory is needed during the reply.} of the next message and freed. +If you want to keep the memory for further processing, you have to remove the +memory from the list. Usually the usage of \verb|prealloc_server| is not +necessary. + \subsection{Error Function} Usually the server ignores IPC errors when sending a reply to a client or diff -ruN p2/l4/tool/dice/include/dice/dice-corba-types.h p3/l4/tool/dice/include/dice/dice-corba-types.h --- p2/l4/tool/dice/include/dice/dice-corba-types.h 2006-10-11 12:04:10.000000000 +0200 +++ p3/l4/tool/dice/include/dice/dice-corba-types.h 2006-11-30 10:41:04.000000000 +0100 @@ -12,6 +12,11 @@ #define DICE_PTRS_MAX 10 #endif +#ifdef __cplusplus +namespace dice +{ +#endif + /* * CORBA language mapping types */ @@ -68,14 +73,42 @@ } dice_CORBA_exception_type; #endif // dice_CORBA_exception_type_typedef +/* close dice namespace before includes */ +#ifdef __cplusplus +} +#endif + #ifndef CORBA_Object_typedef #define CORBA_Object_typedef #ifdef L4API_linux + +#ifdef __cplusplus +namespace dice +{ +#endif /* __cplusplus */ + typedef struct sockaddr_in CORBA_Object_base; + +#ifdef __cplusplus +} /* namespace dice */ +#endif + #elif defined(L4API_l4v2) || defined(L4API_l4x0) + #include + +#ifdef __cplusplus +namespace dice +{ +#endif /* __cplusplus */ + typedef l4_threadid_t CORBA_Object_base; + +#ifdef __cplusplus +} /* namespace dice */ +#endif + #elif defined(L4API_l4x2) || defined(L4API_l4v4) // KA: //#include @@ -83,12 +116,32 @@ // DD: #include #include + +#ifdef __cplusplus +namespace dice +{ +#endif /* __cplusplus */ + typedef L4_ThreadId_t CORBA_Object_base; + +#ifdef __cplusplus +} /* namespace dice */ #endif +#endif /* L4API_ */ + +#ifdef __cplusplus +namespace dice +{ +#endif /* __cplusplus */ + typedef CORBA_Object_base* CORBA_Object; typedef const CORBA_Object_base * const_CORBA_Object; +#ifdef __cplusplus +} /* namespace dice */ +#endif + #endif // CORBA_Object_typedef /* @@ -111,11 +164,26 @@ #ifdef L4API_linux +#ifdef __cplusplus +namespace dice +{ +#endif /* __cplusplus */ + typedef void* (*dice_malloc_func)(size_t); typedef void (*dice_free_func)(void*); +#ifdef __cplusplus +} /* namespace dice */ +#endif + #include #include + +#ifdef __cplusplus +namespace dice +{ +#endif /* __cplusplus */ + typedef struct CORBA_Environment { CORBA_exception_type major:4; @@ -143,9 +211,18 @@ #endif } CORBA_Environment; +#ifdef __cplusplus +} /* namespace dice */ +#endif + #define CORBA_Server_Environment CORBA_Environment #elif defined(L4API_l4v2) || defined(L4API_l4x0) +#ifdef __cplusplus +namespace dice +{ +#endif /* __cplusplus */ + typedef void* (*dice_malloc_func)(unsigned long); typedef void (*dice_free_func)(void*); @@ -203,8 +280,17 @@ #endif } CORBA_Server_Environment; +#ifdef __cplusplus +} /* namespace dice */ +#endif + #elif defined(L4API_l4x2) || defined(L4API_l4v4) +#ifdef __cplusplus +namespace dice +{ +#endif /* __cplusplus */ + typedef void* (*dice_malloc_func)(unsigned long); typedef void (*dice_free_func)(void*); @@ -261,6 +347,11 @@ CORBA_Server_Environment& operator=(const CORBA_Server_Environment &); #endif } CORBA_Server_Environment; + +#ifdef __cplusplus +} /* namespace dice */ +#endif + #endif /* x2 || v4 */ #if defined(L4API_l4v2) || defined(L4API_l4x0) || defined(L4API_l4x2) || defined(L4API_l4v4) @@ -322,6 +413,11 @@ #endif /* L4_INLINE */ #endif /* !DICE_INLINE */ +#ifdef __cplusplus +namespace dice +{ +#endif + /** * \brief test if two CORBA_Objects are equal * \ingroup dice_types @@ -470,5 +566,11 @@ #endif /* L4API_* */ +#ifdef __cplusplus +} /* namespace dice */ + +using namespace dice; +#endif + #endif // __DICE_CORBA_TYPES_H__ diff -ruN p2/l4/tool/dice/include/dice/dice.h p3/l4/tool/dice/include/dice/dice.h --- p2/l4/tool/dice/include/dice/dice.h 2006-06-14 14:24:53.000000000 +0200 +++ p3/l4/tool/dice/include/dice/dice.h 2006-11-30 10:41:04.000000000 +0100 @@ -149,13 +149,13 @@ #endif /* __cplusplus */ #endif /* !DICE_DECLARE_SERVER_ENV */ -/* common functions for the CORBA environement */ -static CORBA_char* __CORBA_Exception_Repository[CORBA_DICE_EXCEPTION_COUNT+1] = { "none", "wrong opcode", "ipc error", "internal ipc error", 0 }; - #ifdef __cplusplus extern "C" { #endif +/* common functions for the CORBA environement */ +static CORBA_char* __CORBA_Exception_Repository[CORBA_DICE_EXCEPTION_COUNT+1] = { "none", "wrong opcode", "ipc error", "internal ipc error", 0 }; + static inline void CORBA_exception_free(CORBA_Environment *ev) { @@ -286,16 +286,57 @@ { void *ptr = 0; if (!ev) + return ptr; + if (ev->ptrs_cur == 0 || + ev->ptrs_cur > DICE_PTRS_MAX) + return ptr; + ptr = ev->ptrs[--ev->ptrs_cur]; + ev->ptrs[ev->ptrs_cur] = 0; + return ptr; +} + +static inline +void* dice_get_nth_ptr(CORBA_Server_Environment *ev, int i) +{ + void *ptr = 0; + if (!ev) return 0; - if (ev->ptrs_cur > 0 && - ev->ptrs_cur <= DICE_PTRS_MAX) + if (i < 0 || i >= ev->ptrs_cur) + return 0; + ptr = ev->ptrs[i]; + /* move ptrs after i to collate array */ + while (i < ev->ptrs_cur) { - ptr = ev->ptrs[--ev->ptrs_cur]; - ev->ptrs[ev->ptrs_cur] = 0; + ev->ptrs[i] = ev->ptrs[i+1]; + i++; } + ev->ptrs_cur--; return ptr; } +static inline +const void* dice_get_ptr(CORBA_Server_Environment *ev, const void* p) +{ + int i; + if (!ev) + return 0; + for (i = 0; i < ev->ptrs_cur; i++) + { + if (p == ev->ptrs[i]) + break; + } + if (i == ev->ptrs_cur) + return 0; + /* move ptrs after i to collate array */ + while (i < ev->ptrs_cur) + { + ev->ptrs[i] = ev->ptrs[i+1]; + i++; + } + ev->ptrs_cur--; + return p; +} + #ifdef __cplusplus } #endif diff -ruN p2/l4/tool/dice/Makefile p3/l4/tool/dice/Makefile --- p2/l4/tool/dice/Makefile 2005-07-08 10:27:24.000000000 +0200 +++ p3/l4/tool/dice/Makefile 2006-11-30 10:41:04.000000000 +0100 @@ -17,6 +17,9 @@ drops: $(MAKE) -f Makefile.drops + +debian-pkg: + dpkg-buildpackage -rfakeroot -uc -us -b endif diff -ruN p2/l4/tool/dice/src/Attribute-Type.h p3/l4/tool/dice/src/Attribute-Type.h --- p2/l4/tool/dice/src/Attribute-Type.h 2006-08-21 16:46:34.000000000 +0200 +++ p3/l4/tool/dice/src/Attribute-Type.h 2006-11-30 10:41:05.000000000 +0100 @@ -78,7 +78,8 @@ ATTR_INIT_RCVSTRING, /**< interface: same as -finit-rcvstring on per interface basis */ ATTR_INIT_RCVSTRING_CLIENT, /**< interface: same as -finit-rcvstring on per interface basis (function is valid for client only) */ ATTR_INIT_RCVSTRING_SERVER, /**< interface: same as -finit-rcvstring on per interface basis (function is valid for server only) */ - ATTR_PREALLOC, /**< parameter: init the recieve buffer with the input value */ + ATTR_PREALLOC_CLIENT, /**< parameter: same as prealloc; only client side */ + ATTR_PREALLOC_SERVER, /**< parameter: same as prealloc; only server side */ ATTR_ALLOW_REPLY_ONLY, /**< function: allow that function can reply only to the client */ ATTR_READONLY, /**< attribute: readonly interface attribute */ ATTR_NOOPCODE, /**< function: allow that function does not send an opcode */ diff -ruN p2/l4/tool/dice/src/be/BEAttribute.cpp p3/l4/tool/dice/src/be/BEAttribute.cpp --- p2/l4/tool/dice/src/be/BEAttribute.cpp 2006-10-10 14:46:16.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEAttribute.cpp 2006-11-30 10:41:06.000000000 +0100 @@ -48,7 +48,6 @@ #include "Compiler.h" #include #include -using namespace std; CBEAttribute::CBEAttribute() : m_pPtrDefault(0), @@ -138,7 +137,6 @@ */ void CBEAttribute::CreateBackEnd(CFEAttribute * pFEAttribute) - throw (CBECreateException*) { // call CBEObject's CreateBackEnd method CBEObject::CreateBackEnd(pFEAttribute); @@ -226,7 +224,8 @@ case ATTR_PTR: // simple case ATTR_STRING: // simple case ATTR_CONTEXT_HANDLE: // simple - case ATTR_PREALLOC: // simple + case ATTR_PREALLOC_CLIENT: // simple + case ATTR_PREALLOC_SERVER: // simple case ATTR_ALLOW_REPLY_ONLY: // simple case ATTR_SCHED_DONATE: // simple case ATTR_DEDICATED_PARTNER: @@ -256,7 +255,6 @@ */ void CBEAttribute::CreateBackEnd(ATTR_TYPE nType) - throw (CBECreateException*) { m_nType = nType; switch (m_nType) @@ -284,7 +282,8 @@ case ATTR_PTR: // simple case ATTR_STRING: // simple case ATTR_CONTEXT_HANDLE: // simple - case ATTR_PREALLOC: // simple + case ATTR_PREALLOC_CLIENT: // simple + case ATTR_PREALLOC_SERVER: // simple case ATTR_ALLOW_REPLY_ONLY: // simple case ATTR_SCHED_DONATE: // simple case ATTR_DEDICATED_PARTNER: // simple @@ -311,7 +310,6 @@ */ void CBEAttribute::CreateBackEndType(CFETypeAttribute * pFETypeAttribute) - throw (CBECreateException*) { CFETypeSpec *pType = pFETypeAttribute->GetType(); CBEClassFactory *pCF = CCompiler::GetClassFactory(); @@ -335,7 +333,6 @@ */ void CBEAttribute::CreateBackEndString(CFEStringAttribute * pFEstringAttribute) - throw (CBECreateException*) { m_sString = pFEstringAttribute->GetString(); } @@ -350,7 +347,6 @@ */ void CBEAttribute::CreateBackEndIs(CFEIsAttribute * pFEIsAttribute) - throw (CBECreateException*) { vector::iterator iterAP; for (iterAP = pFEIsAttribute->m_AttrParameters.begin(); @@ -441,7 +437,6 @@ void CBEAttribute::CreateBackEndIs(ATTR_TYPE nType, CBEDeclarator *pDeclarator) - throw (CBECreateException*) { string exc = string(__func__); // check type @@ -474,7 +469,6 @@ void CBEAttribute::CreateBackEndInt(ATTR_TYPE nType, int nValue) - throw (CBECreateException*) { string exc = string(__func__); // check type @@ -506,7 +500,6 @@ void CBEAttribute::CreateBackEndType(ATTR_TYPE nType, CBEType *pType) - throw (CBECreateException*) { string exc = string(__func__); // check type @@ -530,7 +523,6 @@ */ void CBEAttribute::CreateBackEndInt(CFEIntAttribute * pFEIntAttribute) - throw (CBECreateException*) { m_nIntValue = pFEIntAttribute->GetIntValue(); } @@ -541,7 +533,6 @@ */ void CBEAttribute::CreateBackEndVersion(CFEVersionAttribute *pFEVersionAttribute) - throw (CBECreateException*) { pFEVersionAttribute->GetVersion(m_nMajorVersion, m_nMinorVersion); } @@ -651,6 +642,6 @@ default: break; } - DTRACE("%s: str = %s (class is %d)\n", __func__, - str.c_str(), m_nAttrClass); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s: str = %s (class is %d)\n", + __func__, str.c_str(), m_nAttrClass); } diff -ruN p2/l4/tool/dice/src/be/BEAttribute.h p3/l4/tool/dice/src/be/BEAttribute.h --- p2/l4/tool/dice/src/be/BEAttribute.h 2006-08-21 16:46:35.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEAttribute.h 2006-11-30 10:41:06.000000000 +0100 @@ -35,7 +35,6 @@ #include "template.h" #include #include -using namespace std; class CFEAttribute; class CFEIntAttribute; @@ -85,16 +84,11 @@ virtual int GetRemainingNumberOfIsAttributes( vector::iterator iter); - virtual void CreateBackEnd(ATTR_TYPE nType) - throw (CBECreateException*); - virtual void CreateBackEnd(CFEAttribute * pFEAttribute) - throw (CBECreateException*); - virtual void CreateBackEndIs(ATTR_TYPE nType, CBEDeclarator *pDeclarator) - throw (CBECreateException*); - virtual void CreateBackEndInt(ATTR_TYPE nType, int nValue) - throw (CBECreateException*); - virtual void CreateBackEndType(ATTR_TYPE nType, CBEType *pType) - throw (CBECreateException*); + virtual void CreateBackEnd(ATTR_TYPE nType); + virtual void CreateBackEnd(CFEAttribute * pFEAttribute); + virtual void CreateBackEndIs(ATTR_TYPE nType, CBEDeclarator *pDeclarator); + virtual void CreateBackEndInt(ATTR_TYPE nType, int nValue); + virtual void CreateBackEndType(ATTR_TYPE nType, CBEType *pType); virtual CObject * Clone(); virtual void Write(CBEFile *pFile); @@ -152,16 +146,11 @@ { return m_pType; } protected: - virtual void CreateBackEndInt(CFEIntAttribute * pFEIntAttribute) - throw (CBECreateException*); - virtual void CreateBackEndIs(CFEIsAttribute * pFEIsAttribute) - throw (CBECreateException*); - virtual void CreateBackEndString(CFEStringAttribute * pFEStringAttribute) - throw (CBECreateException*); - virtual void CreateBackEndType(CFETypeAttribute * pFETypeAttribute) - throw (CBECreateException*); - virtual void CreateBackEndVersion(CFEVersionAttribute * pFEVersionAttribute) - throw (CBECreateException*); + virtual void CreateBackEndInt(CFEIntAttribute * pFEIntAttribute); + virtual void CreateBackEndIs(CFEIsAttribute * pFEIsAttribute); + virtual void CreateBackEndString(CFEStringAttribute * pFEStringAttribute); + virtual void CreateBackEndType(CFETypeAttribute * pFETypeAttribute); + virtual void CreateBackEndVersion(CFEVersionAttribute * pFEVersionAttribute); protected: /** \var ATTR_TYPE m_nType diff -ruN p2/l4/tool/dice/src/be/BECallFunction.cpp p3/l4/tool/dice/src/be/BECallFunction.cpp --- p2/l4/tool/dice/src/be/BECallFunction.cpp 2006-08-23 19:27:56.000000000 +0200 +++ p3/l4/tool/dice/src/be/BECallFunction.cpp 2006-11-30 10:41:06.000000000 +0100 @@ -44,7 +44,6 @@ #include "Attribute-Type.h" #include "fe/FEOperation.h" #include -using namespace std; CBECallFunction::CBECallFunction() : CBEOperationFunction(FUNCTION_CALL) @@ -75,7 +74,7 @@ GetName().c_str(), pFile->GetFileName().c_str()); // init message buffer CBEMsgBuffer *pMsgBuffer = GetMessageBuffer(); - pMsgBuffer->WriteInitialization(pFile); + pMsgBuffer->WriteInitialization(pFile, this, 0, 0); } /** \brief writes the invocation of the message transfer @@ -132,7 +131,6 @@ */ void CBECallFunction::CreateBackEnd(CFEOperation * pFEOperation) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s for operation %s called\n", __func__, pFEOperation->GetName().c_str()); @@ -210,11 +208,12 @@ CBECallFunction::DoMarshalParameter(CBETypedDeclarator *pParameter, bool bMarshal) { - DTRACE("%s called for %s with marshal=%s and IN=%s, OUT=%s\n", - __func__, pParameter->m_Declarators.First()->GetName().c_str(), - (bMarshal) ? "yes" : "no", - pParameter->m_Attributes.Find(ATTR_IN) ? "yes" : "no", - pParameter->m_Attributes.Find(ATTR_OUT) ? "yes" : "no"); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s called for %s with marshal=%s and IN=%s, OUT=%s\n", + __func__, pParameter->m_Declarators.First()->GetName().c_str(), + (bMarshal) ? "yes" : "no", + pParameter->m_Attributes.Find(ATTR_IN) ? "yes" : "no", + pParameter->m_Attributes.Find(ATTR_OUT) ? "yes" : "no"); if (!CBEOperationFunction::DoMarshalParameter(pParameter, bMarshal)) return false; if (bMarshal && pParameter->m_Attributes.Find(ATTR_IN)) @@ -233,8 +232,19 @@ */ bool CBECallFunction::DoWriteFunction(CBEHeaderFile * pFile) { + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBECallFunction::%s(%s) called for %s\n", __func__, + pFile->GetFileName().c_str(), GetName().c_str()); + if (!IsTargetFile(pFile)) + { + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBECallFunction::%s failed: wrong target file\n", __func__); return false; + } + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBECallFunction::%s finished.\n", + __func__); return pFile->IsOfFileType(FILETYPE_CLIENT); } @@ -247,8 +257,19 @@ */ bool CBECallFunction::DoWriteFunction(CBEImplementationFile * pFile) { + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBECallFunction::%s(%s) called for %s\n", __func__, + pFile->GetFileName().c_str(), GetName().c_str()); + if (!IsTargetFile(pFile)) + { + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBECallFunction::%s failed: wrong target file\n", __func__); return false; + } + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBECallFunction::%s finished.\n", + __func__); return pFile->IsOfFileType(FILETYPE_CLIENT); } diff -ruN p2/l4/tool/dice/src/be/BECallFunction.h p3/l4/tool/dice/src/be/BECallFunction.h --- p2/l4/tool/dice/src/be/BECallFunction.h 2006-08-04 18:17:16.000000000 +0200 +++ p3/l4/tool/dice/src/be/BECallFunction.h 2006-11-30 10:41:06.000000000 +0100 @@ -53,8 +53,7 @@ CBECallFunction(CBECallFunction &src); public: - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); virtual bool DoMarshalParameter(CBETypedDeclarator * pParameter, bool bMarshal); virtual bool DoWriteFunction(CBEHeaderFile* pFile); diff -ruN p2/l4/tool/dice/src/be/BEClass.cpp p3/l4/tool/dice/src/be/BEClass.cpp --- p2/l4/tool/dice/src/be/BEClass.cpp 2006-10-10 16:59:25.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEClass.cpp 2006-11-30 10:41:06.000000000 +0100 @@ -80,7 +80,6 @@ #include #include -using namespace std; // CFunctionGroup IMPLEMENTATION @@ -233,13 +232,13 @@ */ void CBEClass::CreateBackEnd(CFEInterface * pFEInterface) - throw (CBECreateException*) { + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s(interf: %s) called\n", + __func__, pFEInterface->GetName().c_str()); + // call CBEObject's CreateBackEnd method CBEObject::CreateBackEnd(pFEInterface); - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); - // set target file name SetTargetFileName(pFEInterface); // set own name @@ -324,6 +323,8 @@ CreateObject(); CreateEnvironment(); } + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s finished\n", __func__); } /** \brief add the message buffer @@ -343,7 +344,6 @@ */ void CBEClass::AddMessageBuffer(CFEInterface *pFEInterface) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "\n\n\n"); CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, @@ -458,9 +458,8 @@ */ void CBEClass::AddInterfaceFunctions(CFEInterface* pFEInterface) - throw (CBECreateException*) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); CBEClassFactory *pCF = CCompiler::GetClassFactory(); CBEInterfaceFunction *pFunction = pCF->GetNewWaitAnyFunction(); @@ -475,7 +474,7 @@ e->Print(); delete e; - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; string exc = string(__func__); exc += " failed because wait-any function could not be created"; @@ -493,7 +492,7 @@ e->Print(); delete e; - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; string exc = string(__func__); exc += " failed because recv-any function could not be created"; @@ -511,7 +510,7 @@ e->Print(); delete e; - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; string exc = string(__func__); exc += " failed because reply-wait-any function could not be created"; @@ -532,7 +531,7 @@ e->Print(); delete e; - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; string exc = string(__func__); exc += " failed because dispatch function could not be created"; @@ -553,13 +552,15 @@ e->Print(); delete e; - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; string exc = string(__func__); exc += " failed because srv-loop function could not be created"; throw new CBECreateException(exc); } } + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s finished\n", __func__); } /** \brief creates an alias type for the class @@ -571,11 +572,10 @@ */ void CBEClass::CreateAliasForClass(CFEInterface *pFEInterface) - throw (CBECreateException*) { assert(pFEInterface); - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, - "CBEClass::%s(interfae) called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEClass::%s(interface) called\n", __func__); // create the BE type CBEClassFactory *pCF = CCompiler::GetClassFactory(); CBETypedef *pTypedef = pCF->GetNewTypedef(); @@ -605,7 +605,7 @@ } catch (CBECreateException *e) { - m_Typedefs.Remove(pTypedef); + m_Typedefs.Remove(pTypedef); delete pTypedef; delete pType; e->Print(); @@ -622,7 +622,7 @@ pTypedef->SetSourceFileName( pFEInterface->GetSpecificParent()->GetFileName()); - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s(interface) returns\n", __func__); } @@ -632,9 +632,8 @@ */ void CBEClass::CreateBackEnd(CFEConstDeclarator *pFEConstant) - throw (CBECreateException*) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s(const) called\n", + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s(const) called\n", __func__); CBEClassFactory *pCF = CCompiler::GetClassFactory(); @@ -647,7 +646,7 @@ } catch (CBECreateException *e) { - m_Constants.Remove(pConstant); + m_Constants.Remove(pConstant); delete pConstant; e->Print(); delete e; @@ -657,7 +656,8 @@ " could not be created"; throw new CBECreateException(exc); } - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s(const) returns\n", __func__); } @@ -667,9 +667,8 @@ */ void CBEClass::CreateBackEnd(CFETypedDeclarator *pFETypedef) - throw (CBECreateException*) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s(typedef) called\n", __func__); CBEClassFactory *pCF = CCompiler::GetClassFactory(); @@ -682,7 +681,7 @@ } catch (CBECreateException *e) { - m_Typedefs.Remove(pTypedef); + m_Typedefs.Remove(pTypedef); delete pTypedef; e->Print(); delete e; @@ -691,7 +690,8 @@ exc += " failed because typedef could not be created"; throw new CBECreateException(exc); } - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s(typedef) returns\n", __func__); } @@ -701,7 +701,6 @@ */ void CBEClass::CreateBackEnd(CFEAttributeDeclarator *pFEAttrDecl) - throw (CBECreateException*) { string exc = string(__func__); if (!pFEAttrDecl) @@ -709,7 +708,10 @@ exc += " failed because attribute declarator is 0"; throw new CBECreateException(exc); } - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); + + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s(attr-decl) called\n", + __func__); + // add function " [out]__get_();" for // each decl if !READONLY: // add function "void [in]__set_( @@ -785,6 +787,8 @@ } } } + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); } /** \brief internal function to create the back-end functions @@ -802,9 +806,8 @@ */ void CBEClass::CreateFunctionsNoClassDependency(CFEOperation *pFEOperation) - throw (CBECreateException*) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called.\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "%s called.\n", __func__); CFunctionGroup *pGroup = new CFunctionGroup(pFEOperation); m_FunctionGroups.Add(pGroup); @@ -831,7 +834,7 @@ { e->Print(); delete e; - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; exc += " failed, because call func couldn't be created for " + @@ -852,7 +855,7 @@ { e->Print(); delete e; - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; exc += " failed, because component func couldn't be created for " + @@ -874,7 +877,7 @@ { e->Print(); delete e; - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; exc += " failed, because reply function could not be " \ @@ -901,7 +904,7 @@ { e->Print(); delete e; - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; exc += " failed, because send function could not be created " \ @@ -922,7 +925,7 @@ { e->Print(); delete e; - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; exc += " failed, because wait function could not be created for " + @@ -942,7 +945,7 @@ { e->Print(); delete e; - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; exc += " failed because receive function could not be created for " @@ -965,7 +968,7 @@ { e->Print(); delete e; - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; exc += " failed, because component function could not be " \ @@ -975,7 +978,7 @@ } } - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s returns.\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "%s returns.\n", __func__); } /** \brief internal function to create the back-end functions @@ -993,7 +996,6 @@ */ void CBEClass::CreateFunctionsClassDependency(CFEOperation *pFEOperation) - throw (CBECreateException*) { string exc = string(__func__); // get function group of pFEOperation (should have been create above) @@ -1023,7 +1025,7 @@ } catch (CBECreateException *e) { - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; e->Print(); delete e; @@ -1043,7 +1045,7 @@ } catch (CBECreateException *e) { - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; e->Print(); delete e; @@ -1069,7 +1071,7 @@ } catch (CBECreateException *e) { - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; e->Print(); delete e; @@ -1087,9 +1089,9 @@ */ void CBEClass::CreateBackEnd(CFEAttribute *pFEAttribute) - throw (CBECreateException*) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s(attr) called\n", + __func__); CBEClassFactory *pCF = CCompiler::GetClassFactory(); CBEAttribute *pAttribute = pCF->GetNewAttribute(); @@ -1100,7 +1102,7 @@ } catch (CBECreateException *e) { - m_Attributes.Remove(pAttribute); + m_Attributes.Remove(pAttribute); delete pAttribute; e->Print(); delete e; @@ -1109,6 +1111,8 @@ exc += " failed because attribute could not be created"; throw new CBECreateException(exc); } + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s finished\n", __func__); } /** \brief adds the Class to the header file @@ -1119,16 +1123,16 @@ */ bool CBEClass::AddToFile(CBEHeaderFile *pHeader) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, - "%s(header: %s) for class %s called\n", __func__, + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEClass::%s(header: %s) for class %s called\n", __func__, pHeader->GetFileName().c_str(), GetName().c_str()); // add this class to the file assert(pHeader); if (IsTargetFile(pHeader)) pHeader->m_Classes.Add(this); - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, - "%s(header: %s) for class %s returns true\n", __func__, + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEClass::%s(header: %s) for class %s returns true\n", __func__, pHeader->GetFileName().c_str(), GetName().c_str()); return true; } @@ -1143,8 +1147,8 @@ */ bool CBEClass::AddToFile(CBEImplementationFile *pImpl) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, - "%s(impl: %s) for class %s called\n", __func__, + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEClass::%s(impl: %s) for class %s called\n", __func__, pImpl->GetFileName().c_str(), GetName().c_str()); // check compiler option assert(pImpl); @@ -1163,8 +1167,8 @@ if (IsTargetFile(pImpl)) pImpl->m_Classes.Add(this); - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, - "%s(impl: %s) for class %s returns true\n", __func__, + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEClass::%s(impl: %s) for class %s returns true\n", __func__, pImpl->GetFileName().c_str(), GetName().c_str()); return true; } @@ -1284,7 +1288,8 @@ CBEFunction* CBEClass::FindFunction(string sFunctionName, FUNCTION_TYPE nFunctionType) { - DTRACE("%s(%s) called\n", __func__, sFunctionName.c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s(%s) called\n", __func__, + sFunctionName.c_str()); if (sFunctionName.empty()) return 0; @@ -1295,15 +1300,17 @@ iter != m_Functions.end(); iter++) { - DTRACE("%s checking function %s (compare to %s)\n", - __func__, (*iter)->GetName().c_str(), sFunctionName.c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s checking function %s (compare to %s)\n", __func__, + (*iter)->GetName().c_str(), sFunctionName.c_str()); + if ((*iter)->GetName() == sFunctionName && (*iter)->IsFunctionType(nFunctionType)) return *iter; } - DTRACE("%s function %s not found, return 0\n", __func__, - sFunctionName.c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s function %s not found, return 0\n", + __func__, sFunctionName.c_str()); return 0; } @@ -1316,12 +1323,15 @@ */ bool CBEClass::AddOpcodesToFile(CBEHeaderFile *pFile) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, - "CBEClass::AddOpcodesToFile(header: %s) called\n", - pFile->GetFileName().c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s(header: %s) called\n", + __func__, pFile->GetFileName().c_str()); // check if the file is really our target file if (!IsTargetFile(pFile)) + { + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEClass::%s wrong target file\n", __func__); return true; + } // first create classes in reverse order, so we can build correct parent // relationships @@ -1368,6 +1378,8 @@ delete pBrace; delete pInterfaceCode; delete pBits; + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEClass::%s opcode type creation failed\n", __func__); return false; } // create constant @@ -1384,10 +1396,12 @@ e->Print(); delete e; - pFile->m_Constants.Remove(pOpcode); + pFile->m_Constants.Remove(pOpcode); delete pOpcode; delete pValue; delete pType; + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEClass::%s opcode var creation failed\n", __func__); return false; } @@ -1398,9 +1412,14 @@ iter++) { if (!AddOpcodesToFile((*iter)->GetOperation(), pFile)) + { + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEClass::%s could not add opcodes of function group\n", __func__); return false; + } } + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s finished\n", __func__); return true; } @@ -1412,8 +1431,10 @@ CBEClass::AddOpcodesToFile(CFEOperation *pFEOperation, CBEHeaderFile *pFile) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEClass::AddOpcodesToFile(operation: %s) called\n", + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEClass::AddOpcodesToFile(operation: %s) called\n", pFEOperation->GetName().c_str()); + CBEClassFactory *pCF = CCompiler::GetClassFactory(); CBENameFactory *pNF = CCompiler::GetNameFactory(); // first create classes, so we can build parent relationship correctly @@ -1469,7 +1490,7 @@ e->Print(); delete e; - pFile->m_Constants.Remove(pOpcode); + pFile->m_Constants.Remove(pOpcode); delete pOpcode; delete pType; delete pTopBrace; @@ -1479,8 +1500,12 @@ delete pBrace; delete pFuncCode; delete pBitMask; + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEClass::%s opcode const creation failed\n", __func__); return false; } + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s finished\n", __func__); return true; } @@ -1529,7 +1554,7 @@ */ void CBEClass::Write(CBEHeaderFile *pFile) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s called\n", __func__); // since message buffer is local for this class, the class declaration // wraps the message buffer @@ -1584,6 +1609,8 @@ if (CCompiler::IsBackEndLanguageSet(PROGRAM_BE_CPP)) *pFile << "\t};\n"; + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s finished\n", __func__); } /** \brief writes the class name, which might be different for clnt & srv @@ -1700,11 +1727,13 @@ */ void CBEClass::Write(CBEImplementationFile *pFile) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s called\n", __func__); // write implementation for functions WriteElements(pFile); // write helper functions if any WriteHelperFunctions(pFile); + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s finished\n", __func__); } /** \brief writes the class to the target file @@ -1717,8 +1746,8 @@ */ void CBEClass::WriteElements(CBEHeaderFile *pFile) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, - "%s for %s called\n", __func__, GetName().c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEClass::%s for %s called\n", __func__, GetName().c_str()); // sort our members/elements depending on source line number // into extra vector @@ -1745,12 +1774,12 @@ WriteTypedef((CBETypedef*)(*iter), pFile); else if (dynamic_cast(*iter)) WriteTaggedType((CBEType*)(*iter), pFile); - } + } if (CCompiler::IsBackEndLanguageSet(PROGRAM_BE_CPP)) pFile->DecIndent(); - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::Write(head, %s) finished\n", GetName().c_str()); } @@ -1760,7 +1789,14 @@ void CBEClass::WriteFunctions(CBEHeaderFile *pFile) { + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEClass::%s(head, %s) called\n", __func__, GetName().c_str()); + int nFuncCount = GetFunctionWriteCount(pFile); + + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s %d functions\n", + __func__, nFuncCount); + if (nFuncCount > 0) { // members are public @@ -1788,6 +1824,9 @@ if (CCompiler::IsBackEndLanguageSet(PROGRAM_BE_CPP)) pFile->DecIndent(); } + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s(head, %s) finished\n", + __func__, GetName().c_str()); } /** \brief writes the class to the target file @@ -1798,7 +1837,7 @@ */ void CBEClass::WriteElements(CBEImplementationFile *pFile) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEClass::Write(impl, %s) called\n", GetName().c_str()); // sort our members/elements depending on source line number @@ -1806,7 +1845,7 @@ CreateOrderedElementList(); WriteFunctions(pFile); - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::Write(impl, %s) finished\n", GetName().c_str()); } @@ -1816,7 +1855,14 @@ void CBEClass::WriteFunctions(CBEImplementationFile *pFile) { + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEClass::%s(impl, %s) called\n", __func__, GetName().c_str()); + int nFuncCount = GetFunctionWriteCount(pFile); + + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s %d functions\n", + __func__, nFuncCount); + if (nFuncCount > 0) { WriteExternCStart(pFile); @@ -1836,6 +1882,9 @@ { WriteExternCEnd(pFile); } + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s(impl, %s) finished\n", + __func__, GetName().c_str()); } /** \brief writes the line directive @@ -1862,7 +1911,12 @@ assert(pConstant); if (!pConstant->IsTargetFile(pFile)) return; + + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s called\n", __func__); + pConstant->Write(pFile); + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s finished\n", __func__); } /** \brief write a type definition @@ -1875,7 +1929,12 @@ assert(pTypedef); if (!pTypedef->IsTargetFile(pFile)) return; + + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s called\n", __func__); + pTypedef->WriteDeclaration(pFile); + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s finished\n", __func__); } /** \brief write a function to the header file @@ -1886,11 +1945,18 @@ CBEHeaderFile *pFile) { assert(pFunction); + assert(pFile); + + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s(%s, %s) called\n", + __func__, pFunction->GetName().c_str(), pFile->GetFileName().c_str()); + if (pFunction->DoWriteFunction(pFile)) { pFunction->Write(pFile); *pFile << "\n"; } + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s finished\n", __func__); } /** \brief write a function to the implementation file @@ -1901,11 +1967,18 @@ CBEImplementationFile *pFile) { assert(pFunction); + assert(pFile); + + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s(%s, %s) called\n", + __func__, pFunction->GetName().c_str(), pFile->GetFileName().c_str()); + if (pFunction->DoWriteFunction(pFile)) { pFunction->Write(pFile); *pFile << "\n"; } + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s finished\n", __func__); } /** \brief calculates the function identifier @@ -1933,7 +2006,8 @@ int CBEClass::GetOperationNumber(CFEOperation *pFEOperation) { assert(pFEOperation); - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEClass::GetOperationNumber for %s\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEClass::GetOperationNumber for %s\n", pFEOperation->GetName().c_str()); CFEInterface *pFEInterface = pFEOperation->GetSpecificParent(); int nInterfaceNumber = GetInterfaceNumber(pFEInterface); @@ -1945,15 +2019,10 @@ vSameInterfaces.push_back(pFEInterface); // add this interface too FindPredefinedNumbers(&vSameInterfaces, &functionIDs); // find pFEInterface in vector - vector::iterator iterI = vSameInterfaces.begin(); - for (; iterI != vSameInterfaces.end(); iterI++) - { - if (*iterI == pFEInterface) - { - vSameInterfaces.erase(iterI); - break; // stops for loop - } - } + vector::iterator iterI = std::find(vSameInterfaces.begin(), + vSameInterfaces.end(), pFEInterface); + if (iterI != vSameInterfaces.end()) + vSameInterfaces.erase(iterI); // check for Uuid attribute and return its value if (HasUuid(pFEOperation)) return GetUuid(pFEOperation); @@ -2398,9 +2467,9 @@ */ void CBEClass::CreateBackEnd(CFEConstructedType *pFEType) - throw (CBECreateException*) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s(constr type) called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s(constr type) called\n", + __func__); CBEClassFactory *pCF = CCompiler::GetClassFactory(); CBEType *pType = pCF->GetNewType(pFEType->GetType()); @@ -2412,7 +2481,7 @@ } catch (CBECreateException *e) { - m_TypeDeclarations.Remove(pType); + m_TypeDeclarations.Remove(pType); delete pType; e->Print(); delete e; @@ -2421,7 +2490,8 @@ exc += " failed because tagged type could not be created"; throw new CBECreateException(exc); } - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s(constr type) returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEClass::%s(constr type) returns\n", + __func__); } /** \brief writes a tagged type declaration @@ -2493,7 +2563,7 @@ DIRECTION_IN); int nCountOut = GetParameterCount(nMustAttrs, nMustNotAttrs, DIRECTION_OUT); - return max(nCountIn, nCountOut); + return std::max(nCountIn, nCountOut); } int nCount = 0, nCurr; @@ -2511,7 +2581,7 @@ continue; nCurr = (*iterF)->GetParameterCount(nMustAttrs, nMustNotAttrs, nDirection); - nCount = max(nCount, nCurr); + nCount = std::max(nCount, nCurr); } } @@ -2593,8 +2663,7 @@ void CBEClass::CreateOrderedElementList(void) { // clear vector - m_vOrderedElements.erase(m_vOrderedElements.begin(), - m_vOrderedElements.end()); + m_vOrderedElements.clear(); // typedef vector::iterator iterF; for (iterF = m_Functions.begin(); @@ -2644,18 +2713,12 @@ { if ((*iter)->GetSourceLine() > nLine) { -// TRACE("Insert element from %s:%d before element from %s:%d\n", -// pObj->GetSourceFileName().c_str(), pObj->GetSourceLine(), -// (*iter)->GetSourceFileName().c_str(), -// (*iter)->GetSourceLine()); // insert before that element m_vOrderedElements.insert(iter, pObj); return; } } // new object is bigger that all existing -// TRACE("Insert element from %s:%d at end\n", -// pObj->GetSourceFileName().c_str(), pObj->GetSourceLine()); m_vOrderedElements.push_back(pObj); } @@ -2749,7 +2812,6 @@ */ void CBEClass::CreateObject() - throw (CBECreateException*) { // trace remove old object if (m_pCorbaObject) @@ -2804,7 +2866,6 @@ */ void CBEClass::CreateEnvironment() - throw (CBECreateException*) { // clean up if (m_pCorbaEnv) diff -ruN p2/l4/tool/dice/src/be/BEClassFactory.cpp p3/l4/tool/dice/src/be/BEClassFactory.cpp --- p2/l4/tool/dice/src/be/BEClassFactory.cpp 2006-08-23 19:27:56.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEClassFactory.cpp 2006-11-30 10:41:06.000000000 +0100 @@ -71,7 +71,6 @@ // for dynamic loadable tracing classes #include #include -using namespace std; CBEClassFactory::CBEClassFactory() { @@ -532,7 +531,7 @@ const char *errmsg = dlerror(); if (errmsg != NULL) { - cerr << errmsg; + std::cerr << errmsg; return (CBETrace*)0; } diff -ruN p2/l4/tool/dice/src/be/BEClass.h p3/l4/tool/dice/src/be/BEClass.h --- p2/l4/tool/dice/src/be/BEClass.h 2006-10-10 14:55:35.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEClass.h 2006-11-30 10:41:06.000000000 +0100 @@ -37,7 +37,7 @@ #include "template.h" #include #include -using namespace std; +using std::map; class CBEHeaderFile; class CBEImplementationFile; @@ -104,8 +104,7 @@ ~CBEClass(); public: // Public methods - void CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*); + void CreateBackEnd(CFEInterface *pFEInterface); bool AddToFile(CBEHeaderFile *pHeader); bool AddToFile(CBEImplementationFile *pImpl); int GetParameterCount(int nFEType, bool& bSameCount, int nDirection = 0); @@ -155,33 +154,21 @@ { return m_pMsgBuffer; } protected: - void CreateBackEnd(CFEConstDeclarator *pFEConstant) - throw (CBECreateException*); - void CreateBackEnd(CFETypedDeclarator *pFETypedef) - throw (CBECreateException*); - void CreateBackEnd(CFEAttributeDeclarator *pFEAttrDecl) - throw (CBECreateException*); - void CreateBackEnd(CFEAttribute *pFEAttribute) - throw (CBECreateException*); - void CreateBackEnd(CFEConstructedType *pFEType) - throw (CBECreateException*); + void CreateBackEnd(CFEConstDeclarator *pFEConstant); + void CreateBackEnd(CFETypedDeclarator *pFETypedef); + void CreateBackEnd(CFEAttributeDeclarator *pFEAttrDecl); + void CreateBackEnd(CFEAttribute *pFEAttribute); + void CreateBackEnd(CFEConstructedType *pFEType); - void CreateFunctionsNoClassDependency(CFEOperation *pFEOperation) - throw (CBECreateException*); - void CreateFunctionsClassDependency(CFEOperation *pFEOperation) - throw (CBECreateException*); - virtual void CreateObject(void) - throw (CBECreateException*); - virtual void CreateEnvironment(void) - throw (CBECreateException*); + void CreateFunctionsNoClassDependency(CFEOperation *pFEOperation); + void CreateFunctionsClassDependency(CFEOperation *pFEOperation); + virtual void CreateObject(void); + virtual void CreateEnvironment(void); - void AddInterfaceFunctions(CFEInterface* pFEInterface) - throw (CBECreateException*); - void AddMessageBuffer(CFEInterface* pFEInterface) - throw (CBECreateException*); + void AddInterfaceFunctions(CFEInterface* pFEInterface); + void AddMessageBuffer(CFEInterface* pFEInterface); - void CreateAliasForClass(CFEInterface *pFEInterface) - throw (CBECreateException*); + void CreateAliasForClass(CFEInterface *pFEInterface); bool AddOpcodesToFile(CFEOperation *pFEOperation, CBEHeaderFile *pFile); void WriteElements(CBEHeaderFile *pFile); diff -ruN p2/l4/tool/dice/src/be/BEClient.cpp p3/l4/tool/dice/src/be/BEClient.cpp --- p2/l4/tool/dice/src/be/BEClient.cpp 2006-10-10 14:46:16.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEClient.cpp 2006-11-30 10:41:06.000000000 +0100 @@ -49,8 +49,6 @@ #include "fe/FEIntAttribute.h" #include #include -using namespace std; - CBEClient::CBEClient() { @@ -83,7 +81,6 @@ */ void CBEClient::CreateBackEndFunction(CFEOperation *pFEOperation) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s for %s called\n", __func__, pFEOperation->GetName().c_str()); @@ -110,7 +107,7 @@ } catch (CBECreateException *e) { - m_ImplementationFiles.Remove(pImpl); + m_ImplementationFiles.Remove(pImpl); delete pImpl; throw; } @@ -194,7 +191,6 @@ */ void CBEClient::CreateBackEndHeader(CFEFile * pFEFile) - throw (CBECreateException*) { string exc = string(__func__); CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEClient::CreateBackEndHeader(file: %s) called\n", @@ -212,7 +208,7 @@ } catch (CBECreateException *e) { - m_HeaderFiles.Remove(pHeader); + m_HeaderFiles.Remove(pHeader); delete pHeader; throw; } @@ -228,7 +224,7 @@ } catch (CBECreateException *e) { - m_HeaderFiles.Remove(pOpcodes); + m_HeaderFiles.Remove(pOpcodes); delete pOpcodes; throw; } @@ -249,7 +245,6 @@ */ void CBEClient::CreateBackEndImplementation(CFEFile * pFEFile) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEClient::CreateBackEndImplementation(file: %s) called\n", pFEFile->GetFileName().c_str()); @@ -274,7 +269,6 @@ */ void CBEClient::CreateBackEndFile(CFEFile *pFEFile) - throw (CBECreateException*) { if (!pFEFile->IsIDLFile()) return; @@ -303,7 +297,7 @@ } catch (CBECreateException *e) { - m_ImplementationFiles.Remove(pImpl); + m_ImplementationFiles.Remove(pImpl); delete pImpl; throw; } @@ -320,7 +314,6 @@ void CBEClient::CreateBackEndFile(CFEFile * pFEFile, CBEImplementationFile *pImpl) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEClient::CreateBackEndFile(file: %s, impl: %s) called\n", pFEFile->GetFileName().c_str(), pImpl->GetFileName().c_str()); @@ -390,14 +383,12 @@ */ void CBEClient::CreateBackEndModule(CFEFile *pFEFile) - throw (CBECreateException*) { if (!pFEFile->IsIDLFile()) return; // do not abort creation - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, - "CBEClient::CreateBackEndModule(file: %s) called\n", - pFEFile->GetFileName().c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEClient::%s(file: %s) called\n", + __func__, pFEFile->GetFileName().c_str()); string exc = string (__func__); // find appropriate header file @@ -428,7 +419,7 @@ } catch (CBECreateException *e) { - m_ImplementationFiles.Remove(pImpl); + m_ImplementationFiles.Remove(pImpl); delete pImpl; throw; } @@ -442,7 +433,7 @@ CBEClass *pClass = pRoot->FindClass((*iterI)->GetName()); if (!pClass) { - m_ImplementationFiles.Remove(pImpl); + m_ImplementationFiles.Remove(pImpl); delete pImpl; exc += " failed because clas " + (*iterI)->GetName() + " is not created"; @@ -469,10 +460,9 @@ */ void CBEClient::CreateBackEndModule(CFELibrary *pFELibrary) - throw (CBECreateException*) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEClient::CreateBackEndModule(lib: %s) called\n", - pFELibrary->GetName().c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEClient::%s(lib: %s) called\n", + __func__, pFELibrary->GetName().c_str()); // get the root CBERoot *pRoot = GetSpecificParent(); assert(pRoot); @@ -505,16 +495,16 @@ } catch (CBECreateException *e) { - m_ImplementationFiles.Remove(pImpl); + m_ImplementationFiles.Remove(pImpl); delete pImpl; throw; } // add it to the file pBENameSpace->AddToFile(pImpl); // iterate over nested libs and call this function for them as well -// for_each(pFELibrary->m_Libraries.Begin(), -// pFELibrary->m_Libraries.End(), -// CreateBackEndModule); +// for_each(pFELibrary->m_Libraries.begin(), +// pFELibrary->m_Libraries.end(), +// mem_fun(&CBEClient::CreateBackEndModule)); vector::iterator iterL; for (iterL = pFELibrary->m_Libraries.begin(); iterL != pFELibrary->m_Libraries.end(); @@ -530,7 +520,6 @@ */ void CBEClient::CreateBackEndInterface(CFEFile *pFEFile) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEClient::CreateBackEndInterface(file: %s) called\n", pFEFile->GetFileName().c_str()); @@ -564,7 +553,6 @@ */ void CBEClient::CreateBackEndInterface(CFELibrary *pFELibrary) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEClient::CreateBackEndInterface(lib: %s) called\n", @@ -599,7 +587,6 @@ */ void CBEClient::CreateBackEndInterface(CFEInterface *pFEInterface) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEClient::CreateBackEndInterface(interface: %s) called\n", pFEInterface->GetName().c_str()); @@ -635,7 +622,7 @@ } catch (CBECreateException *e) { - m_ImplementationFiles.Remove(pImpl); + m_ImplementationFiles.Remove(pImpl); delete pImpl; throw; } @@ -649,7 +636,6 @@ */ void CBEClient::CreateBackEndFunction(CFEFile *pFEFile) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s for %s called\n", __func__, pFEFile->GetFileName().c_str()); @@ -684,7 +670,6 @@ */ void CBEClient::CreateBackEndFunction(CFELibrary *pFELibrary) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s for %s called\n", __func__, pFELibrary->GetName().c_str()); @@ -712,7 +697,6 @@ */ void CBEClient::CreateBackEndFunction(CFEInterface *pFEInterface) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s for %s called\n", __func__, pFEInterface->GetName().c_str()); diff -ruN p2/l4/tool/dice/src/be/BEClient.h p3/l4/tool/dice/src/be/BEClient.h --- p2/l4/tool/dice/src/be/BEClient.h 2006-06-14 14:24:55.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEClient.h 2006-11-30 10:41:06.000000000 +0100 @@ -58,33 +58,20 @@ virtual void Write(); protected: - virtual void CreateBackEndHeader(CFEFile * pFEFile) - throw (CBECreateException*); - virtual void CreateBackEndImplementation(CFEFile * pFEFile) - throw (CBECreateException*); - virtual void CreateBackEndFile(CFEFile *pFEFile) - throw (CBECreateException*); + virtual void CreateBackEndHeader(CFEFile * pFEFile); + virtual void CreateBackEndImplementation(CFEFile * pFEFile); + virtual void CreateBackEndFile(CFEFile *pFEFile); virtual void CreateBackEndFile(CFEFile * pFEFile, - CBEImplementationFile *pImpl) - throw (CBECreateException*); - virtual void CreateBackEndModule(CFELibrary *pFELibrary) - throw (CBECreateException*); - virtual void CreateBackEndModule(CFEFile *pFEFile) - throw (CBECreateException*); - virtual void CreateBackEndInterface(CFEFile *pFEFile) - throw (CBECreateException*); - virtual void CreateBackEndInterface(CFELibrary *pFELibrary) - throw (CBECreateException*); - virtual void CreateBackEndInterface(CFEInterface *pFEInterface) - throw (CBECreateException*); - virtual void CreateBackEndFunction(CFEFile *pFEFile) - throw (CBECreateException*); - virtual void CreateBackEndFunction(CFELibrary *pFELibrary) - throw (CBECreateException*); - virtual void CreateBackEndFunction(CFEInterface *pFEInterface) - throw (CBECreateException*); - virtual void CreateBackEndFunction(CFEOperation *pFEOperation) - throw (CBECreateException*); + CBEImplementationFile *pImpl); + virtual void CreateBackEndModule(CFELibrary *pFELibrary); + virtual void CreateBackEndModule(CFEFile *pFEFile); + virtual void CreateBackEndInterface(CFEFile *pFEFile); + virtual void CreateBackEndInterface(CFELibrary *pFELibrary); + virtual void CreateBackEndInterface(CFEInterface *pFEInterface); + virtual void CreateBackEndFunction(CFEFile *pFEFile); + virtual void CreateBackEndFunction(CFELibrary *pFELibrary); + virtual void CreateBackEndFunction(CFEInterface *pFEInterface); + virtual void CreateBackEndFunction(CFEOperation *pFEOperation); }; #endif // !__DICE_BECLIENT_H__ diff -ruN p2/l4/tool/dice/src/be/BEComponent.cpp p3/l4/tool/dice/src/be/BEComponent.cpp --- p2/l4/tool/dice/src/be/BEComponent.cpp 2006-10-10 14:46:16.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEComponent.cpp 2006-11-30 10:41:06.000000000 +0100 @@ -44,7 +44,6 @@ #include "fe/FEInterface.h" #include "fe/FEOperation.h" #include -using namespace std; CBEComponent::CBEComponent() { @@ -123,7 +122,6 @@ */ void CBEComponent::CreateBackEndHeader(CFEFile * pFEFile) - throw (CBECreateException*) { // the header files are created on a per IDL file basis, no matter // which option is set @@ -135,7 +133,7 @@ } catch (CBECreateException *e) { - m_HeaderFiles.Remove(pHeader); + m_HeaderFiles.Remove(pHeader); delete pHeader; throw; } @@ -159,7 +157,6 @@ */ void CBEComponent::CreateBackEndImplementation(CFEFile * pFEFile) - throw (CBECreateException*) { string exc = string(__func__); // find appropriate header file @@ -182,7 +179,7 @@ } catch (CBECreateException *e) { - m_ImplementationFiles.Remove(pImpl); + m_ImplementationFiles.Remove(pImpl); delete pImpl; throw; } @@ -202,7 +199,7 @@ } catch (CBECreateException *e) { - m_ImplementationFiles.Remove(pImpl); + m_ImplementationFiles.Remove(pImpl); delete pImpl; throw; } diff -ruN p2/l4/tool/dice/src/be/BEComponentFunction.cpp p3/l4/tool/dice/src/be/BEComponentFunction.cpp --- p2/l4/tool/dice/src/be/BEComponentFunction.cpp 2006-10-12 18:17:45.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEComponentFunction.cpp 2006-11-30 10:41:06.000000000 +0100 @@ -49,7 +49,6 @@ #include "fe/FEExpression.h" #include #include -using namespace std; CBEComponentFunction::CBEComponentFunction() : CBEOperationFunction(FUNCTION_TEMPLATE) @@ -83,7 +82,6 @@ */ void CBEComponentFunction::CreateBackEnd(CFEOperation * pFEOperation) - throw (CBECreateException*) { // set target file name SetTargetFileName(pFEOperation); @@ -514,7 +512,8 @@ bool CBEComponentFunction::DoWriteParameter(CBETypedDeclarator *pParam) { - DTRACE("%s(%s) called, m_nSkipParameter = %d\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s(%s) called, m_nSkipParameter = %d\n", __func__, pParam->m_Declarators.First()->GetName().c_str(), m_nSkipParameter); if ((m_nSkipParameter & 1) && pParam == GetObject()) diff -ruN p2/l4/tool/dice/src/be/BEComponentFunction.h p3/l4/tool/dice/src/be/BEComponentFunction.h --- p2/l4/tool/dice/src/be/BEComponentFunction.h 2006-10-10 14:55:35.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEComponentFunction.h 2006-11-30 10:41:06.000000000 +0100 @@ -54,8 +54,7 @@ CBEComponentFunction(CBEComponentFunction &src); public: - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); virtual bool AddToFile(CBEImplementationFile * pImpl); virtual bool IsTargetFile(CBEImplementationFile * pFile); virtual bool DoWriteFunction(CBEHeaderFile* pFile); diff -ruN p2/l4/tool/dice/src/be/BEComponent.h p3/l4/tool/dice/src/be/BEComponent.h --- p2/l4/tool/dice/src/be/BEComponent.h 2006-06-14 14:24:55.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEComponent.h 2006-11-30 10:41:06.000000000 +0100 @@ -61,10 +61,8 @@ protected: virtual bool NeedServerLoop(CFEInterface *pFEInterface); - virtual void CreateBackEndHeader(CFEFile * pFEFile) - throw (CBECreateException*); - virtual void CreateBackEndImplementation(CFEFile * pFEFile) - throw (CBECreateException*); + virtual void CreateBackEndHeader(CFEFile * pFEFile); + virtual void CreateBackEndImplementation(CFEFile * pFEFile); }; #endif // !__DICE_BECOMPONENT_H__ diff -ruN p2/l4/tool/dice/src/be/BEConstant.cpp p3/l4/tool/dice/src/be/BEConstant.cpp --- p2/l4/tool/dice/src/be/BEConstant.cpp 2006-08-23 19:27:56.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEConstant.cpp 2006-11-30 10:41:06.000000000 +0100 @@ -71,7 +71,6 @@ */ void CBEConstant::CreateBackEnd(CFEConstDeclarator * pFEConstDeclarator) - throw (CBECreateException*) { // call CBEObject's CreateBackEnd method CBEObject::CreateBackEnd(pFEConstDeclarator); @@ -130,7 +129,6 @@ string sName, CBEExpression * pValue, bool bAlwaysDefine) - throw (CBECreateException*) { string exc = string(__func__); diff -ruN p2/l4/tool/dice/src/be/BEConstant.h p3/l4/tool/dice/src/be/BEConstant.h --- p2/l4/tool/dice/src/be/BEConstant.h 2006-08-21 16:46:35.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEConstant.h 2006-11-30 10:41:07.000000000 +0100 @@ -62,10 +62,8 @@ public: virtual void Write(CBEHeaderFile *pFile); virtual void CreateBackEnd(CBEType* pType, string sName, - CBEExpression* pValue, bool bAlwaysDefine) - throw (CBECreateException*); - virtual void CreateBackEnd(CFEConstDeclarator *pFEConstDeclarator) - throw (CBECreateException*); + CBEExpression* pValue, bool bAlwaysDefine); + virtual void CreateBackEnd(CFEConstDeclarator *pFEConstDeclarator); virtual bool AddToFile(CBEHeaderFile *pHeader); virtual string GetName(); virtual CBEExpression *GetValue(); diff -ruN p2/l4/tool/dice/src/be/BECreateException.cpp p3/l4/tool/dice/src/be/BECreateException.cpp --- p2/l4/tool/dice/src/be/BECreateException.cpp 2006-06-14 14:24:55.000000000 +0200 +++ p3/l4/tool/dice/src/be/BECreateException.cpp 2006-11-30 10:41:07.000000000 +0100 @@ -28,7 +28,6 @@ #include "BECreateException.h" #include -using namespace std; CBECreateException::CBECreateException() { @@ -54,6 +53,6 @@ void CBECreateException::Print() { - cerr << "Creation failed, because " << m_sReason << endl; + std::cerr << "Creation failed, because " << m_sReason << std::endl; } diff -ruN p2/l4/tool/dice/src/be/BEDeclarator.cpp p3/l4/tool/dice/src/be/BEDeclarator.cpp --- p2/l4/tool/dice/src/be/BEDeclarator.cpp 2006-10-16 11:38:48.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEDeclarator.cpp 2006-11-30 10:41:07.000000000 +0100 @@ -48,7 +48,6 @@ #include "fe/FEBinaryExpression.h" #include #include -using namespace std; /** \brief writes the declarator stack to a file * \param pFile the file to write to @@ -88,8 +87,9 @@ int nStars = pDecl->GetStars(); // test for empty array dimensions, which are treated as // stars - DTRACE("%s for %s with %d stars (1)\n", __func__, - pDecl->GetName().c_str(), nStars); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CDeclaratorStackLocation::%s for %s with %d stars (1)\n", + __func__, pDecl->GetName().c_str(), nStars); if (pDecl->GetArrayDimensionCount()) { int nLevel = 0; @@ -105,8 +105,9 @@ } } } - DTRACE("%s for %s with %d stars (2)\n", __func__, - pDecl->GetName().c_str(), nStars); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CDeclaratorStackLocation::%s for %s with %d stars (2)\n", + __func__, pDecl->GetName().c_str(), nStars); if ((iter + 1) == pStack->end()) { // only apply to last element in row @@ -121,8 +122,9 @@ nStars--; } } - DTRACE("%s for %s with %d stars (3)\n", __func__, - pDecl->GetName().c_str(), nStars); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CDeclaratorStackLocation::%s for %s with %d stars (3)\n", + __func__, pDecl->GetName().c_str(), nStars); if (pFunction && ((*iter)->nIndex[0] != -3)) { // this only works if the declarator really belongs to the @@ -135,8 +137,9 @@ pTrueParameter->m_Declarators.First())) nStars++; } - DTRACE("%s for %s with %d stars func at %p (4)\n", __func__, - pDecl->GetName().c_str(), nStars, pFunction); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CDeclaratorStackLocation::%s for %s with %d stars func at %p (4)\n", + __func__, pDecl->GetName().c_str(), nStars, pFunction); // check if the type is a pointer type if (pFunction) { @@ -150,7 +153,8 @@ pParameter->m_Attributes.Find(ATTR_TRANSMIT_AS) : 0; if (pAttr) pType = pAttr->GetAttrType(); - DTRACE("%s for %s: pType %p, pointer? %s, string: %s\n", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CDeclaratorStackLocation::%s for %s: pType %p, pointer? %s, string: %s\n", __func__, pDecl->GetName().c_str(), pType, pType ? (pType->IsPointerType() ? "yes" : "no") : "(no type)", pParameter ? (pParameter->IsString() ? "yes" : "no") : @@ -159,7 +163,8 @@ if (pType && pType->IsPointerType()) nStars++; } - DTRACE("%s for %s with %d stars (5)\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CDeclaratorStackLocation::%s for %s with %d stars (5)\n", __func__, pDecl->GetName().c_str(), nStars); if (nStars > 0) sResult += "("; @@ -229,12 +234,12 @@ */ void CBEDeclarator::CreateBackEnd(CFEDeclarator * pFEDeclarator) - throw (CBECreateException*) { // call CBEObject's CreateBackEnd method CBEObject::CreateBackEnd(pFEDeclarator); - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEDeclarator::%s called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEDeclarator::%s called\n", + __func__); m_sName = pFEDeclarator->GetName(); m_nBitfields = pFEDeclarator->GetBitfields(); @@ -250,7 +255,8 @@ break; } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEDeclarator::%s done\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEDeclarator::%s done\n", + __func__); } /** \brief create a simple declarator using name and number of stars @@ -261,15 +267,15 @@ void CBEDeclarator::CreateBackEnd(string sName, int nStars) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEDeclarator::%s(string: %s)\n", __func__, - sName.c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEDeclarator::%s(string: %s)\n", __func__, sName.c_str()); m_sName = sName; m_nStars = nStars; - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEDeclarator::%s(string) done\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEDeclarator::%s(string) done\n", __func__); } /** \brief creates the back-end representation for the enum declarator @@ -278,9 +284,9 @@ */ void CBEDeclarator::CreateBackEndEnum(CFEEnumDeclarator * pFEEnumDeclarator) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEDeclarator::%s(enum)\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEDeclarator::%s(enum)\n", + __func__); if (pFEEnumDeclarator->GetInitialValue()) { @@ -299,7 +305,8 @@ } } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEDeclarator::%s(enum) done\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEDeclarator::%s(enum) done\n", __func__); } /** \brief creates the back-end representation for the array declarator @@ -308,9 +315,9 @@ */ void CBEDeclarator::CreateBackEndArray(CFEArrayDeclarator * pFEArrayDeclarator) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEDeclarator::%s(array)\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEDeclarator::%s(array)\n", + __func__); // iterate over front-end bounds int nMax = pFEArrayDeclarator->GetDimensionCount(); for (int i = 0; i < nMax; i++) @@ -320,7 +327,8 @@ CBEExpression *pBound = GetArrayDimension(pLower, pUpper); AddArrayBound(pBound); } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEDeclarator::%s(array) done\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEDeclarator::%s(array) done\n", __func__); } /** \brief writes the declarator to the target file @@ -332,12 +340,14 @@ void CBEDeclarator::WriteDeclaration(CBEFile * pFile) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEDeclarator::%s called for %s\n", __func__, + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEDeclarator::%s called for %s\n", __func__, m_sName.c_str()); if (m_nType == DECL_ENUM) { WriteEnum(pFile); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEDeclarator::%s returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEDeclarator::%s returns\n", __func__); return; } // write stars @@ -352,7 +362,8 @@ if (IsArray()) WriteArray(pFile); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEDeclarator::%s returned\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEDeclarator::%s returned\n", + __func__); } /** \brief writes an array declarator @@ -511,8 +522,6 @@ void CBEDeclarator::RemoveArrayBound(CBEExpression *pBound) { - if (!pBound) - return; m_Bounds.Remove(pBound); if (m_Bounds.empty()) m_nType = m_nOldType; @@ -572,7 +581,8 @@ */ int CBEDeclarator::GetMaxSize() { - DTRACE("%s called for %s\n", __func__, GetName().c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called for %s\n", __func__, + GetName().c_str()); int nStars = m_nStars; // deduct from stars one if this is an out reference @@ -580,8 +590,8 @@ if (pParameter && pParameter->m_Attributes.Find(ATTR_OUT)) nStars--; - DTRACE("%s stars %d array? %s\n", __func__, nStars, - IsArray() ? "yes" : "no"); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s stars %d array? %s\n", __func__, + nStars, IsArray() ? "yes" : "no"); if (!IsArray()) { @@ -610,7 +620,7 @@ int nSize = 1; int nFakeStars = 0; - DTRACE("%s check array bounds\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s check array bounds\n", __func__); vector::iterator iterB; for (iterB = m_Bounds.begin(); @@ -626,7 +636,8 @@ if (nFakeStars > 0) nSize = -(nFakeStars + nStars); - DTRACE("%s return %d\n", __func__, nSize); + + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s return %d\n", __func__, nSize); return nSize; } @@ -691,7 +702,8 @@ // (m_nStars:2 nFakeStars:0 bUsePointer:true -> nStartStars:2 nFakeStars:1) if (bUsePointer && (nFakeStars == 0) && (m_nStars > 0)) nFakeStars++; - DTRACE("%s: for %s, nFakeStars: %d, nStartStars: %d\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s: for %s, nFakeStars: %d, nStartStars: %d\n", __func__, m_sName.c_str(), nFakeStars, nStartStars); bool bComma = false; for (int nStars = nStartStars; nStars >= nFakeStars; nStars--) @@ -720,7 +732,7 @@ // write bitfields // if (m_nBitfields > 0) - // pFile->Print(":%d", m_nBitfields); + // *pFile << ":" << m_nBitfields; } /** \brief assigns pointered variables a reference to "unpointered" variables @@ -783,14 +795,18 @@ CBETypedDeclarator *pParameter = pFunction->FindParameter(m_sName); assert(pParameter); // skip the memory allocation if not preallocated - if (!pParameter->m_Attributes.Find(ATTR_PREALLOC)) + if (pFile->IsOfFileType(FILETYPE_CLIENT) && + !pParameter->m_Attributes.Find(ATTR_PREALLOC_CLIENT)) + return; + if (pFile->IsOfFileType(FILETYPE_COMPONENT) && + !pParameter->m_Attributes.Find(ATTR_PREALLOC_SERVER)) return; int nFakeStars = GetEmptyArrayDims(); - int nTypeStars = pParameter->GetType()->GetIndirectionCount(); + int nTypeStars = pParameter->GetTransmitType()->GetIndirectionCount(); int nStartStars = m_nStars + nTypeStars + nFakeStars; if (bUsePointer && (m_nStars > 0) && (nFakeStars == 0)) - nFakeStars++; + nFakeStars = 1; /** now we have to initialize the fake stars (unbound array dimensions). * problem is to use an allocation routine appropriate for this. If there is * an max_is or upper bound it is used, but we have no upper bound. @@ -833,6 +849,7 @@ if (pD) pSizeParam = pFunction->FindParameter(pD->GetName()); } + string sAppend; if (pSizeParam && pSizeParam->m_Attributes.Find(ATTR_IN)) { pParameter->WriteGetSize(pFile, &vStack, pFunction); @@ -841,6 +858,7 @@ { *pFile << "*sizeof"; pType->WriteCast(pFile, false); + sAppend = " /* allocated for unbound array dimensions */"; } } else @@ -848,12 +866,18 @@ int nSize = 0; pAttr = pParameter->m_Attributes.Find(ATTR_MAX_IS); if (pAttr && pAttr->IsOfType(ATTR_CLASS_INT)) + { nSize = pAttr->GetIntValue(); + sAppend = " /* allocated using max_is attribute */"; + } else + { pParameter->GetMaxSize(true, nSize); + sAppend = " /* allocated using max size of type */"; + } *pFile << nSize; } - *pFile << "); /* allocated for unbound array dimensions */\n"; + *pFile << ");" << sAppend << "\n"; delete pLoc; } } @@ -872,12 +896,21 @@ CBETypedDeclarator *pParameter = pFunction->FindParameter(m_sName); assert(pParameter); // skip the memory allocation if not preallocated - if (!pParameter->m_Attributes.Find(ATTR_PREALLOC) && !bDeferred) + if (!pParameter->m_Attributes.Find(ATTR_PREALLOC_CLIENT) && + !pParameter->m_Attributes.Find(ATTR_PREALLOC_SERVER) && + !bDeferred) return; + if (pFile->IsOfFileType(FILETYPE_CLIENT) && + !pParameter->m_Attributes.Find(ATTR_PREALLOC_CLIENT)) + return; + if (pFile->IsOfFileType(FILETYPE_COMPONENT) && + !pParameter->m_Attributes.Find(ATTR_PREALLOC_SERVER)) + return; + CBETypedDeclarator *pEnv = pFunction->GetEnvironment(); CBEDeclarator *pDecl = pEnv->m_Declarators.First(); if (!pDecl && bDeferred) - return; + return; /* return here, so nothing is written */ // calculate stars int nFakeStars = GetEmptyArrayDims(); int nTypeStars = pParameter->GetType()->GetIndirectionCount(); @@ -915,8 +948,9 @@ */ bool CBEDeclarator::IsArray() { - DTRACE("Test if %s is array (%s)\n", m_sName.c_str(), - (m_nType == DECL_ARRAY)?"yes":"no"); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEDeclarator::%s Test if %s is array (%s)\n", __func__, + m_sName.c_str(), (m_nType == DECL_ARRAY) ? "yes" : "no"); return (m_nType == DECL_ARRAY); } diff -ruN p2/l4/tool/dice/src/be/BEDeclarator.h p3/l4/tool/dice/src/be/BEDeclarator.h --- p2/l4/tool/dice/src/be/BEDeclarator.h 2006-10-12 18:17:45.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEDeclarator.h 2006-11-30 10:41:07.000000000 +0100 @@ -34,7 +34,6 @@ #include "template.h" #include #include -using namespace std; class CFEDeclarator; class CFEArrayDeclarator; @@ -50,7 +49,7 @@ * might have and thus how many indices may be available for * a declarators. */ -#define MAX_INDEX_NUMBER 10 +const int MAX_INDEX_NUMBER = 10; /** \class CDeclaratorStackLocation * \brief class to represent a stack location for the declarator stack @@ -177,14 +176,15 @@ }; /** \def DUMP_STACK(iter, stack, str) - * \brief dumps the declarator stack using the \a DTRACE macro + * \brief dumps the declarator stack */ #define DUMP_STACK(iter, stack, str) \ - DTRACE("%s stack is:\n", str); \ + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s stack is:\n", str); \ vector::iterator iter = stack->begin(); \ for (; iter != stack->end(); iter++) \ - DTRACE("%s\n", (*iter)->pDeclarator->GetName().c_str()); \ - DTRACE("--end--\n"); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s\n", \ + (*iter)->pDeclarator->GetName().c_str()); \ + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "--end--\n"); /** \class CBEDeclarator * \ingroup backend @@ -221,10 +221,8 @@ virtual void WriteIndirect(CBEFile * pFile, bool bUsePointer, bool bHasPointerType); virtual void WriteDeclaration(CBEFile * pFile); - virtual void CreateBackEnd(string sName, int nStars) - throw (CBECreateException*); - virtual void CreateBackEnd(CFEDeclarator * pFEDeclarator) - throw (CBECreateException*); + virtual void CreateBackEnd(string sName, int nStars); + virtual void CreateBackEnd(CFEDeclarator * pFEDeclarator); virtual int GetSize(); @@ -282,10 +280,8 @@ protected: virtual int GetEmptyArrayDims(); - virtual void CreateBackEndArray(CFEArrayDeclarator * pFEArrayDeclarator) - throw (CBECreateException*); - virtual void CreateBackEndEnum(CFEEnumDeclarator * pFEEnumDeclarator) - throw (CBECreateException*); + virtual void CreateBackEndArray(CFEArrayDeclarator * pFEArrayDeclarator); + virtual void CreateBackEndEnum(CFEEnumDeclarator * pFEEnumDeclarator); virtual CBEExpression *GetArrayDimension(CFEExpression * pLower, CFEExpression * pUpper); virtual void WriteArray(CBEFile * pFile); diff -ruN p2/l4/tool/dice/src/be/BEDispatchFunction.cpp p3/l4/tool/dice/src/be/BEDispatchFunction.cpp --- p2/l4/tool/dice/src/be/BEDispatchFunction.cpp 2006-10-10 14:46:16.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEDispatchFunction.cpp 2006-11-30 10:41:07.000000000 +0100 @@ -44,7 +44,6 @@ #include "fe/FEStringAttribute.h" #include "fe/FEOperation.h" #include -using namespace std; CBEDispatchFunction::CBEDispatchFunction() : CBEInterfaceFunction(FUNCTION_DISPATCH), @@ -88,7 +87,6 @@ */ void CBEDispatchFunction::CreateBackEnd(CFEInterface * pFEInterface) - throw (CBECreateException*) { // set target file name SetTargetFileName(pFEInterface); @@ -210,7 +208,7 @@ e->Print(); delete e; - m_SwitchCases.Remove(pFunction); + m_SwitchCases.Remove(pFunction); delete pFunction; return false; } diff -ruN p2/l4/tool/dice/src/be/BEDispatchFunction.h p3/l4/tool/dice/src/be/BEDispatchFunction.h --- p2/l4/tool/dice/src/be/BEDispatchFunction.h 2006-08-21 16:46:36.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEDispatchFunction.h 2006-11-30 10:41:07.000000000 +0100 @@ -33,7 +33,6 @@ #include #include "template.h" #include -using namespace std; class CBESwitchCase; @@ -59,8 +58,7 @@ public: virtual bool DoWriteFunction(CBEHeaderFile* pFile); virtual bool DoWriteFunction(CBEImplementationFile* pFile); - virtual void CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEInterface *pFEInterface); protected: virtual void WriteVariableInitialization(CBEFile *pFile); diff -ruN p2/l4/tool/dice/src/be/BEEnumType.cpp p3/l4/tool/dice/src/be/BEEnumType.cpp --- p2/l4/tool/dice/src/be/BEEnumType.cpp 2006-10-10 14:46:16.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEEnumType.cpp 2006-11-30 10:41:07.000000000 +0100 @@ -34,7 +34,6 @@ #include "fe/FEEnumType.h" #include "fe/FEIdentifier.h" #include -using namespace std; CBEEnumType::CBEEnumType() { @@ -64,12 +63,10 @@ */ void CBEEnumType::RemoveMember(string sMember) { - vector::iterator iter; - for (iter = m_vMembers.begin(); iter != m_vMembers.end(); iter++) - { - if (*iter == sMember) - m_vMembers.erase(iter); - } + vector::iterator iter = std::find(m_vMembers.begin(), + m_vMembers.end(), sMember); + if (iter != m_vMembers.end()) + m_vMembers.erase(iter); } /** \brief accesses a member at the given position @@ -97,9 +94,9 @@ */ void CBEEnumType::CreateBackEnd(CFETypeSpec *pFEType) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEEnumType::%s(fe) called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEEnumType::%s(fe) called\n", + __func__); CBEType::CreateBackEnd(pFEType); @@ -115,7 +112,8 @@ // check tagged m_sTag = pFEEnumType->GetTag(); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEEnumType::%s(fe) returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEEnumType::%s(fe) returns\n", + __func__); } /** \brief writes the enum type to the target file diff -ruN p2/l4/tool/dice/src/be/BEEnumType.h p3/l4/tool/dice/src/be/BEEnumType.h --- p2/l4/tool/dice/src/be/BEEnumType.h 2006-06-14 14:24:55.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEEnumType.h 2006-11-30 10:41:07.000000000 +0100 @@ -34,7 +34,6 @@ #include #include #include -using namespace std; /** \class CBEEnumType * \ingroup backend @@ -52,8 +51,7 @@ virtual string GetMemberAt(unsigned int nIndex); virtual void RemoveMember(string sMember); virtual void AddMember(string sMember); - virtual void CreateBackEnd(CFETypeSpec *pFEType) - throw (CBECreateException*); + virtual void CreateBackEnd(CFETypeSpec *pFEType); virtual void WriteZeroInit(CBEFile * pFile); virtual void Write(CBEFile * pFile); virtual void WriteCast(CBEFile* pFile, bool bPointer); diff -ruN p2/l4/tool/dice/src/be/BEException.cpp p3/l4/tool/dice/src/be/BEException.cpp --- p2/l4/tool/dice/src/be/BEException.cpp 2006-06-14 14:24:55.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEException.cpp 2006-11-30 10:41:07.000000000 +0100 @@ -52,7 +52,6 @@ */ void CBEException::CreateBackEnd(CFEIdentifier * pFEException) - throw (CBECreateException*) { // call CBEObject's CreateBackEnd method CBEObject::CreateBackEnd(pFEException); diff -ruN p2/l4/tool/dice/src/be/BEException.h p3/l4/tool/dice/src/be/BEException.h --- p2/l4/tool/dice/src/be/BEException.h 2006-06-14 14:24:55.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEException.h 2006-11-30 10:41:07.000000000 +0100 @@ -54,8 +54,7 @@ CBEException(CBEException &src); public: - virtual void CreateBackEnd(CFEIdentifier *pFEException) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEIdentifier *pFEException); protected: /** \var string m_sName diff -ruN p2/l4/tool/dice/src/be/BEExpression.cpp p3/l4/tool/dice/src/be/BEExpression.cpp --- p2/l4/tool/dice/src/be/BEExpression.cpp 2006-08-21 16:46:36.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEExpression.cpp 2006-11-30 10:41:07.000000000 +0100 @@ -44,9 +44,9 @@ #include "fe/FETypeSpec.h" #include "fe/FEInterface.h" #include "fe/FELibrary.h" +#include "Error.h" #include #include -using namespace std; CBEExpression::CBEExpression() { @@ -96,7 +96,6 @@ */ void CBEExpression::CreateBackEnd(CFEExpression * pFEExpression) - throw (CBECreateException*) { // call CBEObject's CreateBackEnd method CBEObject::CreateBackEnd(pFEExpression); @@ -179,7 +178,6 @@ void CBEExpression::CreateBackEndConditional( CFEConditionalExpression *pFEExpression) - throw (CBECreateException*) { string exc = string(__func__); @@ -209,7 +207,6 @@ */ void CBEExpression::CreateBackEndBinary(CFEBinaryExpression * pFEExpression) - throw (CBECreateException*) { string exc = string(__func__); @@ -239,7 +236,6 @@ */ void CBEExpression::CreateBackEndUnary(CFEUnaryExpression * pFEExpression) - throw (CBECreateException*) { m_nOperator = pFEExpression->GetOperator(); CreateBackEndPrimary(pFEExpression); @@ -253,7 +249,6 @@ void CBEExpression::CreateBackEndUnary(int nOperator, CBEExpression *pOperand) - throw (CBECreateException*) { m_nOperator = nOperator; m_pOperand1 = pOperand; @@ -268,7 +263,6 @@ */ void CBEExpression::CreateBackEndPrimary(CFEPrimaryExpression * pFEExpression) - throw (CBECreateException*) { CFEExpression *pFEOperand = pFEExpression->GetOperand(); if (!pFEOperand) @@ -299,7 +293,6 @@ */ void CBEExpression::CreateBackEndPrimary(int nType, CBEExpression *pExpression) - throw (CBECreateException*) { m_nType = nType; switch (m_nType) @@ -342,7 +335,6 @@ */ void CBEExpression::CreateBackEndSizeOf(CFESizeOfExpression *pFEExpression) - throw (CBECreateException*) { // can be type CBEClassFactory *pCF = CCompiler::GetClassFactory(); @@ -537,7 +529,7 @@ sStr += " || "; break; default: - throw new invalid_operator(); + throw new error::invalid_operator(); break; } // write second operand @@ -564,7 +556,7 @@ sStr += "!"; break; default: - throw new invalid_operator(); + throw new error::invalid_operator(); break; } // write operand @@ -577,7 +569,6 @@ */ void CBEExpression::CreateBackEnd(int nValue) - throw (CBECreateException*) { m_nType = EXPR_INT; m_nIntValue = nValue; @@ -589,7 +580,6 @@ */ void CBEExpression::CreateBackEnd(string sValue) - throw (CBECreateException*) { m_nType = EXPR_USER_DEFINED; m_sStringValue = sValue; @@ -605,7 +595,6 @@ CBEExpression::CreateBackEndBinary(CBEExpression * pOperand1, int nOperator, CBEExpression * pOperand2) - throw (CBECreateException*) { m_pOperand1 = pOperand1; m_nOperator = nOperator; @@ -757,7 +746,7 @@ nValue = (int) (nValue1 || nValue2); break; default: - throw new invalid_operator(); + throw new error::invalid_operator(); break; } @@ -786,7 +775,7 @@ nValue = !nValue; break; default: - throw new invalid_operator(); + throw new error::invalid_operator(); break; } @@ -801,7 +790,7 @@ { string value; - DTRACE("type : %d\n", m_nType); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "type : %d\n", m_nType); switch (m_nType) { case EXPR_NONE: @@ -937,7 +926,7 @@ value = value1 + string(" || ") + value2; break; default: - throw new invalid_operator(); + throw new error::invalid_operator(); break; } @@ -966,7 +955,7 @@ value = string("!") + value; break; default: - throw new invalid_operator(); + throw new error::invalid_operator(); break; } @@ -1091,7 +1080,7 @@ bValue = bValue1 || bValue2; break; default: - throw new invalid_operator(); + throw new error::invalid_operator(); break; } @@ -1124,7 +1113,7 @@ bValue = !bValue; break; default: - throw new invalid_operator(); + throw new error::invalid_operator(); break; } diff -ruN p2/l4/tool/dice/src/be/BEExpression.h p3/l4/tool/dice/src/be/BEExpression.h --- p2/l4/tool/dice/src/be/BEExpression.h 2006-08-04 18:17:17.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEExpression.h 2006-11-30 10:41:07.000000000 +0100 @@ -70,42 +70,19 @@ virtual void WriteToStr(string &sStr); virtual void CreateBackEndBinary(CBEExpression *pOperand1, int nOperator, - CBEExpression *pOperand2) - throw (CBECreateException*); - virtual void CreateBackEnd(string sValue) - throw (CBECreateException*); - virtual void CreateBackEnd(int nValue) - throw (CBECreateException*); - virtual void CreateBackEnd(CFEExpression *pFEExpression) - throw (CBECreateException*); - virtual void CreateBackEndUnary(int nOperator, CBEExpression *pOperand) - throw (CBECreateException*); - virtual void CreateBackEndPrimary(int nType, CBEExpression *pExpression) - throw (CBECreateException*); - - /** \class invalid_operator - * \ingroup backend - * \brief exception class for usage of invalid operators - */ - class invalid_operator : public exception { - public: - /** \brief the constructor of the invalid_operator exception - */ - explicit invalid_operator(void) {} - }; + CBEExpression *pOperand2); + virtual void CreateBackEnd(string sValue); + virtual void CreateBackEnd(int nValue); + virtual void CreateBackEnd(CFEExpression *pFEExpression); + virtual void CreateBackEndUnary(int nOperator, CBEExpression *pOperand); + virtual void CreateBackEndPrimary(int nType, CBEExpression *pExpression); protected: - virtual void CreateBackEndUnary(CFEUnaryExpression *pFEExpression) - throw (CBECreateException*); - virtual void CreateBackEndPrimary(CFEPrimaryExpression *pFEExpression) - throw (CBECreateException*); - virtual void CreateBackEndBinary(CFEBinaryExpression *pFEExpression) - throw (CBECreateException*); - virtual void CreateBackEndConditional( - CFEConditionalExpression *pFEExpression) - throw (CBECreateException*); - virtual void CreateBackEndSizeOf(CFESizeOfExpression *pFEExpression) - throw (CBECreateException*); + virtual void CreateBackEndUnary(CFEUnaryExpression *pFEExpression); + virtual void CreateBackEndPrimary(CFEPrimaryExpression *pFEExpression); + virtual void CreateBackEndBinary(CFEBinaryExpression *pFEExpression); + virtual void CreateBackEndConditional(CFEConditionalExpression *pFEExpression); + virtual void CreateBackEndSizeOf(CFESizeOfExpression *pFEExpression); virtual void WriteUnaryToStr(string &sStr); virtual void WriteBinaryToStr(string &sStr); diff -ruN p2/l4/tool/dice/src/be/BEFile.cpp p3/l4/tool/dice/src/be/BEFile.cpp --- p2/l4/tool/dice/src/be/BEFile.cpp 2006-10-10 14:46:16.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEFile.cpp 2006-11-30 10:41:07.000000000 +0100 @@ -34,6 +34,9 @@ #include "BETarget.h" #include "BEFunction.h" #include "BEContext.h" +#include "BEConstant.h" +#include "BEType.h" +#include "BETypedef.h" #include "IncludeStatement.h" #include "Compiler.h" #include "fe/FEOperation.h" @@ -207,21 +210,21 @@ if (!sFileName.empty()) { if (pInclude->m_bStandard) - Print("#include <"); + m_file << "#include <"; else - Print("#include \""); + m_file << "#include \""; if (!pInclude->m_bIDLFile || sPrefix.empty()) { - Print("%s", sFileName.c_str()); + m_file << sFileName; } else // bIDLFile && !sPrefix.empty()() { - Print("%s/%s", sPrefix.c_str(), sFileName.c_str()); + m_file << sPrefix << "/" << sFileName; } if (pInclude->m_bStandard) - Print(">\n"); + m_file << ">\n"; else - Print("\"\n"); + m_file << "\"\n"; } } @@ -357,20 +360,21 @@ */ void CBEFile::WriteIntro() { - Print("/*\n"); - Print(" * This file is auto generated by Dice-%s", dice_version); + m_file << + "/*\n" << + " * This file is auto generated by Dice-" << dice_version; if (m_nFileType == FILETYPE_TEMPLATE) { - Print(".\n"); - Print(" *\n"); - Print(" * Implement the server templates here.\n"); - Print(" * This file is regenerated with every run of 'dice -t ...'.\n"); - Print(" * Move it to another location after changing to\n"); - Print(" * keep your changes!\n"); + m_file << ".\n" << + " *\n" << + " * Implement the server templates here.\n" << + " * This file is regenerated with every run of 'dice -t ...'.\n" << + " * Move it to another location after changing to\n" << + " * keep your changes!\n"; } else - Print(", DO NOT EDIT!\n"); - Print(" */\n\n"); + m_file << ", DO NOT EDIT!\n"; + m_file << " */\n\n"; } /** \brief creates a list of ordered elements @@ -382,8 +386,7 @@ void CBEFile::CreateOrderedElementList(void) { // clear vector - m_vOrderedElements.erase(m_vOrderedElements.begin(), - m_vOrderedElements.end()); + m_vOrderedElements.clear(); // Includes vector::iterator iterI; for (iterI = m_IncludedFiles.begin(); @@ -433,18 +436,12 @@ { if ((*iter)->GetSourceLine() > nLine) { -// TRACE("Insert element from %s:%d before element from %s:%d\n", -// pObj->GetSourceFileName().c_str(), pObj->GetSourceLine(), -// (*iter)->GetSourceFileName().c_str(), -// (*iter)->GetSourceLine()); // insert before that element m_vOrderedElements.insert(iter, pObj); return; } } // new object is bigger that all existing -// TRACE("Insert element from %s:%d at end\n", -// pObj->GetSourceFileName().c_str(), pObj->GetSourceLine()); m_vOrderedElements.push_back(pObj); } @@ -469,7 +466,7 @@ { int sLine = (*iterI)->GetSourceLine(); int eLine = (*iterI)->GetSourceLineEnd(); - m_nSourceLineNbEnd = max(sLine, max(eLine, m_nSourceLineNbEnd)); + m_nSourceLineNbEnd = std::max(sLine, std::max(eLine, m_nSourceLineNbEnd)); } // namespaces vector::iterator iterN; @@ -479,7 +476,7 @@ { int sLine = (*iterN)->GetSourceLine(); int eLine = (*iterN)->GetSourceLineEnd(); - m_nSourceLineNbEnd = max(sLine, max(eLine, m_nSourceLineNbEnd)); + m_nSourceLineNbEnd = std::max(sLine, std::max(eLine, m_nSourceLineNbEnd)); } // classes vector::iterator iterC; @@ -489,7 +486,7 @@ { int sLine = (*iterC)->GetSourceLine(); int eLine = (*iterC)->GetSourceLineEnd(); - m_nSourceLineNbEnd = max(sLine, max(eLine, m_nSourceLineNbEnd)); + m_nSourceLineNbEnd = std::max(sLine, std::max(eLine, m_nSourceLineNbEnd)); } // functions vector::iterator iterF; @@ -499,7 +496,7 @@ { int sLine = (*iterF)->GetSourceLine(); int eLine = (*iterF)->GetSourceLineEnd(); - m_nSourceLineNbEnd = max(sLine, max(eLine, m_nSourceLineNbEnd)); + m_nSourceLineNbEnd = std::max(sLine, std::max(eLine, m_nSourceLineNbEnd)); } return m_nSourceLineNbEnd; diff -ruN p2/l4/tool/dice/src/be/BEFile.h p3/l4/tool/dice/src/be/BEFile.h --- p2/l4/tool/dice/src/be/BEFile.h 2006-08-21 16:46:36.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEFile.h 2006-11-30 10:41:07.000000000 +0100 @@ -34,7 +34,6 @@ #include "BEContext.h" // for FILE_TYPE #include "template.h" #include -using namespace std; class CBEFunction; class CBETarget; @@ -80,26 +79,22 @@ * \param pFEOperation the operation to use as source * \param nFileType the type of the file */ - virtual void CreateBackEnd(CFEOperation *pFEOperation, FILE_TYPE nFileType) - throw (CBECreateException*) = 0; + virtual void CreateBackEnd(CFEOperation *pFEOperation, FILE_TYPE nFileType) = 0; /** \brief creating class * \param pFEInterface the interface to use as source * \param nFileType the type of the file */ - virtual void CreateBackEnd(CFEInterface *pFEInterface, FILE_TYPE nFileType) - throw (CBECreateException*) = 0; + virtual void CreateBackEnd(CFEInterface *pFEInterface, FILE_TYPE nFileType) = 0; /** \brief creating class * \param pFELibrary the library to use as source * \param nFileType the type of the file */ - virtual void CreateBackEnd(CFELibrary *pFELibrary, FILE_TYPE nFileType) - throw (CBECreateException*) = 0; + virtual void CreateBackEnd(CFELibrary *pFELibrary, FILE_TYPE nFileType) = 0; /** \brief creating class * \param pFEFile the file to use as source * \param nFileType the type of the file */ - virtual void CreateBackEnd(CFEFile *pFEFile, FILE_TYPE nFileType) - throw (CBECreateException*) = 0; + virtual void CreateBackEnd(CFEFile *pFEFile, FILE_TYPE nFileType) = 0; virtual CBEFunction* FindFunction(string sFunctionName, FUNCTION_TYPE nFunctionType); diff -ruN p2/l4/tool/dice/src/be/BEFunction.cpp p3/l4/tool/dice/src/be/BEFunction.cpp --- p2/l4/tool/dice/src/be/BEFunction.cpp 2006-10-10 16:59:58.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEFunction.cpp 2006-11-30 10:41:07.000000000 +0100 @@ -54,7 +54,6 @@ #include "fe/FETypeSpec.h" #include "Compiler.h" #include -using namespace std; CBEFunction::CBEFunction(FUNCTION_TYPE nFunctionType) : m_Attributes(0, this), @@ -339,7 +338,8 @@ pFile->DecIndent(); *pFile << "\t}\n\n"; - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s returns\n", + __func__); } /** \brief writes the return type of a function @@ -367,7 +367,8 @@ */ bool CBEFunction::WriteParameterList(CBEFile * pFile) { - DTRACE("%s called for %s\n", __func__, GetName().c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called for %s\n", __func__, + GetName().c_str()); int nDiffIndent = m_nParameterIndent - pFile->GetIndent(); pFile->IncIndent(nDiffIndent); // remember if we wrote something @@ -430,8 +431,9 @@ */ void CBEFunction::WriteBody(CBEFile * pFile) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s(%s) in %s called\n", - __func__, pFile->GetFileName().c_str(), GetName().c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEFunction::%s(%s) in %s called\n", __func__, + pFile->GetFileName().c_str(), GetName().c_str()); // variable declaration and initialization WriteVariableDeclaration(pFile); @@ -446,7 +448,8 @@ WriteCleanup(pFile); WriteReturn(pFile); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s returns\n", + __func__); } /** \brief writes the declaration of the variables @@ -477,8 +480,8 @@ void CBEFunction::WriteMarshalling(CBEFile * pFile) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s(%s) called\n", __func__, - GetName().c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s(%s) called\n", + __func__, GetName().c_str()); assert(m_pTrace); bool bLocalTrace = false; @@ -497,8 +500,8 @@ m_bTraceOn = false; } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s(%s) finished\n", __func__, - GetName().c_str()); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEFunction::%s(%s) finished\n", __func__, GetName().c_str()); } /** \brief writes the clean up of the function @@ -521,15 +524,15 @@ */ void CBEFunction::WriteReturn(CBEFile * pFile) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s(%s) called\n", __func__, - GetName().c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s(%s) called\n", + __func__, GetName().c_str()); CBETypedDeclarator *pReturn = GetReturnVariable(); if (!pReturn || GetReturnType()->IsVoid()) { *pFile << "\treturn;\n"; - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s(%s) finished\n", __func__, - GetName().c_str()); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEFunction::%s(%s) finished\n", __func__, GetName().c_str()); return; } @@ -539,8 +542,8 @@ pRetVar->WriteDeclaration(pFile); *pFile << ";\n"; - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s(%s) finished\n", __func__, - GetName().c_str()); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEFunction::%s(%s) finished\n", __func__, GetName().c_str()); } /** \brief writes the unmarshlling of the message buffer @@ -551,8 +554,8 @@ void CBEFunction::WriteUnmarshalling(CBEFile * pFile) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s(%s) called\n", __func__, - GetName().c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s(%s) called\n", + __func__, GetName().c_str()); assert(m_pTrace); bool bLocalTrace = false; @@ -571,8 +574,8 @@ m_bTraceOn = false; } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s(%s) finished\n", __func__, - GetName().c_str()); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEFunction::%s(%s) finished\n", __func__, GetName().c_str()); } /** \brief writes a function call to this function @@ -591,8 +594,8 @@ string sReturnVar, bool bCallFromSameClass) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s(%s) called\n", __func__, - GetName().c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s(%s) called\n", + __func__, GetName().c_str()); *pFile << "\t"; m_nParameterIndent = 0; @@ -613,8 +616,8 @@ pFile->DecIndent(m_nParameterIndent); *pFile << ");\n"; - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s(%s) finished\n", __func__, - GetName().c_str()); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEFunction::%s(%s) finished\n", __func__, GetName().c_str()); } /** \brief writes the parameter list for a function call @@ -625,7 +628,8 @@ CBEFunction::WriteCallParameterList(CBEFile * pFile, bool bCallFromSameClass) { - DTRACE("%s called for %s\n", __func__, GetName().c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called for %s\n", __func__, + GetName().c_str()); bool bComma = false; vector::iterator iter; for (iter = m_CallParameters.begin(); @@ -659,7 +663,7 @@ CBEDeclarator *pCallDecl = pParameter->GetCallDeclarator(); if (!pCallDecl) pCallDecl = pOriginalDecl; - DTRACE("%s: write parameter %s\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s: write parameter %s\n", __func__, pOriginalDecl->GetName().c_str()); WriteCallParameterName(pFile, pOriginalDecl, pCallDecl); } @@ -1124,7 +1128,6 @@ */ void CBEFunction::AddMessageBuffer() - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); @@ -1186,7 +1189,6 @@ */ void CBEFunction::AddMessageBuffer(CFEOperation *pFEOperation) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); @@ -1421,7 +1423,7 @@ } catch (CBECreateException *e) { - m_LocalVariables.Remove(pReturn); + m_LocalVariables.Remove(pReturn); delete pReturn; // deletes pType and pAttr return false; } @@ -1468,7 +1470,7 @@ } catch (CBECreateException *e) { - m_LocalVariables.Remove(pReturn); + m_LocalVariables.Remove(pReturn); delete pReturn; e->Print(); delete e; @@ -1494,7 +1496,6 @@ */ void CBEFunction::SetReturnVarAttributes(CBETypedDeclarator *pReturn) - throw(CBECreateException*) { CBEClassFactory *pCF = CCompiler::GetClassFactory(); // FIXME should the attributes really be ignored if creation fails? @@ -1572,15 +1573,16 @@ if (!pStack) return 0; - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s(stack, %s) called in %s\n", - __func__, bCall ? "true" : "false", GetName().c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEFunction::%s(stack, %s) called in %s\n", __func__, + bCall ? "true" : "false", GetName().c_str()); // get first element of stack vector::iterator iter = pStack->begin(); if (iter == pStack->end()) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s end, returns 0\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEFunction::%s end, returns 0\n", __func__); return 0; } // find parameter @@ -1588,8 +1590,8 @@ FindParameter((*iter)->pDeclarator->GetName(), bCall); if (!pParameter) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEFunction::%s no param, returns 0\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEFunction::%s no param, returns 0\n", __func__); return 0; } @@ -1611,7 +1613,7 @@ vector::iterator iter, vector *pStack) { - DTRACE("%s(%p (%s)) called\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s(%p (%s)) called\n", __func__, pParameter, pParameter ? pParameter->m_Declarators.First()->GetName().c_str() : ""); // if no parameter, return @@ -1630,7 +1632,8 @@ CBEStructType *pStruct = dynamic_cast(pType); if (pStruct) { - DTRACE("%s: type of parameter is struct\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s: type of parameter is struct\n", + __func__); CBETypedDeclarator *pMember = pStruct->m_Members.Find((*iter)->pDeclarator->GetName()); return FindParameterMember(pMember, iter + 1, pStack); @@ -1639,13 +1642,15 @@ CBEUnionType *pUnion = dynamic_cast(pType); if (pUnion) { - DTRACE("%s: type of parameter is union\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s: type of parameter is union\n", + __func__); CBETypedDeclarator *pMember = pUnion->m_UnionCases.Find((*iter)->pDeclarator->GetName()); return FindParameterMember(pMember, iter + 1, pStack); } // no constructed type, and stack not empty, something is wrong - DTRACE("%s: no constructed type: return 0\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: no constructed type: return 0\n", + __func__); return 0; } @@ -1700,7 +1705,8 @@ { if (!(*iter)->IsDirection(nDirection)) continue; - DTRACE("%s checking %s (var: %s, str: %s)\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s checking %s (var: %s, str: %s)\n", __func__, (*iter)->m_Declarators.First()->GetName().c_str(), ((*iter)->IsVariableSized()) ? "yes" : "no", ((*iter)->IsString()) ? "yes" : "no"); @@ -1710,7 +1716,8 @@ CBETypedDeclarator *pRet = GetReturnVariable(); if (pRet && pRet->IsDirection(nDirection)) { - DTRACE("%s checking %s (var: %s, str: %s)\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s checking %s (var: %s, str: %s)\n", __func__, pRet->m_Declarators.First()->GetName().c_str(), (pRet->IsVariableSized()) ? "yes" : "no", (pRet->IsString()) ? "yes" : "no"); @@ -1731,7 +1738,7 @@ { int nCountIn = GetParameterCount(nFEType, DIRECTION_IN); int nCountOut = GetParameterCount(nFEType, DIRECTION_OUT); - return max(nCountIn, nCountOut); + return std::max(nCountIn, nCountOut); } int nCount = 0; @@ -1772,7 +1779,7 @@ DIRECTION_IN); int nCountOut = GetParameterCount(nMustAttrs, nMustNotAttrs, DIRECTION_OUT); - return max(nCountIn, nCountOut); + return std::max(nCountIn, nCountOut); } int nCount = 0; @@ -1862,9 +1869,8 @@ if (!(*iter)->IsDirection(nDirection)) continue; CBEDeclarator *pDecl = (*iter)->m_Declarators.First(); - DTRACE("%s checking %s (array: %s)\n", __func__, - pDecl->GetName().c_str(), - (pDecl->IsArray()) ? "yes" : "no"); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s checking %s (array: %s)\n", + __func__, pDecl->GetName().c_str(), (pDecl->IsArray()) ? "yes" : "no"); if (pDecl->IsArray()) { return true; @@ -1874,9 +1880,8 @@ if (pRet && pRet->IsDirection(nDirection)) { CBEDeclarator *pDecl = pRet->m_Declarators.First(); - DTRACE("%s checking %s (array: %s)\n", __func__, - pDecl->GetName().c_str(), - (pDecl->IsArray()) ? "yes" : "no"); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s checking %s (array: %s)\n", + __func__, pDecl->GetName().c_str(), (pDecl->IsArray()) ? "yes" : "no"); if (pDecl->IsArray()) { return true; @@ -1962,7 +1967,6 @@ */ void CBEFunction::CreateBackEnd(CFEBase *pFEObject) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); @@ -1983,7 +1987,6 @@ */ void CBEFunction::CreateMarshaller() - throw (CBECreateException*) { // create marshaller class if (m_pMarshaller) @@ -2004,7 +2007,6 @@ */ void CBEFunction::CreateCommunication() - throw (CBECreateException*) { // set the communication class (does not require initialization) if (m_pComm) @@ -2019,7 +2021,6 @@ */ void CBEFunction::CreateTrace() - throw (CBECreateException*) { if (m_pTrace) delete m_pTrace; @@ -2034,7 +2035,6 @@ */ void CBEFunction::CreateObject() - throw (CBECreateException*) { // trace remove old object if (m_pCorbaObject) @@ -2089,7 +2089,6 @@ */ void CBEFunction::CreateEnvironment() - throw (CBECreateException*) { // clean up if (m_pCorbaEnv) @@ -2151,7 +2150,7 @@ } catch (CBECreateException *e) { - pTypedDecl->m_Declarators.Remove(pSecond); + pTypedDecl->m_Declarators.Remove(pSecond); delete pSecond; throw; } @@ -2229,8 +2228,8 @@ assert(pDeclarator); CBETypedDeclarator *pParameter = FindParameter(pDeclarator->GetName(), bCall); - DTRACE("%s FindParameter(%s) returned %p\n", __func__, - pDeclarator->GetName().c_str(), pParameter); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s FindParameter(%s) returned %p\n", + __func__, pDeclarator->GetName().c_str(), pParameter); // declarators should be the same, e.g. // the function 'f(int x, struct_t b)' with struct_t = { int x, y; }, // will return true for a.x, because it thinks it is x @@ -2394,7 +2393,8 @@ */ void CBEFunction::AddLocalVariable(CBETypedDeclarator *pVariable) { - DTRACE("%s (%p) called\n", __func__, pVariable); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s (%p) called\n", __func__, + pVariable); if (!pVariable) return; if (pVariable->m_Declarators.First() && @@ -2453,7 +2453,6 @@ string sName, int nStars, string sInit) - throw (CBECreateException*) { CBEClassFactory *pCF = CCompiler::GetClassFactory(); CBETypedDeclarator *pVariable = pCF->GetNewTypedDeclarator(); @@ -2464,7 +2463,7 @@ } catch (CBECreateException *e) { - m_LocalVariables.Remove(pVariable); + m_LocalVariables.Remove(pVariable); delete pVariable; throw; } @@ -2491,7 +2490,6 @@ string sName, int nStars, string sInit) - throw (CBECreateException*) { CBEClassFactory *pCF = CCompiler::GetClassFactory(); CBEType *pType = pCF->GetNewType(nFEType); @@ -2505,7 +2503,7 @@ } catch (CBECreateException *e) { - m_LocalVariables.Remove(pVariable); + m_LocalVariables.Remove(pVariable); delete pVariable; throw; } @@ -2562,7 +2560,6 @@ */ CBETypedDeclarator* CBEFunction::CreateOpcodeVariable(void) - throw (CBECreateException*) { CBEClassFactory *pCF = CCompiler::GetClassFactory(); CBEOpcodeType *pOpcodeType = pCF->GetNewOpcodeType(); @@ -2592,7 +2589,6 @@ */ void CBEFunction::AddExceptionVariable(void) - throw (CBECreateException*) { if (m_Attributes.Find(ATTR_NOEXCEPTIONS)) return; @@ -2633,7 +2629,7 @@ bool CBEFunction::DoWriteParameter(CBETypedDeclarator* /*pParam*/) { - DTRACE("%s() called\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s() called\n", __func__); return true; } diff -ruN p2/l4/tool/dice/src/be/BEFunction.h p3/l4/tool/dice/src/be/BEFunction.h --- p2/l4/tool/dice/src/be/BEFunction.h 2006-10-10 14:55:35.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEFunction.h 2006-11-30 10:41:07.000000000 +0100 @@ -36,7 +36,6 @@ #include "Attribute-Type.h" #include "template.h" #include -using namespace std; class CBETypedDeclarator; class CBEType; @@ -145,12 +144,10 @@ virtual int GetParameterAlignment(int nCurrentOffset, int nParamSize); virtual void AddLocalVariable(string sUserType, - string sName, int nStars, string sInit = string()) - throw (CBECreateException*); + string sName, int nStars, string sInit = string()); virtual void AddLocalVariable(int nFEType, bool bUnsigned, int nSize, string sName, int nStars, - string sInit = string()) - throw (CBECreateException*); + string sInit = string()); virtual bool MsgBufferInitialization(CBEMsgBuffer * pMsgBuffer); virtual CBETypedDeclarator* GetReturnVariable(void); @@ -209,30 +206,20 @@ CBETypedDeclarator * pParameter, bool bCallFromSameClass); virtual void WriteCallParameterList(CBEFile * pFile, bool bCallFromSameClass); virtual void WriteFunctionAttributes(CBEFile* pFile); - void AddMessageBuffer(void) - throw (CBECreateException*); - void AddMessageBuffer(CFEOperation *pFEOperation) - throw (CBECreateException*); + void AddMessageBuffer(void); + void AddMessageBuffer(CFEOperation *pFEOperation); virtual bool SetReturnVar(bool bUnsigned, int nSize, int nFEType, string sName); virtual bool SetReturnVar(CBEType * pType, string sName); virtual bool SetReturnVar(CFETypeSpec * pFEType, string sName); - virtual void SetReturnVarAttributes(CBETypedDeclarator *pReturn) - throw(CBECreateException*); - virtual void CreateBackEnd(CFEBase* pFEObject) - throw (CBECreateException*); - virtual void CreateObject(void) - throw (CBECreateException*); - virtual void CreateEnvironment(void) - throw (CBECreateException*); - void CreateMarshaller(void) - throw (CBECreateException*); - void CreateCommunication(void) - throw (CBECreateException*); - void CreateTrace(void) - throw (CBECreateException*); - virtual void AddExceptionVariable() - throw (CBECreateException*); + virtual void SetReturnVarAttributes(CBETypedDeclarator *pReturn); + virtual void CreateBackEnd(CFEBase* pFEObject); + virtual void CreateObject(void); + virtual void CreateEnvironment(void); + void CreateMarshaller(void); + void CreateCommunication(void); + void CreateTrace(void); + virtual void AddExceptionVariable(); virtual int GetFixedReturnSize(int nDirection); virtual int GetReturnSize(int nDirection); @@ -251,8 +238,7 @@ vector::iterator iter, vector *pStack); - CBETypedDeclarator* CreateOpcodeVariable(void) - throw (CBECreateException*); + CBETypedDeclarator* CreateOpcodeVariable(void); private: void SetCallVariable(CBETypedDeclarator *pTypedDecl, diff -ruN p2/l4/tool/dice/src/be/BEHeaderFile.cpp p3/l4/tool/dice/src/be/BEHeaderFile.cpp --- p2/l4/tool/dice/src/be/BEHeaderFile.cpp 2006-10-10 14:46:17.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEHeaderFile.cpp 2006-11-30 10:41:07.000000000 +0100 @@ -46,7 +46,6 @@ #include "fe/FEOperation.h" #include #include -using namespace std; CBEHeaderFile::CBEHeaderFile() : m_Constants(0, (CObject*)0), @@ -101,18 +100,21 @@ */ void CBEHeaderFile::CreateBackEnd(CFEFile * pFEFile, FILE_TYPE nFileType) - throw (CBECreateException*) { assert(pFEFile); - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEHeaderFile::CreateBackEnd(file: %s) called\n", - pFEFile->GetFileName().c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEHeaderFile::%s(file: %s) called\n", + __func__, pFEFile->GetFileName().c_str()); m_nFileType = nFileType; CBENameFactory *pNF = CCompiler::GetNameFactory(); - m_sFileName = pNF->GetFileName(pFEFile, m_nFileType); + m_sFilename = pNF->GetFileName(pFEFile, m_nFileType); m_sIncludeName = pNF->GetIncludeFileName(pFEFile, m_nFileType); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEHeaderFile::%s m_sFilename=%s, m_sIncludeName=%s\n", __func__, + m_sFilename.c_str(), m_sIncludeName.c_str()); + CFEFile *pFERoot = dynamic_cast(pFEFile->GetRoot()); assert(pFERoot); vector::iterator iterI; @@ -136,13 +138,13 @@ (*iterI)->m_bIDLFile) continue; -// TRACE("Add include to file %s: %s (from %s:%d)\n", -// GetFileName().c_str(), sIncName.c_str(), -// pInclude->GetSourceFileName().c_str(), -// pInclude->GetSourceLine()); AddIncludedFileName(sIncName, (*iterI)->m_bIDLFile, (*iterI)->m_bStandard, *iterI); } + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEHeaderFile::%s(file: %s) finished\n", __func__, + pFEFile->GetFileName().c_str()); } /** \brief prepares the header file for the back-end @@ -152,14 +154,14 @@ */ void CBEHeaderFile::CreateBackEnd(CFELibrary * pFELibrary, FILE_TYPE nFileType) - throw (CBECreateException*) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEHeaderFile::CreateBackEnd(library: %s) called\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEHeaderFile::%s(library: %s) called\n", __func__, pFELibrary->GetName().c_str()); m_nFileType = nFileType; CBENameFactory *pNF = CCompiler::GetNameFactory(); - m_sFileName = pNF->GetFileName(pFELibrary, m_nFileType); + m_sFilename = pNF->GetFileName(pFELibrary, m_nFileType); m_sIncludeName = pNF->GetIncludeFileName(pFELibrary, m_nFileType); } @@ -171,14 +173,14 @@ void CBEHeaderFile::CreateBackEnd(CFEInterface * pFEInterface, FILE_TYPE nFileType) - throw (CBECreateException*) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEHeaderFile::CreateBackEnd(interface: %s) called\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEHeaderFile::%s(interface: %s) called\n", __func__, pFEInterface->GetName().c_str()); m_nFileType = nFileType; CBENameFactory *pNF = CCompiler::GetNameFactory(); - m_sFileName = pNF->GetFileName(pFEInterface, m_nFileType); + m_sFilename = pNF->GetFileName(pFEInterface, m_nFileType); m_sIncludeName = pNF->GetIncludeFileName(pFEInterface, m_nFileType); } @@ -190,14 +192,14 @@ void CBEHeaderFile::CreateBackEnd(CFEOperation * pFEOperation, FILE_TYPE nFileType) - throw (CBECreateException*) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEHeaderFile::CreateBackEnd(operation: %s) called\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEHeaderFile::%s(operation: %s) called\n", __func__, pFEOperation->GetName().c_str()); m_nFileType = nFileType; CBENameFactory *pNF = CCompiler::GetNameFactory(); - m_sFileName = pNF->GetFileName(pFEOperation, m_nFileType); + m_sFilename = pNF->GetFileName(pFEOperation, m_nFileType); m_sIncludeName= pNF->GetIncludeFileName(pFEOperation, m_nFileType); } @@ -226,9 +228,9 @@ if (!sOutputDir.empty()) sFilename = sOutputDir; sFilename += GetFileName(); - if (!Open(sFilename, CFile::Write)) + if (!Open(sFilename)) { - cerr << "Could not open header file " << sFilename << "\n"; + std::cerr << "Could not open header file " << sFilename << "\n"; return; } // sort our members/elements depending on source line number @@ -242,11 +244,10 @@ string sDefine = pNF->GetHeaderDefine(GetFileName()); if (!sDefine.empty()) { - Print("#if !defined(%s)\n", sDefine.c_str()); - Print("#define %s\n", sDefine.c_str()); + m_file << "#if !defined(" << sDefine << ")\n"; + m_file << "#define " << sDefine << "\n"; } - // pretty print: newline - Print("\n"); + m_file << "\n"; // default includes always come first, because they define standard headers // needed by other includes @@ -284,25 +285,25 @@ // brace functions with extern C if (nLastType == 6) { - Print("#ifdef __cplusplus\n"); - Print("}\n"); - Print("#endif\n\n"); + m_file << "#ifdef __cplusplus\n" << + "}\n" << + "#endif\n\n"; } - Print("\n"); + m_file << "\n"; nLastType = nCurrType; // brace functions with extern C if (nCurrType == 6) { - Print("#ifdef __cplusplus\n"); - Print("extern \"C\" {\n"); - Print("#endif\n\n"); + m_file << "#ifdef __cplusplus\n" << + "extern \"C\" {\n" << + "#endif\n\n"; } } // add pre-processor directive to denote source line if (CCompiler::IsOptionSet(PROGRAM_GENERATE_LINE_DIRECTIVE)) { - Print("# %d \"%s\"\n", (*iter)->GetSourceLine(), - (*iter)->GetSourceFileName().c_str()); + m_file << "# " << (*iter)->GetSourceLine() << " \"" << + (*iter)->GetSourceFileName() << "\"\n"; } switch (nCurrType) { @@ -334,9 +335,9 @@ // if last element was function, close braces if (nLastType == 6) { - Print("#ifdef __cplusplus\n"); - Print("}\n"); - Print("#endif\n\n"); + m_file << "#ifdef __cplusplus\n" << + "}\n" << + "#endif\n\n"; } // write helper functions, if any @@ -350,10 +351,9 @@ // write include define closing statement if (!sDefine.empty()) { - Print("#endif /* %s */\n", sDefine.c_str()); + m_file << "#endif /* " << sDefine << " */\n"; } - // pretty print: newline - Print("\n"); + m_file << "\n"; // close file Close(); @@ -379,12 +379,12 @@ submin++; } } - Print("#ifndef DICE_MAJOR_VERSION\n"); - Print("#define DICE_MAJOR_VERSION %s\n", major); - Print("#define DICE_MINOR_VERSION %s\n", minor); - Print("#define DICE_SUBMINOR_VERSION %s\n", submin); - Print("#endif\n"); - Print("\n"); + m_file << + "#ifndef DICE_MAJOR_VERSION\n" << + "#define DICE_MAJOR_VERSION " << major << "\n" << + "#define DICE_MINOR_VERSION " << minor << "\n" << + "#define DICE_SUBMINOR_VERSION " << submin << "\n" << + "#endif\n\n"; free(major); CBEClassFactory *pCF = CCompiler::GetClassFactory(); @@ -392,17 +392,10 @@ pTrace->DefaultIncludes(this); delete pTrace; - Print("/* needed for CORBA types */\n"); - Print("#include \"dice/dice.h\"\n"); - Print("\n"); -} - -/** \brief returns the file name used in include statements - * \return the file name used in include statements - */ -string CBEHeaderFile::GetIncludeFileName() -{ - return m_sIncludeName; + m_file << + "/* needed for CORBA types */\n" << + "#include \"dice/dice.h\"\n" << + "\n"; } /** \brief creates a list of ordered elements @@ -504,12 +497,13 @@ if (dynamic_cast(pType)) sTag = ((CBEUnionType*)pType)->GetTag(); sTag = CCompiler::GetNameFactory()->GetTypeDefine(sTag); - Print("#ifndef %s\n", sTag.c_str()); - Print("#define %s\n", sTag.c_str()); + m_file << + "#ifndef " << sTag << "\n" << + "#define " << sTag << "\n"; pType->Write(this); - Print(";\n"); - Print("#endif /* !%s */\n", sTag.c_str()); - Print("\n"); + m_file << ";\n" << + "#endif /* !" << sTag << " */\n" << + "\n"; } /** \brief retrieves the maximum line number in the file @@ -536,7 +530,7 @@ { int sLine = (*iterC)->GetSourceLine(); int eLine = (*iterC)->GetSourceLineEnd(); - m_nSourceLineNbEnd = max(sLine, max(eLine, m_nSourceLineNbEnd)); + m_nSourceLineNbEnd = std::max(sLine, std::max(eLine, m_nSourceLineNbEnd)); } // typedef vector::iterator iterT; @@ -546,7 +540,7 @@ { int sLine = (*iterT)->GetSourceLine(); int eLine = (*iterT)->GetSourceLineEnd(); - m_nSourceLineNbEnd = max(sLine, max(eLine, m_nSourceLineNbEnd)); + m_nSourceLineNbEnd = std::max(sLine, std::max(eLine, m_nSourceLineNbEnd)); } // tagged types vector::iterator iterTa; @@ -556,7 +550,7 @@ { int sLine = (*iterTa)->GetSourceLine(); int eLine = (*iterTa)->GetSourceLineEnd(); - m_nSourceLineNbEnd = max(sLine, max(eLine, m_nSourceLineNbEnd)); + m_nSourceLineNbEnd = std::max(sLine, std::max(eLine, m_nSourceLineNbEnd)); } return m_nSourceLineNbEnd; diff -ruN p2/l4/tool/dice/src/be/BEHeaderFile.h p3/l4/tool/dice/src/be/BEHeaderFile.h --- p2/l4/tool/dice/src/be/BEHeaderFile.h 2006-08-21 16:46:36.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEHeaderFile.h 2006-11-30 10:41:08.000000000 +0100 @@ -1,9 +1,9 @@ /** - * \file dice/src/be/BEHeaderFile.h + * \file dice/src/be/BEHeaderFile.h * \brief contains the declaration of the class CBEHeaderFile * - * \date 01/11/2002 - * \author Ronald Aigner + * \date 01/11/2002 + * \author Ronald Aigner */ /* * Copyright (C) 2001-2004 @@ -32,7 +32,6 @@ #include "be/BEFile.h" #include -using namespace std; class CFEFile; class CFELibrary; @@ -65,16 +64,11 @@ public: virtual void Write(void); - virtual void CreateBackEnd(CFEOperation *pFEOperation, FILE_TYPE nFileType) - throw (CBECreateException*); - virtual void CreateBackEnd(CFEInterface *pFEInterface, FILE_TYPE nFileType) - throw (CBECreateException*); - virtual void CreateBackEnd(CFELibrary *pFELibrary, FILE_TYPE nFileType) - throw (CBECreateException*); - virtual void CreateBackEnd(CFEFile *pFEFile, FILE_TYPE nFileType) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation, FILE_TYPE nFileType); + virtual void CreateBackEnd(CFEInterface *pFEInterface, FILE_TYPE nFileType); + virtual void CreateBackEnd(CFELibrary *pFELibrary, FILE_TYPE nFileType); + virtual void CreateBackEnd(CFEFile *pFEFile, FILE_TYPE nFileType); - virtual string GetIncludeFileName(); virtual int GetSourceLineEnd(); /** \brief tries to match file names @@ -83,6 +77,11 @@ */ bool Match(string sName) { return GetFileName() == sName; } + /** \brief returns the file name used in include statements + * \return the file name used in include statements + */ + string GetIncludeFileName(void) + { return m_sIncludeName; } protected: virtual void WriteTaggedType(CBEType *pType); diff -ruN p2/l4/tool/dice/src/be/BEIDLUnionType.cpp p3/l4/tool/dice/src/be/BEIDLUnionType.cpp --- p2/l4/tool/dice/src/be/BEIDLUnionType.cpp 2006-08-23 19:27:56.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEIDLUnionType.cpp 2006-11-30 10:41:08.000000000 +0100 @@ -32,7 +32,6 @@ #include "Compiler.h" #include "fe/FEIDLUnionType.h" #include -using namespace std; CBEIDLUnionType::CBEIDLUnionType() : CBEStructType() @@ -60,10 +59,9 @@ */ void CBEIDLUnionType::CreateBackEnd(CFETypeSpec * pFEType) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEIDLUnionType::%s(fe) called\n", - __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEIDLUnionType::%s(fe) called\n", __func__); // get union type CFEIDLUnionType *pFEUnion = dynamic_cast(pFEType); @@ -100,7 +98,8 @@ m_sUnionName = "_u"; pUnionVar->CreateBackEnd(pType, m_sUnionName); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEIDLUnionType::%s(fe) returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEIDLUnionType::%s(fe) returns\n", __func__); } /** \brief generates an exact copy of this class diff -ruN p2/l4/tool/dice/src/be/BEIDLUnionType.h p3/l4/tool/dice/src/be/BEIDLUnionType.h --- p2/l4/tool/dice/src/be/BEIDLUnionType.h 2006-06-14 14:24:56.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEIDLUnionType.h 2006-11-30 10:41:08.000000000 +0100 @@ -52,8 +52,7 @@ CBEIDLUnionType(CBEIDLUnionType &src); public: - virtual void CreateBackEnd(CFETypeSpec *pFEType) - throw (CBECreateException*); + virtual void CreateBackEnd(CFETypeSpec *pFEType); virtual CObject* Clone(void); CBETypedDeclarator* GetSwitchVariable(void); diff -ruN p2/l4/tool/dice/src/be/BEImplementationFile.cpp p3/l4/tool/dice/src/be/BEImplementationFile.cpp --- p2/l4/tool/dice/src/be/BEImplementationFile.cpp 2006-08-23 19:27:56.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEImplementationFile.cpp 2006-11-30 10:41:08.000000000 +0100 @@ -41,7 +41,6 @@ #include "fe/FEOperation.h" #include #include -using namespace std; CBEImplementationFile::CBEImplementationFile() { @@ -90,11 +89,10 @@ void CBEImplementationFile::CreateBackEnd(CFEFile * pFEFile, FILE_TYPE nFileType) - throw (CBECreateException*) { m_nFileType = nFileType; CBENameFactory *pNF = CCompiler::GetNameFactory(); - m_sFileName = pNF->GetFileName(pFEFile, m_nFileType); + m_sFilename = pNF->GetFileName(pFEFile, m_nFileType); CBEHeaderFile *pHeader = GetHeaderFile(); if (pHeader) AddIncludedFileName(pHeader->GetFileName(), true, false, pFEFile); @@ -108,11 +106,10 @@ void CBEImplementationFile::CreateBackEnd(CFELibrary * pFELibrary, FILE_TYPE nFileType) - throw (CBECreateException*) { m_nFileType = nFileType; CBENameFactory *pNF = CCompiler::GetNameFactory(); - m_sFileName = pNF->GetFileName(pFELibrary, m_nFileType); + m_sFilename = pNF->GetFileName(pFELibrary, m_nFileType); CBEHeaderFile *pHeader = GetHeaderFile(); if (pHeader) AddIncludedFileName(pHeader->GetFileName(), true, false, pFELibrary); @@ -126,11 +123,10 @@ void CBEImplementationFile::CreateBackEnd(CFEInterface *pFEInterface, FILE_TYPE nFileType) - throw (CBECreateException*) { m_nFileType = nFileType; CBENameFactory *pNF = CCompiler::GetNameFactory(); - m_sFileName = pNF->GetFileName(pFEInterface, m_nFileType); + m_sFilename = pNF->GetFileName(pFEInterface, m_nFileType); CBEHeaderFile *pHeader = GetHeaderFile(); if (pHeader) AddIncludedFileName(pHeader->GetFileName(), true, false, pFEInterface); @@ -144,11 +140,10 @@ void CBEImplementationFile::CreateBackEnd(CFEOperation * pFEOperation, FILE_TYPE nFileType) - throw (CBECreateException*) { m_nFileType = nFileType; CBENameFactory *pNF = CCompiler::GetNameFactory(); - m_sFileName = pNF->GetFileName(pFEOperation, m_nFileType); + m_sFilename = pNF->GetFileName(pFEOperation, m_nFileType); CBEHeaderFile *pHeader = GetHeaderFile(); if (pHeader) AddIncludedFileName(pHeader->GetFileName(), true, false, pFEOperation); @@ -169,9 +164,9 @@ if (!sOutputDir.empty()) sFilename = sOutputDir; sFilename += GetFileName(); - if (!Open(sFilename, CFile::Write)) + if (!Open(sFilename)) { - cerr << "Could not open implementation file " << sFilename << "\n"; + std::cerr << "Could not open implementation file " << sFilename << "\n"; return; } // sort our members/elements depending on source line number @@ -204,25 +199,27 @@ // brace functions with extern C if (nLastType == 4) { - Print("#ifdef __cplusplus\n"); - Print("}\n"); - Print("#endif\n\n"); + m_file << + "#ifdef __cplusplus\n" << + "}\n" << + "#endif\n\n"; } - Print("\n"); + m_file << "\n"; nLastType = nCurrType; // brace functions with extern C if (nCurrType == 4) { - Print("#ifdef __cplusplus\n"); - Print("extern \"C\" {\n"); - Print("#endif\n\n"); + m_file << + "#ifdef __cplusplus\n" << + "extern \"C\" {\n" << + "#endif\n\n"; } } // add pre-processor directive to denote source line if (CCompiler::IsOptionSet(PROGRAM_GENERATE_LINE_DIRECTIVE)) { - Print("# %d \"%s\"\n", (*iter)->GetSourceLine(), - (*iter)->GetSourceFileName().c_str()); + m_file << "# " << (*iter)->GetSourceLine() << " \"" << + (*iter)->GetSourceFileName() << "\"\n"; } // now really write the element switch (nCurrType) @@ -246,9 +243,10 @@ // if last element was function, close braces if (nLastType == 4) { - Print("#ifdef __cplusplus\n"); - Print("}\n"); - Print("#endif\n\n"); + m_file << + "#ifdef __cplusplus\n" << + "}\n" << + "#endif\n\n"; } // write helper functions, if any diff -ruN p2/l4/tool/dice/src/be/BEImplementationFile.h p3/l4/tool/dice/src/be/BEImplementationFile.h --- p2/l4/tool/dice/src/be/BEImplementationFile.h 2006-08-21 16:46:36.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEImplementationFile.h 2006-11-30 10:41:08.000000000 +0100 @@ -61,14 +61,10 @@ public: virtual void Write(void); - virtual void CreateBackEnd(CFEOperation *pFEOperation, FILE_TYPE nFileType) - throw (CBECreateException*); - virtual void CreateBackEnd(CFEInterface *pFEInterface, FILE_TYPE nFileType) - throw (CBECreateException*); - virtual void CreateBackEnd(CFELibrary *pFELibrary, FILE_TYPE nFileType) - throw (CBECreateException*); - virtual void CreateBackEnd(CFEFile *pFEFile, FILE_TYPE nFileType) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation, FILE_TYPE nFileType); + virtual void CreateBackEnd(CFEInterface *pFEInterface, FILE_TYPE nFileType); + virtual void CreateBackEnd(CFELibrary *pFELibrary, FILE_TYPE nFileType); + virtual void CreateBackEnd(CFEFile *pFEFile, FILE_TYPE nFileType); virtual CBEHeaderFile* GetHeaderFile(); virtual void SetHeaderFile(CBEHeaderFile *pHeaderFile); diff -ruN p2/l4/tool/dice/src/be/BEInterfaceFunction.cpp p3/l4/tool/dice/src/be/BEInterfaceFunction.cpp --- p2/l4/tool/dice/src/be/BEInterfaceFunction.cpp 2006-08-23 19:27:56.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEInterfaceFunction.cpp 2006-11-30 10:41:08.000000000 +0100 @@ -37,7 +37,6 @@ #include "fe/FEStringAttribute.h" #include "Compiler.h" #include -using namespace std; CBEInterfaceFunction::CBEInterfaceFunction(FUNCTION_TYPE nFunctionType) : CBEFunction (nFunctionType) @@ -62,7 +61,6 @@ */ void CBEInterfaceFunction::CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*) { assert(pFEInterface); @@ -115,7 +113,6 @@ */ void CBEInterfaceFunction::AddParameters() - throw (CBECreateException*) { CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); diff -ruN p2/l4/tool/dice/src/be/BEInterfaceFunction.h p3/l4/tool/dice/src/be/BEInterfaceFunction.h --- p2/l4/tool/dice/src/be/BEInterfaceFunction.h 2006-08-21 16:46:36.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEInterfaceFunction.h 2006-11-30 10:41:08.000000000 +0100 @@ -57,12 +57,10 @@ CBEInterfaceFunction(CBEInterfaceFunction &src); public: - virtual void CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEInterface *pFEInterface); protected: - virtual void AddParameters(void) - throw (CBECreateException*); + virtual void AddParameters(void); }; #endif // !__DICE_BEINTERFACEFUNCTION_H__ diff -ruN p2/l4/tool/dice/src/be/BEMarshalFunction.cpp p3/l4/tool/dice/src/be/BEMarshalFunction.cpp --- p2/l4/tool/dice/src/be/BEMarshalFunction.cpp 2006-10-10 14:46:17.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEMarshalFunction.cpp 2006-11-30 10:41:08.000000000 +0100 @@ -45,7 +45,6 @@ #include "fe/FEOperation.h" #include "fe/FETypedDeclarator.h" #include -using namespace std; CBEMarshalFunction::CBEMarshalFunction() : CBEOperationFunction(FUNCTION_MARSHAL) @@ -71,7 +70,6 @@ */ void CBEMarshalFunction::CreateBackEnd(CFEOperation * pFEOperation) - throw (CBECreateException*) { // set target file name SetTargetFileName(pFEOperation); @@ -121,8 +119,8 @@ { if (!pMsgBuffer->AddReturnVariable(this)) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s failed, because couldn't added ret-var to msgbuf\n", - __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s failed, because couldn't added ret-var to msgbuf\n", __func__); return false; } } @@ -190,7 +188,8 @@ // if no parameter, then try to find it in the message buffer CBEMsgBuffer *pMsgBuf = m_pClass->GetMessageBuffer(); - DTRACE("%s message buffer in class at %p\n", __func__, pMsgBuf); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s message buffer in class at %p\n", + __func__, pMsgBuf); if (!pMsgBuf) return 0; CBENameFactory *pNF = CCompiler::GetNameFactory(); @@ -198,7 +197,7 @@ pRet = pMsgBuf->FindMember(sName, this, GetSendDirection()); if (!pRet) pRet = pMsgBuf->FindMember(sName, this, GetReceiveDirection()); - DTRACE("%s exception var %s at %p\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s exception var %s at %p\n", __func__, sName.c_str(), pRet); return pRet; @@ -217,7 +216,8 @@ void CBEMarshalFunction::AddBeforeParameters() { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMarshalFunction::%s called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEMarshalFunction::%s called\n", __func__); // call base class to add object CBEOperationFunction::AddBeforeParameters(); @@ -230,7 +230,8 @@ m_Parameters.Add(pReturnParam); } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMarshalFunction::%s returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMarshalFunction::%s returns\n", __func__); } /** \brief add parameters after all other parameters @@ -243,7 +244,8 @@ */ void CBEMarshalFunction::AddAfterParameters() { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMarshalFunction::%s called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEMarshalFunction::%s called\n", __func__); CBEClassFactory *pCF = CCompiler::GetClassFactory(); CBENameFactory *pNF = CCompiler::GetNameFactory(); @@ -264,7 +266,8 @@ CBEOperationFunction::AddAfterParameters(); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMarshalFunction::%s returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMarshalFunction::%s returns\n", __func__); } /** \brief adds a single parameter to this function @@ -277,7 +280,6 @@ */ void CBEMarshalFunction::AddParameter(CFETypedDeclarator * pFEParameter) - throw (CBECreateException*) { if (IsComponentSide()) { diff -ruN p2/l4/tool/dice/src/be/BEMarshalFunction.h p3/l4/tool/dice/src/be/BEMarshalFunction.h --- p2/l4/tool/dice/src/be/BEMarshalFunction.h 2006-08-21 16:46:36.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEMarshalFunction.h 2006-11-30 10:41:08.000000000 +0100 @@ -53,8 +53,7 @@ CBEMarshalFunction(CBEMarshalFunction &src); public: - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); virtual bool MsgBufferInitialization(CBEMsgBuffer *pMsgBuffer); virtual void WriteReturn(CBEFile * pFile); virtual int GetFixedSize(int nDirection); @@ -64,8 +63,7 @@ virtual CBETypedDeclarator* FindParameterType(string sTypeName); virtual bool DoMarshalParameter(CBETypedDeclarator * pParameter, bool bMarshal); - virtual void AddParameter(CFETypedDeclarator * pFEParameter) - throw (CBECreateException*); + virtual void AddParameter(CFETypedDeclarator * pFEParameter); virtual bool DoWriteFunction(CBEHeaderFile* pFile); virtual bool DoWriteFunction(CBEImplementationFile* pFile); diff -ruN p2/l4/tool/dice/src/be/BEMarshaller.cpp p3/l4/tool/dice/src/be/BEMarshaller.cpp --- p2/l4/tool/dice/src/be/BEMarshaller.cpp 2006-10-10 14:46:17.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEMarshaller.cpp 2006-11-30 10:41:08.000000000 +0100 @@ -51,7 +51,6 @@ #include "Compiler.h" #include #include -using namespace std; CBEMarshaller::CBEMarshaller() : CBEObject() @@ -98,8 +97,6 @@ { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEMarshaller::%s(%s, %d) called\n", __func__, pFunction->GetName().c_str(), nDirection); - DTRACE("%s (%s, %d) called\n", __func__, pFunction->GetName().c_str(), - nDirection); // check function's type to get name string sFuncName = pFunction->GetOriginalName(); @@ -171,9 +168,9 @@ CBEFunction *pFunction, int nDirection) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMarshaller::%s(%s, %s, %d) called\n", - __func__, pFile->GetFileName().c_str(), - pFunction->GetName().c_str(), nDirection); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEMarshaller::%s(%s, %s, %d) called\n", __func__, + pFile->GetFileName().c_str(), pFunction->GetName().c_str(), nDirection); // get struct CBEStructType *pStruct = GetStruct(pFunction, nDirection); @@ -181,8 +178,8 @@ // wait-any if (!pStruct) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMarshaller::%s returns (no struct)\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMarshaller::%s returns (no struct)\n", __func__); return; } @@ -240,7 +237,8 @@ m_pFunction = 0; m_pFile = 0; - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMarshaller::%s(,,) returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMarshaller::%s(,,) returns\n", __func__); } /** \brief tests if this parameter should be marshalled @@ -257,25 +255,26 @@ CBETypedDeclarator *pParameter, int nDirection) { - DTRACE("%s(%s, %s, %d) called\n", __func__, + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "%s(%s, %s, %d) called\n", __func__, pFunction->GetName().c_str(), pParameter->m_Declarators.First()->GetName().c_str(), nDirection); if (!pParameter->IsDirection(nDirection)) { - DTRACE("%s: wrong direction\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "%s: wrong direction\n", __func__); return true; } if (pParameter->m_Attributes.Find(ATTR_IGNORE)) { - DTRACE("%s: ignore\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "%s: ignore\n", __func__); return true; } if (!pFunction->DoMarshalParameter(pParameter, m_bMarshal)) { - DTRACE("%s: dont marshal\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "%s: dont marshal\n", __func__); return true; } + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "%s returns false\n", __func__); return false; } @@ -291,7 +290,8 @@ CBETypedDeclarator *pParameter, bool bMarshal) { - DTRACE("%s called for func %s and param %s (%s)\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s called for func %s and param %s (%s)\n", __func__, pFunction ? pFunction->GetName().c_str() : "(none)", pParameter ? pParameter->m_Declarators.First()->GetName().c_str() : "(none)", bMarshal ? "marshalling" : "unmarshalling"); @@ -314,7 +314,8 @@ CBEStructType *pStruct = GetStruct(pFunction, nDirection); // there always should be a struct assert(pStruct); - DTRACE("%s got %p and direction %d\n", __func__, pStruct, nDirection); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s got %p and direction %d\n", + __func__, pStruct, nDirection); vector vStack; CDeclaratorStackLocation *pLoc = new @@ -328,15 +329,16 @@ // to int nPosition = pMsgBuffer->GetMemberPosition(sName, nDirection); // write access to generic member - DTRACE("%s calling MarshalGenericMember for pos %d\n", __func__, - nPosition); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s calling MarshalGenericMember for pos %d\n", __func__, nPosition); MarshalGenericMember(nPosition, pParameter, &vStack); } else { if (!DoSkipParameter(pFunction, pParameter, nDirection)) { - DTRACE("%s calling MarshalParameterIntern\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s calling MarshalParameterIntern\n", __func__); MarshalParameterIntern(pParameter, &vStack); } } @@ -346,7 +348,7 @@ m_pFunction = 0; m_pFile = 0; - DTRACE("%s done.\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s done.\n", __func__); } /** \brief marshals a value at the position of a parameter @@ -436,14 +438,11 @@ return; // FIXME test for enum -// TRACE("%s: parameter %s is \"normal\"\n", __func__, -// pParameter->m_Declarators.First()->GetName().c_str()); - // now this is a simple type: WriteAssignment(pParameter, pStack); - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEMarshaller::%s(%s) returns\n", __func__, - pParameter->m_Declarators.First()->GetName().c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEMarshaller::%s(%s) returns\n", + __func__, pParameter->m_Declarators.First()->GetName().c_str()); } /** \brief marshals a member in the generic struct @@ -467,8 +466,8 @@ CBEMsgBuffer *pMsgBuffer = m_pFunction->GetMessageBuffer(); assert(pMsgBuffer); - DTRACE("%s (%d, %s) called\n", __func__, nPosition, - pParameter->m_Declarators.First()->GetName().c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s (%d, %s) called\n", __func__, + nPosition, pParameter->m_Declarators.First()->GetName().c_str()); *m_pFile << "\t"; if (m_bMarshal) @@ -485,7 +484,7 @@ } *m_pFile << ";\n"; - DTRACE("%s done.\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s done.\n", __func__); } /** \brief marshals a value in the generic struct @@ -680,19 +679,22 @@ bool CBEMarshaller::MarshalReturn(CBETypedDeclarator *pMember) { - DTRACE("%s(%s) called\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s(%s) called\n", __func__, pMember->m_Declarators.First()->GetName().c_str()); + CBENameFactory *pNF = CCompiler::GetNameFactory(); // check if member is return variable string sName = pNF->GetReturnVariable(); - DTRACE("try to find %s in param\n", sName.c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "try to find %s in param\n", + sName.c_str()); if (!pMember->m_Declarators.Find(sName)) return false; // the return value is not a parameter, but a local variable, // so we have to find that variable instead of the parameter CBETypedDeclarator *pParameter = m_pFunction->m_LocalVariables.Find(sName); - DTRACE("Found return as local var in %s at %p\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "Found return as local var in %s at %p\n", m_pFunction->GetName().c_str(), pParameter); // now, the local return variable can be of type void, for marshal // functions at the server side: we do indeed have a return variable as @@ -707,8 +709,9 @@ // if the assert traps here, then there is no local variable for // the return member. if (!pParameter) - TRACE("No local return variable available in func %s\n", - m_pFunction->GetName().c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "No local return variable available in func %s\n", + m_pFunction->GetName().c_str()); assert(pParameter); vector stack; @@ -751,7 +754,8 @@ CBETypedDeclarator *pMember = FindMarshalMember(pStack); if (!pMember) { - TRACE("%s: could not find member for parameter %s\n", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s: could not find member for parameter %s\n", __func__, pParameter->m_Declarators.First()->GetName().c_str()); DUMP_STACK(iter, pStack, __func__); } @@ -805,7 +809,8 @@ string sName = pNF->GetLocalVariableName(pStack); CBETypedDeclarator *pAlias = pMsgBuffer->FindMember(sName, m_pFunction, nDir); - DTRACE("Alias for %s at %p\n", sName.c_str(), pAlias); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "Alias for %s at %p\n", sName.c_str(), + pAlias); if (pAlias) { vector vStack; @@ -845,7 +850,8 @@ vector *pStack, bool bPointer) { - DTRACE("%s (%s, %p, %s) called\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEMarshaller::%s (%s, %p, %s) called\n", __func__, pParameter ? pParameter->m_Declarators.First()->GetName().c_str() : "(none)", pStack, bPointer ? "true" : "false"); @@ -860,7 +866,8 @@ bCast = !pType->IsOfType(pCastType->GetFEType()); } - DTRACE("%s cast? %s\n", __func__, bCast ? "yes" : "no"); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "CBEMarshaller::%s cast? %s\n", + __func__, bCast ? "yes" : "no"); // get declarator CBEDeclarator *pDecl = pParameter->m_Declarators.First(); @@ -936,7 +943,8 @@ if (!pParameter->IsString()) return false; - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMarshaller::%s(%s) called\n", __func__, + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEMarshaller::%s(%s) called\n", __func__, pParameter->m_Declarators.First()->GetName().c_str()); // Because the size has be calculated, we write the size first and then do @@ -960,8 +968,9 @@ // get name of size variable added by us CBENameFactory *pNF = CCompiler::GetNameFactory(); string sSize = pNF->GetLocalSizeVariableName(pStack); - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEMarshaller::%s determined size var as %s\n", - __func__, sSize.c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEMarshaller::%s determined size var as %s\n", __func__, + sSize.c_str()); // get SIZE_IS attribute CBEAttribute *pSizeAttr = pParameter->m_Attributes.Find(ATTR_SIZE_IS); bool bOurSizeAttr = false; @@ -969,7 +978,8 @@ { CBEDeclarator *pDecl = pSizeAttr->m_Parameters.First(); bOurSizeAttr = (pDecl->GetName() == sSize); - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEMarshaller::%s param has size attr %s%s\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEMarshaller::%s param has size attr %s%s\n", __func__, pDecl->GetName().c_str(), bOurSizeAttr ? " => our size attr" : ""); } @@ -1056,8 +1066,8 @@ // now memcpy string CBEMsgBuffer *pMsgBuffer = GetMessageBuffer(m_pFunction); - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEMarshaller::%s message buffer at %p\n", - __func__, pMsgBuffer); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEMarshaller::%s message buffer at %p\n", __func__, pMsgBuffer); CBETypedDeclarator *pMember = FindMarshalMember(pStack); if (m_bMarshal) @@ -1137,7 +1147,13 @@ pMember->WriteGetSize(m_pFile, pStack, m_pFunction); *m_pFile << " > 0))\n"; - bool bPrealloc = (pParameter->m_Attributes.Find(ATTR_PREALLOC) != 0); + bool bPrealloc = false; + if (pParameter->m_Attributes.Find(ATTR_PREALLOC_CLIENT) && + m_pFile->IsOfFileType(FILETYPE_CLIENT)) + bPrealloc = true; + if (pParameter->m_Attributes.Find(ATTR_PREALLOC_SERVER) && + m_pFile->IsOfFileType(FILETYPE_COMPONENT)) + bPrealloc = true; *m_pFile << "\t{\n"; m_pFile->IncIndent(); @@ -1187,13 +1203,14 @@ *m_pFile << "\t"; WriteParameter(pParameter, pStack, true); - *m_pFile << " = NULL;\n"; + *m_pFile << " = 0;\n"; m_pFile->DecIndent(); } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMarshaller::%s(%s) returns true\n", - __func__, pParameter->m_Declarators.First()->GetName().c_str()); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMarshaller::%s(%s) returns true\n", __func__, + pParameter->m_Declarators.First()->GetName().c_str()); return true; } @@ -1341,9 +1358,15 @@ // - no [prealloc] attribute // - no direct reference into the message buffer // - is variable sized + bool bPrealloc = false; + if (pParameter->m_Attributes.Find(ATTR_PREALLOC_CLIENT) && + m_pFile->IsOfFileType(FILETYPE_CLIENT)) + bPrealloc = true; + if (pParameter->m_Attributes.Find(ATTR_PREALLOC_SERVER) && + m_pFile->IsOfFileType(FILETYPE_COMPONENT)) + bPrealloc = true; bool bNeedMalloc = bIsVarSized && !m_bMarshal && !bRefMsgBuf && - (pDeclarator->GetArrayDimensionCount() == 0) && - !pParameter->m_Attributes.Find(ATTR_PREALLOC); + (pDeclarator->GetArrayDimensionCount() == 0) && !bPrealloc; if (bNeedMalloc) { *m_pFile << "\t"; @@ -1462,7 +1485,8 @@ CBEMarshaller::MarshalStruct(CBETypedDeclarator *pParameter, vector *pStack) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMarshaller::%s(%s) called\n", __func__, + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEMarshaller::%s(%s) called\n", __func__, pParameter->m_Declarators.First()->GetName().c_str()); CBEType *pType = pParameter->GetType(); @@ -1471,8 +1495,8 @@ CBEStructType *pStruct = dynamic_cast(pType); if (!pStruct) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMarshaller::%s returns (no struct)\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMarshaller::%s returns (no struct)\n", __func__); return false; // *no* struct } @@ -1540,7 +1564,8 @@ CBETypedDeclarator *pSwitchVar = pUnion->GetSwitchVariable(); if (!pSwitchVar) - TRACE("%s no switch var for param %s\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s no switch var for param %s\n", __func__, pParameter->m_Declarators.First()->GetName().c_str()); assert (pSwitchVar); CDeclaratorStackLocation *pLoc = new @@ -1643,7 +1668,8 @@ // get the member string sName = (*iter++)->pDeclarator->GetName(); pMember = pStruct->m_Members.Find(sName); - DTRACE("%s member in struct is %s (@ %p)\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CBEMarshaller::%s member in struct is %s (@ %p)\n", __func__, sName.c_str(), pMember); for (; iter != pStack->end(); iter++) @@ -1654,7 +1680,8 @@ CBEType *pType = pMember->GetType(); while (dynamic_cast(pType)) pType = ((CBEUserDefinedType*)pType)->GetRealType(); - DTRACE("type of member %s is %d\n", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CBEMarshaller::%s type of member %s is %d\n", __func__, pMember->m_Declarators.First()->GetName().c_str(), pType->GetFEType()); @@ -1680,7 +1707,8 @@ } } - DTRACE("%s returns member %s\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEMarshaller::%s returns member %s\n", __func__, pMember->m_Declarators.First()->GetName().c_str()); return pMember; } diff -ruN p2/l4/tool/dice/src/be/BEMarshaller.h p3/l4/tool/dice/src/be/BEMarshaller.h --- p2/l4/tool/dice/src/be/BEMarshaller.h 2006-06-14 14:24:57.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEMarshaller.h 2006-11-30 10:41:08.000000000 +0100 @@ -32,7 +32,7 @@ #include #include -using namespace std; +using std::vector; class CBETypedDeclarator; class CBEFunction; diff -ruN p2/l4/tool/dice/src/be/BEMsgBuffer.cpp p3/l4/tool/dice/src/be/BEMsgBuffer.cpp --- p2/l4/tool/dice/src/be/BEMsgBuffer.cpp 2006-10-10 14:46:17.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEMsgBuffer.cpp 2006-11-30 10:41:08.000000000 +0100 @@ -53,7 +53,6 @@ #include #include -using namespace std; CBEMsgBuffer::CBEMsgBuffer() : CBETypedef() @@ -104,7 +103,8 @@ CBEMsgBuffer::GetCount(int nFEType, int nDirection) { - DTRACE("%s (%d, %d)\n", __func__, nFEType, nDirection); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s (%d, %d)\n", __func__, nFEType, + nDirection); if (nDirection == 0) { @@ -130,7 +130,7 @@ iter != pStruct->m_Members.end(); iter++) { - DTRACE("testing member %s\n", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "testing member %s\n", (*iter)->m_Declarators.First()->GetName().c_str()); if ((*iter)->GetType()->IsOfType(nFEType)) { @@ -144,7 +144,7 @@ } } - DTRACE("%s returns %d\n", __func__, nCount); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s returns %d\n", __func__, nCount); return nCount; } @@ -167,8 +167,9 @@ CBEFunction *pFunction = GetSpecificParent(); assert(pFunction); - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMsgBuffer::%s (%d, %d) called for mb in %s\n", - __func__, nFEType, nDirection, pFunction->GetName().c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBuffer::%s (%d, %d) called for mb in %s\n", __func__, nFEType, + nDirection, pFunction->GetName().c_str()); bool bInterfaceFunc = (dynamic_cast(pFunction)); // get type @@ -196,7 +197,8 @@ iter != pMsgType->m_UnionCases.end(); iter++) { - DTRACE("%s testing union %s against %s\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s testing union %s against %s\n", __func__, (*iter)->m_Declarators.First()->GetName().c_str(), sName.c_str()); string sUnion = (*iter)->m_Declarators.First()->GetName(); @@ -210,7 +212,8 @@ iterM != pStruct->m_Members.end(); iterM++) { - DTRACE("testing member %s of type %d with %d\n", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "testing member %s of type %d with %d\n", (*iterM)->m_Declarators.First()->GetName().c_str(), (*iterM)->GetType()->GetFEType(), nFEType); if ((*iterM)->GetType()->IsOfType(nFEType)) @@ -225,15 +228,16 @@ } } - DTRACE("Union %s has %d members of type %d\n", sUnion.c_str(), + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "Union %s has %d members of type %d\n", sUnion.c_str(), nCount, nFEType); if (nCount > nMaxCount) nMaxCount = nCount; } } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMsgBuffer::%s returns %d\n", - __func__, nMaxCount); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBuffer::%s returns %d\n", __func__, nMaxCount); return nMaxCount; } @@ -243,9 +247,9 @@ */ void CBEMsgBuffer::CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMsgBuffer::%s(op: %s) called\n", __func__, + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBuffer::%s(op: %s) called\n", __func__, pFEOperation->GetName().c_str()); CBENameFactory *pNF = CCompiler::GetNameFactory(); @@ -255,7 +259,8 @@ CBETypedDeclarator::CreateBackEnd(pType, sName); delete pType; // is cloned in typed decl's create method - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMsgBuffer::%s(op) returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBuffer::%s(op) returns\n", __func__); } /** \brief initialize instance of this class @@ -266,9 +271,9 @@ */ void CBEMsgBuffer::CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMsgBuffer::%s(if: %s) called\n", __func__, + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBuffer::%s(if: %s) called\n", __func__, pFEInterface->GetName().c_str()); CBENameFactory *pNF = CCompiler::GetNameFactory(); @@ -278,7 +283,8 @@ CBETypedef::CreateBackEnd(pType, sName, pFEInterface); delete pType; // is cloned in typed decl's create method - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMsgBuffer::%s(if) returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBuffer::%s(if) returns\n", __func__); } /** \brief creates the type of the message buffer @@ -538,11 +544,13 @@ bool CBEMsgBuffer::AddPlatformSpecificMembers(CBEFunction *pFunction) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMsgBuffer::%s(func: %s) called\n", __func__, + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBuffer::%s(func: %s) called\n", __func__, pFunction->GetName().c_str()); // get RECEIVE structure - DTRACE("Try to get struct for func %s\n", pFunction->GetName().c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "Try to get struct for func %s\n", + pFunction->GetName().c_str()); CBEStructType *pStruct; int nDir = pFunction->GetReceiveDirection(); // if the function's receive direction is OUT then the function should not @@ -550,7 +558,8 @@ ATTR_TYPE nAttr = (nDir == DIRECTION_OUT) ? ATTR_IN : ATTR_OUT; if (!pFunction->m_Attributes.Find(nAttr)) { - DTRACE("func %s does not have attribute %s\n", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "func %s does not have attribute %s\n", pFunction->GetName().c_str(), (nAttr == ATTR_IN) ? "in" : "out"); pStruct = GetStruct(pFunction, nDir); assert(pStruct); @@ -568,7 +577,8 @@ nAttr = (nDir == DIRECTION_IN) ? ATTR_OUT : ATTR_IN; if (!pFunction->m_Attributes.Find(nAttr)) { - DTRACE("func %s does not have attribute %s\n", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "func %s does not have attribute %s\n", pFunction->GetName().c_str(), (nAttr == ATTR_IN) ? "in" : "out"); pStruct = GetStruct(pFunction, nDir); assert(pStruct); @@ -581,7 +591,8 @@ } } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMsgBuffer::%s: return true\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBuffer::%s: return true\n", __func__); return true; } @@ -592,7 +603,8 @@ bool CBEMsgBuffer::AddPlatformSpecificMembers(CBEClass *pClass) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMsgBuffer::%s(class: %s) called\n", __func__, + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBuffer::%s(class: %s) called\n", __func__, pClass->GetName().c_str()); // iterate function groups of class, pick a function and use it to @@ -650,24 +662,26 @@ CBEStructType *pStruct, int nDirection) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMsgBuffer::%s(%s,, %d) called\n", __func__, + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBuffer::%s(%s,, %d) called\n", __func__, pFunction->GetName().c_str(), nDirection); if (!AddOpcodeMember(pFunction, pStruct, nDirection)) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMsgBuffer::%s: could not add opcode\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBuffer::%s: could not add opcode\n", __func__); return false; } if (!AddExceptionMember(pFunction, pStruct, nDirection)) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMsgBuffer::%s: could not add exception\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBuffer::%s: could not add exception\n", __func__); return false; } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMsgBuffer::%s returns true\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBuffer::%s returns true\n", __func__); return true; } @@ -732,7 +746,8 @@ dynamic_cast(pFunction) || dynamic_cast(pFunction)) nFuncExceptionDir = pFunction->GetSendDirection(); - DTRACE("%s exception dir is %d and struct at %p (type at %p)\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s exception dir is %d and struct at %p (type at %p)\n", __func__, nFuncExceptionDir, pStruct, pStruct->GetSpecificParent()); // add exception @@ -744,8 +759,8 @@ CBETypedDeclarator *pException = GetExceptionVariable(); if (!pException) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s failed, because exception could not be created.\n", - __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s failed, because exception could not be created.\n", __func__); return false; } // check if struct already has member with that name @@ -754,7 +769,8 @@ else pStruct->m_Members.Add(pException); - DTRACE("%s exception %sadded to struct %p\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s exception %sadded to struct %p\n", __func__, pStruct->m_Members.Find(pException->m_Declarators.First()->GetName()) ? "" : "not ", pStruct); } @@ -912,7 +928,8 @@ bool CBEMsgBuffer::SortPayload(CBEStructType *pStruct) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "%s called for struct\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "%s called for struct\n", + __func__); CBEMsgBufferType *pType = pStruct->GetSpecificParent(); assert(pType); @@ -972,16 +989,17 @@ { assert(pFirst); assert(pSecond); - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "%s called with (%s, %s)\n", __func__, - pFirst->m_Declarators.First()->GetName().c_str(), + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "%s called with (%s, %s)\n", + __func__, pFirst->m_Declarators.First()->GetName().c_str(), pSecond->m_Declarators.First()->GetName().c_str()); // check variable size bool bVarFirst = pFirst->IsVariableSized(); bool bVarSecond = pSecond->IsVariableSized(); if (bVarFirst && !bVarSecond) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "%s (%s, %s) returns true\n", - __func__, pFirst->m_Declarators.First()->GetName().c_str(), + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "%s (%s, %s) returns true\n", __func__, + pFirst->m_Declarators.First()->GetName().c_str(), pSecond->m_Declarators.First()->GetName().c_str()); return true; } @@ -994,8 +1012,9 @@ if (bVarFirst && bVarSecond && !bConstructedFirst && bConstructedSecond) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "%s (%s, %s) returns true\n", - __func__, pFirst->m_Declarators.First()->GetName().c_str(), + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "%s (%s, %s) returns true\n", __func__, + pFirst->m_Declarators.First()->GetName().c_str(), pSecond->m_Declarators.First()->GetName().c_str()); return true; } @@ -1003,8 +1022,9 @@ // sized parameter, leave it after the first (avoids unnecessary swapping) if (bVarSecond) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "%s (%s, %s) returns true\n", - __func__, pFirst->m_Declarators.First()->GetName().c_str(), + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "%s (%s, %s) returns true\n", __func__, + pFirst->m_Declarators.First()->GetName().c_str(), pSecond->m_Declarators.First()->GetName().c_str()); return false; } @@ -1023,22 +1043,25 @@ } if (nSecondSize > nWordSize) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "%s (%s, %s) returns true\n", - __func__, pFirst->m_Declarators.First()->GetName().c_str(), + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "%s (%s, %s) returns true\n", __func__, + pFirst->m_Declarators.First()->GetName().c_str(), pSecond->m_Declarators.First()->GetName().c_str()); return false; } if (nFirstSize > nWordSize) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "%s (%s, %s) returns true\n", - __func__, pFirst->m_Declarators.First()->GetName().c_str(), + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "%s (%s, %s) returns true\n", __func__, + pFirst->m_Declarators.First()->GetName().c_str(), pSecond->m_Declarators.First()->GetName().c_str()); return true; } if (nFirstSize < nSecondSize) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "%s (%s, %s) returns true\n", - __func__, pFirst->m_Declarators.First()->GetName().c_str(), + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "%s (%s, %s) returns true\n", __func__, + pFirst->m_Declarators.First()->GetName().c_str(), pSecond->m_Declarators.First()->GetName().c_str()); return true; } @@ -1063,7 +1086,8 @@ int nDirection, vector *pStack) { - DTRACE("%s (%s, %s, %d, stack @ %p (%d)) called\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CBEMsgBuffer::%s (%s, %s, %d, stack @ %p (%d)) called\n", __func__, pFile->GetFileName().c_str(), pFunction->GetName().c_str(), nDirection, @@ -1095,8 +1119,9 @@ int nDirection, CBETypedDeclarator* pMember) { - DTRACE("%s (%s, %s, %d, %s) called\n", __func__, - pFile->GetFileName().c_str(), + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CBEMsgBuffer::%s (%s, %s, %d, %s) called\n", + __func__, pFile->GetFileName().c_str(), pFunction->GetName().c_str(), nDirection, pMember->m_Declarators.First()->GetName().c_str()); @@ -1120,7 +1145,8 @@ CBEFunction *pFunction, int nDirection) { - DTRACE("%s (%s, %s, %d) called\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CBEMsgBuffer::%s (%s, %s, %d) called\n", __func__, pFile->GetFileName().c_str(), pFunction->GetName().c_str(), nDirection); @@ -1140,7 +1166,7 @@ string sStructName = pNF->GetMessageBufferStructName(nDirection, sFuncName, sClassName); // write access to message buffer - CBETypedDeclarator *pMsgBufParam = WriteAccessToVariable(pFile, pFunction); + CBETypedDeclarator *pMsgBufParam = WriteAccessToVariable(pFile, pFunction, false); CBEDeclarator *pMsgBufDecl = pMsgBufParam ? pMsgBufParam->m_Declarators.First() : m_Declarators.First(); // if we have a parameter as message buffer, we have to check that's @@ -1159,18 +1185,20 @@ /** \brief writes the access to the variable pointing to the message buffer * \param pFile the file to write to * \param pFunction the function to write the message buffer for + * \param bPointer true if a pointer should be written, if false write as is, + * even if pointer * \return reference to the parameter of the function that is the message * buffer, NULL if no message buffer parameter */ CBETypedDeclarator* CBEMsgBuffer::WriteAccessToVariable(CBEFile *pFile, - CBEFunction *pFunction) + CBEFunction *pFunction, + bool bPointer) { // write access string sName = m_Declarators.First()->GetName(); + bool bHasPointer = HasReference(); CBETypedDeclarator *pMsgBufParam = pFunction->FindParameter(sName); - CBEDeclarator *pMsgBufDecl = pMsgBufParam ? pMsgBufParam->m_Declarators.First() : - m_Declarators.First(); // if this message buffer is not member of a function, then it really is a // typedef and we have to look in the function for a parameter of that @@ -1180,13 +1208,18 @@ pMsgBufParam = pFunction->FindParameterType(sName); if (pMsgBufParam) { - pMsgBufDecl = pMsgBufParam->m_Declarators.First(); - sName = pMsgBufDecl->GetName(); + sName = pMsgBufParam->m_Declarators.First()->GetName(); + bHasPointer = pMsgBufParam->HasReference(); } else - TRACE("STRANGE! no param of type %s in func %s found.\n", + CCompiler::Error("No param of type %s in func %s\n", sName.c_str(), pFunction->GetName().c_str()); } + if (bPointer && (!bHasPointer || + (pMsgBufParam && + pFunction->HasAdditionalReference(pMsgBufParam->m_Declarators.First(), + false)))) + *pFile << "&"; *pFile << sName; return pMsgBufParam; @@ -1299,7 +1332,7 @@ */ CBEStructType* CBEMsgBuffer::GetStruct(CBEFunction *pFunction, - int nDirection) + int nDirection) { assert(pFunction); bool bInterfaceFunc = (dynamic_cast(pFunction)); @@ -1312,8 +1345,9 @@ nDirection = 0; sClassName = string(); } - DTRACE("func name: %s, class name: %s, dir %d, interface-func %s\n", - sFuncName.c_str(), sClassName.c_str(), nDirection, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CBEMsgBuffer::%s: func name: %s, class name: %s, dir %d, interface-func %s\n", + __func__, sFuncName.c_str(), sClassName.c_str(), nDirection, bInterfaceFunc ? "true":"false"); // get type CBEMsgBufferType *pType; @@ -1324,13 +1358,16 @@ assert(pClass); pType = dynamic_cast (pClass->GetMessageBuffer()->GetType()); - DTRACE("class' msgbuf at %p\n", pType); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CBEMsgBuffer::%s class' msgbuf at %p\n", __func__, pType); } else pType = dynamic_cast(GetType()); assert(pType); // get struct - DTRACE("return struct of type at %p (msgbuf type)\n", pType); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CBEMsgBuffer::%s return struct of type at %p (msgbuf type)\n", __func__, + pType); return pType->GetStruct(sFuncName, sClassName, nDirection); } @@ -1351,6 +1388,7 @@ /** \brief writes the initialization of specific members * \param pFile the file to write to + * \param pFunction the function to write for * \param nType the type of the members to initialize * \param nDirection the direction of the struct to initialize * @@ -1359,8 +1397,9 @@ */ void CBEMsgBuffer::WriteInitialization(CBEFile* /*pFile*/, - int /*nType*/, - int /*nDirection*/) + CBEFunction* /*pFunction*/, + int /*nType*/, + int /*nDirection*/) { // FIXME find variable sized members // FIXME allocate memory for message buffer @@ -1373,10 +1412,10 @@ */ CBETypedDeclarator* CBEMsgBuffer::FindMember(string sName, - int nDirection) + int nDirection) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEMsgBuffer::%s(%s, %d) called\n", __func__, - sName.c_str(), nDirection); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEMsgBuffer::%s(%s, %d) called\n", + __func__, sName.c_str(), nDirection); CBEStructType *pStruct = GetStruct(nDirection); if (!pStruct) @@ -1489,19 +1528,19 @@ pFile->IncIndent(); // print four words in one line: // test for begin of wrap-around - *pFile << "\tif (" << sVar << "%%4 == 0)\n"; + *pFile << "\tif (" << sVar << "%4 == 0)\n"; pFile->IncIndent(); - *pFile << "\t" << sFunc << " (\"dwords[%%d]: \", " << sVar << ");\n"; + *pFile << "\t" << sFunc << " (\"dwords[%d]: \", " << sVar << ");\n"; pFile->DecIndent(); // print current word - *pFile << "\t" << sFunc << " (\"%%08x \", ((unsigned long*)("; + *pFile << "\t" << sFunc << " (\"%08x \", ((unsigned long*)("; if (pDecl->GetStars() == 0) *pFile << "&"; *pFile << pDecl->GetName() << "))[" << sVar << "]);\n"; // print newline - *pFile << "\tif (" << sVar << "%%4 == 3)\n"; + *pFile << "\tif (" << sVar << "%4 == 3)\n"; pFile->IncIndent(); *pFile << "\t" << sFunc << " (\"\\n\");\n"; pFile->DecIndent(); @@ -1519,7 +1558,6 @@ void CBEMsgBuffer::PostCreate(CBEFunction *pFunction, CFEOperation *pFEOperation) - throw (CBECreateException*) { string exc = string(__func__); if (!AddGenericStruct(pFunction, pFEOperation)) @@ -1528,8 +1566,8 @@ exc += " function " + pFunction->GetName() + "."; throw new CBECreateException(exc); } - DTRACE("%s calling Pad for func %s\n", __func__, - pFunction->GetName().c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s calling Pad for func %s\n", + __func__, pFunction->GetName().c_str()); if (!Pad()) { exc += " failed, because could not pad message buffer."; @@ -1545,7 +1583,6 @@ void CBEMsgBuffer::PostCreate(CBEClass *pClass, CFEInterface *pFEInterface) - throw (CBECreateException*) { string exc = string(__func__); if (!AddGenericStruct(pClass, pFEInterface)) @@ -1554,8 +1591,8 @@ exc += " class " + pClass->GetName() + "."; throw new CBECreateException(exc); } - DTRACE("%s calling Pad for class %s\n", __func__, - pClass->GetName().c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s calling Pad for class %s\n", + __func__, pClass->GetName().c_str()); if (!Pad()) { exc += " failed, because could not pad message buffer."; @@ -1573,7 +1610,7 @@ int CBEMsgBuffer::GetWordMemberCountFunction() { - DTRACE("%s() called\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s() called\n", __func__); CBEType *pType = GetType(); if (!pType) return 0; @@ -1596,17 +1633,19 @@ int CBEMsgBuffer::GetWordMemberCountClass() { - DTRACE("%s() called\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s() called\n", __func__); CBEType *pType = GetType(); if (!pType) return 0; - DTRACE("%s: type is %d\n", __func__, pType->GetFEType()); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s: type is %d\n", __func__, + pType->GetFEType()); int ret = pType->GetSize(); if (ret < 0) ret = pType->GetMaxSize(); // calculate words from bytes CBESizes *pSizes = CCompiler::GetSizes(); - DTRACE("%s returns words-from-bytes(%d)\n", __func__, ret); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s returns words-from-bytes(%d)\n", + __func__, ret); ret = pSizes->WordsFromBytes(pSizes->WordRoundUp(ret)); return ret; } @@ -1701,8 +1740,8 @@ e->Print(); delete e; - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s failed, because word type could not be created.\n", - __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s failed, because word type could not be created.\n", __func__); return 0; } CBETypedDeclarator *pWordMember = pCF->GetNewTypedDeclarator(); @@ -1717,8 +1756,8 @@ e->Print(); delete e; - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s failed, because word member could not be created.\n", - __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s failed, because word member could not be created.\n", __func__); return 0; } delete pType; // cloned in CBETypedDeclarator::CreateBackEnd @@ -1738,7 +1777,8 @@ e->Print(); delete e; - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s failed, because array dimension couldn't be created.\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s failed, because array dimension couldn't be created.\n", __func__); return false; } @@ -1758,8 +1798,9 @@ e->Print(); delete e; - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s failed, because IN attribute could not be created.\n", - __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s failed, because IN attribute could not be created.\n", + __func__); return 0; } pWordMember->m_Attributes.Add(pAttr); @@ -1777,8 +1818,9 @@ e->Print(); delete e; - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s failed, because OUT attribute could not be created.\n", - __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s failed, because OUT attribute could not be created.\n", + __func__); return 0; } pWordMember->m_Attributes.Add(pAttr); @@ -1901,7 +1943,7 @@ CBEMsgBuffer::GetMemberSize(int nType) { int nMaxSize = 0; - DTRACE("%s(%d) called\n", __func__, nType); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s(%d) called\n", __func__, nType); // iterate over structs of type and get refstring numbers of each struct CBEMsgBufferType *pType = dynamic_cast(GetType()); @@ -1913,14 +1955,16 @@ iterS != pType->m_UnionCases.end(); iterS++) { - DTRACE("%s: %d. union (%s)\n", __func__, ++c, typeid(*(*iterS)).name()); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s: %d. union (%s)\n", __func__, + ++c, typeid(*(*iterS)).name()); CBEStructType *pStruct = dynamic_cast((*iterS)->GetType()); if (!pStruct) continue; int nSize = 0; - DTRACE("%s: iterate members of struct\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s: iterate members of struct\n", + __func__); vector::iterator iterP; for (iterP = pType->GetStartOfPayload(pStruct); iterP != pStruct->m_Members.end(); @@ -1936,14 +1980,15 @@ nSize = (nSize + (nTypeSize - 1)) / nTypeSize; } - DTRACE("%s: size of current struct is %d (max is %d)\n", __func__, - nSize, nMaxSize); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s: size of current struct is %d (max is %d)\n", __func__, nSize, + nMaxSize); if (nSize > nMaxSize) nMaxSize = nSize; } - DTRACE("%s returns %d\n", __func__, nMaxSize); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s returns %d\n", __func__, nMaxSize); return nMaxSize; } @@ -1964,12 +2009,13 @@ bool bMax) { int nSize = 0; - DTRACE("%s (%d, %s, %d, %s) called\n", __func__, nType, - pFunction->GetName().c_str(), nDirection, bMax ? "true" : "false"); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s (%d, %s, %d, %s) called\n", + __func__, nType, pFunction->GetName().c_str(), nDirection, + bMax ? "true" : "false"); CBEStructType *pStruct = GetStruct(pFunction, nDirection); assert(pStruct); - DTRACE("%s: struct at %p\n", __func__, pStruct); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s: struct at %p\n", __func__, pStruct); CBEMsgBufferType *pType = pStruct->GetSpecificParent(); assert(pType); @@ -1979,9 +2025,8 @@ iter++) { int nMemberSize = GetMemberSize(nType, *iter, bMax); - DTRACE("%s size of member %s is %d\n", __func__, - (*iter)->m_Declarators.First()->GetName().c_str(), - nMemberSize); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s size of member %s is %d\n", + __func__, (*iter)->m_Declarators.First()->GetName().c_str(), nMemberSize); // if member with variable size, return variable size if (nMemberSize < 0) return -1; @@ -1994,10 +2039,11 @@ int nTypeSize = pSizes->GetSizeOfType(nType); assert(nTypeSize > 0); nSize = (nSize + (nTypeSize - 1)) / nTypeSize; - DTRACE("%s aligned size to type -> %d\n", __func__, nSize); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s aligned size to type -> %d\n", + __func__, nSize); } - DTRACE("%s returns %d\n", __func__, nSize); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s returns %d\n", __func__, nSize); return nSize; } @@ -2015,16 +2061,10 @@ int nMemberSize = 0; // if we count anything (0) or in word size, then add the size of the // member in bytes - if ((nType == 0) || (nType == TYPE_MWORD)) - { - if (bMax) - pMember->GetMaxSize(true, nMemberSize); - else - nMemberSize = pMember->GetSize(); - } - else if (pMember->GetType()->IsOfType(nType)) + // or: if the member is of the requested type, add its size + if ((nType == 0) || (nType == TYPE_MWORD) || + pMember->GetType()->IsOfType(nType)) { - // or: if the member is of the requested type, add its size if (bMax) pMember->GetMaxSize(true, nMemberSize); else diff -ruN p2/l4/tool/dice/src/be/BEMsgBuffer.h p3/l4/tool/dice/src/be/BEMsgBuffer.h --- p2/l4/tool/dice/src/be/BEMsgBuffer.h 2006-08-08 13:20:06.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEMsgBuffer.h 2006-11-30 10:41:08.000000000 +0100 @@ -64,14 +64,10 @@ virtual int GetCountAll(int nFEType, int nDirection); virtual int GetPayloadOffset(); - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); - virtual void CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*); - virtual void PostCreate(CBEClass *pClass, CFEInterface *pFEInterface) - throw (CBECreateException*); - virtual void PostCreate(CBEFunction *pFunction, CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); + virtual void CreateBackEnd(CFEInterface *pFEInterface); + virtual void PostCreate(CBEClass *pClass, CFEInterface *pFEInterface); + virtual void PostCreate(CBEFunction *pFunction, CFEOperation *pFEOperation); virtual bool AddReturnVariable(CBEFunction *pFunction, CBETypedDeclarator *pReturn = 0); @@ -90,9 +86,9 @@ void WriteAccessToStruct(CBEFile *pFile, CBEFunction *pFunction, int nDirection); CBETypedDeclarator* WriteAccessToVariable(CBEFile *pFile, - CBEFunction *pFunction); - virtual void WriteInitialization(CBEFile *pFile, int nType = 0, - int nDirection = 0); + CBEFunction *pFunction, bool bPointer); + virtual void WriteInitialization(CBEFile *pFile, CBEFunction *pFunction, + int nType, int nDirection); virtual void WriteDump(CBEFile *pFile); virtual bool HasProperty(int nProperty, int nDirection); diff -ruN p2/l4/tool/dice/src/be/BEMsgBufferType.cpp p3/l4/tool/dice/src/be/BEMsgBufferType.cpp --- p2/l4/tool/dice/src/be/BEMsgBufferType.cpp 2006-10-17 14:23:45.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEMsgBufferType.cpp 2006-11-30 10:41:08.000000000 +0100 @@ -53,7 +53,6 @@ #include #include -using namespace std; CBEMsgBufferType::CBEMsgBufferType() : CBEUnionType() @@ -74,10 +73,9 @@ */ void CBEMsgBufferType::CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s(fe-op) called\n", - __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s(fe-op) called\n", __func__); CBEUnionType::CreateBackEnd(string()); @@ -87,8 +85,8 @@ AddStruct(pFEOperation, pFunction->GetSendDirection()); AddStruct(pFEOperation, pFunction->GetReceiveDirection()); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s(fe-op) returns\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s(fe-op) returns\n", __func__); } /** \brief initialize instance of this class @@ -117,20 +115,20 @@ */ void CBEMsgBufferType::CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s(fe-if) called\n", - __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s(fe-if) called\n", __func__); // get tag CBENameFactory *pNF = CCompiler::GetNameFactory(); string sTag = pNF->GetMessageBufferTypeName(pFEInterface); + sTag = pNF->GetTypeName(pFEInterface, sTag); CBEUnionType::CreateBackEnd(sTag); AddStruct(pFEInterface); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s(fe-if) called\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s(fe-if) called\n", __func__); } /** \brief adds the structs of an interface @@ -141,7 +139,6 @@ */ void CBEMsgBufferType::AddStruct(CFEInterface *pFEInterface) - throw (CBECreateException*) { CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s(fe-if) called\n", __func__); @@ -191,7 +188,6 @@ void CBEMsgBufferType::AddStruct(CFEOperation *pFEOperation, int nDirection) - throw (CBECreateException*) { string exc = string(__func__); @@ -209,7 +205,7 @@ } catch (CBECreateException *e) { - m_UnionCases.Remove(pCase); + m_UnionCases.Remove(pCase); delete pType; delete pCase; e->Print(); @@ -232,7 +228,7 @@ } catch (CBECreateException *e) { - m_UnionCases.Remove(pCase); + m_UnionCases.Remove(pCase); delete pType; delete pCase; e->Print(); @@ -276,9 +272,9 @@ void CBEMsgBufferType::AddElements(CFEOperation *pFEOperation, int nDirection) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s called for %s\n", __func__, + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s called for %s\n", __func__, pFEOperation->GetName().c_str()); vector::iterator iter; @@ -318,9 +314,9 @@ void CBEMsgBufferType::AddElement(CFETypedDeclarator *pFEParameter, int nDirection) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s called\n", __func__); assert(pFEParameter); // get struct @@ -349,8 +345,8 @@ // not have OUT parameters. At this point we simply return. if (!pOriginal) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s returns (no orig)\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s returns (no orig)\n", __func__); return; } // clone it @@ -370,7 +366,8 @@ AddElement(pStruct, pParameter); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s returns\n", __func__); } /** \brief really add the element to the struct and do all the init work @@ -380,9 +377,9 @@ void CBEMsgBufferType::AddElement(CBEStructType *pStruct, CBETypedDeclarator *pParameter) - throw(CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s for param %s called\n", + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s for param %s called\n", __func__, pParameter->m_Declarators.First()->GetName().c_str()); // if there is a transmit_as attribute, replace the type @@ -427,13 +424,15 @@ // add to struct pStruct->m_Members.Add(pParameter); - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s member %s added to struct\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s member %s added to struct\n", __func__, pParameter->m_Declarators.First()->GetName().c_str()); // if variable sized, check size_is/length_is attribute if (pParameter->IsVariableSized()) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s param %s is var sized\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s param %s is var sized\n", __func__, pParameter->m_Declarators.First()->GetName().c_str()); // get function CBEFunction *pFunction = GetSpecificParent(); @@ -460,7 +459,8 @@ delete pLoc; } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s returns\n", __func__); } /** \brief adds a word sized member struct containing no members yet @@ -489,13 +489,14 @@ } catch (CBECreateException *e) { - m_UnionCases.Remove(pCase); - delete pType; + m_UnionCases.Remove(pCase); + delete pType; delete pCase; e->Print(); delete e; - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s failed, because generic struct could not be created\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, +"CBEMsgBufferType::%s failed, because generic struct could not be created\n", __func__); return false; } @@ -519,7 +520,8 @@ string sClassName, int nDirection) { - DTRACE("%s called for func %s, class %s and %d\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s called for func %s, class %s and %d\n", __func__, sFuncName.c_str(), sClassName.c_str(), nDirection); CBENameFactory *pNF = CCompiler::GetNameFactory(); @@ -532,13 +534,15 @@ iter != m_UnionCases.end(); iter++) { - DTRACE("%s testing union %s against %s\n", __func__, - (*iter)->m_Declarators.First()->GetName().c_str(), + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CBEMsgBufferType::%s testing union %s against %s\n", + __func__, (*iter)->m_Declarators.First()->GetName().c_str(), sFuncName.c_str()); if ((*iter)->m_Declarators.First()->GetName() == sFuncName) return (CBEStructType*)(*iter)->GetType(); - DTRACE("%s testing union %s against %s\n", __func__, - (*iter)->m_Declarators.First()->GetName().c_str(), + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CBEMsgBufferType::%s testing union %s against %s\n", + __func__, (*iter)->m_Declarators.First()->GetName().c_str(), sName.c_str()); if ((*iter)->m_Declarators.First()->GetName() == sName) return (CBEStructType*)(*iter)->GetType(); @@ -559,11 +563,11 @@ void CBEMsgBufferType::FlattenElement(CBETypedDeclarator *pParameter, CBEStructType *pStruct) - throw(CBECreateException*) { CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s(param: %s, struct: %p) called\n", - __func__, pParameter->m_Declarators.First()->GetName().c_str(), pStruct); + __func__, pParameter->m_Declarators.First()->GetName().c_str(), + pStruct); // check out if the parent of the message buffer (a function) is at the // client or server side. At the server side this message buffer is @@ -587,7 +591,8 @@ pDecl->SetStars(0); // if IN, simple type, stars, and NO pointer or size attributes, // erase pointers - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s stars now %d, %s,%s,%s,%s\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s stars now %d, %s,%s,%s,%s\n", __func__, pDecl->GetStars(), pParameter->GetType()->IsSimpleType() ? "Simple Type" : "", pParameter->m_Attributes.Find(ATTR_SIZE_IS) ? "SIZE" : "", @@ -602,8 +607,8 @@ (pParameter->m_Attributes.Find(ATTR_MAX_IS) != 0))) { pDecl->SetStars(0); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s stars to 0, returns\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s stars to 0, returns\n", __func__); return; } // if string, check for max_is and set it as array boundary. Also set type @@ -611,8 +616,8 @@ CBEClassFactory *pCF = CCompiler::GetClassFactory(); if (pParameter->IsString()) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s is string\n", - __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s is string\n", __func__); string exc = string(__func__); // check for max_is CBEAttribute *pAttr = pParameter->m_Attributes.Find(ATTR_MAX_IS); @@ -665,8 +670,8 @@ // return here, because the following is not done concurrently with // this branch - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s strings done, returns\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s strings done, returns\n", __func__); return; } @@ -844,7 +849,8 @@ __func__); pType = pUserType->GetRealType(); - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s user-type %p, real %p\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s user-type %p, real %p\n", __func__, pUserType, pType); // the new type should be different from the previous (GetRealType // returns NULL if not) @@ -883,12 +889,12 @@ CBEMsgBufferType::FlattenConstructedElement(CBETypedDeclarator *pParameter, vector *pStack, CBEStructType *pStruct) - throw (CBECreateException*) { assert (pParameter); assert (pStack); - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s(%s, stack) called\n", + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s(%s, stack) called\n", __func__, pParameter->m_Declarators.First()->GetName().c_str()); if (pParameter->GetType()->IsSimpleType()) @@ -901,7 +907,8 @@ return; } - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s found var sized member\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s found var sized member\n", __func__); // FIXME: found the variable sized member, create new member of fixed @@ -921,7 +928,8 @@ FlattenElement(pMember, pStruct); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEMsgBufferType::%s returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEMsgBufferType::%s returns\n", __func__); return; } @@ -1006,18 +1014,21 @@ assert(pMsgBuffer); // GetPayloadOffset is in bytes int nPayloadOffset = pMsgBuffer->GetPayloadOffset(); - DTRACE("%s called. start at offset %d\n", __func__, nPayloadOffset); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s called. start at offset %d\n", + __func__, nPayloadOffset); vector::iterator iter; for (iter = pStruct->m_Members.begin(); iter != pStruct->m_Members.end() && nPayloadOffset > 0; iter++) { - DTRACE("%s taking off %d the size of %s (%d)\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s taking off %d the size of %s (%d)\n", __func__, nPayloadOffset, (*iter)->m_Declarators.First()->GetName().c_str(), (*iter)->GetSize()); nPayloadOffset -= (*iter)->GetSize(); } - DTRACE("%s returning iterator pointing after %s\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s returning iterator pointing after %s\n", __func__, ((iter != pStruct->m_Members.end()) && (*iter)) ? (*iter)->m_Declarators.First()->GetName().c_str() : "(begin)"); return iter; @@ -1039,7 +1050,6 @@ int nDirection, string sFunctionName, string sClassName) - throw (CBECreateException*) { CBEClassFactory *pCF = CCompiler::GetClassFactory(); // clone struct type @@ -1058,7 +1068,7 @@ } catch (CBECreateException *e) { - m_UnionCases.Remove(pCase); + m_UnionCases.Remove(pCase); delete pCase; delete pType; e->Print(); @@ -1220,7 +1230,8 @@ CBEDeclarator *pNew = static_cast( pSizeVar->m_Declarators.First()->Clone()); pAttr->CreateBackEndIs(ATTR_SIZE_IS, pNew); - DTRACE("%s: size_is attribute %s added to %s\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s: size_is attribute %s added to %s\n", __func__, pNew->GetName().c_str(), pParameter->m_Declarators.First()->GetName().c_str()); } @@ -1238,7 +1249,8 @@ pParameter->m_Attributes.Add(pAttr); pAttr = static_cast(pAttr->Clone()); pTrueParameter->m_Attributes.Add(pAttr); - DTRACE("%s size_is attribute added to member and true param\n", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s size_is attribute added to member and true param\n", __func__); // clone member pMember = static_cast( @@ -1305,7 +1317,8 @@ CBEDeclarator *pNew = static_cast( pSizeVar->m_Declarators.First()->Clone()); pAttr->CreateBackEndIs(ATTR_SIZE_IS, pNew); - DTRACE("%s: size_is attributbute %s added to %s\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s: size_is attributbute %s added to %s\n", __func__, pNew->GetName().c_str(), pParameter->m_Declarators.First()->GetName().c_str()); } diff -ruN p2/l4/tool/dice/src/be/BEMsgBufferType.h p3/l4/tool/dice/src/be/BEMsgBufferType.h --- p2/l4/tool/dice/src/be/BEMsgBufferType.h 2006-10-10 14:46:17.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEMsgBufferType.h 2006-11-30 10:41:08.000000000 +0100 @@ -62,10 +62,8 @@ virtual CObject* Clone() { return new CBEMsgBufferType(*this); } - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); - virtual void CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); + virtual void CreateBackEnd(CFEInterface *pFEInterface); CBEStructType* GetStruct(string sFuncName, string sClassName, int nDirection); vector::iterator @@ -74,27 +72,17 @@ virtual bool AddGenericStruct(CFEBase *pFERefObj); protected: - void AddStruct(CFEOperation *pFEOperation, int nDirection) - throw (CBECreateException*); - void AddStruct(CFEInterface *pFEInterface) - throw (CBECreateException*); - void AddStruct(CBEStructType *pStruct, int nDirection, - string sFunctionName, string sClassName) - throw (CBECreateException*); - virtual void AddElements(CFEOperation *pFEOperation, int nDirection) - throw (CBECreateException*); - virtual void AddElement(CFETypedDeclarator *pFEParameter, int nDirection) - throw (CBECreateException*); - virtual void AddElement(CBEStructType *pStruct, - CBETypedDeclarator *pParameter) - throw(CBECreateException*); - virtual void FlattenElement(CBETypedDeclarator *pParameter, - CBEStructType *pStruct) - throw (CBECreateException*); + void AddStruct(CFEOperation *pFEOperation, int nDirection); + void AddStruct(CFEInterface *pFEInterface); + void AddStruct(CBEStructType *pStruct, int nDirection, string sFunctionName, + string sClassName); + virtual void AddElements(CFEOperation *pFEOperation, int nDirection); + virtual void AddElement(CFETypedDeclarator *pFEParameter, int nDirection); + virtual void AddElement(CBEStructType *pStruct, CBETypedDeclarator *pParameter); + virtual void FlattenElement(CBETypedDeclarator *pParameter, + CBEStructType *pStruct); virtual void FlattenConstructedElement(CBETypedDeclarator *pParameter, - vector *pStack, - CBEStructType *pStruct) - throw (CBECreateException*); + vector *pStack, CBEStructType *pStruct); void CheckElementForString(CBETypedDeclarator *pParameter, CBEFunction *pFunction, CBEStructType *pStruct, vector *pStack); diff -ruN p2/l4/tool/dice/src/be/BENameFactory.cpp p3/l4/tool/dice/src/be/BENameFactory.cpp --- p2/l4/tool/dice/src/be/BENameFactory.cpp 2006-10-10 14:55:35.000000000 +0200 +++ p3/l4/tool/dice/src/be/BENameFactory.cpp 2006-11-30 10:41:08.000000000 +0100 @@ -47,7 +47,6 @@ #include #include #include -using namespace std; CBENameFactory::CBENameFactory() { @@ -73,12 +72,13 @@ CBENameFactory::GetFileName(CFEBase * pFEBase, FILE_TYPE nFileType) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBENameFactory::%s called\n", + __func__); if (!pFEBase) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s failed because front-end class is 0\n", - __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBENameFactory::%s failed because front-end class is 0\n", __func__); return string(); } @@ -95,7 +95,8 @@ sReturn = sPrefix; sReturn += pFEFile->GetFileName(); // deliver filename - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s(%s, filetype: %d) = %s (!IDL file)\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBENameFactory::%s(%s, filetype: %d) = %s (!IDL file)\n", __func__, typeid(*pFEBase).name(), nFileType, sReturn.c_str()); @@ -113,7 +114,7 @@ if (!pFEFile) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, - "%s failed because filetype required CFEFile and it wasn't\n", + "CBENameFactory::%s failed because filetype required CFEFile and it wasn't\n", __func__); return string(); } @@ -162,7 +163,8 @@ default: break; } - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s(%s, filetype: %d) = %s (header, opcode)\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBENameFactory::%s(%s, filetype: %d) = %s (header, opcode)\n", __func__, typeid(*pFEBase).name(), nFileType, sReturn.c_str()); return sReturn; } @@ -175,7 +177,7 @@ if (!pFEFile) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, - "%s failed because PROGRAM_FILE_IDLFILE/ALL and not CFEFile\n", + "CBENameFactory::%s failed because PROGRAM_FILE_IDLFILE/ALL and not CFEFile\n", __func__); return string(); } @@ -201,7 +203,7 @@ if (!dynamic_cast(pFEBase)) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, - "%s failed because PROGRAM_FILE_MODULE and not CFELibrary\n", + "CBENameFactory::%s failed because PROGRAM_FILE_MODULE and not CFELibrary\n", __func__); return string(); } @@ -233,7 +235,7 @@ if (!dynamic_cast(pFEBase)) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, - "%s failed because PROGRAM_FILE_INTERFACE and not CFEInterface\n", +"CBENameFactory::%s failed because PROGRAM_FILE_INTERFACE and not CFEInterface\n", __func__); return string(); } @@ -277,7 +279,7 @@ if (!dynamic_cast(pFEBase)) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, - "%s failed because PROGRAM_FILE_FUNCTION and not CFEOperation\n", +"CBENameFactory::%s failed because PROGRAM_FILE_FUNCTION and not CFEOperation\n", __func__); return string(); } @@ -310,7 +312,8 @@ else sReturn += ".c"; } - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s(%s, filetype: %d) = %s\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBENameFactory::%s(%s, filetype: %d) = %s\n", __func__, typeid(*pFEBase).name(), nFileType, sReturn.c_str()); return sReturn; } @@ -481,7 +484,7 @@ * This function skips types, which it won't provide names for. This way the * GetTypeName function will set the name for it. */ - string +string CBENameFactory::GetTypeName(int nType, bool bUnsigned, int nSize) @@ -606,7 +609,7 @@ sReturn = "_UNDEFINED_2"; break; case TYPE_USER_DEFINED: - sReturn.erase(sReturn.begin(), sReturn.end()); + sReturn.clear(); break; case TYPE_EXCEPTION: sReturn = "dice_CORBA_exception_type"; @@ -1317,9 +1320,6 @@ string CBENameFactory::GetMessageBufferStructName(int nDirection, string sFuncName, string sClassName) { -// DTRACE("%s(%d, %s, %s) called\n", __func__, nDirection, -// sFuncName.c_str(), sClassName.c_str()); - string sReturn; assert((sFuncName.empty() && sClassName.empty()) || (!sFuncName.empty() && !sClassName.empty())); diff -ruN p2/l4/tool/dice/src/be/BENameFactory.h p3/l4/tool/dice/src/be/BENameFactory.h --- p2/l4/tool/dice/src/be/BENameFactory.h 2006-08-21 16:46:36.000000000 +0200 +++ p3/l4/tool/dice/src/be/BENameFactory.h 2006-11-30 10:41:08.000000000 +0100 @@ -32,6 +32,8 @@ #include "BEObject.h" #include "BEContext.h" // for FILE_TYPE +#include +using std::vector; class CFEBase; class CFEInterface; @@ -42,9 +44,6 @@ class CBEClass; class CDeclaratorStackLocation; -#include -using namespace std; - /** \class CBENameFactory * \ingroup backend * \brief the name factory for the back-end classes diff -ruN p2/l4/tool/dice/src/be/BENameSpace.cpp p3/l4/tool/dice/src/be/BENameSpace.cpp --- p2/l4/tool/dice/src/be/BENameSpace.cpp 2006-10-10 16:08:40.000000000 +0200 +++ p3/l4/tool/dice/src/be/BENameSpace.cpp 2006-11-30 10:41:08.000000000 +0100 @@ -47,7 +47,6 @@ #include "fe/FEConstructedType.h" #include "fe/FEIdentifier.h" #include -using namespace std; CBENameSpace::CBENameSpace() : m_Constants(0, this), @@ -59,10 +58,6 @@ { } -/** destructs the class class */ -CBENameSpace::~CBENameSpace() -{ } - /** \brief searches for a specific Class * \param sClassName the name of the Class * \return a reference to the Class or 0 if not found @@ -114,7 +109,6 @@ * defined mulitple times including different interfaces and such. */ void CBENameSpace::CreateBackEnd(CFELibrary *pFELibrary) - throw (CBECreateException*) { assert(pFELibrary); @@ -197,7 +191,7 @@ } catch (CBECreateException *e) { - m_NestedNamespaces.Remove(pNameSpace); + m_NestedNamespaces.Remove(pNameSpace); throw; } } @@ -252,7 +246,7 @@ } catch (CBECreateException *e) { - m_NestedNamespaces.Remove(pNameSpace); + m_NestedNamespaces.Remove(pNameSpace); throw; } } @@ -271,7 +265,6 @@ */ void CBENameSpace::CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*) { CBEClass *pClass = 0; // check if class already exists @@ -289,7 +282,7 @@ } catch (CBECreateException *e) { - m_Classes.Remove(pClass); + m_Classes.Remove(pClass); delete pClass; e->Print(); delete e; @@ -310,7 +303,6 @@ */ void CBENameSpace::CreateBackEnd(CFEConstDeclarator *pFEConstant) - throw (CBECreateException*) { CBEConstant *pConstant = CCompiler::GetClassFactory()->GetNewConstant(); m_Constants.Add(pConstant); @@ -320,7 +312,7 @@ } catch (CBECreateException *e) { - m_Constants.Remove(pConstant); + m_Constants.Remove(pConstant); delete pConstant; e->Print(); delete e; @@ -338,7 +330,6 @@ */ void CBENameSpace::CreateBackEnd(CFETypedDeclarator *pFETypedef) - throw (CBECreateException*) { CBETypedef *pTypedef = CCompiler::GetClassFactory()->GetNewTypedef(); m_Typedefs.Add(pTypedef); @@ -349,7 +340,7 @@ } catch (CBECreateException *e) { - m_Typedefs.Remove(pTypedef); + m_Typedefs.Remove(pTypedef); delete pTypedef; e->Print(); delete e; @@ -366,7 +357,6 @@ */ void CBENameSpace::CreateBackEnd(CFEAttribute *pFEAttribute) - throw (CBECreateException*) { CBEAttribute *pAttribute = CCompiler::GetClassFactory()->GetNewAttribute(); m_Attributes.Add(pAttribute); @@ -376,7 +366,7 @@ } catch (CBECreateException *e) { - m_Attributes.Remove(pAttribute); + m_Attributes.Remove(pAttribute); delete pAttribute; e->Print(); delete e; @@ -744,16 +734,16 @@ CBEFunction* CBENameSpace::FindFunction(string sFunctionName, FUNCTION_TYPE nFunctionType) { - CBEFunction *pFunction; - DTRACE("%s (sFunctionName: %s) called\n", __func__, - sFunctionName.c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s (sFunctionName: %s) called\n", + __func__, sFunctionName.c_str()); + CBEFunction *pFunction; vector::iterator iterC; for (iterC = m_Classes.begin(); iterC != m_Classes.end(); iterC++) { - DTRACE("%s checking class %s\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s checking class %s\n", __func__, (*iterC)->GetName().c_str()); if ((pFunction = (*iterC)->FindFunction(sFunctionName, nFunctionType)) != 0) @@ -765,8 +755,8 @@ iterN != m_NestedNamespaces.end(); iterN++) { - DTRACE("%s checking nested namespace %s\n", __func__, - (*iterN)->GetName().c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s checking nested namespace %s\n", + __func__, (*iterN)->GetName().c_str()); if ((pFunction = (*iterN)->FindFunction(sFunctionName, nFunctionType)) != 0) return pFunction; @@ -781,12 +771,14 @@ */ CBETypedef* CBENameSpace::FindTypedef(string sTypeName) { - DTRACE("%s (%s) called\n", __func__, sTypeName.c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s (%s) called\n", __func__, + sTypeName.c_str()); CBETypedef *pTypedef = m_Typedefs.Find(sTypeName); if (pTypedef) { - DTRACE("%s: typedef found in namespace, return %p\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s: typedef found in namespace, return %p\n", __func__, pTypedef); return pTypedef; } @@ -797,8 +789,8 @@ iterC != m_Classes.end(); iterC++) { - DTRACE("%s: checking class %s\n", __func__, - (*iterC)->GetName().c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s: checking class %s\n", + __func__, (*iterC)->GetName().c_str()); if ((pTypedDecl = (*iterC)->FindTypedef(sTypeName)) != 0) if (dynamic_cast(pTypedDecl)) return (CBETypedef*)pTypedDecl; @@ -809,13 +801,14 @@ iterN != m_NestedNamespaces.end(); iterN++) { - DTRACE("%s: checking namespace %s\n", __func__, - (*iterN)->GetName().c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s: checking namespace %s\n", + __func__, (*iterN)->GetName().c_str()); if ((pTypedef = (*iterN)->FindTypedef(sTypeName)) != 0) return pTypedef; } - DTRACE("%s: no typedef found, return 0\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: no typedef found, return 0\n", + __func__); return 0; } @@ -929,7 +922,6 @@ */ void CBENameSpace::CreateBackEnd(CFEConstructedType *pFEType) - throw (CBECreateException*) { CBEClassFactory *pCF = CCompiler::GetClassFactory(); CBEType *pType = pCF->GetNewType(pFEType->GetType()); @@ -941,7 +933,7 @@ } catch (CBECreateException *e) { - m_TypeDeclarations.Remove(pType); + m_TypeDeclarations.Remove(pType); delete pType; e->Print(); delete e; @@ -990,8 +982,7 @@ void CBENameSpace::CreateOrderedElementList(void) { // clear vector - m_vOrderedElements.erase(m_vOrderedElements.begin(), - m_vOrderedElements.end()); + m_vOrderedElements.clear(); // namespaces vector::iterator iterN; for (iterN = m_NestedNamespaces.begin(); @@ -1049,18 +1040,12 @@ { if ((*iter)->GetSourceLine() > nLine) { -// TRACE("Insert element from %s:%d before element from %s:%d\n", -// pObj->GetSourceFileName().c_str(), pObj->GetSourceLine(), -// (*iter)->GetSourceFileName().c_str(), -// (*iter)->GetSourceLine()); // insert before that element m_vOrderedElements.insert(iter, pObj); return; } } // new object is bigger that all existing -// TRACE("Insert element from %s:%d at end\n", -// pObj->GetSourceFileName().c_str(), pObj->GetSourceLine()); m_vOrderedElements.push_back(pObj); } diff -ruN p2/l4/tool/dice/src/be/BENameSpace.h p3/l4/tool/dice/src/be/BENameSpace.h --- p2/l4/tool/dice/src/be/BENameSpace.h 2006-08-21 16:46:37.000000000 +0200 +++ p3/l4/tool/dice/src/be/BENameSpace.h 2006-11-30 10:41:09.000000000 +0100 @@ -35,7 +35,6 @@ #include "BEContext.h" // FUNCTION_TYPE #include "template.h" #include -using namespace std; class CBEAttribute; class CBEConstant; @@ -63,11 +62,9 @@ public: /** creates an instance of the namespace class */ CBENameSpace(); - ~CBENameSpace(); public: // Public methods - virtual void CreateBackEnd(CFELibrary *pFELibrary) - throw (CBECreateException*); + virtual void CreateBackEnd(CFELibrary *pFELibrary); virtual bool AddToFile(CBEHeaderFile *pHeader); virtual bool AddToFile(CBEImplementationFile *pImpl); @@ -105,16 +102,11 @@ virtual bool HasFunctionWithUserType(string sTypeName, CBEFile *pFile); protected: // Protected methods - virtual void CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*); - virtual void CreateBackEnd(CFETypedDeclarator *pFETypedef) - throw (CBECreateException*); - virtual void CreateBackEnd(CFEConstDeclarator *pFEConstant) - throw (CBECreateException*); - virtual void CreateBackEnd(CFEConstructedType *pFEType) - throw (CBECreateException*); - virtual void CreateBackEnd(CFEAttribute *pFEAttribute) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEInterface *pFEInterface); + virtual void CreateBackEnd(CFETypedDeclarator *pFETypedef); + virtual void CreateBackEnd(CFEConstDeclarator *pFEConstant); + virtual void CreateBackEnd(CFEConstructedType *pFEType); + virtual void CreateBackEnd(CFEAttribute *pFEAttribute); virtual void WriteConstant(CBEConstant *pConstant, CBEHeaderFile *pFile); virtual void WriteNameSpace(CBENameSpace *pNameSpace, CBEImplementationFile *pFile); diff -ruN p2/l4/tool/dice/src/be/BEObject.cpp p3/l4/tool/dice/src/be/BEObject.cpp --- p2/l4/tool/dice/src/be/BEObject.cpp 2006-08-23 19:27:57.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEObject.cpp 2006-11-30 10:41:09.000000000 +0100 @@ -43,7 +43,6 @@ #include "fe/FEInterface.h" #include "fe/FEOperation.h" #include -using namespace std; ///////////////////////////////////////////////////////////////////////////// // Base class @@ -53,20 +52,17 @@ : CObject(pParent), m_sTargetHeader(), m_sTargetImplementation() -{ -} +{ } CBEObject::CBEObject(CBEObject & src) : CObject(src), m_sTargetHeader(src.m_sTargetHeader), m_sTargetImplementation(src.m_sTargetImplementation) -{ -} +{ } /** cleans up the base object */ CBEObject::~CBEObject() -{ -} +{ } /** \brief sets the target file name * \param pFEObject the front-end object to use for the target file generation @@ -105,11 +101,11 @@ CBENameFactory *pNF = CCompiler::GetNameFactory(); m_sTargetImplementation = pNF->GetFileName(pFEObject, FILETYPE_CLIENTIMPLEMENTATION); - if (pFEObject) - { - if (!(dynamic_cast(pFEObject))) - pFEObject = pFEObject->GetSpecificParent(0); - } + // get the FEObject's file, because the header file is always for the + // whole IDL file. Only implementation files are specific for libs, + // interfaces or operations + if (pFEObject && !(dynamic_cast(pFEObject))) + pFEObject = pFEObject->GetSpecificParent(0); m_sTargetHeader = pNF->GetFileName(pFEObject, FILETYPE_CLIENTHEADER); } @@ -126,8 +122,10 @@ */ bool CBEObject::IsTargetFile(CBEHeaderFile *pFile) { - DTRACE("IsTargetFile(head: %s) m_sTargetHeader=%s\n", - pFile->GetFileName().c_str(), m_sTargetHeader.c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEObject::%s(header: %s) called; m_sTargetHeader=%s\n", + __func__, pFile->GetFileName().c_str(), m_sTargetHeader.c_str()); + long length = m_sTargetHeader.length(); if (length <= 9) return false; @@ -137,7 +135,8 @@ string sBaseTarget = pFile->GetFileName(); int nPos = 0; length = sBaseTarget.length(); - DTRACE("IsTargetFile(head: %s) sBaseTarget=%s\n", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "IsTargetFile(head: %s) sBaseTarget=%s\n", pFile->GetFileName().c_str(), sBaseTarget.c_str()); if ((length > 9) && ((sBaseTarget.substr(length - 9) == "-client.h") || @@ -153,13 +152,15 @@ if ((length > 7) && (sBaseTarget.substr(length - 7) == "-sys.hh")) nPos = 7; - DTRACE("IsTargetFile(head: %s) pos = %d\n", pFile->GetFileName().c_str(), + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "IsTargetFile(head: %s) pos = %d\n", pFile->GetFileName().c_str(), nPos); if (nPos == 0) return false; sBaseTarget = sBaseTarget.substr(0, length-nPos); string sBaseLocal = m_sTargetHeader.substr(0, sBaseTarget.length()); - DTRACE("IsTargetFile(head: %s) sBaseTarget=%s sBaseLocal=%s\n", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "IsTargetFile(head: %s) sBaseTarget=%s sBaseLocal=%s\n", pFile->GetFileName().c_str(), sBaseTarget.c_str(), sBaseLocal.c_str()); if (sBaseTarget == sBaseLocal) @@ -180,41 +181,77 @@ */ bool CBEObject::IsTargetFile(CBEImplementationFile *pFile) { - DTRACE("IsTargetFile(impl: %s) m_sTargetImplementation=%s\n", - pFile->GetFileName().c_str(), m_sTargetImplementation.c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEObject::%s(impl: %s) called; m_sTargetImplementation=%s\n", + __func__, pFile->GetFileName().c_str(), m_sTargetImplementation.c_str()); + long length = m_sTargetImplementation.length(); if (length <= 9) + { + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEObject::%s(%s) fails, because length(%s) <= 9\n", + __func__, pFile->GetFileName().c_str(), m_sTargetImplementation.c_str()); return false; + } if ((m_sTargetImplementation.substr(length - 9) != "-client.c") && (m_sTargetImplementation.substr(length - 10) != "-client.cc")) + { + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEObject::%s(%s) fails, because %s does not end on -client.c\n", + __func__, pFile->GetFileName().c_str(), m_sTargetImplementation.c_str()); return false; + } string sBaseTarget = pFile->GetFileName(); - DTRACE("IsTargetFile(impl: %s) sBaseTarget=%s\n", - pFile->GetFileName().c_str(), sBaseTarget.c_str()); + + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEObject::%s(%s) sBaseTarget=%s\n", + __func__, pFile->GetFileName().c_str(), sBaseTarget.c_str()); + length = sBaseTarget.length(); if (pFile->IsOfFileType(FILETYPE_CLIENT) && (sBaseTarget.substr(length - 9) != "-client.c") && (sBaseTarget.substr(length -10) != "-client.cc")) + { + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEObject::%s(%s) fails, because %s does not contain -client.c\n", + __func__, pFile->GetFileName().c_str(), sBaseTarget.c_str()); return false; + } if (pFile->IsOfFileType(FILETYPE_COMPONENT) && (sBaseTarget.substr(length - 9) != "-server.c") && (sBaseTarget.substr(length - 10) != "-server.cc")) + { + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEObject::%s(%s) fails, because %s does not conatain -server.c\n", + __func__, pFile->GetFileName().c_str(), sBaseTarget.c_str()); return false; + } sBaseTarget = sBaseTarget.substr(0, length-9); string sBaseLocal = m_sTargetImplementation.substr(0, sBaseTarget.length()); - DTRACE("IsTargetFile(impl: %s) sBaseTarget=%s sBaseLocal=%s\n", - pFile->GetFileName().c_str(), sBaseTarget.c_str(), - sBaseLocal.c_str()); + + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEObject::%s(%s) sBaseTarget=%s, sBaseLocal=%s\n", __func__, + pFile->GetFileName().c_str(), sBaseTarget.c_str(), sBaseLocal.c_str()); + if (sBaseTarget == sBaseLocal) + { + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEObject::%s(%s) returns true, stems match\n", __func__, + pFile->GetFileName().c_str()); return true; + } + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEObject::%s(%s) fails, stems mismatch\n", __func__, + pFile->GetFileName().c_str()); return false; } /** \brief creates a new instance of itself */ CObject * CBEObject::Clone() { - TRACE("Clone() not implemented for %s. Fallback to CBEObject::Clone().\n", - typeid(*this).name()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s: Clone() not implemented for %s. Fallback to CBEObject::Clone().\n", + __func__, typeid(*this).name()); return new CBEObject(*this); } @@ -240,7 +277,6 @@ */ void CBEObject::CreateBackEnd(CFEBase* pFEObject) - throw (CBECreateException*) { m_nSourceLineNb = pFEObject->GetSourceLine(); // get file, which this object belongs to @@ -248,9 +284,4 @@ CFEFile *pFEFile = pFEObject->GetSpecificParent(0); if (pFEFile) m_sSourceFileName = pFEFile->GetFileName(); - -// TRACE("Setting source in %s to %s:%d from %s\n", -// typeid(*this).name(), m_sSourceFileName.c_str(), -// m_nSourceLineNb, typeid(*pFEObject).name()); - } diff -ruN p2/l4/tool/dice/src/be/BEObject.h p3/l4/tool/dice/src/be/BEObject.h --- p2/l4/tool/dice/src/be/BEObject.h 2006-06-14 14:24:58.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEObject.h 2006-11-30 10:41:09.000000000 +0100 @@ -32,7 +32,6 @@ #include "Object.h" #include -using namespace std; class CBERoot; class CBETarget; @@ -79,8 +78,7 @@ protected: virtual void SetTargetFileName(CFEBase *pFEObject); - virtual void CreateBackEnd(CFEBase* pFEObject) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEBase* pFEObject); protected: /** \var string m_sTargetHeader diff -ruN p2/l4/tool/dice/src/be/BEOpcodeType.cpp p3/l4/tool/dice/src/be/BEOpcodeType.cpp --- p2/l4/tool/dice/src/be/BEOpcodeType.cpp 2006-08-23 19:27:57.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEOpcodeType.cpp 2006-11-30 10:41:09.000000000 +0100 @@ -56,12 +56,13 @@ */ void CBEOpcodeType::CreateBackEnd() - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEOpcodeType::%s called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEOpcodeType::%s called\n", + __func__); CBEType::CreateBackEnd(false, CCompiler::GetSizes()->GetOpcodeSize(), TYPE_LONG); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEOpcodeType::%s called\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEOpcodeType::%s called\n", + __func__); } /** \brief generates an exact copy of this class diff -ruN p2/l4/tool/dice/src/be/BEOpcodeType.h p3/l4/tool/dice/src/be/BEOpcodeType.h --- p2/l4/tool/dice/src/be/BEOpcodeType.h 2006-06-14 14:24:58.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEOpcodeType.h 2006-11-30 10:41:09.000000000 +0100 @@ -55,8 +55,7 @@ public: virtual CObject* Clone(); - virtual void CreateBackEnd() - throw (CBECreateException*); + virtual void CreateBackEnd(); }; #endif // !__DICE_BEOPCODETYPE_H__ diff -ruN p2/l4/tool/dice/src/be/BEOperationFunction.cpp p3/l4/tool/dice/src/be/BEOperationFunction.cpp --- p2/l4/tool/dice/src/be/BEOperationFunction.cpp 2006-10-10 14:46:17.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEOperationFunction.cpp 2006-11-30 10:41:09.000000000 +0100 @@ -43,7 +43,6 @@ #include "fe/FEInterface.h" #include "fe/FEStringAttribute.h" #include -using namespace std; CBEOperationFunction::CBEOperationFunction(FUNCTION_TYPE nFunctionType) : CBEFunction(nFunctionType) @@ -71,7 +70,6 @@ */ void CBEOperationFunction::CreateBackEnd(CFEOperation * pFEOperation) - throw (CBECreateException*) { assert(pFEOperation); @@ -145,10 +143,10 @@ */ void CBEOperationFunction::AddParameters(CFEOperation * pFEOperation) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEOperationFunction::%s called for %s\n", - __func__, pFEOperation->GetName().c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEOperationFunction::%s called for %s\n", __func__, + pFEOperation->GetName().c_str()); AddBeforeParameters(); @@ -181,7 +179,7 @@ } catch (CBECreateException *e) { - m_Parameters.Remove(pParameter); + m_Parameters.Remove(pParameter); delete pParameter; throw; } @@ -223,7 +221,7 @@ } catch (CBECreateException *e) { - m_Exceptions.Remove(pException); + m_Exceptions.Remove(pException); delete pException; throw; } @@ -301,7 +299,7 @@ } catch (CBECreateException *e) { - m_Attributes.Remove(pAttribute); + m_Attributes.Remove(pAttribute); delete pAttribute; e->Print(); delete e; diff -ruN p2/l4/tool/dice/src/be/BEOperationFunction.h p3/l4/tool/dice/src/be/BEOperationFunction.h --- p2/l4/tool/dice/src/be/BEOperationFunction.h 2006-08-21 16:46:37.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEOperationFunction.h 2006-11-30 10:41:09.000000000 +0100 @@ -58,14 +58,12 @@ CBEOperationFunction(CBEOperationFunction &src); public: - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); protected: virtual bool AddAttributes(CFEOperation *pFEOperation); virtual bool AddExceptions(CFEOperation *pFEOperation); - virtual void AddParameters(CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void AddParameters(CFEOperation *pFEOperation); virtual void AddParameter(CFETypedDeclarator *pFEParameter); virtual bool AddException(CFEIdentifier *pFEException); virtual bool AddAttribute(CFEAttribute *pFEAttribute); diff -ruN p2/l4/tool/dice/src/be/BEReplyCodeType.cpp p3/l4/tool/dice/src/be/BEReplyCodeType.cpp --- p2/l4/tool/dice/src/be/BEReplyCodeType.cpp 2006-08-23 19:27:57.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEReplyCodeType.cpp 2006-11-30 10:41:09.000000000 +0100 @@ -54,9 +54,9 @@ */ void CBEReplyCodeType::CreateBackEnd() - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEReplyCodeType::%s() called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEReplyCodeType::%s() called\n", __func__); m_bUnsigned = false; m_nSize = 2; // bytes @@ -64,7 +64,8 @@ CBENameFactory *pNF = CCompiler::GetNameFactory(); m_sName = pNF->GetTypeName(m_nFEType, false, m_nSize); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEReplyCodeType::%s() returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEReplyCodeType::%s() returns\n", __func__); } /** \brief generates an exact copy of this class diff -ruN p2/l4/tool/dice/src/be/BEReplyCodeType.h p3/l4/tool/dice/src/be/BEReplyCodeType.h --- p2/l4/tool/dice/src/be/BEReplyCodeType.h 2006-06-14 14:24:59.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEReplyCodeType.h 2006-11-30 10:41:09.000000000 +0100 @@ -55,8 +55,7 @@ public: virtual CObject* Clone(); - virtual void CreateBackEnd() - throw (CBECreateException*); + virtual void CreateBackEnd(); }; #endif diff -ruN p2/l4/tool/dice/src/be/BEReplyFunction.cpp p3/l4/tool/dice/src/be/BEReplyFunction.cpp --- p2/l4/tool/dice/src/be/BEReplyFunction.cpp 2006-10-10 14:46:17.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEReplyFunction.cpp 2006-11-30 10:41:09.000000000 +0100 @@ -42,7 +42,6 @@ #include "fe/FETypedDeclarator.h" #include "TypeSpec-Type.h" #include -using namespace std; CBEReplyFunction::CBEReplyFunction() : CBEOperationFunction(FUNCTION_REPLY) @@ -104,7 +103,6 @@ */ void CBEReplyFunction::CreateBackEnd(CFEOperation* pFEOperation) - throw (CBECreateException*) { // set target file name SetTargetFileName(pFEOperation); @@ -254,7 +252,8 @@ // if no parameter, then try to find it in the message buffer CBEMsgBuffer *pMsgBuf = GetMessageBuffer(); - DTRACE("%s message buffer in class at %p\n", __func__, pMsgBuf); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s message buffer in class at %p\n", + __func__, pMsgBuf); if (!pMsgBuf) return 0; CBENameFactory *pNF = CCompiler::GetNameFactory(); @@ -262,8 +261,8 @@ pRet = pMsgBuf->FindMember(sName, this, GetSendDirection()); if (!pRet) pRet = pMsgBuf->FindMember(sName, this, GetReceiveDirection()); - DTRACE("%s exception var %s at %p\n", __func__, - sName.c_str(), pRet); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s exception var %s at %p\n", + __func__, sName.c_str(), pRet); return pRet; } @@ -303,7 +302,6 @@ */ void CBEReplyFunction::AddParameter(CFETypedDeclarator * pFEParameter) - throw (CBECreateException*) { if (!(pFEParameter->m_Attributes.Find(ATTR_OUT))) // skip adding a parameter if it has no OUT diff -ruN p2/l4/tool/dice/src/be/BEReplyFunction.h p3/l4/tool/dice/src/be/BEReplyFunction.h --- p2/l4/tool/dice/src/be/BEReplyFunction.h 2006-08-21 16:46:37.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEReplyFunction.h 2006-11-30 10:41:09.000000000 +0100 @@ -47,8 +47,7 @@ CBEReplyFunction(); virtual ~CBEReplyFunction(); - virtual void CreateBackEnd(CFEOperation* pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation* pFEOperation); virtual bool DoMarshalParameter(CBETypedDeclarator * pParameter, bool bMarshal); virtual bool DoWriteFunction(CBEHeaderFile* pFile); @@ -67,8 +66,7 @@ virtual void WriteUnmarshalling(CBEFile * pFile); virtual void WriteInvocation(CBEFile * pFile); virtual void WriteVariableInitialization(CBEFile * pFile); - virtual void AddParameter(CFETypedDeclarator * pFEParameter) - throw (CBECreateException*); + virtual void AddParameter(CFETypedDeclarator * pFEParameter); }; #endif diff -ruN p2/l4/tool/dice/src/be/BERoot.cpp p3/l4/tool/dice/src/be/BERoot.cpp --- p2/l4/tool/dice/src/be/BERoot.cpp 2006-10-10 16:08:40.000000000 +0200 +++ p3/l4/tool/dice/src/be/BERoot.cpp 2006-11-30 10:41:09.000000000 +0100 @@ -47,7 +47,7 @@ #include "fe/FETypedDeclarator.h" #include "fe/FEConstructedType.h" #include -using namespace std; +#include CBERoot::CBERoot() : m_Constants(0, this), @@ -100,7 +100,6 @@ * and replaced by the new ones. */ void CBERoot::CreateBE(CFEFile * pFEFile) -throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s(file: %s) called\n", __func__, pFEFile->GetFileName().c_str()); @@ -182,7 +181,8 @@ */ CBETypedef *CBERoot::FindTypedef(string sTypeName) { - DTRACE("%s(%s) called\n", __func__, sTypeName.c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s(%s) called\n", __func__, + sTypeName.c_str()); CBETypedef *pTypedef = m_Typedefs.Find(sTypeName); if (pTypedef) return pTypedef; @@ -218,7 +218,7 @@ CBEFunction *CBERoot::FindFunction(string sFunctionName, FUNCTION_TYPE nFunctionType) { - DTRACE("%s (%s) called\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s (%s) called\n", __func__, sFunctionName.c_str()); CBEFunction *pFunction; vector::iterator iterC; @@ -330,7 +330,6 @@ * These exceptions are simply propagated to the calling method. */ void CBERoot::CreateBackEnd(CFEFile *pFEFile) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s for %s called\n", __func__, pFEFile->GetFileName().c_str()); @@ -389,7 +388,6 @@ * \param pFELibrary the front-end library to search for constants */ void CBERoot::CreateBackEnd(CFELibrary *pFELibrary) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s for %s called\n", __func__, pFELibrary->GetName().c_str()); @@ -406,7 +404,7 @@ } catch (CBECreateException *e) { - m_Namespaces.Remove(pNameSpace); + m_Namespaces.Remove(pNameSpace); delete pNameSpace; throw; } @@ -422,7 +420,6 @@ * \param pFEInterface the interface to search for classes */ void CBERoot::CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s for %s called\n", __func__, pFEInterface->GetName().c_str()); @@ -452,7 +449,6 @@ */ void CBERoot::CreateBackEnd(CFEConstDeclarator *pFEConstant) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s for %s called\n", __func__, pFEConstant->GetName().c_str()); @@ -464,7 +460,7 @@ } catch (CBECreateException *e) { - m_Constants.Remove(pConstant); + m_Constants.Remove(pConstant); delete pConstant; e->Print(); delete e; @@ -480,7 +476,6 @@ */ void CBERoot::CreateBackEnd(CFETypedDeclarator *pFETypedef) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); CBETypedef *pTypedef = CCompiler::GetClassFactory()->GetNewTypedef(); @@ -491,7 +486,7 @@ } catch (CBECreateException *e) { - m_Typedefs.Remove(pTypedef); + m_Typedefs.Remove(pTypedef); delete pTypedef; e->Print(); delete e; @@ -511,7 +506,6 @@ */ void CBERoot::CreateBackEnd(CFEConstructedType *pFEType) - throw (CBECreateException*) { CBEClassFactory *pCF = CCompiler::GetClassFactory(); CBEType *pType = pCF->GetNewType(pFEType->GetType()); @@ -523,7 +517,7 @@ } catch (CBECreateException *e) { - m_TypeDeclarations.Remove(pType); + m_TypeDeclarations.Remove(pType); delete pType; e->Print(); delete e; @@ -705,7 +699,7 @@ * \param nCurCol the current column where to start to print (indent) * \param nMaxCol the maximum number of columns */ -void CBERoot::PrintTargetFiles(FILE *output, int &nCurCol, int nMaxCol) +void CBERoot::PrintTargetFiles(ostream& output, int &nCurCol, int nMaxCol) { if (m_pClient) { diff -ruN p2/l4/tool/dice/src/be/BERoot.h p3/l4/tool/dice/src/be/BERoot.h --- p2/l4/tool/dice/src/be/BERoot.h 2006-08-23 19:27:57.000000000 +0200 +++ p3/l4/tool/dice/src/be/BERoot.h 2006-11-30 10:41:09.000000000 +0100 @@ -35,7 +35,8 @@ #include "TypeSpec-Type.h" #include "template.h" #include -using namespace std; +#include +using std::ostream; class CBEClient; class CBEComponent; @@ -76,8 +77,7 @@ public: // Public methods void Write(); - void CreateBE(CFEFile *pFEFile) - throw (CBECreateException*); + void CreateBE(CFEFile *pFEFile); CBETypedef* FindTypedef(string sTypeName); CBEConstant* FindConstant(string sConstantName); @@ -90,21 +90,15 @@ bool AddToFile(CBEHeaderFile *pHeader); bool AddOpcodesToFile(CBEHeaderFile *pHeader, CFEFile *pFEFile); - void PrintTargetFiles(FILE *output, int &nCurCol, int nMaxCol); + void PrintTargetFiles(ostream& output, int &nCurCol, int nMaxCol); protected: // Protected methods - void CreateBackEnd(CFEConstDeclarator *pFEConstant) - throw (CBECreateException*); - void CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*); - void CreateBackEnd(CFELibrary *pFELibrary) - throw (CBECreateException*); - void CreateBackEnd(CFETypedDeclarator *pFETypedef) - throw (CBECreateException*); - void CreateBackEnd(CFEFile *pFEFile) - throw (CBECreateException*); - void CreateBackEnd(CFEConstructedType *pFEType) - throw (CBECreateException*); + void CreateBackEnd(CFEConstDeclarator *pFEConstant); + void CreateBackEnd(CFEInterface *pFEInterface); + void CreateBackEnd(CFELibrary *pFELibrary); + void CreateBackEnd(CFETypedDeclarator *pFETypedef); + void CreateBackEnd(CFEFile *pFEFile); + void CreateBackEnd(CFEConstructedType *pFEType); protected: /** \var CBEClient *m_pClient diff -ruN p2/l4/tool/dice/src/be/BESizes.cpp p3/l4/tool/dice/src/be/BESizes.cpp --- p2/l4/tool/dice/src/be/BESizes.cpp 2006-08-08 13:20:06.000000000 +0200 +++ p3/l4/tool/dice/src/be/BESizes.cpp 2006-11-30 10:41:09.000000000 +0100 @@ -29,7 +29,6 @@ #include "be/BESizes.h" #include "TypeSpec-Type.h" #include -using namespace std; #if defined(HAVE_CONFIG_H) #include "config.h" diff -ruN p2/l4/tool/dice/src/be/BESndFunction.cpp p3/l4/tool/dice/src/be/BESndFunction.cpp --- p2/l4/tool/dice/src/be/BESndFunction.cpp 2006-08-23 19:27:57.000000000 +0200 +++ p3/l4/tool/dice/src/be/BESndFunction.cpp 2006-11-30 10:41:09.000000000 +0100 @@ -70,7 +70,7 @@ { // init message buffer CBEMsgBuffer *pMsgBuffer = GetMessageBuffer(); - pMsgBuffer->WriteInitialization(pFile); + pMsgBuffer->WriteInitialization(pFile, this, 0, 0); } /** \brief writes the invocation of the message transfer @@ -100,7 +100,6 @@ */ void CBESndFunction::CreateBackEnd(CFEOperation * pFEOperation) - throw (CBECreateException*) { // set target file name SetTargetFileName(pFEOperation); diff -ruN p2/l4/tool/dice/src/be/BESndFunction.h p3/l4/tool/dice/src/be/BESndFunction.h --- p2/l4/tool/dice/src/be/BESndFunction.h 2006-08-21 16:46:37.000000000 +0200 +++ p3/l4/tool/dice/src/be/BESndFunction.h 2006-11-30 10:41:09.000000000 +0100 @@ -52,8 +52,7 @@ CBESndFunction(CBESndFunction &src); public: - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); virtual bool DoWriteFunction(CBEHeaderFile* pFile); virtual bool DoWriteFunction(CBEImplementationFile* pFile); virtual int GetSendDirection(); diff -ruN p2/l4/tool/dice/src/be/BESrvLoopFunction.cpp p3/l4/tool/dice/src/be/BESrvLoopFunction.cpp --- p2/l4/tool/dice/src/be/BESrvLoopFunction.cpp 2006-10-10 14:55:35.000000000 +0200 +++ p3/l4/tool/dice/src/be/BESrvLoopFunction.cpp 2006-11-30 10:41:09.000000000 +0100 @@ -47,7 +47,6 @@ #include "fe/FEStringAttribute.h" #include "Compiler.h" #include -using namespace std; CBESrvLoopFunction::CBESrvLoopFunction() : CBEInterfaceFunction(FUNCTION_SRV_LOOP) @@ -84,7 +83,6 @@ */ void CBESrvLoopFunction::CreateBackEnd(CFEInterface * pFEInterface) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); @@ -207,7 +205,7 @@ } catch (CBECreateException *e) { - m_LocalVariables.Remove(pVariable); + m_LocalVariables.Remove(pVariable); delete pVariable; delete pReplyType; e->Print(); @@ -225,7 +223,7 @@ } catch (CBECreateException *e) { - m_LocalVariables.Remove(pVariable); + m_LocalVariables.Remove(pVariable); delete pVariable; delete pReplyType; e->Print(); @@ -272,7 +270,6 @@ */ void CBESrvLoopFunction::CreateObject() - throw (CBECreateException*) { CBEInterfaceFunction::CreateObject(); @@ -321,7 +318,7 @@ WriteEnvironmentInitialization(pFile); // init message buffer CBEMsgBuffer *pMsgBuffer = GetMessageBuffer(); - pMsgBuffer->WriteInitialization(pFile, 0 , 0); + pMsgBuffer->WriteInitialization(pFile, this, 0 , 0); } /** \brief writes the invocation of the message transfer @@ -387,6 +384,9 @@ */ void CBESrvLoopFunction::WriteLoop(CBEFile * pFile) { + assert(m_pTrace); + m_pTrace->BeforeLoop(pFile, this); + CBENameFactory *pNF = CCompiler::GetNameFactory(); string sOpcodeVar = pNF->GetOpcodeVariable(); m_pWaitAnyFunction->WriteCall(pFile, sOpcodeVar, true); @@ -452,8 +452,19 @@ bool CBESrvLoopFunction::DoWriteFunction(CBEHeaderFile * pFile) { + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBESrvLoopFunction::%s(%s) called for %s\n", __func__, + pFile->GetFileName().c_str(), GetName().c_str()); + if (!IsTargetFile(pFile)) + { + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBESrvLoopFunction::%s failed: wrong target file\n", __func__); return false; + } + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBESrvLoopFunction::%s finished.\n", + __func__); return dynamic_cast(pFile->GetTarget()); } @@ -466,8 +477,19 @@ bool CBESrvLoopFunction::DoWriteFunction(CBEImplementationFile * pFile) { + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBESrvLoopFunction::%s(%s) called for %s\n", __func__, + pFile->GetFileName().c_str(), GetName().c_str()); + if (!IsTargetFile(pFile)) + { + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBESrvLoopFunction::%s failed: wrong target file\n", __func__); return false; + } + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBESrvLoopFunction::%s finished.\n", + __func__); return dynamic_cast(pFile->GetTarget()); } @@ -613,7 +635,6 @@ */ void CBESrvLoopFunction::AddParameters() - throw (CBECreateException*) { CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); diff -ruN p2/l4/tool/dice/src/be/BESrvLoopFunction.h p3/l4/tool/dice/src/be/BESrvLoopFunction.h --- p2/l4/tool/dice/src/be/BESrvLoopFunction.h 2006-10-10 14:55:35.000000000 +0200 +++ p3/l4/tool/dice/src/be/BESrvLoopFunction.h 2006-11-30 10:41:09.000000000 +0100 @@ -57,8 +57,7 @@ CBESrvLoopFunction(CBESrvLoopFunction &src); public: - virtual void CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEInterface *pFEInterface); virtual bool DoWriteFunction(CBEHeaderFile* pFile); virtual bool DoWriteFunction(CBEImplementationFile* pFile); virtual int GetReceiveDirection(); @@ -78,12 +77,10 @@ virtual void WriteObjectInitialization(CBEFile *pFile); virtual void WriteFunctionAttributes(CBEFile* pFile); virtual void WriteReturn(CBEFile* pFile); - virtual void AddParameters(void) - throw (CBECreateException*); + virtual void AddParameters(void); virtual bool AddOpcodeVariable(); virtual bool AddReplyVariable(); - virtual void CreateObject() - throw (CBECreateException*); + virtual void CreateObject(); CBEFunction* FindGlobalFunction(CFEInterface *pFEInterface, FUNCTION_TYPE nFunctionType); diff -ruN p2/l4/tool/dice/src/be/BEStructType.cpp p3/l4/tool/dice/src/be/BEStructType.cpp --- p2/l4/tool/dice/src/be/BEStructType.cpp 2006-10-13 18:30:24.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEStructType.cpp 2006-11-30 10:41:09.000000000 +0100 @@ -49,7 +49,6 @@ #include "fe/FEDeclarator.h" #include #include -using namespace std; /****************************** * CStructMembers @@ -179,9 +178,9 @@ */ void CBEStructType::CreateBackEnd(CFETypeSpec * pFEType) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s(fe) called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEStructType::%s(fe) called\n", __func__); // sets m_sName to "struct" CBEType::CreateBackEnd(pFEType); @@ -189,7 +188,8 @@ if (pFEType->GetType() == TYPE_ARRAY) { CreateBackEndSequence((CFEArrayType*)pFEType); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s(fe) returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEStructType::%s(fe) returns\n", __func__); return; } // get forward declaration @@ -212,7 +212,7 @@ } catch (CBECreateException *e) { - m_Members.Remove(pMember); + m_Members.Remove(pMember); delete pMember; throw; } @@ -259,29 +259,11 @@ m_sTag = pNF->GetTypeName(pFEType, sTag); else m_sTag = sTag; - // still no original struct found, than this might be a user - // defined struct - // get the size from there - CBERoot *pRoot = GetSpecificParent(); - assert(pRoot); - CBETypedef *pTypedef = pRoot->FindTypedef(m_sTag); - if (!pTypedef) - { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s(fe) returns\n", - __func__); - return; - } - /* since the typedef is a CBETypedDeclarator, it would evaluate - * the size of it's base type and sum it for all it's declarators. - * We only want it for the declarator we are using. That's why we - * use a specific GetSize function instead of the generic one. */ - m_nSize = pTypedef->GetSize(m_sTag); - // determine max size later - m_nMaxSize = 0; } } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s(fe) returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEStructType::%s(fe) returns\n", __func__); } /** \brief initialize instance of object @@ -294,9 +276,9 @@ void CBEStructType::CreateBackEnd(string sTag, CFEBase *pRefObj) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s(%s, %p) called\n", __func__, + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEStructType::%s(%s, %p) called\n", __func__, sTag.c_str(), pRefObj); // skip CBEType::CreateBackEnd to avoid asserts CBEObject::CreateBackEnd(pRefObj); @@ -305,12 +287,9 @@ CBENameFactory *pNF = CCompiler::GetNameFactory(); m_sName = pNF->GetTypeName(TYPE_STRUCT, false); m_sTag = sTag; - // determine size later - m_nSize = 0; - m_nMaxSize = 0; - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s(%s,) called\n", __func__, - sTag.c_str()); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEStructType::%s(%s,) called\n", __func__, sTag.c_str()); } /** \brief prepares this instance for the code generation @@ -319,10 +298,9 @@ */ void CBEStructType::CreateBackEndSequence(CFEArrayType * pFEType) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s(fe-array) called\n", - __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEStructType::%s(fe-array) called\n", __func__); // if sequence create own members if (pFEType->GetType() != TYPE_ARRAY) { @@ -413,8 +391,8 @@ // recusively call CreateBackEnd to initialize struct CreateBackEnd(pFEStruct); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s(fe-array) returns\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEStructType::%s(fe-array) returns\n", __func__); } /** \brief writes the structure into the target file @@ -493,9 +471,7 @@ /** \brief calculate the size of a struct type * \return the size in bytes of the struct * - * The struct's size is the sum of the member's size. We test m_nSize on - * zero. If it is greater than zero, the size has already been set. If it - * isn't we calculate it. + * The struct's size is the sum of the member's size. * * If the declarator's GetSize returns 0, the member is a bitfield. We have to * add the bits of the declarators. If a bitfield declarator is followed by a @@ -503,43 +479,53 @@ * * \todo If member is indirect, we should add size of pointer instead of \ * size of type + * + * Do not use cached size of struct, because it might change */ int CBEStructType::GetSize() { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s called (m_nSize = %d)\n", - __func__, m_nSize); - DTRACE("%s called (m_nSize = %d)\n", __func__, m_nSize); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEStructType::%s called\n", __func__); - if (m_nSize != 0) - { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s returns %d\n", __func__, - m_nSize); - return m_nSize; - } - + int nSize = 0; // if this is a tagged struct without members, we have to find the // original struct if (m_bForwardDeclaration) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s forward decl of %s\n", - __func__, GetTag().c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEStructType::%s forward decl of %s\n", __func__, + GetTag().c_str()); // search for tag CBERoot *pRoot = GetSpecificParent(); assert(pRoot); CBEStructType *pTaggedType = (CBEStructType*)pRoot->FindTaggedType(TYPE_STRUCT, GetTag()); - // if found, marshal this instead + // if found, get size from it if ((pTaggedType) && (pTaggedType != this)) { - m_nSize = pTaggedType->GetSize(); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s returns %d\n", - __func__, m_nSize); - return m_nSize; + nSize = pTaggedType->GetSize(); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEStructType::%s returns %d\n", __func__, nSize); + return nSize; } // if no tagged struct found, this is a user defined type - // we asked the sizes class in CreateBackEnd, maybe it knows my size - // -> m_nSize should be > 0 + // get the size from there + if (!pTaggedType) + { + CBETypedef *pTypedef = pRoot->FindTypedef(m_sTag); + if (!pTypedef) + { + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEStructType::%s returns 0\n", __func__); + return 0; + } + /* since the typedef is a CBETypedDeclarator, it would evaluate + * the size of it's base type and sum it for all it's declarators. + * We only want it for the declarator we are using. That's why we + * use a specific GetSize function instead of the generic one. */ + return pTypedef->GetSize(m_sTag); + } } int nBitSize = 0; @@ -596,36 +582,30 @@ { // FIXME: get size from // CCompiler::GetSizes()->GetSizeOfType(TYPE_MWORD); - m_nSize = -1; - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s self reference (%s): return -1\n", __func__, m_sTag.c_str()); - return m_nSize; + return -1; } - int nSize = (*iter)->GetSize(); + int nElemSize = (*iter)->GetSize(); if ((*iter)->IsString()) { // a string is also variable sized member - m_nSize = -1; - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s string member: return -1\n", __func__); - return m_nSize; + return -1; } else if ((*iter)->IsVariableSized()) { // if one of the members is variable sized, // the whole struct is variable sized - m_nSize = -1; - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s var-sized member: return -1\n", __func__); return -1; } - else if (nSize == 0) + else if (nElemSize == 0) { nBitSize += (*iter)->GetBitfieldSize(); } @@ -638,36 +618,36 @@ // // if current size (nSize) is 2 bytes then sum is aligned to word // size - if (nSize >= 4) - m_nSize = pSizes->WordRoundUp(m_nSize); - if ((nSize == 2) && ((m_nSize % 2) > 0)) - m_nSize++; // word align - m_nSize += nSize; + if (nElemSize >= 4) + nSize = pSizes->WordRoundUp(nSize); + if ((nElemSize == 2) && ((nSize % 2) > 0)) + nSize++; // word align + nSize += nElemSize; // if bitfields before, align them and add them if (nBitSize > 0) { - m_nSize += nBitSize / 8; + nSize += nBitSize / 8; if ((nBitSize % 8) > 0) - m_nSize++; + nSize++; nBitSize = 0; } } CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s size of member is %d, new total: %d\n", - __func__, nSize, m_nSize); + __func__, nElemSize, nSize); } // some bitfields left? -> align them and add them if (nBitSize > 0) { - m_nSize += nBitSize / 8; + nSize += nBitSize / 8; if ((nBitSize % 8) > 0) - m_nSize++; + nSize++; } CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, - "CBEStructType::%s returns %d\n", __func__, m_nSize); - return m_nSize; + "CBEStructType::%s returns %d\n", __func__, nSize); + return nSize; } /** \brief returns the maximum size of the struct @@ -677,17 +657,21 @@ * variable sized and a maximum size calculation is feasable. The algorithm is * basically the same as for GetSize, but when a member returns -1 (variable * sized) then this implementation tries to determine it's maximum size. + * + * Do not use cached max size, because size might change. */ int CBEStructType::GetMaxSize() { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEStructType::%s called\n", __func__); - m_nMaxSize = GetSize(); - if (m_nMaxSize > 0) + int nMaxSize = GetSize(); + if (nMaxSize > 0) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s normal size is %d, return\n", - __func__, m_nMaxSize); - return m_nMaxSize; + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEStructType::%s normal size is %d, return\n", __func__, + nMaxSize); + return nMaxSize; } // if this is a tagged struct without members, we have to find the @@ -702,22 +686,22 @@ // if found, marshal this instead if ((pTaggedType) && (pTaggedType != this)) { - m_nMaxSize = pTaggedType->GetMaxSize(); + nMaxSize = pTaggedType->GetMaxSize(); CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s size of forward decl struct is %d\n", - __func__, m_nMaxSize); - return m_nMaxSize; + __func__, nMaxSize); + return nMaxSize; } // if no tagged struct found, this is a user defined type // we asked the sizes class in CreateBackEnd, maybe it knows my size - // -> m_nMaxSize should be > 0 + // -> nMaxSize should be > 0 } CBESizes *pSizes = CCompiler::GetSizes(); int nBitSize = 0; - // reset m_nMaxSize, which could have been negative before - m_nMaxSize = 0; + // reset nMaxSize, which could have been negative before + nMaxSize = 0; vector::iterator iter; for (iter = m_Members.begin(); @@ -768,17 +752,17 @@ if ((dynamic_cast(pMemberType)) && pMemberType->HasTag(m_sTag)) { - m_nMaxSize = pSizes->GetSizeOfType(TYPE_VOID_ASTERISK); + nMaxSize = pSizes->GetSizeOfType(TYPE_VOID_ASTERISK); CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s pointer to self, return %d\n", - __func__, m_nMaxSize); - return m_nMaxSize; + __func__, nMaxSize); + return nMaxSize; } int nSize = 0; if (!(*iter)->GetMaxSize(true, nSize)) { - m_nMaxSize = -1; + nMaxSize = -1; CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s can't determine max of member, return -1\n", __func__); @@ -798,14 +782,14 @@ // size int nWordSize = pSizes->GetSizeOfType(TYPE_MWORD); if (nSize >= nWordSize) - m_nMaxSize = pSizes->WordRoundUp(m_nMaxSize); - m_nMaxSize += nSize; + nMaxSize = pSizes->WordRoundUp(nMaxSize); + nMaxSize += nSize; // if bitfields before, align them and add them if (nBitSize > 0) { - m_nMaxSize += nBitSize / 8; + nMaxSize += nBitSize / 8; if ((nBitSize % 8) > 0) - m_nMaxSize++; + nMaxSize++; nBitSize = 0; } } @@ -813,20 +797,20 @@ CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s: member %s has size %d (bits %d) - total: %d\n", __func__, (*iter)->m_Declarators.First()->GetName().c_str(), - nSize, nBitSize, m_nMaxSize); + nSize, nBitSize, nMaxSize); } // some bitfields left? -> align them and add them if (nBitSize > 0) { - m_nMaxSize += nBitSize / 8; + nMaxSize += nBitSize / 8; if ((nBitSize % 8) > 0) - m_nMaxSize++; + nMaxSize++; } CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEStructType::%s return max size %d\n", - __func__, m_nMaxSize); - return m_nMaxSize; + __func__, nMaxSize); + return nMaxSize; } /** \brief writes code to initialize a variable of this type with a zero value diff -ruN p2/l4/tool/dice/src/be/BEStructType.h p3/l4/tool/dice/src/be/BEStructType.h --- p2/l4/tool/dice/src/be/BEStructType.h 2006-10-10 16:08:40.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEStructType.h 2006-11-30 10:41:09.000000000 +0100 @@ -34,7 +34,6 @@ #include "Attribute-Type.h" #include "template.h" #include -using namespace std; class CBEContext; class CBETypedDeclarator; @@ -89,8 +88,7 @@ CBETypedDeclarator *pMember, vector *pStack, CBEFunction *pUsingFunc); - virtual void CreateBackEndSequence(CFEArrayType *pFEType) - throw (CBECreateException*); + virtual void CreateBackEndSequence(CFEArrayType *pFEType); public: virtual void WriteZeroInit(CBEFile *pFile); @@ -115,10 +113,8 @@ virtual CBETypedDeclarator* FindMemberAttribute(ATTR_TYPE nAttributeType); virtual CBETypedDeclarator* FindMemberIsAttribute(ATTR_TYPE nAttributeType, string sAttributeParameter); - virtual void CreateBackEnd(CFETypeSpec *pFEType) - throw (CBECreateException*); - virtual void CreateBackEnd(string sTag, CFEBase *pRefObj) - throw (CBECreateException*); + virtual void CreateBackEnd(CFETypeSpec *pFEType); + virtual void CreateBackEnd(string sTag, CFEBase *pRefObj); protected: /** \var string m_sTag diff -ruN p2/l4/tool/dice/src/be/BESwitchCase.cpp p3/l4/tool/dice/src/be/BESwitchCase.cpp --- p2/l4/tool/dice/src/be/BESwitchCase.cpp 2006-10-12 18:17:45.000000000 +0200 +++ p3/l4/tool/dice/src/be/BESwitchCase.cpp 2006-11-30 10:41:09.000000000 +0100 @@ -47,7 +47,6 @@ #include "TypeSpec-Type.h" #include "fe/FEStructType.h" #include -using namespace std; CBESwitchCase::CBESwitchCase() : CBEOperationFunction(FUNCTION_SWITCH_CASE) @@ -82,7 +81,6 @@ */ void CBESwitchCase::CreateBackEnd(CFEOperation * pFEOperation) - throw (CBECreateException*) { string exc = string(__func__); // we skip OUT functions diff -ruN p2/l4/tool/dice/src/be/BESwitchCase.h p3/l4/tool/dice/src/be/BESwitchCase.h --- p2/l4/tool/dice/src/be/BESwitchCase.h 2006-08-04 18:17:17.000000000 +0200 +++ p3/l4/tool/dice/src/be/BESwitchCase.h 2006-11-30 10:41:09.000000000 +0100 @@ -57,8 +57,7 @@ public: virtual void Write(CBEFile *pFile); - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); virtual void SetMessageBufferType(); virtual void SetCallVariable(string sOriginalName, int nStars, diff -ruN p2/l4/tool/dice/src/be/BETarget.cpp p3/l4/tool/dice/src/be/BETarget.cpp --- p2/l4/tool/dice/src/be/BETarget.cpp 2006-10-10 16:08:41.000000000 +0200 +++ p3/l4/tool/dice/src/be/BETarget.cpp 2006-11-30 10:41:09.000000000 +0100 @@ -51,7 +51,7 @@ #include "fe/FEDeclarator.h" #include "Compiler.h" #include -using namespace std; +#include CBETarget::CBETarget() : m_HeaderFiles(0, this), @@ -263,7 +263,7 @@ } catch (CBECreateException *e) { - pF->m_Constants.Remove(pConstant); + pF->m_Constants.Remove(pConstant); delete pConstant; e->Print(); delete e; @@ -567,7 +567,6 @@ */ void CBETarget::CreateBackEnd(CFEFile *pFEFile) - throw (CBECreateException*) { // if argument is 0, we assume a mistaken include file if (!pFEFile) @@ -596,7 +595,7 @@ * \param nCurCol the current column where to start output (indent) * \param nMaxCol the maximum number of columns */ -void CBETarget::PrintTargetFiles(FILE *output, int &nCurCol, int nMaxCol) +void CBETarget::PrintTargetFiles(ostream& output, int &nCurCol, int nMaxCol) { // iterate over implementation files vector::iterator iterH; @@ -622,15 +621,16 @@ * \param nCurCol the current output column * \param nMaxCol the maximum output column */ -void CBETarget::PrintTargetFileName(FILE *output, string sFilename, int &nCurCol, int nMaxCol) +void CBETarget::PrintTargetFileName(ostream& output, string sFilename, + int &nCurCol, int nMaxCol) { nCurCol += sFilename.length(); if (nCurCol > nMaxCol) { - fprintf(output, "\\\n "); + output << "\\\n "; nCurCol = sFilename.length()+1; } - fprintf(output, "%s ", sFilename.c_str()); + output << sFilename << " "; } /** \brief tests if this target has a function with a given type diff -ruN p2/l4/tool/dice/src/be/BETarget.h p3/l4/tool/dice/src/be/BETarget.h --- p2/l4/tool/dice/src/be/BETarget.h 2006-08-21 16:46:37.000000000 +0200 +++ p3/l4/tool/dice/src/be/BETarget.h 2006-11-30 10:41:10.000000000 +0100 @@ -34,7 +34,8 @@ #include "BEContext.h" // for FILE_TYPE #include "template.h" #include -using namespace std; +#include +using std::ostream; class CFEFile; class CFEOperation; @@ -77,8 +78,7 @@ CBETarget(CBETarget &src); public: - virtual void CreateBackEnd(CFEFile *pFEFile) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEFile *pFEFile); virtual CBEFunction* FindFunction(string sFunctionName, FUNCTION_TYPE nFunctionType); @@ -86,7 +86,7 @@ /** \brief generates the output files and code */ virtual void Write() = 0; - virtual void PrintTargetFiles(FILE *output, int &nCurCol, int nMaxCol); + virtual void PrintTargetFiles(ostream& output, int &nCurCol, int nMaxCol); virtual bool HasFunctionWithUserType(string sTypeName); protected: @@ -117,15 +117,13 @@ /** \brief create target for header file * \param pFEFile the front-end file to use as reference */ - virtual void CreateBackEndHeader(CFEFile *pFEFile) - throw (CBECreateException*) = 0; + virtual void CreateBackEndHeader(CFEFile *pFEFile) = 0; /** \brief create target for implementation file * \param pFEFile the front-end file to use as reference */ - virtual void CreateBackEndImplementation(CFEFile *pFEFile) - throw (CBECreateException*) = 0; + virtual void CreateBackEndImplementation(CFEFile *pFEFile) = 0; - virtual void PrintTargetFileName(FILE *output, string sFilename, + virtual void PrintTargetFileName(ostream& output, string sFilename, int &nCurCol, int nMaxCol); public: diff -ruN p2/l4/tool/dice/src/be/BETrace.cpp p3/l4/tool/dice/src/be/BETrace.cpp --- p2/l4/tool/dice/src/be/BETrace.cpp 2006-08-21 16:46:37.000000000 +0200 +++ p3/l4/tool/dice/src/be/BETrace.cpp 2006-11-30 10:41:10.000000000 +0100 @@ -35,7 +35,6 @@ #include "TypeSpec-Type.h" #include "BETypedDeclarator.h" #include -using namespace std; CBETrace::CBETrace() { @@ -81,6 +80,20 @@ { } +/** \brief write the code required just before the loop starts + * \param pFile the file to write to + * \param pFunction the server loop function calling this hook + * + * This is different from InitServer, because InitServer is called before all + * the variables are initialized. BeforeLoop is called after all the variables + * are initialized and just before the loop actually starts doing something. + */ +void +CBETrace::BeforeLoop(CBEFile* /*pFile*/, + CBEFunction* /*pFunction*/) +{ +} + /** \brief writes default includes required for tracing * \param pFile the file to write to */ @@ -169,7 +182,7 @@ string sOpcodeVar = pNF->GetOpcodeVariable(); string sFunc = CCompiler::GetTraceServerFunc(); - *pFile << "\t" << sFunc << " (\"opcode %%x received\\n\", " + *pFile << "\t" << sFunc << " (\"opcode %x received\\n\", " << sOpcodeVar << ");\n"; } @@ -190,7 +203,7 @@ string sFunc = CCompiler::GetTraceServerFunc(); string sReply = pNF->GetReplyCodeVariable(); - *pFile << "\t" << sFunc << " (\"reply %%s\\n\", (" << + *pFile << "\t" << sFunc << " (\"reply %s\\n\", (" << sReply << "==DICE_REPLY)?\"DICE_REPLY\":" << "((" << sReply << "==DICE_DEFERRED_REPLY)?\"DICE_DEFERRED_REPLY\":" << "\"DICE_NEVER_REPLY\"));\n"; diff -ruN p2/l4/tool/dice/src/be/BETrace.h p3/l4/tool/dice/src/be/BETrace.h --- p2/l4/tool/dice/src/be/BETrace.h 2006-08-04 18:17:17.000000000 +0200 +++ p3/l4/tool/dice/src/be/BETrace.h 2006-11-30 10:41:10.000000000 +0100 @@ -47,6 +47,7 @@ virtual void BeforeCall(CBEFile *pFile, CBEFunction *pFunction); virtual void AfterCall(CBEFile *pFile, CBEFunction *pFunction); virtual void InitServer(CBEFile *pFile, CBEFunction *pFunction); + virtual void BeforeLoop(CBEFile *pFile, CBEFunction *pFunction); virtual void BeforeDispatch(CBEFile *pFile, CBEFunction *pFunction); virtual void AfterDispatch(CBEFile *pFile, CBEFunction *pFunction); virtual void BeforeReplyOnly(CBEFile *pFile, CBEFunction *pFunction); diff -ruN p2/l4/tool/dice/src/be/BEType.cpp p3/l4/tool/dice/src/be/BEType.cpp --- p2/l4/tool/dice/src/be/BEType.cpp 2006-10-14 00:32:30.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEType.cpp 2006-11-30 10:41:10.000000000 +0100 @@ -40,7 +40,6 @@ #include "fe/FESimpleType.h" #include "fe/FEUserDefinedType.h" #include -using namespace std; CBEType::CBEType() { @@ -73,7 +72,6 @@ */ void CBEType::CreateBackEnd(CFETypeSpec * pFEType) - throw (CBECreateException*) { CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CEBType::%s(fe)\n", __func__); assert(pFEType); @@ -128,7 +126,6 @@ CBEType::CreateBackEnd(bool bUnsigned, int nSize, int nFEType) - throw (CBECreateException*) { CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CEBType::%s(%s, %d, %d) called\n", __func__, @@ -143,7 +140,8 @@ m_sName = pNF->GetTypeName(nFEType, bUnsigned, m_nSize); m_nFEType = nFEType; - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CEBType::%s(,,) returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CEBType::%s(,,) returns\n", + __func__); } /** \brief write the type to the target file diff -ruN p2/l4/tool/dice/src/be/BETypedDeclarator.cpp p3/l4/tool/dice/src/be/BETypedDeclarator.cpp --- p2/l4/tool/dice/src/be/BETypedDeclarator.cpp 2006-10-14 00:32:30.000000000 +0200 +++ p3/l4/tool/dice/src/be/BETypedDeclarator.cpp 2006-11-30 10:41:10.000000000 +0100 @@ -56,7 +56,6 @@ #include "Compiler.h" #include #include -using namespace std; CBETypedDeclarator::CBETypedDeclarator() : CBEObject(), @@ -100,7 +99,8 @@ if (!pFile->IsOpen()) return; - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s called for %s\n", + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s called for %s\n", __func__, m_Declarators.First()->GetName().c_str()); WriteAttributes(pFile); @@ -109,7 +109,8 @@ WriteDeclarators(pFile); WriteProperties(pFile); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s returned\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s returned\n", __func__); } /** \brief writes the code to set a variable to a zero value @@ -235,14 +236,14 @@ } if (!pAttr) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s returns (no attr)\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s returns (no attr)\n", __func__); return; } if (pAttr->IsOfType(ATTR_CLASS_IS)) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s an IS attr found\n", - __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s an IS attr found\n", __func__); vector vStack; if (pStack) vStack = *pStack; @@ -281,8 +282,8 @@ pSizeParameter->WriteDeclarators(pFile); // done - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s size attr written\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s size attr written\n", __func__); return; } @@ -307,7 +308,8 @@ *pFile << pAttr->GetString(); } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s returns\n", __func__); } /** \brief writes the maximum size of a variable @@ -327,12 +329,12 @@ CBEType *pType = GetTransmitType(); CBEAttribute *pAttr = 0; - DTRACE("%s called for %s\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s called for %s\n", __func__, m_Declarators.First()->GetName().c_str()); if ((pAttr = m_Attributes.Find(ATTR_MAX_IS)) == 0) { - DTRACE("%s no max_is\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s no max_is\n", __func__); // get declarator CBEDeclarator *pDecl = m_Declarators.First(); @@ -346,7 +348,8 @@ // so we first test for the string attribute // might be string CBESizes *pSizes = CCompiler::GetSizes(); - DTRACE("%s decl %s has string? %s, length? %s, size? %s, char type? %s, stars? %d\n", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s decl %s has string? %s, length? %s, size? %s, char type? %s, stars? %d\n", __func__, pDecl->GetName().c_str(), m_Attributes.Find(ATTR_STRING) ? "yes" : "no", m_Attributes.Find(ATTR_LENGTH_IS) ? "yes" : "no", @@ -374,7 +377,8 @@ // check max size of decl -> that's the easiest way to find out if // there is a variable sized dimension int nMaxSize = pDecl->GetMaxSize(); - DTRACE("%s decl %s max size is %d and is array? %s\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s decl %s max size is %d and is array? %s\n", __func__, pDecl->GetName().c_str(), nMaxSize, pDecl->IsArray() ? "yes" : "no"); if (pDecl->IsArray() && nMaxSize > 0) @@ -427,7 +431,7 @@ "CBETypedDeclarator::%s returns\n", __func__); return; } - DTRACE("%s max_is found\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s max_is found\n", __func__); if (pAttr->IsOfType(ATTR_CLASS_IS)) { vector vStack; @@ -519,20 +523,19 @@ CBEFunction *pUsingFunc, bool& bFoundInStruct) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s (%p, %p, %p, %s) called\n", - __func__, pIsAttribute, pStack, pUsingFunc, + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s (%p, %p, %p, %s) called\n", __func__, + pIsAttribute, pStack, pUsingFunc, bFoundInStruct ? "true" : "false"); - DTRACE("%s: func is %s\n", __func__, - pUsingFunc ? pUsingFunc->GetName().c_str() : "(none)"); - // first: get the name CBEDeclarator *pSizeName = pIsAttribute->m_Parameters.First(); assert(pSizeName); string sSizeName = pSizeName->GetName(); - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s size param is %s\n", - __func__, sSizeName.c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s size param is %s\n", __func__, + sSizeName.c_str()); CBETypedDeclarator *pSizeParameter = 0; @@ -554,8 +557,8 @@ else if (pUnion->IsParent(pStruct)) pStruct = NULL; } - DTRACE("try to find member %s in %s\n", sSizeName.c_str(), - (pStruct) ? "struct" : "union"); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "try to find member %s in %s\n", + sSizeName.c_str(), (pStruct) ? "struct" : "union"); if (pStruct) pSizeParameter = pStruct->m_Members.Find(sSizeName); @@ -593,8 +596,8 @@ pFunction = pUsingFunc; if (!pFunction) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s returns 0 (no func)\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s returns 0 (no func)\n", __func__); return 0; } @@ -605,8 +608,9 @@ pSizeParameter); if (pSizeParameter) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s returns param %s\n", - __func__, pSizeParameter->m_Declarators.First()->GetName().c_str()); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s returns param %s\n", __func__, + pSizeParameter->m_Declarators.First()->GetName().c_str()); return pSizeParameter; } @@ -617,8 +621,9 @@ pSizeParameter); if (pSizeParameter) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s returns local var %s\n", - __func__, pSizeParameter->m_Declarators.First()->GetName().c_str()); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s returns local var %s\n", __func__, + pSizeParameter->m_Declarators.First()->GetName().c_str()); return pSizeParameter; } @@ -667,10 +672,8 @@ } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s returns %p\n", - __func__, pSizeParameter); - - DTRACE("%s: return with size param at %p\n", __func__, pSizeParameter); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s returns %p\n", __func__, pSizeParameter); // return (either found or not) return pSizeParameter; } @@ -804,7 +807,7 @@ { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s called\n", __func__); - CBEType *pType = GetType(); + CBEType *pType = GetTransmitType(); bool bUsePointer = IsString() && !pType->IsPointerType(); // with size_is, length_is we use malloc to init the pointer, @@ -880,10 +883,10 @@ */ void CBETypedDeclarator::CreateBackEnd(CFETypedDeclarator * pFEParameter) - throw (CBECreateException*) { assert(pFEParameter); - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s(fe) called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s(fe) called\n", __func__); // call CBEObject's CreateBackEnd method CBEObject::CreateBackEnd(pFEParameter); @@ -897,7 +900,8 @@ m_pType = 0; } - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s(fe) cleaned\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s(fe) cleaned\n", __func__); // get names // for_each(pFEParameter->m_Declarators.begin(), @@ -911,8 +915,8 @@ AddDeclarator(*iD); } - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s(fe) decl created\n", - __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s(fe) decl created\n", __func__); // get type m_pType = pCF->GetNewType(pFEParameter->GetType()->GetType()); m_pType->SetParent(this); @@ -926,8 +930,8 @@ m_pType = 0; throw; } - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s(fe) type created\n", - __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s(fe) type created\n", __func__); // get attributes // for_each(pFEParameter->m_Attributes.begin(), @@ -941,8 +945,8 @@ AddAttribute(*iA); } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s(fe) returns true\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s(fe) returns true\n", __func__); } /** \brief creates the typed declarator using user defined type and name @@ -955,10 +959,10 @@ CBETypedDeclarator::CreateBackEnd(string sUserDefinedType, string sName, int nStars) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s(%s, %s, %d) called\n", - __func__, sUserDefinedType.c_str(), sName.c_str(), nStars); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s(%s, %s, %d) called\n", __func__, + sUserDefinedType.c_str(), sName.c_str(), nStars); // create decl @@ -980,7 +984,8 @@ m_pType = 0; throw; } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s() returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s() returns\n", __func__); } /** \brief creates the typed declarator using a given back-end type and a name @@ -991,10 +996,10 @@ void CBETypedDeclarator::CreateBackEnd(CBEType * pType, string sName) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s(%p, %s) called\n", - __func__, pType, sName.c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s(%p, %s) called\n", __func__, pType, + sName.c_str()); // create decl AddDeclarator(sName, 0); @@ -1006,8 +1011,8 @@ m_pType->SetParent(this); // do not need to call create, because original has been created before. - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s(type, name) returns true\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s(type, name) returns true\n", __func__); } /** \brief add an attribute constructed from a front-end attribute @@ -1015,7 +1020,6 @@ */ void CBETypedDeclarator::AddAttribute(CFEAttribute *pFEAttribute) - throw (CBECreateException*) { CBEAttribute *pAttribute = CCompiler::GetClassFactory()->GetNewAttribute(); m_Attributes.Add(pAttribute); @@ -1025,7 +1029,7 @@ } catch (CBECreateException *e) { - m_Attributes.Remove(pAttribute); + m_Attributes.Remove(pAttribute); delete pAttribute; throw; } @@ -1035,7 +1039,6 @@ * \param pFEDeclarator the front-end declarator */ void CBETypedDeclarator::AddDeclarator(CFEDeclarator * pFEDeclarator) - throw (CBECreateException*) { CBEClassFactory *pCF = CCompiler::GetClassFactory(); CBEDeclarator *pDecl = pCF->GetNewDeclarator(); @@ -1057,7 +1060,6 @@ * \param nStars the number of stars of this decl */ void CBETypedDeclarator::AddDeclarator(string sName, int nStars) - throw (CBECreateException*) { CBEClassFactory *pCF = CCompiler::GetClassFactory(); CBEDeclarator *pDecl = pCF->GetNewDeclarator(); @@ -1109,15 +1111,17 @@ */ bool CBETypedDeclarator::IsString() { - DTRACE("%s called for %s in func %s\n", __func__, - m_Declarators.First()->GetName().c_str(), + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s called for %s in func %s\n", + __func__, m_Declarators.First()->GetName().c_str(), GetSpecificParent() ? GetSpecificParent()->GetName().c_str() : "(no func)"); if (!m_Attributes.Find(ATTR_STRING)) { - DTRACE("%s returns false: no string attribute\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s returns false: no string attribute\n", __func__); return false; } /* do NOT test for size_is/length_is because: @@ -1127,7 +1131,8 @@ if (m_pType->IsOfType(TYPE_CHAR_ASTERISK) && !m_pType->IsUnsigned()) { - DTRACE("%s returns true: char* and !unsigned\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s returns true: char* and !unsigned\n", __func__); return true; } if (m_pType->IsOfType(TYPE_CHAR) && @@ -1143,12 +1148,15 @@ // == 0 -> bitfield if ((nSize < 0) || (nSize > 1)) { - DTRACE("%s returns true: size is %d\n", __func__, nSize); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s returns true: size is %d\n", __func__, + nSize); return true; } } } - DTRACE("%s returns false: type is %d\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s returns false: type is %d\n", __func__, m_pType->GetFEType()); return false; } @@ -1184,8 +1192,9 @@ */ bool CBETypedDeclarator::IsVariableSized() { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s called for %s\n", - __func__, m_Declarators.First()->GetName().c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s called for %s\n", __func__, + m_Declarators.First()->GetName().c_str()); // need the root CBERoot *pRoot = GetSpecificParent(); @@ -1302,21 +1311,6 @@ } // no size/max attribute and no unbound array: // should be treated as scalar -// -/* pIter = GetFirstDeclarator(); - pDeclarator = GetNextDeclarator(pIter); - DTRACE("CLangCTypedDeclarator::IsVariableSized(%s): size_is=%s, string=%s, ref=%s, type=%d, stars=%d, size=%d, OUT=%s, constr.=%s, func=%s\n", - pDeclarator->GetName(), - (m_Attributes.Find(ATTR_SIZE_IS))?"true":"false", - (m_Attributes.Find(ATTR_STRING))?"true":"false", - (m_Attributes.Find(ATTR_REF))?"true":"false", - GetType()->GetFEType(), - pDeclarator->GetStars(), - pDeclarator->GetSize(), - (m_Attributes.Find(ATTR_OUT))?"true":"false", - (GetType() && GetType()->IsConstructedType())?"true":"false", - GetSpecificParent()->GetName());*/ -// CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s returns false\n", __func__); return false; @@ -1361,7 +1355,8 @@ */ int CBETypedDeclarator::GetSize() { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s called (decl %s)\n", + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s called (decl %s)\n", __func__, m_Declarators.First()->GetName().c_str()); int nSize = 0; @@ -1416,8 +1411,8 @@ */ CBEType* CBETypedDeclarator::GetTransmitType() { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s called\n", - __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s called\n", __func__); CBEType *pType = m_pType; CBEAttribute *pAttr = m_Attributes.Find(ATTR_TRANSMIT_AS); @@ -1425,8 +1420,8 @@ pType = pAttr->GetAttrType(); // get type - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s returns %p\n", - __func__, pType); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s returns %p\n", __func__, pType); return pType; } @@ -1444,21 +1439,24 @@ int CBETypedDeclarator::GetSizeOfDeclarator(CBEDeclarator *pDeclarator) { assert(pDeclarator); - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s(%s) called\n", - __func__, pDeclarator->GetName().c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s(%s) called\n", __func__, + pDeclarator->GetName().c_str()); CBEType *pType = GetTransmitType(); if (pType->IsVoid()) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s(%s) returns void tt 0\n", + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s(%s) returns void (trans-type 0)\n", __func__, pDeclarator->GetName().c_str()); return 0; } int nTypeSize = pType->GetSize(); int nDeclSize = pDeclarator->GetSize(); - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s %s: type(%d): %d, decl: %d\n", - __func__, m_Declarators.First()->GetName().c_str(), pType->GetFEType(), + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s %s: type(%d): %d, decl: %d\n", __func__, + m_Declarators.First()->GetName().c_str(), pType->GetFEType(), nTypeSize, nDeclSize); // if referenced OUT, this is the size @@ -1466,8 +1464,8 @@ (pDeclarator->GetStars() == 1) && (m_Attributes.Find(ATTR_OUT))) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s returns ref-out %d\n", - __func__, nTypeSize); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s returns ref-out %d\n", __func__, nTypeSize); return nTypeSize; } // if reference struct, this is the size @@ -1475,20 +1473,20 @@ (pDeclarator->GetStars() == 1) && (pType->IsConstructedType())) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s returns ts:%d\n", - __func__, nTypeSize); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s returns ts:%d\n", __func__, nTypeSize); return nTypeSize; } // if variables sized, return -1 if (nDeclSize < 0) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s returns -1\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s returns -1\n", __func__); return -1; } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s returns %d\n", - __func__, nDeclSize * nTypeSize); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s returns %d\n", __func__, nDeclSize*nTypeSize); // if bitfield: it multiplies with zero and returns zero // const array or simple? -> return array-dimension * type's size return nDeclSize * nTypeSize; @@ -1537,7 +1535,7 @@ { int nTmp = pAttr->GetRemainingNumberOfIsAttributes( pAttr->m_Parameters.begin()); - nDimension = max(nDimension, nTmp); + nDimension = std::max(nDimension, nTmp); } } return false; @@ -1556,10 +1554,6 @@ CBETypedDeclarator::GetMaxSize(bool bGuessSize, int & nSize, string sName) { - DTRACE( - "%s(%s, %s) called.\n", - __func__, bGuessSize ? "true" : "false", - sName.empty() ? "(none)" : sName.c_str()); CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s(%s, %s) called.\n", __func__, bGuessSize ? "true" : "false", @@ -1579,9 +1573,6 @@ // get type's size (this returns either the simple type's size or the // maximum size of a constructed type) int nTypeSize = pType->GetMaxSize(); - DTRACE( - "%s size of type (%d) is %d\n", __func__, - pType->GetFEType(), nTypeSize); CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s size of type (%d) is %d\n", __func__, pType->GetFEType(), nTypeSize); @@ -1592,11 +1583,6 @@ iterD != m_Declarators.end(); iterD++) { - DTRACE( - "%s sName empty? %s || \"%s\" != \"%s\" (%s)\n", - __func__, sName.empty() ? "true" : "false", - (*iterD)->GetName().c_str(), sName.empty() ? "" : sName.c_str(), - (sName.empty() || (*iterD)->GetName() != sName) ? "continue" : "calc"); CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s sName empty? %s || \"%s\" != \"%s\" (%s)\n", __func__, sName.empty() ? "true" : "false", @@ -1607,9 +1593,6 @@ continue; int nDeclSize = (*iterD)->GetMaxSize(); - DTRACE( - "%s size of %s is %d with type size being %d\n", - __func__, (*iterD)->GetName().c_str(), nDeclSize, nTypeSize); CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s size of %s is %d with type size being %d\n", __func__, (*iterD)->GetName().c_str(), nDeclSize, nTypeSize); @@ -1630,7 +1613,8 @@ m_Attributes.Find(ATTR_LENGTH_IS) || m_Attributes.Find(ATTR_MAX_IS))) { - DTRACE("%s some size attribute\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s some size attribute\n", + __func__); int nDimensions = 1; if (GetSizeOrDimensionOfAttr(ATTR_SIZE_IS, nSize, nDimensions)) continue; @@ -1640,13 +1624,15 @@ continue; if (bGuessSize) { - DTRACE("%s guessing size for size attr\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s guessing size for size attr\n", __func__); WarnNoMax(nTypeSize * -nDeclSize); nSize += pSizes->GetMaxSizeOfType(pType->GetFEType()) * nDimensions; continue; } } - DTRACE("%s decl size is %d\n", __func__, nDeclSize); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s decl size is %d\n", __func__, + nDeclSize); // if referenced, this is the size if (nDeclSize == -((*iterD)->GetStars())) nDeclSize = -nDeclSize; @@ -1657,11 +1643,11 @@ // const array or simple? -> return array-dimension * type's size nSize += nDeclSize * nTypeSize; - DTRACE("%s total now %d\n", __func__, nSize); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s total now %d\n", __func__, + nSize); } - DTRACE( - "CBETypedDeclarator::%s up to now its %d\n", __func__, nSize); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s up to now its %d\n", __func__, nSize); @@ -1672,7 +1658,11 @@ // if no max-is attribute found and bVarSized NOT set, then use the // maximum size determined so far (if non-negative) if (!pAttr && !bVarSized && (nSize > 0)) + { + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s finished max-size\n", __func__); return true; + } // otherwise check again nSize = -1; @@ -1697,8 +1687,6 @@ } } - DTRACE( - "CBETypedDeclarator::%s returning %d\n", __func__, nSize); CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s returning %d\n", __func__, nSize); return (nSize > 0); @@ -1729,8 +1717,8 @@ { if (!pNewType) return; - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s(%p) called\n", - __func__, pNewType); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s(%p) called\n", __func__, pNewType); if (dynamic_cast(pNewType)) { assert(dynamic_cast(pNewType)->GetName() != @@ -1741,7 +1729,8 @@ m_pType = pNewType; pNewType->SetParent(this); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedDeclarator::%s returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedDeclarator::%s returns\n", __func__); } /** \brief returns the size of the bitfield declarator in bits @@ -1835,12 +1824,13 @@ CBETypedDeclarator::FindLanguageProperty(string sProperty, string& sPropertyString) { - DTRACE("%s for %s (%s)\n", __func__, m_Declarators.First()->GetName().c_str(), - sProperty.c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s for %s (%s)\n", __func__, + m_Declarators.First()->GetName().c_str(), sProperty.c_str()); multimap::iterator iter = m_mProperties.begin(); for (; iter != m_mProperties.end(); iter++) { - DTRACE(" checking %s\n", (*iter).first.c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, " checking %s\n", + (*iter).first.c_str()); if ((*iter).first == sProperty) { sPropertyString = (*iter).second; @@ -1870,7 +1860,7 @@ if (bComma) *pFile << ", "; - DTRACE("%s for %s (%d) in %s (%p -> %p)\n", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s for %s (%d) in %s (%p -> %p)\n", __func__, (*iterD)->GetName().c_str(), (*iterD)->GetStars(), (GetSpecificParent()) ? @@ -1913,7 +1903,8 @@ bool bIsArray = IsString(); bool bCheckedArrayDims = false; // test all declarators for strings - DTRACE("%s for %s (1): is-array %s, bChecked %s\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s for %s (1): is-array %s, bChecked %s\n", __func__, m_Declarators.First()->GetName().c_str(), (bIsArray) ? "true" : "false", (bCheckedArrayDims) ? "true" : "false"); if (!bIsArray) @@ -1944,7 +1935,8 @@ bCheckedArrayDims = true; } } - DTRACE("%s for %s (2): is-array %s, bChecked %s\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s for %s (2): is-array %s, bChecked %s\n", __func__, m_Declarators.First()->GetName().c_str(), (bIsArray) ? "true" : "false", (bCheckedArrayDims) ? "true" : "false"); // test for size/length/max attributes, which indicate arrays @@ -1961,7 +1953,8 @@ // if max_is is found now its a pointer, which can use some // const, but this has been enabled by the above checks (array-dims == 0) // already - DTRACE("%s for %s (3): is-array %s, bChecked %s\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s for %s (3): is-array %s, bChecked %s\n", __func__, m_Declarators.First()->GetName().c_str(), (bIsArray) ? "true" : "false", (bCheckedArrayDims) ? "true" : "false"); bool bNoCorbaType = !CCompiler::IsOptionSet(PROGRAM_USE_CORBA_TYPES); @@ -1978,7 +1971,8 @@ (sName.substr(0, 6) == "CORBA_")) bNoCorbaType = false; } - DTRACE("%s for %s (4): is-array %s, constr %s, use corba type %s\n", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s for %s (4): is-array %s, constr %s, use corba type %s\n", __func__, m_Declarators.First()->GetName().c_str(), (bIsArray) ? "true" : "false", (bConstructed) ? "true" : "false", @@ -1986,7 +1980,8 @@ // string check if (bConstructed || bIsArray) { - DTRACE("%s for %s (5): constr %s, array %s -> client %s, no corba %s, ptr %s\n", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s for %s (5): constr %s, array %s -> client %s, no corba %s, ptr %s\n", __func__, m_Declarators.First()->GetName().c_str(), (bConstructed) ? "true" : "false", diff -ruN p2/l4/tool/dice/src/be/BETypedDeclarator.h p3/l4/tool/dice/src/be/BETypedDeclarator.h --- p2/l4/tool/dice/src/be/BETypedDeclarator.h 2006-10-14 00:32:30.000000000 +0200 +++ p3/l4/tool/dice/src/be/BETypedDeclarator.h 2006-11-30 10:41:10.000000000 +0100 @@ -37,7 +37,7 @@ #include "Attribute-Type.h" #include #include -using namespace std; +using std::multimap; class CFETypedDeclarator; class CFEDeclarator; @@ -70,13 +70,9 @@ CBETypedDeclarator(CBETypedDeclarator & src); public: - virtual void CreateBackEnd(CBEType * pType, string sName) - throw (CBECreateException*); - virtual void CreateBackEnd(string sUserDefinedType, string sName, - int nStars) - throw (CBECreateException*); - virtual void CreateBackEnd(CFETypedDeclarator * pFEParameter) - throw (CBECreateException*); + virtual void CreateBackEnd(CBEType * pType, string sName); + virtual void CreateBackEnd(string sUserDefinedType, string sName, int nStars); + virtual void CreateBackEnd(CFETypedDeclarator * pFEParameter); int GetSize(); int GetSize(string sName); @@ -95,14 +91,11 @@ bool Match(string sName); CBEDeclarator *GetCallDeclarator(); void RemoveCallDeclarator(); - void AddDeclarator(CFEDeclarator * pFEDeclarator) - throw (CBECreateException*); - void AddDeclarator(string sName, int nStars) - throw (CBECreateException*); + void AddDeclarator(CFEDeclarator * pFEDeclarator); + void AddDeclarator(string sName, int nStars); CBEAttribute* FindIsAttribute(string sDeclName); - void AddAttribute(CFEAttribute *pFEAttribute) - throw (CBECreateException*); + void AddAttribute(CFEAttribute *pFEAttribute); /** \brief creates a new instance of this class * \return a reference to the copy @@ -144,9 +137,10 @@ virtual void WriteForwardTypeDeclaration(CBEFile * pFile, bool bUseConst = true); + CBEType* GetTransmitType(); + protected: int GetSizeOfDeclarator(CBEDeclarator *pDeclarator); - CBEType* GetTransmitType(); CBETypedDeclarator* GetSizeVariable(CBEAttribute *pIsAttribute, vector *pStack, CBEFunction *pUsingFunc, bool& bFoundInStruct); @@ -183,5 +177,4 @@ CSearchableCollection m_Declarators; }; - #endif //*/ !__DICE_BETYPEDDECLARATOR_H__ diff -ruN p2/l4/tool/dice/src/be/BETypedef.cpp p3/l4/tool/dice/src/be/BETypedef.cpp --- p2/l4/tool/dice/src/be/BETypedef.cpp 2006-10-10 14:55:35.000000000 +0200 +++ p3/l4/tool/dice/src/be/BETypedef.cpp 2006-11-30 10:41:10.000000000 +0100 @@ -38,7 +38,6 @@ #include "fe/FEDeclarator.h" #include "fe/FEFile.h" #include -using namespace std; CBETypedef::CBETypedef() : m_sDefine() @@ -59,9 +58,9 @@ */ void CBETypedef::CreateBackEnd(CFETypedDeclarator * pFETypedef) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBETypedef::%s called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBETypedef::%s called\n", + __func__); // set target file name SetTargetFileName(pFETypedef); @@ -87,7 +86,8 @@ pDecl->GetName()); } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedef::%s returns true\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedef::%s returns true\n", __func__); } /** \brief creates the typed declarator using a given back-end type and a name @@ -101,10 +101,9 @@ CBETypedef::CreateBackEnd(CBEType * pType, string sName, CFEBase *pFERefObject) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBETypedef::%s(%p, %s) called\n", __func__, - pType, sName.c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBETypedef::%s(%p, %s) called\n", __func__, pType, sName.c_str()); SetTargetFileName(pFERefObject); // if declarator changes, we have to reset the alias as well @@ -126,8 +125,8 @@ if (pFEFile) SetSourceFileName(pFEFile->GetFileName()); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedef::%s(type, name) returns\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedef::%s(type, name) returns\n", __func__); } /** \brief adds a typedefinition to the header file @@ -141,11 +140,13 @@ { CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBETypedef::AddToFile(header: %s) for typedef %s called\n", - pHeader->GetFileName().c_str(), m_Declarators.First()->GetName().c_str()); + pHeader->GetFileName().c_str(), + m_Declarators.First()->GetName().c_str()); if (IsTargetFile(pHeader)) pHeader->m_Typedefs.Add(this); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedef::AddToFile(header) return true\n"); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBETypedef::AddToFile(header) return true\n"); return true; } @@ -185,7 +186,8 @@ else WriteDeclaration(pFile); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedef::%s returned\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBETypedef::%s returned\n", + __func__); } /** \brief delegates the call to the language specific class diff -ruN p2/l4/tool/dice/src/be/BETypedef.h p3/l4/tool/dice/src/be/BETypedef.h --- p2/l4/tool/dice/src/be/BETypedef.h 2006-06-14 14:25:01.000000000 +0200 +++ p3/l4/tool/dice/src/be/BETypedef.h 2006-11-30 10:41:10.000000000 +0100 @@ -56,11 +56,8 @@ CBETypedef(CBETypedef &src); public: - virtual void CreateBackEnd(CFETypedDeclarator *pFETypedef) - throw (CBECreateException*); - virtual void CreateBackEnd(CBEType * pType, string sName, - CFEBase *pFERefObject) - throw (CBECreateException*); + virtual void CreateBackEnd(CFETypedDeclarator *pFETypedef); + virtual void CreateBackEnd(CBEType * pType, string sName, CFEBase *pFERefObject); virtual bool AddToFile(CBEHeaderFile *pHeader); /** \brief creates a new instance of this object diff -ruN p2/l4/tool/dice/src/be/BEType.h p3/l4/tool/dice/src/be/BEType.h --- p2/l4/tool/dice/src/be/BEType.h 2006-06-14 14:25:01.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEType.h 2006-11-30 10:41:10.000000000 +0100 @@ -32,7 +32,7 @@ #include "be/BEObject.h" #include -using namespace std; +using std::vector; class CBEFile; class CBETypedef; @@ -72,10 +72,8 @@ virtual int GetSize(); virtual int GetMaxSize(); virtual bool IsVoid(); - virtual void CreateBackEnd(bool bUnsigned, int nSize, int nFEType) - throw (CBECreateException*); - virtual void CreateBackEnd(CFETypeSpec *pFEType) - throw (CBECreateException*); + virtual void CreateBackEnd(bool bUnsigned, int nSize, int nFEType); + virtual void CreateBackEnd(CFETypeSpec *pFEType); virtual CBETypedef* GetTypedef(); virtual void Write(CBEFile *pFile); virtual void WriteToStr(string &str); @@ -106,11 +104,11 @@ * \brief indicates if this type is unsigned */ bool m_bUnsigned; - /** \var unsigned int m_nSize - * \brief specifies the size of the type in bytes + /** \var int m_nSize + * \brief cached value of size */ int m_nSize; - /** \var unsigned int m_nMaxSize + /** \var int m_nMaxSize * \brief cached value of maximum size */ int m_nMaxSize; diff -ruN p2/l4/tool/dice/src/be/BEUnionCase.cpp p3/l4/tool/dice/src/be/BEUnionCase.cpp --- p2/l4/tool/dice/src/be/BEUnionCase.cpp 2006-10-10 16:08:41.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEUnionCase.cpp 2006-11-30 10:41:10.000000000 +0100 @@ -35,7 +35,6 @@ #include "fe/FEUnionCase.h" #include "Compiler.h" #include -using namespace std; CBEUnionCase::CBEUnionCase() : m_Labels(0, this) @@ -61,35 +60,34 @@ */ void CBEUnionCase::CreateBackEnd(CFEUnionCase * pFEUnionCase) - throw (CBECreateException*) { assert(pFEUnionCase); // the union arm is the typed declarator we initialize the base class with: CBETypedDeclarator::CreateBackEnd(pFEUnionCase->GetUnionArm()); // now init union case specific stuff m_bDefault = pFEUnionCase->IsDefault(); - if (!m_bDefault) - { - CBEClassFactory *pCF = CCompiler::GetClassFactory(); + if (m_bDefault) + return; + + CBEClassFactory *pCF = CCompiler::GetClassFactory(); - vector::iterator iter; - for (iter = pFEUnionCase->m_UnionCaseLabelList.begin(); - iter != pFEUnionCase->m_UnionCaseLabelList.end(); - iter++) + vector::iterator iter; + for (iter = pFEUnionCase->m_UnionCaseLabelList.begin(); + iter != pFEUnionCase->m_UnionCaseLabelList.end(); + iter++) + { + CBEExpression *pLabel = pCF->GetNewExpression(); + m_Labels.Add(pLabel); + try + { + pLabel->CreateBackEnd(*iter); + } + catch (CBECreateException *e) { - CBEExpression *pLabel = pCF->GetNewExpression(); - m_Labels.Add(pLabel); - try - { - pLabel->CreateBackEnd(*iter); - } - catch (CBECreateException *e) - { - m_Labels.Remove(pLabel); - delete pLabel; - throw; - } - } + m_Labels.Remove(pLabel); + delete pLabel; + throw; + } } } @@ -107,10 +105,9 @@ string sName, CBEExpression *pCaseLabel, bool bDefault) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEUnionCase::%s called for %s\n", - __func__, sName.c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEUnionCase::%s called for %s\n", __func__, sName.c_str()); CBETypedDeclarator::CreateBackEnd(pType, sName); m_bDefault = bDefault; @@ -119,5 +116,6 @@ m_Labels.Add(pCaseLabel); } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEUnionCase::%s returns true\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEUnionCase::%s returns true\n", __func__); } diff -ruN p2/l4/tool/dice/src/be/BEUnionCase.h p3/l4/tool/dice/src/be/BEUnionCase.h --- p2/l4/tool/dice/src/be/BEUnionCase.h 2006-08-21 16:46:37.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEUnionCase.h 2006-11-30 10:41:10.000000000 +0100 @@ -33,7 +33,6 @@ #include "be/BETypedDeclarator.h" #include "template.h" #include -using namespace std; class CFEUnionCase; class CBEExpression; @@ -59,11 +58,9 @@ CBEUnionCase(CBEUnionCase & src); public: - virtual void CreateBackEnd(CFEUnionCase * pFEUnionCase) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEUnionCase * pFEUnionCase); virtual void CreateBackEnd(CBEType *pType, string sName, - CBEExpression *pCaseLabel, bool bDefault) - throw (CBECreateException*); + CBEExpression *pCaseLabel, bool bDefault); /** \brief returns true if this is the default case * \return true if this is the default case diff -ruN p2/l4/tool/dice/src/be/BEUnionType.cpp p3/l4/tool/dice/src/be/BEUnionType.cpp --- p2/l4/tool/dice/src/be/BEUnionType.cpp 2006-10-13 18:30:24.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEUnionType.cpp 2006-11-30 10:41:10.000000000 +0100 @@ -44,7 +44,6 @@ #include "Attribute-Type.h" #include "Compiler.h" #include -using namespace std; CBEUnionType::CBEUnionType() : m_sTag(), @@ -71,9 +70,9 @@ */ void CBEUnionType::CreateBackEnd(CFETypeSpec * pFEType) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEUnionType::%s(fe) called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEUnionType::%s(fe) called\n", __func__); // sets m_sName to "union" CBEType::CreateBackEnd(pFEType); @@ -97,7 +96,7 @@ } catch (CBECreateException *e) { - m_UnionCases.Remove(pUnionCase); + m_UnionCases.Remove(pUnionCase); delete pUnionCase; e->Print(); delete e; @@ -116,12 +115,12 @@ assert(pFERoot); CFEConstructedType *pFETaggedDecl = pFERoot->FindTaggedDecl(sTag); if (pFETaggedDecl) - m_sTag = pNF->GetTypeName(pFETaggedDecl, sTag); - else - m_sTag = sTag; + sTag = pNF->GetTypeName(pFETaggedDecl, sTag); } + m_sTag = sTag; - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEUnionType::%s(fe) returns\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEUnionType::%s(fe) returns\n", __func__); } /** \brief creates a union @@ -129,10 +128,9 @@ */ void CBEUnionType::CreateBackEnd(string sTag) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEUnionType::%s(%s) called\n", __func__, - sTag.c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEUnionType::%s(%s) called\n", __func__, sTag.c_str()); string exc = string(__func__); @@ -148,8 +146,8 @@ m_nFEType = TYPE_UNION; m_sTag = sTag; - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEUnionType::%s(%s) returns\n", __func__, - sTag.c_str()); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEUnionType::%s(%s) returns\n", __func__, sTag.c_str()); } /** \brief writes the union to the target file @@ -206,15 +204,15 @@ * \return the size in bytes * * The union type's size is the size of the biggest member and the switch type. + * + * Do NOT use cached size, because the size of a member might have changed. */ int CBEUnionType::GetSize() { CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, - "CBEUnionType::%s (m_nSize = %d)\n", __func__, m_nSize); - - if (m_nSize != 0) - return m_nSize; + "CBEUnionType::%s\n", __func__); + int nSize = 0; vector::iterator iter; for (iter = m_UnionCases.begin(); iter != m_UnionCases.end(); @@ -235,23 +233,23 @@ // its exact size to determine a message buffer size if (nUnionSize < 0) { - m_nSize = nUnionSize; + nSize = nUnionSize; CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEUnionType::%s var sized, return -1\n", __func__); return nUnionSize; } - if (m_nSize < nUnionSize) - m_nSize = nUnionSize; + if (nSize < nUnionSize) + nSize = nUnionSize; } - if (m_UnionCases.empty() && (m_nSize == 0)) + if (m_UnionCases.empty() && (nSize == 0)) { // forward declared union -> find definition of union if (m_sTag.empty()) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEUnionType::%s returns %d (empty)\n", - __func__, m_nSize); - return m_nSize; + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEUnionType::%s returns %d (empty)\n", __func__, nSize); + return nSize; } CBERoot *pRoot = GetSpecificParent(); @@ -261,15 +259,15 @@ { CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEUnionType::%s returns %d (no union %s found)\n", - __func__, m_nSize, m_sTag.c_str()); - return m_nSize; + __func__, nSize, m_sTag.c_str()); + return nSize; } - m_nSize = pType->GetSize(); + nSize = pType->GetSize(); } - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEUnionType::%s return %d\n", __func__, - m_nSize); - return m_nSize; + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEUnionType::%s return %d\n", + __func__, nSize); + return nSize; } /** \brief calculates the maximum size of this union type @@ -278,15 +276,17 @@ * This implemetation tries to determine the usual size. If that is negative, * i.e., the union is of variable size, we have rerun the algorithm and * retrieve the maximum sizes for the members. + * + * Do NOT use cached max size, because size might have changed. */ int CBEUnionType::GetMaxSize() { - m_nMaxSize = GetSize(); - if (m_nMaxSize > 0) - return m_nMaxSize; + int nMaxSize = GetSize(); + if (nMaxSize > 0) + return nMaxSize; - // reset m_nMaxSize, because it could have been negative before - m_nMaxSize = 0; + // reset nMaxSize, because it could have been negative before + nMaxSize = 0; vector::iterator iter; for (iter = m_UnionCases.begin(); iter != m_UnionCases.end(); @@ -303,25 +303,25 @@ { continue; } - if (m_nMaxSize < nUnionSize) - m_nMaxSize = nUnionSize; + if (nMaxSize < nUnionSize) + nMaxSize = nUnionSize; } - if (m_UnionCases.empty() && (m_nMaxSize == 0)) + if (m_UnionCases.empty() && (nMaxSize == 0)) { // forward declared union -> find definition of union if (m_sTag.empty()) - return m_nMaxSize; + return nMaxSize; CBERoot *pRoot = GetSpecificParent(); assert(pRoot); CBEType *pType = pRoot->FindTaggedType(TYPE_UNION, m_sTag); if (!pType) - return m_nMaxSize; - m_nMaxSize = pType->GetMaxSize(); + return nMaxSize; + nMaxSize = pType->GetMaxSize(); } - return m_nMaxSize; + return nMaxSize; } /** \brief counts the union cases diff -ruN p2/l4/tool/dice/src/be/BEUnionType.h p3/l4/tool/dice/src/be/BEUnionType.h --- p2/l4/tool/dice/src/be/BEUnionType.h 2006-08-21 16:46:37.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEUnionType.h 2006-11-30 10:41:10.000000000 +0100 @@ -33,7 +33,6 @@ #include "be/BEType.h" #include "template.h" #include -using namespace std; class CBEContext; class CBEUnionCase; @@ -84,10 +83,8 @@ vector *pStack, vector::iterator iCurr); - virtual void CreateBackEnd(CFETypeSpec * pFEType) - throw (CBECreateException*); - virtual void CreateBackEnd(string sTag) - throw (CBECreateException*); + virtual void CreateBackEnd(CFETypeSpec * pFEType); + virtual void CreateBackEnd(string sTag); virtual int GetSize(); virtual int GetMaxSize(); diff -ruN p2/l4/tool/dice/src/be/BEUnmarshalFunction.cpp p3/l4/tool/dice/src/be/BEUnmarshalFunction.cpp --- p2/l4/tool/dice/src/be/BEUnmarshalFunction.cpp 2006-10-10 16:08:41.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEUnmarshalFunction.cpp 2006-11-30 10:41:10.000000000 +0100 @@ -49,7 +49,6 @@ #include "fe/FEOperation.h" #include "fe/FETypedDeclarator.h" #include -using namespace std; CBEUnmarshalFunction::CBEUnmarshalFunction() : CBEOperationFunction(FUNCTION_UNMARSHAL) @@ -76,7 +75,6 @@ */ void CBEUnmarshalFunction::CreateBackEnd(CFEOperation * pFEOperation) - throw (CBECreateException*) { CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEUnmarshalFunction::%s(%s) called\n", __func__, @@ -98,8 +96,8 @@ CreateCommunication(); CreateTrace(); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEUnmarshalFunction::%s returns\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEUnmarshalFunction::%s returns\n", __func__); } /** \brief manipulate the message buffer @@ -188,7 +186,6 @@ */ void CBEUnmarshalFunction::AddParameter(CFETypedDeclarator * pFEParameter) - throw (CBECreateException*) { if (IsComponentSide()) { @@ -275,7 +272,8 @@ bool bCall) { CBETypedDeclarator *pParameter = GetParameter(pDeclarator, bCall); - DTRACE("%s for %s in func %s: parameter at %p\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s for %s in func %s: parameter at %p\n", __func__, pDeclarator->GetName().c_str(), GetName().c_str(), pParameter); if (!pParameter) return false; @@ -289,7 +287,8 @@ pType = pAttr->GetAttrType(); int nArrayDimensions = pDeclarator->GetArrayDimensionCount() - pType->GetArrayDimensionCount(); - DTRACE("%s: check stars (%d), ptr-type %s (%d), array-dimensions %d\n", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s: check stars (%d), ptr-type %s (%d), array-dimensions %d\n", __func__, pDeclarator->GetStars(), pType->IsPointerType() ? "yes" : "no", pType->GetFEType(), nArrayDimensions); @@ -297,7 +296,8 @@ if ((pDeclarator->GetStars() == 0) && !pType->IsPointerType() && (nArrayDimensions <= 0)) return true; - DTRACE("%s: check [string] %s, char type %s, stars %d < 2\n", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s: check [string] %s, char type %s, stars %d < 2\n", __func__, pParameter->m_Attributes.Find(ATTR_STRING) ? "yes" : "no", pType->IsOfType(TYPE_CHAR) ? "yes" : "no", pDeclarator->GetStars()); // checking string @@ -330,7 +330,8 @@ // otherwise either it was one of our own size attributes or the // array dimensions were > 0 } - DTRACE("%s check [length] %s, [max] %s, array-dims %d\n", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s check [length] %s, [max] %s, array-dims %d\n", __func__, pParameter->m_Attributes.Find(ATTR_LENGTH_IS) ? "yes" : "no", pParameter->m_Attributes.Find(ATTR_MAX_IS) ? "yes" : "no", @@ -340,7 +341,8 @@ (nArrayDimensions <= 0)) return true; } - DTRACE("%s: Nothing found, call base\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s: Nothing found, call base\n", __func__); return CBEOperationFunction::HasAdditionalReference(pDeclarator, bCall); } @@ -456,7 +458,6 @@ */ void CBEUnmarshalFunction::AddAfterParameters() - throw (CBECreateException*) { CBEClassFactory *pCF = CCompiler::GetClassFactory(); CBENameFactory *pNF = CCompiler::GetNameFactory(); @@ -498,7 +499,8 @@ // if no parameter, then try to find it in the message buffer CBEMsgBuffer *pMsgBuf = m_pClass->GetMessageBuffer(); - DTRACE("%s message buffer in class at %p\n", __func__, pMsgBuf); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s message buffer in class at %p\n", + __func__, pMsgBuf); if (!pMsgBuf) return 0; CBENameFactory *pNF = CCompiler::GetNameFactory(); @@ -506,7 +508,7 @@ pRet = pMsgBuf->FindMember(sName, this, GetSendDirection()); if (!pRet) pRet = pMsgBuf->FindMember(sName, this, GetReceiveDirection()); - DTRACE("%s exception var %s at %p\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s exception var %s at %p\n", __func__, sName.c_str(), pRet); return pRet; diff -ruN p2/l4/tool/dice/src/be/BEUnmarshalFunction.h p3/l4/tool/dice/src/be/BEUnmarshalFunction.h --- p2/l4/tool/dice/src/be/BEUnmarshalFunction.h 2006-07-26 18:44:20.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEUnmarshalFunction.h 2006-11-30 10:41:11.000000000 +0100 @@ -55,8 +55,7 @@ CBEUnmarshalFunction(CBEUnmarshalFunction &src); public: - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); virtual bool DoMarshalParameter(CBETypedDeclarator * pParameter, bool bMarshal); virtual bool HasAdditionalReference(CBEDeclarator * pDeclarator, @@ -71,14 +70,12 @@ virtual CBETypedDeclarator* GetExceptionVariable(void); protected: - virtual void AddParameter(CFETypedDeclarator *pFEParameter) - throw (CBECreateException*); + virtual void AddParameter(CFETypedDeclarator *pFEParameter); virtual void WriteInvocation(CBEFile *pFile); virtual void WriteVariableInitialization(CBEFile *pFile); virtual void WriteCallParameter(CBEFile *pFile, CBETypedDeclarator *pParameter, bool bCallFromSameClass); - virtual void AddAfterParameters() - throw (CBECreateException*); + virtual void AddAfterParameters(); }; #endif // !__DICE_BEUNMARSHALFUNCTION_H__ diff -ruN p2/l4/tool/dice/src/be/BEUserDefinedType.cpp p3/l4/tool/dice/src/be/BEUserDefinedType.cpp --- p2/l4/tool/dice/src/be/BEUserDefinedType.cpp 2006-10-10 14:46:18.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEUserDefinedType.cpp 2006-11-30 10:41:11.000000000 +0100 @@ -39,7 +39,6 @@ #include "fe/FEUserDefinedType.h" #include "fe/FEFile.h" #include -using namespace std; CBEUserDefinedType::CBEUserDefinedType() { @@ -61,10 +60,9 @@ */ void CBEUserDefinedType::CreateBackEnd(string sName) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEUserDefinedType::%s(%s) called\n", - __func__, sName.c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEUserDefinedType::%s(%s) called\n", __func__, sName.c_str()); string exc = string (__func__); if (sName.empty()) @@ -81,11 +79,13 @@ // set type m_nFEType = TYPE_USER_DEFINED; - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEUserDefinedType::%s(%s) set names, size %d\n", - __func__, sName.c_str(), m_nSize); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEUserDefinedType::%s(%s) set names, size %d\n", __func__, + sName.c_str(), m_nSize); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEUserDefinedType::%s(%s) (this=%p) returns\n", - __func__, sName.c_str(), this); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEUserDefinedType::%s(%s) (this=%p) returns\n", __func__, + sName.c_str(), this); } /** \brief creates a user defined type @@ -96,10 +96,9 @@ */ void CBEUserDefinedType::CreateBackEnd(CFETypeSpec * pFEType) - throw (CBECreateException*) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEUserDefinedType::%s(fe) called\n", - __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEUserDefinedType::%s(fe) called\n", __func__); // call CBEObject's CreateBackEnd method CBEObject::CreateBackEnd(pFEType); @@ -121,8 +120,9 @@ CBENameFactory *pNF = CCompiler::GetNameFactory(); if (!pUserType->GetName().empty()) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CBEUserDefinedType::%s get orig type for %s\n", - __func__, pUserType->GetName().c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CBEUserDefinedType::%s get orig type for %s\n", __func__, + pUserType->GetName().c_str()); // find original type CFEFile *pFERoot = dynamic_cast(pFEType->GetRoot()); assert(pFERoot); @@ -148,8 +148,8 @@ } m_nFEType = TYPE_USER_DEFINED; - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEUserDefinedType::%s(fe) (this=%p) returns\n", - __func__, this); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEUserDefinedType::%s(fe) (this=%p) returns\n", __func__, this); } /** \brief finds the size of a user defined type @@ -161,16 +161,16 @@ */ int CBEUserDefinedType::GetSizeOfTypedef(string sTypeName) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEUserDefinedType::%s(%s) called\n", - __func__, sTypeName.c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEUserDefinedType::%s(%s) called\n", __func__, sTypeName.c_str()); CBERoot *pRoot = GetSpecificParent(); assert(pRoot); CBETypedef *pTypedef = pRoot->FindTypedef(sTypeName); if (!pTypedef) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEUserDefinedType::%s returns 0\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEUserDefinedType::%s returns 0\n", __func__); return 0; } /* check for recursion: if type of typedef is ourselves, then try to get @@ -190,8 +190,9 @@ GetSize function instead of the generic one. */ int nSize = pTypedef->GetSize(sTypeName); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEUserDefinedType::%s(%s) returns %d\n", - __func__, sTypeName.c_str(), nSize); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEUserDefinedType::%s(%s) returns %d\n", __func__, sTypeName.c_str(), + nSize); return nSize; } @@ -204,16 +205,16 @@ */ int CBEUserDefinedType::GetMaxSizeOfTypedef(string sTypeName) { - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "CBEUserDefinedType::%s(%s) called\n", - __func__, sTypeName.c_str()); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, + "CBEUserDefinedType::%s(%s) called\n", __func__, sTypeName.c_str()); CBERoot *pRoot = GetSpecificParent(); assert(pRoot); CBETypedef *pTypedef = pRoot->FindTypedef(sTypeName); if (!pTypedef) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEUserDefinedType::%s returns 0\n", - __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEUserDefinedType::%s returns 0\n", __func__); return 0; } /* check for recursion: if type of typedef is ourselves, then try to get @@ -235,8 +236,9 @@ if (!pTypedef->GetMaxSize(true, nSize, sTypeName)) nSize = 0; - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEUserDefinedType::%s(%s) returns %d\n", - __func__, sTypeName.c_str(), nSize); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEUserDefinedType::%s(%s) returns %d\n", __func__, sTypeName.c_str(), + nSize); return nSize; } @@ -266,8 +268,8 @@ if (m_nSize == 0) m_nSize = GetSizeOfTypedef(m_sOriginalName); - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "CBEUserDefinedType::%s returns %d\n", - __func__, m_nSize); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "CBEUserDefinedType::%s returns %d\n", __func__, m_nSize); return m_nSize; } diff -ruN p2/l4/tool/dice/src/be/BEUserDefinedType.h p3/l4/tool/dice/src/be/BEUserDefinedType.h --- p2/l4/tool/dice/src/be/BEUserDefinedType.h 2006-06-27 12:48:09.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEUserDefinedType.h 2006-11-30 10:41:11.000000000 +0100 @@ -67,10 +67,8 @@ virtual string GetName(); virtual bool IsConstructedType(); - virtual void CreateBackEnd(string sName) - throw (CBECreateException*); - virtual void CreateBackEnd(CFETypeSpec *pFEType) - throw (CBECreateException*); + virtual void CreateBackEnd(string sName); + virtual void CreateBackEnd(CFETypeSpec *pFEType); virtual bool DoWriteZeroInit(); virtual void WriteGetSize(CBEFile *pFile, diff -ruN p2/l4/tool/dice/src/be/BEWaitAnyFunction.cpp p3/l4/tool/dice/src/be/BEWaitAnyFunction.cpp --- p2/l4/tool/dice/src/be/BEWaitAnyFunction.cpp 2006-08-21 16:46:37.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEWaitAnyFunction.cpp 2006-11-30 10:41:11.000000000 +0100 @@ -43,7 +43,6 @@ #include "TypeSpec-Type.h" #include "fe/FEInterface.h" #include -using namespace std; CBEWaitAnyFunction::CBEWaitAnyFunction(bool bOpenWait, bool bReply) : CBEInterfaceFunction(bOpenWait ? @@ -80,7 +79,6 @@ */ void CBEWaitAnyFunction::CreateBackEnd(CFEInterface * pFEInterface) -throw (CBECreateException*) { FUNCTION_TYPE nFunctionType = FUNCTION_NONE; if (m_bOpenWait) diff -ruN p2/l4/tool/dice/src/be/BEWaitAnyFunction.h p3/l4/tool/dice/src/be/BEWaitAnyFunction.h --- p2/l4/tool/dice/src/be/BEWaitAnyFunction.h 2006-07-06 11:23:02.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEWaitAnyFunction.h 2006-11-30 10:41:11.000000000 +0100 @@ -54,8 +54,7 @@ CBEWaitAnyFunction(CBEWaitAnyFunction &src); public: - virtual void CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEInterface *pFEInterface); virtual bool DoMarshalParameter(CBETypedDeclarator * pParameter, bool bMarshal); virtual bool DoWriteFunction(CBEHeaderFile* pFile); diff -ruN p2/l4/tool/dice/src/be/BEWaitFunction.cpp p3/l4/tool/dice/src/be/BEWaitFunction.cpp --- p2/l4/tool/dice/src/be/BEWaitFunction.cpp 2006-10-10 14:46:18.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEWaitFunction.cpp 2006-11-30 10:41:11.000000000 +0100 @@ -45,7 +45,6 @@ #include "fe/FEOperation.h" #include "fe/FETypedDeclarator.h" #include -using namespace std; CBEWaitFunction::CBEWaitFunction(bool bOpenWait) : CBEOperationFunction(bOpenWait ? FUNCTION_WAIT : FUNCTION_RECV) @@ -75,7 +74,7 @@ { // initialize message buffer CBEMsgBuffer *pMsgBuffer = GetMessageBuffer(); - pMsgBuffer->WriteInitialization(pFile); + pMsgBuffer->WriteInitialization(pFile, this, 0, 0); } /** \brief writes the invocation of the message transfer @@ -96,7 +95,6 @@ */ void CBEWaitFunction::CreateBackEnd(CFEOperation * pFEOperation) - throw (CBECreateException*) { FUNCTION_TYPE nFunctionType = FUNCTION_NONE; if (m_bOpenWait) @@ -136,7 +134,6 @@ */ void CBEWaitFunction::CreateObject() - throw (CBECreateException*) { // call base CBEOperationFunction::CreateObject(); @@ -379,7 +376,6 @@ * parameters. We depend on the information set in m_bComponentSide. */ void CBEWaitFunction::AddParameter(CFETypedDeclarator * pFEParameter) - throw (CBECreateException*) { if (IsComponentSide()) { diff -ruN p2/l4/tool/dice/src/be/BEWaitFunction.h p3/l4/tool/dice/src/be/BEWaitFunction.h --- p2/l4/tool/dice/src/be/BEWaitFunction.h 2006-06-14 14:25:02.000000000 +0200 +++ p3/l4/tool/dice/src/be/BEWaitFunction.h 2006-11-30 10:41:11.000000000 +0100 @@ -53,8 +53,7 @@ CBEWaitFunction(CBEWaitFunction &src); public: - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); virtual bool DoMarshalParameter(CBETypedDeclarator * pParameter, bool bMarshal); virtual bool DoWriteFunction(CBEHeaderFile * pFile); @@ -69,10 +68,8 @@ virtual void WriteOpcodeCheck(CBEFile *pFile); virtual bool HasAdditionalReference(CBEDeclarator * pDeclarator, bool bCall = false); - virtual void AddParameter(CFETypedDeclarator * pFEParameter) - throw (CBECreateException*); - virtual void CreateObject(void) - throw (CBECreateException*); + virtual void AddParameter(CFETypedDeclarator * pFEParameter); + virtual void CreateObject(void); virtual int GetSize(int nDirection); virtual int GetFixedSize(int nDirection); diff -ruN p2/l4/tool/dice/src/be/cdr/CCDRClass.cpp p3/l4/tool/dice/src/be/cdr/CCDRClass.cpp --- p2/l4/tool/dice/src/be/cdr/CCDRClass.cpp 2006-08-21 16:46:38.000000000 +0200 +++ p3/l4/tool/dice/src/be/cdr/CCDRClass.cpp 2006-11-30 10:41:11.000000000 +0100 @@ -61,7 +61,6 @@ */ void CCDRClass::CreateBackEnd(CFEOperation* pFEOperation) - throw (CBECreateException*) { string exc = string(__func__); // set source information @@ -86,7 +85,7 @@ } catch (CBECreateException *e) { - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; e->Print(); delete e; @@ -106,7 +105,7 @@ } catch (CBECreateException *e) { - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; e->Print(); delete e; @@ -127,7 +126,7 @@ } catch (CBECreateException *e) { - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; e->Print(); delete e; @@ -147,7 +146,7 @@ } catch (CBECreateException *e) { - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; e->Print(); delete e; @@ -167,7 +166,7 @@ } catch (CBECreateException *e) { - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; e->Print(); delete e; @@ -192,7 +191,7 @@ } catch (CBECreateException *e) { - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; e->Print(); delete e; @@ -213,7 +212,7 @@ } catch (CBECreateException *e) { - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; e->Print(); delete e; @@ -236,7 +235,7 @@ } catch (CBECreateException *e) { - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; e->Print(); delete e; @@ -255,7 +254,6 @@ */ void CCDRClass::AddInterfaceFunctions(CFEInterface* pFEInterface) - throw (CBECreateException*) { CBEClassFactory *pCF = CCompiler::GetClassFactory(); CBEInterfaceFunction *pFunction = pCF->GetNewDispatchFunction(); @@ -267,7 +265,7 @@ } catch (CBECreateException *e) { - m_Functions.Remove(pFunction); + m_Functions.Remove(pFunction); delete pFunction; e->Print(); delete e; diff -ruN p2/l4/tool/dice/src/be/cdr/CCDRClassFactory.cpp p3/l4/tool/dice/src/be/cdr/CCDRClassFactory.cpp --- p2/l4/tool/dice/src/be/cdr/CCDRClassFactory.cpp 2006-08-23 19:27:58.000000000 +0200 +++ p3/l4/tool/dice/src/be/cdr/CCDRClassFactory.cpp 2006-11-30 10:41:11.000000000 +0100 @@ -34,7 +34,6 @@ #include "CCDRUnmarshalFunction.h" #include "Compiler.h" #include -using namespace std; CCDRClassFactory::CCDRClassFactory() : CBEClassFactory() diff -ruN p2/l4/tool/dice/src/be/cdr/CCDRClass.h p3/l4/tool/dice/src/be/cdr/CCDRClass.h --- p2/l4/tool/dice/src/be/cdr/CCDRClass.h 2006-06-14 14:25:02.000000000 +0200 +++ p3/l4/tool/dice/src/be/cdr/CCDRClass.h 2006-11-30 10:41:11.000000000 +0100 @@ -47,10 +47,8 @@ virtual ~CCDRClass(); public: - virtual void CreateBackEnd(CFEOperation* pFEOperation) - throw (CBECreateException*); - virtual void AddInterfaceFunctions(CFEInterface* pFEInterface) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation* pFEOperation); + virtual void AddInterfaceFunctions(CFEInterface* pFEInterface); }; #endif diff -ruN p2/l4/tool/dice/src/be/cdr/CCDRClient.cpp p3/l4/tool/dice/src/be/cdr/CCDRClient.cpp --- p2/l4/tool/dice/src/be/cdr/CCDRClient.cpp 2006-08-21 16:46:38.000000000 +0200 +++ p3/l4/tool/dice/src/be/cdr/CCDRClient.cpp 2006-11-30 10:41:11.000000000 +0100 @@ -36,7 +36,6 @@ #include "Attribute-Type.h" #include "fe/FEOperation.h" #include -using namespace std; CCDRClient::CCDRClient() : CBEClient() @@ -57,7 +56,6 @@ */ void CCDRClient::CreateBackEndFunction(CFEOperation* pFEOperation) - throw (CBECreateException*) { // get root CBERoot *pRoot = GetSpecificParent(); @@ -83,7 +81,7 @@ } catch (CBECreateException *e) { - m_ImplementationFiles.Remove(pImpl); + m_ImplementationFiles.Remove(pImpl); delete pImpl; throw; } diff -ruN p2/l4/tool/dice/src/be/cdr/CCDRClient.h p3/l4/tool/dice/src/be/cdr/CCDRClient.h --- p2/l4/tool/dice/src/be/cdr/CCDRClient.h 2006-06-14 14:25:02.000000000 +0200 +++ p3/l4/tool/dice/src/be/cdr/CCDRClient.h 2006-11-30 10:41:11.000000000 +0100 @@ -44,8 +44,7 @@ ~CCDRClient(); public: - virtual void CreateBackEndFunction(CFEOperation* pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEndFunction(CFEOperation* pFEOperation); }; #endif diff -ruN p2/l4/tool/dice/src/be/cdr/CCDRComponentFunction.cpp p3/l4/tool/dice/src/be/cdr/CCDRComponentFunction.cpp --- p2/l4/tool/dice/src/be/cdr/CCDRComponentFunction.cpp 2006-08-04 17:13:06.000000000 +0200 +++ p3/l4/tool/dice/src/be/cdr/CCDRComponentFunction.cpp 2006-11-30 10:41:11.000000000 +0100 @@ -34,7 +34,6 @@ #include "Compiler.h" #include "fe/FEOperation.h" #include -using namespace std; CCDRComponentFunction::CCDRComponentFunction() : CBEComponentFunction() @@ -56,7 +55,6 @@ */ void CCDRComponentFunction::CreateBackEnd(CFEOperation* pFEOperation) - throw (CBECreateException*) { // set target file name SetTargetFileName(pFEOperation); diff -ruN p2/l4/tool/dice/src/be/cdr/CCDRComponentFunction.h p3/l4/tool/dice/src/be/cdr/CCDRComponentFunction.h --- p2/l4/tool/dice/src/be/cdr/CCDRComponentFunction.h 2006-06-14 14:25:02.000000000 +0200 +++ p3/l4/tool/dice/src/be/cdr/CCDRComponentFunction.h 2006-11-30 10:41:11.000000000 +0100 @@ -44,8 +44,7 @@ virtual ~CCDRComponentFunction(); public: - virtual void CreateBackEnd(CFEOperation* pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation* pFEOperation); }; #endif diff -ruN p2/l4/tool/dice/src/be/cdr/CCDRMarshalFunction.cpp p3/l4/tool/dice/src/be/cdr/CCDRMarshalFunction.cpp --- p2/l4/tool/dice/src/be/cdr/CCDRMarshalFunction.cpp 2006-08-21 16:46:38.000000000 +0200 +++ p3/l4/tool/dice/src/be/cdr/CCDRMarshalFunction.cpp 2006-11-30 10:41:11.000000000 +0100 @@ -33,7 +33,6 @@ #include "be/BETrace.h" #include "Attribute-Type.h" #include -using namespace std; CCDRMarshalFunction::CCDRMarshalFunction() : CBEMarshalFunction() diff -ruN p2/l4/tool/dice/src/be/cdr/CCDRUnmarshalFunction.cpp p3/l4/tool/dice/src/be/cdr/CCDRUnmarshalFunction.cpp --- p2/l4/tool/dice/src/be/cdr/CCDRUnmarshalFunction.cpp 2006-08-21 16:46:38.000000000 +0200 +++ p3/l4/tool/dice/src/be/cdr/CCDRUnmarshalFunction.cpp 2006-11-30 10:41:11.000000000 +0100 @@ -33,7 +33,6 @@ #include "be/BETrace.h" #include "Attribute-Type.h" #include -using namespace std; CCDRUnmarshalFunction::CCDRUnmarshalFunction() : CBEUnmarshalFunction() diff -ruN p2/l4/tool/dice/src/be/l4/L4BECallFunction.cpp p3/l4/tool/dice/src/be/l4/L4BECallFunction.cpp --- p2/l4/tool/dice/src/be/l4/L4BECallFunction.cpp 2006-08-23 19:27:58.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BECallFunction.cpp 2006-11-30 10:41:11.000000000 +0100 @@ -44,7 +44,6 @@ #include "Attribute-Type.h" #include "Compiler.h" #include -using namespace std; CL4BECallFunction::CL4BECallFunction() { @@ -68,7 +67,6 @@ */ void CL4BECallFunction::CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*) { CBECallFunction::CreateBackEnd(pFEOperation); @@ -107,7 +105,7 @@ // set dopes CBEMsgBuffer *pMsgBuffer = GetMessageBuffer(); assert(pMsgBuffer); - pMsgBuffer->WriteInitialization(pFile, TYPE_MSGDOPE_SEND, + pMsgBuffer->WriteInitialization(pFile, this, TYPE_MSGDOPE_SEND, GetSendDirection()); // invocate if (!CCompiler::IsOptionSet(PROGRAM_NO_SEND_CANCELED_CHECK)) @@ -193,11 +191,11 @@ assert(pMsgBuffer); if (CCompiler::IsOptionSet(PROGRAM_ZERO_MSGBUF)) pMsgBuffer->WriteSetZero(pFile); - pMsgBuffer->WriteInitialization(pFile, TYPE_MSGDOPE_SIZE, + pMsgBuffer->WriteInitialization(pFile, this, TYPE_MSGDOPE_SIZE, 0); - pMsgBuffer->WriteInitialization(pFile, TYPE_REFSTRING, + pMsgBuffer->WriteInitialization(pFile, this, TYPE_REFSTRING, GetReceiveDirection()); - pMsgBuffer->WriteInitialization(pFile, TYPE_RCV_FLEXPAGE, + pMsgBuffer->WriteInitialization(pFile, this, TYPE_RCV_FLEXPAGE, GetReceiveDirection()); } diff -ruN p2/l4/tool/dice/src/be/l4/L4BECallFunction.h p3/l4/tool/dice/src/be/l4/L4BECallFunction.h --- p2/l4/tool/dice/src/be/l4/L4BECallFunction.h 2006-06-14 14:25:03.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BECallFunction.h 2006-11-30 10:41:11.000000000 +0100 @@ -62,8 +62,7 @@ virtual void WriteVariableInitialization(CBEFile * pFile); virtual void WriteUnmarshalling(CBEFile * pFile); virtual void WriteIPC(CBEFile* pFile); - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); }; #endif // !__DICE_L4BECALLFUNCTION_H__ diff -ruN p2/l4/tool/dice/src/be/l4/L4BEClassFactory.cpp p3/l4/tool/dice/src/be/l4/L4BEClassFactory.cpp --- p2/l4/tool/dice/src/be/l4/L4BEClassFactory.cpp 2006-08-23 19:27:58.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BEClassFactory.cpp 2006-11-30 10:41:11.000000000 +0100 @@ -49,7 +49,6 @@ #include "be/BEContext.h" #include "Compiler.h" #include -using namespace std; CL4BEClassFactory::CL4BEClassFactory() : CBEClassFactory() diff -ruN p2/l4/tool/dice/src/be/l4/L4BEDispatchFunction.cpp p3/l4/tool/dice/src/be/l4/L4BEDispatchFunction.cpp --- p2/l4/tool/dice/src/be/l4/L4BEDispatchFunction.cpp 2006-08-23 19:27:58.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BEDispatchFunction.cpp 2006-11-30 10:41:11.000000000 +0100 @@ -34,7 +34,6 @@ #include "TypeSpec-Type.h" #include "Compiler.h" #include -using namespace std; CL4BEDispatchFunction::CL4BEDispatchFunction() { diff -ruN p2/l4/tool/dice/src/be/l4/L4BEHeaderFile.cpp p3/l4/tool/dice/src/be/l4/L4BEHeaderFile.cpp --- p2/l4/tool/dice/src/be/l4/L4BEHeaderFile.cpp 2006-08-23 19:27:58.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BEHeaderFile.cpp 2006-11-30 10:41:11.000000000 +0100 @@ -72,20 +72,22 @@ */ if (GetFunctionCount() == 0) { - Print("#ifdef __cplusplus\n"); - Print("extern \"C\" {\n"); - Print("#endif\n\n"); + m_file << "#ifdef __cplusplus\n"; + m_file << "extern \"C\" {\n"; + m_file << "#endif\n\n"; } CBENameFactory *pNF = CCompiler::GetNameFactory(); - string sFuncName = pNF->GetString(CL4BENameFactory::STR_INIT_RCVSTRING_FUNC); + string sFuncName = pNF->GetString( + CL4BENameFactory::STR_INIT_RCVSTRING_FUNC); string sMWord = pNF->GetTypeName(TYPE_MWORD, true); - PrintIndent("void %s(int, %s*, %s*, %s*);\n\n", sFuncName.c_str(), - sMWord.c_str(), sMWord.c_str(), sEnvType.c_str()); + PrintIndent(); + m_file << "void " << sFuncName << "(int, " << sMWord << "*, " + << sMWord << "*, " << sEnvType << "*);\n\n"; if (GetFunctionCount() == 0) { - Print("#ifdef __cplusplus\n"); - Print("}\n"); - Print("#endif\n\n"); + m_file << "#ifdef __cplusplus\n"; + m_file << "}\n"; + m_file << "#endif\n\n"; } } CBEHeaderFile::WriteHelperFunctions(); diff -ruN p2/l4/tool/dice/src/be/l4/L4BEIPC.cpp p3/l4/tool/dice/src/be/l4/L4BEIPC.cpp --- p2/l4/tool/dice/src/be/l4/L4BEIPC.cpp 2006-10-10 16:08:41.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BEIPC.cpp 2006-11-30 10:41:11.000000000 +0100 @@ -92,11 +92,15 @@ } /** \brief writes a send with an immediate wait - * - * Empty implementation to shadow abstract base class. + * \param pFile the file to write to + * \param pFunction the function to write for + * + * Invoke the specialized method with default parameters. */ void -CL4BEIPC::WriteReplyAndWait(CBEFile* /*pFile*/, - CBEFunction* /*pFunction*/) -{ } +CL4BEIPC::WriteReplyAndWait(CBEFile* pFile, + CBEFunction* pFunction) +{ + WriteReplyAndWait(pFile, pFunction, false, false); +} diff -ruN p2/l4/tool/dice/src/be/l4/L4BEMarshalFunction.cpp p3/l4/tool/dice/src/be/l4/L4BEMarshalFunction.cpp --- p2/l4/tool/dice/src/be/l4/L4BEMarshalFunction.cpp 2006-08-21 16:46:38.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BEMarshalFunction.cpp 2006-11-30 10:41:11.000000000 +0100 @@ -39,7 +39,6 @@ #include "Attribute-Type.h" #include "Compiler.h" #include -using namespace std; CL4BEMarshalFunction::CL4BEMarshalFunction() { @@ -122,9 +121,9 @@ else CBEMarshalFunction::WriteMarshalling(pFile); - CBEMsgBuffer *pMsgBuffer = GetMessageBuffer(); - // set size dope - pMsgBuffer->WriteInitialization(pFile, TYPE_MSGDOPE_SEND, + CBEMsgBuffer *pMsgBuffer = m_pClass->GetMessageBuffer(); + // set send dope + pMsgBuffer->WriteInitialization(pFile, this, TYPE_MSGDOPE_SEND, GetSendDirection()); // if we had send flexpages,we have to set the flexpage bit if (bSendFpages) diff -ruN p2/l4/tool/dice/src/be/l4/L4BEMarshaller.cpp p3/l4/tool/dice/src/be/l4/L4BEMarshaller.cpp --- p2/l4/tool/dice/src/be/l4/L4BEMarshaller.cpp 2006-10-10 14:46:18.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BEMarshaller.cpp 2006-11-30 10:41:11.000000000 +0100 @@ -47,7 +47,7 @@ #include "Compiler.h" #include #include -using namespace std; +using std::ostringstream; CL4BEMarshaller::CL4BEMarshaller() : CBEMarshaller() @@ -136,19 +136,14 @@ m_nSkipSize += nParamSize; // do NOT skip exception variable - DTRACE("param %p, exc %p\n", pParameter, pFunction->GetExceptionVariable()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "param %p, exc %p\n", pParameter, + pFunction->GetExceptionVariable()); if (pParameter == pFunction->GetExceptionVariable()) return false; // Check if this parameter should be marshalled // - it should be of word size // - it should not be a constructed type -// TRACE("parameter %s (%d) in func %s dir %d: skip size %d < short IPC size %d?\n", -// pParameter->m_Declarators.First()->GetName().c_str(), -// nParamSize, -// pFunction->GetName().c_str(), -// nDirection, -// m_nSkipSize, nSize); if ((nParamSize == nWordSize) && (m_nSkipSize <= nSize)) return true; @@ -298,7 +293,8 @@ { m_pFile = pFile; m_pFunction = pFunction; - DTRACE("%s called for func %s and param %s (%s at pos %d)\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s called for func %s and param %s (%s at pos %d)\n", __func__, pFunction ? pFunction->GetName().c_str() : "(none)", pParameter ? pParameter->m_Declarators.First()->GetName().c_str() : "(none)", bMarshal ? "marshalling" : "unmarshalling", nPosition); @@ -369,6 +365,10 @@ CL4BEMarshaller::MarshalRefstring(CBETypedDeclarator *pParameter, vector *pStack) { + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CL4BEMarshaller::%s called for %s with%s [ref]\n", __func__, + pParameter->m_Declarators.First()->GetName().c_str(), + pParameter->m_Attributes.Find(ATTR_REF) ? "" : "out"); if (!pParameter->m_Attributes.Find(ATTR_REF)) return false; @@ -376,7 +376,7 @@ CBETypedDeclarator *pMember = FindMarshalMember(pStack); if (!pMember) { - TRACE("%s: could not find member for parameter %s\n", + CCompiler::Warning("CL4BEMarshaller::%s: couldn't find member for param %s\n", __func__, pParameter->m_Declarators.First()->GetName().c_str()); } assert(pMember); @@ -428,8 +428,8 @@ m_pFile->DecIndent(); } } - else if (!pParameter->m_Attributes.Find(ATTR_PREALLOC) || - m_pFunction->IsComponentSide()) + else if (m_pFunction->IsComponentSide() || // on server side OR + !pParameter->m_Attributes.Find(ATTR_PREALLOC_CLIENT)) // no prealloc { // do not unmarshal refstring if preallocated at the client side, // because preallocated refstrings are already assigned to rcv_str. diff -ruN p2/l4/tool/dice/src/be/l4/L4BEMsgBuffer.cpp p3/l4/tool/dice/src/be/l4/L4BEMsgBuffer.cpp --- p2/l4/tool/dice/src/be/l4/L4BEMsgBuffer.cpp 2006-10-10 16:08:41.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BEMsgBuffer.cpp 2006-11-30 10:41:12.000000000 +0100 @@ -48,7 +48,6 @@ #include "fe/FEOperation.h" #include "TypeSpec-L4Types.h" #include -using namespace std; CL4BEMsgBuffer::CL4BEMsgBuffer() : CBEMsgBuffer() @@ -70,7 +69,6 @@ */ CBETypedDeclarator* CL4BEMsgBuffer::GetFlexpageVariable() - throw (CBECreateException*) { string exc = string(__func__); @@ -126,7 +124,6 @@ */ CBETypedDeclarator* CL4BEMsgBuffer::GetSizeDopeVariable() - throw (CBECreateException*) { string exc = string(__func__); @@ -182,7 +179,6 @@ */ CBETypedDeclarator* CL4BEMsgBuffer::GetSendDopeVariable() - throw (CBECreateException*) { string exc = string(__func__); CBEClassFactory *pCF = CCompiler::GetClassFactory(); @@ -355,9 +351,11 @@ CL4BEMsgBuffer::AddGenericStructMembersClass(CBEStructType *pStruct) { // count word members - DTRACE("%s called\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); + int nWords = GetWordMemberCountClass(); - DTRACE("%s GetWordMemberCount returned %d\n", __func__, nWords); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s GetWordMemberCount returned %d\n", + __func__, nWords); // count refstring members int nStrings = CBEMsgBuffer::GetMemberSize(TYPE_REFSTRING); // create word member and add to struct @@ -444,9 +442,54 @@ * \param pFile the file to write to * \param nType the type of the members to initialize * \param nDirection the direction of the struct to initialize + * + * We do rely on the sizeof feature and the variable sized array features of + * the taret compiler here. Variable sized arrays are ideally declared in the + * message buffer using the declarators denoting the array size in the array + * declaration. Using sizeof on the message buffer correctly calculates the + * size of the total message buffer. + * + * Example: (param: [in, string] char * str) + * + * { + * long _str_len = strlen (str) + 1; + * struct { + * l4_strdope_t size; + * ... + * long _str_len; + * char str[_str_len]; + * } msg; + * msg._str_len = _str_len; + * memcpy (msg.str, str, _str_len); + * msg.size = L4_IPC_DOPE(sizeof(msg)/sizeof(long)-3, 0); + * ... + * } + * + * We can also simple subtract the number of indirect strings, because they + * have to be aligned in the [in] and [out] buffers. All we have to do is to + * count the indirect strings. + * + * Example: + * + * union { + * struct { + * ... + * long param1; + * long param2; + * l4_strdope_t str_param1; + * } in; + * struct { + * ... + * long param1; + * long __pad_to_string; + * l4_strdope_t str_param2; + * } out; + * } msg; + * */ void CL4BEMsgBuffer::WriteInitialization(CBEFile *pFile, + CBEFunction *pFunction, int nType, int nDirection) { @@ -455,7 +498,7 @@ (nType != TYPE_REFSTRING) && (nType != TYPE_RCV_FLEXPAGE)) { - CBEMsgBuffer::WriteInitialization(pFile, nType, nDirection); + CBEMsgBuffer::WriteInitialization(pFile, pFunction, nType, nDirection); return; } @@ -470,74 +513,52 @@ return; } - CBEFunction *pFunction = GetSpecificParent(); - DTRACE("%s for func %s and dir %d\n", __func__, - pFunction ? pFunction->GetName().c_str() : "(no func)", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s for func %s and dir %d\n", + __func__, pFunction ? pFunction->GetName().c_str() : "(no func)", nDirection); + // count the indirect strings // if direction is 0 we have to get maximum of IN and OUT - int nWords = 0; int nStrings = 0; CBESizes *pSizes = CCompiler::GetSizes(); - int nRefSize = pSizes->GetSizeOfType(TYPE_REFSTRING) / - pSizes->GetSizeOfType(TYPE_MWORD); + int nWordSize = pSizes->GetSizeOfType(TYPE_MWORD); + int nRefSize = pSizes->GetSizeOfType(TYPE_REFSTRING) / nWordSize; if (nDirection == 0) { - int nWordsIn = CBEMsgBuffer::GetMemberSize(TYPE_MWORD, pFunction, - DIRECTION_IN, false); - DTRACE("%s words in: %d\n", __func__, nWordsIn); - if (nWordsIn < 0) - nWordsIn = CBEMsgBuffer::GetMemberSize(TYPE_MWORD, pFunction, - DIRECTION_IN, true); - DTRACE("%s words in: %d\n", __func__, nWordsIn); - int nWordsOut = CBEMsgBuffer::GetMemberSize(TYPE_MWORD, pFunction, - DIRECTION_OUT, false); - DTRACE("%s words out: %d\n", __func__, nWordsOut); - if (nWordsOut < 0) - nWordsOut = CBEMsgBuffer::GetMemberSize(TYPE_MWORD, pFunction, - DIRECTION_OUT, true); - DTRACE("%s words out: %d\n", __func__, nWordsOut); - // for generic struct we also have to subtract the strings from the // word count, because the strings have been counted when counting // TYPE_MWORD as well. int nStringsIn = CBEMsgBuffer::GetMemberSize(TYPE_REFSTRING, pFunction, DIRECTION_IN, false); - DTRACE("%s strings in: %d\n", __func__, nStringsIn); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s strings in: %d\n", + __func__, nStringsIn); + int nStringsOut = CBEMsgBuffer::GetMemberSize(TYPE_REFSTRING, pFunction, DIRECTION_OUT, false); - DTRACE("%s strings out: %d\n", __func__, nStringsOut); - nStrings = max(nStringsIn, nStringsOut); - DTRACE("%s strings: %d\n", __func__, nStrings); - - DTRACE("%s words in: %d words out: %d\n", __func__, nWordsIn, - nWordsOut); - if (nWordsIn > 0 && nWordsOut > 0) - nWords = max(nWordsIn, nWordsOut); - else - nWords = (nWordsIn < nWordsOut) ? nWordsIn : nWordsOut; - DTRACE("%s words: %d\n", __func__, nWords); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s strings out: %d\n", + __func__, nStringsOut); + + nStrings = std::max(nStringsIn, nStringsOut); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s strings: %d\n", __func__, + nStrings); } else { - nWords = CBEMsgBuffer::GetMemberSize(TYPE_MWORD, pFunction, - nDirection, false); - DTRACE("%s words: %d\n", __func__, nWords); nStrings = CBEMsgBuffer::GetMemberSize(TYPE_REFSTRING, pFunction, nDirection, false); - DTRACE("%s strings: %d\n", __func__, nStrings); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s strings: %d\n", __func__, + nStrings); } - // check minimum number of words - int nMinWords = GetWordMemberCountFunction(); - if (nWords >= 0) - nWords = max(nWords, nMinWords); - DTRACE("%s words (min): %d\n", __func__, nWords); // get name of member CBENameFactory *pNF = CCompiler::GetNameFactory(); string sName = pNF->GetMessageBufferMember(nType); // get member - CBETypedDeclarator *pMember = FindMember(sName, nDirection); + CBETypedDeclarator *pMember = FindMember(sName, pFunction, nDirection); // check if we have member of that type if (!pMember && (nDirection == 0)) { @@ -549,18 +570,42 @@ return; *pFile << "\t"; - WriteAccess(pFile, pFunction, nDirection, pMember); - *pFile << " = L4_IPC_DOPE("; - if (nWords > 0) - *pFile << nWords; - else // variable sized elements - { - // sizeof(.)/sizeof(long)-3 - *pFile << "sizeof("; - WriteAccessToStruct(pFile, pFunction, nDirection); - *pFile << ")/sizeof(long)-"; - *pFile << 3 + nStrings*nRefSize; + *pFile << " = L4_IPC_DOPE( sizeof("; + if (nDirection == 0 || + nType == TYPE_MSGDOPE_SIZE) + { + // sizeof()/sizeof(long)-3 + WriteAccessToVariable(pFile, pFunction, false); + } + else + { + // sizeof(.)/sizeof(long)-3 + WriteAccessToStruct(pFile, pFunction, nDirection); + } + *pFile << ")/sizeof(long)-" << 3 + nStrings*nRefSize; + if (nDirection != 0 && nType == TYPE_MSGDOPE_SEND) + { + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "In func %s try to find padding members:\n", pFunction->GetName().c_str()); + // if we have any padding members in the send part, subtract their size + CBEStructType *pStruct = GetStruct(pFunction, nDirection); + sName = pNF->GetPaddingMember(TYPE_BYTE, TYPE_REFSTRING); + pMember = pStruct->m_Members.Find(sName); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, " member %s found at %p\n", + sName.c_str(), pMember); + + if (pMember) + *pFile << "-" << pMember->GetSize(); + sName = pNF->GetPaddingMember(TYPE_MWORD, TYPE_REFSTRING); + pMember = pStruct->m_Members.Find(sName); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, " member %s found at %p\n", + sName.c_str(), pMember); + + if (pMember) + *pFile << "-" << pMember->GetSize()/nWordSize; } *pFile << ", " << nStrings << ");\n"; } @@ -568,6 +613,7 @@ /** \brief writes the initialization of the refstring members * \param pFile the file to write to * \param nDirection the direction of the struct to initialize + * \return true if we actually did something * * initialize refstring members: check if they are OUT parameters for this * function (have to find them as parameter and check the OUT attribute). If @@ -575,18 +621,19 @@ * parameter (prealloc -> pointer is parameter, size is size attribute). If no * attribute given, allocate using CBEContext::WriteMalloc(). */ -void +bool CL4BEMsgBuffer::WriteRefstringInitialization(CBEFile *pFile, int nDirection) { CBEFunction *pFunction = GetSpecificParent(); if (!pFunction) - return; + return false; CBEClass *pClass = GetSpecificParent(); CBEStructType *pStruct = GetStruct(nDirection); assert(pStruct); int nIndex = -1; + bool bRefstring = false; vector::iterator iter; for (iter = pStruct->m_Members.begin(); iter != pStruct->m_Members.end(); @@ -595,6 +642,8 @@ if (!(*iter)->GetType()->IsOfType(TYPE_REFSTRING)) continue; + bRefstring = true; + // check if declarator is array (as can be for generic part of message // buffer... CBEDeclarator *pMemberDecl = (*iter)->m_Declarators.First(); @@ -621,13 +670,14 @@ // member is refstring, initialize: WriteRefstringInitParameter(pFile, pFunction, (*iter), nIndex, nDirection); - } // array iteration // array bound iteration if (arrIter != pMemberDecl->m_Bounds.end()) arrIter++; } while (arrIter != pMemberDecl->m_Bounds.end()); } + + return bRefstring; } /** \brief writes the maximu size of a specific refstring @@ -762,13 +812,13 @@ CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called for func %s and direction %d\n", __func__, pFunction->GetName().c_str(), nDirection); - DTRACE("%s(%s, %d) called\n", __func__, pFunction->GetName().c_str(), - nDirection); int nWordSize = CCompiler::GetSizes()->GetSizeOfType(TYPE_MWORD); int nShortMembers = GetWordMemberCountFunction(); - DTRACE("%s: word size %d, short size %d\n", __func__, nWordSize, - nShortMembers); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s: word size %d, short size %d\n", + __func__, nWordSize, nShortMembers); + // get structure CBEStructType *pStruct = GetStruct(pFunction, nDirection); assert(pStruct); @@ -780,16 +830,22 @@ iter != pStruct->m_Members.end() && (nShortMembers-- > 0); iter++) { - DTRACE("%s: testing member %s %d for word size (short members %d)\n", + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s: testing member %s %d for word size (short members %d)\n", __func__, (*iter)->m_Declarators.First()->GetName().c_str(), (*iter)->GetSize(), nShortMembers); + if ((*iter)->GetSize() != nWordSize) { - DTRACE("%s: not word size, return false\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s: not word size, return false\n", __func__); + return false; } } - DTRACE("%s: short members left: %d\n", __func__, nShortMembers); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s: short members left: %d\n", + __func__, nShortMembers); if (nShortMembers > 0) return false; @@ -807,10 +863,13 @@ int CL4BEMsgBuffer::GetWordMemberCountFunction() { - DTRACE("%s called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); + CL4BESizes *pSizes = static_cast(CCompiler::GetSizes()); int nShort = pSizes->GetMaxShortIPCSize(); - DTRACE("%s: sizes says, max short size is %d -> make words from that\n", + + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "%s: sizes says, max short size is %d -> make words from that\n", __func__, nShort); return pSizes->WordsFromBytes(nShort); } @@ -821,15 +880,19 @@ int CL4BEMsgBuffer::GetWordMemberCountClass() { - DTRACE("%s called\n", __func__); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); // get value from base class int nSize = CBEMsgBuffer::GetWordMemberCountClass(); CL4BESizes *pSizes = static_cast(CCompiler::GetSizes()); int nShort = pSizes->GetMaxShortIPCSize(); nShort = pSizes->WordsFromBytes(nShort); + // subtract refstrings if any + int nStrings = CBEMsgBuffer::GetMemberSize(TYPE_REFSTRING); + nStrings *= pSizes->GetSizeOfType(TYPE_REFSTRING); // check minimum - DTRACE("%s return max(%d, %d)\n", __func__, nSize, nShort); - return max(nSize, nShort); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "%s return max(%d, %d)\n", __func__, + nSize - nStrings, nShort); + return std::max(nSize - nStrings, nShort); } /** \brief determine the size of a specific member @@ -852,8 +915,8 @@ CBETypedDeclarator *pMember, bool bMax) { - DTRACE("%s (%d, %s, %s) called\n", __func__, nType, - pMember->m_Declarators.First()->GetName().c_str(), + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s (%d, %s, %s) called\n", __func__, + nType, pMember->m_Declarators.First()->GetName().c_str(), bMax ? "true" : "false"); // filter out refstring members CBESizes *pSizes = CCompiler::GetSizes(); @@ -883,8 +946,8 @@ int nMinSize = pSizes->GetMaxShortIPCSize(); // get maximum position of any refstring in message buffer int nMax = GetMaxPosOfRefstringInMsgBuffer(); - DTRACE("%s: min size %d, max pos of refstring %d\n", __func__, - nMinSize, nMax); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s: min size %d, max pos of refstring %d\n", __func__, nMinSize, nMax); if (nMinSize > nMax) nMax = nMinSize; // align refstrings in all message buffers to the max of the two @@ -1072,7 +1135,8 @@ if (!pStruct) continue; - DTRACE("%s: Checking next struct\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s: Checking next struct\n", + __func__); // iterate over struct members vector::iterator iter; int nSize = 0; @@ -1082,22 +1146,24 @@ { if ((*iter)->GetType()->IsOfType(TYPE_REFSTRING)) break; - DTRACE("%s: size of member %s is %d\n", __func__, - (*iter)->m_Declarators.First()->GetName().c_str(), + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s: size of member %s is %d\n", + __func__, (*iter)->m_Declarators.First()->GetName().c_str(), (*iter)->GetSize()); int nMemberSize = (*iter)->GetSize(); if (nMemberSize < 0) (*iter)->GetMaxSize(true, nMemberSize); - DTRACE("%s: adding size (max?) %d\n", __func__, nMemberSize); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s: adding size (max?) %d\n", + __func__, nMemberSize); nSize += nMemberSize; } - DTRACE("%s: Size of this struct is %d\n", __func__, nSize); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s: Size of this struct is %d\n", + __func__, nSize); // check if new max if (nSize > nMax) nMax = nSize; } - DTRACE("%s: returns %d\n", __func__, nMax); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: returns %d\n", __func__, nMax); return nMax; } @@ -1132,9 +1198,9 @@ pFunction, DIRECTION_IN, false); int nStringsOut = CBEMsgBuffer::GetMemberSize(TYPE_REFSTRING, pFunction, DIRECTION_OUT, false); - nStrings = max(nStringsIn, nStringsOut); + nStrings = std::max(nStringsIn, nStringsOut); if (nWordsIn > 0 && nWordsOut > 0) - nWords = max(nWordsIn, nWordsOut); + nWords = std::max(nWordsIn, nWordsOut); else nWords = (nWordsIn < nWordsOut) ? nWordsIn : nWordsOut; } @@ -1148,7 +1214,7 @@ // check minimum number of words int nMinWords = GetWordMemberCountFunction(); if (nWords >= 0) - nWords = max(nWords, nMinWords); + nWords = std::max(nWords, nMinWords); // get short IPC values int nShortSize = pSizes->GetMaxShortIPCSize() / nWordSize; diff -ruN p2/l4/tool/dice/src/be/l4/L4BEMsgBuffer.h p3/l4/tool/dice/src/be/l4/L4BEMsgBuffer.h --- p2/l4/tool/dice/src/be/l4/L4BEMsgBuffer.h 2006-10-10 16:08:41.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BEMsgBuffer.h 2006-11-30 10:41:12.000000000 +0100 @@ -64,20 +64,18 @@ virtual CObject* Clone() { return new CL4BEMsgBuffer(*this); } - virtual void WriteInitialization(CBEFile *pFile, int nType, int nDirection); + virtual void WriteInitialization(CBEFile *pFile, CBEFunction *pFunction, + int nType, int nDirection); virtual bool HasWordMembers(CBEFunction *pFunction, int nDirection); virtual bool HasProperty(int nProperty, int nDirection); protected: // protected methods - virtual CBETypedDeclarator* GetFlexpageVariable() - throw (CBECreateException*); - virtual CBETypedDeclarator* GetSizeDopeVariable() - throw (CBECreateException*); - virtual CBETypedDeclarator* GetSendDopeVariable() - throw (CBECreateException*); + virtual CBETypedDeclarator* GetFlexpageVariable(); + virtual CBETypedDeclarator* GetSizeDopeVariable(); + virtual CBETypedDeclarator* GetSendDopeVariable(); - virtual void WriteRefstringInitialization(CBEFile *pFile, int nDirection); + virtual bool WriteRefstringInitialization(CBEFile *pFile, int nDirection); virtual bool WriteRefstringInitFunction(CBEFile *pFile, CBEFunction *pFunction, CBEClass *pClass, int nIndex, int nDirection); virtual void WriteRcvFlexpageInitialization(CBEFile *pFile, int nDirection); diff -ruN p2/l4/tool/dice/src/be/l4/L4BEMsgBufferType.cpp p3/l4/tool/dice/src/be/l4/L4BEMsgBufferType.cpp --- p2/l4/tool/dice/src/be/l4/L4BEMsgBufferType.cpp 2006-10-10 14:46:18.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BEMsgBufferType.cpp 2006-11-30 10:41:12.000000000 +0100 @@ -45,7 +45,6 @@ #include "Attribute-Type.h" #include "Compiler.h" #include -using namespace std; CL4BEMsgBufferType::CL4BEMsgBufferType() : CBEMsgBufferType() @@ -68,7 +67,6 @@ void CL4BEMsgBufferType::AddElements(CFEOperation *pFEOperation, int nDirection) - throw (CBECreateException*) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CL4BEMsgBufferType::%s called for %s\n", __func__, pFEOperation->GetName().c_str()); @@ -87,7 +85,6 @@ void CL4BEMsgBufferType::AddElement(CFETypedDeclarator *pFEParameter, int nDirection) - throw (CBECreateException*) { assert(pFEParameter); @@ -112,7 +109,6 @@ void CL4BEMsgBufferType::AddRefstringElement(CFETypedDeclarator *pFEParameter, int nDirection) - throw (CBECreateException*) { assert(pFEParameter); // get struct @@ -151,7 +147,6 @@ void CL4BEMsgBufferType::AddFlexpageElement(CFETypedDeclarator *pFEParameter, int nDirection) - throw (CBECreateException*) { assert(pFEParameter); // get struct @@ -185,7 +180,6 @@ void CL4BEMsgBufferType::AddZeroFlexpage(CFEOperation *pFEOperation, int nDirection) - throw (CBECreateException*) { bool bFlexpage = false; diff -ruN p2/l4/tool/dice/src/be/l4/L4BEMsgBufferType.h p3/l4/tool/dice/src/be/l4/L4BEMsgBufferType.h --- p2/l4/tool/dice/src/be/l4/L4BEMsgBufferType.h 2006-06-14 14:25:04.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BEMsgBufferType.h 2006-11-30 10:41:12.000000000 +0100 @@ -61,18 +61,13 @@ { return new CL4BEMsgBufferType(*this); } protected: - virtual void AddElements(CFEOperation *pFEOperation, int nDirection) - throw (CBECreateException*); - virtual void AddElement(CFETypedDeclarator *pFEParameter, int nDirection) - throw (CBECreateException*); + virtual void AddElements(CFEOperation *pFEOperation, int nDirection); + virtual void AddElement(CFETypedDeclarator *pFEParameter, int nDirection); virtual void AddRefstringElement(CFETypedDeclarator *pFEParameter, - int nDirection) - throw (CBECreateException*); + int nDirection); virtual void AddFlexpageElement(CFETypedDeclarator *pFEParameter, - int nDirection) - throw (CBECreateException*); - virtual void AddZeroFlexpage(CFEOperation *pFEOperation, int nDirection) - throw (CBECreateException*); + int nDirection); + virtual void AddZeroFlexpage(CFEOperation *pFEOperation, int nDirection); }; #endif // !__DICE_L4BEMSGBUFFERTYPE_H__ diff -ruN p2/l4/tool/dice/src/be/l4/L4BENameFactory.cpp p3/l4/tool/dice/src/be/l4/L4BENameFactory.cpp --- p2/l4/tool/dice/src/be/l4/L4BENameFactory.cpp 2006-08-23 19:27:58.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BENameFactory.cpp 2006-11-30 10:41:12.000000000 +0100 @@ -35,7 +35,6 @@ #include #include #include -using namespace std; CL4BENameFactory::CL4BENameFactory() : CBENameFactory() diff -ruN p2/l4/tool/dice/src/be/l4/L4BEPositionMarshaller.cpp p3/l4/tool/dice/src/be/l4/L4BEPositionMarshaller.cpp --- p2/l4/tool/dice/src/be/l4/L4BEPositionMarshaller.cpp 2006-10-10 14:46:18.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BEPositionMarshaller.cpp 2006-11-30 10:41:12.000000000 +0100 @@ -45,7 +45,6 @@ #include "TypeSpec-Type.h" #include "Attribute-Type.h" #include -using namespace std; CL4BEMarshaller::PositionMarshaller::PositionMarshaller( CL4BEMarshaller *pParent) @@ -90,9 +89,11 @@ bool bReference, bool bLValue) { - DTRACE("%s called for func %s dir %d, pos %d\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s called for func %s dir %d, pos %d\n", __func__, pFunction ? pFunction->GetName().c_str() : "", nDirection, nPosition); + m_nPosSize = CCompiler::GetSizes()->GetSizeOfType(TYPE_MWORD); m_bReference = bReference; m_pFile = pFile; @@ -124,7 +125,8 @@ GetMemberAt(pMsgType, pStruct, nPosition); if (!pMember) { - DTRACE("%s: could not find a member at pos %d in struct\n", + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s: could not find a member at pos %d in struct\n", __func__, nPosition); // struct too small, nothing to put there return false; @@ -140,7 +142,8 @@ int nMemberSize = GetMemberSize(pMember); if (nMemberSize != m_nPosSize) { - DTRACE("%s: member of different size\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s: member of different size\n", + __func__); if (bReference) *pFile << "&"; pMsgBuffer->WriteGenericMemberAccess(pFile, nPosition); @@ -152,7 +155,8 @@ CBETypedDeclarator *pParameter = pFunction->FindParameter(sName); if (!pParameter) { - DTRACE("%s: parameter %s not found, try special\n", __func__, + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s: parameter %s not found, try special\n", __func__, sName.c_str()); // only call this method if we are sure the member is special // e.g. return, opcode, etc. @@ -161,8 +165,8 @@ } else { - DTRACE("%s: parameter found, write access to member\n", - __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "%s: parameter found, write access to member\n", __func__); // if there is a transmit_as attribute, replace the type CBEAttribute *pAttr = pParameter->m_Attributes.Find(ATTR_TRANSMIT_AS); // if user defined type, then the alias might have a transmit as @@ -266,7 +270,7 @@ } } - DTRACE("%s returns true\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s returns true\n", __func__); return true; } diff -ruN p2/l4/tool/dice/src/be/l4/L4BEReplyFunction.cpp p3/l4/tool/dice/src/be/l4/L4BEReplyFunction.cpp --- p2/l4/tool/dice/src/be/l4/L4BEReplyFunction.cpp 2006-08-23 19:27:58.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BEReplyFunction.cpp 2006-11-30 10:41:12.000000000 +0100 @@ -40,7 +40,6 @@ #include "TypeSpec-L4Types.h" #include "Attribute-Type.h" #include -using namespace std; CL4BEReplyFunction::CL4BEReplyFunction() : CBEReplyFunction() @@ -63,7 +62,6 @@ */ void CL4BEReplyFunction::CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*) { CBEReplyFunction::CreateBackEnd(pFEOperation); @@ -114,7 +112,7 @@ // set size and send dopes CBEMsgBuffer *pMsgBuffer = GetMessageBuffer(); assert(pMsgBuffer); - pMsgBuffer->WriteInitialization(pFile, TYPE_MSGDOPE_SEND, + pMsgBuffer->WriteInitialization(pFile, this, TYPE_MSGDOPE_SEND, GetSendDirection()); // invocate @@ -175,7 +173,7 @@ CBEReplyFunction::WriteVariableInitialization(pFile); CBEMsgBuffer *pMsgBuffer = GetMessageBuffer(); assert(pMsgBuffer); - pMsgBuffer->WriteInitialization(pFile, TYPE_MSGDOPE_SIZE, + pMsgBuffer->WriteInitialization(pFile, this, TYPE_MSGDOPE_SIZE, GetSendDirection()); } diff -ruN p2/l4/tool/dice/src/be/l4/L4BEReplyFunction.h p3/l4/tool/dice/src/be/l4/L4BEReplyFunction.h --- p2/l4/tool/dice/src/be/l4/L4BEReplyFunction.h 2006-06-14 14:25:05.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BEReplyFunction.h 2006-11-30 10:41:12.000000000 +0100 @@ -53,8 +53,7 @@ virtual void WriteIPC(CBEFile *pFile); virtual void WriteIPCErrorCheck(CBEFile *pFile); virtual void WriteVariableInitialization(CBEFile * pFile); - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); }; #endif diff -ruN p2/l4/tool/dice/src/be/l4/L4BESndFunction.cpp p3/l4/tool/dice/src/be/l4/L4BESndFunction.cpp --- p2/l4/tool/dice/src/be/l4/L4BESndFunction.cpp 2006-08-23 19:27:58.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BESndFunction.cpp 2006-11-30 10:41:12.000000000 +0100 @@ -44,7 +44,6 @@ #include "Attribute-Type.h" #include "Compiler.h" #include -using namespace std; CL4BESndFunction::CL4BESndFunction() { @@ -63,7 +62,6 @@ */ void CL4BESndFunction::CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*) { CBESndFunction::CreateBackEnd(pFEOperation); @@ -96,7 +94,7 @@ // after marshalling set the message dope CBEMsgBuffer *pMsgBuffer = GetMessageBuffer(); assert(pMsgBuffer); - pMsgBuffer->WriteInitialization(pFile, TYPE_MSGDOPE_SEND, + pMsgBuffer->WriteInitialization(pFile, this, TYPE_MSGDOPE_SEND, GetSendDirection()); // invocate if (!CCompiler::IsOptionSet(PROGRAM_NO_SEND_CANCELED_CHECK)) @@ -180,7 +178,7 @@ CBESndFunction::WriteVariableInitialization(pFile); CBEMsgBuffer *pMsgBuffer = GetMessageBuffer(); assert(pMsgBuffer); - pMsgBuffer->WriteInitialization(pFile, TYPE_MSGDOPE_SIZE, + pMsgBuffer->WriteInitialization(pFile, this, TYPE_MSGDOPE_SIZE, GetSendDirection()); } diff -ruN p2/l4/tool/dice/src/be/l4/L4BESndFunction.h p3/l4/tool/dice/src/be/l4/L4BESndFunction.h --- p2/l4/tool/dice/src/be/l4/L4BESndFunction.h 2006-06-14 14:25:05.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BESndFunction.h 2006-11-30 10:41:12.000000000 +0100 @@ -49,8 +49,7 @@ virtual void WriteIPCErrorCheck(CBEFile * pFile); virtual void WriteVariableInitialization(CBEFile * pFile); virtual void WriteIPC(CBEFile *pFile); - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); }; #endif diff -ruN p2/l4/tool/dice/src/be/l4/L4BESrvLoopFunction.cpp p3/l4/tool/dice/src/be/l4/L4BESrvLoopFunction.cpp --- p2/l4/tool/dice/src/be/l4/L4BESrvLoopFunction.cpp 2006-08-23 19:27:58.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BESrvLoopFunction.cpp 2006-11-30 10:41:12.000000000 +0100 @@ -43,7 +43,6 @@ #include "Attribute-Type.h" #include "Compiler.h" #include -using namespace std; CL4BESrvLoopFunction::CL4BESrvLoopFunction() { @@ -74,11 +73,11 @@ if (CCompiler::IsOptionSet(PROGRAM_ZERO_MSGBUF)) pMsgBuffer->WriteSetZero(pFile); // set the size dope here, so we do not need to set it anywhere else - pMsgBuffer->WriteInitialization(pFile, TYPE_MSGDOPE_SIZE, 0); + pMsgBuffer->WriteInitialization(pFile, this, TYPE_MSGDOPE_SIZE, 0); // init receive flexpage - pMsgBuffer->WriteInitialization(pFile, TYPE_RCV_FLEXPAGE, 0); + pMsgBuffer->WriteInitialization(pFile, this, TYPE_RCV_FLEXPAGE, 0); // init indirect strings (using generic struct) - pMsgBuffer->WriteInitialization(pFile, TYPE_REFSTRING, 0); + pMsgBuffer->WriteInitialization(pFile, this, TYPE_REFSTRING, 0); // set CORBA_Object depending on [dedicated_partner]. Here, the // environment is initialized, so it is save to use the environment's @@ -149,7 +148,6 @@ */ void CL4BESrvLoopFunction::CreateBackEnd(CFEInterface * pFEInterface) - throw (CBECreateException*) { CBESrvLoopFunction::CreateBackEnd(pFEInterface); // test for flexpages diff -ruN p2/l4/tool/dice/src/be/l4/L4BESrvLoopFunction.h p3/l4/tool/dice/src/be/l4/L4BESrvLoopFunction.h --- p2/l4/tool/dice/src/be/l4/L4BESrvLoopFunction.h 2006-06-14 14:25:05.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BESrvLoopFunction.h 2006-11-30 10:41:12.000000000 +0100 @@ -52,8 +52,7 @@ CL4BESrvLoopFunction(CL4BESrvLoopFunction &src); public: - virtual void CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEInterface *pFEInterface); protected: virtual void WriteVariableInitialization(CBEFile *pFile); diff -ruN p2/l4/tool/dice/src/be/l4/L4BESwitchCase.cpp p3/l4/tool/dice/src/be/l4/L4BESwitchCase.cpp --- p2/l4/tool/dice/src/be/l4/L4BESwitchCase.cpp 2006-10-12 18:17:45.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BESwitchCase.cpp 2006-11-30 10:41:12.000000000 +0100 @@ -28,6 +28,7 @@ #include "be/l4/L4BESwitchCase.h" #include "be/BETypedDeclarator.h" +#include "be/BEFile.h" #include "Attribute-Type.h" @@ -46,8 +47,9 @@ { } -/** \brief writes the cleanup code for a switch case +/** \brief initialize local variables * \param pFile the file to write to + * \param nDirection the direction of the parameters to initailize * * If we have a [out, ref] for which we allocated memory in the switch case, * then this memory has to be valid until the reply, which is after this @@ -56,7 +58,37 @@ * \todo we have to remember which indirect strings are associated with * dynamically allocated memory and have to be freed after the IPC. */ -void CL4BESwitchCase::WriteCleanup(CBEFile* pFile) +void +CL4BESwitchCase::WriteVariableInitialization(CBEFile * pFile, + int nDirection) +{ + // first call the base class + CBESwitchCase::WriteVariableInitialization(pFile, nDirection); + // now check for [out, ref] and call appropriate "deferred" cleanup method + vector::iterator iter; + for (iter = m_Parameters.begin(); + iter != m_Parameters.end(); + iter++) + { + if (!DoWriteVariable(*iter)) + continue; + if (!(*iter)->IsDirection(nDirection)) + continue; + if ((*iter)->m_Attributes.Find(ATTR_IN)) + continue; + if (!(*iter)->m_Attributes.Find(ATTR_REF)) + continue; + (*iter)->WriteCleanup(pFile, true); + } +} + +/** \brief writes the clean up code + * \param pFile the file to write to + * + * If we have an [out, ref] skip the cleanup here, because it is already + * registered for "deferred" cleanup. + */ +void CL4BESwitchCase::WriteCleanup(CBEFile * pFile) { // cleanup indirect variables vector::iterator iter; @@ -64,16 +96,14 @@ iter != m_Parameters.end(); iter++) { + if (!DoWriteVariable(*iter)) + continue; if (!(*iter)->IsDirection(DIRECTION_OUT)) continue; if ((*iter)->m_Attributes.Find(ATTR_IN)) continue; - // up to here the same as the base class - // now thest for [ref] which indicates indirect strings - if ((*iter)->m_Attributes.Find(ATTR_REF)) - (*iter)->WriteCleanup(pFile, true); - else - (*iter)->WriteCleanup(pFile, false); + if ((*iter)->m_Attributes.Find(ATTR_REF)) + continue; + (*iter)->WriteCleanup(pFile, false); } } - diff -ruN p2/l4/tool/dice/src/be/l4/L4BESwitchCase.h p3/l4/tool/dice/src/be/l4/L4BESwitchCase.h --- p2/l4/tool/dice/src/be/l4/L4BESwitchCase.h 2006-06-14 14:25:05.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BESwitchCase.h 2006-11-30 10:41:12.000000000 +0100 @@ -51,7 +51,8 @@ CL4BESwitchCase(CL4BESwitchCase &src); protected: - virtual void WriteCleanup(CBEFile* pFile); + virtual void WriteVariableInitialization(CBEFile *pFile, int nDirection); + virtual void WriteCleanup(CBEFile *pFile); }; #endif diff -ruN p2/l4/tool/dice/src/be/l4/L4BETrace.cpp p3/l4/tool/dice/src/be/l4/L4BETrace.cpp --- p2/l4/tool/dice/src/be/l4/L4BETrace.cpp 2006-08-23 19:27:58.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BETrace.cpp 2006-11-30 10:41:12.000000000 +0100 @@ -42,7 +42,6 @@ #include "be/BEClass.h" #include "Compiler.h" #include -using namespace std; CL4BETrace::CL4BETrace() { @@ -75,6 +74,39 @@ string("__attribute__ ((unused))")); } +/** \brief write the code required just before the loop starts + * \param pFile the file to write to + * \param pFunction the server loop function calling this hook + * + * This is different from InitServer, because InitServer is called before all + * the variables are initialized. BeforeLoop is called after all the variables + * are initialized and just before the loop actually starts doing something. + */ +void +CL4BETrace::BeforeLoop(CBEFile* pFile, + CBEFunction* pFunction) +{ + if (!pFunction->IsComponentSide()) + return; + if (!CCompiler::IsOptionSet(PROGRAM_TRACE_SERVER)) + return; + + CBEMsgBuffer *pMsgBuffer = pFunction->GetMessageBuffer(); + assert(pMsgBuffer); + // get tracing function + string sFunc = CCompiler::GetTraceServerFunc(); + + *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << + ": _size(%d,%d)\\n\", "; + pFile->IncIndent(); + *pFile << "\t"; + pMsgBuffer->WriteMemberAccess(pFile, pFunction, 0, TYPE_MSGDOPE_SIZE, 0); + *pFile << ".md.dwords, "; + pMsgBuffer->WriteMemberAccess(pFile, pFunction, 0, TYPE_MSGDOPE_SIZE, 0); + *pFile << ".md.strings);\n"; + pFile->DecIndent(); +} + /** \brief prints the tracing message before a call * \param pFile the file to write to * \param pFunction the function to write for @@ -119,10 +151,11 @@ { string sMWord = pNF->GetTypeName(TYPE_MWORD, false, 0); *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": server %%2X.%%X\\n\", " << pObjName->GetName() << + ": server %2X.%X\\n\", " << pObjName->GetName() << "->id.task, " << pObjName->GetName() << "->id.lthread);\n"; + *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": with dw0=0x%%x, dw1=0x%%x\\n\", "; + ": with dw0=0x%x, dw1=0x%x\\n\", "; pFile->IncIndent(); *pFile << "\t(unsigned int)"; CL4BEMarshaller *pMarshaller = static_cast( @@ -137,6 +170,21 @@ *pFile << "0"; *pFile << ");\n"; pFile->DecIndent(); + + *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << + ": _size(%d,%d), _send(%d,%d)\\n\", "; + pFile->IncIndent(); + *pFile << "\t"; + pMsgBuffer->WriteMemberAccess(pFile, pFunction, nSndDir, TYPE_MSGDOPE_SIZE, 0); + *pFile << ".md.dwords, "; + pMsgBuffer->WriteMemberAccess(pFile, pFunction, nSndDir, TYPE_MSGDOPE_SIZE, 0); + *pFile << ".md.strings,\n"; + *pFile << "\t"; + pMsgBuffer->WriteMemberAccess(pFile, pFunction, nSndDir, TYPE_MSGDOPE_SEND, 0); + *pFile << ".md.dwords, "; + pMsgBuffer->WriteMemberAccess(pFile, pFunction, nSndDir, TYPE_MSGDOPE_SEND, 0); + *pFile << ".md.strings);\n"; + pFile->DecIndent(); } if (CCompiler::IsOptionSet(PROGRAM_TRACE_MSGBUF) && @@ -184,7 +232,7 @@ CCompiler::IsOptionSet(PROGRAM_TRACE_SERVER)) { *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": return dope %%lx (ipc error %%lx)\\n\",\n"; + ": return dope %lx (ipc error %lx)\\n\",\n"; *pFile << "\t\t" << sResult << ".msgdope, L4_IPC_ERROR(" << sResult << "));\n"; } @@ -221,10 +269,10 @@ pCF->GetNewMarshaller()); *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": opcode %%lx received from %%2X.%%X\\n\", " << sOpcodeVar << + ": opcode %lx received from %2X.%X\\n\", " << sOpcodeVar << ", " << sObjectVar << "->id.task, " << sObjectVar << "->id.lthread);\n"; *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": received dw0=%%lx, dw1=%%lx\\n\", " << "(unsigned long)"; + ": received dw0=%lx, dw1=%lx\\n\", " << "(unsigned long)"; if (!pMarshaller->MarshalWordMember(pFile, pFunction, nDirection, 0, false, false)) *pFile << "0"; @@ -259,7 +307,7 @@ pCF->GetNewMarshaller()); *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": reply %%s (dw0=%%lx, dw1=%%lx)\\n\", (" << + ": reply %s (dw0=%lx, dw1=%lx)\\n\", (" << sReply << "==DICE_REPLY)?\"DICE_REPLY\":\"DICE_NO_REPLY\", " << "(unsigned long)"; if (!pMarshaller->MarshalWordMember(pFile, pFunction, nDirection, 0, @@ -271,7 +319,7 @@ *pFile << "0"; *pFile << " );\n"; // print if we got an fpage - *pFile << "\t" << sFunc << " (\" fpage: %%s\\n\", ("; + *pFile << "\t" << sFunc << " (\" fpage: %s\\n\", ("; pMsgBuffer->WriteMemberAccess(pFile, pFunction, nDirection, TYPE_MSGDOPE_SEND, 0); *pFile << ".md.fpage_received==1)?\"yes\":\"no\");\n"; @@ -299,7 +347,7 @@ CL4BEMarshaller *pMarshaller = static_cast( pCF->GetNewMarshaller()); - *pFile << "\t" << sFunc << " (\"reply (dw0=%%lx, dw1=%%lx)\\n\", "; + *pFile << "\t" << sFunc << " (\"reply (dw0=%lx, dw1=%lx)\\n\", "; *pFile << "(unsigned long)"; if (!pMarshaller->MarshalWordMember(pFile, pFunction, 0, 0, false, false)) @@ -310,17 +358,17 @@ *pFile << "0"; *pFile << ");\n"; // dwords - *pFile << "\t" << sFunc << " (\" words: %%d\\n\", "; + *pFile << "\t" << sFunc << " (\" words: %d\\n\", "; pMsgBuffer->WriteMemberAccess(pFile, pFunction, DIRECTION_OUT, TYPE_MSGDOPE_SEND, 0); *pFile << ".md.dwords);\n"; // strings - *pFile << "\t" << sFunc << " (\" strings; %%d\\n\", "; + *pFile << "\t" << sFunc << " (\" strings; %d\\n\", "; pMsgBuffer->WriteMemberAccess(pFile, pFunction, DIRECTION_OUT, TYPE_MSGDOPE_SEND, 0); *pFile << ".md.strings);\n"; // print if we got an fpage - *pFile << "\t" << sFunc << " (\" fpage: %%s\\n\", ("; + *pFile << "\t" << sFunc << " (\" fpage: %s\\n\", ("; pMsgBuffer->WriteMemberAccess(pFile, pFunction, DIRECTION_OUT, TYPE_MSGDOPE_SEND, 0); *pFile << ".md.fpage_received==1)?\"yes\":\"no\");\n"; @@ -358,7 +406,7 @@ if (CCompiler::IsOptionSet(PROGRAM_TRACE_SERVER)) { *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": return dope %%lx (ipc error %%lx)\\n\",\n"; + ": return dope %lx (ipc error %lx)\\n\",\n"; *pFile << "\t\t" << sResult << ".msgdope, L4_IPC_ERROR(" << sResult << "));\n"; } @@ -381,10 +429,10 @@ string sResult = pNF->GetString(CL4BENameFactory::STR_RESULT_VAR); *pFile << "\t" << sTraceFunc << - " (\"IPC Error in server: 0x%%02lx\\n\", L4_IPC_ERROR(" << + " (\"IPC Error in server: 0x%02lx\\n\", L4_IPC_ERROR(" << sResult << "));\n"; *pFile << "\t" << sTraceFunc << - " (\" reply-wait returns with opcode %%lx\\n\", "; + " (\" reply-wait returns with opcode %lx\\n\", "; pReturn->m_Declarators.First()->WriteName(pFile); *pFile << ");\n"; diff -ruN p2/l4/tool/dice/src/be/l4/L4BETrace.h p3/l4/tool/dice/src/be/l4/L4BETrace.h --- p2/l4/tool/dice/src/be/l4/L4BETrace.h 2006-08-04 18:17:17.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BETrace.h 2006-11-30 10:41:12.000000000 +0100 @@ -41,6 +41,7 @@ virtual ~CL4BETrace(); virtual void AddLocalVariable(CBEFunction *pFunction); + virtual void BeforeLoop(CBEFile *pFile, CBEFunction *pFunction); virtual void BeforeCall(CBEFile *pFile, CBEFunction *pFunction); virtual void AfterCall(CBEFile *pFile, CBEFunction *pFunction); virtual void BeforeDispatch(CBEFile *pFile, CBEFunction *pFunction); diff -ruN p2/l4/tool/dice/src/be/l4/L4BEWaitAnyFunction.cpp p3/l4/tool/dice/src/be/l4/L4BEWaitAnyFunction.cpp --- p2/l4/tool/dice/src/be/l4/L4BEWaitAnyFunction.cpp 2006-08-23 19:27:58.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BEWaitAnyFunction.cpp 2006-11-30 10:41:12.000000000 +0100 @@ -44,7 +44,6 @@ #include "Attribute-Type.h" #include "Compiler.h" #include -using namespace std; CL4BEWaitAnyFunction::CL4BEWaitAnyFunction(bool bOpenWait, bool bReply) : CBEWaitAnyFunction(bOpenWait, bReply) @@ -67,7 +66,6 @@ */ void CL4BEWaitAnyFunction::CreateBackEnd(CFEInterface *pFEInterface) -throw (CBECreateException*) { // set local variables CBEWaitAnyFunction::CreateBackEnd(pFEInterface); @@ -113,7 +111,7 @@ if (pMsgBuffer && m_bReply) { // init receive flexpage - pMsgBuffer->WriteInitialization(pFile, TYPE_FLEXPAGE, + pMsgBuffer->WriteInitialization(pFile, this, TYPE_FLEXPAGE, GetReceiveDirection()); } } @@ -147,8 +145,7 @@ WriteIPCErrorCheck(pFile); // set IPC exception - if (m_bReply) - WriteReleaseMemory(pFile); + WriteReleaseMemory(pFile); } /** \brief writes the ipc code diff -ruN p2/l4/tool/dice/src/be/l4/L4BEWaitAnyFunction.h p3/l4/tool/dice/src/be/l4/L4BEWaitAnyFunction.h --- p2/l4/tool/dice/src/be/l4/L4BEWaitAnyFunction.h 2006-07-06 11:23:03.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BEWaitAnyFunction.h 2006-11-30 10:41:12.000000000 +0100 @@ -70,8 +70,7 @@ virtual void WriteShortFlexpageIPC(CBEFile *pFile); virtual void WriteReleaseMemory(CBEFile *pFile); virtual void WriteDedicatedWait(CBEFile *pFile); - virtual void CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEInterface *pFEInterface); virtual void WriteCleanup(CBEFile * pFile); }; diff -ruN p2/l4/tool/dice/src/be/l4/L4BEWaitFunction.cpp p3/l4/tool/dice/src/be/l4/L4BEWaitFunction.cpp --- p2/l4/tool/dice/src/be/l4/L4BEWaitFunction.cpp 2006-08-23 19:27:58.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BEWaitFunction.cpp 2006-11-30 10:41:12.000000000 +0100 @@ -46,7 +46,6 @@ #include "Attribute-Type.h" #include "Compiler.h" #include -using namespace std; CL4BEWaitFunction::CL4BEWaitFunction(bool bOpenWait) : CBEWaitFunction(bOpenWait) @@ -64,7 +63,6 @@ */ void CL4BEWaitFunction::CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*) { CBEWaitFunction::CreateBackEnd(pFEOperation); @@ -98,7 +96,7 @@ // set size and send dope CBEMsgBuffer *pMsgBuffer = GetMessageBuffer(); assert(pMsgBuffer); - pMsgBuffer->WriteInitialization(pFile, TYPE_MSGDOPE_SEND, + pMsgBuffer->WriteInitialization(pFile, this, TYPE_MSGDOPE_SEND, GetReceiveDirection()); // invocate @@ -265,8 +263,8 @@ CBEMsgBuffer *pMsgBuffer = GetMessageBuffer(); assert(pMsgBuffer); int nDirection = GetReceiveDirection(); - pMsgBuffer->WriteInitialization(pFile, TYPE_MSGDOPE_SIZE, nDirection); - pMsgBuffer->WriteInitialization(pFile, TYPE_RCV_FLEXPAGE, nDirection); + pMsgBuffer->WriteInitialization(pFile, this, TYPE_MSGDOPE_SIZE, nDirection); + pMsgBuffer->WriteInitialization(pFile, this, TYPE_RCV_FLEXPAGE, nDirection); } /** \brief calculates the size of the function's parameters diff -ruN p2/l4/tool/dice/src/be/l4/L4BEWaitFunction.h p3/l4/tool/dice/src/be/l4/L4BEWaitFunction.h --- p2/l4/tool/dice/src/be/l4/L4BEWaitFunction.h 2006-06-14 14:25:06.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/L4BEWaitFunction.h 2006-11-30 10:41:12.000000000 +0100 @@ -58,8 +58,7 @@ virtual void WriteVariableInitialization(CBEFile* pFile); virtual void WriteFlexpageOpcodePatch(CBEFile *pFile); virtual void WriteIPC(CBEFile *pFile); - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); }; #endif diff -ruN p2/l4/tool/dice/src/be/l4/v2/amd64/V2AMD64ClassFactory.cpp p3/l4/tool/dice/src/be/l4/v2/amd64/V2AMD64ClassFactory.cpp --- p2/l4/tool/dice/src/be/l4/v2/amd64/V2AMD64ClassFactory.cpp 2006-08-23 19:27:59.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v2/amd64/V2AMD64ClassFactory.cpp 2006-11-30 10:41:13.000000000 +0100 @@ -31,7 +31,6 @@ #include "be/BEContext.h" #include "Compiler.h" #include -using namespace std; CL4V2AMD64BEClassFactory::CL4V2AMD64BEClassFactory() : CL4V2BEClassFactory() diff -ruN p2/l4/tool/dice/src/be/l4/v2/amd64/V2AMD64NameFactory.cpp p3/l4/tool/dice/src/be/l4/v2/amd64/V2AMD64NameFactory.cpp --- p2/l4/tool/dice/src/be/l4/v2/amd64/V2AMD64NameFactory.cpp 2006-08-23 19:27:59.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v2/amd64/V2AMD64NameFactory.cpp 2006-11-30 10:41:13.000000000 +0100 @@ -30,7 +30,6 @@ #include "Compiler.h" #include "TypeSpec-Type.h" #include -using namespace std; CL4V2AMD64BENameFactory::CL4V2AMD64BENameFactory() : CL4BENameFactory() diff -ruN p2/l4/tool/dice/src/be/l4/v2/ia32/V2IA32ClassFactory.cpp p3/l4/tool/dice/src/be/l4/v2/ia32/V2IA32ClassFactory.cpp --- p2/l4/tool/dice/src/be/l4/v2/ia32/V2IA32ClassFactory.cpp 2006-08-23 19:27:59.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v2/ia32/V2IA32ClassFactory.cpp 2006-11-30 10:41:13.000000000 +0100 @@ -32,7 +32,6 @@ #include "be/BEContext.h" #include "Compiler.h" #include -using namespace std; CL4V2IA32BEClassFactory::CL4V2IA32BEClassFactory() : CL4V2BEClassFactory() diff -ruN p2/l4/tool/dice/src/be/l4/v2/ia32/V2IA32IPC.cpp p3/l4/tool/dice/src/be/l4/v2/ia32/V2IA32IPC.cpp --- p2/l4/tool/dice/src/be/l4/v2/ia32/V2IA32IPC.cpp 2006-08-21 16:46:39.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v2/ia32/V2IA32IPC.cpp 2006-11-30 10:41:13.000000000 +0100 @@ -41,7 +41,6 @@ #include #include -using namespace std; CL4V2IA32BEIPC::CL4V2IA32BEIPC() : CL4V2BEIPC() @@ -173,30 +172,30 @@ // *pFile << "\tasm volatile(\n"; pFile->IncIndent(); - *pFile << "\t\"pushl %%%%ebx \\n\\t\"\n"; - *pFile << "\t\"pushl %%%%ebp \\n\\t\"\n"; + *pFile << "\t\"pushl %%ebx \\n\\t\"\n"; + *pFile << "\t\"pushl %%ebp \\n\\t\"\n"; if (bScheduling) { if (bSendFlexpage) - *pFile << "\t\"orl $2,%%%%eax \\n\\t\"\n"; - *pFile << "\t\"movl %%%%edi,%%%%ebx \\n\\t\"\n"; - *pFile << "\t\"movl 4(%%%%esi),%%%%edi \\n\\t\"\n"; - *pFile << "\t\"movl (%%%%esi),%%%%esi \\n\\t\"\n"; + *pFile << "\t\"orl $2,%%eax \\n\\t\"\n"; + *pFile << "\t\"movl %%edi,%%ebx \\n\\t\"\n"; + *pFile << "\t\"movl 4(%%esi),%%edi \\n\\t\"\n"; + *pFile << "\t\"movl (%%esi),%%esi \\n\\t\"\n"; } else { - *pFile << "\t\"movl %%%%eax,%%%%ebx \\n\\t\"\n"; + *pFile << "\t\"movl %%eax,%%ebx \\n\\t\"\n"; if (bSendFlexpage) - *pFile << "\t\"movl $2,%%%%eax \\n\\t\"\n"; + *pFile << "\t\"movl $2,%%eax \\n\\t\"\n"; else - *pFile << "\t\"subl %%%%eax,%%%%eax \\n\\t\"\n"; + *pFile << "\t\"subl %%eax,%%eax \\n\\t\"\n"; } - *pFile << "\t\"subl %%%%ebp,%%%%ebp \\n\\t\"\n"; + *pFile << "\t\"subl %%ebp,%%ebp \\n\\t\"\n"; *pFile << "\tIPC_SYSENTER\n"; - *pFile << "\t\"popl %%%%ebp \\n\\t\"\n"; - *pFile << "\t\"movl %%%%ebx,%%%%ecx \\n\\t\"\n"; - *pFile << "\t\"popl %%%%ebx \\n\\t\"\n"; + *pFile << "\t\"popl %%ebp \\n\\t\"\n"; + *pFile << "\t\"movl %%ebx,%%ecx \\n\\t\"\n"; + *pFile << "\t\"popl %%ebx \\n\\t\"\n"; *pFile << "\t:\n"; *pFile << "\t\"=a\" (" << sResult << "),\n"; *pFile << "\t\"=d\" ("; @@ -301,22 +300,22 @@ // *pFile << "\tasm volatile(\n"; pFile->IncIndent(); - *pFile << "\t\"pushl %%%%ebp \\n\\t\"\n"; + *pFile << "\t\"pushl %%ebp \\n\\t\"\n"; if (bScheduling) { if (bSendFlexpage) - *pFile << "\t\"orl $2,%%%%eax \\n\\t\"\n"; + *pFile << "\t\"orl $2,%%eax \\n\\t\"\n"; } else { if (bSendFlexpage) - *pFile << "\t\"movl $2,%%%%eax \\n\\t\"\n"; + *pFile << "\t\"movl $2,%%eax \\n\\t\"\n"; else - *pFile << "\t\"subl %%%%eax,%%%%eax \\n\\t\"\n"; + *pFile << "\t\"subl %%eax,%%eax \\n\\t\"\n"; } - *pFile << "\t\"subl %%%%ebp,%%%%ebp \\n\\t\"\n"; + *pFile << "\t\"subl %%ebp,%%ebp \\n\\t\"\n"; *pFile << "\tIPC_SYSENTER\n"; - *pFile << "\t\"popl %%%%ebp \\n\\t\"\n"; + *pFile << "\t\"popl %%ebp \\n\\t\"\n"; *pFile << "\t:\n"; *pFile << "\t\"=a\" (" << sResult << "),\n"; /* EAX, 0 */ *pFile << "\t\"=d\" ("; @@ -442,48 +441,48 @@ // *pFile << "\tasm volatile(\n"; pFile->IncIndent(); - *pFile << "\t\"pushl %%%%ebx \\n\\t\"\n"; - *pFile << "\t\"pushl %%%%ebp \\n\\t\"\n"; + *pFile << "\t\"pushl %%ebx \\n\\t\"\n"; + *pFile << "\t\"pushl %%ebp \\n\\t\"\n"; if (bSendShortIPC) { - *pFile << "\t\"movl %%%%eax,%%%%ebp \\n\\t\"\n"; + *pFile << "\t\"movl %%eax,%%ebp \\n\\t\"\n"; if (bScheduling) { - *pFile << "\t\"andl $0xfffffffc,%%%%ebp \\n\\t\"\n"; - *pFile << "\t\"andl $0x1,%%%%eax \\n\\t\"\n"; + *pFile << "\t\"andl $0xfffffffc,%%ebp \\n\\t\"\n"; + *pFile << "\t\"andl $0x1,%%eax \\n\\t\"\n"; if (bSendFlexpage) - *pFile << "\t\"orl $0x2,%%%%eax \\n\\t\"\n"; + *pFile << "\t\"orl $0x2,%%eax \\n\\t\"\n"; } else { if (bSendFlexpage) - *pFile << "\t\"movl $0x2,%%%%eax \\n\\t\"\n"; + *pFile << "\t\"movl $0x2,%%eax \\n\\t\"\n"; else - *pFile << "\t\"subl %%%%eax,%%%%eax \\n\\t\"\n"; + *pFile << "\t\"subl %%eax,%%eax \\n\\t\"\n"; } } else if (bRecvShortIPC) { - *pFile << "\t\"subl %%%%ebp,%%%%ebp \\n\\t\"\n"; + *pFile << "\t\"subl %%ebp,%%ebp \\n\\t\"\n"; if (bSendFlexpage) - *pFile << "\t\"orl $0x2,%%%%eax \\n\\t\"\n"; + *pFile << "\t\"orl $0x2,%%eax \\n\\t\"\n"; } else // long both ways { - *pFile << "\t\"movl %%%%eax,%%%%ebp \\n\\t\"\n"; + *pFile << "\t\"movl %%eax,%%ebp \\n\\t\"\n"; if (bScheduling) - *pFile << "\t\"andl $0xfffffffc,%%%%ebp \\n\\t\"\n"; + *pFile << "\t\"andl $0xfffffffc,%%ebp \\n\\t\"\n"; if (bSendFlexpage) - *pFile << "\t\"orl $0x2,%%%%eax \\n\\t\"\n"; + *pFile << "\t\"orl $0x2,%%eax \\n\\t\"\n"; } - *pFile << "\t\"movl %%%%edi,%%%%ebx \\n\\t\"\n"; - *pFile << "\t\"movl 4(%%%%esi),%%%%edi \\n\\t\"\n"; - *pFile << "\t\"movl (%%%%esi),%%%%esi \\n\\t\"\n"; + *pFile << "\t\"movl %%edi,%%ebx \\n\\t\"\n"; + *pFile << "\t\"movl 4(%%esi),%%edi \\n\\t\"\n"; + *pFile << "\t\"movl (%%esi),%%esi \\n\\t\"\n"; *pFile << "\tIPC_SYSENTER\n"; - *pFile << "\t\"popl %%%%ebp \\n\\t\"\n"; - *pFile << "\t\"movl %%%%ebx,%%%%ecx \\n\\t\"\n"; - *pFile << "\t\"popl %%%%ebx \\n\\t\"\n"; + *pFile << "\t\"popl %%ebp \\n\\t\"\n"; + *pFile << "\t\"movl %%ebx,%%ecx \\n\\t\"\n"; + *pFile << "\t\"popl %%ebx \\n\\t\"\n"; *pFile << "\t:\n"; *pFile << "\t\"=a\" (" << sResult << "),\n"; *pFile << "\t\"=d\" ("; @@ -594,42 +593,42 @@ // *pFile << "\tasm volatile(\n"; pFile->IncIndent(); - *pFile << "\t\"pushl %%%%ebp \\n\\t\"\n"; + *pFile << "\t\"pushl %%ebp \\n\\t\"\n"; if (bSendShortIPC) { - *pFile << "\t\"movl %%%%eax,%%%%ebp \\n\\t\"\n"; + *pFile << "\t\"movl %%eax,%%ebp \\n\\t\"\n"; if (bScheduling) { - *pFile << "\t\"andl $0xfffffffc,%%%%ebp \\n\\t\"\n"; - *pFile << "\t\"andl $0x1,%%%%eax \\n\\t\"\n"; + *pFile << "\t\"andl $0xfffffffc,%%ebp \\n\\t\"\n"; + *pFile << "\t\"andl $0x1,%%eax \\n\\t\"\n"; if (bSendFlexpage) - *pFile << "\t\"orl $0x2,%%%%eax \\n\\t\"\n"; + *pFile << "\t\"orl $0x2,%%eax \\n\\t\"\n"; } else { if (bSendFlexpage) - *pFile << "\t\"movl $0x2,%%%%eax \\n\\t\"\n"; + *pFile << "\t\"movl $0x2,%%eax \\n\\t\"\n"; else - *pFile << "\t\"subl %%%%eax,%%%%eax \\n\\t\"\n"; + *pFile << "\t\"subl %%eax,%%eax \\n\\t\"\n"; } } else if (bRecvShortIPC) { - *pFile << "\t\"subl %%%%ebp,%%%%ebp \\n\\t\"\n"; + *pFile << "\t\"subl %%ebp,%%ebp \\n\\t\"\n"; if (bSendFlexpage) - *pFile << "\t\"orl $0x2,%%%%eax \\n\\t\"\n"; + *pFile << "\t\"orl $0x2,%%eax \\n\\t\"\n"; } else // long both ways { - *pFile << "\t\"movl %%%%eax,%%%%ebp \\n\\t\"\n"; + *pFile << "\t\"movl %%eax,%%ebp \\n\\t\"\n"; if (bScheduling) - *pFile << "\t\"andl $0xfffffffc,%%%%ebp \\n\\t\"\n"; + *pFile << "\t\"andl $0xfffffffc,%%ebp \\n\\t\"\n"; if (bSendFlexpage) - *pFile << "\t\"orl $0x2,%%%%eax \\n\\t\"\n"; + *pFile << "\t\"orl $0x2,%%eax \\n\\t\"\n"; } *pFile << "\tIPC_SYSENTER\n"; - *pFile << "\t\"popl %%%%ebp \\n\\t\"\n"; + *pFile << "\t\"popl %%ebp \\n\\t\"\n"; *pFile << "\t:\n"; *pFile << "\t\"=a\" (" << sResult << "),\n"; *pFile << "\t\"=d\" ("; @@ -766,18 +765,18 @@ // *pFile << "\tasm volatile(\n"; pFile->IncIndent(); - *pFile << "\t\"pushl %%%%ebx \\n\\t\"\n"; - *pFile << "\t\"pushl %%%%ebp \\n\\t\"\n"; + *pFile << "\t\"pushl %%ebx \\n\\t\"\n"; + *pFile << "\t\"pushl %%ebp \\n\\t\"\n"; if (bSendFlexpage) - *pFile << "\t\"orl $0x2,%%%%eax \\n\\t\"\n"; - *pFile << "\t\"movl $0xffffffff,%%%%ebp \\n\\t\"\n"; - *pFile << "\t\"movl %%%%edi,%%%%ebx \\n\\t\"\n"; - *pFile << "\t\"movl 4(%%%%esi),%%%%edi \\n\\t\"\n"; - *pFile << "\t\"movl (%%%%esi),%%%%esi \\n\\t\"\n"; + *pFile << "\t\"orl $0x2,%%eax \\n\\t\"\n"; + *pFile << "\t\"movl $0xffffffff,%%ebp \\n\\t\"\n"; + *pFile << "\t\"movl %%edi,%%ebx \\n\\t\"\n"; + *pFile << "\t\"movl 4(%%esi),%%edi \\n\\t\"\n"; + *pFile << "\t\"movl (%%esi),%%esi \\n\\t\"\n"; *pFile << "\tIPC_SYSENTER\n"; - *pFile << "\t\"popl %%%%ebp \\n\\t\"\n"; - *pFile << "\t\"popl %%%%ebx \\n\\t\"\n"; + *pFile << "\t\"popl %%ebp \\n\\t\"\n"; + *pFile << "\t\"popl %%ebx \\n\\t\"\n"; *pFile << "\t:\n"; *pFile << "\t\"=a\" (" << sResult << "),\n"; *pFile << "\t\"=d\" (" << sDummy << "),\n"; @@ -864,12 +863,12 @@ // *pFile << "\tasm volatile(\n"; pFile->IncIndent(); - *pFile << "\t\"pushl %%%%ebp \\n\\t\"\n"; + *pFile << "\t\"pushl %%ebp \\n\\t\"\n"; if (bSendFlexpage) - *pFile << "\t\"orl $0x2,%%%%eax \\n\\t\"\n"; - *pFile << "\t\"movl $-1,%%%%ebp \\n\\t\"\n"; + *pFile << "\t\"orl $0x2,%%eax \\n\\t\"\n"; + *pFile << "\t\"movl $-1,%%ebp \\n\\t\"\n"; *pFile << "\tIPC_SYSENTER\n"; - *pFile << "\t\"popl %%%%ebp \\n\\t\"\n"; + *pFile << "\t\"popl %%ebp \\n\\t\"\n"; *pFile << "\t:\n"; *pFile << "\t\"=a\" (" << sResult << "),\n"; *pFile << "\t\"=d\" (" << sDummy << "),\n"; diff -ruN p2/l4/tool/dice/src/be/l4/v2/L4V2BEClassFactory.cpp p3/l4/tool/dice/src/be/l4/v2/L4V2BEClassFactory.cpp --- p2/l4/tool/dice/src/be/l4/v2/L4V2BEClassFactory.cpp 2006-08-23 19:27:59.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v2/L4V2BEClassFactory.cpp 2006-11-30 10:41:12.000000000 +0100 @@ -35,7 +35,6 @@ #include "Compiler.h" #include "be/BEContext.h" #include -using namespace std; CL4V2BEClassFactory::CL4V2BEClassFactory() : CL4BEClassFactory() diff -ruN p2/l4/tool/dice/src/be/l4/v2/L4V2BEDispatchFunction.cpp p3/l4/tool/dice/src/be/l4/v2/L4V2BEDispatchFunction.cpp --- p2/l4/tool/dice/src/be/l4/v2/L4V2BEDispatchFunction.cpp 2006-08-04 17:12:26.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v2/L4V2BEDispatchFunction.cpp 2006-11-30 10:41:12.000000000 +0100 @@ -30,7 +30,6 @@ #include "be/l4/TypeSpec-L4Types.h" #include "Compiler.h" #include -using namespace std; CL4V2BEDispatchFunction::CL4V2BEDispatchFunction() { diff -ruN p2/l4/tool/dice/src/be/l4/v2/L4V2BEIPC.cpp p3/l4/tool/dice/src/be/l4/v2/L4V2BEIPC.cpp --- p2/l4/tool/dice/src/be/l4/v2/L4V2BEIPC.cpp 2006-10-03 16:51:22.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v2/L4V2BEIPC.cpp 2006-11-30 10:41:12.000000000 +0100 @@ -49,7 +49,6 @@ #include "Attribute-Type.h" #include -using namespace std; CL4V2BEIPC::CL4V2BEIPC() { diff -ruN p2/l4/tool/dice/src/be/l4/v2/L4V2BEMsgBuffer.cpp p3/l4/tool/dice/src/be/l4/v2/L4V2BEMsgBuffer.cpp --- p2/l4/tool/dice/src/be/l4/v2/L4V2BEMsgBuffer.cpp 2006-10-12 18:17:46.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v2/L4V2BEMsgBuffer.cpp 2006-11-30 10:41:13.000000000 +0100 @@ -38,7 +38,6 @@ #include "Compiler.h" #include "be/l4/TypeSpec-L4Types.h" #include -using namespace std; CL4V2BEMsgBuffer::CL4V2BEMsgBuffer() : CL4BEMsgBuffer() @@ -72,14 +71,15 @@ if (!CL4BEMsgBuffer::AddPlatformSpecificMembers(pFunction, pStruct, nDirection)) return false; - CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "%s(%s,, %d) called\n", __func__, - pFunction->GetName().c_str(), nDirection); + CCompiler::VerboseI(PROGRAM_VERBOSE_NORMAL, "%s(%s,, %d) called\n", + __func__, pFunction->GetName().c_str(), nDirection); // create receive flexpage CBETypedDeclarator *pFlexpage = GetFlexpageVariable(); if (!pFlexpage) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "%s: no flexpage member created\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "%s: no flexpage member created\n", __func__); return false; } // check if struct already has flexpage @@ -92,7 +92,8 @@ CBETypedDeclarator *pSizeDope = GetSizeDopeVariable(); if (!pSizeDope) { - CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "%s: no size dope created\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "%s: no size dope created\n", __func__); return false; } if (pStruct->m_Members.Find(pSizeDope->m_Declarators.First()->GetName())) @@ -104,7 +105,8 @@ CBETypedDeclarator *pSendDope = GetSendDopeVariable(); if (!pSendDope) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: no send dope created\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, + "%s: no send dope created\n", __func__); return false; } if (pStruct->m_Members.Find(pSendDope->m_Declarators.First()->GetName())) @@ -112,7 +114,7 @@ else pStruct->m_Members.Add(pSendDope); - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: returns true\n", __func__); + CCompiler::VerboseD(PROGRAM_VERBOSE_NORMAL, "%s: returns true\n", __func__); return true; } /** \brief return the offset where the payload starts @@ -243,7 +245,11 @@ CBETypedDeclarator *pParameter = pFunction->FindParameter( pMember->m_Declarators.First()->GetName()); - if (pParameter && pParameter->m_Attributes.Find(ATTR_PREALLOC)) + if (pParameter && ( + (pFile->IsOfFileType(FILETYPE_CLIENT) && + pParameter->m_Attributes.Find(ATTR_PREALLOC_CLIENT)) || + (pFile->IsOfFileType(FILETYPE_COMPONENT) && + pParameter->m_Attributes.Find(ATTR_PREALLOC_SERVER))) ) { *pFile << "\t"; WriteAccess(pFile, pFunction, nDirection, pMember); @@ -273,7 +279,6 @@ } } else if (pParameter->m_Attributes.Find(ATTR_STRING) && - pParameter->m_Attributes.Find(ATTR_PREALLOC) && pParameter->m_Attributes.Find(ATTR_MAX_IS) && pParameter->m_Attributes.Find(ATTR_OUT)) // WriteGetSize would write strlen, wich is not quite wha we want diff -ruN p2/l4/tool/dice/src/be/l4/v2/L4V2BESizes.cpp p3/l4/tool/dice/src/be/l4/v2/L4V2BESizes.cpp --- p2/l4/tool/dice/src/be/l4/v2/L4V2BESizes.cpp 2006-08-23 19:27:59.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v2/L4V2BESizes.cpp 2006-11-30 10:41:13.000000000 +0100 @@ -65,6 +65,9 @@ case TYPE_CHAR_ASTERISK: nSize = 1024; break; + case TYPE_MESSAGE: + nSize = (1 << 19) * GetSizeOfType(TYPE_MWORD); /* maximum of 2^19 dwords */ + break; default: break; } diff -ruN p2/l4/tool/dice/src/be/l4/v4/ia32/L4V4IA32ClassFactory.cpp p3/l4/tool/dice/src/be/l4/v4/ia32/L4V4IA32ClassFactory.cpp --- p2/l4/tool/dice/src/be/l4/v4/ia32/L4V4IA32ClassFactory.cpp 2006-08-23 19:28:00.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/ia32/L4V4IA32ClassFactory.cpp 2006-11-30 10:41:14.000000000 +0100 @@ -29,7 +29,6 @@ #include "be/l4/v4/ia32/L4V4IA32IPC.h" #include "Compiler.h" #include -using namespace std; CL4V4IA32ClassFactory::CL4V4IA32ClassFactory() : CL4V4BEClassFactory() diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BECallFunction.cpp p3/l4/tool/dice/src/be/l4/v4/L4V4BECallFunction.cpp --- p2/l4/tool/dice/src/be/l4/v4/L4V4BECallFunction.cpp 2006-08-23 19:27:59.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BECallFunction.cpp 2006-11-30 10:41:13.000000000 +0100 @@ -40,7 +40,6 @@ #include "Attribute-Type.h" #include "Compiler.h" #include -using namespace std; CL4V4BECallFunction::CL4V4BECallFunction() : CL4BECallFunction() @@ -58,7 +57,6 @@ */ void CL4V4BECallFunction::CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*) { // do not call direct base class (it adds the result var only) CBECallFunction::CreateBackEnd(pFEOperation); @@ -104,7 +102,7 @@ // set dopes CBEMsgBuffer *pMsgBuffer = GetMessageBuffer(); assert(pMsgBuffer); - pMsgBuffer->WriteInitialization(pFile, TYPE_MSGDOPE_SEND, + pMsgBuffer->WriteInitialization(pFile, this, TYPE_MSGDOPE_SEND, GetSendDirection()); // load the message into the UTCB *pFile << "\tL4_MsgLoad ( (L4_Msg_t*) &" << sMsgBuffer << " );\n"; diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BECallFunction.h p3/l4/tool/dice/src/be/l4/v4/L4V4BECallFunction.h --- p2/l4/tool/dice/src/be/l4/v4/L4V4BECallFunction.h 2006-06-28 16:02:34.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BECallFunction.h 2006-11-30 10:41:13.000000000 +0100 @@ -47,8 +47,7 @@ public: virtual int GetFixedSize(int nDirection); virtual int GetSize(int nDirection); - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); protected: virtual void WriteMarshalling(CBEFile * pFile); diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BEClassFactory.cpp p3/l4/tool/dice/src/be/l4/v4/L4V4BEClassFactory.cpp --- p2/l4/tool/dice/src/be/l4/v4/L4V4BEClassFactory.cpp 2006-08-23 19:27:59.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BEClassFactory.cpp 2006-11-30 10:41:13.000000000 +0100 @@ -41,7 +41,6 @@ #include "be/BEContext.h" #include "Compiler.h" #include -using namespace std; CL4V4BEClassFactory::CL4V4BEClassFactory() : CL4BEClassFactory() diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BEIPC.h p3/l4/tool/dice/src/be/l4/v4/L4V4BEIPC.h --- p2/l4/tool/dice/src/be/l4/v4/L4V4BEIPC.h 2006-08-08 13:20:08.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BEIPC.h 2006-11-30 10:41:13.000000000 +0100 @@ -48,7 +48,8 @@ public: virtual void WriteCall(CBEFile* pFile, CBEFunction* pFunction); virtual void WriteReceive(CBEFile* pFile, CBEFunction* pFunction); - virtual void WriteReplyAndWait(CBEFile* pFile, CBEFunction* pFunction, bool bSendFlexpage, bool bSendShortIPC); + virtual void WriteReplyAndWait(CBEFile* pFile, CBEFunction* pFunction, + bool bSendFlexpage, bool bSendShortIPC); virtual void WriteSend(CBEFile* pFile, CBEFunction* pFunction); virtual void WriteWait(CBEFile* pFile, CBEFunction* pFunction); virtual void WriteReply(CBEFile* pFile, CBEFunction* pFunction); diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BEMarshalFunction.cpp p3/l4/tool/dice/src/be/l4/v4/L4V4BEMarshalFunction.cpp --- p2/l4/tool/dice/src/be/l4/v4/L4V4BEMarshalFunction.cpp 2006-08-23 19:27:59.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BEMarshalFunction.cpp 2006-11-30 10:41:13.000000000 +0100 @@ -33,11 +33,11 @@ #include "be/BESizes.h" #include "be/BETrace.h" #include "be/BEMsgBuffer.h" +#include "be/BEClass.h" #include "Attribute-Type.h" #include "TypeSpec-L4V4Types.h" #include "Compiler.h" #include -using namespace std; CL4V4BEMarshalFunction::CL4V4BEMarshalFunction() : CL4BEMarshalFunction() @@ -79,9 +79,9 @@ // set exception in msgbuffer WriteMarshalException(pFile, true); // set dopes - CBEMsgBuffer *pMsgBuffer = GetMessageBuffer(); + CBEMsgBuffer *pMsgBuffer = m_pClass->GetMessageBuffer(); assert(pMsgBuffer); - pMsgBuffer->WriteInitialization(pFile, TYPE_MSGDOPE_SEND, + pMsgBuffer->WriteInitialization(pFile, this, TYPE_MSGDOPE_SEND, GetSendDirection()); if (bLocalTrace) diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BEMarshaller.cpp p3/l4/tool/dice/src/be/l4/v4/L4V4BEMarshaller.cpp --- p2/l4/tool/dice/src/be/l4/v4/L4V4BEMarshaller.cpp 2006-10-10 14:46:19.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BEMarshaller.cpp 2006-11-30 10:41:13.000000000 +0100 @@ -34,13 +34,14 @@ #include "be/BEStructType.h" #include "be/BEMsgBuffer.h" #include "be/BEClassFactory.h" +#include "be/l4/L4BENameFactory.h" #include "Compiler.h" #include "TypeSpec-Type.h" #include "Attribute-Type.h" #include "be/BEFile.h" #include +using std::ostringstream; #include -using namespace std; CL4V4BEMarshaller::CL4V4BEMarshaller() : CL4BEMarshaller() @@ -87,17 +88,25 @@ CL4V4BEMarshaller::MarshalRefstring(CBETypedDeclarator *pParameter, vector *pStack) { - if (!pParameter->m_Attributes.Find(ATTR_REF)) - return false; + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CL4BEMarshaller::%s called for %s\n", __func__, + pParameter->m_Declarators.First()->GetName().c_str()); CBEMsgBuffer *pMsgBuffer = GetMessageBuffer(m_pFunction); CBETypedDeclarator *pMember = FindMarshalMember(pStack); if (!pMember) { - TRACE("%s: could not find member for parameter %s\n", + CCompiler::Warning("%s: could not find member for parameter %s\n", __func__, pParameter->m_Declarators.First()->GetName().c_str()); } assert(pMember); + // check the member for the ref attribute, because we might have made some + // parameters to ref's after adding them to the message buffer + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CL4BEMarshaller::%s member with%s [ref] attribute\n", __func__, + pMember->m_Attributes.Find(ATTR_REF) ? "" : "out"); + if (!pMember->m_Attributes.Find(ATTR_REF)) + return false; CBEType *pType = pParameter->GetType(); // try to find respective member and assign if (m_bMarshal) @@ -128,13 +137,22 @@ WriteParameter(pParameter, pStack, true); *m_pFile << ") );\n"; } - else if (!pParameter->m_Attributes.Find(ATTR_PREALLOC)) + else if ( + !(pParameter->m_Attributes.Find(ATTR_PREALLOC_CLIENT) && + m_pFile->IsOfFileType(FILETYPE_CLIENT)) && + !(pParameter->m_Attributes.Find(ATTR_PREALLOC_SERVER) && + m_pFile->IsOfFileType(FILETYPE_COMPONENT)) ) { // only unmarshal refstrings if not preallocated, because preallocated // refstrings are already assigned to rcv_str. + // also: check if parameter is return parameter, because we cannot + // make a pointer from it. Instead, dereference the refstring. + bool bReturn = pParameter == m_pFunction->GetReturnVariable(); *m_pFile << "\t"; - WriteParameter(pParameter, pStack, true); + WriteParameter(pParameter, pStack, !bReturn); *m_pFile << " = "; + if (bReturn) + *m_pFile << "*"; // cast to type of parameter pType->WriteCast(m_pFile, true); // access message buffer @@ -205,19 +223,15 @@ pType->WriteCast(m_pFile, true); delete pType; - string sMsgBuf; - if (pMsgBuffer->m_Declarators.First()->GetStars() == 0) - sMsgBuf = "&"; - sMsgBuf += pMsgBuffer->m_Declarators.First()->GetName(); // access to the strings is done using the generic struct, the word member // using the size-dope's word count plus the index from above as index // into the word member and casting the result to a string dope. // // ((L4_Msg_t*))->msg[((L4_Msg_t*))->tag.X.u + nIndex] *m_pFile << "&( ((L4_Msg_t*)"; - pMsgBuffer->WriteAccessToVariable(m_pFile, m_pFunction); + pMsgBuffer->WriteAccessToVariable(m_pFile, m_pFunction, true); *m_pFile << ")->msg[((L4_Msg_t*)"; - pMsgBuffer->WriteAccessToVariable(m_pFile, m_pFunction); + pMsgBuffer->WriteAccessToVariable(m_pFile, m_pFunction, true); *m_pFile << ")->tag.X.u"; ostringstream os; os << nIndex; @@ -225,3 +239,31 @@ *m_pFile << " + " << os.str(); *m_pFile << "] ))"; } + +/** \brief test if zero flexpage and marshal if so + * \param pMember the parameter to marshal + * \return true if zero flexpage marshalled + */ +bool +CL4V4BEMarshaller::MarshalZeroFlexpage(CBETypedDeclarator *pMember) +{ + CBENameFactory *pNF = CCompiler::GetNameFactory(); + string sName = pNF->GetString(CL4BENameFactory::STR_ZERO_FPAGE); + if (!pMember->m_Declarators.Find(sName)) + return false; + + // get message buffer + CBEMsgBuffer *pMsgBuffer = pMember->GetSpecificParent(); + assert(pMsgBuffer); + + if (m_bMarshal) + { + // zero raw member + *m_pFile << "\t"; + WriteMember(m_pFunction->GetSendDirection(), pMsgBuffer, pMember, NULL); + *m_pFile << ".raw = 0;\n"; + } + + return true; +} + diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BEMarshaller.h p3/l4/tool/dice/src/be/l4/v4/L4V4BEMarshaller.h --- p2/l4/tool/dice/src/be/l4/v4/L4V4BEMarshaller.h 2006-08-08 13:20:08.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BEMarshaller.h 2006-11-30 10:41:13.000000000 +0100 @@ -50,6 +50,9 @@ vector *pStack); virtual void WriteRefstringCastMember(int nDir, CBEMsgBuffer *pMsgBuffer, CBETypedDeclarator *pMember); + +protected: + virtual bool MarshalZeroFlexpage(CBETypedDeclarator *pMember); }; diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BEMsgBuffer.cpp p3/l4/tool/dice/src/be/l4/v4/L4V4BEMsgBuffer.cpp --- p2/l4/tool/dice/src/be/l4/v4/L4V4BEMsgBuffer.cpp 2006-08-23 19:27:59.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BEMsgBuffer.cpp 2006-11-30 10:41:13.000000000 +0100 @@ -33,11 +33,13 @@ #include "be/BESizes.h" #include "be/BEClass.h" #include "be/BEContext.h" +#include "be/BEUserDefinedType.h" +#include "be/BEMsgBufferType.h" +#include "fe/FEOperation.h" #include "Compiler.h" #include "TypeSpec-L4V4Types.h" #include "Attribute-Type.h" #include -using namespace std; CL4V4BEMsgBuffer::CL4V4BEMsgBuffer() : CL4BEMsgBuffer() @@ -91,7 +93,8 @@ bool CL4V4BEMsgBuffer::Sort(CBEStructType *pStruct) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called for struct\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s called for struct\n", __func__); // sort payload if (!CL4BEMsgBuffer::Sort(pStruct)) @@ -108,18 +111,21 @@ /** \brief writes the initialization of specific members * \param pFile the file to write to + * \param pFunction the function to write for * \param nType the type of the members to initialize * \param nDirection the direction of the struct to initialize */ void CL4V4BEMsgBuffer::WriteInitialization(CBEFile *pFile, - int nType, - int nDirection) + CBEFunction *pFunction, + int nType, + int nDirection) { if (nType != TYPE_MSGDOPE_SEND && nType != TYPE_MSGDOPE_SIZE) { - CL4BEMsgBuffer::WriteInitialization(pFile, nType, nDirection); + CL4BEMsgBuffer::WriteInitialization(pFile, pFunction, nType, + nDirection); return; } @@ -127,10 +133,8 @@ if (nType == TYPE_MSGDOPE_SIZE) return; - CBEFunction *pFunction = GetSpecificParent(); - DTRACE("%s for func %s and dir %d\n", __func__, - pFunction ? pFunction->GetName().c_str() : "(no func)", - nDirection); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s for func %s and dir %d\n", + __func__, pFunction ? pFunction->GetName().c_str() : "(no func)", nDirection); // if direction is 0 we have to get maximum of IN and OUT int nWords = 0; @@ -142,53 +146,79 @@ { int nWordsIn = CBEMsgBuffer::GetMemberSize(TYPE_MWORD, pFunction, DIRECTION_IN, false); - DTRACE("%s words in: %d\n", __func__, nWordsIn); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s words in: %d\n", __func__, + nWordsIn); + if (nWordsIn < 0) nWordsIn = CBEMsgBuffer::GetMemberSize(TYPE_MWORD, pFunction, DIRECTION_IN, true); - DTRACE("%s words in: %d\n", __func__, nWordsIn); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s words in: %d\n", __func__, + nWordsIn); + int nWordsOut = CBEMsgBuffer::GetMemberSize(TYPE_MWORD, pFunction, DIRECTION_OUT, false); - DTRACE("%s words out: %d\n", __func__, nWordsOut); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s words out: %d\n", __func__, + nWordsOut); + if (nWordsOut < 0) nWordsOut = CBEMsgBuffer::GetMemberSize(TYPE_MWORD, pFunction, DIRECTION_OUT, true); - DTRACE("%s words out: %d\n", __func__, nWordsOut); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s words out: %d\n", __func__, + nWordsOut); // for generic struct we also have to subtract the strings from the // word count, because the strings have been counted when counting // TYPE_MWORD as well. int nStringsIn = CBEMsgBuffer::GetMemberSize(TYPE_REFSTRING, pFunction, DIRECTION_IN, false); - DTRACE("%s strings in: %d\n", __func__, nStringsIn); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s strings in: %d\n", __func__, + nStringsIn); + int nStringsOut = CBEMsgBuffer::GetMemberSize(TYPE_REFSTRING, pFunction, DIRECTION_OUT, false); - DTRACE("%s strings out: %d\n", __func__, nStringsOut); - nStrings = max(nStringsIn, nStringsOut); - DTRACE("%s strings: %d\n", __func__, nStrings); - - DTRACE("%s words in: %d words out: %d\n", __func__, nWordsIn, - nWordsOut); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s strings out: %d\n", __func__, + nStringsOut); + + nStrings = std::max(nStringsIn, nStringsOut); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s strings: %d\n", __func__, + nStrings); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s words in: %d words out: %d\n", + __func__, nWordsIn, nWordsOut); + if (nWordsIn >= 0 && nWordsOut >= 0) - nWords = max(nWordsIn, nWordsOut); + nWords = std::max(nWordsIn, nWordsOut); else nWords = (nWordsIn < nWordsOut) ? nWordsIn : nWordsOut; - DTRACE("%s words: %d\n", __func__, nWords); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s words: %d\n", __func__, nWords); } else { nWords = CBEMsgBuffer::GetMemberSize(TYPE_MWORD, pFunction, nDirection, false); - DTRACE("%s words: %d\n", __func__, nWords); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s words: %d\n", __func__, nWords); + nStrings = CBEMsgBuffer::GetMemberSize(TYPE_REFSTRING, pFunction, nDirection, false); - DTRACE("%s strings: %d\n", __func__, nStrings); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s strings: %d\n", __func__, + nStrings); } // check minimum number of words int nMinWords = GetWordMemberCountFunction(); if (nWords >= 0) - nWords = max(nWords, nMinWords); - DTRACE("%s words (min): %d\n", __func__, nWords); + nWords = std::max(nWords, nMinWords); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "%s words (min): %d\n", __func__, + nWords); // get name of member CBENameFactory *pNF = CCompiler::GetNameFactory(); @@ -292,7 +322,7 @@ int CL4V4BEMsgBuffer::GetPayloadOffset() { - DTRACE("%s called\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); CBESizes *pSizes = CCompiler::GetSizes(); return pSizes->GetSizeOfType(TYPE_MSGTAG); } @@ -435,6 +465,30 @@ return false; } + +/** \brief write the initialization of refstring + * \param pFile the file to write to + * \param nDirection the direction to write for + * \return true if we actually wrote for + * + * Here, we call the base class to write the refstring initialization, but + * have to set the "we want to receive refstrings" bit afterwards. + */ +bool +CL4V4BEMsgBuffer::WriteRefstringInitialization(CBEFile *pFile, + int nDirection) +{ + bool bRefstring = CL4BEMsgBuffer::WriteRefstringInitialization(pFile, nDirection); + if (bRefstring) + { + CBEFunction *pFunction = GetSpecificParent(); + if (!pFunction) + return false; + *pFile << "\tL4_Accept (L4_StringItemsAcceptor);\n"; + } + return bRefstring; +} + /** \brief writes the refstring member init for given parameter * \param pFile the file to write to * \param pFunction the function to write for @@ -453,11 +507,15 @@ CBETypedDeclarator *pParameter = pFunction->FindParameter( pMember->m_Declarators.First()->GetName()); - if (pParameter && pParameter->m_Attributes.Find(ATTR_PREALLOC)) + if (pParameter && ( + (pFile->IsOfFileType(FILETYPE_CLIENT) && + pParameter->m_Attributes.Find(ATTR_PREALLOC_CLIENT)) || + (pFile->IsOfFileType(FILETYPE_COMPONENT) && + pParameter->m_Attributes.Find(ATTR_PREALLOC_SERVER))) ) { *pFile << "\t"; WriteAccess(pFile, pFunction, nDirection, pMember); - *pFile << " = L4_StringItem ("; + *pFile << " = L4_StringItem /* " << __func__ << " */ ("; // size CBEType *pType = pParameter->GetType(); if ((pParameter->m_Attributes.Find(ATTR_SIZE_IS)) || @@ -525,13 +583,160 @@ void CL4V4BEMsgBuffer::PostCreate(CBEFunction *pFunction, CFEOperation *pFEOperation) - throw (CBECreateException*) { + CBEStructType *pStruct = GetStruct(DIRECTION_IN); + assert(pStruct); + CheckConvertStruct(pStruct); + pStruct = GetStruct(DIRECTION_OUT); + assert(pStruct); + CheckConvertStruct(pStruct); + + int nMaxSize = CCompiler::GetSizes()->GetMaxSizeOfType(TYPE_MESSAGE); + int nSize = 0; + GetMaxSize(true, nSize); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "Check size: %d <= %d?\n", + nSize, nMaxSize); + assert(nSize <= nMaxSize); // call base class CL4BEMsgBuffer::PostCreate(pFunction, pFEOperation); } +/** \brief check whether a member of the specified struct has to be converted + * \param pStruct the struct to check for convertable members + */ +void +CL4V4BEMsgBuffer::CheckConvertStruct(CBEStructType *pStruct) +{ + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "CL4V4BEMsgBuffer::%s(%p) called\n", + __func__, pStruct); + + CBEUserDefinedType *pUsrType = dynamic_cast(GetType()); + CBEMsgBufferType *pMsgType = 0; + if (pUsrType) + pMsgType = dynamic_cast(pUsrType->GetRealType()); + else + pMsgType = dynamic_cast(GetType()); + assert(pMsgType); + + int nMaxSize = CCompiler::GetSizes()->GetMaxSizeOfType(TYPE_MESSAGE); + int nSize = 0; + GetMaxSize(true, nSize); + bool bConverted = true; + + while ((nSize > nMaxSize) && bConverted) + { + // iterate members and try to find variable sized member for IN struct + CBETypedDeclarator *pMember; + bConverted = false; + + if ((pMember = CheckConvertMember(pStruct, + pMsgType->GetStartOfPayload(pStruct)))) + { + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CL4V4BEMsgBuffer::%s Convert member %s\n", __func__, + pMember->m_Declarators.First()->GetName().c_str()); + ConvertMember(pMember); + bConverted = true; + } + + GetMaxSize(true, nSize); + } + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "CL4V4BEMsgBuffer::%s finished\n", + __func__); +} + +/** \brief check if members of the struct can be converted. + * \param pStruct struct to check + * \param iter the iterator to start the search at + * \return the member to convert + */ +CBETypedDeclarator* +CL4V4BEMsgBuffer::CheckConvertMember(CBEStructType *pStruct, + vector::iterator iter) +{ + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "CL4V4BEMsgBuffer::%s called\n", + __func__); + + int nMaxSize = CCompiler::GetSizes()->GetMaxSizeOfType(TYPE_MESSAGE); + CBETypedDeclarator *pBiggestMember = 0; + for (; iter != pStruct->m_Members.end(); iter++) + { + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CL4V4BEMsgBuffer::%s checking %s (size: %d, max: %d)\n", __func__, + (*iter)->m_Declarators.First()->GetName().c_str(), + (*iter)->GetSize(), nMaxSize); + // if the member itself is bigger than the message size then it should + // be converted + if ((*iter)->GetSize() > nMaxSize) + return *iter; + // if member is variable sized then it should be converted + if ((*iter)->GetSize() < 0) + return *iter; + // try to find biggest member. + if (pBiggestMember && (pBiggestMember->GetSize() < (*iter)->GetSize())) + pBiggestMember = *iter; + if (!pBiggestMember) + pBiggestMember = *iter; + } + if (pBiggestMember && (pBiggestMember->GetSize() > + CCompiler::GetSizes()->GetSizeOfType(TYPE_REFSTRING))) + { + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CL4V4BEMsgBuffer::%s biggest member is %s\n", __func__, + pBiggestMember->m_Declarators.First()->GetName().c_str()); + return pBiggestMember; + } + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "CL4V4BEMsgBuffer::%s nothing found\n", + __func__); + return 0; +} + +/** \brief convert the member into an indirect part + * \param pStruct the struct, the member belongs to + * \param pMember the member to convert + * + * We make a refstring parameter out of the member + */ +void +CL4V4BEMsgBuffer::ConvertMember(CBETypedDeclarator* pMember) +{ + CBEClassFactory *pCF = CCompiler::GetClassFactory(); + CBEType *pType = pCF->GetNewType(TYPE_REFSTRING); + pType->CreateBackEnd(true, 0, TYPE_REFSTRING); + pMember->ReplaceType(pType); + // set the pointer of the declarator to zero + CBEDeclarator *pDecl = pMember->m_Declarators.First(); + pDecl->SetStars(0); + // check for array dimensions and remove if necessary + if (pDecl->IsArray()) + { + // replace array dimensions with max-is attribute + if (!pMember->m_Attributes.Find(ATTR_MAX_IS)) + { + CBEAttribute *pAttr = pCF->GetNewAttribute(); + pMember->m_Attributes.Add(pAttr); + int nSize = 0; + pMember->GetMaxSize(true, nSize); + pAttr->CreateBackEndInt(ATTR_MAX_IS, nSize); + } + // remove array dimensions + while (!pDecl->m_Bounds.empty()) + pDecl->RemoveArrayBound(*(pDecl->m_Bounds.begin())); + } + // add the ref attribute to catch all tests + CBEAttribute *pAttr = pCF->GetNewAttribute(); + pMember->m_Attributes.Add(pAttr); + pAttr->CreateBackEnd(ATTR_REF); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CL4V4BEMsgBuffer::%s added [ref] to member %s (%p)\n", __func__, + pMember->m_Declarators.First()->GetName().c_str(), pMember); + // add C language property to avoid const qualifier in struct + pMember->AddLanguageProperty(string("noconst"), string()); +} + /** \brief the post-create (and post-sort) step during creation * \param pClass the class owning this message buffer * \param pFEInterface the front-end reference interface @@ -548,9 +753,55 @@ void CL4V4BEMsgBuffer::PostCreate(CBEClass *pClass, CFEInterface *pFEInterface) - throw (CBECreateException*) { + assert(pClass); + + CCompiler::SetDebug(); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CL4V4BEMsgBuffer::%s(class %s) called\n", __func__, + pClass->GetName().c_str()); + + CBEUserDefinedType *pUsrType = dynamic_cast(GetType()); + CBEMsgBufferType *pMsgType = 0; + if (pUsrType) + pMsgType = dynamic_cast(pUsrType->GetRealType()); + else + pMsgType = dynamic_cast(GetType()); + assert(pMsgType); + // iterate the structures and test each + string sClassName = pClass->GetName(); + vector::iterator i; + for (i = pClass->m_FunctionGroups.begin(); + i != pClass->m_FunctionGroups.end(); + i++) + { + string sFuncName = (*i)->GetName(); + if (!(*i)->GetOperation()->m_Attributes.Find(ATTR_OUT)) + { + CBEStructType *pStruct = pMsgType->GetStruct(sFuncName, sClassName, + DIRECTION_IN); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CL4V4BEMsgBuffer::%s struct for (%s, %s, IN) at %p\n", __func__, + sFuncName.c_str(), sClassName.c_str(), pStruct); + assert(pStruct); + CheckConvertStruct(pStruct); + } + if (!(*i)->GetOperation()->m_Attributes.Find(ATTR_IN)) + { + CBEStructType *pStruct = pMsgType->GetStruct(sFuncName, sClassName, + DIRECTION_OUT); + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, + "CL4V4BEMsgBuffer::%s struct for (%s, %s, OUT) at %p\n", __func__, + sFuncName.c_str(), sClassName.c_str(), pStruct); + assert(pStruct); + CheckConvertStruct(pStruct); + } + } // call base class CL4BEMsgBuffer::PostCreate(pClass, pFEInterface); + + CCompiler::Verbose(PROGRAM_VERBOSE_DEBUG, "CL4V4BEMsgBuffer::%s finished\n", + __func__); + CCompiler::SetDebug(false); } diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BEMsgBuffer.h p3/l4/tool/dice/src/be/l4/v4/L4V4BEMsgBuffer.h --- p2/l4/tool/dice/src/be/l4/v4/L4V4BEMsgBuffer.h 2006-08-04 18:17:18.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BEMsgBuffer.h 2006-11-30 10:41:13.000000000 +0100 @@ -55,18 +55,18 @@ virtual int GetPayloadOffset(); virtual bool Sort(CBEStructType *pStruct); - virtual void PostCreate(CBEClass *pClass, CFEInterface *pFEInterface) - throw (CBECreateException*); - virtual void PostCreate(CBEFunction *pFunction, CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void PostCreate(CBEClass *pClass, CFEInterface *pFEInterface); + virtual void PostCreate(CBEFunction *pFunction, CFEOperation *pFEOperation); - virtual void WriteInitialization(CBEFile *pFile, int nType, int nDirection); + virtual void WriteInitialization(CBEFile *pFile, CBEFunction *pFunction, + int nType, int nDirection); protected: virtual bool AddPlatformSpecificMembers(CBEFunction *pFunction, CBEStructType *pStruct, int nDirection); virtual void WriteRcvFlexpageInitialization(CBEFile *pFile, int nDirection); + virtual bool WriteRefstringInitialization(CBEFile *pFile, int nDirection); virtual void WriteRefstringInitParameter(CBEFile *pFile, CBEFunction *pFunction, CBETypedDeclarator *pMember, int nIndex, int nDirection); @@ -79,6 +79,10 @@ CBEStructType *pStruct, int nDirection); CBETypedDeclarator* GetMsgTagVariable(void); + virtual void CheckConvertStruct(CBEStructType *pStruct); + virtual CBETypedDeclarator* CheckConvertMember(CBEStructType *pStruct, + vector::iterator iter); + virtual void ConvertMember(CBETypedDeclarator* pMember); }; #endif diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BENameFactory.cpp p3/l4/tool/dice/src/be/l4/v4/L4V4BENameFactory.cpp --- p2/l4/tool/dice/src/be/l4/v4/L4V4BENameFactory.cpp 2006-08-23 19:27:59.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BENameFactory.cpp 2006-11-30 10:41:14.000000000 +0100 @@ -31,7 +31,6 @@ #include "TypeSpec-L4V4Types.h" #include "Compiler.h" #include -using namespace std; CL4V4BENameFactory::CL4V4BENameFactory() : CL4BENameFactory() diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BESizes.cpp p3/l4/tool/dice/src/be/l4/v4/L4V4BESizes.cpp --- p2/l4/tool/dice/src/be/l4/v4/L4V4BESizes.cpp 2006-08-23 19:27:59.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BESizes.cpp 2006-11-30 10:41:14.000000000 +0100 @@ -78,3 +78,21 @@ return nSize; } +/** \brief returns a value for the maximum size of a specific type + * \param nFEType the type to get the max size for + * \return the maximum size of an array of that type + */ +int CL4V4BESizes::GetMaxSizeOfType(int nFEType) +{ + int nSize = CBESizes::GetMaxSizeOfType(nFEType); + switch (nFEType) + { + case TYPE_MESSAGE: + nSize = 64 * GetSizeOfType(TYPE_MWORD); /* maximum of 2^19 dwords */ + break; + default: + break; + } + return nSize; +} + diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BESizes.h p3/l4/tool/dice/src/be/l4/v4/L4V4BESizes.h --- p2/l4/tool/dice/src/be/l4/v4/L4V4BESizes.h 2006-08-08 13:20:08.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BESizes.h 2006-11-30 10:41:14.000000000 +0100 @@ -46,6 +46,7 @@ public: virtual int GetMaxShortIPCSize(void); virtual int GetSizeOfType(int nFEType, int nFESize = 0); + virtual int GetMaxSizeOfType(int nFEType); }; #endif diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BESndFunction.cpp p3/l4/tool/dice/src/be/l4/v4/L4V4BESndFunction.cpp --- p2/l4/tool/dice/src/be/l4/v4/L4V4BESndFunction.cpp 2006-08-23 19:27:59.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BESndFunction.cpp 2006-11-30 10:41:14.000000000 +0100 @@ -40,7 +40,6 @@ #include "Attribute-Type.h" #include "Compiler.h" #include -using namespace std; CL4V4BESndFunction::CL4V4BESndFunction() : CL4BESndFunction() @@ -58,7 +57,6 @@ */ void CL4V4BESndFunction::CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*) { // do not call direct base class (it adds the result var only) CBESndFunction::CreateBackEnd(pFEOperation); @@ -104,7 +102,7 @@ // set dopes CBEMsgBuffer *pMsgBuffer = GetMessageBuffer(); assert(pMsgBuffer); - pMsgBuffer->WriteInitialization(pFile, TYPE_MSGDOPE_SEND, + pMsgBuffer->WriteInitialization(pFile, this, TYPE_MSGDOPE_SEND, GetSendDirection()); // load the message into the UTCB *pFile << "\tL4_MsgLoad ( (L4_Msg_t*) &" << sMsgBuffer << " );\n"; diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BESndFunction.h p3/l4/tool/dice/src/be/l4/v4/L4V4BESndFunction.h --- p2/l4/tool/dice/src/be/l4/v4/L4V4BESndFunction.h 2006-06-28 16:02:34.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BESndFunction.h 2006-11-30 10:41:14.000000000 +0100 @@ -47,8 +47,7 @@ public: virtual int GetFixedSize(int nDirection); virtual int GetSize(int nDirection); - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); protected: virtual void WriteMarshalling(CBEFile * pFile); diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BETrace.cpp p3/l4/tool/dice/src/be/l4/v4/L4V4BETrace.cpp --- p2/l4/tool/dice/src/be/l4/v4/L4V4BETrace.cpp 2006-10-10 14:46:19.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BETrace.cpp 2006-11-30 10:41:14.000000000 +0100 @@ -36,7 +36,6 @@ #include "Compiler.h" #include "TypeSpec-Type.h" #include -using namespace std; CL4V4BETrace::CL4V4BETrace() { @@ -104,7 +103,7 @@ { string sMWord = pNF->GetTypeName(TYPE_MWORD, false, 0); *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": server %%lX (mr0 %%08lx)\\n\", " << pObjName->GetName() << + ": server %lX (mr0 %08lx)\\n\", " << pObjName->GetName() << "->raw, "; pMsgBuffer->WriteAccessToStruct(pFile, pFunction, pFunction->GetSendDirection()); @@ -150,7 +149,7 @@ *pFile << "\tif (L4_IpcFailed (" << sMsgTag << "))\n"; pFile->IncIndent(); *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": IPC error: %%lx in %%s\\n\", L4_ErrorCode () >> 1, " << + ": IPC error: %lx in %s\\n\", L4_ErrorCode () >> 1, " << "(L4_ErrorCode() & 1) ? \"receive\" : \"send\");\n"; pFile->DecIndent(); } @@ -185,13 +184,13 @@ int nDirection = pFunction->GetReceiveDirection(); *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": opcode %%lx received from %%lX\\n\",\n"; + ": opcode %lx received from %lX\\n\",\n"; pFile->IncIndent(); *pFile << "\t" << sOpcodeVar << ",\n"; *pFile << "\t" << sObjectVar << "->raw);\n"; pFile->DecIndent(); *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": received %%d untyped and %%d typed elements\\n\",\n"; + ": received %d untyped and %d typed elements\\n\",\n"; pFile->IncIndent(); *pFile << "\t"; // this writes access to the word members @@ -227,7 +226,7 @@ pCF->GetNewMarshaller()); *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": reply %%s (dw0=%%lx, dw1=%%lx)\\n\",\n"; + ": reply %s (dw0=%lx, dw1=%lx)\\n\",\n"; pFile->IncIndent(); *pFile << "\t(" << sReply << "==DICE_REPLY) ?\n"; @@ -258,7 +257,7 @@ string sFunc = CCompiler::GetTraceServerFunc(); *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": IPC error: %%lx\\n\", L4_ErrorCode ());\n"; + ": IPC error: %lx\\n\", L4_ErrorCode ());\n"; } /** \brief write the tracing the code before reply IPC @@ -282,7 +281,7 @@ string sFunc = CCompiler::GetTraceServerFunc(); *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": send reply to %%lX (label %%08lx)\\n\", " << sObjectVar << + ": send reply to %lX (label %08lx)\\n\", " << sObjectVar << "->raw, "; pMsgBuffer->WriteAccessToStruct(pFile, pFunction, 0); *pFile << "." << sMsgTag << ".raw);\n"; @@ -307,13 +306,13 @@ string sFunc = CCompiler::GetTraceServerFunc(); *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": received request from %%lX (mr0 %%08lx)\\n\", " << sObjectVar << + ": received request from %lX (mr0 %08lx)\\n\", " << sObjectVar << "->raw, " << sMsgTag << ".raw);\n"; *pFile << "\tif (L4_IpcFailed (" << sMsgTag << "))\n"; pFile->IncIndent(); *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": IPC error: %%lx\\n\", L4_ErrorCode ());\n"; + ": IPC error: %lx\\n\", L4_ErrorCode ());\n"; pFile->DecIndent(); *pFile << "\tif (" << sMsgTag << ".X.flags & 1)\n"; @@ -321,7 +320,7 @@ pFile->IncIndent(); *pFile << "\tL4_ThreadId_t _id = L4_ActualSender();\n"; *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": propagated, actual sender %%lX\\n\", _id.raw);\n"; + ": propagated, actual sender %lX\\n\", _id.raw);\n"; pFile->DecIndent(); *pFile << "\t}\n"; } diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BEWaitAnyFunction.cpp p3/l4/tool/dice/src/be/l4/v4/L4V4BEWaitAnyFunction.cpp --- p2/l4/tool/dice/src/be/l4/v4/L4V4BEWaitAnyFunction.cpp 2006-08-23 19:27:59.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BEWaitAnyFunction.cpp 2006-11-30 10:41:14.000000000 +0100 @@ -39,7 +39,6 @@ #include "Attribute-Type.h" #include "Compiler.h" #include -using namespace std; CL4V4BEWaitAnyFunction::CL4V4BEWaitAnyFunction(bool bOpenWait, bool bReply) : CL4BEWaitAnyFunction(bOpenWait, bReply) @@ -211,7 +210,6 @@ */ void CL4V4BEWaitAnyFunction::CreateBackEnd(CFEInterface *pFEInterface) -throw (CBECreateException*) { CBEWaitAnyFunction::CreateBackEnd(pFEInterface); diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BEWaitAnyFunction.h p3/l4/tool/dice/src/be/l4/v4/L4V4BEWaitAnyFunction.h --- p2/l4/tool/dice/src/be/l4/v4/L4V4BEWaitAnyFunction.h 2006-06-14 14:25:09.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BEWaitAnyFunction.h 2006-11-30 10:41:14.000000000 +0100 @@ -48,8 +48,7 @@ virtual void WriteIPCReplyWait(CBEFile *pFile); virtual void WriteUnmarshalling(CBEFile *pFile); virtual void WriteIPCErrorCheck(CBEFile *pFile); - virtual void CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEInterface *pFEInterface); }; #endif diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BEWaitFunction.cpp p3/l4/tool/dice/src/be/l4/v4/L4V4BEWaitFunction.cpp --- p2/l4/tool/dice/src/be/l4/v4/L4V4BEWaitFunction.cpp 2006-08-23 19:27:59.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BEWaitFunction.cpp 2006-11-30 10:41:14.000000000 +0100 @@ -56,7 +56,6 @@ */ void CL4V4BEWaitFunction::CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*) { // do not call direct base class (it adds the result var only) CBEWaitFunction::CreateBackEnd(pFEOperation); diff -ruN p2/l4/tool/dice/src/be/l4/v4/L4V4BEWaitFunction.h p3/l4/tool/dice/src/be/l4/v4/L4V4BEWaitFunction.h --- p2/l4/tool/dice/src/be/l4/v4/L4V4BEWaitFunction.h 2006-06-28 16:02:34.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/v4/L4V4BEWaitFunction.h 2006-11-30 10:41:14.000000000 +0100 @@ -47,8 +47,7 @@ public: virtual int GetFixedSize(int nDirection); virtual int GetSize(int nDirection); - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); protected: virtual void WriteUnmarshalling(CBEFile * pFile); diff -ruN p2/l4/tool/dice/src/be/l4/x0/L4X0BEClassFactory.cpp p3/l4/tool/dice/src/be/l4/x0/L4X0BEClassFactory.cpp --- p2/l4/tool/dice/src/be/l4/x0/L4X0BEClassFactory.cpp 2006-08-23 19:28:00.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/x0/L4X0BEClassFactory.cpp 2006-11-30 10:41:14.000000000 +0100 @@ -27,7 +27,6 @@ */ #include "L4X0BEClassFactory.h" -#include "L4X0BEWaitAnyFunction.h" #include "L4X0BEDispatchFunction.h" #include "L4X0BEMsgBuffer.h" #include "L4X0BESizes.h" @@ -36,7 +35,6 @@ #include "be/BEContext.h" #include "Compiler.h" #include -using namespace std; CL4X0BEClassFactory::CL4X0BEClassFactory() : CL4BEClassFactory() @@ -53,46 +51,18 @@ */ CBESizes * CL4X0BEClassFactory::GetNewSizes() { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CL4X0BEClassFactory: created class CL4X0BESizes\n"); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CL4X0BEClassFactory: created class CL4X0BESizes\n"); return new CL4X0BESizes(); } -/** \brief creates a new instance of the class CBERcvAnyFunction - * \return a reference to the new instance - */ -CBEWaitAnyFunction * CL4X0BEClassFactory::GetNewRcvAnyFunction() -{ - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, - "CL4X0BEClassFactory: created class CL4X0BERcvAnyFunction\n"); - return new CL4X0BEWaitAnyFunction(false, false); -} - -/** \brief creates a new instance of the class CBEReplyAnyWaitAnyFunction - * \return a reference to the new instance - */ -CBEWaitAnyFunction * CL4X0BEClassFactory::GetNewReplyAnyWaitAnyFunction() -{ - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, - "CL4X0BEClassFactory: created class CL4X0BEReplyAnyWaitAnyFunction\n"); - return new CL4X0BEWaitAnyFunction(true, true); -} - -/** \brief creates a new instance of the class CBEWaitAnyFunction - * \return a reference to the new instance - */ -CBEWaitAnyFunction * CL4X0BEClassFactory::GetNewWaitAnyFunction() -{ - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, - "CL4X0BEClassFactory: created class CL4X0BEWaitAnyFunction\n"); - return new CL4X0BEWaitAnyFunction(true, false); -} - /** \brief creates a new instance of the class CBETrace * \return a reference to the new instance */ CBETrace* CL4X0BEClassFactory::GetNewTrace() { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CL4X0BEClassFactory: created class CL4X0BETrace\n"); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CL4X0BEClassFactory: created class CL4X0BETrace\n"); return new CL4X0BETrace(); } @@ -120,7 +90,8 @@ */ CBEMsgBuffer* CL4X0BEClassFactory::GetNewMessageBuffer() { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "CL4X0BEClassFactory: created class CL4X0BEMsgBuffer\n"); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "CL4X0BEClassFactory: created class CL4X0BEMsgBuffer\n"); return new CL4X0BEMsgBuffer(); } diff -ruN p2/l4/tool/dice/src/be/l4/x0/L4X0BEClassFactory.h p3/l4/tool/dice/src/be/l4/x0/L4X0BEClassFactory.h --- p2/l4/tool/dice/src/be/l4/x0/L4X0BEClassFactory.h 2006-08-04 17:12:27.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/x0/L4X0BEClassFactory.h 2006-11-30 10:41:14.000000000 +0100 @@ -51,9 +51,6 @@ public: // Public methods virtual CBESizes * GetNewSizes(); - virtual CBEWaitAnyFunction * GetNewWaitAnyFunction(); - virtual CBEWaitAnyFunction * GetNewReplyAnyWaitAnyFunction(); - virtual CBEWaitAnyFunction * GetNewRcvAnyFunction(); virtual CBETrace* GetNewTrace(); virtual CBECommunication* GetNewCommunication(); virtual CBEMsgBuffer* GetNewMessageBuffer(); diff -ruN p2/l4/tool/dice/src/be/l4/x0/L4X0BEDispatchFunction.cpp p3/l4/tool/dice/src/be/l4/x0/L4X0BEDispatchFunction.cpp --- p2/l4/tool/dice/src/be/l4/x0/L4X0BEDispatchFunction.cpp 2006-08-04 17:12:27.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/x0/L4X0BEDispatchFunction.cpp 2006-11-30 10:41:14.000000000 +0100 @@ -30,7 +30,6 @@ #include "be/l4/TypeSpec-L4Types.h" #include "Compiler.h" #include -using namespace std; CL4X0BEDispatchFunction::CL4X0BEDispatchFunction() { diff -ruN p2/l4/tool/dice/src/be/l4/x0/L4X0BEIPC.cpp p3/l4/tool/dice/src/be/l4/x0/L4X0BEIPC.cpp --- p2/l4/tool/dice/src/be/l4/x0/L4X0BEIPC.cpp 2006-08-23 19:28:00.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/x0/L4X0BEIPC.cpp 2006-11-30 10:41:14.000000000 +0100 @@ -44,7 +44,6 @@ #include "TypeSpec-Type.h" #include "Compiler.h" #include -using namespace std; CL4X0BEIPC::CL4X0BEIPC() : CL4BEIPC() diff -ruN p2/l4/tool/dice/src/be/l4/x0/L4X0BEMsgBuffer.cpp p3/l4/tool/dice/src/be/l4/x0/L4X0BEMsgBuffer.cpp --- p2/l4/tool/dice/src/be/l4/x0/L4X0BEMsgBuffer.cpp 2006-10-10 14:46:19.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/x0/L4X0BEMsgBuffer.cpp 2006-11-30 10:41:14.000000000 +0100 @@ -38,7 +38,6 @@ #include "Compiler.h" #include "be/l4/TypeSpec-L4Types.h" #include -using namespace std; CL4X0BEMsgBuffer::CL4X0BEMsgBuffer() : CL4BEMsgBuffer() @@ -231,7 +230,11 @@ CBETypedDeclarator *pParameter = pFunction->FindParameter( pMember->m_Declarators.First()->GetName()); - if (pParameter && pParameter->m_Attributes.Find(ATTR_PREALLOC)) + if (pParameter && ( + (pFile->IsOfFileType(FILETYPE_CLIENT) && + pParameter->m_Attributes.Find(ATTR_PREALLOC_CLIENT)) || + (pFile->IsOfFileType(FILETYPE_COMPONENT) && + pParameter->m_Attributes.Find(ATTR_PREALLOC_SERVER))) ) { *pFile << "\t"; WriteAccess(pFile, pFunction, nDirection, pMember); diff -ruN p2/l4/tool/dice/src/be/l4/x0/L4X0BESizes.cpp p3/l4/tool/dice/src/be/l4/x0/L4X0BESizes.cpp --- p2/l4/tool/dice/src/be/l4/x0/L4X0BESizes.cpp 2006-08-08 13:20:08.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/x0/L4X0BESizes.cpp 2006-11-30 10:41:14.000000000 +0100 @@ -28,7 +28,6 @@ #include "be/l4/x0/L4X0BESizes.h" #include "be/l4/TypeSpec-L4Types.h" #include -using namespace std; CL4X0BESizes::CL4X0BESizes() : CL4BESizes() @@ -75,3 +74,21 @@ } return nSize; } + +/** \brief returns a value for the maximum size of a specific type + * \param nFEType the type to get the max size for + * \return the maximum size of an array of that type + */ +int CL4X0BESizes::GetMaxSizeOfType(int nFEType) +{ + int nSize = CBESizes::GetMaxSizeOfType(nFEType); + switch (nFEType) + { + case TYPE_MESSAGE: + nSize = (1 << 19) * GetSizeOfType(TYPE_MWORD); /* maximum of 2^19 dwords */ + break; + default: + break; + } + return nSize; +} diff -ruN p2/l4/tool/dice/src/be/l4/x0/L4X0BESizes.h p3/l4/tool/dice/src/be/l4/x0/L4X0BESizes.h --- p2/l4/tool/dice/src/be/l4/x0/L4X0BESizes.h 2006-08-08 13:20:08.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/x0/L4X0BESizes.h 2006-11-30 10:41:14.000000000 +0100 @@ -49,6 +49,7 @@ public: // Public methods virtual int GetMaxShortIPCSize(void); virtual int GetSizeOfType(int nFEType, int nFESize = 0); + virtual int GetMaxSizeOfType(int nFEType); }; #endif diff -ruN p2/l4/tool/dice/src/be/l4/x0/L4X0BETrace.cpp p3/l4/tool/dice/src/be/l4/x0/L4X0BETrace.cpp --- p2/l4/tool/dice/src/be/l4/x0/L4X0BETrace.cpp 2006-08-23 19:28:00.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/x0/L4X0BETrace.cpp 2006-11-30 10:41:14.000000000 +0100 @@ -41,7 +41,6 @@ #include "TypeSpec-Type.h" #include "Compiler.h" #include -using namespace std; CL4X0BETrace::CL4X0BETrace() { @@ -90,10 +89,10 @@ if (CCompiler::IsOptionSet(PROGRAM_TRACE_CLIENT)) { *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": server %%2X.%%X\\n\", " << pObjName->GetName() << + ": server %2X.%X\\n\", " << pObjName->GetName() << "->id.task, " << pObjName->GetName() << "->id.lthread);\n"; *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": with dw0=0x%%x, dw1=0x%%x, dw2=0x%%x\\n\", "; + ": with dw0=0x%x, dw1=0x%x, dw2=0x%x\\n\", "; if (!pMarshaller->MarshalWordMember(pFile, pFunction, nSndDir, 0, false, false)) *pFile << "0"; @@ -153,7 +152,7 @@ CCompiler::IsOptionSet(PROGRAM_TRACE_SERVER)) { *pFile << "\t" << sFunc << " (\"" << pFunction->GetName() << - ": return dope %%x (ipc error %%x)\\n\", " << sResult << + ": return dope %x (ipc error %x)\\n\", " << sResult << ".msgdope, L4_IPC_ERROR(" << sResult << "));\n"; } diff -ruN p2/l4/tool/dice/src/be/l4/x0/L4X0BEWaitAnyFunction.cpp p3/l4/tool/dice/src/be/l4/x0/L4X0BEWaitAnyFunction.cpp --- p2/l4/tool/dice/src/be/l4/x0/L4X0BEWaitAnyFunction.cpp 2006-06-14 14:25:11.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/x0/L4X0BEWaitAnyFunction.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,71 +0,0 @@ -/** - * \file dice/src/be/l4/x0/L4X0BEWaitAnyFunction.cpp - * \brief contains the implementation of the class CL4X0BEWaitAnyFunction - * - * \date 06/01/2002 - * \author Ronald Aigner - */ -/* Copyright (C) 2001-2004 - * Dresden University of Technology, Operating Systems Research Group - * - * This file contains free software, you can redistribute it and/or modify - * it under the terms of the GNU General Public License, Version 2 as - * published by the Free Software Foundation (see the file COPYING). - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * For different licensing schemes please contact - * . - */ - -#include "L4X0BEWaitAnyFunction.h" -#include "be/l4/v2/L4V2BEIPC.h" -#include "be/BEFile.h" -#include "be/BEContext.h" -#include "be/BETrace.h" -#include "TypeSpec-Type.h" -#include -using namespace std; - -CL4X0BEWaitAnyFunction::CL4X0BEWaitAnyFunction(bool bOpenWait, bool bReply) - : CL4BEWaitAnyFunction(bOpenWait, bReply) -{ -} - -/** destroys the wait function object */ -CL4X0BEWaitAnyFunction::~CL4X0BEWaitAnyFunction() -{ -} - -/** \brief writes the unmarshalling code - * \param pFile the file to write to - */ -void -CL4X0BEWaitAnyFunction::WriteUnmarshalling(CBEFile* pFile) -{ - assert (m_pTrace); - bool bLocalTrace = false; - if (!m_bTraceOn) - { - m_pTrace->BeforeUnmarshalling(pFile, this); - m_bTraceOn = bLocalTrace = true; - } - - if (m_bReply) - WriteMarshalReturn(pFile, false); - else - CL4BEWaitAnyFunction::WriteUnmarshalling(pFile); - - if (bLocalTrace) - { - m_pTrace->AfterUnmarshalling(pFile, this); - m_bTraceOn = false; - } -} diff -ruN p2/l4/tool/dice/src/be/l4/x0/L4X0BEWaitAnyFunction.h p3/l4/tool/dice/src/be/l4/x0/L4X0BEWaitAnyFunction.h --- p2/l4/tool/dice/src/be/l4/x0/L4X0BEWaitAnyFunction.h 2006-06-14 14:25:11.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/x0/L4X0BEWaitAnyFunction.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,53 +0,0 @@ -/** - * \file dice/src/be/l4/x0/L4X0BEWaitAnyFunction.h - * \brief contains the declaration of the class CL4X0BEWaitAnyFunction - * - * \date 06/01/2002 - * \author Ronald Aigner - */ -/* Copyright (C) 2001-2004 - * Dresden University of Technology, Operating Systems Research Group - * - * This file contains free software, you can redistribute it and/or modify - * it under the terms of the GNU General Public License, Version 2 as - * published by the Free Software Foundation (see the file COPYING). - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * For different licensing schemes please contact - * . - */ - -#ifndef L4X0BEWAITANYFUNCTION_H -#define L4X0BEWAITANYFUNCTION_H - - -#include - -/** \class CL4X0BEWaitAnyFunction - * \ingroup backend - * \brief implements X0 specific ipc code - */ -class CL4X0BEWaitAnyFunction : public CL4BEWaitAnyFunction -{ - -public: - /** \brief creates a wait function object - * \param bOpenWait true if wait for any sender - * \param bReply true if reply sent before wait - */ - CL4X0BEWaitAnyFunction(bool bOpenWait, bool bReply); - virtual ~CL4X0BEWaitAnyFunction(); - -protected: - virtual void WriteUnmarshalling(CBEFile* pFile); -}; - -#endif diff -ruN p2/l4/tool/dice/src/be/l4/x0/Makefile.am p3/l4/tool/dice/src/be/l4/x0/Makefile.am --- p2/l4/tool/dice/src/be/l4/x0/Makefile.am 2006-10-10 15:57:13.000000000 +0200 +++ p3/l4/tool/dice/src/be/l4/x0/Makefile.am 2006-11-30 10:41:15.000000000 +0100 @@ -2,8 +2,8 @@ SUFFIXES = .cpp noinst_LIBRARIES = libx0.a -libx0_a_SOURCES = L4X0BEClassFactory.cpp L4X0BESizes.cpp L4X0BEWaitAnyFunction.cpp L4X0BEIPC.cpp L4X0BETrace.cpp L4X0BEMsgBuffer.cpp L4X0BEDispatchFunction.cpp -noinst_HEADERS = L4X0BEClassFactory.h L4X0BESizes.h L4X0BEWaitAnyFunction.h L4X0BEIPC.h L4X0BETrace.h L4X0BEMsgBuffer.h L4X0BEDispatchFunction.h +libx0_a_SOURCES = L4X0BEClassFactory.cpp L4X0BESizes.cpp L4X0BEIPC.cpp L4X0BETrace.cpp L4X0BEMsgBuffer.cpp L4X0BEDispatchFunction.cpp +noinst_HEADERS = L4X0BEClassFactory.h L4X0BESizes.h L4X0BEIPC.h L4X0BETrace.h L4X0BEMsgBuffer.h L4X0BEDispatchFunction.h AM_CXXFLAGS = -Wunused -Wunused-parameter -Wall -W \ -Wcast-align -Wcast-qual -Wconversion -Wformat=2 \ diff -ruN p2/l4/tool/dice/src/be/sock/BESocket.cpp p3/l4/tool/dice/src/be/sock/BESocket.cpp --- p2/l4/tool/dice/src/be/sock/BESocket.cpp 2006-10-11 12:04:10.000000000 +0200 +++ p3/l4/tool/dice/src/be/sock/BESocket.cpp 2006-11-30 10:41:15.000000000 +0100 @@ -254,7 +254,7 @@ // offset might have been overwritten, so it has to be reinitialized CBEMsgBuffer *pMsgBuffer = pFunction->GetMessageBuffer(); if (pMsgBuffer->IsVariableSized(0)) - pMsgBuffer->WriteInitialization(pFile); + pMsgBuffer->WriteInitialization(pFile, pFunction, 0, 0); // zero msgbuffer WriteZeroMsgBuffer(pFile, pFunction); // receive response diff -ruN p2/l4/tool/dice/src/be/sock/SockBECallFunction.cpp p3/l4/tool/dice/src/be/sock/SockBECallFunction.cpp --- p2/l4/tool/dice/src/be/sock/SockBECallFunction.cpp 2006-08-21 16:46:40.000000000 +0200 +++ p3/l4/tool/dice/src/be/sock/SockBECallFunction.cpp 2006-11-30 10:41:15.000000000 +0100 @@ -37,7 +37,6 @@ #include "Compiler.h" #include "TypeSpec-Type.h" #include -using namespace std; CSockBECallFunction::CSockBECallFunction() { @@ -104,7 +103,6 @@ */ void CSockBECallFunction::CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*) { CBECallFunction::CreateBackEnd(pFEOperation); diff -ruN p2/l4/tool/dice/src/be/sock/SockBECallFunction.h p3/l4/tool/dice/src/be/sock/SockBECallFunction.h --- p2/l4/tool/dice/src/be/sock/SockBECallFunction.h 2006-06-14 14:25:14.000000000 +0200 +++ p3/l4/tool/dice/src/be/sock/SockBECallFunction.h 2006-11-30 10:41:15.000000000 +0100 @@ -48,8 +48,7 @@ CSockBECallFunction(); virtual ~CSockBECallFunction(); - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); protected: /** \brief copy constructor */ @@ -57,8 +56,6 @@ virtual void WriteInvocation(CBEFile * pFile); virtual void WriteVariableInitialization(CBEFile * pFile); - -public: }; #endif diff -ruN p2/l4/tool/dice/src/be/sock/SockBEClassFactory.cpp p3/l4/tool/dice/src/be/sock/SockBEClassFactory.cpp --- p2/l4/tool/dice/src/be/sock/SockBEClassFactory.cpp 2006-08-24 22:46:05.000000000 +0200 +++ p3/l4/tool/dice/src/be/sock/SockBEClassFactory.cpp 2006-11-30 10:41:15.000000000 +0100 @@ -38,7 +38,6 @@ #include "BESocket.h" #include "Compiler.h" #include -using namespace std; CSockBEClassFactory::CSockBEClassFactory() : CBEClassFactory() diff -ruN p2/l4/tool/dice/src/be/sock/SockBESndFunction.cpp p3/l4/tool/dice/src/be/sock/SockBESndFunction.cpp --- p2/l4/tool/dice/src/be/sock/SockBESndFunction.cpp 2006-08-24 22:46:05.000000000 +0200 +++ p3/l4/tool/dice/src/be/sock/SockBESndFunction.cpp 2006-11-30 10:41:15.000000000 +0100 @@ -40,7 +40,6 @@ #include "Compiler.h" #include "TypeSpec-Type.h" #include -using namespace std; CSockBESndFunction::CSockBESndFunction() { @@ -107,7 +106,6 @@ */ void CSockBESndFunction::CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*) { CBESndFunction::CreateBackEnd(pFEOperation); diff -ruN p2/l4/tool/dice/src/be/sock/SockBESndFunction.h p3/l4/tool/dice/src/be/sock/SockBESndFunction.h --- p2/l4/tool/dice/src/be/sock/SockBESndFunction.h 2006-08-24 22:46:05.000000000 +0200 +++ p3/l4/tool/dice/src/be/sock/SockBESndFunction.h 2006-11-30 10:41:15.000000000 +0100 @@ -51,8 +51,7 @@ CSockBESndFunction(); virtual ~CSockBESndFunction(); - virtual void CreateBackEnd(CFEOperation *pFEOperation) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEOperation *pFEOperation); protected: /** \brief copy constructor */ diff -ruN p2/l4/tool/dice/src/be/sock/SockBESrvLoopFunction.cpp p3/l4/tool/dice/src/be/sock/SockBESrvLoopFunction.cpp --- p2/l4/tool/dice/src/be/sock/SockBESrvLoopFunction.cpp 2006-08-23 19:28:00.000000000 +0200 +++ p3/l4/tool/dice/src/be/sock/SockBESrvLoopFunction.cpp 2006-11-30 10:41:15.000000000 +0100 @@ -36,7 +36,6 @@ #include "Attribute-Type.h" #include "Compiler.h" #include -using namespace std; CSockBESrvLoopFunction::CSockBESrvLoopFunction() { @@ -59,7 +58,6 @@ */ void CSockBESrvLoopFunction::CreateBackEnd(CFEInterface * pFEInterface) - throw (CBECreateException*) { CBESrvLoopFunction::CreateBackEnd(pFEInterface); diff -ruN p2/l4/tool/dice/src/be/sock/SockBESrvLoopFunction.h p3/l4/tool/dice/src/be/sock/SockBESrvLoopFunction.h --- p2/l4/tool/dice/src/be/sock/SockBESrvLoopFunction.h 2006-06-14 14:25:15.000000000 +0200 +++ p3/l4/tool/dice/src/be/sock/SockBESrvLoopFunction.h 2006-11-30 10:41:15.000000000 +0100 @@ -59,8 +59,7 @@ virtual void WriteDefaultEnvAssignment(CBEFile *pFile); public: - virtual void CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEInterface *pFEInterface); }; #endif diff -ruN p2/l4/tool/dice/src/be/sock/SockBEWaitAnyFunction.cpp p3/l4/tool/dice/src/be/sock/SockBEWaitAnyFunction.cpp --- p2/l4/tool/dice/src/be/sock/SockBEWaitAnyFunction.cpp 2006-08-21 16:46:40.000000000 +0200 +++ p3/l4/tool/dice/src/be/sock/SockBEWaitAnyFunction.cpp 2006-11-30 10:41:15.000000000 +0100 @@ -37,7 +37,6 @@ #include "Compiler.h" #include "TypeSpec-Type.h" #include -using namespace std; CSockBEWaitAnyFunction::CSockBEWaitAnyFunction(bool bOpenWait, bool bReply) : CBEWaitAnyFunction(bOpenWait, bReply) @@ -78,7 +77,6 @@ */ void CSockBEWaitAnyFunction::CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*) { CBEWaitAnyFunction::CreateBackEnd(pFEInterface); @@ -95,7 +93,7 @@ } catch (CBECreateException *e) { - m_LocalVariables.Remove(pVariable); + m_LocalVariables.Remove(pVariable); delete pVariable; // deletes pType too throw; } @@ -110,7 +108,7 @@ } catch (CBECreateException *e) { - m_LocalVariables.Remove(pVariable); + m_LocalVariables.Remove(pVariable); delete pVariable; throw; } diff -ruN p2/l4/tool/dice/src/be/sock/SockBEWaitAnyFunction.h p3/l4/tool/dice/src/be/sock/SockBEWaitAnyFunction.h --- p2/l4/tool/dice/src/be/sock/SockBEWaitAnyFunction.h 2006-06-14 14:25:15.000000000 +0200 +++ p3/l4/tool/dice/src/be/sock/SockBEWaitAnyFunction.h 2006-11-30 10:41:15.000000000 +0100 @@ -50,8 +50,7 @@ CSockBEWaitAnyFunction(bool bOpenWait, bool bReply); virtual ~CSockBEWaitAnyFunction(); - virtual void CreateBackEnd(CFEInterface *pFEInterface) - throw (CBECreateException*); + virtual void CreateBackEnd(CFEInterface *pFEInterface); protected: /** \brief copy constructor */ diff -ruN p2/l4/tool/dice/src/CCapIDLParser.cpp p3/l4/tool/dice/src/CCapIDLParser.cpp --- p2/l4/tool/dice/src/CCapIDLParser.cpp 2006-08-23 19:27:55.000000000 +0200 +++ p3/l4/tool/dice/src/CCapIDLParser.cpp 2006-11-30 10:41:05.000000000 +0100 @@ -32,7 +32,6 @@ #include #include -using namespace std; //@{ /** global variables and function of the CapIDL parser */ diff -ruN p2/l4/tool/dice/src/CCORBAParser.cpp p3/l4/tool/dice/src/CCORBAParser.cpp --- p2/l4/tool/dice/src/CCORBAParser.cpp 2006-08-23 19:27:55.000000000 +0200 +++ p3/l4/tool/dice/src/CCORBAParser.cpp 2006-11-30 10:41:05.000000000 +0100 @@ -32,7 +32,6 @@ #include #include -using namespace std; //@{ /** global variables and function of the CORBA parser */ @@ -171,10 +170,6 @@ FrontEnd_Type nIDL, bool bPreProcessOnly) { -// TRACE("CORBA::Parse(%p, %s, %d, %s, %s) called\n", scan_buffer, -// sFilename.c_str(), nIDL, -// bPreProcessOnly?"true":"false"); - m_nInputFileType = nIDL; bool bFirst = (scan_buffer == 0); diff -ruN p2/l4/tool/dice/src/CCParser.cpp p3/l4/tool/dice/src/CCParser.cpp --- p2/l4/tool/dice/src/CCParser.cpp 2006-08-23 19:27:55.000000000 +0200 +++ p3/l4/tool/dice/src/CCParser.cpp 2006-11-30 10:41:05.000000000 +0100 @@ -37,7 +37,6 @@ #include #include -using namespace std; //@{ /** global variables and function of the GCC C parser */ @@ -189,10 +188,6 @@ FrontEnd_Type nIDL, bool bPreProcessOnly) { -// TRACE("C::Parse(%p, %s, %d, %s, %s) called\n", scan_buffer, -// sFilename.c_str(), nIDL, -// bPreProcessOnly?"true":"false"); - m_nInputFileType = nIDL; bool bFirst = (scan_buffer == 0); diff -ruN p2/l4/tool/dice/src/CCXXParser.cpp p3/l4/tool/dice/src/CCXXParser.cpp --- p2/l4/tool/dice/src/CCXXParser.cpp 2006-08-23 19:27:55.000000000 +0200 +++ p3/l4/tool/dice/src/CCXXParser.cpp 2006-11-30 10:41:05.000000000 +0100 @@ -32,7 +32,6 @@ #include #include -using namespace std; //@{ /** global variables and function of the GCC C++ parser */ @@ -171,10 +170,6 @@ FrontEnd_Type nIDL, bool bPreProcessOnly) { -// TRACE("Cxx::Parse(%p, %s, %d, %s, %s) called\n", scan_buffer, -// sFilename.c_str(), nIDL, -// bPreProcessOnly?"true":"false"); - m_nInputFileType = nIDL; // 1. call preprocess -> opens input file diff -ruN p2/l4/tool/dice/src/CDCEParser.cpp p3/l4/tool/dice/src/CDCEParser.cpp --- p2/l4/tool/dice/src/CDCEParser.cpp 2006-08-23 19:27:55.000000000 +0200 +++ p3/l4/tool/dice/src/CDCEParser.cpp 2006-11-30 10:41:05.000000000 +0100 @@ -32,7 +32,6 @@ #include #include -using namespace std; //@{ /** global variables and function of the DCE parser */ @@ -175,10 +174,6 @@ FrontEnd_Type nIDL, bool bPreProcessOnly) { -// TRACE("DCE::Parse(%p, %s, %d, %s, %s) called\n", scan_buffer, -// sFilename.c_str(), nIDL, -// bPreProcessOnly?"true":"false"); - m_nInputFileType = nIDL; bool bFirst = (scan_buffer == 0); diff -ruN p2/l4/tool/dice/src/Compiler.cpp p3/l4/tool/dice/src/Compiler.cpp --- p2/l4/tool/dice/src/Compiler.cpp 2006-10-10 16:08:39.000000000 +0200 +++ p3/l4/tool/dice/src/Compiler.cpp 2006-11-30 10:41:05.000000000 +0100 @@ -44,7 +44,6 @@ #include #include #include -using namespace std; #if defined(HAVE_GETOPT_H) #include @@ -110,9 +109,6 @@ int warningcount = 0; //@} -/** debugging helper variable */ -int nGlobalDebug = 0; - //@{ /** global variables for argument parsing */ extern char *optarg; @@ -335,7 +331,7 @@ (nVerboseLevel > PROGRAM_VERBOSE_MAXLEVEL)) { Warning("dice: Verbose level %d not supported in this version.", nVerboseLevel); - nVerboseLevel = max(min(nVerboseLevel, + nVerboseLevel = std::max(std::min(nVerboseLevel, (int)PROGRAM_VERBOSE_MAXLEVEL), 0); } Verbose(PROGRAM_VERBOSE_OPTIONS, "Verbose level %d enabled\n", nVerboseLevel); @@ -1168,16 +1164,16 @@ { if (!IsVerboseLevel(PROGRAM_VERBOSE_OPTIONS)) return; - cout << "DICE (c) 2001-2006 Dresden University of Technology" << endl; - cout << "Author: Ronald Aigner " << endl; - cout << "e-Mail: dice@os.inf.tu-dresden.de" << endl << endl; + std::cout << "DICE (c) 2001-2006 Dresden University of Technology" << std::endl; + std::cout << "Author: Ronald Aigner " << std::endl; + std::cout << "e-Mail: dice@os.inf.tu-dresden.de" << std::endl << std::endl; } /** displays a help for this compiler */ void CCompiler::ShowHelp(bool bShort) { ShowCopyright(); - cout << "Usage: dice [] \n" + std::cout << "Usage: dice [] \n" //23456789+123456789+123456789+123456789+123456789+123456789+123456789+123456789+ "\nPre-Processor/Front-End Options:\n" " -h" @@ -1230,11 +1226,11 @@ #endif " generate client stubs as inline\n"; if (!bShort) - cout << + std::cout << " set to \"static\" to generate static inline\n" " set to \"extern\" to generate extern inline\n" " is optional\n"; - cout << + std::cout << " -n" #if defined(HAVE_GETOPT_LONG) ", --no-opcodes" @@ -1278,10 +1274,10 @@ " -o \n" " specify an output directory (default is .)\n"; if (bShort) - cout << + std::cout << " -f supply flags to compiler\n"; else - cout << + std::cout << "\n" "Compiler Flags:\n" " -f supply flags to compiler\n" @@ -1356,21 +1352,21 @@ " temporarely during preprocessing created files.\n" " USE FOR DEBUGGING ONLY!\n" "\n"; - cout << + std::cout << " -B" #if defined(HAVE_GETOPT_LONG) ", --back-end" #endif " defines the back-end to use\n"; if (!bShort) - cout << + std::cout << " starts with a letter specifying platform, kernel interface or\n" " language mapping\n" " p - specifies the platform (IA32, IA64, ARM, AMD64)\n" " i - specifies the kernel interface (v2, x0, v4, sock)\n" " m - specifies the language mapping (C, CPP)\n" " example: -Bpia32 -Biv2 -BmC - which is default\n"; - cout << + std::cout << " -m" #if defined(HAVE_GETOPT_LONG) ", --message-passing" @@ -1395,10 +1391,10 @@ void CCompiler::ShowVersion() { ShowCopyright(); - cout << "DICE " << dice_version << " - built on " << dice_build; + std::cout << "DICE " << dice_version << " - built on " << dice_build; if (dice_user) - cout << " by " << dice_user; - cout << "." << endl; + std::cout << " by " << dice_user; + std::cout << "." << std::endl; exit(0); } @@ -1437,7 +1433,8 @@ CPostParseVisitor v; try { - m_pRootFE->Accept(v); + if (m_pRootFE) + m_pRootFE->Accept(v); } catch (...) { @@ -1555,12 +1552,12 @@ } catch (CBECreateException *e) { - Verbose(PROGRAM_VERBOSE_NORMAL, "Back-End creation failed\n"); + Verbose(PROGRAM_VERBOSE_NORMAL, "Back-End creation failed\n"); delete m_pRootBE; m_pRootBE = 0; e->Print(); delete e; - Error("Creation of the back-end failed. compilation aborted.\n"); + Error("Creating back-end failed.\n"); } Verbose(PROGRAM_VERBOSE_NORMAL, "...done.\n"); @@ -1617,16 +1614,13 @@ */ void CCompiler::Error(const char *sMsg, ...) { - cerr << "dice: "; + std::cerr << "dice: "; va_list args; va_start(args, sMsg); vfprintf(stderr, sMsg, args); va_end(args); - cerr << "\n"; + std::cerr << "\n"; - fflush(stdout); - fflush(stderr); - sleep(1); exit(1); } @@ -1684,7 +1678,7 @@ { // walk down if (pStack->size() > 1) - cerr << "In file included "; + std::cerr << "In file included "; vector::iterator iter; for (iter = pStack->begin(); (iter != pStack->end()) && (iter != pStack->end()-1); iter++) @@ -1696,25 +1690,25 @@ int nIncludeLine = 1; if (iter != pStack->end()-1) nIncludeLine = (*(iter+1))->GetIncludedOnLine(); - cerr << "from " << pFEFile->GetFileName() << ":" << nIncludeLine; + std::cerr << "from " << pFEFile->GetFileName() << ":" << nIncludeLine; if (iter + 2 != pStack->end()) - cerr << ",\n "; + std::cerr << ",\n "; else - cerr << ":\n"; + std::cerr << ":\n"; } if (*iter) { // we do not use GetFullFileName, because the "normal" // filename already includes the whole path it is the filename // generated by Gcc - cerr << (*iter)->GetFileName() << ":" << nLinenb << ": "; + std::cerr << (*iter)->GetFileName() << ":" << nLinenb << ": "; } } // cleanup delete pStack; } vfprintf(stderr, sMsg, vl); - cerr << endl; + std::cerr << std::endl; } /** @@ -1729,7 +1723,7 @@ va_start(args, sMsg); vfprintf(stderr, sMsg, args); va_end(args); - cerr << endl; + std::cerr << std::endl; } /** \brief print verbose message @@ -1834,26 +1828,26 @@ { // walk down if (pStack->size() > 1) - cerr << "In file included "; + std::cerr << "In file included "; vector::iterator iter; for (iter = pStack->begin(); (iter != pStack->end()) && (iter != pStack->end()-1); iter++) { - cerr << "from " << (*iter)->GetFullFileName() << ":1"; + std::cerr << "from " << (*iter)->GetFullFileName() << ":1"; if (iter+2 != pStack->end()) - cerr << ",\n "; + std::cerr << ",\n "; else - cerr << ":\n"; + std::cerr << ":\n"; } if (*iter) { - cerr << (*iter)->GetFullFileName() << ":" << nLinenb << ": warning: "; + std::cerr << (*iter)->GetFullFileName() << ":" << nLinenb << ": warning: "; } } // cleanup delete pStack; } vfprintf(stderr, sMsg, vl); - cerr << "\n"; + std::cerr << "\n"; } diff -ruN p2/l4/tool/dice/src/Compiler.h p3/l4/tool/dice/src/Compiler.h --- p2/l4/tool/dice/src/Compiler.h 2006-10-10 16:08:39.000000000 +0200 +++ p3/l4/tool/dice/src/Compiler.h 2006-11-30 10:41:05.000000000 +0100 @@ -30,12 +30,12 @@ #ifndef __DICE_COMPILER_H__ #define __DICE_COMPILER_H__ -#include +#include #include "defines.h" #include #include #include -using namespace std; +using std::bitset; #include "ProgramOptions.h" #include "be/BENameFactory.h" @@ -123,6 +123,7 @@ static CBENameFactory *GetNameFactory(); static CBEClassFactory *GetClassFactory(); static CBESizes* GetSizes(); + static void SetDebug(bool bOn = true); protected: void ShowVersion(); @@ -734,4 +735,17 @@ m_pSizes = pSizes; } +/** \brief set debug output on or off + * \param bOn true if on, otherwise off + */ +inline +void +CCompiler::SetDebug(bool bOn) +{ + if (bOn) + m_VerboseLevel = PROGRAM_VERBOSE_DEBUG; + else + m_VerboseLevel = PROGRAM_VERBOSE_NONE; +} + #endif // __DICE_COMPILER_H__ diff -ruN p2/l4/tool/dice/src/CParser.cpp p3/l4/tool/dice/src/CParser.cpp --- p2/l4/tool/dice/src/CParser.cpp 2006-10-10 14:46:16.000000000 +0200 +++ p3/l4/tool/dice/src/CParser.cpp 2006-11-30 10:41:05.000000000 +0100 @@ -58,9 +58,6 @@ extern int warningcount; //@} -/** debugging helper variable */ -extern int nGlobalDebug; - /** the current line number (relative to the current file) */ int gLineNumber = 1; @@ -297,8 +294,6 @@ m_pParent->UpdateState(sFileName, nLineNumber); return; } -// TRACE("UpdateState for %s from %d to %d\n", -// sFileName.c_str(), m_nLineNumber, nLineNumber); // update line number if (nLineNumber > m_nLineNumber) m_nLineNumber = nLineNumber; diff -ruN p2/l4/tool/dice/src/CParser.h p3/l4/tool/dice/src/CParser.h --- p2/l4/tool/dice/src/CParser.h 2006-08-23 19:27:55.000000000 +0200 +++ p3/l4/tool/dice/src/CParser.h 2006-11-30 10:41:05.000000000 +0100 @@ -31,9 +31,8 @@ #define PARSER_H #include -using namespace std; -#include -#include // needed for memset +#include +#include // for std::memset #include "Compiler.h" // FrontEnd_Type class CFEFile; diff -ruN p2/l4/tool/dice/src/CPreProcess.cpp p3/l4/tool/dice/src/CPreProcess.cpp --- p2/l4/tool/dice/src/CPreProcess.cpp 2006-10-10 16:08:39.000000000 +0200 +++ p3/l4/tool/dice/src/CPreProcess.cpp 2006-11-30 10:41:05.000000000 +0100 @@ -33,7 +33,8 @@ #include "CPreProcess.h" #include "CParser.h" #include "Compiler.h" -#include // needed for errno +#include "Error.h" +#include // needed for errno #include // needed for pipe #include // needed for waitpid #include // needed for waitpid @@ -42,7 +43,6 @@ #include "fe/FEFile.h" #include #include -using namespace std; //@{ /** globale pre-processor variables and function */ @@ -62,9 +62,6 @@ /** the current line number (relative to the current file) */ extern int gLineNumber; -/** debugging helper variable */ -extern int nGlobalDebug; - CPreProcess *CPreProcess::m_pPreProcessor = 0; CPreProcess::CPreProcess() @@ -229,16 +226,16 @@ { if (!m_sCPPProgram || (strlen(m_sCPPProgram) == 0)) - throw new preprocess_exception("No preprocessor set.\n"); + throw new error::preprocess_error("No preprocessor set.\n"); int pipes[2]; if (pipe(pipes) == -1) - throw new preprocess_exception("Could not open pipe.\n"); + throw new error::preprocess_error("Could not open pipe.\n"); int pid = fork(); int status; if (pid == -1) - throw new preprocess_exception("Could not fork preprocess.\n"); + throw new error::preprocess_error("Could not fork preprocess.\n"); // in child process call cpp if (pid == 0) @@ -261,7 +258,7 @@ sArgs[i+1] = m_sCPPArgs[i]; execvp(m_sCPPProgram, sArgs); CPPErrorHandling(); - throw new preprocess_exception("Could not start preprocess program.\n"); + throw new error::preprocess_error("Could not start preprocess program.\n"); } // parent -> wait for cpp waitpid(pid, &status, 0); @@ -296,9 +293,6 @@ CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "Start preprocessing input file (\"%s\") ...\n", sTopLevelInFileName.c_str()); - // turn debugging on - if (CCompiler::IsVerboseLevel(PROGRAM_VERBOSE_PARSER)) - nGlobalDebug++; // search for import and include statements FILE *fOutput; string s, sBase; @@ -312,7 +306,7 @@ fOutput = tmpfile(); if (!fOutput) { - cerr << "could not create temporary file\n"; + std::cerr << "could not create temporary file\n"; if (fInput != 0) fclose(fInput); return 0; @@ -330,9 +324,6 @@ gLineNumber = 1; inclex(); - // turn debugging off - if (CCompiler::IsVerboseLevel(PROGRAM_VERBOSE_PARSER)) - nGlobalDebug--; // close input of preprocess if (!sFilename.empty()) // _not_ stdin fclose(fInput); @@ -349,7 +340,7 @@ fInput = tmpfile(); if (!fInput) { - cerr << "could not create temporary file\n"; + std::cerr << "could not create temporary file\n"; if (fOutput != 0) fclose(fOutput); return 0; @@ -370,14 +361,14 @@ int ret; if ((ret = ExecCPP(fOutput, fInput)) > 0) { - cerr << "Preprocessing \"" << sInFileName << "\" returned " << + std::cerr << "Preprocessing \"" << sInFileName << "\" returned " << ret << ".\n"; return 0; } } - catch (preprocess_exception *e) + catch (error::preprocess_error *e) { - cerr << "Preprocessing error: " << e->what() << endl; + std::cerr << "Preprocessing error: " << e->what() << std::endl; delete e; return 0; @@ -409,10 +400,6 @@ { RemoveSlashes(sName); -// TRACE("%s(%s, %s, %s, %s) called\n", __func__, sName.c_str(), -// bDefault ? "true" : "false", -// bIgnoreErrors ? "true" : "false"); - string sCurPath; if (m_nCurrentIncludePath < 0 || bDefault) sCurPath = ""; @@ -479,7 +466,7 @@ CFEFile *pCurFile = CParser::GetCurrentFile(); if (!pCurFile) { - cerr << "dice: " << sName << ": No such file or directory.\n"; + std::cerr << "dice: " << sName << ": No such file or directory.\n"; return 0; } /* if not open by now, couldn't find file */ @@ -495,7 +482,7 @@ } // down in line if (vStack.size() > 1) - cerr << "In file included "; + std::cerr << "In file included "; vector::iterator iter = vStack.begin(); while (iter != vStack.end()) { @@ -509,11 +496,11 @@ nLine = FindLineNbOfInclude(sFileName, ((CFEFile*)(pFEFile->GetParent()))->GetFullFileName()); else nLine = FindLineNbOfInclude(sFileName, pFEFile->GetFullFileName()); - cerr << "from " << sFileName << ":" << nLine; + std::cerr << "from " << sFileName << ":" << nLine; if (iter+1 != vStack.end()) - cerr << ",\n "; + std::cerr << ",\n "; else - cerr << ":\n"; + std::cerr << ":\n"; iter++; } } @@ -521,7 +508,7 @@ if (sFileName.empty()) sFileName = sTopLevelInFileName; int nLine = FindLineNbOfInclude(sName, sFileName); - cerr << sFileName << ":" << nLine << ": " << sName << + std::cerr << sFileName << ":" << nLine << ": " << sName << ": No such file or directory.\n"; } if (!fReturn) diff -ruN p2/l4/tool/dice/src/CPreProcess.h p3/l4/tool/dice/src/CPreProcess.h --- p2/l4/tool/dice/src/CPreProcess.h 2006-10-10 14:46:16.000000000 +0200 +++ p3/l4/tool/dice/src/CPreProcess.h 2006-11-30 10:41:05.000000000 +0100 @@ -32,7 +32,6 @@ #include #include -using namespace std; #include "ProgramOptions.h" // needed for ProgramOptionType #include "IncludeStatement.h" #include "template.h" @@ -73,36 +72,6 @@ CIncludeStatement* GetNextIncludeInFile(string sFilename, vector::iterator & iter); - - class preprocess_exception : public exception - { - public: - /** a preprocessing exception - * \param str the reason string - */ - explicit preprocess_exception(const char * str) throw() - : reason(str) - { } - - /** destructor */ - ~preprocess_exception() throw() - { } - - /** Returns a C-style character string describing the cause of the - * exception - */ - const char* what() const throw() - { - return reason.c_str(); - } - - private: - /** \var string reason - * \brief contains the reason string - */ - string reason; - }; - protected: void CPPErrorHandling(); int ExecCPP(FILE *fInput, FILE* fOutput); diff -ruN p2/l4/tool/dice/src/debug.h p3/l4/tool/dice/src/debug.h --- p2/l4/tool/dice/src/debug.h 2006-06-14 14:24:54.000000000 +0200 +++ p3/l4/tool/dice/src/debug.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,63 +0,0 @@ -/** - * \file dice/src/debug.h - * \brief contains basic macros and definitions for debugging - * - * \date 05/06/2003 - * \author Ronald Aigner - */ -/* - * Copyright (C) 2001-2004 - * Dresden University of Technology, Operating Systems Research Group - * - * This file contains free software, you can redistribute it and/or modify - * it under the terms of the GNU General Public License, Version 2 as - * published by the Free Software Foundation (see the file COPYING). - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * For different licensing schemes please contact - * . - */ - -/** preprocessing symbol to check header file */ -#ifndef __DICE_DEBUG_H__ -#define __DICE_DEBUG_H__ - -/** \defgroup Debug Some debugging macros */ -//@{ -#ifndef NDEBUG - -/** some variables used for debugging */ -#ifndef GLOBAL_DEBUG_TRACE -#define GLOBAL_DEBUG_TRACE - -extern int nGlobalDebug; -#define DTRACE(s, args...) if (nGlobalDebug == 1) printf("%s:%d:" s, __FILE__, __LINE__, ## args) /**< dynamic trace output */ -#define DTRACE_ON nGlobalDebug = 1 /**< turn dynamic debug on */ -#define DTRACE_OFF nGlobalDebug = 0 /**< turn dynamic debug off */ - -#endif /* GLOBAL_DEBUG_TRACE */ - -/** print debug information */ -#define TRACE(s, args...) do { printf("%s:%d:" s, __FILE__, __LINE__, ## args); fflush(stdout); } while(0) - -#else - -/** all debug macros are empty */ -#define TRACE(s, args...) -#define DTRACE(s, args...) -#define DTRACE_ON -#define DTRACE_OFF - -#endif /* NDEBUG */ -//@} - -#endif - diff -ruN p2/l4/tool/dice/src/defines.h p3/l4/tool/dice/src/defines.h --- p2/l4/tool/dice/src/defines.h 2006-08-24 14:17:43.000000000 +0200 +++ p3/l4/tool/dice/src/defines.h 2006-11-30 10:41:06.000000000 +0100 @@ -49,8 +49,6 @@ #include #include -#include "debug.h" - /** \def CLONE_MEM(class, member) * \brief clones a member of a source class */ diff -ruN p2/l4/tool/dice/src/Dependency.cpp p3/l4/tool/dice/src/Dependency.cpp --- p2/l4/tool/dice/src/Dependency.cpp 2006-10-10 14:46:16.000000000 +0200 +++ p3/l4/tool/dice/src/Dependency.cpp 2006-11-30 10:41:05.000000000 +0100 @@ -36,9 +36,10 @@ #include "be/BEContext.h" #include "be/BERoot.h" -#include +#include #include -using namespace std; +#include +using std::ofstream; /** defines the number of characters for dependency output per line */ #define MAX_SHELL_COLS 80 @@ -51,6 +52,7 @@ m_pRootBE = pBERoot; m_pRootFE = pFERoot; m_nCurCol = 0; + m_output = &std::cout; } /** \brief print the dependency tree @@ -62,8 +64,8 @@ { assert (m_pRootBE); + ofstream *of = new ofstream(); // if file, open file - FILE *output = stdout; if (CCompiler::IsDependsOptionSet(PROGRAM_DEPEND_MD) || CCompiler::IsDependsOptionSet(PROGRAM_DEPEND_MMD) || CCompiler::IsDependsOptionSet(PROGRAM_DEPEND_MF)) @@ -73,25 +75,28 @@ sOutName += m_sDependsFile; else sOutName += m_pRootFE->GetFileNameWithoutExtension() + ".d"; - output = fopen(sOutName.c_str(), "w"); - if (!output) + of->open(sOutName.c_str()); + if (!of->is_open()) { CCompiler::Warning("Could not open %s, use \n", sOutName.c_str()); - output = stdout; } - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: opened \"%s\" for output\n", __func__, - sOutName.c_str()); + else + { + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, + "%s: opened \"%s\" for output\n", __func__, sOutName.c_str()); + m_output = of; + } } CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: start printing target files\n", __func__); m_nCurCol = 0; - m_pRootBE->PrintTargetFiles(output, m_nCurCol, MAX_SHELL_COLS); - fprintf(output, ": "); + m_pRootBE->PrintTargetFiles(*m_output, m_nCurCol, MAX_SHELL_COLS); + *m_output << ": "; m_nCurCol += 2; CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: start with files\n", __func__); - PrintDependentFile(output, m_pRootFE->GetFullFileName()); - PrintDependencyTree(output, m_pRootFE); - fprintf(output, "\n\n"); + PrintDependentFile(m_pRootFE->GetFullFileName()); + PrintDependencyTree(m_pRootFE); + *m_output << "\n\n"; // if phony dependencies are set then print them now if (CCompiler::IsDependsOptionSet(PROGRAM_DEPEND_MP)) @@ -99,19 +104,19 @@ vector::iterator iter = m_vPhonyDependencies.begin(); for (; iter != m_vPhonyDependencies.end(); iter++) { - fprintf(output, "%s: \n\n", (*iter).c_str()); + *m_output << (*iter) << ": \n\n"; } } // if file, close file - if (CCompiler::IsDependsOptionSet(PROGRAM_DEPEND_MD) || - CCompiler::IsDependsOptionSet(PROGRAM_DEPEND_MMD)) - fclose(output); + if ((CCompiler::IsDependsOptionSet(PROGRAM_DEPEND_MD) || + CCompiler::IsDependsOptionSet(PROGRAM_DEPEND_MMD)) && + of->is_open()) + of->close(); CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: finished\n", __func__); } /** \brief prints the included files - * \param output the output stream * \param pFEFile the current front-end file * * This implementation print the file names of the included files. It first @@ -120,7 +125,7 @@ * If the options PROGRAM_DEPEND_MM or PROGRAM_DEPEND_MMD are specified only * files included with '\#include "file"' are printed. */ -void CDependency::PrintDependencyTree(FILE * output, CFEFile * pFEFile) +void CDependency::PrintDependencyTree(CFEFile * pFEFile) { if (!pFEFile) return; @@ -139,7 +144,7 @@ (CCompiler::IsDependsOptionSet(PROGRAM_DEPEND_MM) || CCompiler::IsDependsOptionSet(PROGRAM_DEPEND_MMD))) continue; - PrintDependentFile(output, (*iterF)->GetFullFileName()); + PrintDependentFile((*iterF)->GetFullFileName()); } // ierate over included files for (iterF = pFEFile->m_ChildFiles.begin(); @@ -153,15 +158,14 @@ (CCompiler::IsDependsOptionSet(PROGRAM_DEPEND_MM) || CCompiler::IsDependsOptionSet(PROGRAM_DEPEND_MMD))) continue; - PrintDependencyTree(output, *iterF); + PrintDependencyTree(*iterF); } } /** \brief prints a list of generated files for the given options - * \param output the output stream * \param pFEFile the file to scan for generated files */ -void CDependency::PrintGeneratedFiles(FILE * output, CFEFile * pFEFile) +void CDependency::PrintGeneratedFiles(CFEFile * pFEFile) { if (!pFEFile->IsIDLFile()) return; @@ -172,19 +176,19 @@ if (CCompiler::IsFileOptionSet(PROGRAM_FILE_IDLFILE) || CCompiler::IsFileOptionSet(PROGRAM_FILE_ALL)) { - PrintGeneratedFiles4File(output, pFEFile); + PrintGeneratedFiles4File(pFEFile); } else if (CCompiler::IsFileOptionSet(PROGRAM_FILE_MODULE)) { - PrintGeneratedFiles4Library(output, pFEFile); + PrintGeneratedFiles4Library(pFEFile); } else if (CCompiler::IsFileOptionSet(PROGRAM_FILE_INTERFACE)) { - PrintGeneratedFiles4Interface(output, pFEFile); + PrintGeneratedFiles4Interface(pFEFile); } else if (CCompiler::IsFileOptionSet(PROGRAM_FILE_FUNCTION)) { - PrintGeneratedFiles4Operation(output, pFEFile); + PrintGeneratedFiles4Operation(pFEFile); } CBENameFactory *pNF = CCompiler::GetNameFactory(); @@ -193,20 +197,20 @@ if (CCompiler::IsOptionSet(PROGRAM_GENERATE_CLIENT)) { sName = pNF->GetFileName(pFEFile, FILETYPE_CLIENTHEADER); - PrintDependentFile(output, sName); + PrintDependentFile(sName); } // create server header file if (CCompiler::IsOptionSet(PROGRAM_GENERATE_COMPONENT)) { // component file sName = pNF->GetFileName(pFEFile, FILETYPE_COMPONENTHEADER); - PrintDependentFile(output, sName); + PrintDependentFile(sName); } // opcodes if (!CCompiler::IsOptionSet(PROGRAM_NO_OPCODES)) { sName = pNF->GetFileName(pFEFile, FILETYPE_OPCODE); - PrintDependentFile(output, sName); + PrintDependentFile(sName); } if (CCompiler::IsFileOptionSet(PROGRAM_FILE_ALL)) @@ -216,7 +220,7 @@ iter != pFEFile->m_ChildFiles.end(); iter++) { - PrintGeneratedFiles(output, *iter); + PrintGeneratedFiles(*iter); } } @@ -224,10 +228,9 @@ } /** \brief prints the file-name generated for the front-end file - * \param output the target stream * \param pFEFile the current front-end file */ -void CDependency::PrintGeneratedFiles4File(FILE * output, CFEFile * pFEFile) +void CDependency::PrintGeneratedFiles4File(CFEFile * pFEFile) { CBENameFactory *pNF = CCompiler::GetNameFactory(); string sName; @@ -240,24 +243,23 @@ { // client implementation file sName = pNF->GetFileName(pFEFile, FILETYPE_CLIENTIMPLEMENTATION); - PrintDependentFile(output, sName); + PrintDependentFile(sName); } // server if (CCompiler::IsOptionSet(PROGRAM_GENERATE_COMPONENT)) { // component file sName = pNF->GetFileName(pFEFile, FILETYPE_COMPONENTIMPLEMENTATION); - PrintDependentFile(output, sName); + PrintDependentFile(sName); } CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: done.\n", __func__); } /** \brief prints a list of generated files for the library granularity - * \param output the output stream * \param pFEFile the front-end file to scan for generated files */ -void CDependency::PrintGeneratedFiles4Library(FILE * output, CFEFile * pFEFile) +void CDependency::PrintGeneratedFiles4Library(CFEFile * pFEFile) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: for file \"%s\" called\n", __func__, pFEFile->GetFileName().c_str()); @@ -268,7 +270,7 @@ iterL != pFEFile->m_Libraries.end(); iterL++) { - PrintGeneratedFiles4Library(output, *iterL); + PrintGeneratedFiles4Library(*iterL); } // iterate over interfaces vector::iterator iterI; @@ -276,18 +278,16 @@ iterI != pFEFile->m_Interfaces.end(); iterI++) { - PrintGeneratedFiles4Library(output, *iterI); + PrintGeneratedFiles4Library(*iterI); } CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: done\n", __func__); } /** \brief print the list of generated files for the library granularity - * \param output the output stream to print to * \param pFELibrary the library to scan */ -void CDependency::PrintGeneratedFiles4Library(FILE * output, - CFELibrary * pFELibrary) +void CDependency::PrintGeneratedFiles4Library(CFELibrary * pFELibrary) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: for lib \"%s\" called\n", __func__, @@ -300,14 +300,14 @@ { // implementation sName = pNF->GetFileName(pFELibrary, FILETYPE_CLIENTIMPLEMENTATION); - PrintDependentFile(output, sName); + PrintDependentFile(sName); } // component file if (CCompiler::IsOptionSet(PROGRAM_GENERATE_COMPONENT)) { // implementation sName = pNF->GetFileName(pFELibrary, FILETYPE_COMPONENTIMPLEMENTATION); - PrintDependentFile(output, sName); + PrintDependentFile(sName); } // nested libraries vector::iterator iterL; @@ -315,18 +315,16 @@ iterL != pFELibrary->m_Libraries.end(); iterL++) { - PrintGeneratedFiles4Library(output, *iterL); + PrintGeneratedFiles4Library(*iterL); } CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: done.\n", __func__); } /** \brief print the list of generated files for the library granularity - * \param output the output stream to print to * \param pFEInterface the interface to scan */ -void CDependency::PrintGeneratedFiles4Library(FILE * output, - CFEInterface * pFEInterface) +void CDependency::PrintGeneratedFiles4Library(CFEInterface * pFEInterface) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: for interface \"%s\" called\n", __func__, @@ -339,7 +337,7 @@ { // implementation sName = pNF->GetFileName(pFEInterface, FILETYPE_CLIENTIMPLEMENTATION); - PrintDependentFile(output, sName); + PrintDependentFile(sName); } // component file if (CCompiler::IsOptionSet(PROGRAM_GENERATE_COMPONENT)) @@ -347,17 +345,16 @@ // implementation sName = pNF->GetFileName(pFEInterface, FILETYPE_COMPONENTIMPLEMENTATION); - PrintDependentFile(output, sName); + PrintDependentFile(sName); } CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: done.\n", __func__); } /** \brief print the list of generated files for interface granularity - * \param output the output stream to print to * \param pFEFile the front-end file to be scanned */ -void CDependency::PrintGeneratedFiles4Interface(FILE * output, CFEFile * pFEFile) +void CDependency::PrintGeneratedFiles4Interface(CFEFile * pFEFile) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: for file \"%s\" called\n", __func__, pFEFile->GetFileName().c_str()); @@ -368,7 +365,7 @@ iterI != pFEFile->m_Interfaces.end(); iterI++) { - PrintGeneratedFiles4Interface(output, *iterI); + PrintGeneratedFiles4Interface(*iterI); } // iterate over libraries vector::iterator iterL; @@ -376,17 +373,16 @@ iterL != pFEFile->m_Libraries.end(); iterL++) { - PrintGeneratedFiles4Interface(output, *iterL); + PrintGeneratedFiles4Interface(*iterL); } CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: done.\n", __func__); } /** \brief print the list of generated files for interface granularity - * \param output the output stream to print to * \param pFELibrary the front-end library to be scanned */ -void CDependency::PrintGeneratedFiles4Interface(FILE * output, +void CDependency::PrintGeneratedFiles4Interface( CFELibrary * pFELibrary) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, @@ -399,7 +395,7 @@ iterI != pFELibrary->m_Interfaces.end(); iterI++) { - PrintGeneratedFiles4Interface(output, *iterI); + PrintGeneratedFiles4Interface(*iterI); } // iterate over nested libraries vector::iterator iterL; @@ -407,17 +403,16 @@ iterL != pFELibrary->m_Libraries.end(); iterL++) { - PrintGeneratedFiles4Interface(output, *iterL); + PrintGeneratedFiles4Interface(*iterL); } CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: done.\n", __func__); } /** \brief print the list of generated files for interface granularity - * \param output the output stream to print to * \param pFEInterface the front-end interface to be scanned */ -void CDependency::PrintGeneratedFiles4Interface(FILE * output, +void CDependency::PrintGeneratedFiles4Interface( CFEInterface * pFEInterface) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, @@ -431,7 +426,7 @@ { // implementation sName = pNF->GetFileName(pFEInterface, FILETYPE_CLIENTIMPLEMENTATION); - PrintDependentFile(output, sName); + PrintDependentFile(sName); } // component file if (CCompiler::IsOptionSet(PROGRAM_GENERATE_COMPONENT)) @@ -439,17 +434,16 @@ // implementation sName = pNF->GetFileName(pFEInterface, FILETYPE_COMPONENTIMPLEMENTATION); - PrintDependentFile(output, sName); + PrintDependentFile(sName); } CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: done.\n", __func__); } /** \brief print the list of generated files for operation granularity - * \param output the output stream to print to * \param pFEFile the front-end file to be scanned */ -void CDependency::PrintGeneratedFiles4Operation(FILE * output, CFEFile * pFEFile) +void CDependency::PrintGeneratedFiles4Operation(CFEFile * pFEFile) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: for file \"%s\" called\n", __func__, pFEFile->GetFileName().c_str()); @@ -460,7 +454,7 @@ iterI != pFEFile->m_Interfaces.end(); iterI++) { - PrintGeneratedFiles4Operation(output, *iterI); + PrintGeneratedFiles4Operation(*iterI); } // iterate over libraries vector::iterator iterL; @@ -468,17 +462,16 @@ iterL != pFEFile->m_Libraries.end(); iterL++) { - PrintGeneratedFiles4Operation(output, *iterL); + PrintGeneratedFiles4Operation(*iterL); } CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: done.\n", __func__); } /** \brief print the list of generated files for operation granularity - * \param output the output stream to print to * \param pFELibrary the front-end library to be scanned */ -void CDependency::PrintGeneratedFiles4Operation(FILE * output, +void CDependency::PrintGeneratedFiles4Operation( CFELibrary * pFELibrary) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: for lib \"%s\" called\n", @@ -490,7 +483,7 @@ iterI != pFELibrary->m_Interfaces.end(); iterI++) { - PrintGeneratedFiles4Operation(output, *iterI); + PrintGeneratedFiles4Operation(*iterI); } // iterate over nested libraries vector::iterator iterL; @@ -498,17 +491,16 @@ iterL != pFELibrary->m_Libraries.end(); iterL++) { - PrintGeneratedFiles4Operation(output, *iterL); + PrintGeneratedFiles4Operation(*iterL); } CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: done\n", __func__); } /** \brief print the list of generated files for operation granularity - * \param output the output stream to print to * \param pFEInterface the front-end interface to be scanned */ -void CDependency::PrintGeneratedFiles4Operation(FILE * output, +void CDependency::PrintGeneratedFiles4Operation( CFEInterface * pFEInterface) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, @@ -521,17 +513,16 @@ iter != pFEInterface->m_Operations.end(); iter++) { - PrintGeneratedFiles4Operation(output, *iter); + PrintGeneratedFiles4Operation(*iter); } CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: done.\n", __func__); } /** \brief print the list of generated files for operation granularity - * \param output the output stream to print to * \param pFEOperation the front-end operation to be scanned */ -void CDependency::PrintGeneratedFiles4Operation(FILE * output, +void CDependency::PrintGeneratedFiles4Operation( CFEOperation * pFEOperation) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, @@ -545,7 +536,7 @@ { // implementation sName = pNF->GetFileName(pFEOperation, FILETYPE_CLIENTIMPLEMENTATION); - PrintDependentFile(output, sName); + PrintDependentFile(sName); } // component file if (CCompiler::IsOptionSet(PROGRAM_GENERATE_COMPONENT)) @@ -553,14 +544,13 @@ // implementation sName = pNF->GetFileName(pFEOperation, FILETYPE_COMPONENTIMPLEMENTATION); - PrintDependentFile(output, sName); + PrintDependentFile(sName); } CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s: done.\n", __func__); } /** \brief prints a filename to the dependency tree - * \param output the stream to write to * \param sFileName the name to print * * This implementation adds a spacer after each file name and also checks @@ -568,7 +558,7 @@ * If it would a new line is started The length of the filename is added to * the columns. */ -void CDependency::PrintDependentFile(FILE * output, string sFileName) +void CDependency::PrintDependentFile(string sFileName) { CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s(%s) called\n", __func__, sFileName.c_str()); @@ -584,10 +574,10 @@ int nLength = strlen(real_path); if ((m_nCurCol + nLength + 1) >= MAX_SHELL_COLS) { - fprintf(output, "\\\n "); + *m_output << "\\\n "; m_nCurCol = 1; } - fprintf(output, "%s ", real_path); + *m_output << real_path << " "; m_nCurCol += nLength + 1; // if phony dependency option is set, add this file to phony dependency diff -ruN p2/l4/tool/dice/src/Dependency.h p3/l4/tool/dice/src/Dependency.h --- p2/l4/tool/dice/src/Dependency.h 2006-08-21 16:46:35.000000000 +0200 +++ p3/l4/tool/dice/src/Dependency.h 2006-11-30 10:41:05.000000000 +0100 @@ -30,10 +30,13 @@ #ifndef __DICE_DEPENDENCY_H__ #define __DICE_DEPENDENCY_H__ -#include +#include #include +using std::string; #include -using namespace std; +using std::vector; +#include +using std::ostream; class CFEFile; class CFELibrary; @@ -62,23 +65,27 @@ void PrintDependencies(); protected: - void PrintDependencyTree(FILE * output, CFEFile * pFEFile); - void PrintGeneratedFiles(FILE * output, CFEFile * pFEFile); - void PrintGeneratedFiles4File(FILE * output, CFEFile * pFEFile); - void PrintGeneratedFiles4Library(FILE * output, CFEFile * pFEFile); - void PrintGeneratedFiles4Library(FILE * output, CFELibrary * pFELibrary); - void PrintGeneratedFiles4Library(FILE * output, CFEInterface * pFEInterface); - void PrintGeneratedFiles4Interface(FILE * output, CFEFile * pFEFile); - void PrintGeneratedFiles4Interface(FILE * output, CFELibrary * pFEpFELibrary); - void PrintGeneratedFiles4Interface(FILE * output, CFEInterface * pFEInterface); - void PrintGeneratedFiles4Operation(FILE * output, CFEFile * pFEFile); - void PrintGeneratedFiles4Operation(FILE * output, CFELibrary * pFELibrary); - void PrintGeneratedFiles4Operation(FILE * output, CFEInterface * pFEInterface); - void PrintGeneratedFiles4Operation(FILE * output, CFEOperation * pFEOperation); - void PrintDependentFile(FILE * output, string sFileName); + void PrintDependencyTree(CFEFile * pFEFile); + void PrintGeneratedFiles(CFEFile * pFEFile); + void PrintGeneratedFiles4File(CFEFile * pFEFile); + void PrintGeneratedFiles4Library(CFEFile * pFEFile); + void PrintGeneratedFiles4Library(CFELibrary * pFELibrary); + void PrintGeneratedFiles4Library(CFEInterface * pFEInterface); + void PrintGeneratedFiles4Interface(CFEFile * pFEFile); + void PrintGeneratedFiles4Interface(CFELibrary * pFEpFELibrary); + void PrintGeneratedFiles4Interface(CFEInterface * pFEInterface); + void PrintGeneratedFiles4Operation(CFEFile * pFEFile); + void PrintGeneratedFiles4Operation(CFELibrary * pFELibrary); + void PrintGeneratedFiles4Operation(CFEInterface * pFEInterface); + void PrintGeneratedFiles4Operation(CFEOperation * pFEOperation); + void PrintDependentFile(string sFileName); // Attributes protected: + /** \var ostream* m_output + * \brief the output file + */ + ostream* m_output; /** \var string m_sDependsFile * \brief the file to write the dependencies to */ diff -ruN p2/l4/tool/dice/src/Error.h p3/l4/tool/dice/src/Error.h --- p2/l4/tool/dice/src/Error.h 1970-01-01 01:00:00.000000000 +0100 +++ p3/l4/tool/dice/src/Error.h 2006-11-30 10:41:05.000000000 +0100 @@ -0,0 +1,123 @@ +/** + * \file dice/src/Error.h + * \brief contains the declaration of the class CError + * + * \date 11/19/2006 + * \author Ronald Aigner + */ +/* + * Copyright (C) 2006 + * Dresden University of Technology, Operating Systems Research Group + * + * This file contains free software, you can redistribute it and/or modify + * it under the terms of the GNU General Public License, Version 2 as + * published by the Free Software Foundation (see the file COPYING). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * For different licensing schemes please contact + * . + */ + +/** preprocessing symbol to check header file */ +#ifndef __DICE_ERROR_H__ +#define __DICE_ERROR_H__ + +#include +#include + +namespace error +{ + /** \class invalid_operator + * \ingroup error + * \brief exception class for usage of invalid operator + */ + class invalid_operator : public std::exception + { + public: + /** \brief the constructor of the invalid_operator exceptions */ + explicit invalid_operator(void) throw() + { } + + /** \brief returns the string specification of the exceptions */ + virtual const char* what() const throw() + { + return "Invalid operator used."; + } + }; + + /** \class preprocess_error + * \ingroup error + * \brief exception class for preprocessor + */ + class preprocess_error : public std::exception + { + public: + /** \brief the constructor taking a reason */ + explicit preprocess_error(const char* str) throw() + : m_reason(str) + { } + + /** \brief required to have rigid throw specification */ + virtual ~preprocess_error() throw() + { } + + /** \brief returns the string of the exception */ + virtual const char* what() const throw() + { + return m_reason.c_str(); + } + + private: + /** \var string m_reason + * \brief contains the reason string + */ + std::string m_reason; + }; + + /** \class postparse_error + * \ingroup error + * \brief exception class for preprocessing + */ + class postparse_error : public std::exception + { + public: + /** \brief the constructor for the class */ + explicit postparse_error(void) throw() + { } + + /** \brief returns the string of the exception */ + virtual const char* what() const throw() + { + return "PostParse exception."; + } + }; + + /** \class consistency_error + * \ingroup error + * \brief exception class for consistency check errors + */ + class consistency_error : public std::exception + { + public: + /** \brief the constructor of the class */ + explicit consistency_error(void) throw() + { } + + /** \brief returns the string of the exception */ + virtual const char* what() const throw() + { + return "Check Consistency error."; + } + }; + +}; /* namespace error */ + +#endif // __DICE_ERROR_H__ diff -ruN p2/l4/tool/dice/src/Exception.cpp p3/l4/tool/dice/src/Exception.cpp --- p2/l4/tool/dice/src/Exception.cpp 2006-06-14 14:24:54.000000000 +0200 +++ p3/l4/tool/dice/src/Exception.cpp 2006-11-30 10:41:05.000000000 +0100 @@ -28,7 +28,6 @@ #include "Exception.h" #include -using namespace std; CException::CException() { @@ -54,5 +53,5 @@ void CException::Print() { - cerr << m_sReason << endl; + std::cerr << m_sReason << std::endl; } diff -ruN p2/l4/tool/dice/src/Exception.h p3/l4/tool/dice/src/Exception.h --- p2/l4/tool/dice/src/Exception.h 2006-06-14 14:24:54.000000000 +0200 +++ p3/l4/tool/dice/src/Exception.h 2006-11-30 10:41:05.000000000 +0100 @@ -31,7 +31,7 @@ #define __DICE_EXCEPTION_H__ #include -using namespace std; +using std::string; /** \class CException * \ingroup backend diff -ruN p2/l4/tool/dice/src/fe/ConsistencyVisitor.cpp p3/l4/tool/dice/src/fe/ConsistencyVisitor.cpp --- p2/l4/tool/dice/src/fe/ConsistencyVisitor.cpp 2006-10-10 15:59:24.000000000 +0200 +++ p3/l4/tool/dice/src/fe/ConsistencyVisitor.cpp 2006-11-30 10:41:16.000000000 +0100 @@ -43,6 +43,7 @@ #include "FEExpression.h" #include "FEIsAttribute.h" #include "Compiler.h" +#include "Error.h" #include #include @@ -68,7 +69,7 @@ CCompiler::GccWarning(*iO2, 0, "Function name \"%s\" used before (here: %d)\n", (*iO2)->GetName().c_str(), (*iO)->GetSourceLine()); - throw consistency_error(); + throw error::consistency_error(); } } // then check in base interface @@ -100,7 +101,7 @@ "Function \"%s\" redefined. Previously defined in interface %s.\n", pFEOperation->GetName().c_str(), pFEInterface->GetName().c_str()); - throw consistency_error(); + throw error::consistency_error(); } } @@ -126,7 +127,7 @@ { CCompiler::GccError(&constant, 0, "A constant without a name has been defined."); - throw consistency_error(); + throw error::consistency_error(); } // see if this constant exists somewhere CFEConstDeclarator *pConstant = pRoot->FindConstDeclarator(sName); @@ -136,14 +137,14 @@ "Internal Compiler Error:\n" "The chaining of the front-end classes is wrong - please contact\n" \ "dice@os.inf.tu-dresden.de with a description of this error."); - throw consistency_error(); + throw error::consistency_error(); } // check if it is really me if (pConstant != &constant) { CCompiler::GccError(&constant, 0, "The constant %s is defined twice.", sName.c_str()); - throw consistency_error(); + throw error::consistency_error(); } // found me - now check the type CFETypeSpec* pType = constant.GetType(); @@ -156,7 +157,7 @@ CCompiler::GccError(&constant, 0, "The type (%s) of expression \"%s\" is not defined.\n", sTypeName.c_str(), sName.c_str()); - throw consistency_error(); + throw error::consistency_error(); } pType = pTypedef->GetType(); } @@ -164,7 +165,7 @@ { CCompiler::GccError(&constant, 0, "The expression of %s does not match its type.", sName.c_str()); - throw consistency_error(); + throw error::consistency_error(); } } @@ -205,7 +206,7 @@ CCompiler::GccError(&operation, 0, "A function with attribute [in] cannot have a return type (%s).", operation.GetName().c_str()); - throw consistency_error(); + throw error::consistency_error(); } /////////////////////////////////////////////////////////////// // check directional attribute of operation and directional attributes of @@ -247,7 +248,7 @@ CCompiler::GccError(*iterP, 0, "[out] parameter (%s) must be reference", pD->GetName().c_str()); - throw consistency_error(); + throw error::consistency_error(); } // if parameter is [out] and has a size or length parameter and is // not an array declarator, that is, has array dimensions, then @@ -258,13 +259,14 @@ ((*iterP)->m_Attributes.Find(ATTR_SIZE_IS) || (*iterP)->m_Attributes.Find(ATTR_LENGTH_IS)) && !((*iterP)->m_Attributes.Find(ATTR_MAX_IS) || - (*iterP)->m_Attributes.Find(ATTR_PREALLOC)) && + (*iterP)->m_Attributes.Find(ATTR_PREALLOC_CLIENT) || + (*iterP)->m_Attributes.Find(ATTR_PREALLOC_SERVER)) && (nStars < 2)) { CCompiler::GccError(*iterP, 0, "[out] parameter (%s) with [size_is] must have at least 2 references", pD->GetName().c_str()); - throw consistency_error(); + throw error::consistency_error(); } } } @@ -303,7 +305,7 @@ CCompiler::GccError(&operation, 0, "The operation %s has the parameter %s defined more than once.\n", operation.GetName().c_str(), sName.c_str()); - throw consistency_error(); + throw error::consistency_error(); } } } @@ -351,7 +353,7 @@ "The argument \"%s\" of attribute %s for parameter %s is not declared as a parameter or constant.\n", (*iterAttr)->GetName().c_str(), sAttribute, pDecl->GetName().c_str()); - throw consistency_error(); + throw error::consistency_error(); } } } @@ -381,7 +383,7 @@ CCompiler::GccError(&operation, 0, "Operation %s cannot have %s parameter and operation attribute %s", operation.GetName().c_str(), sOther.c_str(), sAttr.c_str()); - throw consistency_error(); + throw error::consistency_error(); } } } @@ -428,7 +430,7 @@ CCompiler::GccError(*iterA, 0, "Attribute (%d) not allowed for void return type.\n", nType); - throw consistency_error(); + throw error::consistency_error(); } break; } @@ -440,7 +442,7 @@ CCompiler::GccError(&operation, 0, "Type \"refstring\" is not a valid return type of a function (%s).", operation.GetName().c_str()); - throw consistency_error(); + throw error::consistency_error(); } } @@ -452,7 +454,7 @@ CCompiler::GccError(&type, 0, "The type %d (%s) has no consistency check implementation.", type.GetType(), typeid(type).name()); - throw consistency_error(); + throw error::consistency_error(); } /** \brief check the consistency of the array type @@ -464,7 +466,7 @@ if (!type.GetBaseType()) { CCompiler::GccError(&type, 0, "An array-type without a base type."); - throw consistency_error(); + throw error::consistency_error(); } } @@ -479,7 +481,7 @@ return; CCompiler::GccError(&type, 0, "An enum should contain at least one member."); - throw consistency_error(); + throw error::consistency_error(); } /** \brief check the consistency of a struct type @@ -555,7 +557,7 @@ { CCompiler::GccError(&type, 0, "A union without members is not allowed."); - throw consistency_error(); + throw error::consistency_error(); } } @@ -567,12 +569,12 @@ if (type.GetType() == TYPE_NONE) { CCompiler::GccError(&type, 0, "The type has no type?!"); - throw consistency_error(); + throw error::consistency_error(); } if (type.GetSize() < 0) { CCompiler::GccError(&type, 0, "Type with negative size."); - throw consistency_error(); + throw error::consistency_error(); } } @@ -587,7 +589,7 @@ if (sName.empty()) { CCompiler::GccError(&type, 0, "A user defined type without a name."); - throw consistency_error(); + throw error::consistency_error(); } // the user defined type can also reference an interface CFELibrary *pFELibrary = type.GetSpecificParent(); @@ -609,7 +611,7 @@ CCompiler::GccError(&type, 0, "User defined type \"%s\" not defined.", sName.c_str()); - throw consistency_error(); + throw error::consistency_error(); } } @@ -630,7 +632,7 @@ if (!pType) { CCompiler::GccError(&typeddecl, 0, "Typed Declarator has no type."); - throw consistency_error(); + throw error::consistency_error(); } // check type // to avoid circular calls of CheckConsitency for something like: @@ -676,7 +678,7 @@ { CCompiler::GccError(&typeddecl, 0, "The type %s is not defined.", (*iterD)->GetName().c_str()); - throw consistency_error(); + throw error::consistency_error(); } if ((pSecondType = pRoot->FindUserDefinedType((*iterD)->GetName())) != &typeddecl) @@ -723,7 +725,7 @@ (pSecondFile) ? (pSecondFile->GetFileName().c_str()) : "", pSecondType->GetSourceLine()); - throw consistency_error(); + throw error::consistency_error(); } } } @@ -787,7 +789,7 @@ CCompiler::GccError(&typeddecl, 0, "Unbound array declarator \"%s\" with direction IN needs max_is attribute", pArray->GetName().c_str()); - throw consistency_error(); + throw error::consistency_error(); } if ((!typeddecl.m_Attributes.Find(ATTR_SIZE_IS)) && (!typeddecl.m_Attributes.Find(ATTR_MAX_IS)) && @@ -796,7 +798,7 @@ CCompiler::GccError(&typeddecl, 0, "Unbound array declarator \"%s\" needs size_is, length_is or max_is attribute", pArray->GetName().c_str()); - throw consistency_error(); + throw error::consistency_error(); } } } @@ -814,13 +816,13 @@ { CCompiler::GccError(&ucase, 0, "A Union case has to be either default or have a switch value"); - throw consistency_error(); + throw error::consistency_error(); } if (!ucase.GetUnionArm()) { CCompiler::GccError(&ucase, 0, "A union case has to have a typed declarator."); - throw consistency_error(); + throw error::consistency_error(); } } diff -ruN p2/l4/tool/dice/src/fe/ConsistencyVisitor.h p3/l4/tool/dice/src/fe/ConsistencyVisitor.h --- p2/l4/tool/dice/src/fe/ConsistencyVisitor.h 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/ConsistencyVisitor.h 2006-11-30 10:41:16.000000000 +0100 @@ -32,7 +32,6 @@ #include "Visitor.h" #include "Attribute-Type.h" -#include /** \class CConsistencyVisitor * \ingroup frontend @@ -48,17 +47,6 @@ virtual ~CConsistencyVisitor() { } - /** \class consistency_error - * \ingroup frontend - * \brief exception class used when consistency check error occurs - */ - class consistency_error : public std::exception { - public: - /** \brief the constructor of the consistency_error exception - */ - explicit consistency_error(void) {} - }; - /** Declare all the visit methods for all the classes in the syntax tree. * There are two opinions on how to write this: opinion A is that the * method name should be distinct for each class and opinion B is that diff -ruN p2/l4/tool/dice/src/fe/FEArrayDeclarator.cpp p3/l4/tool/dice/src/fe/FEArrayDeclarator.cpp --- p2/l4/tool/dice/src/fe/FEArrayDeclarator.cpp 2006-10-10 15:59:24.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEArrayDeclarator.cpp 2006-11-30 10:41:16.000000000 +0100 @@ -152,8 +152,9 @@ /** \brief deletes a dimension from the vounds vectors * \param nIndex the dimension to erase * - * This function removes the bounds without returning any reference to them, so if you - * like to know where there are (e.g. keep your memory clean) get these expressions first. + * This function removes the bounds without returning any reference to them, + * so if you like to know where there are (e.g. keep your memory clean) get + * these expressions first. */ void CFEArrayDeclarator::RemoveBounds(unsigned int nIndex) { diff -ruN p2/l4/tool/dice/src/fe/FEArrayDeclarator.h p3/l4/tool/dice/src/fe/FEArrayDeclarator.h --- p2/l4/tool/dice/src/fe/FEArrayDeclarator.h 2006-06-14 14:25:15.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEArrayDeclarator.h 2006-11-30 10:41:16.000000000 +0100 @@ -32,7 +32,7 @@ #include "fe/FEDeclarator.h" #include -using namespace std; +using std::vector; class CFEExpression; diff -ruN p2/l4/tool/dice/src/fe/FEArrayType.cpp p3/l4/tool/dice/src/fe/FEArrayType.cpp --- p2/l4/tool/dice/src/fe/FEArrayType.cpp 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEArrayType.cpp 2006-11-30 10:41:16.000000000 +0100 @@ -31,7 +31,6 @@ #include "File.h" #include "Compiler.h" #include -using namespace std; CFEArrayType::CFEArrayType(CFETypeSpec * pBaseType, CFEExpression * pBound) :CFETypeSpec(TYPE_ARRAY) diff -ruN p2/l4/tool/dice/src/fe/FEAttribute.h p3/l4/tool/dice/src/fe/FEAttribute.h --- p2/l4/tool/dice/src/fe/FEAttribute.h 2006-08-28 09:44:19.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEAttribute.h 2006-11-30 10:41:16.000000000 +0100 @@ -34,7 +34,7 @@ #include "Attribute-Type.h" /** \class CFEAttribute - * \ingroup frontend + * \ingroup frontend * \brief the base class for all attributes * * the attributes of an operation or interface diff -ruN p2/l4/tool/dice/src/fe/FEBase.cpp p3/l4/tool/dice/src/fe/FEBase.cpp --- p2/l4/tool/dice/src/fe/FEBase.cpp 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEBase.cpp 2006-11-30 10:41:16.000000000 +0100 @@ -31,7 +31,6 @@ #include #include #include -using namespace std; ///////////////////////////////////////////////////////////////////////////// // Base class diff -ruN p2/l4/tool/dice/src/fe/FEBase.h p3/l4/tool/dice/src/fe/FEBase.h --- p2/l4/tool/dice/src/fe/FEBase.h 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEBase.h 2006-11-30 10:41:16.000000000 +0100 @@ -32,7 +32,6 @@ #include "Object.h" #include -using namespace std; class CFile; class CFEFile; diff -ruN p2/l4/tool/dice/src/fe/FEConstDeclarator.cpp p3/l4/tool/dice/src/fe/FEConstDeclarator.cpp --- p2/l4/tool/dice/src/fe/FEConstDeclarator.cpp 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEConstDeclarator.cpp 2006-11-30 10:41:16.000000000 +0100 @@ -36,7 +36,6 @@ #include "Visitor.h" #include #include -using namespace std; CFEConstDeclarator::CFEConstDeclarator(CFETypeSpec * pConstType, string sConstName, CFEExpression * pConstValue) { diff -ruN p2/l4/tool/dice/src/fe/FEConstDeclarator.h p3/l4/tool/dice/src/fe/FEConstDeclarator.h --- p2/l4/tool/dice/src/fe/FEConstDeclarator.h 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEConstDeclarator.h 2006-11-30 10:41:16.000000000 +0100 @@ -32,7 +32,6 @@ #include "fe/FEInterfaceComponent.h" #include -using namespace std; class CFEExpression; class CFETypeSpec; diff -ruN p2/l4/tool/dice/src/fe/FEEndPointAttribute.h p3/l4/tool/dice/src/fe/FEEndPointAttribute.h --- p2/l4/tool/dice/src/fe/FEEndPointAttribute.h 2006-08-23 19:28:00.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEEndPointAttribute.h 2006-11-30 10:41:16.000000000 +0100 @@ -33,7 +33,7 @@ #include "fe/FEAttribute.h" #include #include -using namespace std; +using std::vector; /** \struct PortSpec * \ingroup frontend diff -ruN p2/l4/tool/dice/src/fe/FEEnumType.h p3/l4/tool/dice/src/fe/FEEnumType.h --- p2/l4/tool/dice/src/fe/FEEnumType.h 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEEnumType.h 2006-11-30 10:41:16.000000000 +0100 @@ -33,7 +33,6 @@ #include "fe/FEConstructedType.h" #include "template.h" #include -using namespace std; class CFEIdentifier; diff -ruN p2/l4/tool/dice/src/fe/FEExceptionAttribute.h p3/l4/tool/dice/src/fe/FEExceptionAttribute.h --- p2/l4/tool/dice/src/fe/FEExceptionAttribute.h 2006-08-21 16:46:40.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEExceptionAttribute.h 2006-11-30 10:41:16.000000000 +0100 @@ -33,7 +33,6 @@ #include "fe/FEAttribute.h" #include "template.h" #include -using namespace std; class CFEIdentifier; diff -ruN p2/l4/tool/dice/src/fe/FEExpression.cpp p3/l4/tool/dice/src/fe/FEExpression.cpp --- p2/l4/tool/dice/src/fe/FEExpression.cpp 2006-08-23 19:28:00.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEExpression.cpp 2006-11-30 10:41:16.000000000 +0100 @@ -29,7 +29,6 @@ #include "fe/FEExpression.h" #include "File.h" #include -using namespace std; CFEExpression::CFEExpression() { diff -ruN p2/l4/tool/dice/src/fe/FEExpression.h p3/l4/tool/dice/src/fe/FEExpression.h --- p2/l4/tool/dice/src/fe/FEExpression.h 2006-08-23 19:28:00.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEExpression.h 2006-11-30 10:41:16.000000000 +0100 @@ -53,7 +53,6 @@ #include "fe/FEBase.h" #include "TypeSpec-Type.h" #include -using namespace std; /** \class CFEExpression * \ingroup frontend diff -ruN p2/l4/tool/dice/src/fe/FEFileComponent.h p3/l4/tool/dice/src/fe/FEFileComponent.h --- p2/l4/tool/dice/src/fe/FEFileComponent.h 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEFileComponent.h 2006-11-30 10:41:16.000000000 +0100 @@ -32,7 +32,6 @@ #include "fe/FEBase.h" #include -using namespace std; /** \class CFEFileComponent * \ingroup frontend diff -ruN p2/l4/tool/dice/src/fe/FEFile.cpp p3/l4/tool/dice/src/fe/FEFile.cpp --- p2/l4/tool/dice/src/fe/FEFile.cpp 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEFile.cpp 2006-11-30 10:41:16.000000000 +0100 @@ -44,7 +44,6 @@ #include #include #include -using namespace std; CFEFile::CFEFile(string sFileName, string sPath, @@ -62,7 +61,7 @@ // if the statement was: #include "l4/sys/types.h" and the path where the // file was found is "../../include" the following string are created: // - // m_sFileName = "l4/sys/types.h" + // m_sFilename = "l4/sys/types.h" // m_sFilenameWithoutExtension = "types" // m_sFileExtension = "h" // m_sFileWithPath = "../../include/l4/sys/types.h" @@ -72,19 +71,18 @@ __func__, sFileName.c_str(), sPath.c_str(), nIncludedOnLine, nStdInclude); - m_sFileName = sFileName; + m_sFilename = sFileName; // first strip of extension (the string after the last '.') - int iDot = m_sFileName.rfind('.'); + int iDot = m_sFilename.rfind('.'); if (iDot < 0) { - m_sFilenameWithoutExtension = m_sFileName; - m_sFileExtension.erase(m_sFileExtension.begin(), - m_sFileExtension.end()); + m_sFilenameWithoutExtension = m_sFilename; + m_sFileExtension.clear(); } else { - m_sFilenameWithoutExtension = m_sFileName.substr(0, iDot); - m_sFileExtension = m_sFileName.substr(iDot + 1); + m_sFilenameWithoutExtension = m_sFilename.substr(0, iDot); + m_sFileExtension = m_sFilename.substr(iDot + 1); } // now strip of the path int iSlash = m_sFilenameWithoutExtension.rfind('/'); @@ -100,10 +98,10 @@ m_sFileWithPath = sPath; if (!bLastSlash) m_sFileWithPath += "/"; - m_sFileWithPath += m_sFileName; + m_sFileWithPath += m_sFilename; } else - m_sFileWithPath = m_sFileName; + m_sFileWithPath = m_sFilename; m_nStdInclude = nStdInclude; m_nIncludedOnLine = nIncludedOnLine; @@ -115,7 +113,7 @@ CPreProcess *pPreprocess = CPreProcess::GetPreProcessor(); vector::iterator i = pPreprocess->GetFirstIncludeInFile(); CIncludeStatement *b; - while ((b = pPreprocess->GetNextIncludeInFile(m_sFileName, i)) != 0) + while ((b = pPreprocess->GetNextIncludeInFile(m_sFilename, i)) != 0) { string sIncName = b->m_sFilename; // test if idl file @@ -134,11 +132,11 @@ m_Includes.Add(pNew); // set source file info pNew->SetSourceLine(b->m_nLineNb); - pNew->SetSourceFileName(m_sFileName); + pNew->SetSourceFileName(m_sFilename); } - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s has m_sFileName: %s\n", __func__, - m_sFileName.c_str()); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s has m_sFilename: %s\n", __func__, + m_sFilename.c_str()); CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s has m_sFilenameWithoutExtension: %s\n", __func__, m_sFilenameWithoutExtension.c_str()); CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s has m_sFileExtension: %s\n", @@ -157,7 +155,7 @@ m_ChildFiles(src.m_ChildFiles), m_Includes(src.m_Includes) { - m_sFileName = src.m_sFileName; + m_sFilename = src.m_sFilename; m_sFileExtension = src.m_sFileExtension; m_sFilenameWithoutExtension = src.m_sFilenameWithoutExtension; m_sFileWithPath = src.m_sFileWithPath; @@ -182,7 +180,7 @@ */ string CFEFile::GetFileName() { - return m_sFileName; + return m_sFilename; } /** returns a reference to the user defined type @@ -463,10 +461,16 @@ */ void CFEFile::Accept(CVisitor &v) { - CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called\n", __func__); + CCompiler::Verbose(PROGRAM_VERBOSE_NORMAL, "%s called for file %s\n", + __func__, GetFileName().c_str()); + // only check consistency if this is an IDL file! + if (!IsIDLFile()) + return; // call visitor v.Visit(*this); // included files +// for_each(m_ChildFiles.begin(), m_ChildFiles.end(), +// mem_fun(&CFEFile::Accept)); vector::iterator iterF; for (iterF = m_ChildFiles.begin(); iterF != m_ChildFiles.end(); @@ -474,6 +478,14 @@ { (*iterF)->Accept(v); } + // check constants + vector::iterator iterC; + for (iterC = m_Constants.begin(); + iterC != m_Constants.end(); + iterC++) + { + (*iterC)->Accept(v); + } // check types vector::iterator iterT; for (iterT = m_Typedefs.begin(); @@ -482,13 +494,13 @@ { (*iterT)->Accept(v); } - // check constants - vector::iterator iterC; - for (iterC = m_Constants.begin(); - iterC != m_Constants.end(); - iterC++) + // check type declarations + vector::iterator iterCT; + for (iterCT = m_TaggedDeclarators.begin(); + iterCT != m_TaggedDeclarators.end(); + iterCT++) { - (*iterC)->Accept(v); + (*iterCT)->Accept(v); } // check interfaces vector::iterator iterI; @@ -590,7 +602,7 @@ */ CFEFile* CFEFile::FindFile(string sFileName) { - if (m_sFileName == sFileName) + if (m_sFilename == sFileName) return this; CFEFile *pFoundFile; vector::iterator iterF; @@ -625,7 +637,7 @@ { int sLine = (*iterI)->GetSourceLine(); int eLine = (*iterI)->GetSourceLineEnd(); - m_nSourceLineNbEnd = max(sLine, max(eLine, m_nSourceLineNbEnd)); + m_nSourceLineNbEnd = std::max(sLine, std::max(eLine, m_nSourceLineNbEnd)); } // libraries vector::iterator iterL; @@ -635,7 +647,7 @@ { int sLine = (*iterL)->GetSourceLine(); int eLine = (*iterL)->GetSourceLineEnd(); - m_nSourceLineNbEnd = max(sLine, max(eLine, m_nSourceLineNbEnd)); + m_nSourceLineNbEnd = std::max(sLine, std::max(eLine, m_nSourceLineNbEnd)); } // interfaces vector::iterator iterIF; @@ -645,7 +657,7 @@ { int sLine = (*iterIF)->GetSourceLine(); int eLine = (*iterIF)->GetSourceLineEnd(); - m_nSourceLineNbEnd = max(sLine, max(eLine, m_nSourceLineNbEnd)); + m_nSourceLineNbEnd = std::max(sLine, std::max(eLine, m_nSourceLineNbEnd)); } // typedefs vector::iterator iterTD; @@ -655,7 +667,7 @@ { int sLine = (*iterTD)->GetSourceLine(); int eLine = (*iterTD)->GetSourceLineEnd(); - m_nSourceLineNbEnd = max(sLine, max(eLine, m_nSourceLineNbEnd)); + m_nSourceLineNbEnd = std::max(sLine, std::max(eLine, m_nSourceLineNbEnd)); } // tagged types vector::iterator iterCT; @@ -665,7 +677,7 @@ { int sLine = (*iterCT)->GetSourceLine(); int eLine = (*iterCT)->GetSourceLineEnd(); - m_nSourceLineNbEnd = max(sLine, max(eLine, m_nSourceLineNbEnd)); + m_nSourceLineNbEnd = std::max(sLine, std::max(eLine, m_nSourceLineNbEnd)); } // tagged types vector::iterator iterC; @@ -675,7 +687,7 @@ { int sLine = (*iterC)->GetSourceLine(); int eLine = (*iterC)->GetSourceLineEnd(); - m_nSourceLineNbEnd = max(sLine, max(eLine, m_nSourceLineNbEnd)); + m_nSourceLineNbEnd = std::max(sLine, std::max(eLine, m_nSourceLineNbEnd)); } return m_nSourceLineNbEnd; diff -ruN p2/l4/tool/dice/src/fe/FEFile.h p3/l4/tool/dice/src/fe/FEFile.h --- p2/l4/tool/dice/src/fe/FEFile.h 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEFile.h 2006-11-30 10:41:16.000000000 +0100 @@ -34,7 +34,6 @@ #include "template.h" #include #include -using namespace std; class CFETypedDeclarator; class CFEConstDeclarator; @@ -92,10 +91,10 @@ // Attributes protected: - /** \var string m_sFileName + /** \var string m_sFilename * \brief contains the file name of the component */ - string m_sFileName; + string m_sFilename; /** \var string m_sFilenameWithoutExtension * \brief the file name without the extension */ diff -ruN p2/l4/tool/dice/src/fe/FEFunctionDeclarator.h p3/l4/tool/dice/src/fe/FEFunctionDeclarator.h --- p2/l4/tool/dice/src/fe/FEFunctionDeclarator.h 2006-08-21 16:46:40.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEFunctionDeclarator.h 2006-11-30 10:41:16.000000000 +0100 @@ -33,7 +33,6 @@ #include "fe/FEDeclarator.h" #include "template.h" #include -using namespace std; class CFETypedDeclarator; diff -ruN p2/l4/tool/dice/src/fe/FEIdentifier.cpp p3/l4/tool/dice/src/fe/FEIdentifier.cpp --- p2/l4/tool/dice/src/fe/FEIdentifier.cpp 2006-10-10 15:59:24.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEIdentifier.cpp 2006-11-30 10:41:16.000000000 +0100 @@ -28,7 +28,6 @@ #include "fe/FEIdentifier.h" #include -using namespace std; CFEIdentifier::CFEIdentifier() { diff -ruN p2/l4/tool/dice/src/fe/FEIdentifier.h p3/l4/tool/dice/src/fe/FEIdentifier.h --- p2/l4/tool/dice/src/fe/FEIdentifier.h 2006-08-21 16:46:40.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEIdentifier.h 2006-11-30 10:41:16.000000000 +0100 @@ -32,7 +32,6 @@ #include "fe/FEBase.h" #include -using namespace std; /** \class CFEIdentifier * \ingroup frontend diff -ruN p2/l4/tool/dice/src/fe/FEIDLUnionType.cpp p3/l4/tool/dice/src/fe/FEIDLUnionType.cpp --- p2/l4/tool/dice/src/fe/FEIDLUnionType.cpp 2006-06-14 14:25:15.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEIDLUnionType.cpp 2006-11-30 10:41:16.000000000 +0100 @@ -32,7 +32,6 @@ #include "Compiler.h" #include "File.h" #include -using namespace std; CFEIDLUnionType::CFEIDLUnionType(string sTag, vector *pUnionBody, diff -ruN p2/l4/tool/dice/src/fe/FEIDLUnionType.h p3/l4/tool/dice/src/fe/FEIDLUnionType.h --- p2/l4/tool/dice/src/fe/FEIDLUnionType.h 2006-08-04 18:17:18.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEIDLUnionType.h 2006-11-30 10:41:16.000000000 +0100 @@ -33,7 +33,6 @@ #include "fe/FEUnionType.h" #include #include -using namespace std; class CFEUnionCase; diff -ruN p2/l4/tool/dice/src/fe/FEInterface.cpp p3/l4/tool/dice/src/fe/FEInterface.cpp --- p2/l4/tool/dice/src/fe/FEInterface.cpp 2006-10-10 15:59:25.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEInterface.cpp 2006-11-30 10:41:16.000000000 +0100 @@ -48,7 +48,6 @@ #include #include #include -using namespace std; ///////////////////////////////////////////////////////////////////// // Interface stuff diff -ruN p2/l4/tool/dice/src/fe/FEInterface.h p3/l4/tool/dice/src/fe/FEInterface.h --- p2/l4/tool/dice/src/fe/FEInterface.h 2006-10-10 15:59:25.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEInterface.h 2006-11-30 10:41:16.000000000 +0100 @@ -36,7 +36,6 @@ #include "template.h" #include #include -using namespace std; class CFEInterface; class CFETypedDeclarator; diff -ruN p2/l4/tool/dice/src/fe/FEIsAttribute.h p3/l4/tool/dice/src/fe/FEIsAttribute.h --- p2/l4/tool/dice/src/fe/FEIsAttribute.h 2006-08-21 16:46:41.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEIsAttribute.h 2006-11-30 10:41:17.000000000 +0100 @@ -33,7 +33,6 @@ #include "fe/FEAttribute.h" #include "template.h" #include -using namespace std; class CFEDeclarator; diff -ruN p2/l4/tool/dice/src/fe/FELibrary.h p3/l4/tool/dice/src/fe/FELibrary.h --- p2/l4/tool/dice/src/fe/FELibrary.h 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FELibrary.h 2006-11-30 10:41:17.000000000 +0100 @@ -35,7 +35,6 @@ #include "template.h" #include #include -using namespace std; class CFEIdentifier; class CFETypedDeclarator; diff -ruN p2/l4/tool/dice/src/fe/FEOperation.cpp p3/l4/tool/dice/src/fe/FEOperation.cpp --- p2/l4/tool/dice/src/fe/FEOperation.cpp 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEOperation.cpp 2006-11-30 10:41:17.000000000 +0100 @@ -43,7 +43,6 @@ #include "Visitor.h" #include #include -using namespace std; CFEOperation::CFEOperation(CFETypeSpec * pReturnType, string sName, diff -ruN p2/l4/tool/dice/src/fe/FEOperation.h p3/l4/tool/dice/src/fe/FEOperation.h --- p2/l4/tool/dice/src/fe/FEOperation.h 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEOperation.h 2006-11-30 10:41:17.000000000 +0100 @@ -36,7 +36,6 @@ #include "template.h" #include #include -using namespace std; class CFEIdentifier; class CFETypeSpec; diff -ruN p2/l4/tool/dice/src/fe/FEPrimaryExpression.cpp p3/l4/tool/dice/src/fe/FEPrimaryExpression.cpp --- p2/l4/tool/dice/src/fe/FEPrimaryExpression.cpp 2006-08-23 19:28:01.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEPrimaryExpression.cpp 2006-11-30 10:41:17.000000000 +0100 @@ -28,8 +28,8 @@ #include "FEPrimaryExpression.h" #include "File.h" +#include "Compiler.h" #include -using namespace std; CFEPrimaryExpression::CFEPrimaryExpression(EXPR_TYPE nType, long int nValue) @@ -159,7 +159,7 @@ return (int) m_fValue; break; default: - TRACE("CFEPrimaryExpression::GetIntValue unrecognized\n"); + CCompiler::Warning("CFEPrimaryExpression::GetIntValue unrecognized\n"); break; } return 0; diff -ruN p2/l4/tool/dice/src/fe/FEStringAttribute.h p3/l4/tool/dice/src/fe/FEStringAttribute.h --- p2/l4/tool/dice/src/fe/FEStringAttribute.h 2006-06-14 14:25:16.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEStringAttribute.h 2006-11-30 10:41:17.000000000 +0100 @@ -31,7 +31,6 @@ #include "fe/FEAttribute.h" #include -using namespace std; /** \class CFEStringAttribute * \ingroup frontend diff -ruN p2/l4/tool/dice/src/fe/FEStructType.cpp p3/l4/tool/dice/src/fe/FEStructType.cpp --- p2/l4/tool/dice/src/fe/FEStructType.cpp 2006-10-10 15:59:25.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEStructType.cpp 2006-11-30 10:41:17.000000000 +0100 @@ -35,7 +35,6 @@ #include "Compiler.h" #include "Visitor.h" #include -using namespace std; CFEStructType::CFEStructType(string sTag, vector * pMembers) diff -ruN p2/l4/tool/dice/src/fe/FEStructType.h p3/l4/tool/dice/src/fe/FEStructType.h --- p2/l4/tool/dice/src/fe/FEStructType.h 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEStructType.h 2006-11-30 10:41:17.000000000 +0100 @@ -34,7 +34,6 @@ #include "FETypedDeclarator.h" #include "template.h" #include -using namespace std; /** \class CFEStructType * \ingroup frontend diff -ruN p2/l4/tool/dice/src/fe/FETypedDeclarator.cpp p3/l4/tool/dice/src/fe/FETypedDeclarator.cpp --- p2/l4/tool/dice/src/fe/FETypedDeclarator.cpp 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FETypedDeclarator.cpp 2006-11-30 10:41:17.000000000 +0100 @@ -47,7 +47,6 @@ #include "Visitor.h" #include #include -using namespace std; CFETypedDeclarator::CFETypedDeclarator(TYPEDDECL_TYPE nType, CFETypeSpec * pType, diff -ruN p2/l4/tool/dice/src/fe/FETypedDeclarator.h p3/l4/tool/dice/src/fe/FETypedDeclarator.h --- p2/l4/tool/dice/src/fe/FETypedDeclarator.h 2006-10-10 15:59:25.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FETypedDeclarator.h 2006-11-30 10:41:17.000000000 +0100 @@ -48,7 +48,6 @@ #include "Attribute-Type.h" // needed for the declaration of ATTR_TYPE #include "template.h" #include -using namespace std; class CFETypeSpec; diff -ruN p2/l4/tool/dice/src/fe/FETypeSpec.cpp p3/l4/tool/dice/src/fe/FETypeSpec.cpp --- p2/l4/tool/dice/src/fe/FETypeSpec.cpp 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FETypeSpec.cpp 2006-11-30 10:41:17.000000000 +0100 @@ -37,7 +37,6 @@ // needed for Error function #include "Compiler.h" #include -using namespace std; CFETypeSpec::CFETypeSpec(unsigned int nType) { diff -ruN p2/l4/tool/dice/src/fe/FEUnionCase.cpp p3/l4/tool/dice/src/fe/FEUnionCase.cpp --- p2/l4/tool/dice/src/fe/FEUnionCase.cpp 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEUnionCase.cpp 2006-11-30 10:41:17.000000000 +0100 @@ -33,7 +33,6 @@ #include "File.h" #include "Visitor.h" #include -using namespace std; CFEUnionCase::CFEUnionCase() : m_UnionCaseLabelList(0, this) diff -ruN p2/l4/tool/dice/src/fe/FEUnionCase.h p3/l4/tool/dice/src/fe/FEUnionCase.h --- p2/l4/tool/dice/src/fe/FEUnionCase.h 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEUnionCase.h 2006-11-30 10:41:17.000000000 +0100 @@ -34,7 +34,6 @@ #include "fe/FEExpression.h" #include "template.h" #include -using namespace std; class CFETypedDeclarator; diff -ruN p2/l4/tool/dice/src/fe/FEUnionType.cpp p3/l4/tool/dice/src/fe/FEUnionType.cpp --- p2/l4/tool/dice/src/fe/FEUnionType.cpp 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEUnionType.cpp 2006-11-30 10:41:17.000000000 +0100 @@ -33,7 +33,6 @@ #include "File.h" #include "Visitor.h" #include -using namespace std; CFEUnionType::CFEUnionType(string sTag, vector * pUnionBody) diff -ruN p2/l4/tool/dice/src/fe/FEUnionType.h p3/l4/tool/dice/src/fe/FEUnionType.h --- p2/l4/tool/dice/src/fe/FEUnionType.h 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEUnionType.h 2006-11-30 10:41:17.000000000 +0100 @@ -35,7 +35,6 @@ #include "template.h" #include #include -using namespace std; class CFEUnionCase; diff -ruN p2/l4/tool/dice/src/fe/FEUserDefinedExpression.cpp p3/l4/tool/dice/src/fe/FEUserDefinedExpression.cpp --- p2/l4/tool/dice/src/fe/FEUserDefinedExpression.cpp 2006-08-23 19:28:01.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEUserDefinedExpression.cpp 2006-11-30 10:41:17.000000000 +0100 @@ -34,7 +34,6 @@ // needed for Error function #include "Compiler.h" #include -using namespace std; CFEUserDefinedExpression::CFEUserDefinedExpression(string sExpName) : CFEExpression(EXPR_USER_DEFINED) diff -ruN p2/l4/tool/dice/src/fe/FEUserDefinedType.cpp p3/l4/tool/dice/src/fe/FEUserDefinedType.cpp --- p2/l4/tool/dice/src/fe/FEUserDefinedType.cpp 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEUserDefinedType.cpp 2006-11-30 10:41:18.000000000 +0100 @@ -37,7 +37,6 @@ #include "Visitor.h" #include #include -using namespace std; CFEUserDefinedType::CFEUserDefinedType(string sName) : CFETypeSpec(TYPE_USER_DEFINED) diff -ruN p2/l4/tool/dice/src/fe/FEUserDefinedType.h p3/l4/tool/dice/src/fe/FEUserDefinedType.h --- p2/l4/tool/dice/src/fe/FEUserDefinedType.h 2006-10-10 15:59:25.000000000 +0200 +++ p3/l4/tool/dice/src/fe/FEUserDefinedType.h 2006-11-30 10:41:18.000000000 +0100 @@ -32,7 +32,6 @@ #include "fe/FETypeSpec.h" #include -using namespace std; /** \class CFEUserDefinedType * \ingroup frontend diff -ruN p2/l4/tool/dice/src/fe/PostParseVisitor.cpp p3/l4/tool/dice/src/fe/PostParseVisitor.cpp --- p2/l4/tool/dice/src/fe/PostParseVisitor.cpp 2006-10-10 15:59:25.000000000 +0200 +++ p3/l4/tool/dice/src/fe/PostParseVisitor.cpp 2006-11-30 10:41:18.000000000 +0100 @@ -41,6 +41,7 @@ #include "FEIsAttribute.h" #include "FEPrimaryExpression.h" #include "Compiler.h" +#include "Error.h" #include /** \brief post parse processing for interface @@ -79,39 +80,9 @@ { CCompiler::GccError(&interface, 0, "Base interface %s not declared.", (*iterBIN)->GetName().c_str()); - throw postparse_error(); + throw error::postparse_error(); } } - - // test for version attribute - CFEVersionAttribute *pVersionAttr = - dynamic_cast(interface.m_Attributes.Find(ATTR_VERSION)); - if (pVersionAttr) - { - int nMajor, nMinor; - pVersionAttr->GetVersion(nMajor, nMinor); - if ((nMajor) || (nMinor)) - { - // version(0.0) is a reserved version number for internal use - // we add a function which returns bool and has NO parameters - // the check is hard coded on equal major and minor numbers - // create return type - CFETypeSpec *pType = new CFESimpleType(TYPE_BOOLEAN); - // create operation - CFEVersionAttribute *pOpAttr = - static_cast(pVersionAttr->Clone()); - vector *pVecAttr = new vector(); - pVecAttr->push_back(pOpAttr); - CFEOperation *pOperation = new CFEOperation(pType, - string("check_version"), 0, pVecAttr); - delete pVecAttr; - pType->SetParent(pOperation); - pOpAttr->SetParent(pOperation); - // add operation - interface.m_Operations.Add(pOperation); - } - } - } /** \brief post parse processing of operation @@ -120,18 +91,18 @@ void CPostParseVisitor::Visit(CFEOperation& operation) { // if function has both directional attributes, delete them - if (operation.m_Attributes.Find(ATTR_IN) && - operation.m_Attributes.Find(ATTR_OUT)) + CFEAttribute* pAttrIn = operation.m_Attributes.Find(ATTR_IN); + CFEAttribute* pAttrOut = operation.m_Attributes.Find(ATTR_OUT); + if (pAttrIn && pAttrOut) { - operation.m_Attributes.Remove(ATTR_IN); - operation.m_Attributes.Remove(ATTR_OUT); + operation.m_Attributes.Remove(pAttrIn); + operation.m_Attributes.Remove(pAttrOut); // already return here, because later checks rely n at least one of // the directional attributes return; } // return if neither directional attribute is set - if (!operation.m_Attributes.Find(ATTR_IN) && - !operation.m_Attributes.Find(ATTR_OUT)) + if (!pAttrIn && !pAttrOut) { // check if parameters have no directional attributes. If so, add at // least the IN attribute. @@ -149,7 +120,7 @@ // if the function has a directional attribute, then apply it to all // parameters. The consistency check will then find any mismaches. ATTR_TYPE nAttr; - if (operation.m_Attributes.Find(ATTR_IN)) + if (pAttrIn) nAttr = ATTR_IN; else nAttr = ATTR_OUT; @@ -161,8 +132,8 @@ i++) { (*i)->m_Attributes.Add(new CFEAttribute(nAttr)); - if ((*i)->m_Attributes.Find(ATTR_NONE)) - (*i)->m_Attributes.Remove(ATTR_NONE); + CFEAttribute *pAttr = (*i)->m_Attributes.Find(ATTR_NONE); + (*i)->m_Attributes.Remove(pAttr); } } @@ -249,7 +220,7 @@ CFEDeclarator *pNewDecl = new CFEDeclarator(DECL_IDENTIFIER, pArrayDecl->GetName(), pArrayDecl->GetStars()); - typeddecl.m_Declarators.Remove(pArrayDecl); + typeddecl.m_Declarators.Remove(pArrayDecl); delete pArrayDecl; typeddecl.m_Declarators.Add(pNewDecl); // because current pDecl is deleted we start all over again @@ -356,9 +327,11 @@ { pArray = new CFEArrayDeclarator(*iterD); CFEDeclarator *pDecl = *iterD; - typeddecl.m_Declarators.Remove(pDecl); + typeddecl.m_Declarators.Remove(pDecl); delete pDecl; typeddecl.m_Declarators.Add(pArray); + // because pDecl has been removed, reset iterator + iterD = typeddecl.m_Declarators.begin(); } // first add the pointer from char* if (pArray) @@ -409,9 +382,11 @@ { pArray = new CFEArrayDeclarator(*iterD); CFEDeclarator *pDecl = *iterD; - typeddecl.m_Declarators.Remove(pDecl); + typeddecl.m_Declarators.Remove(pDecl); delete pDecl; typeddecl.m_Declarators.Add(pArray); + // because pDecl has been removed, reset iterator + iterD = typeddecl.m_Declarators.begin(); } // first add the pointer from char* if (pArray) @@ -428,22 +403,27 @@ { // check for in-parameter and struct or union type // FIXME is this really what we want? (shouldn't size of struct matter?) - if (typeddecl.m_Attributes.Find(ATTR_IN)) + if (!typeddecl.m_Attributes.Find(ATTR_IN)) + return; + + // make structs reference parameters + // except they are pointers already. + if (CFETypeSpec::IsConstructedType(typeddecl.GetType()) && + !CFETypeSpec::IsPointerType(typeddecl.GetType())) { - // make structs reference parameters - // except they are pointers already. - if (CFETypeSpec::IsConstructedType(typeddecl.GetType()) && - !CFETypeSpec::IsPointerType(typeddecl.GetType())) - { - vector::iterator iterD; - for (iterD = typeddecl.m_Declarators.begin(); - iterD != typeddecl.m_Declarators.end(); - iterD++) - { - if ((*iterD)->GetStars() == 0) - (*iterD)->SetStars(1); - } - } + vector::iterator iterD; + for (iterD = typeddecl.m_Declarators.begin(); + iterD != typeddecl.m_Declarators.end(); + iterD++) + { + if ((*iterD)->GetStars() > 0) + continue; + CFEArrayDeclarator *pDecl = dynamic_cast(*iterD); + if (pDecl && pDecl->GetDimensionCount() > 0) + continue; + // stars = 0 and no array bounds + (*iterD)->SetStars(1); + } } } @@ -469,74 +449,73 @@ if (!dynamic_cast(pSizeAttrib)) pSizeAttrib = typeddecl.m_Attributes.Find(ATTR_MAX_IS); } + if (!pSizeAttrib) + return; + bool bRemoveSize = false; - if (pSizeAttrib) - { - vector::iterator iterD; - for (iterD = typeddecl.m_Declarators.begin(); - iterD != typeddecl.m_Declarators.end(); - iterD++) + vector::iterator iterD; + for (iterD = typeddecl.m_Declarators.begin(); + iterD != typeddecl.m_Declarators.end(); + iterD++) + { + CFEArrayDeclarator *pArray = + dynamic_cast(*iterD); + if (!pArray) + continue; + + // find the first unbound array dimension + int nMax = pArray->GetDimensionCount(); + for (int i = nMax - 1; i >= 0; i--) { - CFEArrayDeclarator *pArray = - dynamic_cast(*iterD); - if (pArray) - { - // find the first unbound array dimension - int nMax = pArray->GetDimensionCount(); - for (int i = nMax - 1; i >= 0; i--) - { - CFEExpression *pUpper = pArray->GetUpperBound(i); - if (!pUpper) - { - // create new expression with value of size_is/max_is - // if the value is declarator -> ignore it - if (dynamic_cast(pSizeAttrib)) - { - // use ReplaceUpperBound to set new expression. - CFEExpression *pNewBound = - new CFEPrimaryExpression(EXPR_INT, - (long int) ((CFEIntAttribute *) - pSizeAttrib)->GetIntValue()); - pArray->ReplaceUpperBound(i, pNewBound); - // remove attribute - bRemoveSize = true; - } - // test for constant in size attribute - if (dynamic_cast(pSizeAttrib)) - { - // test for parameter - CFEDeclarator *pDAttr = - ((CFEIsAttribute*)pSizeAttrib)-> - m_AttrParameters.First(); - if (pDAttr) - { - // find constant - CFEFile *pFERoot = dynamic_cast( - typeddecl.GetRoot()); - assert(pFERoot); - CFEConstDeclarator *pConstant = - pFERoot->FindConstDeclarator( - pDAttr->GetName()); - if (pConstant && pConstant->GetValue()) - { - // replace bounds - CFEExpression *pNewBound = - new CFEPrimaryExpression(EXPR_INT, - (long) pConstant->GetValue()-> - GetIntValue()); - pArray->ReplaceUpperBound(i, pNewBound); - // do not delete the size attribute - } - } - } - } - } - } - } + CFEExpression *pUpper = pArray->GetUpperBound(i); + if (pUpper) + continue; + + // create new expression with value of size_is/max_is + // if the value is declarator -> ignore it + if (dynamic_cast(pSizeAttrib)) + { + // use ReplaceUpperBound to set new expression. + CFEExpression *pNewBound = + new CFEPrimaryExpression(EXPR_INT, + (long int) ((CFEIntAttribute *) + pSizeAttrib)->GetIntValue()); + pArray->ReplaceUpperBound(i, pNewBound); + // remove attribute + bRemoveSize = true; + } + // test for constant in size attribute + if (dynamic_cast(pSizeAttrib)) + { + // test for parameter + CFEDeclarator *pDAttr = + ((CFEIsAttribute*)pSizeAttrib)-> + m_AttrParameters.First(); + if (pDAttr) + { + // find constant + CFEFile *pFERoot = dynamic_cast( + typeddecl.GetRoot()); + assert(pFERoot); + CFEConstDeclarator *pConstant = + pFERoot->FindConstDeclarator(pDAttr->GetName()); + if (pConstant && pConstant->GetValue()) + { + // replace bounds + CFEExpression *pNewBound = + new CFEPrimaryExpression(EXPR_INT, + (long)pConstant->GetValue()->GetIntValue()); + pArray->ReplaceUpperBound(i, pNewBound); + // do not delete the size attribute + } + } + } + } } - if (bRemoveSize && (pSizeAttrib)) + if (bRemoveSize) { - typeddecl.m_Attributes.Remove(pSizeAttrib->GetAttrType()); + typeddecl.m_Attributes.Remove(pSizeAttrib); + delete pSizeAttrib; } } diff -ruN p2/l4/tool/dice/src/fe/PostParseVisitor.h p3/l4/tool/dice/src/fe/PostParseVisitor.h --- p2/l4/tool/dice/src/fe/PostParseVisitor.h 2006-10-10 14:46:20.000000000 +0200 +++ p3/l4/tool/dice/src/fe/PostParseVisitor.h 2006-11-30 10:41:18.000000000 +0100 @@ -32,7 +32,6 @@ #include "Visitor.h" #include "Attribute-Type.h" -#include /** \class CPostParseVisitor * \ingroup frontend @@ -48,17 +47,6 @@ virtual ~CPostParseVisitor() { } - /** \class postparse_error - * \ingroup frontend - * \brief exception class used when consistency check error occurs - */ - class postparse_error : public std::exception { - public: - /** \brief the constructor of the postparse_error exception - */ - explicit postparse_error(void) {} - }; - /** Declare all the visit methods for all the classes in the syntax tree. * There are two opinions on how to write this: opinion A is that the * method name should be distinct for each class and opinion B is that diff -ruN p2/l4/tool/dice/src/File.cpp p3/l4/tool/dice/src/File.cpp --- p2/l4/tool/dice/src/File.cpp 2006-10-10 16:08:39.000000000 +0200 +++ p3/l4/tool/dice/src/File.cpp 2006-11-30 10:41:05.000000000 +0100 @@ -27,258 +27,95 @@ */ #include "File.h" -#include -#include CFile::CFile() { - m_fCurrent = 0; m_nIndent = 0; } -CFile::CFile(CFile & src) +CFile::CFile(CFile& src) : CObject(src) { - m_fCurrent = src.m_fCurrent; - m_sFileName = src.m_sFileName; - m_nIndent = src.m_nIndent; } -/** because the object does not really contain anything, the destructor has - * nothing to clean up - */ -CFile::~CFile() -{ -} - -/** - * \brief opens a file with a specific type - * \param sFileName the file name - * \param nStatus whether file is open for Read or Write - * \return true if open was siccessful, false otherwise +/** \brief specializaion of stream operator for strings + * \param s string parameter + * + * Here we implement the special treatment for indentation. To make it right + * we have to check if there are tabs after line-breaks. */ -bool CFile::Open(string sFileName, int nStatus) +template<> +CFile& CFile::operator<<(string s) { - if (m_fCurrent) + if (s[0] == '\t') { - return false; - } - if (sFileName.empty()) - { - if (nStatus == Read) - { - m_fCurrent = stdin; - } - if (nStatus == Write) - { - m_fCurrent = stdout; - } - } - else - { - if (nStatus == Read) - { - m_fCurrent = fopen(sFileName.c_str(), "r"); - } - if (nStatus == Write) - { - m_fCurrent = fopen(sFileName.c_str(), "w+"); - } + PrintIndent(); + *this << s.substr(1); + return *this; } - if (!m_fCurrent) - { - return false; - } - if (m_sFileName.empty()) - m_sFileName = sFileName; - m_nIndent = 0; - m_nStatus = nStatus; - return true; -} -/** - * \brief opens a file with a specific type - * \param nStatus whether the file is open for Read or Write - * \return true if open was successful, false otherwise - * - * This implementation calls the other Open function using the member - * m_sFileName as filename. This can be used to set the filename beforehand - * and then open a file later. - */ -bool CFile::Open(int nStatus) -{ - return Open(m_sFileName, nStatus); -} + string::size_type pos = s.find('\n'); + if (pos != string::npos && + pos != s.length()) + { + /* first print everything up to \n */ + m_file << s.substr(0, pos + 1); -/** - * \brief closes a file - * \return true if close was successful, false otherwise - */ -bool CFile::Close() -{ - if (fclose(m_fCurrent)) - return false; - m_fCurrent = 0; - return true; -} + /* then call ourselves with the rest */ + *this << s.substr(pos + 1); + return *this; + } -/** - * \brief prints a line into the currently open file - * \param fmt the format string for the argument list - * - * This function starts to write at the current position in the file. - */ -void CFile::Print(const char *fmt, ...) -{ - if (!m_fCurrent) - return; - va_list args; - va_start(args, fmt); - VPrint(fmt, args); - va_end(args); + /* simple string */ + m_file << s; + return *this; } -/** - * \brief prints the line into the currently open file - * \param fmt the format string for the argument list - * \param args the argument list - * - * If the first character in the line is a "\t" we eat it and - * send the rest to VPrintIndent. - * - * If the string contains a "\n" we print everything up to and - * including the "\n", and restart VPrint with the rest. +/** \brief specialization of stream operator for character arrays + * \param s character array to print */ -void CFile::VPrint(const char *fmt, va_list args) +template<> +CFile& CFile::operator<<(char const * s) { - if (!m_fCurrent) - return; - // check if there is a string - if (!fmt) - return; - // check for '\t' at beginning - if (fmt[0] == '\t') - { - VPrintIndent(&fmt[1], args); - return; - } - // check for '\n' - char *p = strchr(fmt, '\n'); - if (p && *(++p)) - { - int len = p-fmt; - char *first = (char*)malloc(len+1); - strncpy(first, fmt, len); - first[len] = 0; - // print - vfprintf(m_fCurrent, first, args); - // print rest - VPrint(p, args); - - free(first); - return; - } - // print - vfprintf(m_fCurrent, fmt, args); + this->operator<<(string(s)); + return *this; } -/** - * \brief prints the line into the currently open file - * \param str the string to write - * - * If the first character in the line is a "\t" we eat it and - * send the rest to VPrintIndent. - * - * If the string contains a "\n" we print everything up to and - * including the "\n", and restart VPrint with the rest. +/** \brief specialization of stream operator for character arrays + * \param s character array to print */ -void CFile::Prints(const char *str) +template<> +CFile& CFile::operator<<(char* s) { - if (!m_fCurrent) - return; - // check if there is a string - if (!str) - return; - // check for '\t' at beginning - if (str[0] == '\t') - { - PrintIndent("%s", &str[1]); - return; - } - // check for '\n' - char *p = strchr(str, '\n'); - if (p && *(++p)) - { - int len = p-str; - char *first = (char*)malloc(len+1); - strncpy(first, str, len); - first[len] = 0; - // print - fprintf(m_fCurrent, first); - // print rest - Prints(p); - - free(first); - return; - } - // print - fprintf(m_fCurrent, str); + this->operator<<(string(s)); + return *this; } /** - * \brief prints a line into the currently open file - * \param fmt the format string for the argument list - * - * This function starts to write the number of identify characters into the file - * and then starts to print the line. + * \brief opens a file with a specific type + * \param sFileName the file name + * \return true if open was siccessful, false otherwise */ -void CFile::PrintIndent(const char *fmt, ...) +bool CFile::Open(string sFileName) { - if (!m_fCurrent) - return; - // print - va_list args; - va_start(args, fmt); - VPrintIndent(fmt, args); - va_end(args); + if (m_file.is_open()) + return false; + m_file.open(sFileName.c_str()); + if (!m_file) + return false; + if (m_sFilename.empty()) + m_sFilename = sFileName; + m_nIndent = 0; + m_nLastIndent = 0; + return true; } -/** - * \brief prints a line into the currently open file - * \param fmt the format string for the line to print - * \param args the arguments to the format string - * - * If there is a '\n' in the string and something behind it, - * then we print everything up to and including the first - * '\n' and restart VPrint with the rest. +/** \brief prints the indentation */ -void CFile::VPrintIndent(const char *fmt, va_list args) +void CFile::PrintIndent(void) { - if (!m_fCurrent) - return; - // print indent - for (int i = 0; i < m_nIndent; i++) - fprintf(m_fCurrent, " "); - // check if there is a string - if (!fmt) - return; - // check for '\n' - char *p = strchr(fmt, '\n'); - if (p && *(++p)) - { - int len = p-fmt; - char *first = (char*)malloc(len+1); - strncpy(first, fmt, len); - first[len] = 0; - // print - vfprintf(m_fCurrent, first, args); - // print rest - VPrint(p, args); - - return; - } - // print - vfprintf(m_fCurrent, fmt, args); + for (unsigned int i = 0; i < m_nIndent; i++) + m_file << " "; } /** @@ -291,11 +128,8 @@ */ void CFile::IncIndent(int by) { - if ((m_nIndent + by) <= MAX_INDENT) - { - m_nIndent += by; - m_nLastIndent = by; - } + m_nLastIndent = (m_nIndent + by > MAX_INDENT) ? MAX_INDENT - m_nIndent : by; + m_nIndent = std::min(m_nIndent + by, MAX_INDENT); } /** @@ -308,198 +142,7 @@ */ void CFile::DecIndent(int by) { - if (by == -1) - { - by = m_nLastIndent; - m_nLastIndent = 0; - } - - if (m_nIndent > by) - m_nIndent -= by; - else - m_nIndent = 0; -} - -/** - * \brief return the name of the file - * \return the name of the currently open file, 0 if no file is open - */ -string CFile::GetFileName() -{ - return m_sFileName; -} - -/** test if the file is reading - * \return true if reading - */ -bool CFile::IsLoading() -{ - return (m_nStatus == Read); -} - -/** test if the file is writing - * \return true if writing - */ -bool CFile::IsStoring() -{ - return (m_nStatus == Write); -} - -/** \brief test whether or not file is open - * \return true if file is open - * - * This function test the current file handle member (m_fCurrent). If it is - * set to 0 the functionr eturns false. - */ -bool CFile::IsOpen() -{ - return (m_fCurrent != 0); -} - -/** \brief flushes the content of the file stream to disk - */ -void CFile::Flush() -{ - if (m_fCurrent) - fflush(m_fCurrent); -} - -/** \brief writes a string to the file - * \param f the file to write to - * \param str the string to write - * \return the File again - */ -CFile& operator << (CFile& f, const char * const str) -{ - if (str && (str[0] == '\t')) - f.PrintIndent(&str[1]); - else - f.Prints(str); - return f; -} - -/** \brief writes a string to the file - * \param f the file to write to - * \param str the string to write - * \return the File again - */ -CFile& operator << (CFile& f, string str) -{ - f.Print("%s", str.c_str()); - return f; -} - -/** \brief writes an integer to the file - * \param f the file to write to - * \param i the integer to write - * \return the File again - */ -CFile& operator << (CFile& f, const int i) -{ - f.Print("%d", i); - return f; -} - -/** \brief writes an integer to the file - * \param f the file to write to - * \param i the integer to write - * \return the File again - */ -CFile& operator << (CFile& f, const unsigned int i) -{ - f.Print("%u", i); - return f; -} - -/** \brief writes an integer to the file - * \param f the file to write to - * \param i the integer to write - * \return the File again - */ -CFile& operator << (CFile& f, const long i) -{ - f.Print("%ld", i); - return f; -} - -/** \brief writes an integer to the file - * \param f the file to write to - * \param i the integer to write - * \return the File again - */ -CFile& operator << (CFile& f, const unsigned long i) -{ - f.Print("%lu", i); - return f; -} - -#if SIZEOF_LONG_LONG > 0 - -/** \brief writes an integer to the file - * \param f the file to write to - * \param i the integer to write - * \return the File again - */ -CFile& operator << (CFile& f, const long long i) -{ - f.Print("%lld", i); - return f; -} - -/** \brief writes an integer to the file - * \param f the file to write to - * \param i the integer to write - * \return the File again - */ -CFile& operator << (CFile& f, const unsigned long long i) -{ - f.Print("%llu", i); - return f; -} - -#endif - -/** \brief writes an integer to the file - * \param f the file to write to - * \param i the integer to write - * \return the File again - */ -CFile& operator << (CFile& f, const short i) -{ - f.Print("%hd", i); - return f; -} - -/** \brief writes an integer to the file - * \param f the file to write to - * \param i the integer to write - * \return the File again - */ -CFile& operator << (CFile& f, const unsigned short i) -{ - f.Print("%hu", i); - return f; -} - -/** \brief writes an double to the file - * \param f the file to write to - * \param i the double to write - * \return the File again - */ -CFile& operator << (CFile& f, const double i) -{ - f.Print("%f", i); - return f; -} - -/** \brief writes an double to the file - * \param f the file to write to - * \param i the double to write - * \return the File again - */ -CFile& operator << (CFile& f, const long double i) -{ - f.Print("%Lf", i); - return f; + m_nIndent = std::max((int)m_nIndent - ((by == -1) ? m_nLastIndent : by), 0); + m_nLastIndent = 0; } diff -ruN p2/l4/tool/dice/src/File.h p3/l4/tool/dice/src/File.h --- p2/l4/tool/dice/src/File.h 2006-06-14 14:24:54.000000000 +0200 +++ p3/l4/tool/dice/src/File.h 2006-11-30 10:41:05.000000000 +0100 @@ -32,105 +32,99 @@ #include "Object.h" #include -using namespace std; +#include +using std::ofstream; #if defined(HAVE_CONFIG_H) #include "config.h" #endif -#define MAX_INDENT 80 /**< the maximum possible indent */ -#define STD_INDENT 04 /**< the standard indentation value */ +/** maimum possible indent */ +const unsigned int MAX_INDENT = 80; +/** the standard indentation value */ +const unsigned int STD_INDENT = 4; /** \class CFile * \ingroup base * \brief base class for all file classes + * + * Because we only write files, this class owns an ostream only. */ class CFile : public CObject { -// Constructor - public: - /** \enum FileStatus - * \brief describes the type of the file - */ - enum FileStatus - { - Read = 1, /**< file is open for read */ - Write = 2 /**< file is open for write */ - }; +// Constructors +protected: + /** copy constructor */ + CFile(CFile&src); +public: /** the constructor for this class */ CFile(); - virtual ~ CFile(); - - protected: - /** the copy constructor - * \param src the source to copy from - */ - CFile(CFile & src); // Operations - public: - virtual bool IsOpen(); - bool IsStoring(); - bool IsLoading(); - virtual string GetFileName(); +public: void DecIndent(int by = STD_INDENT); void IncIndent(int by = STD_INDENT); - + + bool Open(string sFileName); + + /** \brief return the name of the file + * \return the name of the currently open file, 0 if no file is open + */ + string GetFileName() const + { return m_sFilename; } + /** \brief test whether or not file is open + * \return true if file is open + */ + const bool IsOpen() //const + { return m_file.is_open(); } + /** flushes the content of the file stream to disk */ + void Flush() + { m_file.flush(); } /** \brief return the current indent * \return the current indent */ - int GetIndent() + unsigned int GetIndent() const { return m_nIndent; } + /** \brief closes a file + * \return true if close was successful, false otherwise + */ + void Close() + { m_file.close(); } - virtual void PrintIndent(const char *fmt, ...); - virtual void Print(const char *fmt, ...); - virtual void Prints(const char* str); - virtual bool Close(); - virtual bool Open(string sFileName, int nStatus); - virtual void Flush(); + template CFile& operator<< (T a); protected: - virtual bool Open(int nStatus); - virtual void VPrint(const char* fmt, va_list args); - virtual void VPrintIndent(const char* fmt, va_list args); + virtual void PrintIndent(void); protected: - /** \var string m_sFileName + /** \var string m_sFilename * \brief the file's name */ - string m_sFileName; - /** \var int m_nIndent + string m_sFilename; + /** \var int m_nIndent * \brief the current valid indent, when printing to the file */ - int m_nIndent; - /** \var FILE* m_fCurrent + unsigned int m_nIndent; + /** \var ofstream m_file * \brief the file handle */ - FILE *m_fCurrent; - /** \var m_nStatus - * \brief write or read file - */ - int m_nStatus; - /** \var m_nLastIndent + ofstream m_file; + /** \var m_nLastIndent * \brief remembers last increment */ int m_nLastIndent; }; -CFile& operator << (CFile& f, const char * const str); -CFile& operator << (CFile& f, string str); -CFile& operator << (CFile& f, const int i); -CFile& operator << (CFile& f, const unsigned int i); -CFile& operator << (CFile& f, const long i); -CFile& operator << (CFile& f, const unsigned long i); -#if SIZEOF_LONG_LONG > 0 -CFile& operator << (CFile& f, const long long i); -CFile& operator << (CFile& f, const unsigned long long i); -#endif -CFile& operator << (CFile& f, const short i); -CFile& operator << (CFile& f, const unsigned short i); -CFile& operator << (CFile& f, const double i); -CFile& operator << (CFile& f, const long double i); +/** \brief output data to the file + * \param a the data to by printed into the file + * \return a reference to the file + */ +template +CFile& CFile::operator<< (T a) +{ + m_file << a; + return *this; +} #endif // __DICE_FILE_H__ diff -ruN p2/l4/tool/dice/src/IncludeStatement.h p3/l4/tool/dice/src/IncludeStatement.h --- p2/l4/tool/dice/src/IncludeStatement.h 2006-10-10 16:08:39.000000000 +0200 +++ p3/l4/tool/dice/src/IncludeStatement.h 2006-11-30 10:41:05.000000000 +0100 @@ -32,7 +32,6 @@ #include "Object.h" #include -using namespace std; /** \class CIncludeStatement * \ingroup base diff -ruN p2/l4/tool/dice/src/Makefile.am p3/l4/tool/dice/src/Makefile.am --- p2/l4/tool/dice/src/Makefile.am 2006-10-10 15:57:14.000000000 +0200 +++ p3/l4/tool/dice/src/Makefile.am 2006-11-30 10:41:05.000000000 +0100 @@ -22,7 +22,7 @@ bin_PROGRAMS= dice dice_SOURCES = main.cpp Compiler.cpp CParser.cpp File.cpp Object.cpp Visitor.cpp version.cpp CCParser.cpp CCXXParser.cpp CDCEParser.cpp CCORBAParser.cpp CPreProcess.cpp IncludeStatement.cpp Exception.cpp Dependency.cpp -noinst_HEADERS = defines.h template.h Compiler.h CParser.h File.h Object.h Visitor.h ProgramOptions.h debug.h CCParser.h CCXXParser.h CDCEParser.h CCORBAParser.h CPreProcess.h TypeSpec-Type.h Attribute-Type.h IncludeStatement.h Exception.h Dependency.h +noinst_HEADERS = defines.h template.h Compiler.h CParser.h File.h Object.h Visitor.h ProgramOptions.h CCParser.h CCXXParser.h CDCEParser.h CCORBAParser.h CPreProcess.h TypeSpec-Type.h Attribute-Type.h IncludeStatement.h Exception.h Dependency.h dice_DEPENDENCIES= $(DICELIBS) diff -ruN p2/l4/tool/dice/src/Object.h p3/l4/tool/dice/src/Object.h --- p2/l4/tool/dice/src/Object.h 2006-10-10 16:08:40.000000000 +0200 +++ p3/l4/tool/dice/src/Object.h 2006-11-30 10:41:05.000000000 +0100 @@ -32,7 +32,7 @@ #include "defines.h" #include -using namespace std; +using std::string; class CVisitor; diff -ruN p2/l4/tool/dice/src/parser/corba/parser.yy p3/l4/tool/dice/src/parser/corba/parser.yy --- p2/l4/tool/dice/src/parser/corba/parser.yy 2006-10-10 15:58:15.000000000 +0200 +++ p3/l4/tool/dice/src/parser/corba/parser.yy 2006-11-30 10:41:18.000000000 +0100 @@ -31,7 +31,6 @@ #include #include #include -using namespace std; #include "defines.h" #include "Compiler.h" diff -ruN p2/l4/tool/dice/src/parser/corba/scanner.ll p3/l4/tool/dice/src/parser/corba/scanner.ll --- p2/l4/tool/dice/src/parser/corba/scanner.ll 2006-08-11 11:36:08.000000000 +0200 +++ p3/l4/tool/dice/src/parser/corba/scanner.ll 2006-11-30 10:41:18.000000000 +0100 @@ -31,7 +31,6 @@ #include #include #include -using namespace std; #include "fe/FEFile.h" #include "fe/FELibrary.h" diff -ruN p2/l4/tool/dice/src/parser/dce/parser.yy p3/l4/tool/dice/src/parser/dce/parser.yy --- p2/l4/tool/dice/src/parser/dce/parser.yy 2006-10-16 16:04:37.000000000 +0200 +++ p3/l4/tool/dice/src/parser/dce/parser.yy 2006-11-30 10:41:18.000000000 +0100 @@ -39,7 +39,6 @@ #include #include #include -using namespace std; void dceerror(char *); void dceerror2(const char *fmt, ...); @@ -201,7 +200,7 @@ %token DEFAULT_FUNCTION ERROR_FUNCTION ERROR_FUNCTION_CLIENT ERROR_FUNCTION_SERVER %token INIT_RCVSTRING INIT_RCVSTRING_CLIENT INIT_RCVSTRING_SERVER INIT_WITH_IN %token PREALLOC ABSTRACT INOUT MODULE READONLY ALLOW_REPLY_ONLY -%token ONEWAY CALLBACK +%token ONEWAY CALLBACK PREALLOC_CLIENT PREALLOC_SERVER /* dice specific token */ %token EOF_TOKEN NOOPCODE NOEXCEPTIONS @@ -384,7 +383,8 @@ ((CFEInterface*)pCurFileComponent)->m_Typedefs.Add($1); else { - TRACE("current file component is unknown type: %s\n", + CCompiler::GccError(NULL, 0, + "current file component is unknown type: %s\n", typeid(*pCurFileComponent).name()); assert(false); } @@ -1055,7 +1055,8 @@ ((CFEInterface*)pCurFileComponent)->m_Typedefs.Add($1); else { - TRACE("current file component is unknown type: %s\n", + CCompiler::GccError(NULL, 0, + "current file component is unknown type: %s\n", typeid(*pCurFileComponent).name()); assert(false); } @@ -1074,7 +1075,8 @@ ((CFEInterface*)pCurFileComponent)->m_Constants.Add($1); else { - TRACE("current file component is unknown type: %s\n", + CCompiler::GccError(NULL, 0, + "current file component is unknown type: %s\n", typeid(*pCurFileComponent).name()); assert(false); } @@ -1093,7 +1095,8 @@ ((CFEInterface*)pCurFileComponent)->m_TaggedDeclarators.Add($1); else { - TRACE("current file component is unknown type: %s\n", + CCompiler::GccError(NULL, 0, + "current file component is unknown type: %s\n", typeid(*pCurFileComponent).name()); assert(false); } @@ -2654,7 +2657,8 @@ ((CFEInterface*)pCurFileComponent)->m_Operations.Add(pOp); else { - TRACE("current file component is unknown type: %s\n", + CCompiler::GccError(NULL, 0, + "current file component is unknown type: %s\n", typeid(*pCurFileComponent).name()); assert(false); } @@ -2682,7 +2686,9 @@ ((CFEInterface*)pCurFileComponent)->m_Operations.Add(pOp); else { - TRACE("current file component is unknown type: %s\n", typeid(*pCurFileComponent).name()); + CCompiler::GccError(NULL, 0, + "current file component is unknown type: %s\n", + typeid(*pCurFileComponent).name()); assert(false); } } @@ -2709,7 +2715,9 @@ ((CFEInterface*)pCurFileComponent)->m_Operations.Add(pOp); else { - TRACE("current file component is unknown type: %s\n", typeid(*pCurFileComponent).name()); + CCompiler::GccError(NULL, 0, + "current file component is unknown type: %s\n", + typeid(*pCurFileComponent).name()); assert(false); } } @@ -2735,7 +2743,9 @@ ((CFEInterface*)pCurFileComponent)->m_Operations.Add(pOp); else { - TRACE("current file component is unknown type: %s\n", typeid(*pCurFileComponent).name()); + CCompiler::GccError(NULL, 0, + "current file component is unknown type: %s\n", + typeid(*pCurFileComponent).name()); assert(false); } } @@ -2979,14 +2989,23 @@ | field_attribute | INIT_WITH_IN { - $$ = new CFEAttribute(ATTR_PREALLOC); - $$->SetSourceLine(gLineNumber); + dceerror2("[init_with_in] is deprecated. Use [prealloc_client] and/or [prealloc_server]."); + YYABORT; } | PREALLOC { - // is the IDL4 version of "init_with_in" - $$ = new CFEAttribute(ATTR_PREALLOC); - $$->SetSourceLine(gLineNumber); + dceerror2("[prealloc] is deprecated. Use [prealloc_client] and/or [prealloc_server]."); + YYABORT; + } + | PREALLOC_CLIENT + { + $$ = new CFEAttribute(ATTR_PREALLOC_CLIENT); + $$->SetSourceLine(gLineNumber); + } + | PREALLOC_SERVER + { + $$ = new CFEAttribute(ATTR_PREALLOC_SERVER); + $$->SetSourceLine(gLineNumber); } | TRANSMIT_AS LPAREN simple_type_spec RPAREN { @@ -3392,7 +3411,8 @@ ((CFEInterface*)pCurFileComponent)->m_Typedefs.Add($1); else { - TRACE("current file component is unknown type: %s\n", + CCompiler::GccError(NULL, 0, + "current file component is unknown type: %s\n", typeid(*pCurFileComponent).name()); assert(false); } @@ -3412,7 +3432,8 @@ ((CFEInterface*)pCurFileComponent)->m_Constants.Add($1); else { - TRACE("current file component is unknown type: %s\n", + CCompiler::GccError(NULL, 0, + "current file component is unknown type: %s\n", typeid(*pCurFileComponent).name()); assert(false); } @@ -3429,7 +3450,8 @@ ((CFEInterface*)pCurFileComponent)->m_TaggedDeclarators.Add($1); else { - TRACE("current file component is unknown type: %s\n", + CCompiler::GccError(NULL, 0, + "current file component is unknown type: %s\n", typeid(*pCurFileComponent).name()); assert(false); } @@ -3464,7 +3486,8 @@ ((CFEInterface*)pCurFileComponent)->m_AttributeDeclarators.Add(pAttr); else { - TRACE("current file component is unknown type: %s\n", + CCompiler::GccError(NULL, 0, + "current file component is unknown type: %s\n", typeid(*pCurFileComponent).name()); assert(false); } @@ -3491,7 +3514,8 @@ ((CFEInterface*)pCurFileComponent)->m_AttributeDeclarators.Add(pAttr); else { - TRACE("current file component is unknown type: %s\n", + CCompiler::GccError(NULL, 0, + "current file component is unknown type: %s\n", typeid(*pCurFileComponent).name()); assert(false); } diff -ruN p2/l4/tool/dice/src/parser/dce/scanner.ll p3/l4/tool/dice/src/parser/dce/scanner.ll --- p2/l4/tool/dice/src/parser/dce/scanner.ll 2006-08-11 11:36:09.000000000 +0200 +++ p3/l4/tool/dice/src/parser/dce/scanner.ll 2006-11-30 10:41:18.000000000 +0100 @@ -32,7 +32,6 @@ #include #include #include -using namespace std; #include "fe/FEUnaryExpression.h" // for enum EXPT_OPERATOR @@ -424,6 +423,8 @@ server_parameter RETURN_IF_ATTR(SERVER_PARAMETER) init_with_in RETURN_IF_ATTR(INIT_WITH_IN) prealloc RETURN_IF_ATTR(PREALLOC) +prealloc_client RETURN_IF_ATTR(PREALLOC_CLIENT) +prealloc_server RETURN_IF_ATTR(PREALLOC_SERVER) allow_reply_only RETURN_IF_ATTR(ALLOW_REPLY_ONLY) hidden RETURN_IF_ATTR(HIDDEN) lcid RETURN_IF_ATTR(LCID) diff -ruN p2/l4/tool/dice/src/parser/gcc-c/parser.yy p3/l4/tool/dice/src/parser/gcc-c/parser.yy --- p2/l4/tool/dice/src/parser/gcc-c/parser.yy 2006-10-16 16:04:37.000000000 +0200 +++ p3/l4/tool/dice/src/parser/gcc-c/parser.yy 2006-11-30 10:41:18.000000000 +0100 @@ -65,7 +65,6 @@ #include #include #include -using namespace std; #include "parser.h" int gcc_clex(YYSTYPE*); @@ -956,7 +955,8 @@ ((CFEInterface*)pCurFileComponent)->m_TaggedDeclarators.Add(pT); else { - TRACE("current file component is unknown type: %s\n", + CCompiler::GccError(NULL, 0, + "current file component is unknown type: %s\n", typeid(*pCurFileComponent).name()); assert(false); } @@ -1063,7 +1063,9 @@ ((CFEInterface*)pCurFileComponent)->m_Typedefs.Add(pTypedef); else { - TRACE("current file component is unknown type: %s\n", typeid(*pCurFileComponent).name()); + CCompiler::GccError(NULL, 0, + "current file component is unknown type: %s\n", + typeid(*pCurFileComponent).name()); assert(false); } } diff -ruN p2/l4/tool/dice/src/parser/gcc-c/scanner.ll p3/l4/tool/dice/src/parser/gcc-c/scanner.ll --- p2/l4/tool/dice/src/parser/gcc-c/scanner.ll 2006-08-11 11:36:09.000000000 +0200 +++ p3/l4/tool/dice/src/parser/gcc-c/scanner.ll 2006-11-30 10:41:18.000000000 +0100 @@ -33,7 +33,6 @@ #include #include #include -using namespace std; #include "fe/FEFile.h" #include "fe/FELibrary.h" diff -ruN p2/l4/tool/dice/src/parser/gcc-cxx/scanner.ll p3/l4/tool/dice/src/parser/gcc-cxx/scanner.ll --- p2/l4/tool/dice/src/parser/gcc-cxx/scanner.ll 2006-08-11 11:36:09.000000000 +0200 +++ p3/l4/tool/dice/src/parser/gcc-cxx/scanner.ll 2006-11-30 10:41:19.000000000 +0100 @@ -31,7 +31,6 @@ #include #include #include -using namespace std; #include "fe/FEFile.h" #include "parser/gcc-cxx/parser.h" diff -ruN p2/l4/tool/dice/src/parser/inc/scanner.ll p3/l4/tool/dice/src/parser/inc/scanner.ll --- p2/l4/tool/dice/src/parser/inc/scanner.ll 2006-08-23 19:28:01.000000000 +0200 +++ p3/l4/tool/dice/src/parser/inc/scanner.ll 2006-11-30 10:41:19.000000000 +0100 @@ -32,7 +32,6 @@ #include #include #include -using namespace std; #include "CPreProcess.h" #include "fe/FEFile.h" #include "Compiler.h" @@ -113,8 +112,6 @@ (\r)?\n { gLineNumber++; fprintf(yyout, "\n"); -// TRACE("inc-scan: line++ in comment (%s:%d)\n", -// sInFileName.c_str(), gLineNumber); } "#"[ \t]*"include"[ \t]+"\"" { @@ -161,8 +158,6 @@ // if we did not include it at the same spot before // (return value of AddInclude) FILE *fInput = 0; -// TRACE("AddInclude(%s, %s, %d)\n", sFilename.c_str(), -// sInFileName.c_str(), gLineNumber); if (!pPreProcess->AddInclude(sFilename, sInFileName, gLineNumber, bImport, bStandard) && (sExt == "idl")) @@ -188,8 +183,6 @@ // set filename and line number sInFileName = sFilename; gLineNumber = 1; // starts right in the new buffer -// TRACE("inc-scan: switched to %s start at line %d\n", -// sInFileName.c_str(), gLineNumber); // print preprocessing line statement fprintf(yyout, "# 1 \"%s\" 1\n", yytext); // create new buffer @@ -212,8 +205,6 @@ BEGIN(INITIAL); fprintf(yyout, "\n"); gLineNumber++; -// TRACE("inc-scan: line++ in include (%s:%d)\n", -// sInFileName.c_str(), gLineNumber); } "#line" BEGIN(line); [ \t]+ /* eat whitespace */ @@ -226,26 +217,18 @@ fprintf(yyout, "#line %d %s", gLineNumber, yytext); gLineNumber--; // to skip newline at end of this directive BEGIN(INITIAL); -// TRACE("inc-scan: line-- in line (%s:%d)\n", -// sInFileName.c_str(), gLineNumber); } (\r)?\n { fprintf(yyout, "#line %d\n", gLineNumber); BEGIN(INITIAL); -// TRACE("inc-scan: line keep in line (%s:%d)\n", -// sInFileName.c_str(), gLineNumber); } (\r)?\n { fprintf(yyout, "\n"); gLineNumber++; -// TRACE("inc-scan: line++ in INITIAL (%s:%d)\n", -// sInFileName.c_str(), gLineNumber); } \f { gLineNumber++; fprintf(yyout, "\n"); -// TRACE("inc-scan: page-feed line++ (%s:%d)\n", -// sInFileName.c_str(), gLineNumber); } <> { @@ -270,8 +253,6 @@ // will also be printed after this statement fprintf(yyout, "# %d \"%s\" 2", gLineNumber+1, sInFileName.c_str()); -// TRACE("inc-scan: switch back to old stack (%s:%d)\n", -// sInFileName.c_str(), gLineNumber); } else diff -ruN p2/l4/tool/dice/src/ProgramOptions.h p3/l4/tool/dice/src/ProgramOptions.h --- p2/l4/tool/dice/src/ProgramOptions.h 2006-08-28 09:44:18.000000000 +0200 +++ p3/l4/tool/dice/src/ProgramOptions.h 2006-11-30 10:41:05.000000000 +0100 @@ -108,6 +108,7 @@ PROGRAM_VERBOSE_NORMAL, /**< normal verboseness level (-v) */ PROGRAM_VERBOSE_PARSER, /**< the verboseness level of the parser */ PROGRAM_VERBOSE_SCANNER, /**< scanner is more verbose than parser */ + PROGRAM_VERBOSE_DEBUG, /**< debug output */ PROGRAM_VERBOSE_MAXLEVEL /**< the maximum verbose level */ }; diff -ruN p2/l4/tool/dice/src/template.h p3/l4/tool/dice/src/template.h --- p2/l4/tool/dice/src/template.h 2006-10-13 18:29:50.000000000 +0200 +++ p3/l4/tool/dice/src/template.h 2006-11-30 10:41:06.000000000 +0100 @@ -30,6 +30,7 @@ #include "defines.h" #include +using std::vector; #include template @@ -139,31 +140,14 @@ vector::insert(pos, pAdd); } - /** \brief remove a specific member from the vector - * \param pRem the member to remove - */ - void Remove(T* pRem) - { - if (!pRem) - return; - typename vector::iterator i = - find(vector::begin(), vector::end(), pRem); - if (i != vector::end()) - { - vector::erase(i); - return; - } - } - /** \brief return reference to firt element in vector or NULL if empty * \return reference to first element in vector */ T* First(void) { - typename vector::iterator i = vector::begin(); - if (i == vector::end()) + if (vector::empty()) return (T*)0; - return *i; + return vector::front(); } /** \brief "adopt" all elements of the vector @@ -182,6 +166,20 @@ ++i) SetParent(*i); } + + /** \brief remove an element from the collection + * \param pRem the element to remove + */ + void Remove(T* pRem) + { + if (!pRem) + return; + typename vector::iterator i = std::find(vector::begin(), + vector::end(), pRem); + if (i == vector::end()) + return; + erase(i); + } }; template @@ -213,36 +211,22 @@ */ T* Find(KeyT key) { - typename vector::iterator i; - for (i = vector::begin(); - i != vector::end(); - i++) - { - if ((*i)->Match(key)) - return *i; - } + typename vector::iterator i = std::find_if(vector::begin(), + vector::end(), std::bind2nd(std::ptr_fun(Match), key)); + if (i != vector::end()) + return *i; return (T*)0; } - /** \brief remove all member matching the given key - * \param key the key to use for comparison - */ - void Remove(KeyT key) - { - T* pEl; - while ((pEl = Find(key)) != 0) - { - CCollection::Remove(pEl); - delete pEl; - } - } - - /** \brief wrap remove operation of collection to shadow remove with key - * \param pRem the member to remove - */ - void Remove(T* pRem) - { - CCollection::Remove(pRem); +private: + /** \brief alias function to call object's match function + * \param o the object to use + * \param k the key to find + * \return true if object's Match function with k returns true + */ + static bool Match(T* o, KeyT k) + { + return o->Match(k); } }; diff -ruN p2/l4/tool/dice/src/TypeSpec-Type.h p3/l4/tool/dice/src/TypeSpec-Type.h --- p2/l4/tool/dice/src/TypeSpec-Type.h 2006-10-10 16:08:40.000000000 +0200 +++ p3/l4/tool/dice/src/TypeSpec-Type.h 2006-11-30 10:41:06.000000000 +0100 @@ -74,6 +74,7 @@ TYPE_GCC, /**< GCC: gcc specific type (can be ignored) */ TYPE_MWORD, /**< DICE: used to get the size and string for a machine word */ TYPE_EXCEPTION, /**< DICE: CORBA exception type */ + TYPE_MESSAGE, /**< DICE: used to determine (maximum) size for messages */ TYPE_MAX /**< delimiter value */ }; diff -ruN p2/l4/tool/dice/src/Visitor.h p3/l4/tool/dice/src/Visitor.h --- p2/l4/tool/dice/src/Visitor.h 2006-10-10 14:46:16.000000000 +0200 +++ p3/l4/tool/dice/src/Visitor.h 2006-11-30 10:41:06.000000000 +0100 @@ -84,7 +84,7 @@ /** empty default constructor */ CVisitor() { } - /** empty destructor */ + /** virtual destructor */ virtual ~CVisitor() { } diff -ruN p2/l4lx/.config p3/l4lx/.config --- p2/l4lx/.config 2006-11-20 11:11:08.000000000 +0100 +++ p3/l4lx/.config 2006-12-05 15:49:44.000000000 +0100 @@ -542,11 +542,7 @@ # # Serial drivers # -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_NR_UARTS=4 -CONFIG_SERIAL_8250_RUNTIME_UARTS=4 -# CONFIG_SERIAL_8250_EXTENDED is not set +# CONFIG_SERIAL_8250 is not set # # Non-8250 serial port support @@ -566,8 +562,7 @@ # Watchdog Cards # # CONFIG_WATCHDOG is not set -CONFIG_HW_RANDOM=y -CONFIG_HW_RANDOM_VIA=y +# CONFIG_HW_RANDOM is not set # CONFIG_NVRAM is not set # CONFIG_RTC is not set # CONFIG_GEN_RTC is not set