diff options
author | Juergen Schmidt <jsc@openoffice.org> | 2001-03-15 11:25:06 +0000 |
---|---|---|
committer | Juergen Schmidt <jsc@openoffice.org> | 2001-03-15 11:25:06 +0000 |
commit | ce5e228414d95fbc44e51cf124928d180c4e3beb (patch) | |
tree | f6a3277631028941536ec5f89f2b419123ec659c /idlc/inc | |
parent | 4d90fa60375508dbb088ac5d3cd92ab1a7c3c0e0 (diff) |
new
Diffstat (limited to 'idlc/inc')
33 files changed, 3746 insertions, 0 deletions
diff --git a/idlc/inc/idlc/astarray.hxx b/idlc/inc/idlc/astarray.hxx new file mode 100644 index 000000000..ba00dced3 --- /dev/null +++ b/idlc/inc/idlc/astarray.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * $RCSfile: astarray.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTARRAY_HXX_ +#define _IDLC_ASTARRAY_HXX_ + +#ifndef _IDLC_ASTTYPE_HXX_ +#include <idlc/asttype.hxx> +#endif +#ifndef _IDLC_ASTSCOPE_HXX_ +#include <idlc/astscope.hxx> +#endif + +class AstArray : public AstType +{ +public: + AstArray(const ::rtl::OString& name, AstType* pType, const ExprList& rDimExpr, AstScope* pScope); + AstArray(AstType* pType, const ExprList& rDimExpr, AstScope* pScope); + + virtual ~AstArray() {} + + AstType* getType() + { return m_pType; } + void setType(AstType* pType) + { + m_pType = pType; + setName(makeName()); + } + ExprList* getDimExpressions() + { return &m_dimExpressions; } + sal_uInt32 getDimension() + { return m_dimension; } + +private: + ::rtl::OString makeName(); + + AstType* m_pType; + sal_uInt32 m_dimension; + ExprList m_dimExpressions; +}; + +#endif // _IDLC_ASTARRAY_HXX_ + diff --git a/idlc/inc/idlc/astattribute.hxx b/idlc/inc/idlc/astattribute.hxx new file mode 100644 index 000000000..90e172afa --- /dev/null +++ b/idlc/inc/idlc/astattribute.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * $RCSfile: astattribute.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTATTRIBUTE_HXX_ +#define _IDLC_ASTATTRIBUTE_HXX_ + +#ifndef _IDLC_ASTDECLARATION_HXX_ +#include <idlc/astdeclaration.hxx> +#endif + +class AstAttribute : public AstDeclaration +{ +public: + AstAttribute(sal_uInt32 flags, AstType *pType, const ::rtl::OString& name, AstScope* pScope) + : AstDeclaration(NT_attribute, name, pScope) + , m_flags(flags) + , m_pType(pType) + {} + AstAttribute(NodeType nodeType, sal_uInt32 flags, AstType *pType, const ::rtl::OString& name, AstScope* pScope) + : AstDeclaration(nodeType, name, pScope) + , m_flags(flags) + , m_pType(pType) + {} + virtual ~AstAttribute() {} + + AstType* getType() + { return m_pType; } + const sal_Bool isReadonly() + { return ((m_flags & AF_READONLY) == AF_READONLY); } + const sal_Bool isOptional() + { return ((m_flags & AF_OPTIONAL) == AF_OPTIONAL); } + const sal_Bool isAttribute() + { return ((m_flags & AF_ATTRIBUTE) == AF_ATTRIBUTE); } + const sal_Bool isProperty() + { return ((m_flags & AF_PROPERTY) == AF_PROPERTY); } + const sal_Bool isBound() + { return ((m_flags & AF_BOUND) == AF_BOUND); } + const sal_Bool isMayBeVoid() + { return ((m_flags & AF_MAYBEVOID) == AF_MAYBEVOID); } + const sal_Bool isConstrained() + { return ((m_flags & AF_CONSTRAINED) == AF_CONSTRAINED); } + const sal_Bool isTransient() + { return ((m_flags & AF_TRANSIENT) == AF_TRANSIENT); } + const sal_Bool isMayBeAmbiguous() + { return ((m_flags & AF_MAYBEAMBIGUOUS) == AF_MAYBEAMBIGUOUS); } + const sal_Bool isMayBeDefault() + { return ((m_flags & AF_MAYBEDEFAULT) == AF_MAYBEDEFAULT); } + const sal_Bool isRemoveable() + { return ((m_flags & AF_REMOVEABLE) == AF_REMOVEABLE); } + + sal_Bool dumpBlob(RegistryTypeWriter& rBlob, sal_uInt16 index); +private: + const sal_uInt32 m_flags; + AstType* m_pType; +}; + +#endif // _IDLC_ASTATTRIBUTE_HXX_ + diff --git a/idlc/inc/idlc/astbasetype.hxx b/idlc/inc/idlc/astbasetype.hxx new file mode 100644 index 000000000..49c726ebb --- /dev/null +++ b/idlc/inc/idlc/astbasetype.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * $RCSfile: astbasetype.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTBASETYPE_HXX_ +#define _IDLC_ASTBASETYPE_HXX_ + +#ifndef _IDLC_ASTTYPE_HXX_ +#include <idlc/asttype.hxx> +#endif +#ifndef _IDLC_ASTEXPRESSION_HXX_ +#include <idlc/astexpression.hxx> +#endif + + +class AstBaseType : public AstType +{ +public: + AstBaseType(const ExprType type, const ::rtl::OString& name, AstScope* pScope) + : AstType(NT_predefined, name, pScope) + , m_exprType(type) + {} + + virtual ~AstBaseType() {} + + const ExprType getExprType() + { return m_exprType; } +private: + const ExprType m_exprType; +}; + +#endif // _IDLC_ASTBASETYPE_HXX_ + diff --git a/idlc/inc/idlc/astconstant.hxx b/idlc/inc/idlc/astconstant.hxx new file mode 100644 index 000000000..c8aef9230 --- /dev/null +++ b/idlc/inc/idlc/astconstant.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * $RCSfile: astconstant.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTCONSTANT_HXX_ +#define _IDLC_ASTCONSTANT_HXX_ + +#ifndef _IDLC_ASTDECLARATION_HXX_ +#include <idlc/astdeclaration.hxx> +#endif +#ifndef _IDLC_ASTEXPRESSION_HXX_ +#include <idlc/astexpression.hxx> +#endif + +class AstConstant : public AstDeclaration +{ +public: + AstConstant(const ExprType type, const NodeType nodeType, + AstExpression* pExpr, const ::rtl::OString& name, AstScope* pScope); + AstConstant(const ExprType type, AstExpression* pExpr, + const ::rtl::OString& name, AstScope* pScope); + virtual ~AstConstant(); + + AstExpression* getConstValue() + { return m_pConstValue; } + const ExprType getConstValueType() + { return m_constValueType; } + + sal_Bool dumpBlob(RegistryTypeWriter& rBlob, sal_uInt16 index); +private: + AstExpression* m_pConstValue; + const ExprType m_constValueType; +}; + +#endif // _IDLC_ASTCONSTANT_HXX_ + diff --git a/idlc/inc/idlc/astconstants.hxx b/idlc/inc/idlc/astconstants.hxx new file mode 100644 index 000000000..23ae2d59a --- /dev/null +++ b/idlc/inc/idlc/astconstants.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * $RCSfile: astconstants.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTCONSTANTS_HXX_ +#define _IDLC_ASTCONSTANTS_HXX_ + +#include <idlc/astmodule.hxx> + +class AstConstants : public AstModule +{ +public: + AstConstants(const ::rtl::OString& name, AstScope* pScope) + : AstModule(NT_constants, name, pScope) + {} + virtual ~AstConstants() {} +}; + +#endif // _IDLC_ASTCONSTANTS_HXX_ + diff --git a/idlc/inc/idlc/astdeclaration.hxx b/idlc/inc/idlc/astdeclaration.hxx new file mode 100644 index 000000000..5f57c8c79 --- /dev/null +++ b/idlc/inc/idlc/astdeclaration.hxx @@ -0,0 +1,174 @@ +/************************************************************************* + * + * $RCSfile: astdeclaration.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTDECLARATION_HXX_ +#define _IDLC_ASTDECLARATION_HXX_ + +#ifndef _IDLC_IDLC_HXX_ +#include <idlc/idlc.hxx> +#endif +#ifndef _REGISTRY_REGISTRY_HXX_ +#include <registry/registry.hxx> +#endif +#ifndef _REGISTRY_REFLWRIT_HXX_ +#include <registry/reflwrit.hxx> +#endif + +class AstScope; + +// Enum defining the different kinds of Ast nodes +enum NodeType +{ + NT_object, // Denotes an object + NT_service, // Denotes an servcie + NT_interface_member, // Denotes an interface which is exported from object + NT_service_member, // Denotes an service which is exported from object + NT_observes, // Denotes an observed interface + NT_needs, // Denotes an needed service + NT_module, // Denotes a module + NT_root, // Denotes the root of AST + NT_interface, // Denotes an interface + NT_constants, // Denotes a constant group + NT_const, // Denotes a constant + NT_exception, // Denotes an exception + NT_attribute, // Denotes an attribute + NT_property, // Denotes an property + NT_operation, // Denotes an operation + NT_parameter, // Denotes an op. parameter + NT_union, // Denotes a union + NT_union_branch, // Denotes a union branch + NT_struct, // Denotes a structure + NT_member, // Denotes a member in structure, exception + NT_enum, // Denotes an enumeration + NT_enum_val, // Denotes an enum. value + NT_array, // Denotes an IDL array + NT_sequence, // Denotes an IDL sequence + NT_typedef, // Denotes a typedef + NT_predefined // Denotes a predefined type +}; + +class AstDeclaration +{ +public: + // Constructors + AstDeclaration(const NodeType type, const ::rtl::OString& name, AstScope* pScope); + virtual ~AstDeclaration(); + + // Data access + void setName(const ::rtl::OString& name); + const ::rtl::OString& getLocalName() + { return m_localName; } + const ::rtl::OString& getScopedName() + { return m_scopedName; } + const ::rtl::OString& getFullName() + { return m_fullName; } + virtual const sal_Char* getRelativName() + { return m_fullName.getStr()+1; } + AstScope* getScope() + { return m_pScope; } + void setScope(AstScope* pSc) + { m_pScope = pSc; } + const NodeType getNodeType() + { return m_nodeType; } + sal_Bool isInMainfile() + { return m_bInMainFile; } + void setInMainfile(sal_Bool bInMainfile) + { m_bInMainFile = bInMainfile; } + sal_Bool isImported() + { return m_bImported; } + void setImported(sal_Bool bImported) + { m_bImported = bImported; } + sal_Int32 getLineNumber() + { return m_lineNumber; } + void setLineNumber(sal_Int32 lineNumber) + { m_lineNumber = lineNumber; } + const ::rtl::OString& getFileName() + { return m_fileName; } + void setFileName(const ::rtl::OString& rFileName) + { m_fileName = rFileName; } + const ::rtl::OUString& getDocumentation() + { return m_documentation; } + void setDocumentation(const ::rtl::OUString& rDocumentation) + { m_documentation = rDocumentation; } + sal_Bool isAdded() + { return m_bIsAdded; } + void markAsAdded() + { m_bIsAdded = sal_True; } + + sal_Bool isType(); + sal_Bool hasAncestor(AstDeclaration* pDecl); + + virtual sal_Bool dump(RegistryKey& rKey, RegistryTypeWriterLoader* pLoader); +protected: + ::rtl::OString m_localName; + ::rtl::OString m_scopedName; // full qualified name + ::rtl::OString m_fullName; // full qualified name with '/' as seperator + AstScope* m_pScope; + const NodeType m_nodeType; + sal_Bool m_bImported; // imported ? + sal_Bool m_bIsAdded; // mark declaration as added in scope + sal_Bool m_bInMainFile; // defined in main file + sal_Int32 m_lineNumber; // line number defined in + ::rtl::OString m_fileName; // fileName defined in + ::rtl::OUString m_documentation; // fileName defined in +}; + +#endif // _IDLC_ASTDECLARATION_HXX_ + diff --git a/idlc/inc/idlc/astenum.hxx b/idlc/inc/idlc/astenum.hxx new file mode 100644 index 000000000..477d5d6fa --- /dev/null +++ b/idlc/inc/idlc/astenum.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * $RCSfile: astenum.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTENUM_HXX_ +#define _IDLC_ASTENUM_HXX_ + +#ifndef _IDLC_ASTTYPE_HXX_ +#include <idlc/asttype.hxx> +#endif +#ifndef _IDLC_ASTSCOPE_HXX_ +#include <idlc/astscope.hxx> +#endif +#ifndef _IDLC_ASTCONSTANT_HXX_ +#include <idlc/astconstant.hxx> +#endif + +class AstEnum : public AstType + , public AstScope +{ +public: + AstEnum(const ::rtl::OString& name, AstScope* pScope); + + virtual ~AstEnum(); + + void setEnumValueCount(sal_Int32 count) + { m_enumValueCount = count; } + sal_Int32 getEnumValueCount() + { return m_enumValueCount++; } + + AstConstant* checkValue(AstExpression* pExpr); + + virtual sal_Bool dump(RegistryKey& rKey, RegistryTypeWriterLoader* pLoader); + + virtual AstDeclaration* addDeclaration(AstDeclaration* pDecl); +private: + sal_Int32 m_enumValueCount; +}; + +#endif // _IDLC_ASTENUM_HXX_ + diff --git a/idlc/inc/idlc/astexception.hxx b/idlc/inc/idlc/astexception.hxx new file mode 100644 index 000000000..0611a4e06 --- /dev/null +++ b/idlc/inc/idlc/astexception.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * $RCSfile: astexception.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTEXCEPTION_HXX_ +#define _IDLC_ASTEXCEPTION_HXX_ + +#ifndef _IDLC_ASTSTRUCT_HXX_ +#include <idlc/aststruct.hxx> +#endif + +class AstException : public AstStruct +{ +public: + AstException(const ::rtl::OString& name, AstException* pBaseType, AstScope* pScope) + : AstStruct(NT_exception, name, pBaseType, pScope) + {} + + virtual ~AstException() {} +}; + +#endif // _IDLC_ASTEXCEPTION_HXX_ + diff --git a/idlc/inc/idlc/astexpression.hxx b/idlc/inc/idlc/astexpression.hxx new file mode 100644 index 000000000..a06025276 --- /dev/null +++ b/idlc/inc/idlc/astexpression.hxx @@ -0,0 +1,232 @@ +/************************************************************************* + * + * $RCSfile: astexpression.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTEXPRESSION_HXX_ +#define _IDLC_ASTEXPRESSION_HXX_ + +#ifndef _IDLC_IDLC_HXX_ +#include <idlc/idlc.hxx> +#endif + +// Enum to define all the different operators to combine expressions +enum ExprComb +{ + EC_add, // '+' + EC_minus, // '-' + EC_mul, // '*' + EC_div, // '/' + EC_mod, // '%' + EC_or, // '|' + EC_xor, // '^' + EC_and, // '&' + EC_left, // '<<' + EC_right, // '>>' + EC_u_plus, // unary '+' + EC_u_minus, // unary '-' + EC_bit_neg, // '~' + EC_none, // No operator (missing) + EC_symbol // a symbol (function or constant name) +}; + +// Enum to define the different kinds of evaluation possible +enum EvalKind +{ + EK_const, // Must evaluate to constant + EK_positive_int // Must evaluate to positive integer +}; + +// Enum to define expression type +enum ExprType +{ + ET_short, // Expression value is short + ET_ushort, // Expression value is unsigned short + ET_long, // Expression value is long + ET_ulong, // Expression value is unsigned long + ET_hyper, // Expression value is hyper (64 bit) + ET_uhyper, // Expression value is unsigned hyper + ET_float, // Expression value is 32-bit float + ET_double, // Expression value is 64-bit float + ET_char, // Expression value is char + ET_byte, // Expression value is byte + ET_boolean, // Expression value is boolean + ET_string, // Expression value is char * + ET_any, // Expression value is any of above + ET_void, // Expression value is void (absent) + ET_type, // Expression value is type + ET_none, // Expression value is missing + ET_pseudo // Expression value is pseudo (for keywords) +}; + +// Structure to describe value of constant expression and its type +struct AstExprValue +{ + union + { + sal_uInt8 byval; // Contains byte expression value + sal_Int16 sval; // Contains short expression value + sal_uInt16 usval; // Contains unsigned short expr value + sal_Int32 lval; // Contains long expression value + sal_uInt32 ulval; // Contains unsigned long expr value + sal_Int64 hval; // Contains hyper expression value + sal_uInt64 uhval; // Contains unsigned hyper expr value + sal_Bool bval; // Contains boolean expression value + float fval; // Contains 32-bit float expr value + double dval; // Contains 64-bit float expr value + sal_Char cval; // Contains char expression value + ::rtl::OString* strval; // Contains String * expr value + sal_uInt32 eval; // Contains enumeration value + } u; + ExprType et; +}; + +sal_Char* SAL_CALL exprTypeToString(ExprType t); + +class AstExpression +{ +public: + // Constructor(s) + AstExpression(AstExpression *pExpr, ExprType et); + AstExpression(ExprComb c, AstExpression *pExpr1, AstExpression *pExpr2); + + AstExpression(sal_Int16 s); + AstExpression(sal_uInt16 us); + AstExpression(sal_Int32 l); + AstExpression(sal_Int32 l, ExprType et); + AstExpression(sal_uInt32 ul); + AstExpression(sal_Int64 h); + AstExpression(sal_uInt64 uh); + AstExpression(float f); + AstExpression(double d); + AstExpression(sal_Char c); + AstExpression(::rtl::OString* s, sal_Bool bIsScopedName = sal_False); + + virtual ~AstExpression(); + + // Data Accessors + AstScope* getScope() + { return m_pScope; } + void setScope(AstScope* pScope) + { m_pScope = pScope; } + sal_Int32 getLine() + { return m_lineNo; } + void setLine(sal_Int32 l) + { m_lineNo = l; } + const ::rtl::OString& getFileName() + { return m_fileName; } + void setFileName(const ::rtl::OString& fileName) + { m_fileName = fileName; } + ExprComb getCombOperator() + { return m_combOperator; } + void setCombOperator(ExprComb new_ec) + { m_combOperator = new_ec; } + AstExprValue* getExprValue() + { return m_exprValue; } + void setExprValue(AstExprValue *pEv) + { m_exprValue = pEv; } + AstExpression* getExpr1() + { return m_subExpr1; } + void setExpr1(AstExpression *pExpr) + { m_subExpr1 = pExpr; } + AstExpression* getExpr2() + { return m_subExpr2; } + void setExpr2(AstExpression *pExpr) + { m_subExpr2 = pExpr; } + ::rtl::OString* getSymbolicName() + { return m_pSymbolicName; } + void setSymbolicName(::rtl::OString* pSymbolicName) + { m_pSymbolicName = pSymbolicName; } + + // Evaluation and value coercion + AstExprValue* eval(EvalKind ek); + AstExprValue* coerce(ExprType type, sal_Bool bAssign=sal_True); + + // Evaluate then store value inside this AstExpression + void evaluate(EvalKind ek); + + // Compare to AstExpressions + sal_Bool operator==(AstExpression *pExpr); + sal_Bool compare(AstExpression *pExpr); + + ::rtl::OString toString(); + void dump() {} +private: + // Fill out the lineno, filename and definition scope details + void fillDefinitionDetails(); + // Internal evaluation + AstExprValue* eval_internal(EvalKind ek); + // Evaluate different sets of operators + AstExprValue* eval_bin_op(EvalKind ek); + AstExprValue* eval_bit_op(EvalKind ek); + AstExprValue* eval_un_op(EvalKind ek); + AstExprValue* eval_symbol(EvalKind ek); + + AstScope* m_pScope; // scope defined in + sal_Int32 m_lineNo; // line number defined in + ::rtl::OString m_fileName; // fileName defined in + + ExprComb m_combOperator; + AstExpression* m_subExpr1; + AstExpression* m_subExpr2; + AstExprValue* m_exprValue; + ::rtl::OString* m_pSymbolicName; +}; + +#endif // _IDLC_ASTEXPRESSION_HXX_ + diff --git a/idlc/inc/idlc/astinterface.hxx b/idlc/inc/idlc/astinterface.hxx new file mode 100644 index 000000000..fa9ac69cf --- /dev/null +++ b/idlc/inc/idlc/astinterface.hxx @@ -0,0 +1,113 @@ +/************************************************************************* + * + * $RCSfile: astinterface.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTINTERFACE_HXX_ +#define _IDLC_ASTINTERFACE_HXX_ + +#ifndef _IDLC_ASTTYPE_HXX_ +#include <idlc/asttype.hxx> +#endif +#ifndef _IDLC_ASTSCOPE_HXX_ +#include <idlc/astscope.hxx> +#endif + + +class AstInterface : public AstType + , public AstScope +{ +public: + AstInterface(const ::rtl::OString& name, DeclList* pInherits, sal_Bool bIsDefined, AstScope* pScope); + virtual ~AstInterface(); + + const DeclList& getInheritedInterfaces() + { return m_inheritedInterfaces; } + void setInheritedInterfaces(const DeclList& inherits) + { + m_inheritedInterfaces = inherits; + } + sal_Int32 nInheritedInterfaces() + { + return m_inheritedInterfaces.size(); + } + + void setForwarded(sal_Bool bForwarded) + { m_bForwarded = bForwarded; } + sal_Bool isForwarded() + { return m_bForwarded; } + void setForwardedInSameFile(sal_Bool bForwarded) + { m_bForwardedInSameFile = bForwarded; } + sal_Bool isForwardedInSameFile() + { return m_bForwardedInSameFile; } + + void setDefined(sal_Bool bIsDefined) + { m_bIsDefined = bIsDefined; } + sal_Bool isDefined() + { return m_bIsDefined; } + + virtual sal_Bool dump(RegistryKey& rKey, RegistryTypeWriterLoader* pLoader); +private: + DeclList m_inheritedInterfaces; + sal_Bool m_bIsDefined; + sal_Bool m_bForwarded; + sal_Bool m_bForwardedInSameFile; +}; + +#endif // _IDLC_ASTINTERFACE_HXX_ + diff --git a/idlc/inc/idlc/astinterfacemember.hxx b/idlc/inc/idlc/astinterfacemember.hxx new file mode 100644 index 000000000..ae525380a --- /dev/null +++ b/idlc/inc/idlc/astinterfacemember.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * $RCSfile: astinterfacemember.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTINTERFACEMEMBER_HXX_ +#define _IDLC_ASTINTERFACEMEMBER_HXX_ + +#ifndef _IDLC_ASTINTERFACE_HXX_ +#include <idlc/astinterface.hxx> +#endif + +class AstInterfaceMember : public AstDeclaration +{ +public: + AstInterfaceMember(const sal_uInt32 flags, AstInterface* pRealInterface, + const ::rtl::OString& name, AstScope* pScope) + : AstDeclaration(NT_interface_member, name, pScope) + , m_pRealInterface(pRealInterface) + , m_flags(flags) + {} + virtual ~AstInterfaceMember() {} + + AstInterface* getRealInterface() + { return m_pRealInterface; } + sal_Bool isOptional() + { return ((m_flags & AF_OPTIONAL) == AF_OPTIONAL); } +private: + const sal_uInt32 m_flags; + AstInterface* m_pRealInterface; +}; + +#endif // _IDLC_ASTINTERFACEMEMBER_HXX_ + diff --git a/idlc/inc/idlc/astmember.hxx b/idlc/inc/idlc/astmember.hxx new file mode 100644 index 000000000..dc76bfb37 --- /dev/null +++ b/idlc/inc/idlc/astmember.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * $RCSfile: astmember.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTMEMBER_HXX_ +#define _IDLC_ASTMEMBER_HXX_ + +#ifndef _IDLC_ASTDECLARATION_HXX_ +#include <idlc/astdeclaration.hxx> +#endif + +class AstMember : public AstDeclaration +{ +public: + AstMember(AstType *pType, const ::rtl::OString& name, AstScope* pScope) + : AstDeclaration(NT_member, name, pScope) + , m_pType(pType) + {} + AstMember(const NodeType type, + AstType *pType, + const ::rtl::OString& name, + AstScope* pScope) + : AstDeclaration(type, name, pScope) + , m_pType(pType) + {} + virtual ~AstMember() {} + + AstType* getType() + { return m_pType; } + +private: + AstType* m_pType; +}; + +#endif // _IDLC_ASTMEMBER_HXX_ + diff --git a/idlc/inc/idlc/astmodule.hxx b/idlc/inc/idlc/astmodule.hxx new file mode 100644 index 000000000..0c35bf348 --- /dev/null +++ b/idlc/inc/idlc/astmodule.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * $RCSfile: astmodule.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTMODULE_HXX_ +#define _IDLC_ASTMODULE_HXX_ + +#include <idlc/astdeclaration.hxx> +#include <idlc/astscope.hxx> + +class AstModule : public AstDeclaration + , public AstScope +{ +public: + AstModule(const ::rtl::OString& name, AstScope* pScope) + : AstDeclaration(NT_module, name, pScope) + , AstScope(NT_module) + {} + AstModule(NodeType type, const ::rtl::OString& name, AstScope* pScope) + : AstDeclaration(type, name, pScope) + , AstScope(type) + {} + virtual ~AstModule() {} + + virtual sal_Bool dump(RegistryKey& rKey, RegistryTypeWriterLoader* pLoader); +}; + +#endif // _IDLC_ASTMODULE_HXX_ + diff --git a/idlc/inc/idlc/astneeds.hxx b/idlc/inc/idlc/astneeds.hxx new file mode 100644 index 000000000..314a66b3d --- /dev/null +++ b/idlc/inc/idlc/astneeds.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * $RCSfile: astneeds.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTNEEDS_HXX_ +#define _IDLC_ASTNEEDS_HXX_ + +#ifndef _IDLC_ASTSERVICE_HXX_ +#include <idlc/astservice.hxx> +#endif + +class AstNeeds : public AstDeclaration +{ +public: + AstNeeds(AstService* pRealService, const ::rtl::OString& name, AstScope* pScope) + : AstDeclaration(NT_needs, name, pScope) + , m_pRealService(pRealService) + {} + virtual ~AstNeeds() {} + + AstService* getRealService() + { return m_pRealService; } +private: + AstService* m_pRealService; +}; + +#endif // _IDLC_ASTNEEDS_HXX_ + diff --git a/idlc/inc/idlc/astobserves.hxx b/idlc/inc/idlc/astobserves.hxx new file mode 100644 index 000000000..59df2116e --- /dev/null +++ b/idlc/inc/idlc/astobserves.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * $RCSfile: astobserves.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTOBSERVES_HXX_ +#define _IDLC_ASTOBSERVES_HXX_ + +#ifndef _IDLC_ASTINTERFACE_HXX_ +#include <idlc/astinterface.hxx> +#endif + +class AstObserves : public AstDeclaration +{ +public: + AstObserves(AstInterface* pRealInterface, const ::rtl::OString& name, AstScope* pScope) + : AstDeclaration(NT_observes, name, pScope) + , m_pRealInterface(pRealInterface) + {} + virtual ~AstObserves() {} + + AstInterface* getRealInterface() + { return m_pRealInterface; } +private: + AstInterface* m_pRealInterface; +}; + +#endif // _IDLC_ASTOBSERVES_HXX_ + diff --git a/idlc/inc/idlc/astoperation.hxx b/idlc/inc/idlc/astoperation.hxx new file mode 100644 index 000000000..d6c3832d8 --- /dev/null +++ b/idlc/inc/idlc/astoperation.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * $RCSfile: astoperation.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTOPERATION_HXX_ +#define _IDLC_ASTOPERATION_HXX_ + +#ifndef _IDLC_ASTDECLARATION_HXX_ +#include <idlc/astdeclaration.hxx> +#endif +#ifndef _IDLC_ASTSCOPE_HXX_ +#include <idlc/astscope.hxx> +#endif + +#define OP_NONE 0x0000 +#define OP_ONEWAY 0x0001 + +class AstType; + +class AstOperation : public AstDeclaration + , public AstScope +{ +public: + AstOperation(sal_uInt32 flags, AstType* pReturnType, const ::rtl::OString& name, AstScope* pScope) + : AstDeclaration(NT_operation, name, pScope) + , AstScope(NT_operation) + , m_flags(flags) + , m_pReturnType(pReturnType) + {} + virtual ~AstOperation() {} + + sal_Bool isOneway() + { return ((m_flags & OP_ONEWAY) == OP_ONEWAY); } + sal_Bool isVoid(); + AstType* getReturnType() + { return m_pReturnType; } + + void addExceptions(StringList* pExceptions); + const DeclList& getExceptions() + { return m_exceptions; } + sal_uInt16 nExceptions() + { return m_exceptions.size(); } + + sal_Bool dumpBlob(RegistryTypeWriter& rBlob, sal_uInt16 index); + + // scope management + virtual AstDeclaration* addDeclaration(AstDeclaration* pDecl); +private: + sal_uInt32 m_flags; + AstType* m_pReturnType; + DeclList m_exceptions; +}; + +#endif // _IDLC_ASTOPERATION_HXX_ + diff --git a/idlc/inc/idlc/astparameter.hxx b/idlc/inc/idlc/astparameter.hxx new file mode 100644 index 000000000..2de3705e1 --- /dev/null +++ b/idlc/inc/idlc/astparameter.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * $RCSfile: astparameter.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTPARAMETER_HXX_ +#define _IDLC_ASTPARAMETER_HXX_ + +#ifndef _IDLC_ASTMEMBER_HXX_ +#include <idlc/astmember.hxx> +#endif + +enum Direction +{ + DIR_IN, + DIR_OUT, + DIR_INOUT +}; + +class AstParameter : public AstMember +{ +public: + AstParameter(Direction direction, AstType *pType, const ::rtl::OString& name, AstScope* pScope) + : AstMember(NT_parameter, pType, name, pScope) + , m_direction(direction) + , m_pType(pType) + {} + virtual ~AstParameter() {} + + Direction getDirection() + { return m_direction; } + AstType* getType() + { return m_pType; } +private: + Direction m_direction; + AstType* m_pType; +}; + +#endif // _IDLC_ASTPARAMETER_HXX_ + diff --git a/idlc/inc/idlc/astscope.hxx b/idlc/inc/idlc/astscope.hxx new file mode 100644 index 000000000..40551c18c --- /dev/null +++ b/idlc/inc/idlc/astscope.hxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * $RCSfile: astscope.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTSCOPE_HXX_ +#define _IDLC_ASTSCOPE_HXX_ + +#ifndef _IDLC_IDLC_HXX_ +#include <idlc/idlc.hxx> +#endif + +class AstExpression; +#ifndef _IDLC_ASTDECLARATION_HXX_ +#include <idlc/astdeclaration.hxx> +#endif +#ifndef _IDLC_ASTEXPRESSION_HXX_ +#include <idlc/astexpression.hxx> +#endif + +class AstScope +{ +public: + AstScope(NodeType nodeType); + virtual ~AstScope(); + + const NodeType getScopeNodeType() + { return m_nodeType; } + + virtual AstDeclaration* addDeclaration(AstDeclaration* pDecl); + + sal_uInt32 nMembers() + { return m_declarations.size(); } + DeclList::iterator getIteratorBegin() + { return m_declarations.begin(); } + DeclList::iterator getIteratorEnd() + { return m_declarations.end(); } + sal_uInt16 getNodeCount(NodeType nType); + + // Name look up mechanism + AstDeclaration* lookupByName(const ::rtl::OString& scopedName); + // Look up the identifier 'name' specified only in the local scope + AstDeclaration* lookupByNameLocal(const ::rtl::OString& name); + + AstDeclaration* lookupInForwarded(const ::rtl::OString& scopedName); + AstDeclaration* lookupInInherited(const ::rtl::OString& scopedName); + + // Look up a predefined type by its ExprType + AstDeclaration* lookupPrimitiveType(ExprType type); + + AstDeclaration* lookupForAdd(AstDeclaration* pDecl); + +private: + DeclList m_declarations; + const NodeType m_nodeType; +}; + +#endif // _IDLC_ASTSCOPE_HXX_ + diff --git a/idlc/inc/idlc/astsequence.hxx b/idlc/inc/idlc/astsequence.hxx new file mode 100644 index 000000000..5b56def35 --- /dev/null +++ b/idlc/inc/idlc/astsequence.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * $RCSfile: astsequence.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTSEQUENCE_HXX_ +#define _IDLC_ASTSEQUENCE_HXX_ + +#ifndef _IDLC_ASTTYPE_HXX_ +#include <idlc/asttype.hxx> +#endif + +class AstSequence : public AstType +{ +public: + AstSequence(AstType* pMemberType, AstScope* pScope) + : AstType(NT_sequence, ::rtl::OString("[]")+pMemberType->getScopedName(), pScope) + , m_pMemberType(pMemberType) + , m_pRelativName(NULL) + {} + virtual ~AstSequence() + { + if ( m_pRelativName ) + delete m_pRelativName; + } + + AstType* getMemberType() + { return m_pMemberType; } + + virtual const sal_Char* getRelativName(); +private: + AstType* m_pMemberType; + ::rtl::OString* m_pRelativName; +}; + +#endif // _IDLC_ASTSEQUENCE_HXX_ + diff --git a/idlc/inc/idlc/astservice.hxx b/idlc/inc/idlc/astservice.hxx new file mode 100644 index 000000000..dee7b4727 --- /dev/null +++ b/idlc/inc/idlc/astservice.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * $RCSfile: astservice.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTSERVICE_HXX_ +#define _IDLC_ASTSERVICE_HXX_ + +#ifndef _IDLC_ASTDECLARATION_HXX_ +#include <idlc/astdeclaration.hxx> +#endif +#ifndef _IDLC_ASTSCOPE_HXX_ +#include <idlc/astscope.hxx> +#endif + +class AstService : public AstDeclaration + , public AstScope +{ +public: + AstService(const ::rtl::OString& name, AstScope* pScope) + : AstDeclaration(NT_service, name, pScope) + , AstScope(NT_service) + {} + virtual ~AstService() {} + + virtual sal_Bool dump(RegistryKey& rKey, RegistryTypeWriterLoader* pLoader); +}; + +#endif // _IDLC_ASTSERVICE_HXX_ + diff --git a/idlc/inc/idlc/astservicemember.hxx b/idlc/inc/idlc/astservicemember.hxx new file mode 100644 index 000000000..1ea71c44a --- /dev/null +++ b/idlc/inc/idlc/astservicemember.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * $RCSfile: astservicemember.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTSERVICEMEMBER_HXX_ +#define _IDLC_ASTSERVICEMEMBER_HXX_ + +#ifndef _IDLC_ASTSERVICE_HXX_ +#include <idlc/astservice.hxx> +#endif + +class AstServiceMember : public AstDeclaration +{ +public: + AstServiceMember(const sal_uInt32 flags, AstService* pRealService, + const ::rtl::OString& name, AstScope* pScope) + : AstDeclaration(NT_service_member, name, pScope) + , m_pRealService(pRealService) + , m_flags(flags) + {} + virtual ~AstServiceMember() {} + + AstService* getRealService() + { return m_pRealService; } + sal_Bool isOptional() + { return ((m_flags & AF_OPTIONAL) == AF_OPTIONAL); } +private: + const sal_uInt32 m_flags; + AstService* m_pRealService; +}; + +#endif // _IDLC_ASTSERVICEMEMBER_HXX_ + diff --git a/idlc/inc/idlc/aststack.hxx b/idlc/inc/idlc/aststack.hxx new file mode 100644 index 000000000..c3e7bbac7 --- /dev/null +++ b/idlc/inc/idlc/aststack.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * $RCSfile: aststack.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTSTACK_HXX_ +#define _IDLC_ASTSTACK_HXX_ + +#ifndef _SAL_TYPES_H_ +#include <sal/types.h> +#endif + +class AstScope; + +class AstStack +{ +public: + AstStack(); + virtual ~AstStack(); + + sal_uInt32 depth(); + AstScope* top(); + AstScope* bottom(); + AstScope* nextToTop(); + AstScope* topNonNull(); + AstStack* push(AstScope* pScope); + void pop(); + void clear(); + +private: + AstScope** m_stack; + sal_uInt32 m_size; + sal_uInt32 m_top; +}; + +#endif // _IDLC_ASTSTACK_HXX_ + diff --git a/idlc/inc/idlc/aststruct.hxx b/idlc/inc/idlc/aststruct.hxx new file mode 100644 index 000000000..076d9fb00 --- /dev/null +++ b/idlc/inc/idlc/aststruct.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * $RCSfile: aststruct.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTSTRUCT_HXX_ +#define _IDLC_ASTSTRUCT_HXX_ + +#ifndef _IDLC_ASTTYPE_HXX_ +#include <idlc/asttype.hxx> +#endif +#ifndef _IDLC_ASTSCOPE_HXX_ +#include <idlc/astscope.hxx> +#endif + +class AstStruct; +typedef ::std::vector< AstStruct* > InheritedTypes; + +class AstStruct : public AstType + , public AstScope +{ +public: + AstStruct(const ::rtl::OString& name, AstStruct* pBaseType, AstScope* pScope); + AstStruct(const NodeType type, + const ::rtl::OString& name, + AstStruct* pBaseType, + AstScope* pScope); + virtual ~AstStruct(); + + AstStruct* getBaseType() + { return m_pBaseType; } + + virtual sal_Bool dump(RegistryKey& rKey, RegistryTypeWriterLoader* pLoader); +private: + AstStruct* m_pBaseType; +}; + +#endif // _IDLC_ASTSTRUCT_HXX_ + diff --git a/idlc/inc/idlc/asttype.hxx b/idlc/inc/idlc/asttype.hxx new file mode 100644 index 000000000..a3b6fb78c --- /dev/null +++ b/idlc/inc/idlc/asttype.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * $RCSfile: asttype.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTTYPE_HXX_ +#define _IDLC_ASTTYPE_HXX_ + +#ifndef _IDLC_ASTDECLARATION_HXX_ +#include <idlc/astdeclaration.hxx> +#endif + +class AstType : public AstDeclaration +{ +public: + AstType(const NodeType type, const ::rtl::OString& name, AstScope* pScope) + : AstDeclaration(type, name, pScope) + {} + + virtual ~AstType() {} +}; + +#endif // _IDLC_ASTTYPE_HXX_ + diff --git a/idlc/inc/idlc/asttypedef.hxx b/idlc/inc/idlc/asttypedef.hxx new file mode 100644 index 000000000..57a5cdcaf --- /dev/null +++ b/idlc/inc/idlc/asttypedef.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * $RCSfile: asttypedef.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTTYPEDEF_HXX_ +#define _IDLC_ASTTYPEDEF_HXX_ + +#ifndef _IDLC_ASTTYPE_HXX_ +#include <idlc/asttype.hxx> +#endif + +class AstTypeDef : public AstType +{ +public: + AstTypeDef(AstType* pBaseType, const ::rtl::OString& name, AstScope* pScope) + : AstType(NT_typedef, name, pScope) + , m_pBaseType(pBaseType) + {} + virtual ~AstTypeDef() {} + + AstType* getBaseType() + { return m_pBaseType; } + + virtual sal_Bool dump(RegistryKey& rKey, RegistryTypeWriterLoader* pLoader); +private: + AstType* m_pBaseType; +}; + +#endif // _IDLC_ASTTYPEDEF_HXX_ + diff --git a/idlc/inc/idlc/astunion.hxx b/idlc/inc/idlc/astunion.hxx new file mode 100644 index 000000000..7308bfabe --- /dev/null +++ b/idlc/inc/idlc/astunion.hxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * $RCSfile: astunion.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTUNION_HXX_ +#define _IDLC_ASTUNION_HXX_ + +#ifndef _IDLC_ASTSTRUCT_HXX_ +#include <idlc/aststruct.hxx> +#endif +#ifndef _IDLC_ASTUNIONBRANCH_HXX_ +#include <idlc/astunionbranch.hxx> +#endif + +class AstUnion : public AstStruct +{ +public: + AstUnion(const ::rtl::OString& name, AstType* pDiscType, AstScope* pScope); + virtual ~AstUnion(); + + AstType* getDiscrimantType() + { return m_pDiscriminantType; } + ExprType getDiscrimantExprType() + { return m_discExprType; } + + virtual sal_Bool dump(RegistryKey& rKey, RegistryTypeWriterLoader* pLoader); + + virtual AstDeclaration* addDeclaration(AstDeclaration* pDecl); +protected: + // Look up a branch by node pointer + AstUnionBranch* lookupBranch(AstUnionBranch* pBranch); + + // Look up the branch with the "default" label + AstUnionBranch* lookupDefault(sal_Bool bReportError = sal_True ); + + // Look up a branch given a branch with a label. This is used to + // check for duplicate labels + AstUnionBranch* lookupLabel(AstUnionBranch* pBranch); + + // Look up a union branch given an enumerator. This is used to + // check for duplicate enum labels + AstUnionBranch* lookupEnum(AstUnionBranch* pBranch); + +private: + AstType* m_pDiscriminantType; + ExprType m_discExprType; +}; + +#endif // _IDLC_ASTUNION_HXX_ + diff --git a/idlc/inc/idlc/astunionbranch.hxx b/idlc/inc/idlc/astunionbranch.hxx new file mode 100644 index 000000000..3e5c7ba4f --- /dev/null +++ b/idlc/inc/idlc/astunionbranch.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * $RCSfile: astunionbranch.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTUNIONBRANCH_HXX_ +#define _IDLC_ASTUNIONBRANCH_HXX_ + +#ifndef _IDLC_ASTMEMBER_HXX_ +#include <idlc/astmember.hxx> +#endif +#ifndef _IDLC_ASTUNIONLABEL_HXX_ +#include <idlc/astunionlabel.hxx> +#endif + +class AstUnionBranch : public AstMember +{ +public: + AstUnionBranch(AstUnionLabel* pLabel, AstType* pType, const ::rtl::OString& name, AstScope* pScope); + virtual ~AstUnionBranch(); + + AstUnionLabel* getLabel() + { return m_pLabel; } +private: + AstUnionLabel* m_pLabel; +}; + +#endif // _IDLC_ASTUNIONBRANCH_HXX_ + diff --git a/idlc/inc/idlc/astunionlabel.hxx b/idlc/inc/idlc/astunionlabel.hxx new file mode 100644 index 000000000..457f8e0b7 --- /dev/null +++ b/idlc/inc/idlc/astunionlabel.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * $RCSfile: astunionlabel.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ASTUNIONLABEL_HXX_ +#define _IDLC_ASTUNIONLABEL_HXX_ + +enum UnionLabel +{ + UL_default, // Label is "default" + UL_label // Regular label +}; + +class AstUnionLabel +{ +public: + AstUnionLabel(); + AstUnionLabel(UnionLabel labelKind, AstExpression* pExpr); + virtual ~AstUnionLabel(); + + UnionLabel getLabelKind() + { return m_label; } + AstExpression* getLabelValue() + { return m_pLabelValue; } +private: + UnionLabel m_label; + AstExpression* m_pLabelValue; +}; + +#endif // _IDLC_ASTUNIONLABEL_HXX_ + diff --git a/idlc/inc/idlc/errorhandler.hxx b/idlc/inc/idlc/errorhandler.hxx new file mode 100644 index 000000000..5b4e881b5 --- /dev/null +++ b/idlc/inc/idlc/errorhandler.hxx @@ -0,0 +1,183 @@ +/************************************************************************* + * + * $RCSfile: errorhandler.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_ERRORHANDLER_HXX_ +#define _IDLC_ERRORHANDLER_HXX_ + +#ifndef _IDLC_ASTDECLARATION_HXX_ +#include <idlc/astdeclaration.hxx> +#endif +#ifndef _IDLC_ASTEXPRESSION_HXX_ +#include <idlc/astexpression.hxx> +#endif +#ifndef _IDLC_ASTUNION_HXX_ +#include <idlc/astunion.hxx> +#endif +#ifndef _IDLC_ASTENUM_HXX_ +#include <idlc/astenum.hxx> +#endif + +enum ErrorCode +{ + EIDL_NONE, // No error + EIDL_SYNTAX_ERROR, // Syntax error in IDL input + // More details will be gleaned from examining + // the parse state + EIDL_REDEF, // Redefinition + EIDL_REDEF_SCOPE, // Redefinition inside defining scope + EIDL_DEF_USE, // Definition after use + EIDL_MULTIPLE_BRANCH, // More than one union branch with this label + EIDL_COERCION_FAILURE, // Coercion failure + EIDL_SCOPE_CONFLICT, // Between fwd declare and full declare + EIDL_ONEWAY_CONFLICT, // Between op decl and argument direction + EIDL_DISC_TYPE, // Illegal discriminator type in union + EIDL_LABEL_TYPE, // Mismatch with discriminator type in union + EIDL_ILLEGAL_ADD, // Illegal add action + EIDL_ILLEGAL_USE, // Illegal type used in expression + EIDL_ILLEGAL_RAISES, // Error in "raises" clause + EIDL_CANT_INHERIT, // Cannot inherit from non-interface + EIDL_LOOKUP_ERROR, // Identifier not found + EIDL_INHERIT_FWD_ERROR, // Cannot inherit from fwd decl interface + EIDL_CONSTANT_EXPECTED, // We got something else.. + EIDL_NAME_CASE_ERROR, // Spelling differences found + EIDL_ENUM_VAL_EXPECTED, // Expected an enumerator + EIDL_ENUM_VAL_NOT_FOUND, // Didnt find an enumerator with that name + EIDL_EVAL_ERROR, // Error in evaluating expression + EIDL_AMBIGUOUS, // Ambiguous name definition + EIDL_DECL_NOT_DEFINED, // Forward declared but never defined + EIDL_FWD_DECL_LOOKUP, // Tried to lookup in fwd declared intf + EIDL_RECURSIVE_TYPE, // Illegal recursive use of type + EIDL_NONVOID_ONEWAY, // Non-void return type in oneway operation + EIDL_NOT_A_TYPE, // Not a type + EIDL_TYPE_NOT_VALID, // Type is not valid in this context + EIDL_INTERFACEMEMBER_LOOKUP, // interface is not defined or a fwd declaration not exists + EIDL_SERVICEMEMBER_LOOKUP, + EIDL_MULTIBLE_INHERITANCE, // multible inheritance is not allowed + EIDL_TYPE_IDENT_CONFLICT, // type and identifier has equal names + EIDL_ONEWAY_RAISE_CONFLICT, // oneway function raised excpetion conflict + EIDL_WRONGATTRIBUTEFLAG, + EIDL_DEFINED_ATTRIBUTEFLAG, + EIDL_WRONGATTRIBUTEKEYWORD, + EIDL_MISSINGATTRIBUTEKEYWORD, + EIDL_ATTRIBUTEREADONLYEXPECTED, + EIDL_OPTIONALEXPECTED +}; + +enum WarningCode +{ + WIDL_EXPID_CONFLICT, // exception id conflict + WIDL_REQID_CONFLICT, // request id conflict + WIDL_INHERIT_IDCONFLICT, // request id conflict inheritance tree + WIDL_TYPE_IDENT_CONFLICT // type and identifier has equal names +}; + +class ErrorHandler +{ +public: + // Report errors with varying numbers of arguments + void error0(ErrorCode e); + void error1(ErrorCode e, AstDeclaration* d); + void error2(ErrorCode e, AstDeclaration* d1, AstDeclaration* d2); + void error3(ErrorCode e, AstDeclaration* d1, AstDeclaration* d2, AstDeclaration* d3); + + // Warning + void warning1(WarningCode e, AstDeclaration* d); + void warning2(WarningCode e, AstDeclaration* d1, AstDeclaration* d2); + + // Report a syntax error in IDL input + void syntaxError(ParseState state, sal_Int32 lineNumber, sal_Char* errmsg); + + // Report a name being used with different spellings + void nameCaseError(sal_Char *n, sal_Char *t); + + // Report an unsuccesful coercion attempt + void coercionError(AstExpression *pExpr, ExprType et); + + // Report a failed name lookup attempt + void lookupError(const ::rtl::OString& n); + // Report a failed name lookup attempt + void lookupError(ErrorCode e, const ::rtl::OString& n, AstDeclaration* pScope); + + + // Report a type error + void noTypeError(AstDeclaration* pDecl); + + void inheritanceError(::rtl::OString* name, AstDeclaration* pDecl); + + void flagError(ErrorCode e, sal_uInt32 flag); + + void forwardLookupError(AstDeclaration* pForward, const ::rtl::OString& name); + + void constantExpected(AstDeclaration* pDecl, const ::rtl::OString& name); + + void evalError(AstExpression* pExpr); + + // Report a situation where an enumerator was expected but we got + // something else instead. This occurs when a union with an enum + // discriminator is being parsed and one of the branch labels is + // not an enumerator in that enum + void enumValExpected(AstUnion* pUnion, AstUnionLabel *pLabel); + + // Report a failed enumerator lookup in an enum + void enumValLookupFailure(AstUnion* pUnion, AstEnum* pEnum, const ::rtl::OString& name); +}; + +#endif // _IDLC_ERRORHANDLER_HXX_ + diff --git a/idlc/inc/idlc/fehelper.hxx b/idlc/inc/idlc/fehelper.hxx new file mode 100644 index 000000000..d2093fd6c --- /dev/null +++ b/idlc/inc/idlc/fehelper.hxx @@ -0,0 +1,161 @@ +/************************************************************************* + * + * $RCSfile: fehelper.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_FEHELPER_HXX_ +#define _IDLC_FEHELPER_HXX_ + +#ifndef _IDLC_ASTTYPE_HXX_ +#include <idlc/asttype.hxx> +#endif +#ifndef _IDLC_ASTINTERFACE_HXX_ +#include <idlc/astinterface.hxx> +#endif + +class FeDeclarator +{ +public: + // Enum to denote types of declarators + enum DeclaratorType + { + FD_simple, // Simple declarator + FD_complex // Complex declarator (complex_part field used) + }; + + FeDeclarator(const ::rtl::OString& name, DeclaratorType declType, AstDeclaration* pComplPart); + virtual ~FeDeclarator(); + + AstDeclaration* getComplexPart() + { return m_pComplexPart; } + const ::rtl::OString& getName() + { return m_name; } + DeclaratorType getDeclType() + { return m_declType; } + + sal_Bool checkType(AstDeclaration *pType); + AstType* compose(AstDeclaration* pDecl); +private: + AstDeclaration* m_pComplexPart; + ::rtl::OString m_name; + DeclaratorType m_declType; +}; + +typedef ::std::list< FeDeclarator* > FeDeclList; + +class FeInheritanceHeader +{ +public: + FeInheritanceHeader(NodeType nodeType, ::rtl::OString* pName, StringList* pInherits); + + virtual ~FeInheritanceHeader() + { + if ( m_pName ) + delete m_pName; + if ( m_pInherits ) + delete m_pInherits; + } + + void setNodeType(NodeType nodeType) + { m_nodeType = nodeType; } + NodeType getNodeType() + { return m_nodeType; } + void setName(::rtl::OString* pName) + { m_pName = pName; } + ::rtl::OString* getName() + { return m_pName; } + void setInheritsAsStringList(StringList* pInherits) + { initializeInherits(pInherits); } + void setInherits(DeclList* pInherits) + { m_pInherits = pInherits; } + DeclList* getInherits() + { return m_pInherits; } + sal_uInt32 nInherits() + { + if ( m_pInherits ) + return m_pInherits->size(); + else + return 0; + } +protected: + virtual sal_Bool initializeInherits(StringList* pinherits); + + NodeType m_nodeType; + ::rtl::OString* m_pName; + DeclList* m_pInherits; +}; + +class FeInterfaceHeader : public FeInheritanceHeader +{ +public: + FeInterfaceHeader( ::rtl::OString* pName, StringList* pInherits) + : FeInheritanceHeader(NT_interface, pName, pInherits) + {} + FeInterfaceHeader(NodeType nodeType, ::rtl::OString* pName, StringList* pInherits) + : FeInheritanceHeader(nodeType, pName, pInherits) + {} + + virtual ~FeInterfaceHeader() + {} + +protected: + virtual sal_Bool initializeInherits(StringList* pinherits); +}; + +#endif // _IDLC_FEHELPER_HXX_ + diff --git a/idlc/inc/idlc/idlc.hxx b/idlc/inc/idlc/idlc.hxx new file mode 100644 index 000000000..05fbecd79 --- /dev/null +++ b/idlc/inc/idlc/idlc.hxx @@ -0,0 +1,175 @@ +/************************************************************************* + * + * $RCSfile: idlc.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_IDLC_HXX_ +#define _IDLC_IDLC_HXX_ + +#ifndef _IDLC_IDLCTYPES_HXX_ +#include <idlc/idlctypes.hxx> +#endif +#ifndef _IDLC_ASTSTACK_HXX_ +#include <idlc/aststack.hxx> +#endif +#ifndef _IDLC_OPTIONS_HXX_ +#include <idlc/options.hxx> +#endif + +class AstModule; +class Options; +class ErrorHandler; + +class Idlc +{ +public: + Idlc(Options* pOptions); + virtual ~Idlc(); + + void init(); + + Options* getOptions() + { return m_pOptions; } + AstStack* scopes() + { return m_pScopes; } + AstModule* getRoot() + { return m_pRoot; } + ErrorHandler* error() + { return m_pErrorHandler; } + const ::rtl::OString& getFileName() + { return m_fileName; } + void setFileName(const ::rtl::OString& fileName) + { m_fileName = fileName; } + const ::rtl::OString& getMainFileName() + { return m_mainFileName; } + void setMainFileName(const ::rtl::OString& mainFileName) + { m_mainFileName = mainFileName; } + const ::rtl::OString& getRealFileName() + { return m_realFileName; } + void setRealFileName(const ::rtl::OString& realFileName) + { m_realFileName = realFileName; } + const ::rtl::OString& getDocumentation() + { + m_bIsDocValid = sal_False; + return m_documentation; + } + void setDocumentation(const ::rtl::OString& documentation) + { + m_documentation = documentation; + m_bIsDocValid = sal_True; + } + sal_Bool isDocValid(); + sal_Bool isInMainFile() + { return m_bIsInMainfile; } + void setInMainfile(sal_Bool bInMainfile) + { m_bIsInMainfile = bInMainfile; } + sal_uInt32 getErrorCount() + { return m_errorCount; } + void setErrorCount(sal_uInt32 errorCount) + { m_errorCount = errorCount; } + void incErrorCount() + { m_errorCount++; } + sal_uInt32 getLineNumber() + { return m_lineNumber; } + void setLineNumber(sal_uInt32 lineNumber) + { m_lineNumber = lineNumber; } + void incLineNumber() + { m_lineNumber++; } + ParseState getParseState() + { return m_parseState; } + void setParseState(ParseState parseState) + { m_parseState = parseState; } + + void insertInclude(const ::rtl::OString& inc) + { m_includes.insert(inc); } + StringSet* getIncludes() + { return &m_includes; } + + void reset(); +private: + Options* m_pOptions; + AstStack* m_pScopes; + AstModule* m_pRoot; + ErrorHandler* m_pErrorHandler; + ::rtl::OString m_fileName; + ::rtl::OString m_mainFileName; + ::rtl::OString m_realFileName; + ::rtl::OString m_documentation; + sal_Bool m_bIsDocValid; + sal_Bool m_bGenerateDoc; + sal_Bool m_bIsInMainfile; + sal_uInt32 m_errorCount; + sal_uInt32 m_lineNumber; + ParseState m_parseState; + StringSet m_includes; +}; + +sal_Int32 SAL_CALL compileFile(const ::rtl::OString& fileName); +sal_Int32 SAL_CALL produceFile(const ::rtl::OString& fileName); +void SAL_CALL removeIfExists(const ::rtl::OString& fileName); +sal_Bool SAL_CALL canBeRedefined(AstDeclaration *pDecl); + +class AstType; +AstType* SAL_CALL resolveTypeDef(AstType* pType); + +Idlc* SAL_CALL idlc(); +Idlc* SAL_CALL setIdlc(Options* pOptions); + + +#endif // _IDLC_IDLC_HXX_ + diff --git a/idlc/inc/idlc/idlctypes.hxx b/idlc/inc/idlc/idlctypes.hxx new file mode 100644 index 000000000..f9b817706 --- /dev/null +++ b/idlc/inc/idlc/idlctypes.hxx @@ -0,0 +1,296 @@ +/************************************************************************* + * + * $RCSfile: idlctypes.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _IDLC_IDLCTYPES_HXX_ +#define _IDLC_IDLCTYPES_HXX_ + +#include <stdio.h> + +#include <hash_map> +#include <list> +#include <vector> +#include <set> + +#ifndef _SAL_TYPES_H_ +#include <sal/types.h> +#endif +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif + +struct EqualString +{ + sal_Bool operator()(const ::rtl::OString& str1, const ::rtl::OString& str2) const + { + return (str1 == str2); + } +}; + +struct HashString +{ + size_t operator()(const ::rtl::OString& str) const + { + return str.hashCode(); + } +}; + +struct LessString +{ + sal_Bool operator()(const ::rtl::OString& str1, const ::rtl::OString& str2) const + { + return (str1 < str2); + } +}; + +typedef ::std::list< ::rtl::OString > StringList; +typedef ::std::vector< ::rtl::OString > StringVector; +typedef ::std::set< ::rtl::OString, LessString > StringSet; + +class AstExpression; +typedef ::std::list< AstExpression* > ExprList; + +class AstUnionLabel; +typedef ::std::list< AstUnionLabel* > LabelList; + +class AstDeclaration; + +typedef ::std::hash_map< ::rtl::OString, AstDeclaration*, HashString, EqualString > DeclMap; +typedef ::std::list< AstDeclaration* > DeclList; + +class AstScope; +AstDeclaration* SAL_CALL scopeAsDecl(AstScope* pScope); +AstScope* SAL_CALL declAsScope(AstDeclaration* pDecl); + +#ifdef WIN32 +#pragma warning( disable : 4541 ) +#endif + +// flags used for attributes, properties and services +#define AF_INVALID 0x0000 +#define AF_READONLY 0x0001 +#define AF_OPTIONAL 0x0002 +#define AF_MAYBEVOID 0x0004 +#define AF_BOUND 0x0008 +#define AF_CONSTRAINED 0x0010 +#define AF_TRANSIENT 0x0020 +#define AF_MAYBEAMBIGUOUS 0x0040 +#define AF_MAYBEDEFAULT 0x0080 +#define AF_REMOVEABLE 0x0100 +#define AF_ATTRIBUTE 0x0200 +#define AF_PROPERTY 0x0400 + +enum ParseState +{ + PS_NoState, + PS_TypeDeclSeen, // Seen complete typedef declaration + PS_ConstantDeclSeen, // Seen complete const declaration + PS_ExceptionDeclSeen, // Seen complete exception declaration + PS_InterfaceDeclSeen, // Seen complete interface declaration + PS_ServiceDeclSeen, // Seen complete service declaration + PS_ModuleDeclSeen, // Seen complete module declaration + PS_AttributeDeclSeen, // Seen complete attribute declaration + PS_PropertyDeclSeen, // Seen complete property declaration + PS_OperationDeclSeen, // Seen complete operation declaration + PS_ConstantsDeclSeen, // Seen complete constants declaration + + PS_ServiceSeen, // Seen a SERVICE keyword + PS_ServiceIDSeen, // Seen the service ID + PS_ServiceSqSeen, // '{' seen for service + PS_ServiceQsSeen, // '}' seen for service + PS_ServiceBodySeen, // Seen complete service body + PS_ServiceMemberSeen, // Seen a service member + PS_ServiceIFHeadSeen, // Seen an interface member header + PS_ServiceSHeadSeen, // Seen an service member header + + PS_ModuleSeen, // Seen a MODULE keyword + PS_ModuleIDSeen, // Seen the module ID + PS_ModuleSqSeen, // '{' seen for module + PS_ModuleQsSeen, // '}' seen for module + PS_ModuleBodySeen, // Seen complete module body + + PS_ConstantsSeen, // Seen a CONSTANTS keyword + PS_ConstantsIDSeen, // Seen the constants ID + PS_ConstantsSqSeen, // '{' seen for constants + PS_ConstantsQsSeen, // '}' seen for constants + PS_ConstantsBodySeen, // Seen complete constants body + + PS_InterfaceSeen, // Seen an INTERFACE keyword + PS_InterfaceIDSeen, // Seen the interface ID + PS_InterfaceHeadSeen, // Seen the interface head + PS_InheritSpecSeen, // Seen a complete inheritance spec + PS_ForwardDeclSeen, // Forward interface decl seen + PS_InterfaceSqSeen, // '{' seen for interface + PS_InterfaceQsSeen, // '}' seen for interface + PS_InterfaceBodySeen, // Seen an interface body + PS_InheritColonSeen, // Seen ':' in inheritance list + + PS_SNListCommaSeen, // Seen ',' in list of scoped names + PS_ScopedNameSeen, // Seen a complete scoped name + PS_SN_IDSeen, // Seen an identifier as part of a scoped name + PS_ScopeDelimSeen, // Seen a scope delim as party of a scoped name + + PS_ConstSeen, // Seen a CONST keyword + PS_ConstTypeSeen, // Parsed the type of a constant + PS_ConstIDSeen, // Seen the constant ID + PS_ConstAssignSeen, // Seen the '=' + PS_ConstExprSeen, // Seen the constant value expression + + PS_TypedefSeen, // Seen a TYPEDEF keyword + PS_TypeSpecSeen, // Seen a complete type specification + PS_DeclaratorsSeen, // Seen a complete list of declarators + + PS_StructSeen, // Seen a STRUCT keyword + PS_StructHeaderSeen, // Seen struct header + PS_StructIDSeen, // Seen the struct ID + PS_StructSqSeen, // '{' seen for struct + PS_StructQsSeen, // '}' seen for struct + PS_StructBodySeen, // Seen complete body of struct decl + + PS_MemberTypeSeen, // Seen type of struct or except member + PS_MemberDeclsSeen, // Seen decls of struct or except members + PS_MemberDeclsCompleted,// Completed one struct or except member to ';' + + PS_UnionSeen, // Seen a UNION keyword + PS_UnionIDSeen, // Seen the union ID + PS_SwitchSeen, // Seen the SWITCH keyword + PS_SwitchOpenParSeen, // Seen the switch open par. + PS_SwitchTypeSeen, // Seen the switch type spec + PS_SwitchCloseParSeen, // Seen the switch close par. + PS_UnionSqSeen, // '{' seen for union + PS_UnionQsSeen, // '}' seen for union + PS_DefaultSeen, // Seen DEFAULT keyword + PS_UnionLabelSeen, // Seen label of union element + PS_LabelColonSeen, // Seen ':' of union branch label + PS_LabelExprSeen, // Seen expression of union branch label + PS_UnionElemSeen, // Seen a union element + PS_UnionElemCompleted, // Completed one union member up to ';' + PS_CaseSeen, // Seen a CASE keyword + PS_UnionElemTypeSeen, // Seen type spec for union element + PS_UnionElemDeclSeen, // Seen declarator for union element + PS_UnionBodySeen, // Seen completed union body + + PS_EnumSeen, // Seen an ENUM keyword + PS_EnumIDSeen, // Seen the enum ID + PS_EnumSqSeen, // Seen '{' for enum + PS_EnumQsSeen, // Seen '}' for enum + PS_EnumBodySeen, // Seen complete enum body + PS_EnumCommaSeen, // Seen ',' in list of enumerators + + PS_SequenceSeen, // Seen a SEQUENCE keyword + PS_SequenceSqSeen, // Seen '<' for sequence + PS_SequenceQsSeen, // Seen '>' for sequence + PS_SequenceTypeSeen, // Seen type decl for sequence + + PS_ArrayIDSeen, // Seen array ID + PS_ArrayTypeSeen, // Seen array type + PS_ArrayCompleted, // Seen completed array declaration + PS_DimSqSeen, // Seen '[' for array dimension + PS_DimQsSeen, // Seen ']' for array dimension + PS_DimExprSeen, // Seen size expression for array dimension + + + PS_FlagHeaderSeen, // Seen the attribute|property|interface member head + PS_AttrSeen, // Seen ATTRIBUTE keyword + PS_AttrTypeSeen, // Seen type decl for attribute + PS_AttrCompleted, // Seen complete attribute declaration + PS_ReadOnlySeen, // Seen READONLY keyword + PS_OptionalSeen, // Seen OPTIONAL keyword + PS_MayBeVoidSeen, // Seen MAYBEVOID yword + PS_BoundSeen, // Seen BOUND keyword + PS_ConstrainedSeen, // Seen CONSTRAINED keyword + PS_TransientSeen, // Seen TRANSIENT keyword + PS_MayBeAmbigiousSeen, // Seen MAYBEAMBIGIOUS keyword + PS_MayBeDefaultSeen, // Seen MAYBEDEFAULT keyword + PS_RemoveableSeen, // Seen REMOVEABLE keyword + + PS_PropertySeen, // Seen PROPERTY keyword + PS_PropertyTypeSeen, // Seen type decl for property + PS_PropertyCompleted, // Seen complete property declaration + + PS_ExceptSeen, // Seen EXCEPTION keyword + PS_ExceptHeaderSeen, // Seen exception header keyword + PS_ExceptIDSeen, // Seen exception identifier + PS_ExceptSqSeen, // Seen '{' for exception + PS_ExceptQsSeen, // Seen '}' for exception + PS_ExceptBodySeen, // Seen complete exception body + + PS_OpHeadSeen, // Seen the operation head + PS_OpTypeSeen, // Seen operation return type + PS_OpIDSeen, // Seen operation ID + PS_OpParsCompleted, // Completed operation param list + PS_OpRaiseCompleted, // Completed operation except list + PS_OpCompleted, // Completed operation statement + PS_OpSqSeen, // Seen '(' for operation + PS_OpQsSeen, // Seen ')' for operation + PS_OpParCommaSeen, // Seen ',' in list of op params + PS_OpParDirSeen, // Seen parameter direction + PS_OpParTypeSeen, // Seen parameter type + PS_OpParDeclSeen, // Seen parameter declaration + PS_OpRaiseSeen, // Seen RAISES keyword + PS_OpRaiseSqSeen, // Seen '(' for RAISES + PS_OpRaiseQsSeen, // Seen ')' for RAISES + PS_OpOnewaySeen, // Seen ONEWAY keyword + + PS_DeclsCommaSeen, // Seen ',' in declarators list + PS_DeclsDeclSeen // Seen complete decl in decls list +}; + +#endif // _IDLC_IDLCTYPES_HXX_ + diff --git a/idlc/inc/idlc/options.hxx b/idlc/inc/idlc/options.hxx new file mode 100644 index 000000000..34a70643b --- /dev/null +++ b/idlc/inc/idlc/options.hxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * $RCSfile: options.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jsc $ $Date: 2001-03-15 12:23:01 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _IDLC_OPTIONS_HXX_ +#define _IDLC_OPTIONS_HXX_ + +#ifndef _IDLC_IDLCTYPEs_HXX_ +#include <idlc/idlctypes.hxx> +#endif + +typedef ::std::hash_map< ::rtl::OString, + ::rtl::OString, + HashString, + EqualString > OptionMap; + +class IllegalArgument +{ +public: + IllegalArgument(const ::rtl::OString& msg) + : m_message(msg) {} + + ::rtl::OString m_message; +}; + + +class Options +{ +public: + Options(); + ~Options(); + + sal_Bool initOptions(int ac, char* av[], sal_Bool bCmdFile=sal_False) + throw( IllegalArgument ); + + ::rtl::OString prepareHelp(); + ::rtl::OString prepareVersion(); + + const ::rtl::OString& getProgramName() const; + sal_uInt16 getNumberOfOptions() const; + sal_Bool isValid(const ::rtl::OString& option); + const ::rtl::OString getOption(const ::rtl::OString& option) + throw( IllegalArgument ); + const OptionMap& getOptions(); + + sal_uInt16 getNumberOfInputFiles() const; + const ::rtl::OString getInputFile(sal_uInt16 index) + throw( IllegalArgument ); + + const StringVector& getInputFiles(); + +protected: + ::rtl::OString m_program; + StringVector m_inputFiles; + OptionMap m_options; +}; + +#endif // _IDLC_OPTIONS_HXX_ + |