Orbix Code Generation Toolkit Programmer’s Guide Code Generation Toolkit...

download Orbix Code Generation Toolkit Programmer’s Guide Code Generation Toolkit Programmer’s Guide vi Creating

of 313

  • date post

    29-Jun-2018
  • Category

    Documents

  • view

    215
  • download

    0

Embed Size (px)

Transcript of Orbix Code Generation Toolkit Programmer’s Guide Code Generation Toolkit...

  • Orbix Code Generation Toolkit Programmers Guide

    IONA Technologies PLCFebruary 1999

  • Orbix and OrbixWeb are Registered Trademarks of IONA Technologies PLC.While the information in this publication is believed to be accurate, IONA Technologies PLC makes no warranty of any kind to this material including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. IONA Technologies PLC shall not be liable for errors contained herein, or for incidental or consequential damages in connection with the furnishing, performance or use of this material.Java is a trademark of Sun Microsystems, Inc. Visual Studio is a trademark of Microsoft Corp.COPYRIGHT NOTICENo part of this publication may be reproduced, stored in a retrieval system or transmitted, in any form or by any means, photocopying, recording or otherwise, without prior written consent of IONA Technologies PLC. No third party intellectual property right liability is assumed with respect to the use of the information contained herein. IONA Technologies PLC assumes no responsibility for errors or omissions contained in this book. This publication and features described herein are subject to change without notice.Copyright 1999 IONA Technologies PLC. All rights reserved. All products or services mentioned in this manual are covered by the trademarks, service marks, or product names as designated by the companies who market those products.M 2 2 4 4

  • The Orbix Code Generation Tool contains the product CFE which is used subject to the following license:Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the UnitedStates of America. All Rights Reserved. This product is protected by copyright and distributed under the following license restricting its use.The Interface Definition Language Compiler Front End (CFE) is made available for your use provided that you include this license and copyright notice on all media and documentation and the software program in which this product is incorporated in whole or part. You may copy and extend functionality (but may not remove functionality) of the Interface Definition Language CFE without charge, but you are not authorized to license or distribute it to anyone else except as part of a product or program developed by you or with the express written consent of Sun Microsystems, Inc. ("Sun").The names of Sun Microsystems, Inc. and any of its subsidiaries or affiliates may not be used in advertising or publicity pertaining to distribution of Interface Definition Language CFE as permitted herein.This license is effective until terminated by Sun for failure to comply with this license. Upon termination, you shall destroy or return all code and documentation for the Interface Definition Language CFE.INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.Use, duplication, or disclosure by the government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR 52.227-19.Sun, Sun Microsystems and the Sun logo are trademarks or registered trademarks of Sun Microsystems, Inc. SunSoft, Inc. 2550 Garcia Avenue Mountain View, California 94043

  • The Orbix Code Generation contains the language Tcl which is used subject to the following license:This software is copyrighted by the Regents of the University of California, Sun Microsystems, Inc., and other parties. The followingterms apply to all files associated with the software unless explicitly disclaimed in individual files.

    The authors hereby grant permission to use, copy, modify, distribute, and license this software and its documentation for any purpose, provided that existing copyright notices are retained in all copies and that this notice is included verbatim in any distributions. No written agreement, license, or royalty fee is required for any of the authorized uses. Modifications to this software may be copyrighted by their authors and need not follow the licensing terms described here, provided that the new terms are clearly indicated on the first page of each file where they apply.

    IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES RISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

    GOVERNMENT USE: If you are acquiring this software on behalf of the U.S. government, the Government shall have only "Restricted Rights" in the software and related documentation as defined in the Federal Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you are acquiring the software on behalf of the Department of Defense, the software shall be classified as "Commercial Computer Software" and the Government shall have only "Restricted Rights" as defined in Clause 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the authors grant the U.S. Government and others acting in its behalf permission to use and distribute the software in accordance with the terms specified in this license.

  • Contents

    Preface xiiiAudience xiiiOrganization of this Guide xivDocument Conventions xv

    Part 1 Using the Orbix Code Generation Toolkit

    Chapter 1 Overview of the Code Generation Toolkit 3Architecture 3

    IDLgen and Genies 4Orbix Code Generation Toolkit Components 5The Bundled Applications 6

    Approaches to Using the Code Generation Toolkit 6Known Limitations of Code Generation Toolkit 7

    Chapter 2 Running the Demonstration Genies 9Running Genies with IDLgen 9

    Specifying the Application Location 10Looking For Applications 11Common Command Line Arguments 11

    What are the Bundled Genies? 13Demonstration Genies 14

    stats.tcl 14idl2html.tcl 15

    Chapter 3 Ready-to-use Genies for Orbix C++ 17Using the C++ Genie to Kickstart New Projects 17

    Generating a Complete Client/Server Application 18Generating a Partial Application 19Command Line Options to Generate Parts of an Application 21A Few Other Options 30

    Generating Signatures of Individual Operations with cpp_op.tcl 31

    v

  • O r b i x Co d e G e n e r a t i o n T oo l k i t P r o g r am me r s G u i d e

    Creating Print Functions for IDL Types with cpp_print.tcl 32Creating Random Functions for IDL Types with cpp_random.tcl 34Creating Equality Functions for IDL Types with cpp_equal.tcl 36Configuration Settings 37

    Chapter 4 Orbix C++ Client/Server Wizard 39Using the Wizard 40

    Starting the Wizard 40Advanced Code Generation Options 42Generating Client Code 44Generating Server Code 45

    Building Your CORBA C++ Application 47

    Chapter 5 Ready-to-use Genies for OrbixWeb 49Using the Java Genie to Kickstart New Projects 49

    Generating a Complete Client/Server Application 50Generating a Partial Application 51Command Line Options to Generate Parts of an Application 53A Few Other Options 61

    Creating Print Functions for IDL Types with java_print.tcl 62Creating Random Functions for IDL Types with java_random.tcl 64Configuration Settings 66

    Part 2 Developing Genies with the Orbix Code Generation Toolkit

    Chapter 6 Writing a Genie 69Prerequisites for Developing Genies 69Some Simple Examples 70

    Hello World 70Hello World with Command Line Arguments 70

    Some Extensions Provided by IDLgen 71Using Commands in Other Libraries 71Writing to a File from Your Genie 72Embedding Text in Your Application 74

    vi

  • C o n t e n t s

    What are Bilingual Files? 76Using Bilingual Files 77

    Chapter 7 Processing an IDL File 81IDL Files and IDLgen 81

    Parsing the IDL File 82Structure of the Parse Tree 83Nodes of the Parse Tree 84The Abstract Node node 86The Abstract Node scope 87Nodes Representing Built-in IDL Types 91Typedefs and Anonymous Types 92Visiting Hidden Nodes 94Other Node Types 95

    Traversing the Parse Tree with rcontents 95Searching an IDL File with IDLgrep 95

    Recursive Descent Traversal 100Polymorphism in Tcl 100Recursive Descent Traversal through Polymorphism 101

    Processing User-defined Types 103Recursive Structs and Unions 103

    Chapter 8 Configuring your Genies 105Command Line Arguments 105

    Enhancing IDLgrep 105Processing the Command Line 106Searching for Command Line Arguments 108More Examples of Command Line Processing 109IDLgrep with Command Line Arguments 110Using std/args.tcl 112

    Using Configuration Files 113Syntax of an IDLgen Configuration File 113Reading the Contents of a Configuration File 114The Standard Configuration File 11