⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defs.py

📁 编译工具
💻 PY
📖 第 1 页 / 共 5 页
字号:
# -*- python -*-#                           Package   : omniidl# defs.py                   Created on: 1999/11/2#			    Author    : David Scott (djs)##    Copyright (C) 1999 AT&T Laboratories Cambridge##  This file is part of omniidl.##  omniidl is free software; you can redistribute it and/or modify it#  under the terms of the GNU General Public License as published by#  the Free Software Foundation; either version 2 of the License, or#  (at your option) any later version.##  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., 59 Temple Place - Suite 330, Boston, MA#  02111-1307, USA.## Description:#   #   Produce the main header definitions for the C++ backend# $Id: defs.py,v 1.33.2.17 2005/12/30 17:40:22 dgrisby Exp $# $Log: defs.py,v $# Revision 1.33.2.17  2005/12/30 17:40:22  dgrisby# Previously extern inline functions are now just inline or static# inline when inside classes.## Revision 1.33.2.16  2004/07/23 14:07:04  dgrisby# Subtly incorrect generated code for arrays.## Revision 1.33.2.15  2003/03/31 15:35:08  dgrisby# Code generated for forward declared structs inside interfaces would# not compile on MSVC.## Revision 1.33.2.14  2001/10/29 17:42:39  dpg1# Support forward-declared structs/unions, ORB::create_recursive_tc().## Revision 1.33.2.13  2001/10/18 12:45:28  dpg1# IDL compiler tweaks.## Revision 1.33.2.12  2001/08/17 13:45:55  dpg1# C++ mapping fixes.## Revision 1.33.2.11  2001/08/15 10:29:53  dpg1# Update DSI to use Current, inProcessIdentity.## Revision 1.33.2.10  2001/07/31 19:25:11  sll#  Array _var should be separated into fixed and variable size ones.## Revision 1.33.2.9  2001/07/26 11:27:26  dpg1# Typo in C++ back-end broke wstring constants.## Revision 1.33.2.8  2001/06/08 17:12:16  dpg1# Merge all the bug fixes from omni3_develop.## Revision 1.33.2.7  2001/03/13 10:32:08  dpg1# Fixed point support.## Revision 1.33.2.6  2000/11/20 14:43:25  sll# Added support for wchar and wstring.## Revision 1.33.2.5  2000/11/10 15:40:52  dpg1# Missed an update in yesterday's merge.## Revision 1.33.2.4  2000/11/07 18:29:56  sll# Choose a default constant not too large to avoid g++ complaining.## Revision 1.33.2.3  2000/11/03 19:19:46  sll# visitTypedef() just rely on types.base() to give the right type name for# object reference, instead of adding in a "_ptr" suffix.## Revision 1.33.2.2  2000/10/12 15:37:50  sll# Updated from omni3_1_develop.## Revision 1.34.2.3  2000/08/21 11:35:15  djs# Lots of tidying## Revision 1.34.2.2  2000/08/04 17:10:29  dpg1# Long long support## Revision 1.34.2.1  2000/08/02 10:52:02  dpg1# New omni3_1_develop branch, merged from omni3_develop.## Revision 1.34  2000/07/13 15:26:00  dpg1# Merge from omni3_develop for 3.0 release.## Revision 1.31.2.19  2000/08/03 21:27:39  djs# Typo in -Wbvirtual_objref code caused incorrect operation signatures to be# generated in the _objref class of an interface.## Revision 1.31.2.18  2000/07/26 15:29:08  djs# Missing typedef and forward when generating BOA skeletons## Revision 1.31.2.17  2000/07/18 15:34:25  djs# Added -Wbvirtual_objref option to make attribute and operation _objref# methods virtual## Revision 1.31.2.16  2000/07/12 17:16:11  djs# Minor bugfix to option -Wbsplice-modules## Revision 1.31.2.15  2000/06/27 16:15:10  sll# New classes: _CORBA_String_element, _CORBA_ObjRef_Element,# _CORBA_ObjRef_tcDesc_arg to support assignment to an element of a# sequence of string and a sequence of object reference.## Revision 1.31.2.14  2000/06/26 16:23:57  djs# Better handling of #include'd files (via new commandline options)# Refactoring of configuration state mechanism.## Revision 1.31.2.13  2000/06/19 18:19:49  djs# Implemented union discriminant setting function _d(_value) with checks for# illegal uses (setting to a label corresponding to a non-current member and# setting before initialisation)## Revision 1.31.2.12  2000/06/16 08:36:40  djs# For a union with a boolean discriminant and an implied default, sets a# better default discriminator in _default()## Revision 1.31.2.11  2000/06/05 13:03:55  djs# Removed union member name clash (x & pd_x, pd__default, pd__d)# Removed name clash when a sequence is called "pd_seq"# Nested union within union fix# Actually generates BOA non-flattened tie templates## Revision 1.31.2.10  2000/05/31 18:02:56  djs# Better output indenting (and preprocessor directives now correctly output at# the beginning of lines)## Revision 1.31.2.9  2000/05/30 15:59:23  djs# Removed inheritance ambiguity in generated BOA _sk_ and POA_ classes## Revision 1.31.2.8  2000/05/18 15:57:32  djs# Added missing T* data constructor for bounded sequence types## Revision 1.31.2.7  2000/05/04 14:35:02  djs# Added new flag splice-modules which causes all continuations to be output# as one lump. Default is now to output them in pieces following the IDL.## Revision 1.31.2.6  2000/04/26 18:22:28  djs# Rewrote type mapping code (now in types.py)# Rewrote identifier handling code (now in id.py)## Revision 1.31.2.5  2000/04/05 10:57:37  djs# Minor source tidying (removing commented out blocks)## Revision 1.31.2.4  2000/03/24 17:18:48  djs# Missed _ from typedefs to objrefs## Revision 1.31.2.3  2000/03/24 16:24:22  djs# Produced 2 invalid typedefs in the case of a typedef to an object reference# (it transformed a " " into a "_" by mistake)## Revision 1.31.2.2  2000/03/20 11:50:18  djs# Removed excess buffering- output templates have code attached which is# lazily evaluated when required.## Revision 1.31.2.1  2000/02/14 18:34:55  dpg1# New omniidl merged in.## Revision 1.31  2000/01/19 11:23:27  djs# Moved most C++ code to template file## Revision 1.30  2000/01/18 18:05:52  djs# Extracted most C++ from header/defs and put in a template file.# General refactoring.## Revision 1.29  2000/01/17 17:01:49  djs# Many fixes including:#   Module continuations#   Constructed types#   Union discriminator handling## Revision 1.28  2000/01/14 17:38:27  djs# Preliminary support for unions with multiple case labels## Revision 1.27  2000/01/13 17:02:00  djs# Added support for operation contexts.## Revision 1.26  2000/01/13 15:56:38  djs# Factored out private identifier prefix rather than hard coding it all through# the code.## Revision 1.25  2000/01/13 14:16:29  djs# Properly clears state between processing separate IDL input files## Revision 1.24  2000/01/12 17:48:31  djs# Added option to create BOA compatible skeletons (same as -BBOA in omniidl3)## Revision 1.23  2000/01/11 14:13:15  djs# Updated array mapping to include NAME_copy(to, from) as per 2.3 spec## Revision 1.22  2000/01/11 11:34:27  djs# Added support for fragment generation (-F) mode## Revision 1.21  2000/01/10 16:13:13  djs# Removed a chunk of redundant code.## Revision 1.20  2000/01/10 15:38:55  djs# Better name and scope handling.## Revision 1.19  2000/01/07 20:31:27  djs# Regression tests in CVSROOT/testsuite now pass for#   * no backend arguments#   * tie templates#   * flattened tie templates#   * TypeCode and Any generation## Revision 1.18  1999/12/26 16:43:06  djs# Enum scope fix# Handling default case of char discriminated switch fixed## Revision 1.17  1999/12/25 21:47:18  djs# Better TypeCode support## Revision 1.16  1999/12/24 18:14:29  djs# Fixed handling of #include'd .idl files## Revision 1.15  1999/12/16 16:10:46  djs# TypeCode fixes## Revision 1.14  1999/12/15 12:13:16  djs# Multiple forward declarations of interface fix## Revision 1.13  1999/12/14 17:38:22  djs# Fixed anonymous sequences of sequences bug## Revision 1.12  1999/12/14 11:52:30  djs# Support for CORBA::TypeCode and CORBA::Any## Revision 1.11  1999/12/01 17:03:15  djs# Added support for Typecodes and Anys## Revision 1.10  1999/11/23 18:46:34  djs# Constant fixes# Moved exception constructor argument generator into a more central place## Revision 1.9  1999/11/19 20:08:09  djs# Removed references to a non-existant utility function## Revision 1.8  1999/11/15 19:12:45  djs# Tidied up sequence template handling# Moved useful functions into separate utility module## Revision 1.7  1999/11/12 17:18:39  djs# Lots of header generation bugfixes## Revision 1.6  1999/11/10 20:19:43  djs# Array struct element fix# Union sequence element fix## Revision 1.5  1999/11/08 19:29:03  djs# Rewrite of sequence template code# Fixed lots of typedef problems## Revision 1.4  1999/11/04 19:05:08  djs# Finished moving code from tmp_omniidl. Regression tests ok.## Revision 1.3  1999/11/03 18:18:12  djs# Struct and Exception fixes## Revision 1.2  1999/11/03 17:35:11  djs# Brought more of the old tmp_omniidl code into the new tree## Revision 1.1  1999/11/03 11:09:56  djs# General module renaming#"""Produce the main header definitions"""# similar to o2be_root::produce_hdr_defs in the old C++ BEimport stringfrom omniidl import idlast, idltype, idlutilfrom omniidl_be.cxx import output, config, id, types, iface, cxx, ast, utilfrom omniidl_be.cxx.header import templateimport defsself = defsdef __init__(stream):    defs.stream = stream    # Need to keep track of how deep within the AST we are.    # In a recursive procedure these would be extra arguments,    # but the visitor pattern necessitates them being global.    self.__insideInterface = 0    self.__insideModule    = 0    self.__insideClass     = 0    # A repository id entry in this hash indicates that an interface    # has been declared- therefore any more AST forward nodes for this    # interface are ignored.    self.__interfaces = {}    # When we first encounter a module, we sometimes deal with all the    # continuations straight away. Therefore when we reencounter a    # continuation later, we don't duplicate the definitions.    self.__completedModules = {}    return defs# Returns the prefix required inside a const declaration (it depends on# exactly what the declaration is nested inside)def const_qualifier(insideModule, insideClass):    if not insideModule and not insideClass:        return "_CORBA_GLOBAL_VAR"    elif insideClass:        return "static"    else:        return "_CORBA_MODULE_VAR"# Same logic for function qualifiersdef func_qualifier():    return const_qualifier(__insideModule, __insideClass)# Inline functions are subtly differentdef inline_qualifier():    if not __insideModule and not __insideClass:        return "inline"    elif __insideClass:        return "static inline"    else:        return "_CORBA_MODULE_INLINE"#

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -