diff options
author | gokhale <asgokhale@users.noreply.github.com> | 1997-05-16 21:24:52 +0000 |
---|---|---|
committer | gokhale <asgokhale@users.noreply.github.com> | 1997-05-16 21:24:52 +0000 |
commit | 6f427a719012878b532f4ae570214733e2bd4a91 (patch) | |
tree | 292ce8a8997c8d6f633a49eb4fc4abce4fe8d01d | |
parent | 88658235b6f416fb066fe88d9c0a9a61441b43a1 (diff) | |
download | ATCD-6f427a719012878b532f4ae570214733e2bd4a91.tar.gz |
TAO IDL Compiler: Helper functions that use templates
-rw-r--r-- | TAO/TAO_IDL/util/utl_tmpl/utl_decllist.cpp | 105 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_tmpl/utl_exceptlist.cpp | 104 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_tmpl/utl_exprlist.cpp | 104 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_tmpl/utl_idlist.cpp | 137 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_tmpl/utl_labellist.cpp | 104 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_tmpl/utl_list.cpp | 211 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_tmpl/utl_namelist.cpp | 106 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_tmpl/utl_strlist.cpp | 139 |
8 files changed, 1010 insertions, 0 deletions
diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_decllist.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_decllist.cpp new file mode 100644 index 00000000000..5efa9e50a1b --- /dev/null +++ b/TAO/TAO_IDL/util/utl_tmpl/utl_decllist.cpp @@ -0,0 +1,105 @@ +/* + *====================================================================== + * + *Copyright 1992 Sun Microsystems, Inc. + * + *The Interface Definition Language Compiler Front End (CFE) is made + *available for use provided that this legend is included on all media and + *documentation and as a part of the software program in whole or part. + *Users may copy and extend functionality (but may not remove + *functionality) of the Interface Definition Language CFE without charge, + *but are not authorized to license or distribute it to anyone else except + *as part of a product or program developed by the user or with the express + *written consent of Sun Microsystems, Inc. + * + *The names of Sun Microsystems, Inc. and any of its subsidiaries may not + *be used in advertising or publicity pertaining to distribution of + *Interface Definition Language CFE as permitted herein. + * + *The Interface Definition Language CFE may not be exported outside the + *United States without first obtaining the appropriate government + *approvals. + * + *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 Microsystems, Inc. or any of + *its subsidiaries or affiliates to assist in its use, correction, + *modification or enhancement. + * + *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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. + * + *SunSoft, Inc. + *2550 Garcia Avenue + *Mountain View, California 94043 + * + * + * + * + *====================================================================== + */ + +#pragma ident "%@(#)utl_decllist.cc 1.27% %92/06/10% Sun Microsystems" + +// utl_decllist.cc +// +// Implementation of a list of declarators + +#include <idl.hh> +#include <idl_extern.hh> + +/* + * Constructor(s) + */ + +UTL_DeclList::UTL_DeclList(FE_Declarator *s, UTL_DeclList *cdr) + : UTL_List<UTL_DeclList, FE_Declarator>(s, cdr) +{ +} + +/* + * Private operations + */ + +/* + * Public operations + */ + +/* + * Redefinition of inherited virtual operations + */ + +// UTL_DeclList active iterator + +/* + * Constructor + */ + +UTL_DecllistActiveIterator::UTL_DecllistActiveIterator(UTL_DeclList *s) + : UTL_ListActiveIterator<UTL_DeclList, FE_Declarator>(s) +{ +} + +/* + * Private operations + */ + +/* + * Public operations + */ + +/* + * Redefined inherited operations + */ + diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_exceptlist.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_exceptlist.cpp new file mode 100644 index 00000000000..6a6e4ac2b47 --- /dev/null +++ b/TAO/TAO_IDL/util/utl_tmpl/utl_exceptlist.cpp @@ -0,0 +1,104 @@ +/* + *====================================================================== + * + *Copyright 1992 Sun Microsystems, Inc. + * + *The Interface Definition Language Compiler Front End (CFE) is made + *available for use provided that this legend is included on all media and + *documentation and as a part of the software program in whole or part. + *Users may copy and extend functionality (but may not remove + *functionality) of the Interface Definition Language CFE without charge, + *but are not authorized to license or distribute it to anyone else except + *as part of a product or program developed by the user or with the express + *written consent of Sun Microsystems, Inc. + * + *The names of Sun Microsystems, Inc. and any of its subsidiaries may not + *be used in advertising or publicity pertaining to distribution of + *Interface Definition Language CFE as permitted herein. + * + *The Interface Definition Language CFE may not be exported outside the + *United States without first obtaining the appropriate government + *approvals. + * + *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 Microsystems, Inc. or any of + *its subsidiaries or affiliates to assist in its use, correction, + *modification or enhancement. + * + *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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. + * + *SunSoft, Inc. + *2550 Garcia Avenue + *Mountain View, California 94043 + * + * + * + * + *====================================================================== + */ + +#pragma ident "%@(#)utl_exceptlist.cc 1.33% %92/06/10% Sun Microsystems" + +// utl_exceptlist.cc +// +// Implementation of a list of exceptions + +#include <idl.hh> +#include <idl_extern.hh> + +/* + * Constructor(s) + */ + +UTL_ExceptList::UTL_ExceptList(AST_Exception *s, UTL_ExceptList *cdr) + : UTL_List<UTL_ExceptList, AST_Exception>(s, cdr) +{ +} + +/* + * Private operations + */ + +/* + * Public operations + */ + +/* + * Redefinition of inherited virtual operations + */ + +// UTL_ExceptList active iterator + +/* + * Constructor + */ + +UTL_ExceptlistActiveIterator::UTL_ExceptlistActiveIterator(UTL_ExceptList *s) + : UTL_ListActiveIterator<UTL_ExceptList, AST_Exception>(s) +{ +} + +/* + * Private operations + */ + +/* + * Public operations + */ + +/* + * Redefinition of inherited virtual operations + */ diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_exprlist.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_exprlist.cpp new file mode 100644 index 00000000000..3ae1e259cce --- /dev/null +++ b/TAO/TAO_IDL/util/utl_tmpl/utl_exprlist.cpp @@ -0,0 +1,104 @@ +/* + *====================================================================== + * + *Copyright 1992 Sun Microsystems, Inc. + * + *The Interface Definition Language Compiler Front End (CFE) is made + *available for use provided that this legend is included on all media and + *documentation and as a part of the software program in whole or part. + *Users may copy and extend functionality (but may not remove + *functionality) of the Interface Definition Language CFE without charge, + *but are not authorized to license or distribute it to anyone else except + *as part of a product or program developed by the user or with the express + *written consent of Sun Microsystems, Inc. + * + *The names of Sun Microsystems, Inc. and any of its subsidiaries may not + *be used in advertising or publicity pertaining to distribution of + *Interface Definition Language CFE as permitted herein. + * + *The Interface Definition Language CFE may not be exported outside the + *United States without first obtaining the appropriate government + *approvals. + * + *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 Microsystems, Inc. or any of + *its subsidiaries or affiliates to assist in its use, correction, + *modification or enhancement. + * + *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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. + * + *SunSoft, Inc. + *2550 Garcia Avenue + *Mountain View, California 94043 + * + * + * + * + *====================================================================== + */ + +#pragma ident "%@(#)utl_exprlist.cc 1.33% %92/06/10% Sun Microsystems" + +// utl_exprlist.cc +// +// Implementation of a list of strings + +#include <idl.hh> +#include <idl_extern.hh> + +/* + * Constructor(s) + */ + +UTL_ExprList::UTL_ExprList(AST_Expression *s, UTL_ExprList *cdr) + : UTL_List<UTL_ExprList, AST_Expression>(s, cdr) +{ +} + +/* + * Private operations + */ + +/* + * Public operations + */ + +/* + * Redefinition of inherited virtual operations + */ + +// UTL_ExprList active iterator + +/* + * Constructor + */ + +UTL_ExprlistActiveIterator::UTL_ExprlistActiveIterator(UTL_ExprList *s) + : UTL_ListActiveIterator<UTL_ExprList, AST_Expression>(s) +{ +} + +/* + * Private operations + */ + +/* + * Public operations + */ + +/* + * Redefinition of inherited virtual operations + */ diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_idlist.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_idlist.cpp new file mode 100644 index 00000000000..d1e7bb49d8f --- /dev/null +++ b/TAO/TAO_IDL/util/utl_tmpl/utl_idlist.cpp @@ -0,0 +1,137 @@ +/* + *====================================================================== + * + *Copyright 1992 Sun Microsystems, Inc. + * + *The Interface Definition Language Compiler Front End (CFE) is made + *available for use provided that this legend is included on all media and + *documentation and as a part of the software program in whole or part. + *Users may copy and extend functionality (but may not remove + *functionality) of the Interface Definition Language CFE without charge, + *but are not authorized to license or distribute it to anyone else except + *as part of a product or program developed by the user or with the express + *written consent of Sun Microsystems, Inc. + * + *The names of Sun Microsystems, Inc. and any of its subsidiaries may not + *be used in advertising or publicity pertaining to distribution of + *Interface Definition Language CFE as permitted herein. + * + *The Interface Definition Language CFE may not be exported outside the + *United States without first obtaining the appropriate government + *approvals. + * + *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 Microsystems, Inc. or any of + *its subsidiaries or affiliates to assist in its use, correction, + *modification or enhancement. + * + *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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. + * + *SunSoft, Inc. + *2550 Garcia Avenue + *Mountain View, California 94043 + * + * + * + * + *====================================================================== + */ + +#pragma ident "%@(#)utl_idlist.cc 1.34% %92/06/10% Sun Microsystems" + +// utl_idlist.cc +// +// Implementation of a list of utl_string nodes + +#include <idl.hh> +#include <idl_extern.hh> + +/* + * Constructor(s) + */ + +UTL_IdList::UTL_IdList(Identifier *s, UTL_IdList *cdr) + : UTL_List<UTL_IdList, Identifier>(s, cdr) +{ +} + +/* + * Private operations + */ + +/* + * Public operations + */ + +// Get last item of this list +Identifier * +UTL_IdList::last_component() +{ + if (tail() == NULL) + return head(); + return tail()->last_component(); +} + +// AST Dumping +void +UTL_IdList::dump(ostream &o) +{ + UTL_IdListActiveIterator *i = new UTL_IdListActiveIterator(this); + long first = I_TRUE; + long second = I_FALSE; + + while (!(i->is_done())) { + if (!first) + o << "::"; + else if (second) + first = second = I_FALSE; + i->item()->dump(o); + if (first) { + if (strcmp(i->item()->get_string(), "::") != 0) + first = I_FALSE; + else + second = I_TRUE; + } + i->next(); + } +} + +/* + * Redefinition of inherited virtual operations + */ + +// UTL_IdList active iterator + +/* + * Constructor + */ + +UTL_IdListActiveIterator::UTL_IdListActiveIterator(UTL_IdList *s) + : UTL_ListActiveIterator<UTL_IdList, Identifier>(s) +{ +} + +/* + * Private operations + */ + +/* + * Public operations + */ + +/* + * Redefinition of inherited virtual operations + */ diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_labellist.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_labellist.cpp new file mode 100644 index 00000000000..6fa8a0b9fb3 --- /dev/null +++ b/TAO/TAO_IDL/util/utl_tmpl/utl_labellist.cpp @@ -0,0 +1,104 @@ +/* + *====================================================================== + * + *Copyright 1992 Sun Microsystems, Inc. + * + *The Interface Definition Language Compiler Front End (CFE) is made + *available for use provided that this legend is included on all media and + *documentation and as a part of the software program in whole or part. + *Users may copy and extend functionality (but may not remove + *functionality) of the Interface Definition Language CFE without charge, + *but are not authorized to license or distribute it to anyone else except + *as part of a product or program developed by the user or with the express + *written consent of Sun Microsystems, Inc. + * + *The names of Sun Microsystems, Inc. and any of its subsidiaries may not + *be used in advertising or publicity pertaining to distribution of + *Interface Definition Language CFE as permitted herein. + * + *The Interface Definition Language CFE may not be exported outside the + *United States without first obtaining the appropriate government + *approvals. + * + *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 Microsystems, Inc. or any of + *its subsidiaries or affiliates to assist in its use, correction, + *modification or enhancement. + * + *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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. + * + *SunSoft, Inc. + *2550 Garcia Avenue + *Mountain View, California 94043 + * + * + * + * + *====================================================================== + */ + +#pragma ident "%@(#)utl_labellist.cc 1.27% %92/06/10% Sun Microsystems" + +// utl_labellist.cc +// +// Implementation of a list of scoped names + +#include <idl.hh> +#include <idl_extern.hh> + +/* + * Constructor(s) + */ + +UTL_LabelList::UTL_LabelList(AST_UnionLabel *s, UTL_LabelList *cdr) + : UTL_List<UTL_LabelList, AST_UnionLabel>(s, cdr) +{ +} + +/* + * Private operations + */ + +/* + * Public operations + */ + +/* + * Redefinition of inherited virtual operations + */ + +// UTL_LabelList active iterator + +/* + * Constructor + */ + +UTL_LabellistActiveIterator::UTL_LabellistActiveIterator(UTL_LabelList *s) + : UTL_ListActiveIterator<UTL_LabelList, AST_UnionLabel>(s) +{ +} + +/* + * Private operations + */ + +/* + * Public operations + */ + +/* + * Redefinition of inherited virtual operations + */ diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_list.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_list.cpp new file mode 100644 index 00000000000..233add32d63 --- /dev/null +++ b/TAO/TAO_IDL/util/utl_tmpl/utl_list.cpp @@ -0,0 +1,211 @@ +/* + *====================================================================== + * + *Copyright 1992 Sun Microsystems, Inc. + * + *The Interface Definition Language Compiler Front End (CFE) is made + *available for use provided that this legend is included on all media and + *documentation and as a part of the software program in whole or part. + *Users may copy and extend functionality (but may not remove + *functionality) of the Interface Definition Language CFE without charge, + *but are not authorized to license or distribute it to anyone else except + *as part of a product or program developed by the user or with the express + *written consent of Sun Microsystems, Inc. + * + *The names of Sun Microsystems, Inc. and any of its subsidiaries may not + *be used in advertising or publicity pertaining to distribution of + *Interface Definition Language CFE as permitted herein. + * + *The Interface Definition Language CFE may not be exported outside the + *United States without first obtaining the appropriate government + *approvals. + * + *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 Microsystems, Inc. or any of + *its subsidiaries or affiliates to assist in its use, correction, + *modification or enhancement. + * + *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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. + * + *SunSoft, Inc. + *2550 Garcia Avenue + *Mountain View, California 94043 + * + * + * + * + *====================================================================== + */ + +#pragma ident "%@(#)utl_list.cc 1.34% %92/06/10% Sun Microsystems" + +// utl_list.cc +// +// Implementation of generic single-linked lists + +#include <stddef.h> +#include <utl_list.hh> +#include <idl_bool.hh> + +/* + * Constructor(s) + */ + +template<class L, class T> +UTL_List<L, T>::UTL_List(T *c, L *l) + : pd_car_data(c), + pd_cdr_data(l) +{ +} + +/* + * Private operations + */ + +// Compute list length +template<class L, class T> +long +UTL_List<L, T>::list_length(long n) +{ + if (pd_cdr_data == NULL) + return n; + else + return pd_cdr_data->list_length(n+1); +} + +/* + * Public operations + */ + +// Smash last cdr with l +template<class L, class T> +void +UTL_List<L, T>::nconc(L *l) +{ + if (pd_cdr_data == NULL) + pd_cdr_data = l; + else + pd_cdr_data->nconc(l); +} + +/* + * Override this operation to copy lists of other types + */ +// Copy a list +template<class L, class T> +L * +UTL_List<L, T>::copy() +{ + if (pd_cdr_data == NULL) + return new L(head(), NULL); + return new L(head(), pd_cdr_data->copy()); +} + +// Get list item +template<class L, class T> +T * +UTL_List<L, T>::head() +{ + return pd_car_data; +} + +// Get next list +template<class L, class T> +L * +UTL_List<L, T>::tail() +{ + return pd_cdr_data; +} + +// Set list item +template<class L, class T> +void +UTL_List<L, T>::set_head(T *s) +{ + pd_car_data = s; +} + +// Set next list +template<class L, class T> +void +UTL_List<L, T>::set_tail(L *l) +{ + pd_cdr_data = l; +} + +// Compute list length +template<class L, class T> +long +UTL_List<L, T>::length() +{ + return list_length(1); +} + +/* + * Redefinition of inherited virtual operations + */ + +// UTL_List active iterator + +/* + * Constructor + */ + +template<class L, class T> +UTL_ListActiveIterator<L, T>::UTL_ListActiveIterator(UTL_List<L, T> *s) + : source(s) +{ +} + +/* + * Private operations + */ + +/* + * Public operations + */ + +// Is iterator done? +template<class L, class T> +long +UTL_ListActiveIterator<L, T>::is_done() +{ + return (source == NULL) ? I_TRUE : I_FALSE; +} + +// Get current item +template<class L, class T> +T * +UTL_ListActiveIterator<L, T>::item() +{ + if (source == NULL) + return NULL; + return source->head(); +} + +// Advance to next item +template<class L, class T> +void +UTL_ListActiveIterator<L, T>::next() +{ + if (source != NULL) + source = source->tail(); +} + +/* + * Redefinition of inherited operations + */ + diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_namelist.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_namelist.cpp new file mode 100644 index 00000000000..f2fc6dfe7e2 --- /dev/null +++ b/TAO/TAO_IDL/util/utl_tmpl/utl_namelist.cpp @@ -0,0 +1,106 @@ +/* + *====================================================================== + * + *Copyright 1992 Sun Microsystems, Inc. + * + *The Interface Definition Language Compiler Front End (CFE) is made + *available for use provided that this legend is included on all media and + *documentation and as a part of the software program in whole or part. + *Users may copy and extend functionality (but may not remove + *functionality) of the Interface Definition Language CFE without charge, + *but are not authorized to license or distribute it to anyone else except + *as part of a product or program developed by the user or with the express + *written consent of Sun Microsystems, Inc. + * + *The names of Sun Microsystems, Inc. and any of its subsidiaries may not + *be used in advertising or publicity pertaining to distribution of + *Interface Definition Language CFE as permitted herein. + * + *The Interface Definition Language CFE may not be exported outside the + *United States without first obtaining the appropriate government + *approvals. + * + *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 Microsystems, Inc. or any of + *its subsidiaries or affiliates to assist in its use, correction, + *modification or enhancement. + * + *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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. + * + *SunSoft, Inc. + *2550 Garcia Avenue + *Mountain View, California 94043 + * + * + * + * + *====================================================================== + */ + +#pragma ident "%@(#)utl_namelist.cc 1.33% %92/06/10% Sun Microsystems" + +// utl_namelist.cc +// +// Implementation of a list of scoped names + +#include <idl.hh> +#include <idl_extern.hh> + +typedef UTL_List<UTL_NameList, UTL_ScopedName> _dummy_; + +/* + * Constructor(s) + */ + +UTL_NameList::UTL_NameList(UTL_ScopedName *s, UTL_NameList *cdr) + : UTL_List<UTL_NameList, UTL_ScopedName>(s, cdr) +{ +} + +/* + * Private operations + */ + +/* + * Public operations + */ + +/* + * Redefinition of inherited virtual operations + */ + +// UTL_NameList active iterator + +/* + * Constructor + */ + +UTL_NamelistActiveIterator::UTL_NamelistActiveIterator(UTL_NameList *s) + : UTL_ListActiveIterator<UTL_NameList, UTL_ScopedName>(s) +{ +} + +/* + * Private operations + */ + +/* + * Public operations + */ + +/* + * Redefinition of inherited virtual operations + */ diff --git a/TAO/TAO_IDL/util/utl_tmpl/utl_strlist.cpp b/TAO/TAO_IDL/util/utl_tmpl/utl_strlist.cpp new file mode 100644 index 00000000000..9c2d1cf29fb --- /dev/null +++ b/TAO/TAO_IDL/util/utl_tmpl/utl_strlist.cpp @@ -0,0 +1,139 @@ +/* + *====================================================================== + * + *Copyright 1992 Sun Microsystems, Inc. + * + *The Interface Definition Language Compiler Front End (CFE) is made + *available for use provided that this legend is included on all media and + *documentation and as a part of the software program in whole or part. + *Users may copy and extend functionality (but may not remove + *functionality) of the Interface Definition Language CFE without charge, + *but are not authorized to license or distribute it to anyone else except + *as part of a product or program developed by the user or with the express + *written consent of Sun Microsystems, Inc. + * + *The names of Sun Microsystems, Inc. and any of its subsidiaries may not + *be used in advertising or publicity pertaining to distribution of + *Interface Definition Language CFE as permitted herein. + * + *The Interface Definition Language CFE may not be exported outside the + *United States without first obtaining the appropriate government + *approvals. + * + *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 Microsystems, Inc. or any of + *its subsidiaries or affiliates to assist in its use, correction, + *modification or enhancement. + * + *SUN MICROSYSTEMS, INC. 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 MICROSYSTEMS, INC. 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. + * + *SunSoft, Inc. + *2550 Garcia Avenue + *Mountain View, California 94043 + * + * + * + * + *====================================================================== + */ + +#pragma ident "%@(#)utl_strlist.cc 1.34% %92/06/10% Sun Microsystems" + +// utl_strlist.cc +// +// Implementation of a list of utl_string nodes + +#include <idl.hh> +#include <idl_extern.hh> + +/* + * Constructor(s) + */ + +UTL_StrList::UTL_StrList(String *s, UTL_StrList *cdr) + : UTL_List<UTL_StrList, String>(s, cdr) +{ +} + +/* + * Private operations + */ + +/* + * Public operations + */ + +// Get last item of this list +String * +UTL_StrList::last_component() +{ + if (tail() == NULL) + return head(); + return tail()->last_component(); +} + +// AST Dumping +void +UTL_StrList::dump(ostream &o) +{ + char *s; + UTL_StrlistActiveIterator *i = new UTL_StrlistActiveIterator(this); + long first = I_TRUE; + long second = I_FALSE; + + while (!(i->is_done())) { + if (!first) + o << "::"; + else if (second) + first = second = I_FALSE; + s = i->item()->get_string(); + o << s; + if (first) { + if (strcmp(s, "::") != 0) + first = I_FALSE; + else + second = I_TRUE; + } + i->next(); + } +} + +/* + * Redefinition of inherited virtual operations + */ + +// UTL_StrList active iterator + +/* + * Constructor + */ + +UTL_StrlistActiveIterator::UTL_StrlistActiveIterator(UTL_StrList *s) + : UTL_ListActiveIterator<UTL_StrList, String>(s) +{ +} + +/* + * Private operations + */ + +/* + * Public operations + */ + +/* + * Redefinition of inherited virtual operations + */ |