Translate a 32-bit unsigned string address, to a pointer to an (encoded) string
| Return Type | Function name | Arguments |
|---|---|---|
| unsigned char* | hzSMAR::Xlate | (uint32_t,) |
Declared in file: hzSMAR.h
Defined in file : hzSMAR.cpp
Function Logic:
Function body:
unsigned char* hzSMAR::Xlate (uint32_t ssrAddr)
{
// Translate a 32-bit unsigned string address, to a pointer to an (encoded) string
//
// Argument: ssrAddr The address
//
// Returns: The encoded string OR
// NULL if not located
_hzfunc("hzSMAR::Xlate") ;
_smarBloc* pBloc ; // Pointer to superblock
uint32_t* pSeg ; // Data segment
uint32_t blocNo ; // Offset within vector of blocks
uint32_t slotNo ; // String slot within block
if (!this)
hzexit(E_CORRUPT, "No instance") ;
if (!ssrAddr)
{
threadLog("SMAR %u: CORRUPT: Should not be called to xlate NULL address\n", m_nCode) ;
return 0;
}
slotNo = ssrAddr & SMAR_SLOT_MASK ;
blocNo = (ssrAddr & SMAR_BLOC_MASK) >> 16;
if (!blocNo)
return (uchar*) m_Heap[slotNo] ;
if (blocNo > m_Super.Count())
{
threadLog("CORRUPT: Cannot xlate address %u:%u. No such superblock (%u issued)\n", blocNo, slotNo, m_Super.Count()) ;
return 0;
}
if (_hzGlobal_MT)
m_lockSbloc.Lock() ;
pBloc = m_Super[blocNo] ;
if (_hzGlobal_MT)
m_lockSbloc.Unlock() ;
if (!pBloc)
{
threadLog("CORRUPT: No block found for address %u:%u. Total of %u superblocks issued)\n", blocNo, slotNo, m_Super.Count()) ;
return 0;
}
pSeg = pBloc->m_Space ;
pSeg += slotNo ;
return (uchar*) pSeg ;
}