packtype.cpp
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C++ 代码 · 共 1,370 行 · 第 1/3 页
CPP
1,370 行
}
bool LFSubField::IsEqual( const LFLeafStruct& target ) const
/**********************************************************/
{
return ( _recordLength == dc(target)._recordLength &&
IsSubFieldEqual(dc(target)) );
}
bool LFFieldList::IsEqual( const LFLeafStruct& target ) const
/***********************************************************/
{
WCPtrConstSListIter<LFSubField> refIter( _subFieldList );
WCPtrConstSListIter<LFSubField> targetIter( dc(target)._subFieldList );
while ( ++targetIter && ++refIter ) {
if ( ! refIter.current() -> IsEquivalent( *targetIter.current() ) ) {
return FALSE;
}
}
return TRUE;
}
void LFLeafStruct::FixTypeList( type_index* tList,
const uint count )
/*******************************************************/
{
for ( uint i = 0; i < count; i++ ) {
tList[i] = TypeMap.Lookup(tList[i]);
}
}
void LFModifier::FixTypeIndex()
/*****************************/
{
_modifier.index = TypeMap.Lookup(_modifier.index);
}
void LFPointer::FixTypeIndex()
/****************************/
{
_pointer.type = TypeMap.Lookup(_pointer.type);
}
void LFArray::FixTypeIndex()
/**************************/
{
_array.elemtype = TypeMap.Lookup(_array.elemtype);
_array.idxtype = TypeMap.Lookup(_array.idxtype);
}
void LFClass::FixTypeIndex()
/**************************/
{
_class.field = TypeMap.Lookup(_class.field);
_class.dList = TypeMap.Lookup(_class.dList);
_class.vshape = TypeMap.Lookup(_class.vshape);
}
void LFUnion::FixTypeIndex()
/**************************/
{
_union.field = TypeMap.Lookup(_union.field);
}
void LFEnum::FixTypeIndex()
/*************************/
{
_enum.type = TypeMap.Lookup(_enum.type);
_enum.fList = TypeMap.Lookup(_enum.fList);
}
void LFProcedure::FixTypeIndex()
/******************************/
{
_procedure.rvtype = TypeMap.Lookup(_procedure.rvtype);
_procedure.arglist = TypeMap.Lookup(_procedure.arglist);
}
void LFMFunction::FixTypeIndex()
/******************************/
{
_mFunction.rvtype = TypeMap.Lookup(_mFunction.rvtype);
_mFunction.class_idx = TypeMap.Lookup(_mFunction.class_idx);
_mFunction.thisptr = TypeMap.Lookup(_mFunction.thisptr);
_mFunction.arglist = TypeMap.Lookup(_mFunction.arglist);
}
void LFCobol0::FixTypeIndex()
/***************************/
{
_cobol0.parent = TypeMap.Lookup(_cobol0.parent);
}
void LFCobol1::FixTypeIndex()
/***************************/
{
}
void LFBArray::FixTypeIndex()
/***************************/
{
_bArray.type = TypeMap.Lookup(_bArray.type);
}
void LFLabel::FixTypeIndex()
/***************************/
{
}
void LFDimArray::FixTypeIndex()
/*****************************/
{
_dimArray.utype = TypeMap.Lookup(_dimArray.utype);
_dimArray.diminfo = TypeMap.Lookup(_dimArray.diminfo);
}
void LFVftPath::FixTypeIndex()
/****************************/
{
LFLeafStruct::FixTypeList(_bases,_vftPath.count);
}
void LFArgList::FixTypeIndex()
/****************************/
{
LFLeafStruct::FixTypeList(_indices,_argList.argcount);
}
void LFDefArg::FixTypeIndex()
/***************************/
{
_defArg.index = TypeMap.Lookup(_defArg.index);
}
void LFFieldList::FixTypeIndex()
/******************************/
{
WCPtrSListIter<LFSubField> iter(_subFieldList);
while ( ++iter ) {
iter.current() -> FixTypeIndex();
}
}
void LFDerived::FixTypeIndex()
/**************************/
{
LFLeafStruct::FixTypeList(_indices, _derived.count);
}
void LFBitField::FixTypeIndex()
/***************************/
{
_bitField.type = TypeMap.Lookup(_bitField.type);
}
void LFMethodList::FixTypeIndex()
/*******************************/
{
WCPtrConstSListIter<my_ct_mlist> iter(*_mList);
while ( ++iter ) {
iter.current() -> type = TypeMap.Lookup(iter.current()->type);
}
}
void LFDimConu::FixTypeIndex()
/****************************/
{
_dimConu.index = TypeMap.Lookup(_dimConu.index);
}
void LFDimConlu::FixTypeIndex()
/*****************************/
{
_dimConlu.index = TypeMap.Lookup(_dimConlu.index);
}
void LFBClass::FixTypeIndex()
/***************************/
{
_bClass.type = TypeMap.Lookup(_bClass.type);
}
void LFVBClass::FixTypeIndex()
/****************************/
{
_vbClass.btype = TypeMap.Lookup(_vbClass.btype);
_vbClass.vtype = TypeMap.Lookup(_vbClass.vtype);
}
void LFEnumerate::FixTypeIndex()
/*****************************/
{
}
void LFFriendFcn::FixTypeIndex()
/******************************/
{
_friendFcn.type = TypeMap.Lookup(_friendFcn.type);
}
void LFIndex::FixTypeIndex()
/**************************/
{
_index.index = TypeMap.Lookup(_index.index);
}
void LFMember::FixTypeIndex()
/***************************/
{
_member.type = TypeMap.Lookup(_member.type);
}
void LFMethod::FixTypeIndex()
/***************************/
{
_method.mList = TypeMap.Lookup(_method.mList);
}
void LFNestedType::FixTypeIndex()
/*******************************/
{
_nestedType.index = TypeMap.Lookup(_nestedType.index);
}
void LFVFuncTab::FixTypeIndex()
/*****************************/
{
_vFuncTab.type = TypeMap.Lookup(_vFuncTab.type);
}
void LFFriendCls::FixTypeIndex()
/******************************/
{
_friendCls.type = TypeMap.Lookup(_friendCls.type);
}
void LFOneMethod::FixTypeIndex()
/******************************/
{
_oneMethod.type = TypeMap.Lookup(_oneMethod.type);
}
void LFVFuncOff::FixTypeIndex()
/*****************************/
{
_vFuncOff.type = TypeMap.Lookup(_vFuncOff.type);
}
LFLeafStruct* LFNotTrans::Construct( const char*, const uint )
/************************************************************/
{
return new LFNotTrans();
}
LFLeafStruct* LFNull::Construct( const char*, const uint)
/*******************************************************/
{
return new LFNull();
}
LFLeafStruct* LFModifier::Construct( const char* ptr,
const uint length )
/*******************************************************/
{
return new LFModifier ( *(lf_modifier *) (ptr),
ptr + sizeof(lf_modifier),
length - sizeof(lf_modifier) );
}
LFLeafStruct* LFPointer::Construct( const char* ptr,
const uint length )
/******************************************************/
{
lf_pointer pointer = * (lf_pointer*) ptr;
ptr += sizeof(lf_pointer);
type_index trailingType = NO_TYPING_INFO;
uint trailingLen = length - sizeof(lf_pointer);
if ( pointer.f.attr.f.type == CV_BASETYPE ||
pointer.f.attr.f.mode == CV_PTRTOMEMBER ||
pointer.f.attr.f.mode == CV_PTRTOMETHOD ) {
trailingType = * (type_index *) ptr;
ptr += WORD;
trailingLen -= WORD;
}
return new LFPointer ( pointer, ptr, trailingLen, trailingType );
}
LFLeafStruct* LFArray::Construct( const char* ptr,
const uint length )
/****************************************************/
{
return new LFArray ( *(lf_array *) (ptr),
ptr + sizeof(lf_array),
length - sizeof(lf_array) );
}
LFLeafStruct* LFClass::Construct( const char* ptr,
const uint length )
/****************************************************/
{
return new LFClass ( *(lf_class *) (ptr),
ptr + sizeof(lf_class),
length - sizeof(lf_class) );
}
LFLeafStruct* LFUnion::Construct( const char* ptr,
const uint length )
/****************************************************/
{
return new LFUnion ( *(lf_union *) (ptr),
ptr + sizeof(lf_union),
length - sizeof(lf_union) );
}
LFLeafStruct* LFEnum::Construct( const char* ptr,
const uint length )
/***************************************************/
{
return new LFEnum ( *(lf_enum *) (ptr),
ptr + sizeof(lf_enum),
length - sizeof(lf_enum) );
}
LFLeafStruct* LFProcedure::Construct( const char* ptr,
const uint length )
/********************************************************/
{
return new LFProcedure ( *(lf_procedure *) (ptr),
ptr + sizeof(lf_procedure),
length - sizeof(lf_procedure) );
}
LFLeafStruct* LFMFunction::Construct( const char* ptr,
const uint length )
/********************************************************/
{
return new LFMFunction ( *(lf_mfunction *) (ptr),
ptr + sizeof(lf_mfunction),
length - sizeof(lf_mfunction) );
}
LFLeafStruct* LFVtShape::Construct( const char* ptr,
const uint length )
/******************************************************/
{
return new LFVtShape ( *(lf_vtshape *) (ptr),
ptr + sizeof(lf_vtshape),
length - sizeof(lf_vtshape) );
}
LFLeafStruct* LFCobol0::Construct( const char* ptr,
const uint length )
/*****************************************************/
{
return new LFCobol0 ( *(lf_cobol0 *) (ptr),
ptr + sizeof(lf_cobol0),
length - sizeof(lf_cobol0) );
}
LFLeafStruct* LFCobol1::Construct( const char* ptr,
const uint length )
/*****************************************************/
{
return new LFCobol1 ( *(lf_cobol1 *) (ptr),
ptr + sizeof(lf_cobol1),
length - sizeof(lf_cobol1) );
}
LFLeafStruct* LFBArray::Construct( const char* ptr,
const uint length )
/*****************************************************/
{
return new LFBArray ( *(lf_barray *) (ptr),
ptr + sizeof(lf_barray),
length - sizeof(lf_barray) );
}
LFLeafStruct* LFLabel::Construct( const char* ptr,
const uint length )
/****************************************************/
{
return new LFLabel ( *(lf_label *) (ptr),
ptr + sizeof(lf_label),
length - sizeof(lf_label) );
}
LFLeafStruct* LFDimArray::Construct( const char* ptr,
const uint length )
/*******************************************************/
{
return new LFDimArray ( *(lf_dimarray *) (ptr),
ptr + sizeof(lf_dimarray),
length - sizeof(lf_dimarray) );
}
LFLeafStruct* LFVftPath::Construct( const char* ptr,
const uint length )
/******************************************************/
{
const char* end = &ptr[length];
lf_vftpath vftPath = * (lf_vftpath *) ptr;
ptr += sizeof( lf_vftpath );
type_index* indices = NULL;
if ( vftPath.f.count > 0 ) {
indices = new type_index [vftPath.f.count];
for ( uint i = 0; i < vftPath.f.count; i++ ) {
indices[i] = * ( type_index * ) ptr;
ptr += sizeof( type_index );
}
}
return new LFVftPath ( vftPath, ptr, end-ptr, indices );
}
LFLeafStruct* LFArgList::Construct( const char* ptr,
const uint length )
/******************************************************/
{
const char* end = &ptr[length];
lf_arglist argList = * (lf_arglist *) ptr;
ptr += sizeof( lf_arglist );
type_index* indices = NULL;
if ( argList.f.argcount > 0 ) {
indices = new type_index [argList.f.argcount];
for ( uint i = 0; i < argList.f.argcount; i++ ) {
indices[i] = * ( type_index * ) ptr;
ptr += sizeof( type_index );
}
}
return new LFArgList ( argList, ptr, end-ptr, indices );
}
LFLeafStruct* LFDefArg::Construct( const char* ptr,
const uint length )
/*****************************************************/
{
return new LFDefArg ( *(lf_defarg *) (ptr),
ptr + sizeof(lf_defarg),
length - sizeof(lf_defarg) );
}
LFLeafStruct* LFDerived::Construct( const char* ptr,
const uint length )
/******************************************************/
{
const char* end = &ptr[length];
lf_derived derived = * (lf_derived *) ptr;
ptr += sizeof( lf_derived );
type_index* indices = NULL;
if ( derived.f.count > 0 ) {
indices = new type_index [derived.f.count];
for ( uint i = 0; i < derived.f.count; i++ ) {
indices[i] = * ( type_index * ) ptr;
ptr += sizeof( type_index );
}
}
return new LFDerived ( derived, ptr, end-ptr, indices );
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?