summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2016-05-12 10:21:51 -0400
committerBernard Normier <bernard@zeroc.com>2016-05-12 10:21:51 -0400
commit6ea27c2fc2478cea6a42bad30e746f7ebf9c69af (patch)
treea52106addf73a73fbeb5e33c26ff9f8908b62a24 /cpp/src
parentUWP test suite fixes (diff)
downloadice-6ea27c2fc2478cea6a42bad30e746f7ebf9c69af.tar.bz2
ice-6ea27c2fc2478cea6a42bad30e746f7ebf9c69af.tar.xz
ice-6ea27c2fc2478cea6a42bad30e746f7ebf9c69af.zip
Renamed ICE_UTIL_API to ICE_API and other cleanups
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/Incoming.cpp2
-rw-r--r--cpp/src/Ice/Instance.cpp4
-rw-r--r--cpp/src/Ice/LoggerUtil.cpp2
-rw-r--r--cpp/src/Ice/Makefile.mk4
-rw-r--r--cpp/src/IceUtil/ArgVector.h2
-rw-r--r--cpp/src/IceUtil/Makefile.mk8
-rw-r--r--cpp/src/IceUtil/Unicode.h6
-rw-r--r--cpp/src/IceUtil/UtilException.cpp4
-rw-r--r--cpp/src/Slice/CPlusPlusUtil.h71
-rw-r--r--cpp/src/Slice/Checksum.h26
-rw-r--r--cpp/src/Slice/CsUtil.h91
-rw-r--r--cpp/src/Slice/DotNetNames.h34
-rw-r--r--cpp/src/Slice/FileTracker.h73
-rw-r--r--cpp/src/Slice/JavaUtil.h258
-rw-r--r--cpp/src/Slice/Makefile.mk2
-rw-r--r--cpp/src/Slice/ObjCUtil.h127
-rw-r--r--cpp/src/Slice/PHPUtil.h50
-rw-r--r--cpp/src/Slice/Parser.h1100
-rw-r--r--cpp/src/Slice/Preprocessor.h60
-rw-r--r--cpp/src/Slice/PythonUtil.h64
-rw-r--r--cpp/src/Slice/RubyUtil.h54
-rw-r--r--cpp/src/Slice/Util.h51
-rw-r--r--cpp/src/Slice/msbuild/slice.vcxproj24
-rw-r--r--cpp/src/Slice/msbuild/slice.vcxproj.filters30
24 files changed, 2096 insertions, 51 deletions
diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp
index 2ca85c47c07..5e7e0616943 100644
--- a/cpp/src/Ice/Incoming.cpp
+++ b/cpp/src/Ice/Incoming.cpp
@@ -33,7 +33,7 @@ using namespace IceInternal;
namespace IceUtilInternal
{
-extern bool ICE_UTIL_API printStackTraces;
+extern bool printStackTraces;
}
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index 089a8ee0871..4baed1e3421 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -74,8 +74,8 @@ using namespace IceInternal;
namespace IceUtilInternal
{
-extern bool ICE_UTIL_API nullHandleAbort;
-extern bool ICE_UTIL_API printStackTraces;
+extern bool nullHandleAbort;
+extern bool printStackTraces;
};
diff --git a/cpp/src/Ice/LoggerUtil.cpp b/cpp/src/Ice/LoggerUtil.cpp
index 6653fe9a243..13dd1eae363 100644
--- a/cpp/src/Ice/LoggerUtil.cpp
+++ b/cpp/src/Ice/LoggerUtil.cpp
@@ -19,7 +19,7 @@ using namespace std;
namespace IceUtilInternal
{
-extern bool ICE_UTIL_API printStackTraces;
+extern bool printStackTraces;
}
diff --git a/cpp/src/Ice/Makefile.mk b/cpp/src/Ice/Makefile.mk
index 50ace93ca83..99f6bbabb8f 100644
--- a/cpp/src/Ice/Makefile.mk
+++ b/cpp/src/Ice/Makefile.mk
@@ -10,7 +10,7 @@
$(project)_libraries = Ice
Ice_targetdir := $(libdir)
-Ice_cppflags = -DICE_API_EXPORTS -DICE_UTIL_API_EXPORTS
+Ice_cppflags = -DICE_API_EXPORTS
ifeq ($(DEFAULT_MUTEX_PROTOCOL), PrioInherit)
Ice_cppflags += -DICE_PRIO_INHERIT
@@ -22,7 +22,7 @@ endif
Ice_sliceflags := --include-dir Ice --dll-export ICE_API
Ice_libs := bz2
-Ice_system_libs := $(ICE_OS_LIBS) $(ICEUTIL_OS_LIBS)
+Ice_system_libs := $(ICE_OS_LIBS)
Ice_extra_sources := $(wildcard src/IceUtil/*.cpp)
Ice_excludes := $(currentdir)/DLLMain.cpp
diff --git a/cpp/src/IceUtil/ArgVector.h b/cpp/src/IceUtil/ArgVector.h
index fa8fe1592fa..634dec94e63 100644
--- a/cpp/src/IceUtil/ArgVector.h
+++ b/cpp/src/IceUtil/ArgVector.h
@@ -17,7 +17,7 @@
namespace IceUtilInternal
{
-class ICE_UTIL_API ArgVector
+class ICE_API ArgVector
{
public:
diff --git a/cpp/src/IceUtil/Makefile.mk b/cpp/src/IceUtil/Makefile.mk
index a8b13e209cd..9a7c3d97079 100644
--- a/cpp/src/IceUtil/Makefile.mk
+++ b/cpp/src/IceUtil/Makefile.mk
@@ -9,17 +9,11 @@
$(project)_libraries = IceUtil
-IceUtil_targetdir := $(libdir)
-IceUtil_cppflags := -DICE_UTIL_API_EXPORTS
-IceUtil_system_libs := $(ICEUTIL_OS_LIBS)
+IceUtil_targetdir := $(libdir)
# Always enable the static configuration for the IceUtil library
IceUtil_always_enable_configs := static
-ifeq ($(DEFAULT_MUTEX_PROTOCOL), PrioInherit)
- IceUtil_cppflags += -DICE_PRIO_INHERIT
-endif
-
ifeq ($(libbacktrace),yes)
IceUtil_cppflags += -DICE_LIBBACKTRACE
endif
diff --git a/cpp/src/IceUtil/Unicode.h b/cpp/src/IceUtil/Unicode.h
index d5c3b235ddb..c061ec51da0 100644
--- a/cpp/src/IceUtil/Unicode.h
+++ b/cpp/src/IceUtil/Unicode.h
@@ -45,15 +45,15 @@ convertUTF8ToUTFWstring(const IceUtil::Byte*& sourceStart, const IceUtil::Byte*
std::wstring& target, IceUtil::ConversionFlags flags);
-ICE_UTIL_API ConversionResult
+ICE_API ConversionResult
convertUTF8ToUTF16(const std::vector<unsigned char>&, std::vector<unsigned short>&,
IceUtil::ConversionFlags);
-ICE_UTIL_API ConversionResult
+ICE_API ConversionResult
convertUTF8ToUTF32(const std::vector<unsigned char>&, std::vector<unsigned int>&,
IceUtil::ConversionFlags);
-ICE_UTIL_API ConversionResult
+ICE_API ConversionResult
convertUTF32ToUTF8(const std::vector<unsigned int>&, std::vector<unsigned char>&,
IceUtil::ConversionFlags);
diff --git a/cpp/src/IceUtil/UtilException.cpp b/cpp/src/IceUtil/UtilException.cpp
index b0c25c75324..450174ec274 100644
--- a/cpp/src/IceUtil/UtilException.cpp
+++ b/cpp/src/IceUtil/UtilException.cpp
@@ -74,8 +74,8 @@ using namespace std;
namespace IceUtilInternal
{
-bool ICE_UTIL_API printStackTraces = false;
-bool ICE_UTIL_API nullHandleAbort = false;
+bool ICE_API printStackTraces = false;
+bool ICE_API nullHandleAbort = false;
StackTraceImpl
stackTraceImpl()
diff --git a/cpp/src/Slice/CPlusPlusUtil.h b/cpp/src/Slice/CPlusPlusUtil.h
new file mode 100644
index 00000000000..5a3ad0f4b14
--- /dev/null
+++ b/cpp/src/Slice/CPlusPlusUtil.h
@@ -0,0 +1,71 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef C_PLUS_PLUS_UTIL_H
+#define C_PLUS_PLUS_UTIL_H
+
+#include <Slice/Parser.h>
+#include <IceUtil/OutputUtil.h>
+
+namespace Slice
+{
+
+extern FeatureProfile featureProfile;
+extern std::string paramPrefix;
+
+struct ToIfdef
+{
+ char operator()(char);
+};
+
+void printHeader(::IceUtilInternal::Output&);
+void printVersionCheck(::IceUtilInternal::Output&);
+void printDllExportStuff(::IceUtilInternal::Output&, const std::string&);
+
+const int TypeContextInParam = 1;
+const int TypeContextAMIEnd = 2;
+const int TypeContextAMIPrivateEnd = 4;
+const int TypeContextAMICallPrivateEnd = 8;
+const int TypeContextUseWstring = 16;
+const int TypeContextLocal = 32;
+
+bool isMovable(const TypePtr&);
+
+std::string typeToString(const TypePtr&, const StringList& = StringList(), int = 0, bool = false);
+std::string typeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0, bool = false);
+std::string returnTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0, bool = false);
+std::string inputTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0, bool = false);
+std::string outputTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0, bool = false);
+std::string operationModeToString(Operation::Mode, bool cpp11 = false);
+std::string opFormatTypeToString(const OperationPtr&);
+
+std::string fixKwd(const std::string&);
+
+void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, bool, int, const std::string&,
+ bool, const StringList& = StringList(), int = 0, const std::string& = "",
+ bool = true);
+
+void writeMarshalCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool, int = 0);
+void writeUnmarshalCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool, int = 0);
+void writeAllocateCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool, int = 0, bool = false);
+
+std::string getEndArg(const TypePtr&, const StringList&, const std::string&);
+void writeEndCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool = false);
+
+bool findMetaData(const std::string&, const ClassDeclPtr&, std::string&);
+bool findMetaData(const std::string&, const StringList&, std::string&);
+std::string findMetaData(const StringList&, int = 0);
+bool inWstringModule(const SequencePtr&);
+
+std::string getDataMemberRef(const DataMemberPtr&);
+
+std::string classDefToDelegateString(const ClassDefPtr&, int = 0, bool = false);
+}
+
+#endif
diff --git a/cpp/src/Slice/Checksum.h b/cpp/src/Slice/Checksum.h
new file mode 100644
index 00000000000..3744d8a6ad4
--- /dev/null
+++ b/cpp/src/Slice/Checksum.h
@@ -0,0 +1,26 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef SLICE_CHECKSUM_H
+#define SLICE_CHECKSUM_H
+
+#include <Slice/Parser.h>
+#include <map>
+#include <vector>
+
+namespace Slice
+{
+
+typedef std::map<std::string, std::vector<unsigned char> > ChecksumMap;
+
+ChecksumMap createChecksums(const UnitPtr&);
+
+}
+
+#endif
diff --git a/cpp/src/Slice/CsUtil.h b/cpp/src/Slice/CsUtil.h
new file mode 100644
index 00000000000..2401ae1db84
--- /dev/null
+++ b/cpp/src/Slice/CsUtil.h
@@ -0,0 +1,91 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef CS_UTIL_H
+#define CS_UTIL_H
+
+#include <Slice/Parser.h>
+#include <IceUtil/OutputUtil.h>
+
+namespace Slice
+{
+
+class CsGenerator : private ::IceUtil::noncopyable
+{
+public:
+
+ virtual ~CsGenerator() {};
+
+ //
+ // Convert a dimension-less array declaration to one with a dimension.
+ //
+ static std::string toArrayAlloc(const std::string& decl, const std::string& sz);
+
+ //
+ // Validate all metadata in the unit with a "cs:" prefix.
+ //
+ static void validateMetaData(const UnitPtr&);
+
+protected:
+ static std::string fixId(const std::string&, int = 0, bool = false);
+ static std::string fixId(const ContainedPtr&, int = 0, bool = false);
+ static std::string getOptionalFormat(const TypePtr&);
+ static std::string getStaticId(const TypePtr&);
+ static std::string typeToString(const TypePtr&, bool = false);
+ static bool isValueType(const TypePtr&);
+ static bool isSerializable(const TypePtr&);
+
+ //
+ // Generate code to marshal or unmarshal a type
+ //
+ void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool);
+ void writeOptionalMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, int, bool);
+ void writeSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const SequencePtr&, const std::string&,
+ bool, bool);
+ void writeOptionalSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const SequencePtr&, const std::string&,
+ int, bool);
+
+ void writeSerializeDeserializeCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool, int, bool);
+
+private:
+
+ class MetaDataVisitor : public ParserVisitor
+ {
+ public:
+
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual void visitClassDecl(const ClassDeclPtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitExceptionStart(const ExceptionPtr&);
+ virtual void visitExceptionEnd(const ExceptionPtr&);
+ virtual bool visitStructStart(const StructPtr&);
+ virtual void visitStructEnd(const StructPtr&);
+ virtual void visitOperation(const OperationPtr&);
+ virtual void visitParamDecl(const ParamDeclPtr&);
+ virtual void visitDataMember(const DataMemberPtr&);
+ virtual void visitSequence(const SequencePtr&);
+ virtual void visitDictionary(const DictionaryPtr&);
+ virtual void visitEnum(const EnumPtr&);
+ virtual void visitConst(const ConstPtr&);
+
+ private:
+
+ void validate(const ContainedPtr&);
+
+ std::string _fileName;
+ StringSet _history;
+ };
+};
+
+}
+
+#endif
diff --git a/cpp/src/Slice/DotNetNames.h b/cpp/src/Slice/DotNetNames.h
new file mode 100644
index 00000000000..f4ee205e13d
--- /dev/null
+++ b/cpp/src/Slice/DotNetNames.h
@@ -0,0 +1,34 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef DOTNETNAMES_H
+#define DOTNETNAMES_H
+
+#include <string>
+
+namespace Slice
+{
+
+namespace DotNet
+{
+
+enum BaseType
+{
+ Object=1, ICloneable=2, Exception=4, END=8
+};
+
+extern const char * manglePrefix;
+
+std::string mangleName(const std::string&, int baseTypes = 0);
+
+}
+
+}
+
+#endif
diff --git a/cpp/src/Slice/FileTracker.h b/cpp/src/Slice/FileTracker.h
new file mode 100644
index 00000000000..1c18c97742f
--- /dev/null
+++ b/cpp/src/Slice/FileTracker.h
@@ -0,0 +1,73 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef FILE_TRACKER_H
+#define FILE_TRACKER_H
+
+#include <IceUtil/Shared.h>
+#include <Slice/Parser.h>
+
+namespace Slice
+{
+
+class FileException : public ::IceUtil::Exception
+{
+public:
+
+ FileException(const char*, int, const std::string&);
+ ~FileException() ICE_NOEXCEPT;
+ virtual std::string ice_id() const;
+ virtual void ice_print(std::ostream&) const;
+#ifndef ICE_CPP11_MAPPING
+ virtual FileException* ice_clone() const;
+#endif
+ virtual void ice_throw() const;
+
+ std::string reason() const;
+
+private:
+
+ static const char* _name;
+ const std::string _reason;
+};
+
+class FileTracker;
+typedef IceUtil::Handle<FileTracker> FileTrackerPtr;
+
+class FileTracker : public ::IceUtil::SimpleShared
+{
+public:
+
+ FileTracker();
+ ~FileTracker();
+
+ static FileTrackerPtr instance();
+
+ void setSource(const std::string&);
+ void setOutput(const std::string&, bool);
+ void addFile(const std::string&);
+ void addDirectory(const std::string&);
+
+ void cleanup();
+ void dumpxml();
+
+private:
+
+ std::string escape(const std::string&) const;
+
+ std::list<std::pair< std::string, bool> > _files;
+ std::string _source;
+ std::map<std::string, std::string> _errors;
+ std::map<std::string, std::list<std::string> > _generated;
+ std::map<std::string, std::list<std::string> >::iterator _curr;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Slice/JavaUtil.h b/cpp/src/Slice/JavaUtil.h
new file mode 100644
index 00000000000..6473f406e0e
--- /dev/null
+++ b/cpp/src/Slice/JavaUtil.h
@@ -0,0 +1,258 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef JAVA_UTIL_H
+#define JAVA_UTIL_H
+
+#include <Slice/Parser.h>
+#include <IceUtil/OutputUtil.h>
+
+namespace Slice
+{
+
+//
+// Compute Java serialVersionUID for a Slice class
+//
+long
+computeSerialVersionUUID(const ClassDefPtr&);
+
+//
+// Compute Java serialVersionUID for a Slice class
+//
+long
+computeSerialVersionUUID(const ExceptionPtr&);
+
+//
+// Compute Java serialVersionUID for a Slice struct
+//
+long
+computeSerialVersionUUID(const StructPtr&);
+
+class JavaOutput : public ::IceUtilInternal::Output
+{
+public:
+
+ JavaOutput();
+ JavaOutput(std::ostream&);
+ JavaOutput(const char*);
+
+ //
+ // Open a file to hold the source for a Java class. The first
+ // argument is the class name (including an optional leading
+ // package). Intermediate directories will be created as
+ // necessary to open the file in the package. The second
+ // argument specifies a directory prefix in which to locate
+ // the class.
+ //
+ // After successfully opening the file, the function invokes
+ // printHeader() and then emits a "package" statement if
+ // necessary.
+ //
+ void openClass(const std::string&, const std::string&, const std::string& = std::string());
+
+ virtual void printHeader();
+};
+
+class JavaGenerator : private ::IceUtil::noncopyable
+{
+public:
+
+ virtual ~JavaGenerator();
+
+ //
+ // Validate all metadata in the unit with a "java:" prefix.
+ //
+ static void validateMetaData(const UnitPtr&);
+
+ void close();
+
+protected:
+
+ JavaGenerator(const std::string&);
+
+ //
+ // Given the fully-scoped Java class name, create any intermediate
+ // package directories and open the class file,
+ //
+ void open(const std::string&, const std::string&);
+
+ ::IceUtilInternal::Output& output() const;
+
+ //
+ // Check a symbol against any of the Java keywords. If a
+ // match is found, return the symbol with a leading underscore.
+ //
+ std::string fixKwd(const std::string&) const;
+
+ //
+ // Convert a Slice scoped name into a Java name.
+ //
+ std::string convertScopedName(const std::string&,
+ const std::string& = std::string(),
+ const std::string& = std::string()) const;
+
+
+ //
+ // Returns the package prefix for a give Slice file.
+ //
+ std::string getPackagePrefix(const ContainedPtr&) const;
+
+ //
+ // Returns the Java package of a Contained entity.
+ //
+ std::string getPackage(const ContainedPtr&) const;
+
+ //
+ // Returns the Java name for a Contained entity. If the optional
+ // package argument matches the entity's package name, then the
+ // package is removed from the result.
+ //
+ std::string getAbsolute(const ContainedPtr&,
+ const std::string& = std::string(),
+ const std::string& = std::string(),
+ const std::string& = std::string()) const;
+
+ //
+ // Return the method call necessary to obtain the static type ID for an object type.
+ //
+ std::string getStaticId(const TypePtr&, const std::string&) const;
+
+ //
+ // Determines whether an operation should use the optional mapping.
+ //
+ bool useOptionalMapping(const OperationPtr&);
+
+ //
+ // Returns the optional type corresponding to the given Slice type.
+ //
+ std::string getOptionalFormat(const TypePtr&);
+
+ //
+ // Get the Java name for a type. If an optional scope is provided,
+ // the scope will be removed from the result if possible.
+ //
+ enum TypeMode
+ {
+ TypeModeIn,
+ TypeModeOut,
+ TypeModeMember,
+ TypeModeReturn
+ };
+ std::string typeToString(const TypePtr&, TypeMode, const std::string& = std::string(),
+ const StringList& = StringList(), bool = true, bool = false) const;
+
+ //
+ // Get the Java object name for a type. For primitive types, this returns the
+ // Java class type (e.g., Integer). For all other types, this function delegates
+ // to typeToString.
+ //
+ std::string typeToObjectString(const TypePtr&, TypeMode, const std::string& = std::string(),
+ const StringList& = StringList(), bool = true) const;
+
+ //
+ // Generate code to marshal or unmarshal a type.
+ //
+ enum OptionalMode
+ {
+ OptionalNone,
+ OptionalInParam,
+ OptionalOutParam,
+ OptionalReturnParam,
+ OptionalMember
+ };
+
+ void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const TypePtr&, OptionalMode,
+ bool, int, const std::string&, bool, int&, bool = false,
+ const StringList& = StringList(), const std::string& patchParams = "");
+
+ //
+ // Generate code to marshal or unmarshal a dictionary type.
+ //
+ void writeDictionaryMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const DictionaryPtr&,
+ const std::string&, bool, int&, bool,
+ const StringList& = StringList());
+
+ //
+ // Generate code to marshal or unmarshal a sequence type.
+ //
+ void writeSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const SequencePtr&,
+ const std::string&, bool, int&, bool, const StringList& = StringList());
+
+ //
+ // Search metadata for an entry with the given prefix and return the entire string.
+ //
+ static bool findMetaData(const std::string&, const StringList&, std::string&);
+
+ //
+ // Get custom type metadata. If metadata is found, the abstract and
+ // concrete types are extracted and the function returns true. If an
+ // abstract type is not specified, it is set to an empty string.
+ //
+ static bool getTypeMetaData(const StringList&, std::string&, std::string&);
+
+ //
+ // Determine whether a custom type is defined. The function checks the
+ // metadata of the type's original definition, as well as any optional
+ // metadata that typically represents a data member or parameter.
+ //
+ static bool hasTypeMetaData(const TypePtr&, const StringList& = StringList());
+
+ //
+ // Obtain the concrete and abstract types for a dictionary or sequence type.
+ // The functions return true if a custom type was defined and false to indicate
+ // the default mapping was used.
+ //
+ bool getDictionaryTypes(const DictionaryPtr&, const std::string&, const StringList&,
+ std::string&, std::string&) const;
+ bool getSequenceTypes(const SequencePtr&, const std::string&, const StringList&, std::string&, std::string&) const;
+
+ bool sequenceHasHolder(const SequencePtr&) const;
+
+ virtual JavaOutput* createOutput();
+
+ static const std::string _getSetMetaData;
+
+private:
+
+ class MetaDataVisitor : public ParserVisitor
+ {
+ public:
+
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitClassDecl(const ClassDeclPtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitExceptionStart(const ExceptionPtr&);
+ virtual bool visitStructStart(const StructPtr&);
+ virtual void visitOperation(const OperationPtr&);
+ virtual void visitDataMember(const DataMemberPtr&);
+ virtual void visitSequence(const SequencePtr&);
+ virtual void visitDictionary(const DictionaryPtr&);
+ virtual void visitEnum(const EnumPtr&);
+ virtual void visitConst(const ConstPtr&);
+
+ private:
+
+ StringList getMetaData(const ContainedPtr&);
+ void validateType(const SyntaxTreeBasePtr&, const StringList&, const std::string&, const std::string&);
+ void validateGetSet(const SyntaxTreeBasePtr&, const StringList&, const std::string&, const std::string&);
+
+ StringSet _history;
+ };
+
+ friend class JavaGenerator::MetaDataVisitor;
+
+ std::string _dir;
+ ::IceUtilInternal::Output* _out;
+ mutable std::map<std::string, std::string> _filePackagePrefix;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Slice/Makefile.mk b/cpp/src/Slice/Makefile.mk
index a7bd6544050..c8686d54d17 100644
--- a/cpp/src/Slice/Makefile.mk
+++ b/cpp/src/Slice/Makefile.mk
@@ -10,8 +10,6 @@
$(project)_libraries := Slice
Slice_targetdir := $(libdir)
-Slice_dependencies := IceUtil
-Slice_cppflags := -DSLICE_API_EXPORTS
Slice_libs := mcpp
# Always enable the static configuration for the Slice library
diff --git a/cpp/src/Slice/ObjCUtil.h b/cpp/src/Slice/ObjCUtil.h
new file mode 100644
index 00000000000..7c8236ede63
--- /dev/null
+++ b/cpp/src/Slice/ObjCUtil.h
@@ -0,0 +1,127 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef OBJC_UTIL_H
+#define OBJC_UTIL_H
+
+#include <Slice/Parser.h>
+#include <IceUtil/OutputUtil.h>
+
+namespace Slice
+{
+
+enum BaseType
+{
+ BaseTypeNone,
+ BaseTypeObject,
+ BaseTypeException
+};
+
+class ObjCGenerator : private ::IceUtil::noncopyable
+{
+public:
+
+ virtual ~ObjCGenerator() {};
+
+ //
+ // Validate all metadata in the unit with an "objc:" prefix.
+ //
+ static void validateMetaData(const UnitPtr&);
+
+protected:
+ struct ModulePrefix
+ {
+ ModulePtr m;
+ std::string name;
+ };
+
+ static bool addModule(const ModulePtr&, const std::string&);
+ static ModulePrefix modulePrefix(const ModulePtr&);
+ static std::string moduleName(const ModulePtr&);
+ static ModulePtr findModule(const ContainedPtr&, int = 0, bool = false);
+ static void modulePrefixError(const ModulePtr&, const std::string&);
+ static std::string fixId(const std::string&, int = 0, bool = false);
+ static std::string fixId(const ContainedPtr&, int = 0, bool = false);
+ static std::string fixName(const ContainedPtr&, int = 0, bool = false);
+ static std::string fixScoped(const ContainedPtr&, int = 0, bool = false);
+ static std::string getParamId(const ContainedPtr&);
+ static std::string getFactoryMethod(const ContainedPtr&, bool);
+ static std::string typeToString(const TypePtr&);
+ static std::string inTypeToString(const TypePtr&, bool, bool = false, bool = false);
+ static std::string outTypeToString(const TypePtr&, bool, bool = false, bool = false);
+ static std::string typeToObjCTypeString(const TypePtr&);
+ static bool isValueType(const TypePtr&);
+ static bool isString(const TypePtr&);
+ static bool isClass(const TypePtr&);
+ static bool mapsToPointerType(const TypePtr&);
+ static std::string getBuiltinName(const BuiltinPtr&);
+ static std::string getBuiltinSelector(const BuiltinPtr&, bool);
+ static std::string getOptionalHelperGetter(const TypePtr&);
+ static std::string getOptionalStreamHelper(const TypePtr&);
+ static StringList splitScopedName(const std::string&);
+ static std::string getOptionalFormat(const TypePtr&);
+
+ //
+ // Generate code to marshal or unmarshal a type
+ //
+ void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool, bool) const;
+ void writeOptMemberMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool) const;
+ void writeOptParamMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, int,
+ bool) const;
+
+private:
+
+ class MetaDataVisitor : public ParserVisitor
+ {
+ public:
+ MetaDataVisitor();
+
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual void visitClassDecl(const ClassDeclPtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitExceptionStart(const ExceptionPtr&);
+ virtual void visitExceptionEnd(const ExceptionPtr&);
+ virtual bool visitStructStart(const StructPtr&);
+ virtual void visitStructEnd(const StructPtr&);
+ virtual void visitOperation(const OperationPtr&);
+ virtual void visitParamDecl(const ParamDeclPtr&);
+ virtual void visitDataMember(const DataMemberPtr&);
+ virtual void visitSequence(const SequencePtr&);
+ virtual void visitDictionary(const DictionaryPtr&);
+ virtual void visitEnum(const EnumPtr&);
+ virtual void visitConst(const ConstPtr&);
+
+ private:
+
+ void validate(const ContainedPtr&);
+
+ static Slice::StringList getMetaData(const ContainedPtr&);
+ static void modulePrefixError(const ModulePtr&, const std::string&);
+
+ static const std::string _objcPrefix; // "objc:"
+ static const std::string _msg; // "ignoring invalid metadata"
+
+ StringSet _history;
+ };
+
+
+ //
+ // Map of module scoped name to ModulePtr. Used to verify that objc:prefix metadata directives are consistent.
+ //
+
+ typedef std::map<std::string, ModulePrefix> ModuleMap;
+ static ModuleMap _modules;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Slice/PHPUtil.h b/cpp/src/Slice/PHPUtil.h
new file mode 100644
index 00000000000..e98130e9345
--- /dev/null
+++ b/cpp/src/Slice/PHPUtil.h
@@ -0,0 +1,50 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef SLICE_PHP_UTIL_H
+#define SLICE_PHP_UTIL_H
+
+#include <Slice/Parser.h>
+
+namespace Slice
+{
+namespace PHP
+{
+
+//
+// Convert a scoped name into a PHP name.
+//
+std::string scopedToName(const std::string&, bool);
+
+//
+// Check the given identifier against PHP's list of reserved words. If it matches
+// a reserved word, then an escaped version is returned with a leading underscore.
+//
+std::string fixIdent(const std::string&);
+
+//
+// Get the fully-qualified name of the given definition. If a suffix is provided,
+// it is prepended to the definition's unqualified name. If the nameSuffix
+// is provided, it is appended to the container's name.
+//
+// COMPILERFIX: MSVC 6 seems to have a problem with const std::string
+// = std::string(), const std::string = std::string().
+//
+std::string getAbsolute(const Slice::ContainedPtr&, bool, const std::string& = "", const std::string& = "");
+
+//
+// Since PHP uses the backslash character as the namespace separator, we have
+// to escape backslash characters when they appear in a string literal.
+//
+std::string escapeName(const std::string&);
+
+}
+}
+
+#endif
diff --git a/cpp/src/Slice/Parser.h b/cpp/src/Slice/Parser.h
new file mode 100644
index 00000000000..a142ec921d0
--- /dev/null
+++ b/cpp/src/Slice/Parser.h
@@ -0,0 +1,1100 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef SLICE_PARSER_H
+#define SLICE_PARSER_H
+
+#include <IceUtil/Shared.h>
+#include <IceUtil/Handle.h>
+#include <string>
+#include <vector>
+#include <list>
+#include <stack>
+#include <map>
+#include <set>
+#include <stdio.h>
+
+
+namespace Slice
+{
+
+#if defined(_WIN32) && !defined(__MINGW32__)
+
+const IceUtil::Int64 Int32Max = 0x7fffffffi64;
+const IceUtil::Int64 Int32Min = -Int32Max - 1i64;
+
+#else
+
+# if defined(INT32_MIN) && defined(INT32_MAX)
+
+const IceUtil::Int64 Int32Max = INT32_MAX;
+const IceUtil::Int64 Int32Min = INT32_MIN;
+
+# else
+
+const IceUtil::Int64 Int32Max = 0x7fffffffLL;
+const IceUtil::Int64 Int32Min = -Int32Max - 1LL;
+
+# endif
+
+#endif
+
+const IceUtil::Int64 Int16Max = 0x7fff;
+const IceUtil::Int64 Int16Min = -Int16Max - 1;
+const IceUtil::Int64 ByteMax = 0xff;
+const IceUtil::Int64 ByteMin = 0x00;
+
+enum FeatureProfile
+{
+ Ice,
+ IceE
+};
+
+enum NodeType
+{
+ Dummy,
+ Real
+};
+
+//
+// Format preference for classes and exceptions.
+//
+enum FormatType
+{
+ DefaultFormat, // No preference was specified.
+ CompactFormat, // Minimal format.
+ SlicedFormat // Full format.
+};
+
+class GrammarBase;
+class SyntaxTreeBase;
+class Type;
+class Builtin;
+class Contained;
+class Container;
+class Module;
+class Constructed;
+class ClassDecl;
+class ClassDef;
+class Proxy;
+class Exception;
+class Struct;
+class Operation;
+class ParamDecl;
+class DataMember;
+class Sequence;
+class Dictionary;
+class Enum;
+class Enumerator;
+class Const;
+class Unit;
+class CICompare;
+class DerivedToBaseCompare;
+class ModulePartialCompare;
+
+typedef ::IceUtil::Handle<GrammarBase> GrammarBasePtr;
+typedef ::IceUtil::Handle<SyntaxTreeBase> SyntaxTreeBasePtr;
+typedef ::IceUtil::Handle<Type> TypePtr;
+typedef ::IceUtil::Handle<Builtin> BuiltinPtr;
+typedef ::IceUtil::Handle<Contained> ContainedPtr;
+typedef ::IceUtil::Handle<Container> ContainerPtr;
+typedef ::IceUtil::Handle<Module> ModulePtr;
+typedef ::IceUtil::Handle<Constructed> ConstructedPtr;
+typedef ::IceUtil::Handle<ClassDecl> ClassDeclPtr;
+typedef ::IceUtil::Handle<ClassDef> ClassDefPtr;
+typedef ::IceUtil::Handle<Proxy> ProxyPtr;
+typedef ::IceUtil::Handle<Exception> ExceptionPtr;
+typedef ::IceUtil::Handle<Struct> StructPtr;
+typedef ::IceUtil::Handle<Operation> OperationPtr;
+typedef ::IceUtil::Handle<ParamDecl> ParamDeclPtr;
+typedef ::IceUtil::Handle<DataMember> DataMemberPtr;
+typedef ::IceUtil::Handle<Sequence> SequencePtr;
+typedef ::IceUtil::Handle<Dictionary> DictionaryPtr;
+typedef ::IceUtil::Handle<Enum> EnumPtr;
+typedef ::IceUtil::Handle<Enumerator> EnumeratorPtr;
+typedef ::IceUtil::Handle<Const> ConstPtr;
+typedef ::IceUtil::Handle<Unit> UnitPtr;
+
+typedef std::list<TypePtr> TypeList;
+typedef std::list<ExceptionPtr> ExceptionList;
+typedef std::set<std::string> StringSet;
+typedef std::list<std::string> StringList;
+typedef std::pair<TypePtr, std::string> TypeString;
+typedef std::list<TypeString> TypeStringList;
+typedef std::list<ContainedPtr> ContainedList;
+typedef std::list<ModulePtr> ModuleList;
+typedef std::list<ConstructedPtr> ConstructedList;
+typedef std::list<ClassDefPtr> ClassList;
+typedef std::list<ExceptionPtr> ExceptionList;
+typedef std::list<StructPtr> StructList;
+typedef std::list<SequencePtr> SequenceList;
+typedef std::list<DictionaryPtr> DictionaryList;
+typedef std::list<EnumPtr> EnumList;
+typedef std::list<ConstPtr> ConstList;
+typedef std::list<OperationPtr> OperationList;
+typedef std::list<DataMemberPtr> DataMemberList;
+typedef std::list<ParamDeclPtr> ParamDeclList;
+typedef std::list<EnumeratorPtr> EnumeratorList;
+
+struct ConstDef
+{
+ TypePtr type;
+ SyntaxTreeBasePtr value;
+ std::string valueAsString;
+ std::string valueAsLiteral;
+};
+
+struct OptionalDef
+{
+ TypePtr type;
+ std::string name;
+ bool optional;
+ int tag;
+};
+
+// ----------------------------------------------------------------------
+// CICompare -- function object to do case-insensitive string comparison.
+// ----------------------------------------------------------------------
+
+class CICompare : public std::binary_function<std::string, std::string, bool>
+{
+public:
+
+ bool operator()(const std::string&, const std::string&) const;
+};
+
+#if defined(__SUNPRO_CC)
+bool cICompare(const std::string&, const std::string&);
+#endif
+
+// ----------------------------------------------------------------------
+// DerivedToBaseCompare -- function object to do sort exceptions into
+// most-derived to least-derived order.
+// ----------------------------------------------------------------------
+
+class DerivedToBaseCompare : public std::binary_function<std::string, std::string, bool>
+{
+public:
+
+ bool operator()(const ExceptionPtr&, const ExceptionPtr&) const;
+};
+
+#if defined(__SUNPRO_CC)
+bool derivedToBaseCompare(const ExceptionPtr&, const ExceptionPtr&);
+#endif
+
+// ----------------------------------------------------------------------
+// ParserVisitor
+// ----------------------------------------------------------------------
+
+class ParserVisitor
+{
+public:
+
+ virtual ~ParserVisitor() { }
+ virtual bool visitUnitStart(const UnitPtr&) { return true; }
+ virtual void visitUnitEnd(const UnitPtr&) { }
+ virtual bool visitModuleStart(const ModulePtr&) { return true; }
+ virtual void visitModuleEnd(const ModulePtr&) { }
+ virtual void visitClassDecl(const ClassDeclPtr&) { }
+ virtual bool visitClassDefStart(const ClassDefPtr&) { return true; }
+ virtual void visitClassDefEnd(const ClassDefPtr&) { }
+ virtual bool visitExceptionStart(const ExceptionPtr&) { return true; }
+ virtual void visitExceptionEnd(const ExceptionPtr&) { }
+ virtual bool visitStructStart(const StructPtr&) { return true; }
+ virtual void visitStructEnd(const StructPtr&) { }
+ virtual void visitOperation(const OperationPtr&) { }
+ virtual void visitParamDecl(const ParamDeclPtr&) { }
+ virtual void visitDataMember(const DataMemberPtr&) { }
+ virtual void visitSequence(const SequencePtr&) { }
+ virtual void visitDictionary(const DictionaryPtr&) { }
+ virtual void visitEnum(const EnumPtr&) { }
+ virtual void visitConst(const ConstPtr&) { }
+};
+
+// ----------------------------------------------------------------------
+// DefinitionContext
+// ----------------------------------------------------------------------
+
+class DefinitionContext : public ::IceUtil::SimpleShared
+{
+public:
+
+ DefinitionContext(int, const StringList&);
+
+ std::string filename() const;
+ int includeLevel() const;
+ bool seenDefinition() const;
+
+ void setFilename(const std::string&);
+ void setSeenDefinition();
+
+ bool hasMetaData() const;
+ void setMetaData(const StringList&);
+ std::string findMetaData(const std::string&) const;
+ StringList getMetaData() const;
+
+private:
+
+ int _includeLevel;
+ StringList _metaData;
+ std::string _filename;
+ bool _seenDefinition;
+};
+typedef ::IceUtil::Handle<DefinitionContext> DefinitionContextPtr;
+
+// ----------------------------------------------------------------------
+// GrammarBase
+// ----------------------------------------------------------------------
+
+class GrammarBase : public ::IceUtil::SimpleShared
+{
+};
+
+// ----------------------------------------------------------------------
+// SyntaxTreeBase
+// ----------------------------------------------------------------------
+
+class SyntaxTreeBase : public GrammarBase
+{
+public:
+
+ virtual void destroy();
+ UnitPtr unit() const;
+ DefinitionContextPtr definitionContext() const; // May be nil
+ virtual void visit(ParserVisitor*, bool);
+
+protected:
+
+ SyntaxTreeBase(const UnitPtr&);
+
+ UnitPtr _unit;
+ DefinitionContextPtr _definitionContext;
+};
+
+// ----------------------------------------------------------------------
+// Type
+// ----------------------------------------------------------------------
+
+class Type : public virtual SyntaxTreeBase
+{
+public:
+
+ virtual bool isLocal() const = 0;
+ virtual std::string typeId() const = 0;
+ virtual bool usesClasses() const = 0;
+ virtual size_t minWireSize() const = 0;
+ virtual bool isVariableLength() const = 0;
+
+protected:
+
+ Type(const UnitPtr&);
+};
+
+// ----------------------------------------------------------------------
+// Builtin
+// ----------------------------------------------------------------------
+
+class Builtin : public virtual Type
+{
+public:
+
+ enum Kind
+ {
+ KindByte,
+ KindBool,
+ KindShort,
+ KindInt,
+ KindLong,
+ KindFloat,
+ KindDouble,
+ KindString,
+ KindObject,
+ KindObjectProxy,
+ KindLocalObject,
+ KindValue
+ };
+
+ virtual bool isLocal() const;
+ virtual std::string typeId() const;
+ virtual bool usesClasses() const;
+ virtual size_t minWireSize() const;
+ virtual bool isVariableLength() const;
+
+ Kind kind() const;
+ std::string kindAsString() const;
+
+ static const char* builtinTable[];
+
+protected:
+
+ Builtin(const UnitPtr&, Kind);
+ friend class Unit;
+
+ Kind _kind;
+};
+
+// ----------------------------------------------------------------------
+// Contained
+// ----------------------------------------------------------------------
+
+class Contained : public virtual SyntaxTreeBase
+{
+public:
+
+ ContainerPtr container() const;
+ std::string name() const;
+ std::string scoped() const;
+ std::string scope() const;
+ std::string flattenedScope() const;
+ std::string file() const;
+ std::string line() const;
+ std::string comment() const;
+
+ int includeLevel() const;
+ void updateIncludeLevel();
+
+ bool hasMetaData(const std::string&) const;
+ bool findMetaData(const std::string&, std::string&) const;
+ std::list<std::string> getMetaData() const;
+ void setMetaData(const std::list<std::string>&);
+ void addMetaData(const std::string&); // TODO: remove this method once "cs:" and "vb:" are hard errors.
+
+ static FormatType parseFormatMetaData(const std::list<std::string>&);
+
+ enum ContainedType
+ {
+ ContainedTypeSequence,
+ ContainedTypeDictionary,
+ ContainedTypeEnum,
+ ContainedTypeEnumerator,
+ ContainedTypeModule,
+ ContainedTypeClass,
+ ContainedTypeException,
+ ContainedTypeStruct,
+ ContainedTypeOperation,
+ ContainedTypeParamDecl,
+ ContainedTypeDataMember,
+ ContainedTypeConstant
+ };
+ virtual ContainedType containedType() const = 0;
+
+ virtual bool uses(const ContainedPtr&) const = 0;
+ virtual std::string kindOf() const = 0;
+
+ bool operator<(const Contained&) const;
+ bool operator==(const Contained&) const;
+ bool operator!=(const Contained&) const;
+
+protected:
+
+ Contained(const ContainerPtr&, const std::string&);
+ friend class Container;
+
+ ContainerPtr _container;
+ std::string _name;
+ std::string _scoped;
+ std::string _file;
+ std::string _line;
+ std::string _comment;
+ int _includeLevel;
+ std::list<std::string> _metaData;
+};
+
+// ----------------------------------------------------------------------
+// Container
+// ----------------------------------------------------------------------
+
+class Container : public virtual SyntaxTreeBase
+{
+public:
+
+ virtual void destroy();
+ ModulePtr createModule(const std::string&);
+ ClassDefPtr createClassDef(const std::string&, int, bool, const ClassList&, bool);
+ ClassDeclPtr createClassDecl(const std::string&, bool, bool, bool = true);
+ ExceptionPtr createException(const std::string&, const ExceptionPtr&, bool, NodeType = Real);
+ StructPtr createStruct(const std::string&, bool, NodeType = Real);
+ SequencePtr createSequence(const std::string&, const TypePtr&, const StringList&, bool, NodeType = Real);
+ DictionaryPtr createDictionary(const std::string&, const TypePtr&, const StringList&, const TypePtr&,
+ const StringList&, bool, NodeType = Real);
+ EnumPtr createEnum(const std::string&, bool, NodeType = Real);
+ EnumeratorPtr createEnumerator(const std::string&);
+ EnumeratorPtr createEnumerator(const std::string&, int);
+ ConstPtr createConst(const std::string, const TypePtr&, const StringList&, const SyntaxTreeBasePtr&,
+ const std::string&, const std::string&, NodeType = Real);
+ TypeList lookupType(const std::string&, bool = true);
+ TypeList lookupTypeNoBuiltin(const std::string&, bool = true, bool = false);
+ ContainedList lookupContained(const std::string&, bool = true);
+ ExceptionPtr lookupException(const std::string&, bool = true);
+ UnitPtr unit() const;
+ ModuleList modules() const;
+ ClassList classes() const;
+ ExceptionList exceptions() const;
+ StructList structs() const;
+ SequenceList sequences() const;
+ DictionaryList dictionaries() const;
+ EnumList enums() const;
+ ConstList consts() const;
+ ContainedList contents() const;
+ bool hasNonLocalClassDecls() const;
+ bool hasNonLocalClassDefs() const;
+ bool hasLocalClassDefsWithAsync() const;
+ bool hasNonLocalSequences() const;
+ bool hasNonLocalExceptions() const;
+ bool hasDictionaries() const;
+ bool hasOnlyDictionaries(DictionaryList&) const;
+ bool hasClassDecls() const;
+ bool hasClassDefs() const;
+ bool hasLocalClassDefs() const;
+ bool hasNonLocalInterfaceDefs() const;
+ bool hasValueDefs() const;
+ bool hasOnlyClassDecls() const;
+ bool hasAbstractClassDefs() const;
+ bool hasNonLocalDataOnlyClasses() const;
+ bool hasOtherConstructedOrExceptions() const; // Exceptions or constructed types other than classes.
+ bool hasContentsWithMetaData(const std::string&) const;
+ bool hasAsyncOps() const;
+ bool hasNonLocalContained(Contained::ContainedType) const;
+ std::string thisScope() const;
+ void mergeModules();
+ void sort();
+ void sortContents(bool);
+ virtual void visit(ParserVisitor*, bool);
+ void containerRecDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly.
+
+ bool checkIntroduced(const std::string&, ContainedPtr = 0);
+ bool nameIsLegal(const std::string&, const char *);
+ bool checkForGlobalDef(const std::string&, const char *);
+
+protected:
+
+ Container(const UnitPtr&);
+
+ void checkIdentifier(const std::string&) const;
+ bool checkInterfaceAndLocal(const std::string&, bool, bool, bool, bool, bool);
+ bool checkGlobalMetaData(const StringList&, const StringList&);
+ bool validateConstant(const std::string&, const TypePtr&, const SyntaxTreeBasePtr&, const std::string&, bool);
+ EnumeratorPtr validateEnumerator(const std::string&);
+
+ ContainedList _contents;
+ std::map<std::string, ContainedPtr, CICompare> _introducedMap;
+};
+
+// ----------------------------------------------------------------------
+// Module
+// ----------------------------------------------------------------------
+
+class Module : public virtual Container, public virtual Contained
+{
+public:
+
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual std::string kindOf() const;
+ virtual void visit(ParserVisitor*, bool);
+
+protected:
+
+ Module(const ContainerPtr&, const std::string&);
+ friend class Container;
+};
+
+// ----------------------------------------------------------------------
+// Constructed
+// ----------------------------------------------------------------------
+
+class Constructed : public virtual Type, public virtual Contained
+{
+public:
+
+ virtual bool isLocal() const;
+ virtual std::string typeId() const;
+ virtual bool isVariableLength() const = 0;
+ ConstructedList dependencies();
+ virtual void recDependencies(std::set<ConstructedPtr>&) = 0; // Internal operation, don't use directly.
+
+protected:
+
+ Constructed(const ContainerPtr&, const std::string&, bool);
+
+ bool _local;
+};
+
+// ----------------------------------------------------------------------
+// ClassDecl
+// ----------------------------------------------------------------------
+
+class ClassDecl : public virtual Constructed
+{
+public:
+
+ virtual void destroy();
+ ClassDefPtr definition() const;
+ bool isInterface() const;
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual bool usesClasses() const;
+ virtual size_t minWireSize() const;
+ virtual bool isVariableLength() const;
+ virtual void visit(ParserVisitor*, bool);
+ virtual std::string kindOf() const;
+ virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly.
+
+ static void checkBasesAreLegal(const std::string&, bool, bool, const ClassList&, const UnitPtr&);
+
+protected:
+
+ ClassDecl(const ContainerPtr&, const std::string&, bool, bool);
+ friend class Container;
+ friend class ClassDef;
+
+ ClassDefPtr _definition;
+ bool _interface;
+
+private:
+
+ typedef std::list<ClassList> GraphPartitionList;
+ typedef std::list<StringList> StringPartitionList;
+
+ static bool isInList(const GraphPartitionList&, const ClassDefPtr);
+ static void addPartition(GraphPartitionList&, GraphPartitionList::reverse_iterator, const ClassDefPtr);
+ static StringPartitionList toStringPartitionList(const GraphPartitionList&);
+ static void checkPairIntersections(const StringPartitionList&, const std::string&, const UnitPtr&);
+};
+
+// ----------------------------------------------------------------------
+// Operation
+// ----------------------------------------------------------------------
+
+class Operation : public virtual Contained, public virtual Container
+{
+public:
+
+ //
+ // Note: The order of definitions here *must* match the order of
+ // definitions of ::Ice::OperationMode in slice/Ice/Current.ice!
+ //
+ enum Mode
+ {
+ Normal,
+ Nonmutating,
+ Idempotent
+ };
+
+ TypePtr returnType() const;
+ bool returnIsOptional() const;
+ int returnTag() const;
+ Mode mode() const;
+ Mode sendMode() const;
+ ParamDeclPtr createParamDecl(const std::string&, const TypePtr&, bool, bool, int);
+ ParamDeclList parameters() const;
+ ExceptionList throws() const;
+ void setExceptionList(const ExceptionList&);
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ bool sendsClasses(bool) const;
+ bool returnsClasses(bool) const;
+ bool returnsData() const;
+ bool sendsOptionals() const;
+ int attributes() const;
+ FormatType format() const;
+ virtual std::string kindOf() const;
+ virtual void visit(ParserVisitor*, bool);
+
+protected:
+
+ Operation(const ContainerPtr&, const std::string&, const TypePtr&, bool, int, Mode);
+ friend class ClassDef;
+
+ TypePtr _returnType;
+ bool _returnIsOptional;
+ int _returnTag;
+ ExceptionList _throws;
+ Mode _mode;
+};
+
+// ----------------------------------------------------------------------
+// ClassDef
+// ----------------------------------------------------------------------
+
+//
+// Note: For the purpose of this parser, a class definition is not
+// considered to be a type, but a class declaration is. And each class
+// definition has at least one class declaration (but not vice versa),
+// so if you need the class as a "constructed type", use the
+// declaration() operation to navigate to the class declaration.
+//
+class ClassDef : public virtual Container, public virtual Contained
+{
+public:
+
+ virtual void destroy();
+ OperationPtr createOperation(const std::string&, const TypePtr&, bool, int, Operation::Mode = Operation::Normal);
+ DataMemberPtr createDataMember(const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&,
+ const std::string&, const std::string&);
+ ClassDeclPtr declaration() const;
+ ClassList bases() const;
+ ClassList allBases() const;
+ OperationList operations() const;
+ OperationList allOperations() const;
+ DataMemberList dataMembers() const;
+ DataMemberList orderedOptionalDataMembers() const;
+ DataMemberList allDataMembers() const;
+ DataMemberList classDataMembers() const;
+ DataMemberList allClassDataMembers() const;
+ bool canBeCyclic() const;
+ bool isAbstract() const;
+ bool isInterface() const;
+ bool isA(const std::string&) const;
+ virtual bool isLocal() const;
+ bool hasDataMembers() const;
+ bool hasOperations() const;
+ bool hasDefaultValues() const;
+ bool inheritsMetaData(const std::string&) const;
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual std::string kindOf() const;
+ virtual void visit(ParserVisitor*, bool);
+ int compactId() const;
+ bool isDelegate() const;
+
+protected:
+
+ ClassDef(const ContainerPtr&, const std::string&, int, bool, const ClassList&, bool);
+ friend class Container;
+
+ ClassDeclPtr _declaration;
+ bool _interface;
+ bool _hasDataMembers;
+ bool _hasOperations;
+ ClassList _bases;
+ bool _local;
+ int _compactId;
+};
+
+// ----------------------------------------------------------------------
+// Proxy
+// ----------------------------------------------------------------------
+
+class Proxy : public virtual Type
+{
+public:
+
+ virtual bool isLocal() const;
+ virtual std::string typeId() const;
+ virtual bool usesClasses() const;
+ virtual size_t minWireSize() const;
+ virtual bool isVariableLength() const;
+
+ ClassDeclPtr _class() const;
+
+ Proxy(const ClassDeclPtr&);
+
+protected:
+
+ ClassDeclPtr __class;
+};
+
+// ----------------------------------------------------------------------
+// Exception
+// ----------------------------------------------------------------------
+
+// No inheritance from Constructed, as this is not a Type
+class Exception : public virtual Container, public virtual Contained
+{
+public:
+
+ virtual void destroy();
+ DataMemberPtr createDataMember(const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&,
+ const std::string&, const std::string&);
+ DataMemberList dataMembers() const;
+ DataMemberList orderedOptionalDataMembers() const;
+ DataMemberList allDataMembers() const;
+ DataMemberList classDataMembers() const;
+ DataMemberList allClassDataMembers() const;
+ ExceptionPtr base() const;
+ ExceptionList allBases() const;
+ virtual bool isBaseOf(const ExceptionPtr&) const;
+ virtual bool isLocal() const;
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ bool usesClasses(bool) const;
+ bool hasDefaultValues() const;
+ bool inheritsMetaData(const std::string&) const;
+ virtual std::string kindOf() const;
+ virtual void visit(ParserVisitor*, bool);
+
+protected:
+
+ Exception(const ContainerPtr&, const std::string&, const ExceptionPtr&, bool);
+ friend class Container;
+
+ ExceptionPtr _base;
+ bool _local;
+};
+
+// ----------------------------------------------------------------------
+// Struct
+// ----------------------------------------------------------------------
+
+class Struct : public virtual Container, public virtual Constructed
+{
+public:
+
+ DataMemberPtr createDataMember(const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&,
+ const std::string&, const std::string&);
+ DataMemberList dataMembers() const;
+ DataMemberList classDataMembers() const;
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual bool usesClasses() const;
+ virtual size_t minWireSize() const;
+ virtual bool isVariableLength() const;
+ bool hasDefaultValues() const;
+ virtual std::string kindOf() const;
+ virtual void visit(ParserVisitor*, bool);
+ virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly.
+
+protected:
+
+ Struct(const ContainerPtr&, const std::string&, bool);
+ friend class Container;
+};
+
+// ----------------------------------------------------------------------
+// Sequence
+// ----------------------------------------------------------------------
+
+class Sequence : public virtual Constructed
+{
+public:
+
+ TypePtr type() const;
+ StringList typeMetaData() const;
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual bool usesClasses() const;
+ virtual size_t minWireSize() const;
+ virtual bool isVariableLength() const;
+ virtual std::string kindOf() const;
+ virtual void visit(ParserVisitor*, bool);
+ virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly.
+
+protected:
+
+ Sequence(const ContainerPtr&, const std::string&, const TypePtr&, const StringList&, bool);
+ friend class Container;
+
+ TypePtr _type;
+ StringList _typeMetaData;
+};
+
+// ----------------------------------------------------------------------
+// Dictionary
+// ----------------------------------------------------------------------
+
+class Dictionary : public virtual Constructed
+{
+public:
+
+ TypePtr keyType() const;
+ TypePtr valueType() const;
+ StringList keyMetaData() const;
+ StringList valueMetaData() const;
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual bool usesClasses() const;
+ virtual size_t minWireSize() const;
+ virtual bool isVariableLength() const;
+ virtual std::string kindOf() const;
+ virtual void visit(ParserVisitor*, bool);
+ virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly.
+
+ static bool legalKeyType(const TypePtr&, bool&);
+
+protected:
+
+ Dictionary(const ContainerPtr&, const std::string&, const TypePtr&, const StringList&, const TypePtr&,
+ const StringList&, bool);
+ friend class Container;
+
+ TypePtr _keyType;
+ TypePtr _valueType;
+ StringList _keyMetaData;
+ StringList _valueMetaData;
+};
+
+// ----------------------------------------------------------------------
+// Enum
+// ----------------------------------------------------------------------
+
+class Enum : public virtual Constructed
+{
+public:
+
+ virtual void destroy();
+ EnumeratorList getEnumerators();
+ void setEnumerators(const EnumeratorList&);
+ bool explicitValue() const;
+ int minValue() const;
+ int maxValue() const;
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual bool usesClasses() const;
+ virtual size_t minWireSize() const;
+ virtual bool isVariableLength() const;
+ virtual std::string kindOf() const;
+ virtual void visit(ParserVisitor*, bool);
+ virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly.
+
+protected:
+
+ Enum(const ContainerPtr&, const std::string&, bool);
+ friend class Container;
+
+ EnumeratorList _enumerators;
+ bool _explicitValue;
+ IceUtil::Int64 _minValue;
+ IceUtil::Int64 _maxValue;
+};
+
+// ----------------------------------------------------------------------
+// Enumerator
+// ----------------------------------------------------------------------
+
+class Enumerator : public virtual Contained
+{
+public:
+
+ EnumPtr type() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual ContainedType containedType() const;
+ virtual std::string kindOf() const;
+
+ bool explicitValue() const;
+ int value() const;
+
+protected:
+
+ Enumerator(const ContainerPtr&, const std::string&);
+ Enumerator(const ContainerPtr&, const std::string&, int);
+ friend class Container;
+ friend class Enum;
+
+ EnumPtr _type;
+ bool _explicitValue;
+ int _value;
+};
+
+// ----------------------------------------------------------------------
+// Const
+// ----------------------------------------------------------------------
+
+class Const : public virtual Contained
+{
+public:
+
+ TypePtr type() const;
+ StringList typeMetaData() const;
+ SyntaxTreeBasePtr valueType() const;
+ std::string value() const;
+ std::string literal() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual ContainedType containedType() const;
+ virtual std::string kindOf() const;
+ virtual void visit(ParserVisitor*, bool);
+
+protected:
+
+ Const(const ContainerPtr&, const std::string&, const TypePtr&, const StringList&, const SyntaxTreeBasePtr&,
+ const std::string&, const std::string&);
+ friend class Container;
+
+ TypePtr _type;
+ StringList _typeMetaData;
+ SyntaxTreeBasePtr _valueType;
+ std::string _value;
+ std::string _literal;
+};
+
+// ----------------------------------------------------------------------
+// ParamDecl
+// ----------------------------------------------------------------------
+
+class ParamDecl : public virtual Contained
+{
+public:
+
+ TypePtr type() const;
+ bool isOutParam() const;
+ bool optional() const;
+ int tag() const;
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual std::string kindOf() const;
+ virtual void visit(ParserVisitor*, bool);
+
+protected:
+
+ ParamDecl(const ContainerPtr&, const std::string&, const TypePtr&, bool, bool, int);
+ friend class Operation;
+
+ TypePtr _type;
+ bool _isOutParam;
+ bool _optional;
+ int _tag;
+};
+
+// ----------------------------------------------------------------------
+// DataMember
+// ----------------------------------------------------------------------
+
+class DataMember : public virtual Contained
+{
+public:
+
+ TypePtr type() const;
+ bool optional() const;
+ int tag() const;
+ std::string defaultValue() const;
+ std::string defaultLiteral() const;
+ SyntaxTreeBasePtr defaultValueType() const;
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual std::string kindOf() const;
+ virtual void visit(ParserVisitor*, bool);
+
+
+protected:
+
+ DataMember(const ContainerPtr&, const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&,
+ const std::string&, const std::string&);
+ friend class ClassDef;
+ friend class Struct;
+ friend class Exception;
+
+ TypePtr _type;
+ bool _optional;
+ int _tag;
+ SyntaxTreeBasePtr _defaultValueType;
+ std::string _defaultValue;
+ std::string _defaultLiteral;
+};
+
+// ----------------------------------------------------------------------
+// Unit
+// ----------------------------------------------------------------------
+
+class Unit : public virtual Container
+{
+public:
+
+ static UnitPtr createUnit(bool, bool, bool, bool, const StringList& = StringList());
+
+ bool ignRedefs() const;
+ bool allowIcePrefix() const;
+ bool allowUnderscore() const;
+
+ void setComment(const std::string&);
+ std::string currentComment(); // Not const, as this function removes the current comment.
+ std::string currentFile() const;
+ std::string topLevelFile() const;
+ int currentLine() const;
+
+ void nextLine();
+ bool scanPosition(const char*);
+ int currentIncludeLevel() const;
+
+ void addGlobalMetaData(const StringList&);
+
+ void setSeenDefinition();
+
+ void error(const char*); // Not const, because error count is increased.
+ void error(const std::string&); // Ditto.
+
+ void warning(const char*) const;
+ void warning(const std::string&) const;
+
+ ContainerPtr currentContainer() const;
+ void pushContainer(const ContainerPtr&);
+ void popContainer();
+
+ DefinitionContextPtr currentDefinitionContext() const;
+ void pushDefinitionContext();
+ void popDefinitionContext();
+ DefinitionContextPtr findDefinitionContext(const std::string&) const;
+
+ void addContent(const ContainedPtr&);
+ void removeContent(const ContainedPtr&);
+ ContainedList findContents(const std::string&) const;
+ ClassList findDerivedClasses(const ClassDefPtr&) const;
+ ExceptionList findDerivedExceptions(const ExceptionPtr&) const;
+ ContainedList findUsedBy(const ContainedPtr&) const;
+
+ void addTypeId(int, const std::string&);
+ std::string getTypeId(int);
+
+ bool usesNonLocals() const;
+ bool usesConsts() const;
+
+ FeatureProfile profile() const;
+
+ //
+ // Returns the path names of the files included directly by the top-level file.
+ //
+ StringList includeFiles() const;
+
+ //
+ // Returns the path names of all files parsed by this unit.
+ //
+ StringList allFiles() const;
+
+ int parse(const std::string&, FILE*, bool, FeatureProfile profile = Ice);
+
+ virtual void destroy();
+ virtual void visit(ParserVisitor*, bool);
+
+ BuiltinPtr builtin(Builtin::Kind); // Not const, as builtins are created on the fly. (Lazy initialization.)
+
+ void addTopLevelModule(const std::string&, const std::string&);
+ std::set<std::string> getTopLevelModules(const std::string&) const;
+
+private:
+
+ Unit(bool, bool, bool, bool, const StringList&);
+ static void eraseWhiteSpace(::std::string&);
+
+ bool _ignRedefs;
+ bool _all;
+ bool _allowIcePrefix;
+ bool _allowUnderscore;
+ StringList _defaultGlobalMetaData;
+ int _errors;
+ std::string _currentComment;
+ int _currentLine;
+ int _currentIncludeLevel;
+ std::string _currentFile;
+ std::string _topLevelFile;
+ std::stack<DefinitionContextPtr> _definitionContextStack;
+ StringList _includeFiles;
+ std::stack<ContainerPtr> _containerStack;
+ std::map<Builtin::Kind, BuiltinPtr> _builtins;
+ std::map<std::string, ContainedList> _contentMap;
+ FeatureProfile _featureProfile;
+ std::map<std::string, DefinitionContextPtr> _definitionContextMap;
+ std::map<int, std::string> _typeIds;
+ std::map< std::string, std::set<std::string> > _fileTopLevelModules;
+};
+
+extern Unit* unit; // The current parser for bison/flex
+
+}
+
+#endif
diff --git a/cpp/src/Slice/Preprocessor.h b/cpp/src/Slice/Preprocessor.h
new file mode 100644
index 00000000000..80f8acf4d66
--- /dev/null
+++ b/cpp/src/Slice/Preprocessor.h
@@ -0,0 +1,60 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef PREPROCESSOR_H
+#define PREPROCESSOR_H
+
+#include <IceUtil/Shared.h>
+#include <IceUtil/Handle.h>
+#include <vector>
+
+namespace Slice
+{
+
+class Preprocessor;
+typedef IceUtil::Handle<Preprocessor> PreprocessorPtr;
+
+class Preprocessor : public IceUtil::SimpleShared
+{
+public:
+
+ static PreprocessorPtr create(const std::string&, const std::string&, const std::vector<std::string>&);
+
+ ~Preprocessor();
+
+ FILE* preprocess(bool, const std::string& = "");
+ bool close();
+
+ enum Language { CPlusPlus, Java, CSharp, Python, Ruby, PHP, JavaScript, JavaScriptJSON, ObjC, SliceXML };
+
+ bool printMakefileDependencies(std::ostream&, Language, const std::vector<std::string>&, const std::string& = "",
+ const std::string& = "cpp", const std::string& = "");
+
+ std::string getBaseName();
+
+ static std::string addQuotes(const std::string&);
+ static std::string normalizeIncludePath(const std::string&);
+
+private:
+
+ Preprocessor(const std::string&, const std::string&, const std::vector<std::string>&);
+
+ bool checkInputFile();
+
+ const std::string _path;
+ const std::string _fileName;
+ const std::string _shortFileName;
+ const std::vector<std::string> _args;
+ std::string _cppFile;
+ FILE* _cppHandle;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Slice/PythonUtil.h b/cpp/src/Slice/PythonUtil.h
new file mode 100644
index 00000000000..807fcfa1561
--- /dev/null
+++ b/cpp/src/Slice/PythonUtil.h
@@ -0,0 +1,64 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef SLICE_PYTHON_UTIL_H
+#define SLICE_PYTHON_UTIL_H
+
+#include <Slice/Parser.h>
+#include <IceUtil/OutputUtil.h>
+
+namespace Slice
+{
+namespace Python
+{
+
+//
+// Generate Python code for a translation unit.
+//
+void generate(const Slice::UnitPtr&, bool, bool, const std::vector<std::string>&, IceUtilInternal::Output&);
+
+//
+// Convert a scoped name into a Python name.
+//
+std::string scopedToName(const std::string&);
+
+//
+// Check the given identifier against Python's list of reserved words. If it matches
+// a reserved word, then an escaped version is returned with a leading underscore.
+//
+std::string fixIdent(const std::string&);
+
+//
+// Return the package specified in the global metadata for the given definition,
+// or an empty string if no metadata was found.
+//
+std::string getPackageMetadata(const Slice::ContainedPtr&);
+
+//
+// Get the fully-qualified name of the given definition, including any
+// package defined via metadata. If a suffix is provided, it is
+// prepended to the definition's unqualified name. If the nameSuffix
+// is provided, it is appended to the containers name.
+//
+// COMPILERFIX: MSVC 6 seems to have a problem with const std::string
+// = std::string(), const std::string = std::string().
+//
+std::string getAbsolute(const Slice::ContainedPtr&, const std::string& = "", const std::string& = "");
+
+//
+// Emit a comment header.
+//
+void printHeader(IceUtilInternal::Output&);
+
+int compile(int, char*[]);
+
+}
+}
+
+#endif
diff --git a/cpp/src/Slice/RubyUtil.h b/cpp/src/Slice/RubyUtil.h
new file mode 100644
index 00000000000..3acae195d9c
--- /dev/null
+++ b/cpp/src/Slice/RubyUtil.h
@@ -0,0 +1,54 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef SLICE_RUBY_UTIL_H
+#define SLICE_RUBY_UTIL_H
+
+#include <Slice/Parser.h>
+#include <IceUtil/OutputUtil.h>
+
+namespace Slice
+{
+namespace Ruby
+{
+
+//
+// Generate Ruby code for a translation unit.
+//
+void generate(const Slice::UnitPtr&, bool, bool, const std::vector<std::string>&, IceUtilInternal::Output&);
+
+//
+// Check the given identifier against Ruby's list of reserved words. If it matches
+// a reserved word, then an escaped version is returned with a leading underscore.
+//
+enum IdentStyle
+{
+ IdentNormal,
+ IdentToUpper, // Mapped identifier must begin with an upper-case letter.
+ IdentToLower // Mapped identifier must begin with a lower-case letter.
+};
+std::string fixIdent(const std::string&, IdentStyle);
+
+//
+// Get the fully-qualified name of the given definition. If a prefix is provided,
+// it is prepended to the definition's unqualified name.
+//
+std::string getAbsolute(const Slice::ContainedPtr&, IdentStyle, const std::string& = std::string());
+
+//
+// Emit a comment header.
+//
+void printHeader(IceUtilInternal::Output&);
+
+int compile(int, char*[]);
+
+}
+}
+
+#endif
diff --git a/cpp/src/Slice/Util.h b/cpp/src/Slice/Util.h
new file mode 100644
index 00000000000..a2ec69a87a2
--- /dev/null
+++ b/cpp/src/Slice/Util.h
@@ -0,0 +1,51 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef SLICE_UTIL_H
+#define SLICE_UTIL_H
+
+#include <Slice/Parser.h>
+#include <IceUtil/OutputUtil.h>
+
+#include <ostream>
+#include <fstream>
+
+namespace Slice
+{
+
+std::string fullPath(const std::string&);
+std::string changeInclude(const std::string&, const std::vector<std::string>&);
+void setErrorStream(std::ostream&);
+std::ostream& getErrorStream();
+void emitError(const std::string&, int, const std::string&);
+void emitWarning(const std::string&, int, const std::string&);
+void emitError(const std::string&, const std::string&, const std::string&);
+void emitWarning(const std::string&, const std::string&, const std::string&);
+void emitRaw(const char*);
+std::vector<std::string> filterMcppWarnings(const std::string&);
+void printGeneratedHeader(IceUtilInternal::Output& out, const std::string&, const std::string& commentStyle = "//");
+
+class DependOutputUtil : IceUtil::noncopyable
+{
+public:
+
+ DependOutputUtil(std::string& file);
+ ~DependOutputUtil();
+ void cleanup();
+ std::ostream& os();
+
+private:
+
+ const std::string _file;
+ std::ofstream _os;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Slice/msbuild/slice.vcxproj b/cpp/src/Slice/msbuild/slice.vcxproj
index c1fd2551891..c495f735108 100644
--- a/cpp/src/Slice/msbuild/slice.vcxproj
+++ b/cpp/src/Slice/msbuild/slice.vcxproj
@@ -83,17 +83,17 @@
<ClCompile Include="..\SliceUtil.cpp" />
</ItemGroup>
<ItemGroup>
- <ClInclude Include="..\..\..\include\Slice\Checksum.h" />
- <ClInclude Include="..\..\..\include\Slice\CPlusPlusUtil.h" />
- <ClInclude Include="..\..\..\include\Slice\FileTracker.h" />
- <ClInclude Include="..\..\..\include\Slice\JavaUtil.h" />
- <ClInclude Include="..\..\..\include\Slice\ObjCUtil.h" />
- <ClInclude Include="..\..\..\include\Slice\Parser.h" />
- <ClInclude Include="..\..\..\include\Slice\PHPUtil.h" />
- <ClInclude Include="..\..\..\include\Slice\Preprocessor.h" />
- <ClInclude Include="..\..\..\include\Slice\PythonUtil.h" />
- <ClInclude Include="..\..\..\include\Slice\RubyUtil.h" />
- <ClInclude Include="..\..\..\include\Slice\Util.h" />
+ <ClInclude Include="..\Checksum.h" />
+ <ClInclude Include="..\CPlusPlusUtil.h" />
+ <ClInclude Include="..\FileTracker.h" />
+ <ClInclude Include="..\JavaUtil.h" />
+ <ClInclude Include="..\ObjCUtil.h" />
+ <ClInclude Include="..\Parser.h" />
+ <ClInclude Include="..\PHPUtil.h" />
+ <ClInclude Include="..\Preprocessor.h" />
+ <ClInclude Include="..\PythonUtil.h" />
+ <ClInclude Include="..\RubyUtil.h" />
+ <ClInclude Include="..\Util.h" />
<ClInclude Include="..\Grammar.h" />
<ClInclude Include="..\GrammarUtil.h" />
<ClInclude Include="..\MD5.h" />
@@ -101,4 +101,4 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
-</Project>
+</Project> \ No newline at end of file
diff --git a/cpp/src/Slice/msbuild/slice.vcxproj.filters b/cpp/src/Slice/msbuild/slice.vcxproj.filters
index c3359f281c5..fd3091d1980 100644
--- a/cpp/src/Slice/msbuild/slice.vcxproj.filters
+++ b/cpp/src/Slice/msbuild/slice.vcxproj.filters
@@ -21,9 +21,6 @@
<ClCompile Include="..\CPlusPlusUtil.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="..\DotNetNames.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="..\FileTracker.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -83,41 +80,38 @@
<ClInclude Include="..\MD5I.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\include\Slice\Checksum.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\include\Slice\CPlusPlusUtil.h">
+ <ClInclude Include="..\Checksum.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\include\Slice\DotNetNames.h">
+ <ClInclude Include="..\CPlusPlusUtil.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\include\Slice\FileTracker.h">
+ <ClInclude Include="..\FileTracker.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\include\Slice\JavaUtil.h">
+ <ClInclude Include="..\JavaUtil.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\include\Slice\ObjCUtil.h">
+ <ClInclude Include="..\ObjCUtil.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\include\Slice\Parser.h">
+ <ClInclude Include="..\Parser.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\include\Slice\Preprocessor.h">
+ <ClInclude Include="..\Preprocessor.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\include\Slice\RubyUtil.h">
+ <ClInclude Include="..\RubyUtil.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\include\Slice\Util.h">
+ <ClInclude Include="..\Util.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\include\Slice\PHPUtil.h">
+ <ClInclude Include="..\PHPUtil.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\..\..\include\Slice\PythonUtil.h">
+ <ClInclude Include="..\PythonUtil.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
-</Project>
+</Project> \ No newline at end of file