[hydra-commits] file: branch ice/slice-translator-versioning r656 - /ice/branches/slice-trans...
SVN commits to the Hydra project
hydra-commits at lists.digium.com
Thu Jun 3 09:19:31 CDT 2010
Author: file
Date: Thu Jun 3 09:19:30 2010
New Revision: 656
URL: https://origsvn.digium.com/svn-view/hydra?view=rev&rev=656
Log:
Add suppress support to slice2java.
Modified:
ice/branches/slice-translator-versioning/cpp/src/slice2java/Gen.cpp
ice/branches/slice-translator-versioning/cpp/src/slice2java/Gen.h
ice/branches/slice-translator-versioning/cpp/src/slice2java/Main.cpp
Modified: ice/branches/slice-translator-versioning/cpp/src/slice2java/Gen.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-translator-versioning/cpp/src/slice2java/Gen.cpp?view=diff&rev=656&r1=655&r2=656
==============================================================================
--- ice/branches/slice-translator-versioning/cpp/src/slice2java/Gen.cpp (original)
+++ ice/branches/slice-translator-versioning/cpp/src/slice2java/Gen.cpp Thu Jun 3 09:19:30 2010
@@ -35,6 +35,25 @@
using IceUtilInternal::epar;
static string
+suppressedabsolute(const ContainerPtr& cp, string absolute, bool _suppress)
+{
+ string suppressed_absolute = absolute;
+
+ if (_suppress) {
+ for (ContainedPtr contained = ContainedPtr::dynamicCast(cp); contained; contained = ContainedPtr::dynamicCast(contained->container())) {
+ ModulePtr mod = ModulePtr::dynamicCast(contained);
+ if (mod && mod->hasMetaData("suppress")) {
+ string suppress_string = "." + mod->name();
+ string::size_type pos = suppressed_absolute.rfind(suppress_string);
+ suppressed_absolute.replace(pos, suppress_string.length(), "");
+ }
+ }
+ }
+
+ return suppressed_absolute;
+}
+
+static string
sliceModeToIceMode(Operation::Mode opMode)
{
string mode;
@@ -400,6 +419,7 @@
{
string name = fixKwd(p->name());
string package = getPackage(p);
+ cout << "Rawr " << package << endl;
string scoped = p->scoped();
ClassList bases = p->bases();
@@ -1721,10 +1741,11 @@
}
}
-Slice::Gen::Gen(const string& name, const string& base, const vector<string>& includePaths, const string& dir) :
+Slice::Gen::Gen(const string& name, const string& base, const vector<string>& includePaths, const string& dir, bool suppress) :
_base(base),
_includePaths(includePaths),
- _dir(dir)
+ _dir(dir),
+ _suppress(suppress)
{
}
@@ -1737,44 +1758,44 @@
{
JavaGenerator::validateMetaData(p);
- OpsVisitor opsVisitor(_dir);
+ OpsVisitor opsVisitor(_dir, _suppress);
p->visit(&opsVisitor, false);
PackageVisitor packageVisitor(_dir);
p->visit(&packageVisitor, false);
- TypesVisitor typesVisitor(_dir, stream);
+ TypesVisitor typesVisitor(_dir, stream, _suppress);
p->visit(&typesVisitor, false);
- HolderVisitor holderVisitor(_dir, stream);
+ HolderVisitor holderVisitor(_dir, stream, _suppress);
p->visit(&holderVisitor, false);
- HelperVisitor helperVisitor(_dir, stream);
+ HelperVisitor helperVisitor(_dir, stream, _suppress);
p->visit(&helperVisitor, false);
- ProxyVisitor proxyVisitor(_dir);
+ ProxyVisitor proxyVisitor(_dir, _suppress);
p->visit(&proxyVisitor, false);
- DelegateVisitor delegateVisitor(_dir);
+ DelegateVisitor delegateVisitor(_dir, _suppress);
p->visit(&delegateVisitor, false);
- DelegateMVisitor delegateMVisitor(_dir);
+ DelegateMVisitor delegateMVisitor(_dir, _suppress);
p->visit(&delegateMVisitor, false);
- DelegateDVisitor delegateDVisitor(_dir);
+ DelegateDVisitor delegateDVisitor(_dir, _suppress);
p->visit(&delegateDVisitor, false);
- DispatcherVisitor dispatcherVisitor(_dir, stream);
+ DispatcherVisitor dispatcherVisitor(_dir, stream, _suppress);
p->visit(&dispatcherVisitor, false);
- AsyncVisitor asyncVisitor(_dir);
+ AsyncVisitor asyncVisitor(_dir, _suppress);
p->visit(&asyncVisitor, false);
}
void
Slice::Gen::generateTie(const UnitPtr& p)
{
- TieVisitor tieVisitor(_dir);
+ TieVisitor tieVisitor(_dir, _suppress);
p->visit(&tieVisitor, false);
}
@@ -1847,8 +1868,8 @@
out << nl;
}
-Slice::Gen::OpsVisitor::OpsVisitor(const string& dir) :
- JavaVisitor(dir)
+Slice::Gen::OpsVisitor::OpsVisitor(const string& dir, bool suppress) :
+ JavaVisitor(dir), _suppress(suppress)
{
}
@@ -1885,7 +1906,7 @@
}
string absolute = getAbsolute(p, "", "_", opIntfName);
- open(absolute, p->file());
+ open(suppressedabsolute(p->container(), absolute, _suppress), p->file());
Output& out = output();
@@ -1989,8 +2010,8 @@
close();
}
-Slice::Gen::TieVisitor::TieVisitor(const string& dir) :
- JavaVisitor(dir)
+Slice::Gen::TieVisitor::TieVisitor(const string& dir, bool suppress) :
+ JavaVisitor(dir), _suppress(suppress)
{
}
@@ -2015,7 +2036,7 @@
return false;
}
- open(absolute, p->file());
+ open(suppressedabsolute(p->container(), absolute, _suppress), p->file());
Output& out = output();
@@ -2212,8 +2233,8 @@
return false;
}
-Slice::Gen::TypesVisitor::TypesVisitor(const string& dir, bool stream) :
- JavaVisitor(dir), _stream(stream)
+Slice::Gen::TypesVisitor::TypesVisitor(const string& dir, bool stream, bool suppress) :
+ JavaVisitor(dir), _stream(stream), _suppress(suppress)
{
}
@@ -2234,7 +2255,7 @@
DataMemberList allDataMembers = p->allDataMembers();
DataMemberList::const_iterator d;
- open(absolute, p->file());
+ open(suppressedabsolute(p->container(), absolute, _suppress), p->file());
Output& out = output();
@@ -2557,7 +2578,7 @@
DataMemberList members = p->dataMembers();
DataMemberList::const_iterator d;
- open(absolute, p->file());
+ open(suppressedabsolute(p->container(), absolute, _suppress), p->file());
Output& out = output();
@@ -2889,7 +2910,7 @@
string name = fixKwd(p->name());
string absolute = getAbsolute(p);
- open(absolute, p->file());
+ open(suppressedabsolute(p->container(), absolute, _suppress), p->file());
Output& out = output();
@@ -3402,7 +3423,7 @@
EnumeratorList::const_iterator en;
size_t sz = enumerators.size();
- open(absolute, p->file());
+ open(suppressedabsolute(p->container(), absolute, _suppress), p->file());
Output& out = output();
@@ -3517,7 +3538,7 @@
string absolute = getAbsolute(p);
TypePtr type = p->type();
- open(absolute, p->file());
+ open(suppressedabsolute(p->container(), absolute, _suppress), p->file());
Output& out = output();
@@ -3553,8 +3574,8 @@
return true;
}
-Slice::Gen::HolderVisitor::HolderVisitor(const string& dir, bool stream) :
- JavaVisitor(dir), _stream(stream)
+Slice::Gen::HolderVisitor::HolderVisitor(const string& dir, bool stream, bool suppress) :
+ JavaVisitor(dir), _stream(stream), _suppress(suppress)
{
}
@@ -3569,7 +3590,7 @@
string name = p->name();
string absolute = getAbsolute(p, "", "", "PrxHolder");
- open(absolute, p->file());
+ open(suppressedabsolute(p->container(), absolute, _suppress), p->file());
Output& out = output();
out << sp << nl << "public final class " << name << "PrxHolder";
@@ -3646,7 +3667,7 @@
file = p->definitionContext()->filename();
}
- open(absolute, file);
+ open(suppressedabsolute(contained->container(), absolute, _suppress), file);
Output& out = output();
string typeS = typeToString(p, TypeModeIn, getPackage(contained));
@@ -3706,8 +3727,8 @@
close();
}
-Slice::Gen::HelperVisitor::HelperVisitor(const string& dir, bool stream) :
- JavaVisitor(dir), _stream(stream)
+Slice::Gen::HelperVisitor::HelperVisitor(const string& dir, bool stream, bool suppress) :
+ JavaVisitor(dir), _stream(stream), _suppress(suppress)
{
}
@@ -3728,7 +3749,7 @@
string package = getPackage(p);
string absolute = getAbsolute(p);
- open(getAbsolute(p, "", "", "PrxHelper"), p->file());
+ open(suppressedabsolute(p->container(), getAbsolute(p, "", "", "PrxHelper"), _suppress), p->file());
Output& out = output();
//
@@ -4322,7 +4343,8 @@
//
// Class helper.
//
- open(getAbsolute(p, "", "", "Helper"), p->file());
+
+ open(suppressedabsolute(p->container(), getAbsolute(p, "", "", "Helper"), _suppress), p->file());
Output& out2 = output();
@@ -4354,7 +4376,7 @@
string name = p->name();
string fixedName = fixKwd(name);
- open(getAbsolute(p, "", "", "Helper"), p->file());
+ open(suppressedabsolute(p->container(), getAbsolute(p, "", "", "Helper"), _suppress), p->file());
Output& out = output();
@@ -4448,7 +4470,7 @@
suppressUnchecked = origContentS.find('<') != string::npos;
}
- open(helper, p->file());
+ open(suppressedabsolute(p->container(), helper, _suppress), p->file());
Output& out = output();
int iter;
@@ -4522,7 +4544,7 @@
StringList metaData = p->getMetaData();
string formalType = typeToString(p, TypeModeIn, package, StringList(), true);
- open(helper, p->file());
+ open(suppressedabsolute(p->container(), helper, _suppress), p->file());
Output& out = output();
int iter;
@@ -4576,7 +4598,7 @@
string name = p->name();
string fixedName = fixKwd(name);
- open(getAbsolute(p, "", "", "Helper"), p->file());
+ open(suppressedabsolute(p->container(), getAbsolute(p, "", "", "Helper"), _suppress), p->file());
Output& out = output();
@@ -4598,8 +4620,8 @@
}
}
-Slice::Gen::ProxyVisitor::ProxyVisitor(const string& dir) :
- JavaVisitor(dir)
+Slice::Gen::ProxyVisitor::ProxyVisitor(const string& dir, bool suppress) :
+ JavaVisitor(dir), _suppress(suppress)
{
}
@@ -4616,7 +4638,7 @@
string package = getPackage(p);
string absolute = getAbsolute(p, "", "", "Prx");
- open(absolute, p->file());
+ open(suppressedabsolute(p->container(), absolute, _suppress), p->file());
Output& out = output();
@@ -4776,8 +4798,8 @@
}
}
-Slice::Gen::DelegateVisitor::DelegateVisitor(const string& dir) :
- JavaVisitor(dir)
+Slice::Gen::DelegateVisitor::DelegateVisitor(const string& dir, bool suppress) :
+ JavaVisitor(dir), _suppress(suppress)
{
}
@@ -4794,7 +4816,7 @@
string package = getPackage(p);
string absolute = getAbsolute(p, "", "_", "Del");
- open(absolute, p->file());
+ open(suppressedabsolute(p->container(), absolute, _suppress), p->file());
Output& out = output();
@@ -4850,8 +4872,8 @@
return false;
}
-Slice::Gen::DelegateMVisitor::DelegateMVisitor(const string& dir) :
- JavaVisitor(dir)
+Slice::Gen::DelegateMVisitor::DelegateMVisitor(const string& dir, bool suppress) :
+ JavaVisitor(dir), _suppress(suppress)
{
}
@@ -4868,7 +4890,7 @@
string package = getPackage(p);
string absolute = getAbsolute(p, "", "_", "DelM");
- open(absolute, p->file());
+ open(suppressedabsolute(p->container(), absolute, _suppress), p->file());
Output& out = output();
out << sp << nl << "public final class _" << name << "DelM extends Ice._ObjectDelM implements _" << name << "Del";
@@ -5049,8 +5071,8 @@
return false;
}
-Slice::Gen::DelegateDVisitor::DelegateDVisitor(const string& dir) :
- JavaVisitor(dir)
+Slice::Gen::DelegateDVisitor::DelegateDVisitor(const string& dir, bool suppress) :
+ JavaVisitor(dir), _suppress(suppress)
{
}
@@ -5067,7 +5089,7 @@
string package = getPackage(p);
string absolute = getAbsolute(p, "", "_", "DelD");
- open(absolute, p->file());
+ open(suppressedabsolute(p->container(), absolute, _suppress), p->file());
Output& out = output();
@@ -5234,8 +5256,8 @@
return false;
}
-Slice::Gen::DispatcherVisitor::DispatcherVisitor(const string& dir, bool stream) :
- JavaVisitor(dir), _stream(stream)
+Slice::Gen::DispatcherVisitor::DispatcherVisitor(const string& dir, bool stream, bool suppress) :
+ JavaVisitor(dir), _stream(stream), _suppress(suppress)
{
}
@@ -5251,7 +5273,7 @@
ClassList bases = p->bases();
string absolute = getAbsolute(p, "", "_", "Disp");
- open(absolute, p->file());
+ open(suppressedabsolute(p->container(), absolute, _suppress), p->file());
Output& out = output();
@@ -5548,7 +5570,7 @@
string package = getPackage(p);
string absolute = getAbsolute(p, "", "", "I");
- open(absolute, p->file());
+ open(suppressedabsolute(p->container(), absolute, _suppress), p->file());
Output& out = output();
@@ -5606,7 +5628,7 @@
string package = getPackage(p);
string absolute = getAbsolute(p, "", "", "I");
- open(absolute, p->file());
+ open(suppressedabsolute(p->container(), absolute, _suppress), p->file());
Output& out = output();
@@ -5678,8 +5700,8 @@
return false;
}
-Slice::Gen::AsyncVisitor::AsyncVisitor(const string& dir) :
- JavaVisitor(dir)
+Slice::Gen::AsyncVisitor::AsyncVisitor(const string& dir, bool suppress) :
+ JavaVisitor(dir), _suppress(suppress)
{
}
@@ -5705,7 +5727,7 @@
string classNameAsync = "Callback_" + cl->name();
string absoluteAsync = getAbsolute(cl, "", "Callback_", "_" + name);
- open(absoluteAsync, p->file());
+ open(suppressedabsolute(p->container(), absoluteAsync, _suppress), p->file());
Output& out = output();
@@ -5805,7 +5827,7 @@
string classNameAMI = "AMI_" + cl->name();
string absoluteAMI = getAbsolute(cl, "", "AMI_", "_" + name);
- open(absoluteAMI, p->file());
+ open(suppressedabsolute(p->container(), absoluteAMI, _suppress), p->file());
Output& out = output();
@@ -5883,7 +5905,7 @@
vector<string> paramsAMD = getParamsAsyncCB(p, classPkg);
{
- open(absoluteAMD, p->file());
+ open(suppressedabsolute(p->container(), absoluteAMD, _suppress), p->file());
Output& out = output();
@@ -5901,7 +5923,7 @@
}
{
- open(absoluteAMDI, p->file());
+ open(suppressedabsolute(p->container(), absoluteAMDI, _suppress), p->file());
Output& out = output();
Modified: ice/branches/slice-translator-versioning/cpp/src/slice2java/Gen.h
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-translator-versioning/cpp/src/slice2java/Gen.h?view=diff&rev=656&r1=655&r2=656
==============================================================================
--- ice/branches/slice-translator-versioning/cpp/src/slice2java/Gen.h (original)
+++ ice/branches/slice-translator-versioning/cpp/src/slice2java/Gen.h Thu Jun 3 09:19:30 2010
@@ -99,7 +99,8 @@
Gen(const std::string&,
const std::string&,
const std::vector<std::string>&,
- const std::string&);
+ const std::string&,
+ bool);
~Gen();
void generate(const UnitPtr&, bool);
@@ -115,25 +116,32 @@
std::vector<std::string> _includePaths;
std::string _dir;
+ bool _suppress;
+
class OpsVisitor : public JavaVisitor
{
public:
- OpsVisitor(const std::string&);
+ OpsVisitor(const std::string&, bool);
virtual bool visitClassDefStart(const ClassDefPtr&);
private:
void writeOperations(const ClassDefPtr&, bool);
+ bool _suppress;
};
class TieVisitor : public JavaVisitor
{
public:
- TieVisitor(const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
+ TieVisitor(const std::string&, bool);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+
+ private:
+
+ bool _suppress;
};
class PackageVisitor : public JavaVisitor
@@ -149,7 +157,7 @@
{
public:
- TypesVisitor(const std::string&, bool);
+ TypesVisitor(const std::string&, bool, bool);
virtual bool visitClassDefStart(const ClassDefPtr&);
virtual void visitClassDefEnd(const ClassDefPtr&);
@@ -170,13 +178,15 @@
const std::string&);
bool _stream;
+
+ bool _suppress;
};
class HolderVisitor : public JavaVisitor
{
public:
- HolderVisitor(const std::string&, bool);
+ HolderVisitor(const std::string&, bool, bool);
virtual bool visitClassDefStart(const ClassDefPtr&);
virtual bool visitStructStart(const StructPtr&);
@@ -189,13 +199,15 @@
void writeHolder(const TypePtr&);
bool _stream;
+
+ bool _suppress;
};
class HelperVisitor : public JavaVisitor
{
public:
- HelperVisitor(const std::string&, bool);
+ HelperVisitor(const std::string&, bool, bool);
virtual bool visitClassDefStart(const ClassDefPtr&);
virtual bool visitStructStart(const StructPtr&);
@@ -206,57 +218,77 @@
private:
bool _stream;
+
+ bool _suppress;
};
class ProxyVisitor : public JavaVisitor
{
public:
- ProxyVisitor(const std::string&);
+ ProxyVisitor(const std::string&, bool);
virtual bool visitClassDefStart(const ClassDefPtr&);
virtual void visitClassDefEnd(const ClassDefPtr&);
virtual void visitOperation(const OperationPtr&);
+
+ private:
+
+ bool _suppress;
};
class DelegateVisitor : public JavaVisitor
{
public:
- DelegateVisitor(const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
+ DelegateVisitor(const std::string&, bool);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+
+ private:
+
+ bool _suppress;
};
class DelegateMVisitor : public JavaVisitor
{
public:
- DelegateMVisitor(const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
+ DelegateMVisitor(const std::string&, bool);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+
+ private:
+
+ bool _suppress;
};
class DelegateDVisitor : public JavaVisitor
{
public:
- DelegateDVisitor(const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
+ DelegateDVisitor(const std::string&, bool);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+
+ private:
+
+ bool _suppress;
};
class DispatcherVisitor : public JavaVisitor
{
public:
- DispatcherVisitor(const std::string&, bool);
+ DispatcherVisitor(const std::string&, bool, bool);
virtual bool visitClassDefStart(const ClassDefPtr&);
private:
bool _stream;
+
+ bool _suppress;
};
class BaseImplVisitor : public JavaVisitor
@@ -278,6 +310,8 @@
//
void writeReturn(::IceUtilInternal::Output&, const TypePtr&);
+ bool _suppress;
+
//
// Generate an operation.
//
@@ -306,13 +340,15 @@
{
public:
- AsyncVisitor(const std::string&);
+ AsyncVisitor(const std::string&, bool);
virtual void visitOperation(const OperationPtr&);
private:
static std::string initValue(const TypePtr&);
+
+ bool _suppress;
};
};
Modified: ice/branches/slice-translator-versioning/cpp/src/slice2java/Main.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-translator-versioning/cpp/src/slice2java/Main.cpp?view=diff&rev=656&r1=655&r2=656
==============================================================================
--- ice/branches/slice-translator-versioning/cpp/src/slice2java/Main.cpp (original)
+++ ice/branches/slice-translator-versioning/cpp/src/slice2java/Main.cpp Thu Jun 3 09:19:30 2010
@@ -78,6 +78,7 @@
"--checksum CLASS Generate checksums for Slice definitions into CLASS.\n"
"--stream Generate marshaling support for public stream API.\n"
"--meta META Define global metadata directive META.\n"
+ "--suppress Suppress tagged modules from being written.\n"
;
}
@@ -103,6 +104,7 @@
opts.addOpt("", "checksum", IceUtilInternal::Options::NeedArg);
opts.addOpt("", "stream");
opts.addOpt("", "meta", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat);
+ opts.addOpt("", "suppress");
vector<string>args;
try
@@ -174,6 +176,8 @@
StringList globalMetadata;
vector<string> v = opts.argVec("meta");
copy(v.begin(), v.end(), back_inserter(globalMetadata));
+
+ bool suppress = opts.isSet("suppress");
if(args.empty())
{
@@ -294,7 +298,7 @@
{
try
{
- Gen gen(argv[0], icecpp->getBaseName(), includePaths, output);
+ Gen gen(argv[0], icecpp->getBaseName(), includePaths, output, suppress);
gen.generate(p, stream);
if(tie)
{
More information about the asterisk-scf-commits
mailing list