diff options
author | Bernard Normier <bernard@zeroc.com> | 2016-12-06 14:33:03 -0500 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2016-12-06 14:33:03 -0500 |
commit | d2cadef086b2a694bb33830caa1bec57fa42a3e4 (patch) | |
tree | 1f3a5a89626192f73b46e07e8176eb60f484035d /cpp/src | |
parent | Fixed for ICE-7458 - Removed escaping form double quoted strings of icegridad... (diff) | |
download | ice-d2cadef086b2a694bb33830caa1bec57fa42a3e4.tar.bz2 ice-d2cadef086b2a694bb33830caa1bec57fa42a3e4.tar.xz ice-d2cadef086b2a694bb33830caa1bec57fa42a3e4.zip |
Removed or replaced most double underscores in ObjC
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/slice2objc/Gen.cpp | 447 | ||||
-rw-r--r-- | cpp/src/slice2objc/Gen.h | 8 | ||||
-rw-r--r-- | cpp/src/slice2objc/ObjCUtil.cpp | 25 | ||||
-rw-r--r-- | cpp/src/slice2objc/ObjCUtil.h | 1 |
4 files changed, 260 insertions, 221 deletions
diff --git a/cpp/src/slice2objc/Gen.cpp b/cpp/src/slice2objc/Gen.cpp index 794570bc4d0..4dcd484ba63 100644 --- a/cpp/src/slice2objc/Gen.cpp +++ b/cpp/src/slice2objc/Gen.cpp @@ -89,6 +89,21 @@ opFormatTypeToString(const OperationPtr& op) return "???"; } +string +getEscapedParamName(const OperationPtr& p, const string& name) +{ + ParamDeclList params = p->parameters(); + + for(ParamDeclList::const_iterator i = params.begin(); i != params.end(); ++i) + { + if((*i)->name() == name) + { + return name + "_"; + } + } + return name; +} + class SortParamDeclByTagFn { public: @@ -122,7 +137,11 @@ Slice::ObjCVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, con } else { - string name = reference ? "*" + fixId((*p)->name()) : fixId((*p)->name()); + string name = getParamName(*p, true); + if(reference) + { + name = "*" + name; + } writeMarshalUnmarshalCode(_M, (*p)->type(), name, marshal, true); } } @@ -130,7 +149,7 @@ Slice::ObjCVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, con { if(!op->returnIsOptional()) { - writeMarshalUnmarshalCode(_M, op->returnType(), "ret_", marshal, true); + writeMarshalUnmarshalCode(_M, op->returnType(), "ret", marshal, true); } } @@ -140,15 +159,21 @@ Slice::ObjCVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, con { if(checkReturnType && op->returnTag() < (*p)->tag()) { - writeOptParamMarshalUnmarshalCode(_M, op->returnType(), "ret_", op->returnTag(), marshal); + writeOptParamMarshalUnmarshalCode(_M, op->returnType(), "ret", op->returnTag(), marshal); checkReturnType = false; } - string name = reference ? "*" + fixId((*p)->name()) : fixId((*p)->name()); + + string name = getParamName(*p, true); + if(reference) + { + name = "*" + name; + } + writeOptParamMarshalUnmarshalCode(_M, (*p)->type(), name, (*p)->tag(), marshal); } if(checkReturnType) { - writeOptParamMarshalUnmarshalCode(_M, op->returnType(), "ret_", op->returnTag(), marshal); + writeOptParamMarshalUnmarshalCode(_M, op->returnType(), "ret", op->returnTag(), marshal); } } @@ -174,7 +199,7 @@ Slice::ObjCVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p) assert(scopedIter != ids.end()); StringList::difference_type scopedPos = IceUtilInternal::distance(firstIter, scopedIter); - _M << sp << nl << "static NSString *" << name << "_ids__[] = "; + _M << sp << nl << "static NSString * iceS_" << name << "_ids[] = "; _M << sb; { StringList::const_iterator q = ids.begin(); @@ -199,11 +224,11 @@ Slice::ObjCVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p) assert(cl); string opName = getName(op); - _M << sp << nl << "+(void)" << op->name() << "___:(id<" << name << ">)target_ current:(ICECurrent *)current " - << "is:(id<ICEInputStream>)is_ os:(id<ICEOutputStream>)os_"; + _M << sp << nl << "+(void) iceD_" << op->name() << ":(id<" << name << ">)target current:(ICECurrent *)current " + << "is:(id<ICEInputStream>)istr os:(id<ICEOutputStream>)ostr"; _M << sb; - _M << nl << "ICEInternalCheckModeAndSelector(target_, " << sliceModeToIceMode(op->mode()) << ", @selector("; + _M << nl << "ICEInternalCheckModeAndSelector(target, " << sliceModeToIceMode(op->mode()) << ", @selector("; string selector = getSelector(op); if(!selector.empty()) { @@ -215,7 +240,7 @@ Slice::ObjCVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p) } _M << "), current);"; - _M << nl << "ICEEncodingVersion* encoding = [is_ startEncapsulation];"; + _M << nl << "ICEEncodingVersion* encoding = [istr startEncapsulation];"; ParamDeclList inParams; ParamDeclList outParams; ParamDeclList paramList = op->parameters(); @@ -234,8 +259,7 @@ Slice::ObjCVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p) for(ParamDeclList::const_iterator inp = inParams.begin(); inp != inParams.end(); ++inp) { TypePtr type = (*inp)->type(); - string name = (*inp)->name(); - _M << nl << outTypeToString(type, (*inp)->optional(), true) << " " << fixId(name); + _M << nl << outTypeToString(type, (*inp)->optional(), true) << " " << getParamName(*inp, true); if(!isValueType(type)) { _M << " = nil"; @@ -245,32 +269,31 @@ Slice::ObjCVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p) writeMarshalUnmarshalParams(inParams, 0, false); if(op->sendsClasses(false)) { - _M << nl << "[is_ readPendingValues];"; + _M << nl << "[istr readPendingValues];"; } - _M << nl << "[is_ endEncapsulation];"; + _M << nl << "[istr endEncapsulation];"; for(ParamDeclList::const_iterator outp = outParams.begin(); outp != outParams.end(); ++outp) { TypePtr type = (*outp)->type(); - string name = (*outp)->name(); - _M << nl << inTypeToString(type, (*outp)->optional(), true) << " " << fixId(name); + _M << nl << inTypeToString(type, (*outp)->optional(), true) << " " << getParamName(*outp, true); if((*outp)->optional()) { _M << " = ICENone"; } _M << ";"; } - _M << nl << "[os_ startEncapsulation:encoding format:" << opFormatTypeToString(*r) << "];"; + _M << nl << "[ostr startEncapsulation:encoding format:" << opFormatTypeToString(*r) << "];"; TypePtr returnType = op->returnType(); if(returnType) { - _M << nl << inTypeToString(returnType, op->returnIsOptional(), true) << " ret_ = "; + _M << nl << inTypeToString(returnType, op->returnIsOptional(), true) << " ret = "; } else { _M << nl; } string args = getServerArgs(op); - _M << "[target_ " << opName << args; + _M << "[target " << opName << args; if(!args.empty()) { _M << " current"; @@ -279,9 +302,9 @@ Slice::ObjCVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p) writeMarshalUnmarshalParams(outParams, op, true); if(op->returnsClasses(false)) { - _M << nl << "[os_ writePendingValues];"; + _M << nl << "[ostr writePendingValues];"; } - _M << nl << "[os_ endEncapsulation];"; + _M << nl << "[ostr endEncapsulation];"; _M << eb; } @@ -301,7 +324,7 @@ Slice::ObjCVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p) map<string, string>::const_iterator q; - _M << sp << nl << "static NSString *" << name << "_all__[] ="; + _M << sp << nl << "static NSString * iceS_" << name << "_all[] ="; _M << sb; q = allOpNames.begin(); while(q != allOpNames.end()) @@ -314,12 +337,12 @@ Slice::ObjCVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p) } _M << eb << ';'; - _M << sp << nl << "-(void) dispatch__:(ICECurrent *)current is:(id<ICEInputStream>)is " - << "os:(id<ICEOutputStream>)os"; + _M << sp << nl << "-(void) iceDispatch:(ICECurrent *)current is:(id<ICEInputStream>)istr " + << "os:(id<ICEOutputStream>)ostr"; _M << sb; - _M << nl << "id target__ = [self target__];"; - _M << nl << "switch(ICEInternalLookupString(" << name << "_all__, sizeof(" << name - << "_all__) / sizeof(NSString*), current.operation))"; + _M << nl << "id target = [self iceTarget];"; + _M << nl << "switch(ICEInternalLookupString(iceS_" << name << "_all, sizeof(iceS_" << name + << "_all) / sizeof(NSString*), current.operation))"; _M << sb; int i = 0; for(q = allOpNames.begin(); q != allOpNames.end(); ++q) @@ -328,13 +351,14 @@ Slice::ObjCVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p) _M.inc(); if(q->second == "ICEObject") { - _M << nl << "[ICEServant " << q->first << "___:(id<" << q->second << ">)self"; + _M << nl << "[ICEServant iceD_" << q->first << ":(id<" << q->second << ">)self"; } else { - _M << nl << "[" << q->second << " " << q->first << "___:(id<" << q->second << ">)target__"; + _M << nl << "[" << q->second << " iceD_" << q->first << ":(id<" << q->second << ">)target"; } - _M << " current:current is:is os:os];"; + _M << " current:current is:istr os:ostr];"; + _M << nl << "return;"; _M.dec(); } @@ -353,11 +377,11 @@ Slice::ObjCVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p) _M << eb; } - _M << sp << nl << "+(NSString * const*) staticIds__:(int*)count idIndex:(int*)idx"; + _M << sp << nl << "+(NSString * const*) iceStaticIds:(int*)count idIndex:(int*)idx"; _M << sb; - _M << nl << "*count = sizeof(" << name << "_ids__) / sizeof(NSString *);"; + _M << nl << "*count = sizeof(iceS_" << name << "_ids) / sizeof(NSString *);"; _M << nl << "*idx = " << scopedPos << ";"; - _M << nl << "return " << name << "_ids__;"; + _M << nl << "return iceS_" << name << "_ids;"; _M << eb; } @@ -394,7 +418,7 @@ Slice::ObjCVisitor::getSelector(const OperationPtr& op) const } string -Slice::ObjCVisitor::getParams(const OperationPtr& op) const +Slice::ObjCVisitor::getParams(const OperationPtr& op, bool internal) const { string result; ParamDeclList paramList = op->parameters(); @@ -414,7 +438,7 @@ Slice::ObjCVisitor::getParams(const OperationPtr& op) const { result += " " + getParamId(*q); } - result += ":(" + typeString + ")" + fixId((*q)->name()); + result += ":(" + typeString + ")" + getParamName(*q, internal); } return result; } @@ -446,7 +470,7 @@ Slice::ObjCVisitor::getBlockParams(const OperationPtr& op) const } string -Slice::ObjCVisitor::getMarshalParams(const OperationPtr& op) const +Slice::ObjCVisitor::getMarshalParams(const OperationPtr& op, bool internal) const { ParamDeclList paramList = op->parameters(); string result; @@ -459,14 +483,14 @@ Slice::ObjCVisitor::getMarshalParams(const OperationPtr& op) const { result += " " + getParamId(*q); } - result += ":(" + inTypeToString(type, (*q)->optional()) + ")" + fixId((*q)->name()); + result += ":(" + inTypeToString(type, (*q)->optional()) + ")" + getParamName(*q, internal); } } return result; } string -Slice::ObjCVisitor::getUnmarshalParams(const OperationPtr& op) const +Slice::ObjCVisitor::getUnmarshalParams(const OperationPtr& op, bool internal) const { string result; ParamDeclList paramList = op->parameters(); @@ -479,7 +503,7 @@ Slice::ObjCVisitor::getUnmarshalParams(const OperationPtr& op) const { result += " " + getParamId(*q); } - result += ":(" + outTypeToString(type, (*q)->optional(), false, true) + ")" + fixId((*q)->name()); + result += ":(" + outTypeToString(type, (*q)->optional(), false, true) + ")" + getParamName(*q, internal); } } return result; @@ -506,7 +530,7 @@ Slice::ObjCVisitor::getServerParams(const OperationPtr& op) const { result += " " + getParamId(*q); } - result += ":(" + typeString + ")" + fixId((*q)->name()); + result += ":(" + typeString + ")" + getParamName(*q, false); } return result; } @@ -548,7 +572,7 @@ Slice::ObjCVisitor::getArgs(const OperationPtr& op) const { result += " " + getParamId(*q); } - result += ":" + fixId((*q)->name()); + result += ":" + getParamName(*q, true); } return result; } @@ -566,7 +590,7 @@ Slice::ObjCVisitor::getMarshalArgs(const OperationPtr& op) const { result += " " + getParamId(*q); } - result += ":" + fixId((*q)->name()); + result += ":" + getParamName(*q, true); } } return result; @@ -585,7 +609,7 @@ Slice::ObjCVisitor::getUnmarshalArgs(const OperationPtr& op) const { result += " " + getParamId(*q); } - result += ":" + fixId((*q)->name()); + result += ":" + getParamName(*q, true); } } return result; @@ -607,7 +631,7 @@ Slice::ObjCVisitor::getServerArgs(const OperationPtr& op) const { result += "&"; } - result += fixId((*q)->name()); + result += getParamName(*q, true); } return result; } @@ -1018,7 +1042,7 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p) if(preserved && !basePreserved) { - _H << nl << "id<ICESlicedData> slicedData__;"; + _H << nl << "id<ICESlicedData> iceSlicedData_;"; } _H << eb; @@ -1039,7 +1063,7 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p) writeInit(p, dataMembers, baseDataMembers, allDataMembers, requiresMemberInit(dataMembers), BaseTypeObject, Other); writeFactory(p, allDataMembers, BaseTypeObject, Other); writeCopyWithZone(p, allDataMembers, BaseTypeObject, Other); - writeMemberDealloc(dataMembers, BaseTypeObject, preserved && !basePreserved); + writeMemberDealloc(dataMembers, BaseTypeObject, preserved && !basePreserved ? "iceSlicedData_" : ""); // // Setter, has, clear selectors for optionals @@ -1068,35 +1092,35 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p) for(r = ops.begin(); r != ops.end(); ++r) { OperationPtr op = *r; - _H << nl << "+(void)" << op->name() << "___:(id<" << name + _H << nl << "+(void) iceD_" << op->name() << ":(id<" << name << ">)target current:(ICECurrent *)current " - << "is:(id<ICEInputStream>)is_ os:(id<ICEOutputStream>)os_;"; + << "is:(id<ICEInputStream>)istr os:(id<ICEOutputStream>)ostr;"; } // // Marshaling/unmarshaling // - _M << sp << nl << "-(void) writeImpl__:(id<ICEOutputStream>)os_"; + _M << sp << nl << "-(void) iceWriteImpl:(id<ICEOutputStream>)ostr"; _M << sb; - _M << nl << "[os_ startSlice:@\"" << p->scoped() << "\" compactId: " << p->compactId() << " lastSlice:" + _M << nl << "[ostr startSlice:@\"" << p->scoped() << "\" compactId:" << p->compactId() << " lastSlice:" << (!hasBaseClass ? "YES" : "NO") << "];"; writeMemberMarshal(dataMembers, optionalMembers, BaseTypeObject); - _M << nl << "[os_ endSlice];"; + _M << nl << "[ostr endSlice];"; if(hasBaseClass) { - _M << nl << "[super writeImpl__:os_];"; + _M << nl << "[super iceWriteImpl:ostr];"; } _M << eb; - _M << sp << nl << "-(void) readImpl__:(id<ICEInputStream>)is_"; + _M << sp << nl << "-(void) iceReadImpl:(id<ICEInputStream>)istr"; _M << sb; - _M << nl << "[is_ startSlice];"; + _M << nl << "[istr startSlice];"; writeMemberUnmarshal(dataMembers, optionalMembers, BaseTypeObject); - _M << nl << "[is_ endSlice];"; + _M << nl << "[istr endSlice];"; if(hasBaseClass) { - _M << nl << "[super readImpl__:is_];"; + _M << nl << "[super iceReadImpl:istr];"; } _M << eb; @@ -1104,18 +1128,18 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p) if(preserved && !basePreserved) { - _M << nl << "-(void) write__:(id<ICEOutputStream>)os"; + _M << nl << "-(void) iceWrite:(id<ICEOutputStream>)ostr"; _M << sb; - _M << nl << "[os startValue:slicedData__];"; - _M << nl << "[self writeImpl__:os];"; - _M << nl << "[os endValue];"; + _M << nl << "[ostr startValue:iceSlicedData_];"; + _M << nl << "[self iceWriteImpl:ostr];"; + _M << nl << "[ostr endValue];"; _M << eb; - _M << nl << "-(void) read__:(id<ICEInputStream>)is"; + _M << nl << "-(void) iceRead:(id<ICEInputStream>)istr"; _M << sb; - _M << nl << "[is startValue];"; - _M << nl << "[self readImpl__:is];"; - _M << nl << "slicedData__ = [is endValue:YES];"; + _M << nl << "[istr startValue];"; + _M << nl << "[self iceReadImpl:istr];"; + _M << nl << "iceSlicedData_ = [istr endValue:YES];"; _M << eb; } } @@ -1153,7 +1177,7 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p) { _H << " current"; } - _H << ":(ICECurrent *)current;"; + _H << ":(ICECurrent *)" << getEscapedParamName(p, "current") << ";"; } else { @@ -1249,7 +1273,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) if(preserved && !basePreserved) { - _H << nl << "id<ICESlicedData> slicedData__;"; + _H << nl << "id<ICESlicedData> slicedData_;"; } _H << eb; @@ -1280,7 +1304,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) writeInit(p, dataMembers, baseDataMembers, allDataMembers, requiresMemberInit(dataMembers), BaseTypeException, ct); writeFactory(p, allDataMembers, BaseTypeException, ct); writeCopyWithZone(p, allDataMembers, BaseTypeException, ct); - writeMemberDealloc(dataMembers, BaseTypeException, preserved && !basePreserved); + writeMemberDealloc(dataMembers, BaseTypeException, preserved && !basePreserved ? "slicedData_" : ""); // // Setter, has, clear selectors for optionals @@ -1295,7 +1319,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) { if(!base || (base && !base->usesClasses(false))) { - _M << sp << nl << "-(BOOL) usesClasses__"; + _M << sp << nl << "-(BOOL) iceUsesClasses"; _M << sb; _M << nl << "return YES;"; _M << eb; @@ -1304,43 +1328,43 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) if(!p->isLocal()) { - _M << sp << nl << "-(void) writeImpl__:(id<ICEOutputStream>)os_"; + _M << sp << nl << "-(void) iceWriteImpl:(id<ICEOutputStream>)ostr"; _M << sb; - _M << nl << "[os_ startSlice:@\"" << p->scoped() << "\" compactId:-1 lastSlice:" + _M << nl << "[ostr startSlice:@\"" << p->scoped() << "\" compactId:-1 lastSlice:" << (!base ? "YES" : "NO") << "];"; writeMemberMarshal(dataMembers, optionalMembers, BaseTypeException); - _M << nl << "[os_ endSlice];"; + _M << nl << "[ostr endSlice];"; if(base) { - _M << nl << "[super writeImpl__:os_];"; + _M << nl << "[super iceWriteImpl:ostr];"; } _M << eb; - _M << sp << nl << "-(void) readImpl__:(id<ICEInputStream>)is_"; + _M << sp << nl << "-(void) iceReadImpl:(id<ICEInputStream>)istr"; _M << sb; - _M << nl << "[is_ startSlice];"; + _M << nl << "[istr startSlice];"; writeMemberUnmarshal(dataMembers, optionalMembers, BaseTypeException); - _M << nl << "[is_ endSlice];"; + _M << nl << "[istr endSlice];"; if(base) { - _M << nl << "[super readImpl__:is_];"; + _M << nl << "[super iceReadImpl:istr];"; } _M << eb; if(preserved && !basePreserved) { - _M << nl << nl << "-(void) write__:(id<ICEOutputStream>)os"; + _M << nl << nl << "-(void) iceWrite:(id<ICEOutputStream>)ostr"; _M << sb; - _M << nl << "[os startException:slicedData__];"; - _M << nl << "[self writeImpl__:os];"; - _M << nl << "[os endException];"; + _M << nl << "[ostr startException:slicedData_];"; + _M << nl << "[self iceWriteImpl:ostr];"; + _M << nl << "[ostr endException];"; _M << eb; - _M << nl << nl << "-(void) read__:(id<ICEInputStream>)is"; + _M << nl << nl << "-(void) iceRead:(id<ICEInputStream>)istr"; _M << sb; - _M << nl << "[is startException];"; - _M << nl << "[self readImpl__:is];"; - _M << nl << "slicedData__ = [is endException:YES];"; + _M << nl << "[istr startException];"; + _M << nl << "[self iceReadImpl:istr];"; + _M << nl << "slicedData_ = [istr endException:YES];"; _M << eb; } } @@ -1422,15 +1446,15 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) // // Marshaling/unmarshaling // - _H << nl << "-(void) write__:(id<ICEOutputStream>)os_;"; - _H << nl << "-(void) read__:(id<ICEInputStream>)is_;"; + _H << nl << "-(void) iceWrite:(id<ICEOutputStream>)ostr;"; + _H << nl << "-(void) iceRead:(id<ICEInputStream>)istr;"; - _M << sp << nl << "-(void) write__:(id<ICEOutputStream>)os_"; + _M << sp << nl << "-(void) iceWrite:(id<ICEOutputStream>)ostr"; _M << sb; writeMemberMarshal(dataMembers, DataMemberList(), BaseTypeObject); _M << eb; - _M << sp << nl << "-(void) read__:(id<ICEInputStream>)is_"; + _M << sp << nl << "-(void) iceRead:(id<ICEInputStream>)istr"; _M << sb; writeMemberUnmarshal(dataMembers, DataMemberList(), BaseTypeObject); _M << eb; @@ -1566,7 +1590,7 @@ Slice::Gen::TypesVisitor::writeInit(const ContainedPtr& p, const DataMemberList& _M << nl << "self = [super init"; if(ct == LocalException) { - _M << ":file__p line:line__p"; + _M << ":file_ line:line_"; } writeMemberCall(baseDataMembers, baseType, ct, WithEscape); _M << "];"; @@ -1605,7 +1629,7 @@ Slice::Gen::TypesVisitor::writeFactory(const ContainedPtr& p, const DataMemberLi _M << nl << "return ICE_AUTORELEASE([(" << name << " *)[self alloc] init"; if(ct == LocalException) { - _M << ":file__p line:line__p"; + _M << ":file_ line:line_"; } writeMemberCall(dataMembers, baseType, ct, WithEscape); _M << "]);"; @@ -1625,7 +1649,7 @@ Slice::Gen::TypesVisitor::writeFactory(const ContainedPtr& p, const DataMemberLi _M << nl << "return ICE_AUTORELEASE([self " << factoryMethod; if(ct == LocalException) { - _M << ":file__p line:line__p"; + _M << ":file_ line:line_"; } writeMemberCall(dataMembers, baseType, ct, WithEscape); _M << "]);"; @@ -1643,9 +1667,9 @@ Slice::Gen::TypesVisitor::writeCopyWithZone(const ContainedPtr& p, const DataMem } string name = fixName(p); - _M << sp << nl << "-(id) copyWithZone:(NSZone *)zone_p"; + _M << sp << nl << "-(id) copyWithZone:(NSZone *)zone"; _M << sb; - _M << nl << "return [(" << name << " *)[[self class] allocWithZone:zone_p] init"; + _M << nl << "return [(" << name << " *)[[self class] allocWithZone:zone] init"; if(ct == LocalException) { _M << ":file line:line"; @@ -1693,8 +1717,8 @@ Slice::Gen::TypesVisitor::writeMemberSignature(const DataMemberList& dataMembers { if(ct == LocalException) { - _H << ":(const char*)file__p line:(int)line__p"; - _M << ":(const char*)file__p line:(int)line__p"; + _H << ":(const char*)file line:(int)line"; + _M << ":(const char*)file_ line:(int)line_"; } for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) { @@ -1718,7 +1742,7 @@ Slice::Gen::TypesVisitor::writeMemberSignature(const DataMemberList& dataMembers _M << " " << getParamId(*q); } _H << ":(" << typeString << ")" << fixId((*q)->name()); - _M << ":(" << typeString << ")" << fixId((*q)->name()) << "_p"; + _M << ":(" << typeString << ")" << getParamName(*q, true); } } @@ -1756,7 +1780,7 @@ Slice::Gen::TypesVisitor::writeMemberCall(const DataMemberList& dataMembers, int } else { - _M << ":" << name << "_p"; + _M << ":" << getParamName(*q, true); } } } @@ -1838,12 +1862,12 @@ Slice::Gen::TypesVisitor::writeMemberInit(const DataMemberList& dataMembers, int if(isValueType(type)) { _M << nl << "self->has_" << name << "__ = [ICEOptionalGetter " << getOptionalHelperGetter(type) << ":"; - _M << name << "_p value:&self->" << fixId((*q)->name(), baseType) << "];"; + _M << getParamName(*q, true) << " value:&self->" << fixId((*q)->name(), baseType) << "];"; } else { _M << nl << "self->has_" << name << "__ = [ICEOptionalGetter getRetained:"; - _M << name << "_p value:&self->" << fixId((*q)->name(), baseType); + _M << getParamName(*q, true) << " value:&self->" << fixId((*q)->name(), baseType); _M << " type:[" << typeToObjCTypeString(type) << " class]];"; } } @@ -1851,11 +1875,11 @@ Slice::Gen::TypesVisitor::writeMemberInit(const DataMemberList& dataMembers, int { if(isValueType(type)) { - _M << nl << "self->" << fixId((*q)->name(), baseType) << " = " << name << "_p;"; + _M << nl << "self->" << fixId((*q)->name(), baseType) << " = " << getParamName(*q, true) << ";"; } else { - _M << nl << "self->" << fixId((*q)->name(), baseType) << " = ICE_RETAIN(" << name << "_p);"; + _M << nl << "self->" << fixId((*q)->name(), baseType) << " = ICE_RETAIN(" << getParamName(*q, true) << ");"; } } } @@ -1922,24 +1946,25 @@ Slice::Gen::TypesVisitor::writeOptionalDataMemberSelectors(const DataMemberList& string typeString = inTypeToString(type, false); string name = fixId((*q)->name(), baseType); + string paramName = getParamName(*q, true); string capName = (*q)->name(); capName[0] = toupper(static_cast<unsigned char>(capName[0])); - _H << nl << "-(void)set" << capName << ":(" << typeString << ")" << name << "_p;"; + _H << nl << "-(void)set" << capName << ":(" << typeString << ")" << name << ";"; - _M << nl << "-(void)set" << capName << ":(" << typeString << ")" << name << "_p"; + _M << nl << "-(void)set" << capName << ":(" << typeString << ")" << paramName; _M << sb; _M << nl << "self->has_" << name << "__ = YES;"; bool isValue = isValueType(type); if(isValue) { - _M << nl << "self->" << name << " = " << name << "_p;"; + _M << nl << "self->" << name << " = " << paramName << ";"; } else { _M << nl << "ICE_RELEASE(self->" << name << ");"; - _M << nl << "self->" << name << " = ICE_RETAIN(" << name << "_p);"; + _M << nl << "self->" << name << " = ICE_RETAIN(" << paramName << ");"; } _M << eb; @@ -2048,7 +2073,7 @@ Slice::Gen::TypesVisitor::writeMemberEquals(const DataMemberList& dataMembers, i } void -Slice::Gen::TypesVisitor::writeMemberDealloc(const DataMemberList& dataMembers, int baseType, bool slicedData) const +Slice::Gen::TypesVisitor::writeMemberDealloc(const DataMemberList& dataMembers, int baseType, const string& slicedData) const { if(dataMembers.empty()) { @@ -2081,9 +2106,9 @@ Slice::Gen::TypesVisitor::writeMemberDealloc(const DataMemberList& dataMembers, } if(once) { - if(slicedData) + if(!slicedData.empty()) { - _M << nl << "[(NSObject*)slicedData__ release];"; + _M << nl << "[(NSObject*)" << slicedData << " release];"; } _M << nl << "[super dealloc];"; _M << eb; @@ -2109,7 +2134,7 @@ Slice::Gen::TypesVisitor::writeMemberMarshal(const DataMemberList& dataMembers, { string name = fixId((*q)->name(), baseType); string frmt = getOptionalFormat((*q)->type()); - _M << nl << "if(self->has_" << name << "__ && [os_ writeOptional:" << (*q)->tag() << " format:" << frmt << "])"; + _M << nl << "if(self->has_" << name << "__ && [ostr writeOptional:" << (*q)->tag() << " format:" << frmt << "])"; _M << sb; writeOptMemberMarshalUnmarshalCode(_M, (*q)->type(), "self->" + name, true); _M << eb; @@ -2131,7 +2156,7 @@ Slice::Gen::TypesVisitor::writeMemberUnmarshal(const DataMemberList& dataMembers { string name = fixId((*q)->name(), baseType); string frmt = getOptionalFormat((*q)->type()); - _M << nl << "if([is_ readOptional:" << (*q)->tag() << " format:" << frmt << "])"; + _M << nl << "if([istr readOptional:" << (*q)->tag() << " format:" << frmt << "])"; _M << sb; _M << nl << "self->has_" << name << "__ = YES;"; writeOptMemberMarshalUnmarshalCode(_M, (*q)->type(), "self->" + name, false); @@ -2208,7 +2233,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) { _H << " context"; } - _H << ":(ICEContext *)context;"; + _H << ":(ICEContext *)" << getEscapedParamName(p, "context") << ";"; _H << nl << "-(id<ICEAsyncResult>) begin_" << p->name() << marshalParams << ";"; _H << nl << "-(id<ICEAsyncResult>) begin_" << p->name() << marshalParams; @@ -2216,45 +2241,47 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) { _H << " context"; } - _H << ":(ICEContext *)context;"; + _H << ":(ICEContext *)" << getEscapedParamName(p, "context") << ";"; _H << nl << "-(" << retString << ") end_" << p->name() << unmarshalParams; if(!unmarshalParams.empty()) { _H << " result"; } - _H << ":(id<ICEAsyncResult>)result;"; + _H << ":(id<ICEAsyncResult>)" << getEscapedParamName(p, "result") << ";"; + + string responseExceptionDecl = ":(" + getResponseCBSig(p) + ")" + getEscapedParamName(p, "response") + + " exception:(void(^)(ICEException*))" + getEscapedParamName(p, "exception"); + string responseExceptionSentDecl = responseExceptionDecl + " sent:(void(^)(BOOL))" + getEscapedParamName(p, "sent"); - string responseCBSig = getResponseCBSig(p); _H << nl << "-(id<ICEAsyncResult>) begin_" << p->name() << marshalParams; if(!marshalParams.empty()) { _H << " response"; } - _H << ":(" << responseCBSig << ")response_ exception:(void(^)(ICEException*))exception_;"; + _H << responseExceptionDecl << ";"; _H << nl << "-(id<ICEAsyncResult>) begin_" << p->name() << marshalParams; if(!marshalParams.empty()) { _H << " context"; } - _H << ":(ICEContext *)context"; - _H << " response:(" << responseCBSig << ")response_ exception:(void(^)(ICEException*))exception_;"; + _H << ":(ICEContext *)" << getEscapedParamName(p, "context") << " response" << responseExceptionDecl << ";"; _H << nl << "-(id<ICEAsyncResult>) begin_" << p->name() << marshalParams; if(!marshalParams.empty()) { _H << " response"; } - _H << ":(" << responseCBSig << ")response_ exception:(void(^)(ICEException*))exception_ sent:(void(^)(BOOL))sent_;"; + _H << responseExceptionSentDecl << ";"; _H << nl << "-(id<ICEAsyncResult>) begin_" << p->name() << marshalParams; if(!marshalParams.empty()) { _H << " context"; } - _H << ":(ICEContext *)context"; - _H << " response:(" << responseCBSig << ")response_ exception:(void(^)(ICEException*))exception_ sent:(void(^)(BOOL))sent_;"; + _H << ":(ICEContext *)" << getEscapedParamName(p, "context"); + _H << " response" << responseExceptionSentDecl << ";"; } Slice::Gen::HelperVisitor::HelperVisitor(Output& H, Output& M, const string& dllExport) : @@ -2598,7 +2625,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) string opName = getName(*r); TypePtr returnType = (*r)->returnType(); string retString = outTypeToString(returnType, (*r)->returnIsOptional()); - string params = getParams(*r); + string params = getParams(*r, true); string args = getArgs(*r); ParamDeclList inParams; @@ -2641,11 +2668,11 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) { _M << " context"; } - _M << ":(ICEContext *)ctx_"; + _M << ":(ICEContext *)context"; _M << sb; if(returnType) { - _M << nl << "__block " << retString << " ret_"; + _M << nl << "__block " << retString << " ret"; if(!isValueType(returnType)) { _M << " = nil;"; @@ -2658,13 +2685,13 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) string marshal; string marshalArgs = getMarshalArgs(*r); - string marshalParams = getMarshalParams(*r); + string marshalParams = getMarshalParams(*r, true); if(!inParams.empty()) { - _M << nl << "ICEMarshalCB marshal_ = ^(id<ICEOutputStream> os_) "; - _M << "{ [" << className << "Prx " << (*r)->name() << "_marshal___" << marshalArgs; - _M << (marshalArgs.empty() ? ":os_" : " os:os_") << "]; };"; - marshal = "marshal_"; + _M << nl << "ICEMarshalCB marshal = ^(id<ICEOutputStream> ostr) "; + _M << "{ [" << className << "Prx iceI_" << (*r)->name() << "_marshal" << marshalArgs; + _M << (marshalArgs.empty() ? ":ostr" : " os:ostr") << "]; };"; + marshal = "marshal"; } else { @@ -2673,33 +2700,33 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) string unmarshal; string unmarshalArgs = getUnmarshalArgs(*r); - string unmarshalParams = getUnmarshalParams(*r); + string unmarshalParams = getUnmarshalParams(*r, true); if((*r)->returnsData()) { - _M << nl << "ICEUnmarshalCB unmarshal_ = ^(id<ICEInputStream> is_, BOOL ok_) "; + _M << nl << "ICEUnmarshalCB unmarshal = ^(id<ICEInputStream> istr, BOOL ok) "; if(returnType) { - _M << "{ ret_ = "; + _M << "{ ret = "; } else { _M << "{ "; } - _M << "[" << className << "Prx " << (*r)->name() << "_unmarshal___" << unmarshalArgs; - _M << (unmarshalArgs.empty() ? ":is_" : " is:is_") << " ok:ok_]; };"; - unmarshal = "unmarshal_"; + _M << "[" << className << "Prx iceI_" << (*r)->name() << "_unmarshal" << unmarshalArgs; + _M << (unmarshalArgs.empty() ? ":istr" : " is:istr") << " ok:ok]; };"; + unmarshal = "unmarshal"; } else { unmarshal = "nil"; } - _M << nl << "[self invoke__:@\"" << (*r)->name() << "\" mode:" << sliceModeToIceMode((*r)->sendMode()) + _M << nl << "[self iceInvoke:@\"" << (*r)->name() << "\" mode:" << sliceModeToIceMode((*r)->sendMode()) << " format:" << opFormatTypeToString(*r) << " marshal:" << marshal - << " unmarshal:" << unmarshal << " context:ctx_];"; + << " unmarshal:" << unmarshal << " context:context];"; if(returnType) { - _M << nl << "return ret_;"; + _M << nl << "return ret;"; } _M << eb; @@ -2716,19 +2743,19 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) // Write begin_ version with context. // _M << sp << nl << "-(id<ICEAsyncResult>) begin_" << (*r)->name() << marshalParams; - _M << (marshalParams.empty() ? "" : " context") << ":(ICEContext *)ctx_"; + _M << (marshalParams.empty() ? "" : " context") << ":(ICEContext *)context"; _M << sb; if(!inParams.empty()) { - _M << nl << "ICEMarshalCB marshal_ = ^(id<ICEOutputStream> os_) "; - _M << "{ [" << className << "Prx " << (*r)->name() << "_marshal___" << marshalArgs; - _M << (marshalArgs.empty() ? "" : " os") << ":os_]; };"; + _M << nl << "ICEMarshalCB marshal = ^(id<ICEOutputStream> ostr) "; + _M << "{ [" << className << "Prx iceI_" << (*r)->name() << "_marshal" << marshalArgs; + _M << (marshalArgs.empty() ? "" : " os") << ":ostr]; };"; } - _M << nl << "return [self begin_invoke__:@\"" << (*r)->name() << "\" mode:" + _M << nl << "return [self iceI_begin_invoke:@\"" << (*r)->name() << "\" mode:" << sliceModeToIceMode((*r)->sendMode()) << " format:" << opFormatTypeToString(*r) << " marshal:" << marshal << " returnsData:" << ((*r)->returnsData() ? "YES" : "NO") - << " context:ctx_];"; + << " context:context];"; _M << eb; // @@ -2739,11 +2766,11 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) { _M << " result"; } - _M << ":(id<ICEAsyncResult>)result_"; + _M << ":(id<ICEAsyncResult>)result"; _M << sb; if(returnType) { - _M << nl << "__block " << retString << " ret_"; + _M << nl << "__block " << retString << " ret"; if(!isValueType(returnType)) { _M << " = nil;"; @@ -2755,22 +2782,22 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) } if((*r)->returnsData()) { - _M << nl << "ICEUnmarshalCB unmarshal_ = ^(id<ICEInputStream> is_, BOOL ok_) "; + _M << nl << "ICEUnmarshalCB unmarshal = ^(id<ICEInputStream> istr, BOOL ok) "; if(returnType) { - _M << "{ ret_ = "; + _M << "{ ret = "; } else { _M << "{ "; } - _M << "[" << className << "Prx " << (*r)->name() << "_unmarshal___" << unmarshalArgs; - _M << (unmarshalArgs.empty() ? ":is_" : " is:is_") << " ok:ok_]; };"; + _M << "[" << className << "Prx iceI_" << (*r)->name() << "_unmarshal" << unmarshalArgs; + _M << (unmarshalArgs.empty() ? ":istr" : " is:istr") << " ok:ok]; };"; } - _M << nl << "[self end_invoke__:@\"" << (*r)->name() << "\" unmarshal:" << unmarshal << " result:result_];"; + _M << nl << "[self iceI_end_invoke:@\"" << (*r)->name() << "\" unmarshal:" << unmarshal << " result:result];"; if(returnType) { - _M << nl << "return ret_;"; + _M << nl << "return ret;"; } _M << eb; @@ -2780,43 +2807,43 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) string responseCBSig = getResponseCBSig(*r); _M << sp << nl << "-(id<ICEAsyncResult>) begin_" << (*r)->name() << marshalParams; - _M << (marshalParams.empty() ? "" : " response") << ":(" << responseCBSig << ")response_"; - _M << " exception:(void(^)(ICEException*))exception_"; + _M << (marshalParams.empty() ? "" : " response") << ":(" << responseCBSig << ")response"; + _M << " exception:(void(^)(ICEException*))exception"; _M << sb; _M << nl << "return [self begin_" << (*r)->name() << marshalArgs; - _M << (marshalArgs.empty() ? "" : " context") << ":nil response:response_ exception:exception_ sent:nil];"; + _M << (marshalArgs.empty() ? "" : " context") << ":nil response:response exception:exception sent:nil];"; _M << eb; _M << sp << nl << "-(id<ICEAsyncResult>) begin_" << (*r)->name() << marshalParams; - _M << (marshalParams.empty() ? "" : " response") << ":(" << responseCBSig << ")response_"; - _M << " exception:(void(^)(ICEException*))exception_ sent:(void(^)(BOOL))sent_"; + _M << (marshalParams.empty() ? "" : " response") << ":(" << responseCBSig << ")response"; + _M << " exception:(void(^)(ICEException*))exception sent:(void(^)(BOOL))sent"; _M << sb; _M << nl << "return [self begin_" << (*r)->name() << marshalArgs; - _M << (marshalArgs.empty() ? "" : " context") << ":nil response:response_ exception:exception_ sent:sent_];"; + _M << (marshalArgs.empty() ? "" : " context") << ":nil response:response exception:exception sent:sent];"; _M << eb; _M << sp << nl << "-(id<ICEAsyncResult>) begin_" << (*r)->name() << marshalParams; - _M << (marshalParams.empty() ? "" : " context") << ":(ICEContext*)ctx_"; - _M << " response:(" << responseCBSig << ")response_ exception:(void(^)(ICEException*))exception_ "; + _M << (marshalParams.empty() ? "" : " context") << ":(ICEContext*)context"; + _M << " response:(" << responseCBSig << ")response exception:(void(^)(ICEException*))exception "; _M << sb; _M << nl << "return [self begin_" << (*r)->name() << marshalArgs; - _M << (marshalArgs.empty() ? "" : " context") << ":ctx_ response:response_ exception:exception_ sent:nil];"; + _M << (marshalArgs.empty() ? "" : " context") << ":context response:response exception:exception sent:nil];"; _M << eb; _M << sp << nl << "-(id<ICEAsyncResult>) begin_" << (*r)->name() << marshalParams; - _M << (marshalParams.empty() ? "" : " context") << ":(ICEContext*)ctx_"; - _M << " response:(" << responseCBSig << ")response_ exception:(void(^)(ICEException*))exception_ "; - _M << " sent:(void(^)(BOOL))sent_"; + _M << (marshalParams.empty() ? "" : " context") << ":(ICEContext*)context"; + _M << " response:(" << responseCBSig << ")response exception:(void(^)(ICEException*))exception "; + _M << " sent:(void(^)(BOOL))sent"; _M << sb; if(!inParams.empty()) { - _M << nl << "ICEMarshalCB marshal_ = ^(id<ICEOutputStream> os_) "; - _M << "{ [" << className << "Prx " << (*r)->name() << "_marshal___" << marshalArgs; - _M << (marshalArgs.empty() ? "" : " os") << ":os_]; };"; + _M << nl << "ICEMarshalCB marshal = ^(id<ICEOutputStream> ostr) "; + _M << "{ [" << className << "Prx iceI_" << (*r)->name() << "_marshal" << marshalArgs; + _M << (marshalArgs.empty() ? "" : " os") << ":ostr]; };"; } if((*r)->returnsData()) { - _M << nl << "void(^completed_)(id<ICEInputStream>, BOOL) = ^(id<ICEInputStream> is_, BOOL ok_)"; + _M << nl << "void(^completed)(id<ICEInputStream>, BOOL) = ^(id<ICEInputStream> istr, BOOL ok)"; _M << sb; string responseCallArgs; string unmarshalCallArgs; @@ -2824,12 +2851,12 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) { if(returnType) { - responseCallArgs += "ret_"; + responseCallArgs += "ret"; } for(ParamDeclList::const_iterator op = outParams.begin(); op != outParams.end(); ++op) { - string name = fixId((*op)->name()); + string name = getParamName(*op, true); _M << nl << outTypeToString((*op)->type(), (*op)->optional(), true) << " " << name; if(!isValueType((*op)->type())) { @@ -2839,7 +2866,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) if(!unmarshalCallArgs.empty()) { - unmarshalCallArgs += " " + name; + unmarshalCallArgs += " " + getParamId(*op); } unmarshalCallArgs += ":&" + name; @@ -2851,7 +2878,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) } if(returnType) { - _M << nl << outTypeToString(returnType, (*r)->returnIsOptional(), true) << " ret_"; + _M << nl << outTypeToString(returnType, (*r)->returnIsOptional(), true) << " ret"; if(!isValueType(returnType)) { _M << " = nil"; @@ -2864,43 +2891,43 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) _M << nl; if(returnType) { - _M << "ret_ = "; + _M << "ret = "; } - _M << "[" << className << "Prx " << (*r)->name() << "_unmarshal___" << unmarshalCallArgs; - _M << (unmarshalCallArgs.empty() ? ":is_" : " is:is_") << " ok:ok_];"; + _M << "[" << className << "Prx iceI_" << (*r)->name() << "_unmarshal" << unmarshalCallArgs; + _M << (unmarshalCallArgs.empty() ? ":istr" : " is:istr") << " ok:ok];"; _M << eb; _M << nl << "@catch(ICEException* ex)"; _M << sb; - _M << nl << "if(exception_)"; + _M << nl << "if(exception)"; _M << sb; - _M << nl << "exception_(ex);"; + _M << nl << "exception(ex);"; _M << eb; _M << nl << "return;"; _M << eb; - _M << nl << "if(response_)"; + _M << nl << "if(response)"; _M << sb; - _M << nl << "response_(" << responseCallArgs << ");"; + _M << nl << "response(" << responseCallArgs << ");"; _M << eb; _M << eb << ";"; if(returnType || !outParams.empty()) { - _M << nl << "return [self begin_invoke__:@\"" << (*r)->name() << "\" mode:" + _M << nl << "return [self iceI_begin_invoke:@\"" << (*r)->name() << "\" mode:" << sliceModeToIceMode((*r)->sendMode()) << " format:" << opFormatTypeToString(*r) << " marshal:" << marshal - << " completed:completed_ response:(response_ != nil) exception:exception_ sent:sent_ context:ctx_];"; + << " completed:completed response:(response != nil) exception:exception sent:sent context:context];"; } else { - _M << nl << "return [self begin_invoke__:@\"" << (*r)->name() << "\" mode:" + _M << nl << "return [self iceI_begin_invoke:@\"" << (*r)->name() << "\" mode:" << sliceModeToIceMode((*r)->sendMode()) << " format:" << opFormatTypeToString(*r) - << " marshal:" << marshal << " completed:completed_ response:YES exception:exception_ sent:sent_ context:ctx_];"; + << " marshal:" << marshal << " completed:completed response:YES exception:exception sent:sent context:context];"; } } else { - _M << nl << "return [self begin_invoke__:@\"" << (*r)->name() << "\" mode:" + _M << nl << "return [self iceI_begin_invoke:@\"" << (*r)->name() << "\" mode:" << sliceModeToIceMode((*r)->sendMode()) << " format:" << opFormatTypeToString(*r) - << " marshal:" << marshal << " response:response_ exception:exception_ sent:sent_ context:ctx_];"; + << " marshal:" << marshal << " response:response exception:exception sent:sent context:context];"; } _M << eb; } @@ -2925,10 +2952,8 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) { TypePtr returnType = p->returnType(); string retString = outTypeToString(returnType, p->returnIsOptional()); - string params = getParams(p); - string args = getParams(p); - string marshalParams = getMarshalParams(p); - string unmarshalParams = getUnmarshalParams(p); + string marshalParams = getMarshalParams(p, true); + string unmarshalParams = getUnmarshalParams(p, true); ParamDeclList inParams; ParamDeclList outParams; @@ -2953,47 +2978,47 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) string className = fixName(cl); if(!inParams.empty()) { - _H << nl << "+(void) " << p->name() << "_marshal___" << marshalParams; + _H << nl << "+(void) iceI_" << p->name() << "_marshal" << marshalParams; if(!marshalParams.empty()) { _H << " os"; } - _H << ":(id<ICEOutputStream>)os_;"; + _H << ":(id<ICEOutputStream>)ostr;"; - _M << sp << nl << "+(void) " << p->name() << "_marshal___" << marshalParams; + _M << sp << nl << "+(void) iceI_" << p->name() << "_marshal" << marshalParams; if(!marshalParams.empty()) { _M << " os"; } - _M << ":(id<ICEOutputStream>)os_"; + _M << ":(id<ICEOutputStream>)ostr"; _M << sb; writeMarshalUnmarshalParams(inParams, 0, true); if(p->sendsClasses(false)) { - _M << nl << "[os_ writePendingValues];"; + _M << nl << "[ostr writePendingValues];"; } _M << eb; } if(p->returnsData()) { - _H << nl << "+(" << retString << ")" << p->name() << "_unmarshal___" << unmarshalParams; + _H << nl << "+(" << retString << ") iceI_" << p->name() << "_unmarshal" << unmarshalParams; if(!unmarshalParams.empty()) { _H << " is"; } - _H << ":(id<ICEInputStream>)is_ ok:(BOOL)ok_;"; + _H << ":(id<ICEInputStream>)istr ok:(BOOL)ok;"; - _M << nl << "+(" << retString << ")" << p->name() << "_unmarshal___" << unmarshalParams; + _M << nl << "+(" << retString << ") iceI_" << p->name() << "_unmarshal" << unmarshalParams; if(!unmarshalParams.empty()) { _M << " is"; } - _M << ":(id<ICEInputStream>)is_ ok:(BOOL)ok_"; + _M << ":(id<ICEInputStream>)istr ok:(BOOL)ok"; _M << sb; if(returnType) { - _M << nl << outTypeToString(returnType, p->returnIsOptional(), true) << " ret_"; + _M << nl << outTypeToString(returnType, p->returnIsOptional(), true) << " ret"; if(!isValueType(returnType)) { _M << " = nil;"; @@ -3009,16 +3034,16 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) { if(!isValueType((*op)->type())) { - _M << nl << "*" << fixId((*op)->name()) << " = nil;"; + _M << nl << "*" << getParamName(*op, true) << " = nil;"; } } } - _M << nl << "if(!ok_)"; + _M << nl << "if(!ok)"; _M << sb; _M << nl << "@try"; _M << sb; - _M << nl << "[is_ startEncapsulation];"; - _M << nl << "[is_ throwException];"; + _M << nl << "[istr startEncapsulation];"; + _M << nl << "[istr throwException];"; _M << eb; // // Arrange exceptions into most-derived to least-derived order. If we don't @@ -3033,17 +3058,17 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) for(ExceptionList::const_iterator e = throws.begin(); e != throws.end(); ++e) { - _M << nl << "@catch(" << fixName(*e) << " *ex_)"; + _M << nl << "@catch(" << fixName(*e) << " *ex)"; _M << sb; - _M << nl << "[is_ endEncapsulation];"; + _M << nl << "[istr endEncapsulation];"; _M << nl << "@throw;"; _M << eb; } - _M << nl << "@catch(ICEUserException *ex_)"; + _M << nl << "@catch(ICEUserException *ex)"; _M << sb; - _M << nl << "[is_ endEncapsulation];"; + _M << nl << "[istr endEncapsulation];"; _M << nl << "@throw [ICEUnknownUserException unknownUserException:__FILE__ line:__LINE__ " - << "unknown:[ex_ ice_id]];"; + << "unknown:[ex ice_id]];"; _M << eb; _M << eb; @@ -3051,19 +3076,19 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) { _M << nl << "else"; _M << sb; - _M << nl << "[is_ startEncapsulation];"; + _M << nl << "[istr startEncapsulation];"; writeMarshalUnmarshalParams(outParams, p, false, true); if(p->returnsClasses(false)) { - _M << nl << "[is_ readPendingValues];"; + _M << nl << "[istr readPendingValues];"; } - _M << nl << "[is_ endEncapsulation];"; + _M << nl << "[istr endEncapsulation];"; _M << eb; } if(returnType) { - _M << nl << "return ret_;"; + _M << nl << "return ret;"; } _M << eb; } diff --git a/cpp/src/slice2objc/Gen.h b/cpp/src/slice2objc/Gen.h index 75d86c78285..0c9ef639e7d 100644 --- a/cpp/src/slice2objc/Gen.h +++ b/cpp/src/slice2objc/Gen.h @@ -29,10 +29,10 @@ protected: virtual void writeMarshalUnmarshalParams(const ParamDeclList&, const OperationPtr&, bool, bool = false); virtual std::string getName(const OperationPtr&) const; virtual std::string getSelector(const OperationPtr&) const; - virtual std::string getParams(const OperationPtr&) const; + virtual std::string getParams(const OperationPtr&, bool = false) const; virtual std::string getBlockParams(const OperationPtr&) const; - virtual std::string getMarshalParams(const OperationPtr&) const; - virtual std::string getUnmarshalParams(const OperationPtr&) const; + virtual std::string getMarshalParams(const OperationPtr&, bool = false) const; + virtual std::string getUnmarshalParams(const OperationPtr&, bool = false) const; virtual std::string getServerParams(const OperationPtr&) const; virtual std::string getResponseCBSig(const OperationPtr&) const; virtual std::string getArgs(const OperationPtr&) const; @@ -147,7 +147,7 @@ private: void writeOptionalDataMemberSelectors(const DataMemberList&, int) const; void writeMemberHashCode(const DataMemberList&, int) const; void writeMemberEquals(const DataMemberList&, int) const; - void writeMemberDealloc(const DataMemberList&, int, bool slicedData = false) const; + void writeMemberDealloc(const DataMemberList&, int, const std::string& = "") const; void writeMemberMarshal(const DataMemberList&, const DataMemberList&, int) const; void writeMemberUnmarshal(const DataMemberList&, const DataMemberList&, int) const; }; diff --git a/cpp/src/slice2objc/ObjCUtil.cpp b/cpp/src/slice2objc/ObjCUtil.cpp index 852af9ba2af..99f7f925098 100644 --- a/cpp/src/slice2objc/ObjCUtil.cpp +++ b/cpp/src/slice2objc/ObjCUtil.cpp @@ -208,6 +208,19 @@ Slice::ObjCGenerator::getParamId(const ContainedPtr& param) } string +Slice::ObjCGenerator::getParamName(const ContainedPtr& param, bool internal) +{ + if(internal) + { + return "iceP_" + param->name(); + } + else + { + return fixId(param->name()); + } +} + +string Slice::ObjCGenerator::getFactoryMethod(const ContainedPtr& p, bool deprecated) { ClassDefPtr def = ClassDefPtr::dynamicCast(p); @@ -692,7 +705,7 @@ void Slice::ObjCGenerator::writeMarshalUnmarshalCode(Output &out, const TypePtr& type, const string& param, bool marshal, bool autoreleased) const { - string stream = marshal ? "os_" : "is_"; + string stream = marshal ? "ostr" : "istr"; BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); if(builtin) @@ -883,7 +896,7 @@ void Slice::ObjCGenerator::writeOptMemberMarshalUnmarshalCode(Output &out, const TypePtr& type, const string& param, bool marshal) const { - string stream = marshal ? "os_" : "is_"; + string stream = marshal ? "ostr" : "istr"; string optionalHelper; string helper; @@ -1009,11 +1022,11 @@ Slice::ObjCGenerator::writeOptParamMarshalUnmarshalCode(Output &out, const TypeP out << nl; if(marshal) { - out << "[" << helper << " writeOptional:" << param << " stream:os_ tag:" << tag << "];"; + out << "[" << helper << " writeOptional:" << param << " stream:ostr tag:" << tag << "];"; } else { - out << "[" << helper << " readOptional:&" << param << " stream:is_ tag:" << tag << "];"; + out << "[" << helper << " readOptional:&" << param << " stream:istr tag:" << tag << "];"; } return; } @@ -1021,11 +1034,11 @@ Slice::ObjCGenerator::writeOptParamMarshalUnmarshalCode(Output &out, const TypeP out << nl; if(marshal) { - out << "[" << helper << " writeOptional:" << param << " stream:os_ tag:" << tag << "];"; + out << "[" << helper << " writeOptional:" << param << " stream:ostr tag:" << tag << "];"; } else { - out << param << " = [" << helper << " readOptional:is_ tag:" << tag << "];"; + out << param << " = [" << helper << " readOptional:istr tag:" << tag << "];"; } } diff --git a/cpp/src/slice2objc/ObjCUtil.h b/cpp/src/slice2objc/ObjCUtil.h index 7c8236ede63..abf46773226 100644 --- a/cpp/src/slice2objc/ObjCUtil.h +++ b/cpp/src/slice2objc/ObjCUtil.h @@ -51,6 +51,7 @@ protected: 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 getParamName(const ContainedPtr&, bool = false); static std::string getFactoryMethod(const ContainedPtr&, bool); static std::string typeToString(const TypePtr&); static std::string inTypeToString(const TypePtr&, bool, bool = false, bool = false); |