summaryrefslogtreecommitdiff
path: root/cpp/src/slice2freezej/Main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2freezej/Main.cpp')
-rw-r--r--cpp/src/slice2freezej/Main.cpp1436
1 files changed, 718 insertions, 718 deletions
diff --git a/cpp/src/slice2freezej/Main.cpp b/cpp/src/slice2freezej/Main.cpp
index adf009ee4d6..bbca3691695 100644
--- a/cpp/src/slice2freezej/Main.cpp
+++ b/cpp/src/slice2freezej/Main.cpp
@@ -26,12 +26,12 @@ struct DictIndex
bool operator==(const DictIndex& rhs) const
{
- return member == rhs.member;
+ return member == rhs.member;
}
bool operator!=(const DictIndex& rhs) const
{
- return member != rhs.member;
+ return member != rhs.member;
}
};
@@ -82,49 +82,49 @@ FreezeGenerator::varToObject(const TypePtr& type, const string& param)
BuiltinPtr b = BuiltinPtr::dynamicCast(type);
if(b != 0)
{
- switch(b->kind())
- {
- case Builtin::KindByte:
- {
- result = string("new java.lang.Byte(") + param + ")";
- break;
- }
- case Builtin::KindBool:
- {
- result = string("new java.lang.Boolean(") + param + ")";
- break;
- }
- case Builtin::KindShort:
- {
- result = string("new java.lang.Short(") + param + ")";
- break;
- }
- case Builtin::KindInt:
- {
- result = string("new java.lang.Integer(") + param + ")";
- break;
- }
- case Builtin::KindLong:
- {
- result = string("new java.lang.Long(") + param + ")";
- break;
- }
- case Builtin::KindFloat:
- {
- result = string("new java.lang.Float(") + param + ")";
- break;
- }
- case Builtin::KindDouble:
- {
- result = string("new java.lang.Double(") + param + ")";
- break;
- }
- case Builtin::KindString:
- case Builtin::KindObject:
- case Builtin::KindObjectProxy:
- case Builtin::KindLocalObject:
- break;
- }
+ switch(b->kind())
+ {
+ case Builtin::KindByte:
+ {
+ result = string("new java.lang.Byte(") + param + ")";
+ break;
+ }
+ case Builtin::KindBool:
+ {
+ result = string("new java.lang.Boolean(") + param + ")";
+ break;
+ }
+ case Builtin::KindShort:
+ {
+ result = string("new java.lang.Short(") + param + ")";
+ break;
+ }
+ case Builtin::KindInt:
+ {
+ result = string("new java.lang.Integer(") + param + ")";
+ break;
+ }
+ case Builtin::KindLong:
+ {
+ result = string("new java.lang.Long(") + param + ")";
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ result = string("new java.lang.Float(") + param + ")";
+ break;
+ }
+ case Builtin::KindDouble:
+ {
+ result = string("new java.lang.Double(") + param + ")";
+ break;
+ }
+ case Builtin::KindString:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ break;
+ }
}
return result;
}
@@ -137,49 +137,49 @@ FreezeGenerator::objectToVar(const TypePtr& type, const string& param)
BuiltinPtr b = BuiltinPtr::dynamicCast(type);
if(b != 0)
{
- switch(b->kind())
- {
- case Builtin::KindByte:
- {
- result = string("((java.lang.Byte)") + param + ").byteValue()";
- break;
- }
- case Builtin::KindBool:
- {
- result = string("((java.lang.Boolean)") + param + ").booleanValue()";
- break;
- }
- case Builtin::KindShort:
- {
- result = string("((java.lang.Short)") + param + ").shortValue()";
- break;
- }
- case Builtin::KindInt:
- {
- result = string("((java.lang.Integer)") + param + ").intValue()";
- break;
- }
- case Builtin::KindLong:
- {
- result = string("((java.lang.Long)") + param + ").longValue()";
- break;
- }
- case Builtin::KindFloat:
- {
- result = string("((java.lang.Float)") + param + ").floatValue()";
- break;
- }
- case Builtin::KindDouble:
- {
- result = string("((java.lang.Double)") + param + ").doubleValue()";
- break;
- }
- case Builtin::KindString:
- case Builtin::KindObject:
- case Builtin::KindObjectProxy:
- case Builtin::KindLocalObject:
- break;
- }
+ switch(b->kind())
+ {
+ case Builtin::KindByte:
+ {
+ result = string("((java.lang.Byte)") + param + ").byteValue()";
+ break;
+ }
+ case Builtin::KindBool:
+ {
+ result = string("((java.lang.Boolean)") + param + ").booleanValue()";
+ break;
+ }
+ case Builtin::KindShort:
+ {
+ result = string("((java.lang.Short)") + param + ").shortValue()";
+ break;
+ }
+ case Builtin::KindInt:
+ {
+ result = string("((java.lang.Integer)") + param + ").intValue()";
+ break;
+ }
+ case Builtin::KindLong:
+ {
+ result = string("((java.lang.Long)") + param + ").longValue()";
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ result = string("((java.lang.Float)") + param + ").floatValue()";
+ break;
+ }
+ case Builtin::KindDouble:
+ {
+ result = string("((java.lang.Double)") + param + ").doubleValue()";
+ break;
+ }
+ case Builtin::KindString:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ break;
+ }
}
return result;
}
@@ -236,108 +236,108 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict)
for(i = 0; i < dict.indices.size(); ++i)
{
- const DictIndex& index = dict.indices[i];
- const string& member = index.member;
-
- if(index.member.empty())
- {
- if(dict.indices.size() > 1)
- {
- cerr << _prog << ": bad index for dictionary `" << dict.name << "'" << endl;
- return false;
- }
-
- if(!Dictionary::legalKeyType(valueType))
- {
- cerr << _prog << ": `" << dict.value << "' is not a valid index type" << endl;
- return false;
- }
-
- if(index.caseSensitive == false)
- {
- //
- // Let's check value is a string
- //
-
- BuiltinPtr builtInType = BuiltinPtr::dynamicCast(valueType);
-
- if(builtInType == 0 || builtInType->kind() != Builtin::KindString)
- {
- cerr << _prog << ": VALUE is a `" << dict.value << "', not a string " << endl;
- return false;
- }
- }
- indexTypes.push_back(valueType);
- capitalizedMembers.push_back("Value");
- indexNames.push_back("index");
- }
- else
- {
- DataMemberPtr dataMember = 0;
- DataMemberList dataMembers;
-
- ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(valueType);
- if(classDecl != 0)
- {
- dataMembers = classDecl->definition()->allDataMembers();
- }
- else
- {
- StructPtr structDecl = StructPtr::dynamicCast(valueType);
- if(structDecl == 0)
- {
- cerr << _prog << ": `" << dict.value << "' is neither a class nor a struct." << endl;
- return false;
- }
- dataMembers = structDecl->dataMembers();
- }
- DataMemberList::const_iterator q = dataMembers.begin();
- while(q != dataMembers.end() && dataMember == 0)
- {
- if((*q)->name() == index.member)
- {
- dataMember = *q;
- }
- else
- {
- ++q;
- }
- }
-
- if(dataMember == 0)
- {
- cerr << _prog << ": The value of `" << dict.name
- << "' has no data member named `" << index.member << "'" << endl;
- return false;
- }
-
- TypePtr dataMemberType = dataMember->type();
-
- if(!Dictionary::legalKeyType(dataMemberType))
- {
- cerr << _prog << ": `" << index.member << "' cannot be used as an index" << endl;
- return false;
- }
-
- if(index.caseSensitive == false)
- {
- //
- // Let's check member is a string
- //
- BuiltinPtr memberType = BuiltinPtr::dynamicCast(dataMemberType);
- if(memberType == 0 || memberType->kind() != Builtin::KindString)
- {
- cerr << _prog << ": `" << index.member << "' is not a string " << endl;
- return false;
- }
- }
- indexTypes.push_back(dataMemberType);
-
- string capitalizedMember = member;
- capitalizedMember[0] = toupper(capitalizedMember[0]);
- capitalizedMembers.push_back(capitalizedMember);
- indexNames.push_back(member);
- }
+ const DictIndex& index = dict.indices[i];
+ const string& member = index.member;
+
+ if(index.member.empty())
+ {
+ if(dict.indices.size() > 1)
+ {
+ cerr << _prog << ": bad index for dictionary `" << dict.name << "'" << endl;
+ return false;
+ }
+
+ if(!Dictionary::legalKeyType(valueType))
+ {
+ cerr << _prog << ": `" << dict.value << "' is not a valid index type" << endl;
+ return false;
+ }
+
+ if(index.caseSensitive == false)
+ {
+ //
+ // Let's check value is a string
+ //
+
+ BuiltinPtr builtInType = BuiltinPtr::dynamicCast(valueType);
+
+ if(builtInType == 0 || builtInType->kind() != Builtin::KindString)
+ {
+ cerr << _prog << ": VALUE is a `" << dict.value << "', not a string " << endl;
+ return false;
+ }
+ }
+ indexTypes.push_back(valueType);
+ capitalizedMembers.push_back("Value");
+ indexNames.push_back("index");
+ }
+ else
+ {
+ DataMemberPtr dataMember = 0;
+ DataMemberList dataMembers;
+
+ ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(valueType);
+ if(classDecl != 0)
+ {
+ dataMembers = classDecl->definition()->allDataMembers();
+ }
+ else
+ {
+ StructPtr structDecl = StructPtr::dynamicCast(valueType);
+ if(structDecl == 0)
+ {
+ cerr << _prog << ": `" << dict.value << "' is neither a class nor a struct." << endl;
+ return false;
+ }
+ dataMembers = structDecl->dataMembers();
+ }
+ DataMemberList::const_iterator q = dataMembers.begin();
+ while(q != dataMembers.end() && dataMember == 0)
+ {
+ if((*q)->name() == index.member)
+ {
+ dataMember = *q;
+ }
+ else
+ {
+ ++q;
+ }
+ }
+
+ if(dataMember == 0)
+ {
+ cerr << _prog << ": The value of `" << dict.name
+ << "' has no data member named `" << index.member << "'" << endl;
+ return false;
+ }
+
+ TypePtr dataMemberType = dataMember->type();
+
+ if(!Dictionary::legalKeyType(dataMemberType))
+ {
+ cerr << _prog << ": `" << index.member << "' cannot be used as an index" << endl;
+ return false;
+ }
+
+ if(index.caseSensitive == false)
+ {
+ //
+ // Let's check member is a string
+ //
+ BuiltinPtr memberType = BuiltinPtr::dynamicCast(dataMemberType);
+ if(memberType == 0 || memberType->kind() != Builtin::KindString)
+ {
+ cerr << _prog << ": `" << index.member << "' is not a string " << endl;
+ return false;
+ }
+ }
+ indexTypes.push_back(dataMemberType);
+
+ string capitalizedMember = member;
+ capitalizedMember[0] = toupper(capitalizedMember[0]);
+ capitalizedMembers.push_back(capitalizedMember);
+ indexNames.push_back(member);
+ }
}
@@ -357,46 +357,46 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict)
//
if(dict.indices.size() > 0)
{
- out << sp << nl << "public" << nl << name
- << "(Freeze.Connection __connection, String __dbName, boolean __createDb, "
- << "java.util.Comparator __comparator, java.util.Map __indexComparators)";
- out << sb;
-
- out << nl << "super(__connection, __dbName, __comparator);";
- out << nl << "_indices = new Freeze.Map.Index[" << dict.indices.size() << "];";
- for(i = 0; i < dict.indices.size(); ++i)
- {
- out << nl << "_indices[" << i << "] = new " << capitalizedMembers[i]
- << "Index(\"" << indexNames[i] << "\");";
- }
- out << nl << "init(_indices, __dbName, \"" << keyType->typeId() << "\", \""
- << valueType->typeId() << "\", __createDb, __indexComparators);";
- out << eb;
+ out << sp << nl << "public" << nl << name
+ << "(Freeze.Connection __connection, String __dbName, boolean __createDb, "
+ << "java.util.Comparator __comparator, java.util.Map __indexComparators)";
+ out << sb;
+
+ out << nl << "super(__connection, __dbName, __comparator);";
+ out << nl << "_indices = new Freeze.Map.Index[" << dict.indices.size() << "];";
+ for(i = 0; i < dict.indices.size(); ++i)
+ {
+ out << nl << "_indices[" << i << "] = new " << capitalizedMembers[i]
+ << "Index(\"" << indexNames[i] << "\");";
+ }
+ out << nl << "init(_indices, __dbName, \"" << keyType->typeId() << "\", \""
+ << valueType->typeId() << "\", __createDb, __indexComparators);";
+ out << eb;
}
out << sp << nl << "public" << nl << name
- << "(Freeze.Connection __connection, String __dbName, boolean __createDb, "
- << "java.util.Comparator __comparator)";
+ << "(Freeze.Connection __connection, String __dbName, boolean __createDb, "
+ << "java.util.Comparator __comparator)";
out << sb;
if(dict.indices.size() > 0)
{
- out << nl << "this(__connection, __dbName, __createDb, __comparator, null);";
+ out << nl << "this(__connection, __dbName, __createDb, __comparator, null);";
}
else
{
- out << nl << "super(__connection, __dbName, \"" << keyType->typeId() << "\", \""
- << valueType->typeId() << "\", __createDb, __comparator);";
+ out << nl << "super(__connection, __dbName, \"" << keyType->typeId() << "\", \""
+ << valueType->typeId() << "\", __createDb, __comparator);";
}
out << eb;
out << sp << nl << "public" << nl << name
- << "(Freeze.Connection __connection, String __dbName, boolean __createDb)";
+ << "(Freeze.Connection __connection, String __dbName, boolean __createDb)";
out << sb;
out << nl << "this(__connection, __dbName, __createDb, null);";
out << eb;
out << sp << nl << "public" << nl << name
- << "(Freeze.Connection __connection, String __dbName)";
+ << "(Freeze.Connection __connection, String __dbName)";
out << sb;
out << nl << "this(__connection, __dbName, true);";
out << eb;
@@ -406,33 +406,33 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict)
//
for(i = 0; i < capitalizedMembers.size(); ++i)
{
- string indexClassName = capitalizedMembers[i] + "Index";
-
- out << sp << nl << "public Freeze.Map.EntryIterator";
- out << nl << "findBy" << capitalizedMembers[i] << "("
- << typeToString(indexTypes[i], TypeModeIn) << " __index, boolean __onlyDups)";
- out << sb;
- out << nl << "return _indices[" << i << "].untypedFind("
- << varToObject(indexTypes[i], "__index") << ", __onlyDups);";
- out << eb;
-
- out << sp << nl << "public Freeze.Map.EntryIterator";
- out << nl << "findBy" << capitalizedMembers[i] << "("
- << typeToString(indexTypes[i], TypeModeIn) << " __index)";
- out << sb;
- out << nl << "return _indices[" << i << "].untypedFind("
- << varToObject(indexTypes[i], "__index") << ", true);";
- out << eb;
-
- string countMethod = dict.indices[i].member.empty() ?
- string("valueCount") : dict.indices[i].member + "Count";
- out << sp << nl << "public int";
- out << nl << countMethod << "("
- << typeToString(indexTypes[i], TypeModeIn) << " __index)";
- out << sb;
- out << nl << "return _indices[" << i << "].untypedCount("
- << varToObject(indexTypes[i], "__index") << ");";
- out << eb;
+ string indexClassName = capitalizedMembers[i] + "Index";
+
+ out << sp << nl << "public Freeze.Map.EntryIterator";
+ out << nl << "findBy" << capitalizedMembers[i] << "("
+ << typeToString(indexTypes[i], TypeModeIn) << " __index, boolean __onlyDups)";
+ out << sb;
+ out << nl << "return _indices[" << i << "].untypedFind("
+ << varToObject(indexTypes[i], "__index") << ", __onlyDups);";
+ out << eb;
+
+ out << sp << nl << "public Freeze.Map.EntryIterator";
+ out << nl << "findBy" << capitalizedMembers[i] << "("
+ << typeToString(indexTypes[i], TypeModeIn) << " __index)";
+ out << sb;
+ out << nl << "return _indices[" << i << "].untypedFind("
+ << varToObject(indexTypes[i], "__index") << ", true);";
+ out << eb;
+
+ string countMethod = dict.indices[i].member.empty() ?
+ string("valueCount") : dict.indices[i].member + "Count";
+ out << sp << nl << "public int";
+ out << nl << countMethod << "("
+ << typeToString(indexTypes[i], TypeModeIn) << " __index)";
+ out << sb;
+ out << nl << "return _indices[" << i << "].untypedCount("
+ << varToObject(indexTypes[i], "__index") << ");";
+ out << eb;
}
//
@@ -460,18 +460,18 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict)
encaps = true;
}
- string valS = objectToVar(type, "o");
- string typeS;
+ string valS = objectToVar(type, "o");
+ string typeS;
BuiltinPtr b = BuiltinPtr::dynamicCast(type);
if(b != 0)
{
typeS = builtinTable[b->kind()];
- }
- else
- {
- typeS = typeToString(type, TypeModeIn);
- }
+ }
+ else
+ {
+ typeS = typeToString(type, TypeModeIn);
+ }
int iter;
@@ -614,213 +614,213 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict)
//
for(i = 0; i < capitalizedMembers.size(); ++i)
{
- string indexClassName = capitalizedMembers[i] + "Index";
- out << sp << nl << "private class " << indexClassName << " extends Freeze.Map.Index";
- out << sb;
-
- //
- // encodeKey
- //
- out << sp << nl << "public byte[]";
- out << nl << "encodeKey(Object key, Ice.Communicator communicator)";
- out << sb;
- if(dict.indices[i].member.empty())
- {
- //
- // Encode the full value (with an encaps!)
- //
- string keyS = "key";
- if(!dict.indices[i].caseSensitive)
- {
- keyS = "((String)key).toLowerCase()";
- }
-
- out << nl << "return encodeValue(" << keyS << ", communicator);";
- }
- else
- {
- //
- // No encaps
- //
- string keyS = dict.indices[i].caseSensitive ?
- "key" : "((String)key).toLowerCase()";
-
- keyS = objectToVar(indexTypes[i], keyS);
-
- out << nl << "IceInternal.BasicStream __os = "
- << "new IceInternal.BasicStream(Ice.Util.getInstance(communicator));";
- int iter = 0;
- writeMarshalUnmarshalCode(out, "", indexTypes[i], keyS, true, iter, false);
- assert(!indexTypes[i]->usesClasses());
-
- out << nl << "java.nio.ByteBuffer buf = __os.prepareWrite();";
- out << nl << "byte[] r = new byte[buf.limit()];";
- out << nl << "buf.get(r);";
- out << nl << "return r;";
- }
- out << eb;
-
- //
- // decodekey
- //
- out << sp << nl << "public Object";
- out << nl << "decodeKey(byte[] bytes, Ice.Communicator communicator)";
- out << sb;
- if(dict.indices[i].member.empty())
- {
- //
- // Decode the full value (with an encaps!)
- //
- out << nl << "return decodeValue(bytes, communicator);";
- }
- else
- {
- out << nl << "IceInternal.BasicStream __is = new IceInternal.BasicStream(Ice.Util.getInstance(communicator));";
- out << nl << "__is.resize(bytes.length, true);";
- out << nl << "java.nio.ByteBuffer buf = __is.prepareRead();";
- out << nl << "buf.position(0);";
- out << nl << "buf.put(bytes);";
- out << nl << "buf.position(0);";
-
- int iter = 0;
- list<string> metaData;
- string patchParams;
-
- string typeS;
- BuiltinPtr b = BuiltinPtr::dynamicCast(indexTypes[i]);
- if(b != 0)
- {
- typeS = builtinTable[b->kind()];
- }
- else
- {
- typeS = typeToString(indexTypes[i], TypeModeIn);
- }
+ string indexClassName = capitalizedMembers[i] + "Index";
+ out << sp << nl << "private class " << indexClassName << " extends Freeze.Map.Index";
+ out << sb;
+
+ //
+ // encodeKey
+ //
+ out << sp << nl << "public byte[]";
+ out << nl << "encodeKey(Object key, Ice.Communicator communicator)";
+ out << sb;
+ if(dict.indices[i].member.empty())
+ {
+ //
+ // Encode the full value (with an encaps!)
+ //
+ string keyS = "key";
+ if(!dict.indices[i].caseSensitive)
+ {
+ keyS = "((String)key).toLowerCase()";
+ }
+
+ out << nl << "return encodeValue(" << keyS << ", communicator);";
+ }
+ else
+ {
+ //
+ // No encaps
+ //
+ string keyS = dict.indices[i].caseSensitive ?
+ "key" : "((String)key).toLowerCase()";
+
+ keyS = objectToVar(indexTypes[i], keyS);
+
+ out << nl << "IceInternal.BasicStream __os = "
+ << "new IceInternal.BasicStream(Ice.Util.getInstance(communicator));";
+ int iter = 0;
+ writeMarshalUnmarshalCode(out, "", indexTypes[i], keyS, true, iter, false);
+ assert(!indexTypes[i]->usesClasses());
+
+ out << nl << "java.nio.ByteBuffer buf = __os.prepareWrite();";
+ out << nl << "byte[] r = new byte[buf.limit()];";
+ out << nl << "buf.get(r);";
+ out << nl << "return r;";
+ }
+ out << eb;
+
+ //
+ // decodekey
+ //
+ out << sp << nl << "public Object";
+ out << nl << "decodeKey(byte[] bytes, Ice.Communicator communicator)";
+ out << sb;
+ if(dict.indices[i].member.empty())
+ {
+ //
+ // Decode the full value (with an encaps!)
+ //
+ out << nl << "return decodeValue(bytes, communicator);";
+ }
+ else
+ {
+ out << nl << "IceInternal.BasicStream __is = new IceInternal.BasicStream(Ice.Util.getInstance(communicator));";
+ out << nl << "__is.resize(bytes.length, true);";
+ out << nl << "java.nio.ByteBuffer buf = __is.prepareRead();";
+ out << nl << "buf.position(0);";
+ out << nl << "buf.put(bytes);";
+ out << nl << "buf.position(0);";
+
+ int iter = 0;
+ list<string> metaData;
+ string patchParams;
+
+ string typeS;
+ BuiltinPtr b = BuiltinPtr::dynamicCast(indexTypes[i]);
+ if(b != 0)
+ {
+ typeS = builtinTable[b->kind()];
+ }
+ else
+ {
+ typeS = typeToString(indexTypes[i], TypeModeIn);
+ }
out << nl << typeS << " r;";
-
- if(b != 0)
- {
- switch(b->kind())
- {
- case Builtin::KindByte:
- {
- out << nl << "r = new java.lang.Byte(__is.readByte());";
- break;
- }
- case Builtin::KindBool:
- {
- out << nl << "r = new java.lang.Boolean(__is.readBool());";
- break;
- }
- case Builtin::KindShort:
- {
- out << nl << "r = new java.lang.Short(__is.readShort());";
- break;
- }
- case Builtin::KindInt:
- {
- out << nl << "r = new java.lang.Integer(__is.readInt());";
- break;
- }
- case Builtin::KindLong:
- {
- out << nl << "r = new java.lang.Long(__is.readLong());";
- break;
- }
- case Builtin::KindFloat:
- {
- out << nl << "r = new java.lang.Float(__is.readFloat());";
- break;
- }
- case Builtin::KindDouble:
- {
- out << nl << "r = new java.lang.Double(__is.readDouble());";
- break;
- }
- case Builtin::KindString:
- case Builtin::KindObject:
- case Builtin::KindObjectProxy:
- case Builtin::KindLocalObject:
- {
- writeMarshalUnmarshalCode(out, "", indexTypes[i], "r", false, iter, false, metaData, patchParams);
- break;
- }
- }
- }
- else
- {
- writeMarshalUnmarshalCode(out, "", indexTypes[i], "r", false, iter, false, metaData, patchParams);
- }
+
+ if(b != 0)
+ {
+ switch(b->kind())
+ {
+ case Builtin::KindByte:
+ {
+ out << nl << "r = new java.lang.Byte(__is.readByte());";
+ break;
+ }
+ case Builtin::KindBool:
+ {
+ out << nl << "r = new java.lang.Boolean(__is.readBool());";
+ break;
+ }
+ case Builtin::KindShort:
+ {
+ out << nl << "r = new java.lang.Short(__is.readShort());";
+ break;
+ }
+ case Builtin::KindInt:
+ {
+ out << nl << "r = new java.lang.Integer(__is.readInt());";
+ break;
+ }
+ case Builtin::KindLong:
+ {
+ out << nl << "r = new java.lang.Long(__is.readLong());";
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ out << nl << "r = new java.lang.Float(__is.readFloat());";
+ break;
+ }
+ case Builtin::KindDouble:
+ {
+ out << nl << "r = new java.lang.Double(__is.readDouble());";
+ break;
+ }
+ case Builtin::KindString:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ {
+ writeMarshalUnmarshalCode(out, "", indexTypes[i], "r", false, iter, false, metaData, patchParams);
+ break;
+ }
+ }
+ }
+ else
+ {
+ writeMarshalUnmarshalCode(out, "", indexTypes[i], "r", false, iter, false, metaData, patchParams);
+ }
out << nl << "return r;";
}
out << eb;
- //
- // compare
- //
- out << sp << nl << "public int";
- out << nl << "compare(Object o1, Object o2)";
- out << sb;
- out << nl << "assert _comparator != null;";
- out << nl << "byte[] d1 = (byte[])o1;";
- out << nl << "byte[] d2 = (byte[])o2;";
- out << nl << "Ice.Communicator communicator = ((Freeze.Connection)_connection).getCommunicator();";
- out << nl << "return _comparator.compare(";
- out.inc();
- out << nl << "decodeKey(d1, communicator),";
- out << nl << "decodeKey(d2, communicator));";
- out.dec();
- out << eb;
-
- //
- // extractKey from value
- //
- out << sp << nl << "public Object";
- out << nl << "extractKey(Object value)";
- out << sb;
- if(dict.indices[i].member.empty())
- {
- if(dict.indices[i].caseSensitive)
- {
- out << nl << "return value;";
- }
- else
- {
- out << nl << "return value.toLowerCase();";
- }
- }
- else
- {
- out << nl << typeToString(valueType, TypeModeIn)
- << " typedValue = ("
- << typeToString(valueType, TypeModeIn) << ")value;";
-
- string member = string("typedValue.") + dict.indices[i].member;
- if(!dict.indices[i].caseSensitive)
- {
- member += ".toLowerCase()";
- }
- out << nl << "return " << varToObject(indexTypes[i], member) << ";";
- }
- out << eb;
-
- //
- // marshalKey optimization
- //
- if(dict.indices[i].member.empty() && dict.indices[i].caseSensitive)
- {
- out << sp << nl << "protected byte[]";
- out << nl << "marshalKey(byte[] value)";
- out << sb;
- out << nl << "return value;";
- out << eb;
- }
-
- out << sp << nl << "private " << indexClassName << "(String name)";
- out << sb;
- out << nl << "super(name);";
- out << eb;
- out << eb;
+ //
+ // compare
+ //
+ out << sp << nl << "public int";
+ out << nl << "compare(Object o1, Object o2)";
+ out << sb;
+ out << nl << "assert _comparator != null;";
+ out << nl << "byte[] d1 = (byte[])o1;";
+ out << nl << "byte[] d2 = (byte[])o2;";
+ out << nl << "Ice.Communicator communicator = ((Freeze.Connection)_connection).getCommunicator();";
+ out << nl << "return _comparator.compare(";
+ out.inc();
+ out << nl << "decodeKey(d1, communicator),";
+ out << nl << "decodeKey(d2, communicator));";
+ out.dec();
+ out << eb;
+
+ //
+ // extractKey from value
+ //
+ out << sp << nl << "public Object";
+ out << nl << "extractKey(Object value)";
+ out << sb;
+ if(dict.indices[i].member.empty())
+ {
+ if(dict.indices[i].caseSensitive)
+ {
+ out << nl << "return value;";
+ }
+ else
+ {
+ out << nl << "return value.toLowerCase();";
+ }
+ }
+ else
+ {
+ out << nl << typeToString(valueType, TypeModeIn)
+ << " typedValue = ("
+ << typeToString(valueType, TypeModeIn) << ")value;";
+
+ string member = string("typedValue.") + dict.indices[i].member;
+ if(!dict.indices[i].caseSensitive)
+ {
+ member += ".toLowerCase()";
+ }
+ out << nl << "return " << varToObject(indexTypes[i], member) << ";";
+ }
+ out << eb;
+
+ //
+ // marshalKey optimization
+ //
+ if(dict.indices[i].member.empty() && dict.indices[i].caseSensitive)
+ {
+ out << sp << nl << "protected byte[]";
+ out << nl << "marshalKey(byte[] value)";
+ out << sb;
+ out << nl << "return value;";
+ out << eb;
+ }
+
+ out << sp << nl << "private " << indexClassName << "(String name)";
+ out << sb;
+ out << nl << "super(name);";
+ out << eb;
+ out << eb;
}
//
@@ -897,7 +897,7 @@ FreezeGenerator::generate(UnitPtr& u, const Index& index)
ClassDeclPtr classDecl = ClassDeclPtr::dynamicCast(type);
if(classDecl == 0)
{
- cerr << _prog << ": `" << index.type << "' is not a class" << endl;
+ cerr << _prog << ": `" << index.type << "' is not a class" << endl;
return false;
}
@@ -906,33 +906,33 @@ FreezeGenerator::generate(UnitPtr& u, const Index& index)
DataMemberList::const_iterator p = dataMembers.begin();
while(p != dataMembers.end() && dataMember == 0)
{
- if((*p)->name() == index.member)
- {
- dataMember = *p;
- }
- else
- {
- ++p;
- }
+ if((*p)->name() == index.member)
+ {
+ dataMember = *p;
+ }
+ else
+ {
+ ++p;
+ }
}
if(dataMember == 0)
{
- cerr << _prog << ": `" << index.type << "' has no data member named `" << index.member << "'" << endl;
+ cerr << _prog << ": `" << index.type << "' has no data member named `" << index.member << "'" << endl;
return false;
}
if(index.caseSensitive == false)
{
- //
- // Let's check member is a string
- //
- BuiltinPtr memberType = BuiltinPtr::dynamicCast(dataMember->type());
- if(memberType == 0 || memberType->kind() != Builtin::KindString)
- {
- cerr << _prog << ": `" << index.member << "'is not a string " << endl;
- return false;
- }
+ //
+ // Let's check member is a string
+ //
+ BuiltinPtr memberType = BuiltinPtr::dynamicCast(dataMember->type());
+ if(memberType == 0 || memberType->kind() != Builtin::KindString)
+ {
+ cerr << _prog << ": `" << index.member << "'is not a string " << endl;
+ return false;
+ }
}
string memberTypeString = typeToString(dataMember->type(), TypeModeIn);
@@ -965,19 +965,19 @@ FreezeGenerator::generate(UnitPtr& u, const Index& index)
// find and count
//
out << sp << nl << "public Ice.Identity[]" << nl
- << "findFirst(" << memberTypeString << " __index, int __firstN)";
+ << "findFirst(" << memberTypeString << " __index, int __firstN)";
out << sb;
out << nl << "return untypedFindFirst(marshalKey(__index), __firstN);";
out << eb;
out << sp << nl << "public Ice.Identity[]" << nl
- << "find(" << memberTypeString << " __index)";
+ << "find(" << memberTypeString << " __index)";
out << sb;
out << nl << "return untypedFind(marshalKey(__index));";
out << eb;
out << sp << nl << "public int" << nl
- << "count(" << memberTypeString << " __index)";
+ << "count(" << memberTypeString << " __index)";
out << sb;
out << nl << "return untypedCount(marshalKey(__index));";
out << eb;
@@ -988,7 +988,7 @@ FreezeGenerator::generate(UnitPtr& u, const Index& index)
string typeString = typeToString(type, TypeModeIn);
out << sp << nl << "protected byte[]" << nl
- << "marshalKey(Ice.Object __servant)";
+ << "marshalKey(Ice.Object __servant)";
out << sb;
out << nl << "if(__servant instanceof " << typeString << ")";
out << sb;
@@ -1004,15 +1004,15 @@ FreezeGenerator::generate(UnitPtr& u, const Index& index)
string valueS = index.caseSensitive ? "__key" : "__key.toLowerCase()";
out << sp << nl << "private byte[]" << nl
- << "marshalKey(" << memberTypeString << " __key)";
+ << "marshalKey(" << memberTypeString << " __key)";
out << sb;
out << nl << "IceInternal.BasicStream __os = "
- << "new IceInternal.BasicStream(Ice.Util.getInstance(communicator()));";
+ << "new IceInternal.BasicStream(Ice.Util.getInstance(communicator()));";
int iter = 0;
writeMarshalUnmarshalCode(out, "", dataMember->type(), valueS, true, iter, false);
if(type->usesClasses())
{
- out << nl << "__os.writePendingObjects();";
+ out << nl << "__os.writePendingObjects();";
}
out << nl << "java.nio.ByteBuffer __buf = __os.prepareWrite();";
out << nl << "byte[] __r = new byte[__buf.limit()];";
@@ -1040,29 +1040,29 @@ usage(const char* n)
"-DNAME=DEF Define NAME as DEF.\n"
"-UNAME Remove any definition for NAME.\n"
"-IDIR Put DIR in the include file search path.\n"
- "-E Print preprocessor output on stdout.\n"
+ "-E Print preprocessor output on stdout.\n"
"--include-dir DIR Use DIR as the header include directory.\n"
"--dict NAME,KEY,VALUE Create a Freeze dictionary with the name NAME,\n"
" using KEY as key, and VALUE as value. This\n"
" option may be specified multiple times for\n"
" different names. NAME may be a scoped name.\n"
- "--index NAME,TYPE,MEMBER[,{case-sensitive|case-insensitive}]\n"
+ "--index NAME,TYPE,MEMBER[,{case-sensitive|case-insensitive}]\n"
" Create a Freeze evictor index with the name\n"
" NAME for member MEMBER of class TYPE. This\n"
" option may be specified multiple times for\n"
" different names. NAME may be a scoped name.\n"
" When member is a string, the case can be\n"
" sensitive or insensitive (default is sensitive).\n"
- "--dict-index DICT[,MEMBER][,{case-sensitive|case-insensitive}] \n"
- " Add an index to dictionary DICT. If MEMBER is \n"
+ "--dict-index DICT[,MEMBER][,{case-sensitive|case-insensitive}] \n"
+ " Add an index to dictionary DICT. If MEMBER is \n"
" specified, then DICT's VALUE must be a class or\n"
- " a struct, and MEMBER must designate a member of\n"
- " VALUE. Otherwise, the entire VALUE is used for \n"
- " indexing. When the secondary key is a string, \n"
- " the case can be sensitive or insensitive (default\n"
- " is sensitive).\n"
+ " a struct, and MEMBER must designate a member of\n"
+ " VALUE. Otherwise, the entire VALUE is used for \n"
+ " indexing. When the secondary key is a string, \n"
+ " the case can be sensitive or insensitive (default\n"
+ " is sensitive).\n"
"--output-dir DIR Create files in the directory DIR.\n"
- "--depend Generate Makefile dependencies.\n"
+ "--depend Generate Makefile dependencies.\n"
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
"--meta META Define global metadata directive META.\n"
@@ -1098,21 +1098,21 @@ main(int argc, char* argv[])
}
catch(const IceUtil::BadOptException& e)
{
- cerr << argv[0] << ": " << e.reason << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
+ cerr << argv[0] << ": " << e.reason << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
if(opts.isSet("help"))
{
- usage(argv[0]);
- return EXIT_SUCCESS;
+ usage(argv[0]);
+ return EXIT_SUCCESS;
}
if(opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
- return EXIT_SUCCESS;
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
}
string cppArgs;
@@ -1120,19 +1120,19 @@ main(int argc, char* argv[])
vector<string>::const_iterator i;
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -D" + Preprocessor::addQuotes(*i);
+ cppArgs += " -D" + Preprocessor::addQuotes(*i);
}
optargs = opts.argVec("U");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- cppArgs += " -U" + Preprocessor::addQuotes(*i);
+ cppArgs += " -U" + Preprocessor::addQuotes(*i);
}
vector<string> includePaths = opts.argVec("I");
for(i = includePaths.begin(); i != includePaths.end(); ++i)
{
- cppArgs += " -I" + Preprocessor::addQuotes(*i);
+ cppArgs += " -I" + Preprocessor::addQuotes(*i);
}
bool preprocess = opts.isSet("E");
@@ -1143,199 +1143,199 @@ main(int argc, char* argv[])
optargs = opts.argVec("dict");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- string s = *i;
- s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
-
- Dict dict;
-
- string::size_type pos;
- pos = s.find(',');
- if(pos != string::npos)
- {
- dict.name = s.substr(0, pos);
- s.erase(0, pos + 1);
- }
- pos = s.find(',');
- if(pos != string::npos)
- {
- dict.key = s.substr(0, pos);
- s.erase(0, pos + 1);
- }
- dict.value = s;
-
- if(dict.name.empty())
- {
- cerr << argv[0] << ": " << *i << ": no name specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(dict.key.empty())
- {
- cerr << argv[0] << ": " << *i << ": no key specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(dict.value.empty())
- {
- cerr << argv[0] << ": " << *i << ": no value specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- dicts.push_back(dict);
+ string s = *i;
+ s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
+
+ Dict dict;
+
+ string::size_type pos;
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ dict.name = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ }
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ dict.key = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ }
+ dict.value = s;
+
+ if(dict.name.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no name specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(dict.key.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no key specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(dict.value.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no value specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ dicts.push_back(dict);
}
vector<Index> indices;
optargs = opts.argVec("index");
for(i = optargs.begin(); i != optargs.end(); ++i)
{
- string s = *i;
- s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
-
- Index index;
-
- string::size_type pos;
- pos = s.find(',');
- if(pos != string::npos)
- {
- index.name = s.substr(0, pos);
- s.erase(0, pos + 1);
- }
- pos = s.find(',');
- if(pos != string::npos)
- {
- index.type = s.substr(0, pos);
- s.erase(0, pos + 1);
- }
- pos = s.find(',');
- string caseString;
- if(pos != string::npos)
- {
- index.member = s.substr(0, pos);
- s.erase(0, pos + 1);
- caseString = s;
- }
- else
- {
- index.member = s;
- caseString = "case-sensitive";
- }
-
- if(index.name.empty())
- {
- cerr << argv[0] << ": " << *i << ": no name specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(index.type.empty())
- {
- cerr << argv[0] << ": " << *i << ": no type specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(index.member.empty())
- {
- cerr << argv[0] << ": " << *i << ": no member specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(caseString != "case-sensitive" && caseString != "case-insensitive")
- {
- cerr << argv[0] << ": " << *i << ": the case can be `case-sensitive' or `case-insensitive'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- index.caseSensitive = (caseString == "case-sensitive");
-
- indices.push_back(index);
+ string s = *i;
+ s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
+
+ Index index;
+
+ string::size_type pos;
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ index.name = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ }
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ index.type = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ }
+ pos = s.find(',');
+ string caseString;
+ if(pos != string::npos)
+ {
+ index.member = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ caseString = s;
+ }
+ else
+ {
+ index.member = s;
+ caseString = "case-sensitive";
+ }
+
+ if(index.name.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no name specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(index.type.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no type specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(index.member.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no member specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(caseString != "case-sensitive" && caseString != "case-insensitive")
+ {
+ cerr << argv[0] << ": " << *i << ": the case can be `case-sensitive' or `case-insensitive'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ index.caseSensitive = (caseString == "case-sensitive");
+
+ indices.push_back(index);
}
if(opts.isSet("dict-index"))
{
- vector<string> optargs = opts.argVec("dict-index");
- for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
- {
- string s = *i;
- s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
-
- string dictName;
- DictIndex index;
- string::size_type pos;
-
- string caseString = "case-sensitive";
- pos = s.find(',');
- if(pos != string::npos)
- {
- dictName = s.substr(0, pos);
- s.erase(0, pos + 1);
-
- pos = s.find(',');
- if(pos != string::npos)
- {
- index.member = s.substr(0, pos);
- s.erase(0, pos + 1);
- caseString = s;
- }
- else
- {
- if(s == "case-sensitive" || s == "case-insensitive")
- {
- caseString = s;
- }
- else
- {
- index.member = s;
- }
- }
- }
- else
- {
- dictName = s;
- }
-
- if(dictName.empty())
- {
- cerr << argv[0] << ": " << *i << ": no dictionary specified" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
-
- if(caseString != "case-sensitive" && caseString != "case-insensitive")
- {
- cerr << argv[0] << ": " << *i << ": the case can be `case-sensitive' or `case-insensitive'" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- index.caseSensitive = (caseString == "case-sensitive");
-
- bool found = false;
- for(vector<Dict>::iterator p = dicts.begin(); p != dicts.end(); ++p)
- {
- if(p->name == dictName)
- {
- if(find(p->indices.begin(), p->indices.end(), index) != p->indices.end())
- {
- cerr << argv[0] << ": --dict-index " << *i << ": this dict-index is defined twice" << endl;
- return EXIT_FAILURE;
- }
-
- p->indices.push_back(index);
- found = true;
- break;
- }
- }
- if(!found)
- {
- cerr << argv[0] << ": " << *i << ": unknown dictionary" << endl;
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- }
+ vector<string> optargs = opts.argVec("dict-index");
+ for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i)
+ {
+ string s = *i;
+ s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
+
+ string dictName;
+ DictIndex index;
+ string::size_type pos;
+
+ string caseString = "case-sensitive";
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ dictName = s.substr(0, pos);
+ s.erase(0, pos + 1);
+
+ pos = s.find(',');
+ if(pos != string::npos)
+ {
+ index.member = s.substr(0, pos);
+ s.erase(0, pos + 1);
+ caseString = s;
+ }
+ else
+ {
+ if(s == "case-sensitive" || s == "case-insensitive")
+ {
+ caseString = s;
+ }
+ else
+ {
+ index.member = s;
+ }
+ }
+ }
+ else
+ {
+ dictName = s;
+ }
+
+ if(dictName.empty())
+ {
+ cerr << argv[0] << ": " << *i << ": no dictionary specified" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ if(caseString != "case-sensitive" && caseString != "case-insensitive")
+ {
+ cerr << argv[0] << ": " << *i << ": the case can be `case-sensitive' or `case-insensitive'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ index.caseSensitive = (caseString == "case-sensitive");
+
+ bool found = false;
+ for(vector<Dict>::iterator p = dicts.begin(); p != dicts.end(); ++p)
+ {
+ if(p->name == dictName)
+ {
+ if(find(p->indices.begin(), p->indices.end(), index) != p->indices.end())
+ {
+ cerr << argv[0] << ": --dict-index " << *i << ": this dict-index is defined twice" << endl;
+ return EXIT_FAILURE;
+ }
+
+ p->indices.push_back(index);
+ found = true;
+ break;
+ }
+ }
+ if(!found)
+ {
+ cerr << argv[0] << ": " << *i << ": unknown dictionary" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ }
}
string output = opts.optArg("output-dir");
@@ -1365,51 +1365,51 @@ main(int argc, char* argv[])
for(vector<string>::size_type idx = 0; idx < args.size(); ++idx)
{
- if(depend)
- {
- Preprocessor icecpp(argv[0], args[idx], cppArgs);
- icecpp.printMakefileDependencies(Preprocessor::Java);
- }
- else
- {
- Preprocessor icecpp(argv[0], args[idx], cppArgs);
- FILE* cppHandle = icecpp.preprocess(false);
-
- if(cppHandle == 0)
- {
- u->destroy();
- return EXIT_FAILURE;
- }
-
- if(preprocess)
- {
- char buf[4096];
- while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
- {
- if(fputs(buf, stdout) == EOF)
- {
- u->destroy();
- return EXIT_FAILURE;
- }
- }
- }
- else
- {
- status = u->parse(cppHandle, debug);
- }
-
- if(!icecpp.close())
- {
- u->destroy();
- return EXIT_FAILURE;
- }
- }
+ if(depend)
+ {
+ Preprocessor icecpp(argv[0], args[idx], cppArgs);
+ icecpp.printMakefileDependencies(Preprocessor::Java);
+ }
+ else
+ {
+ Preprocessor icecpp(argv[0], args[idx], cppArgs);
+ FILE* cppHandle = icecpp.preprocess(false);
+
+ if(cppHandle == 0)
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+
+ if(preprocess)
+ {
+ char buf[4096];
+ while(fgets(buf, static_cast<int>(sizeof(buf)), cppHandle) != NULL)
+ {
+ if(fputs(buf, stdout) == EOF)
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+ }
+ }
+ else
+ {
+ status = u->parse(cppHandle, debug);
+ }
+
+ if(!icecpp.close())
+ {
+ u->destroy();
+ return EXIT_FAILURE;
+ }
+ }
}
if(depend)
{
u->destroy();
- return EXIT_SUCCESS;
+ return EXIT_SUCCESS;
}
if(status == EXIT_SUCCESS && !preprocess)
@@ -1439,7 +1439,7 @@ main(int argc, char* argv[])
}
}
- for(vector<Index>::const_iterator q = indices.begin(); q != indices.end(); ++q)
+ for(vector<Index>::const_iterator q = indices.begin(); q != indices.end(); ++q)
{
try
{