bool LFPointer::IsEqual( const LFLeafStruct& target ) const /*********************************************************/ { return ( AttrEqual(_pointer.attr, dc(target)._pointer.attr) && TypeEqual( _pointer.type, dc(target)._pointer.type ) && TypeEqual( _trailingType, dc(target)._trailingType) ); }
bool LFVBClass::IsSubFieldEqual( const LFSubField& target ) const /***************************************************************/ { return ( AttrEqual(_vbClass.attr, dc(target)._vbClass.attr) && TypeEqual(_vbClass.btype, dc(target)._vbClass.btype) && TypeEqual(_vbClass.vtype, dc(target)._vbClass.vtype) ); }
bool LFClass::IsEqual( const LFLeafStruct& target ) const /*******************************************************/ { return ( _class.count == dc(target)._class.count && AttrEqual( _class.property, dc(target)._class.property ) && TypeEqual( _class.field, dc(target)._class.field ) && TypeEqual( _class.vshape, dc(target)._class.vshape ) ); }
bool LFEnum::IsEqual( const LFLeafStruct& target ) const /******************************************************/ { return ( _enum.count == dc(target)._enum.count && AttrEqual( _enum.property, dc(target)._enum.property ) && TypeEqual( _enum.type, dc(target)._enum.type) && TypeEqual( _enum.fList, dc(target)._enum.fList ) ); }
bool LFProcedure::IsEqual( const LFLeafStruct& target ) const /***********************************************************/ { return ( _procedure.call == dc(target)._procedure.call && _procedure.parms == dc(target)._procedure.parms && TypeEqual( _procedure.rvtype, dc(target)._procedure.rvtype ) && TypeEqual( _procedure.arglist, dc(target)._procedure.arglist ) ); }
bool LFMFunction::IsEqual( const LFLeafStruct& target ) const /***********************************************************/ { return ( _mFunction.call == dc(target)._mFunction.call && _mFunction.parms == dc(target)._mFunction.parms && _mFunction.thisadjust == dc(target)._mFunction.thisadjust && TypeEqual( _mFunction.thisptr, dc(target)._mFunction.thisptr ) && TypeEqual( _mFunction.rvtype, dc(target)._mFunction.rvtype ) && TypeEqual( _mFunction.class_idx, dc(target)._mFunction.class_idx ) && TypeEqual( _mFunction.arglist, dc(target)._mFunction.arglist ) ); }
bool LFUnion::IsEqual( const LFLeafStruct& target ) const /*******************************************************/ { return ( _union.count == dc(target)._union.count && AttrEqual( _union.property, dc(target)._union.property ) && TypeEqual( _union.field, dc(target)._union.field ) ); }
bool LFBitField::IsEqual( const LFLeafStruct& target ) const /**********************************************************/ { return ( _bitField.length == dc(target)._bitField.length && _bitField.position == dc(target)._bitField.position && TypeEqual( _bitField.type, dc(target)._bitField.type) ); }
bool LFLeafStruct::TypeListEqual( const type_index* refIndices, const type_index* tIndices, const uint count ) { for ( uint i = 0; i < count; i++ ) { if ( ! TypeEqual(refIndices[i], tIndices[i] ) ) { return false; } } return true; }
bool LFMethodList::IsEqual( const LFLeafStruct& target ) const /************************************************************/ { if ( _mList -> entries() != dc(target)._mList -> entries() ) { return false; } WCPtrConstSListIter<my_ct_mlist> refIter(*_mList); WCPtrConstSListIter<my_ct_mlist> tIter(*dc(target)._mList); my_ct_mlist* refPtr; my_ct_mlist* tPtr; while ( ++refIter && ++tIter ) { refPtr = refIter.current(); tPtr = tIter.current(); if ( refPtr -> vtab != tPtr-> vtab || ! AttrEqual( refPtr -> attr, tPtr -> attr ) || ! TypeEqual( refPtr -> type, tPtr -> type ) ) { return false; } } return true; }
Cjson Cjson::operator = (int nNum){ string strTemp = ""; CStringManager::Format(strTemp,"%d",nNum); return *(TypeEqual(strTemp)); }
bool LFDimConlu::IsEqual( const LFLeafStruct& target ) const /**********************************************************/ { return ( _dimConlu.rank == dc(target)._dimConlu.rank && TypeEqual(_dimConlu.index, dc(target)._dimConlu.index) ); }
bool LFDefArg::IsEqual( const LFLeafStruct& target ) const /********************************************************/ { return TypeEqual( _defArg.index, dc(target)._defArg.index ); }
bool LFDimArray::IsEqual( const LFLeafStruct& target ) const /**********************************************************/ { return ( TypeEqual( _dimArray.diminfo, dc(target)._dimArray.diminfo ) && TypeEqual( _dimArray.utype, dc(target)._dimArray.utype ) ); }
bool LFOneMethod::IsSubFieldEqual( const LFSubField& target ) const /*****************************************************************/ { return ( AttrEqual(_oneMethod.attr, dc(target)._oneMethod.attr) && TypeEqual(_oneMethod.type, dc(target)._oneMethod.type) ); }
bool LFVFuncTab::IsSubFieldEqual( const LFSubField& target ) const /****************************************************************/ { return TypeEqual(_vFuncTab.type, dc(target)._vFuncTab.type); }
bool LFMethod::IsSubFieldEqual( const LFSubField& target ) const /**************************************************************/ { return ( _method.count == dc(target)._method.count && TypeEqual(_method.mList,dc(target)._method.mList) ); }
Cjson Cjson::operator = (double dNum){ string strTemp = ""; CStringManager::Format(strTemp,"%lf", dNum); return *(TypeEqual(strTemp)); }
Cjson Cjson::operator = (string str){ string strTemp = ""; CStringManager::Format(strTemp,"\"%s\"", str); return *(TypeEqual(strTemp)); }
bool LFArray::IsEqual( const LFLeafStruct& target ) const /*******************************************************/ { return ( TypeEqual( _array.elemtype, dc(target)._array.elemtype) && TypeEqual( _array.idxtype,dc(target)._array.idxtype) ); }
bool LFIndex::IsSubFieldEqual( const LFSubField& target ) const /*************************************************************/ { return ( TypeEqual(_index.index, dc(target)._index.index) ); }
/* Must mutate original if changes required for consistency */ GLOBAL void FunctionConflict(Node *orig, Node *create) { Node *ofdcl, *nfdcl; assert(orig); assert(create); assert(orig->typ == Decl); assert(create->typ == Decl); ofdcl = NodeDataType(orig); nfdcl = NodeDataType(create); if (ofdcl->typ != Fdcl || nfdcl->typ != Fdcl) goto Mismatch; /* * Check if one declaration is T_PROCEDURE and the other is not. * BUG: I think the whole way we treat 'cilk' and 'inlet' keywords * is broken. We treat 'cilk' like 'const', but * * const int foo() * * is not the same as * * cilk int foo() * * The former returns a 'const int', but the latter does not return a * 'cilk int' ! - athena * * BTW, the following line is a hack :-) * ((ofdcl->u.fdcl.tq ^ nfdcl->u.fdcl.tq) & (T_PROCEDURE | T_INLET)) * Bradley rewrote it has follows: */ if ((tq_has_procedure(ofdcl->u.fdcl.tq) != tq_has_procedure(nfdcl->u.fdcl.tq)) || (tq_has_inlet(ofdcl->u.fdcl.tq) != tq_has_inlet(nfdcl->u.fdcl.tq))) goto Mismatch; /* The Result Type must be equal */ if (!TypeEqual(ofdcl->u.fdcl.returns, nfdcl->u.fdcl.returns)) goto Mismatch; /* Inspect the parameter lists */ { List *optr = ofdcl->u.fdcl.args, *nptr = nfdcl->u.fdcl.args; /* Are both definitions in prototype form? */ if (optr && nptr) { /* Then every parameter must be compatible */ for (; optr && nptr; optr = Rest(optr), nptr = Rest(nptr)) { Node *oitem = FirstItem(optr), *otype = NodeDataType(oitem), *nitem = FirstItem(nptr), *ntype = NodeDataType(nitem); if (!TypeEqualFormals(otype, ntype)) { SetItem(optr, nitem); goto Mismatch; } } /* And the parameter lists must be of the same length */ if (optr || nptr) goto Mismatch; } /* Check for <Type> f(void) vs <Type> f() */ else if (IsVoidArglist(optr)); /* Check for <Type> f() vs <Type> f(void) */ else if (IsVoidArglist(nptr)) ofdcl->u.fdcl.args = MakeNewList(PrimVoid); /* Else the provided types must be the "usual unary conversions" */ else { /* Either this loop will run */ for (; optr; optr = Rest(optr)) { Node *oitem = FirstItem(optr), *otype = NodeDataType(oitem); if (!TypeEqual(otype, UsualUnaryConversionType(otype)) || IsEllipsis(otype)) goto Mismatch; } /* Or this one will */ for (; nptr; nptr = Rest(nptr)) { Node *nitem = FirstItem(nptr), *ntype = NodeDataType(nitem); if (!TypeEqual(ntype, UsualUnaryConversionType(ntype)) || IsEllipsis(ntype)) goto Mismatch; } } } return; Mismatch: SyntaxErrorCoord(create->coord, "identifier `%s' redeclared", VAR_NAME(orig)); fprintf(stderr, "\tPrevious declaration: "); PRINT_COORD(stderr, orig->coord); fputc('\n', stderr); return; }
bool LFMember::IsSubFieldEqual( const LFSubField& target ) const /**************************************************************/ { return ( AttrEqual(_member.attr, dc(target)._member.attr) && TypeEqual(_member.type, dc(target)._member.type) ); }
bool LFModifier::IsEqual( const LFLeafStruct& target ) const /**********************************************************/ { return ( AttrEqual(_modifier.attr, dc(target)._modifier.attr ) && TypeEqual(_modifier.index, dc(target)._modifier.index) ); }
bool LFNestedType::IsSubFieldEqual( const LFSubField& target ) const /******************************************************************/ { return TypeEqual(_nestedType.index, dc(target)._nestedType.index); }
bool LFCobol0::IsEqual( const LFLeafStruct& target ) const /********************************************************/ { return TypeEqual( _cobol0.parent, dc(target)._cobol0.parent ); }
bool LFFriendCls::IsSubFieldEqual( const LFSubField& target ) const /*****************************************************************/ { return TypeEqual(_friendCls.type, dc(target)._friendCls.type); }
bool LFBArray::IsEqual( const LFLeafStruct& target ) const /********************************************************/ { return TypeEqual( _bArray.type, dc(target)._bArray.type ); }
bool LFVFuncOff::IsSubFieldEqual( const LFSubField& target ) const /****************************************************************/ { return ( _vFuncOff.offset == dc(target)._vFuncOff.offset && TypeEqual(_vFuncOff.type, dc(target)._vFuncOff.type) ); }
/* DEAD CODE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ GLOBAL Bool IsCompatibleFdcls(Node *node1, Node *node2) { assert(node1->typ == Fdcl); assert(node2->typ == Fdcl); #if 0 printf("IsCompatibleFdcls\n"); PrintNode(stdout, node1, 0); printf("\n"); PrintNode(stdout, node2, 0); printf("\n"); #endif /* The Result Type must be equal */ if (!TypeEqual(node1->u.fdcl.returns, node2->u.fdcl.returns)) return FALSE; /* Inspect the parameter lists */ { List *optr = node1->u.fdcl.args, *nptr = node2->u.fdcl.args; /* Are both definitions in prototype form? */ if (optr && nptr) { /* Then every parameter must be compatible */ for (; optr && nptr; optr = Rest(optr), nptr = Rest(nptr)) { Node *oitem = FirstItem(optr), *otype = NodeDataType(oitem), *nitem = FirstItem(nptr), *ntype = NodeDataType(nitem); if (!TypeEqual(otype, ntype)) { #if 0 PrintNode(stdout, otype, 0); printf("\n"); PrintNode(stdout, ntype, 0); printf("\n"); #endif return FALSE; } } /* And the parameter lists must be of the same length */ if (optr || nptr) return FALSE; else return TRUE; } /* Check for <Type> f(void) vs <Type> f() */ else if (IsVoidArglist(optr)) return TRUE; /* Check for <Type> f() vs <Type> f(void) */ else if (IsVoidArglist(nptr)) return TRUE; /* Else the provided types must be the "usual unary conversions" */ else { /* Either this loop will run */ for (; optr; optr = Rest(optr)) { Node *oitem = FirstItem(optr), *otype = NodeDataType(oitem); if (!TypeEqual(otype, UsualUnaryConversionType(otype)) || IsEllipsis(otype)) return FALSE; } /* Or this one will */ for (; nptr; nptr = Rest(nptr)) { Node *nitem = FirstItem(nptr), *ntype = NodeDataType(nitem); if (!TypeEqual(ntype, UsualUnaryConversionType(ntype)) || IsEllipsis(ntype)) return FALSE; } return TRUE; } } }