Esempio n. 1
0
static void DoInvoke( handle hndl, char *name, char_ring *parmlist )
{
    invokes     *inv;

    _Alloc( inv, sizeof( invokes ) + strlen( name ) );
    if( inv != NULL ) {
        inv->buff_size = CMD_LEN;
        _Alloc( inv->buff, inv->buff_size+1 ); /* extra for NULLCHAR */
    }
    if( inv == NULL || inv->buff == NULL ) {
        if( inv != NULL ) _Free( inv );
        FileClose( hndl );
        FreeRing( parmlist );
        Error( ERR_NONE, LIT( ERR_NO_MEMORY ) );
    }
    strcpy( inv->name, name );
    inv->in_size = 0;
    inv->in_off = 0;
    inv->flags = 0;
    inv->redirect = NULL;
    inv->inv_input = hndl;
    inv->prmlst = parmlist;
    inv->number = InvCount++;
    inv->line = 0;
    PushInpStack( inv, DoneInvLine, TRUE );
    TypeInpStack( INP_CMD_FILE );
}
Esempio n. 2
0
static image_entry *DoCreateImage( const char *exe, const char *symfile )
{
    image_entry         *image;
    image_entry         **owner;
    size_t              len;

    len = ( exe == NULL ) ? 0 : strlen( exe );
    _Alloc( image, sizeof( *image ) + len );
    if( image != NULL ) {
        memset( image, 0, sizeof( *image ) );
        if( len != 0 )
            memcpy( image->image_name, exe, len + 1 );
        if( symfile != NULL ) {
            _Alloc( image->symfile_name, strlen( symfile ) + 1 );
            if( image->symfile_name == NULL ) {
                _Free( image );
                image = NULL;
            } else {
                strcpy( image->symfile_name, symfile );
            }
        }
        if( image != NULL ) {
            image->mapper = MapAddrSystem;
            for( owner = &DbgImageList; *owner != NULL; owner = &(*owner)->link )
                ;
            *owner = image;
        }
    }
    return( image );
}
Esempio n. 3
0
name_list *SymCompInit( bool code, bool data, bool d2_only, bool dup_ok, mod_handle mod )
{
    sorted_names        *curr;
    walk_find           wf;

    for( curr = SortedNames; curr != NULL; curr = curr->next ) {
        if( code != curr->code )
            continue;
        if( data != curr->data )
            continue;
        if( d2_only != curr->d2_only )
            continue;
        if( dup_ok != curr->dup_ok )
            continue;
        if( mod != curr->mod )
            continue;
        return( &curr->list );
    }
    _Alloc( curr, sizeof( *curr ) );
    wf = 0;
    if( code )
        wf |= WF_CODE;
    if( data )
        wf |= WF_DATA;
    NameListInit( &curr->list, wf );
    NameListAddModules( &curr->list, mod, d2_only, dup_ok );
    curr->next = SortedNames;
    SortedNames = curr;
    curr->code = code;
    curr->data = data;
    curr->d2_only = d2_only;
    curr->dup_ok = dup_ok;
    curr->mod = mod;
    return( &curr->list );
}
Esempio n. 4
0
static image_entry *DoCreateImage( const char *exe, const char *symfile )
{
    image_entry         *image;
    image_entry         **owner;
    size_t              len;


    len = ( exe == NULL ) ? 0 : strlen( exe );
    _ChkAlloc( image, sizeof( *image ) + len, LIT_ENG( ERR_NO_MEMORY_FOR_DEBUG ) );
    if( image == NULL )
        return( NULL );
    memset( image, 0, sizeof( *image ) );
    if( len != 0 )
        memcpy( image->image_name, exe, len + 1 );
    if( symfile != NULL ) {
        _Alloc( image->symfile_name, strlen( symfile ) + 1 );
        if( image->symfile_name == NULL ) {
            _Free( image );
            Error( ERR_NONE, LIT_ENG( ERR_NO_MEMORY_FOR_DEBUG ) );
            return( NULL );
        }
        strcpy( image->symfile_name, symfile );
    }
    image->mapper = MapAddrSystem;
    for( owner = &DbgImageList; *owner != NULL; owner = &(*owner)->link )
        ;
    *owner = image;
    return( image );
}
Esempio n. 5
0
void *DIGCLIENTRY( Alloc )( size_t amount )
{
    void        *p;

    _Alloc( p, amount );
    return( p );
}
Esempio n. 6
0
SingleNet::SingleNet( const Configuration &config ) :
  Network( config )
{
  _ComputeSize( config );
  _Alloc( );
  _BuildNet( config );
}
	_Vectorfix_val(_Alloc _Al = _Alloc())
		: _Alval(_Al)
		{	// construct allocator from _Al
		_Myfirst = 0;
		_Mylast = 0;
		_Myend = 0;
		}
Esempio n. 8
0
void ProcInvoke( void )
{
    char      *fstart;
    unsigned   flen;
    char      *start;
    char_ring *parmlist;
    char_ring **owner;
    char_ring *path;
    unsigned   len;

    if( !ScanItem( TRUE, &fstart, &flen ) ) Error( ERR_LOC, LIT( ERR_WANT_FILENAME ) );
    parmlist = NULL;
    owner = &parmlist;
    while( !ScanEOC() ) {
        ScanItem( TRUE, &start, &len );
        _Alloc( path, sizeof( char_ring ) + len );
        if( path == NULL ) {
            FreeRing( parmlist );
            Error( ERR_NONE, LIT( ERR_NO_MEMORY ) );
        }
        memcpy( path->name, start, len );
        path->name[ len ] = NULLCHAR;
        path->next = NULL;
        *owner = path;
        owner = &path->next;
    }
    Invoke( fstart, (int)flen, parmlist );
}
Esempio n. 9
0
void MapAddrForImage( image_entry *image, addr_ptr *addr )
{
    map_entry           **owner;
    map_entry           *curr;
    addr_ptr            map_addr;
    addr_off            lo_bound;
    addr_off            hi_bound;

    for( owner = &image->map_list; (curr = *owner) != NULL; owner = &curr->link ) {
        if( curr->pre_map || InMapEntry( curr, addr ) ) {
            curr->map_addr = *addr;
            curr->pre_map = false;
            addr->segment = curr->real_addr.segment;
            addr->offset += curr->real_addr.offset;
            return;
        }
    }
    map_addr = *addr;
    image->mapper( image, addr, &lo_bound, &hi_bound );
    _Alloc( curr, sizeof( *curr ) );
    if( curr != NULL ) {
        curr->link = NULL;
        *owner = curr;
        curr->map_valid_lo = lo_bound;
        curr->map_valid_hi = hi_bound;
        curr->map_addr = map_addr;
        curr->map_addr.offset = 0;
        curr->real_addr = *addr;
        curr->real_addr.offset -= map_addr.offset;
        curr->pre_map = false;
    }
}
Esempio n. 10
0
name_list *SymCompInit( bool code, bool data, bool d2_only, bool dup_ok, mod_handle mod )
{
    void                *old;
    sorted_names        *curr;

    for( curr = SortedNames; curr != NULL; curr = curr->next ) {
        if( code != curr->code ) continue;
        if( data != curr->data ) continue;
        if( d2_only != curr->d2_only ) continue;
        if( dup_ok != curr->dup_ok ) continue;
        if( mod != curr->mod ) continue;
        return( &curr->list );
    }
    old = DUIHourGlass( NULL );
    _Alloc( curr, sizeof( *curr ) );
    NameListInit( &curr->list, ( code ? WF_CODE : 0 ) + ( data ? WF_DATA : 0 ) );
    NameListAddModules( &curr->list, mod, d2_only, dup_ok );
    DUIHourGlass( old );
    curr->next = SortedNames;
    SortedNames = curr;
    curr->code = code;
    curr->data = data;
    curr->d2_only = d2_only;
    curr->dup_ok = dup_ok;
    curr->mod = mod;
    return( &curr->list );
}
Esempio n. 11
0
KNFly::KNFly( const Configuration &config, const string & name ) :
Network( config, name )
{
  _ComputeSize( config );
  _Alloc( );
  _BuildNet( config );
}
Esempio n. 12
0
void AddAliasInfo( unsigned seg, unsigned alias )
{
    alias_info          **owner;
    alias_info          *curr;

    if( alias == 0 ) {
        owner = &HeadAliasTbl;
        for( ;; ) {
            curr = *owner;
            if( curr == NULL ) break;
            if( curr->seg == seg ) {
                (*owner)->next = curr->next;
                _Free( curr );
                return;
            }
            owner = &curr->next;
        }
    } else {
        _Alloc( curr, sizeof( alias_info ) );
        if( curr != NULL ) {
            curr->seg = seg;
            curr->alias = alias;
            curr->next = HeadAliasTbl;
            HeadAliasTbl = curr;
        }
    }
}
Esempio n. 13
0
void *DIGCLIENT DIGCliAlloc( size_t amount )
{
    void        *p;

    _Alloc( p, amount );
    return( p );
}
Esempio n. 14
0
KNFly::KNFly( const Configuration &config ) :
  Network( config )
{
  _ComputeSize( config );
  _Alloc( );
  _BuildNet( config );
}
Esempio n. 15
0
ACLStr::ACLStr(IN const ACLStr& str)
{
	size_t len(str.Len());
	_Init();
	_Alloc(len);
	STRNCPY_S(_string, _realLength, str._string, len); 
}	// ACLStr(IN const &ACLStr)
DragonFlyNew::DragonFlyNew( const Configuration &config, const string & name ) :
  Network( config, name )
{

  _ComputeSize( config );
  _Alloc( );
  _BuildNet( config );
}
Esempio n. 17
0
AnyNet::AnyNet( const Configuration &config, const string & name )
  :  Booksim_Network( config, name ){

  _ComputeSize( config );
  _Alloc( );
  _BuildNet( config );
  router_list.resize(2);
}
Esempio n. 18
0
FlatFlyOnChip::FlatFlyOnChip( const Configuration &config, const string & name ) :
  BSNetwork( config, name )
{

  _ComputeSize( config );
  _Alloc( );
  _BuildNet( config );
}
Esempio n. 19
0
KNCube::KNCube( const Configuration &config, bool mesh ) :
Network_gpgpu( config )
{
   _mesh = mesh;

   _ComputeSize( config );
   _Alloc( );
   _BuildNet( config );
}
Esempio n. 20
0
KNCube::KNCube( const Configuration &config, const string & name, bool mesh ) :
BSNetwork( config, name )
{
  _mesh = mesh;

  _ComputeSize( config );
  _Alloc( );
  _BuildNet( config );
}
Esempio n. 21
0
	hook_buffer(char* target_func,int target_prolog_len)
		: _target_func(target_func) , _target_prolog_len(target_prolog_len) , _status(false)
		{
			_buffer = _Alloc().allocate(target_prolog_len+lenJMP);
			if (!_buffer) { _status = false ; return ;}

			memcpy (_buffer                  ,target_func, target_prolog_len);
			asm_jmp(_buffer+target_prolog_len,target_func+ target_prolog_len);
			_status=true;
		}
Esempio n. 22
0
GUI_HMEM GUI_ALLOC_Alloc(int size) {
  GUI_HMEM hMem;
 /* First make sure that init has been called */
  GUI_LOCK();
  GUI_DEBUG_LOG2("\nGUI_ALLOC_Alloc... requesting %d, %d avail", size, GUI_ALLOC.NumFreeBytes);
  hMem = _Alloc(size);
  GUI_DEBUG_LOG1("\nGUI_ALLOC_Alloc : Handle", hMem);
  GUI_UNLOCK();
  return hMem;
}
Esempio n. 23
0
bool LangSetInit( void )
{
    static char InitialLang[] = { "cpp" };

    LangInit();
    _Alloc( Language, sizeof( InitialLang ) + 1 );
    if( Language == NULL )
        return( FALSE );
    StrCopy( InitialLang, Language );
    return( LangLoad( Language, strlen( Language ) ) );
}
Esempio n. 24
0
ACLStr::ACLStr(IN const BSTR bstr)
{
	_Init();
	if (bstr)
	{
		UINT nStrLen = ::SysStringLen(bstr);
		_Alloc(nStrLen);

		MakeLPTSTR(bstr);
	}
}	// ACLStr(IN BSTR)
Esempio n. 25
0
ACLStr::ACLStr(IN LPCTSTR str)
{
	_Init();

	if (str)
	{
		size_t len(STRLEN(str));
		_Alloc(len);
		STRNCPY_S(_string, _realLength, str, len); 
	}
}	// ACLStr(IN LPCTSTR)
Esempio n. 26
0
//! Writes a binary data as a table to a debug screen buffer beginning at the current cursor location.
//! \param pData [in] a pointer to a binary data.
//! \param nDataSize [in] a size of the binary data.
//! \return the number of characters written to the debug
int _PrintDebugHEXTable(char *pData,int nDataSize)
{
	TCHAR *pszString=(TCHAR *)_Alloc(3*(sizeof(TCHAR))*(nDataSize+1));

	_BinToHEXTable(pData,nDataSize,pszString);

	int nResult=_PrintDebugText(pszString);

	_Free(pszString);

	return nResult;
}
Esempio n. 27
0
/*********************************************************************
*
*       GUI_ALLOC_AllocNoInit
*/
GUI_HMEM GUI_ALLOC_AllocNoInit(GUI_ALLOC_DATATYPE Size) {
  GUI_HMEM hMem;
  if (Size == 0) {
    return (GUI_HMEM)0;
  }
  GUI_LOCK();
  GUI_DEBUG_LOG2("\nGUI_ALLOC_AllocNoInit... requesting %d, %d avail", Size, GUI_ALLOC.NumFreeBytes);
  hMem = _Alloc(Size);
  GUI_DEBUG_LOG1("\nGUI_ALLOC_AllocNoInit : Handle", hMem);
  GUI_UNLOCK();
  return hMem;
}
// vectorfix standard header fixed for aligned element types
#pragma once
#ifndef _MSVC100STDVECTORFIX_HPP_
#define _MSVC100STDVECTORFIX_HPP_
#ifndef RC_INVOKED
#include <memory>
#include <stdexcept>
#include <xfunctional>

 #pragma pack(push,_CRT_PACKING)
 #pragma warning(push,3)

 #pragma warning(disable: 4244)

_STD_BEGIN
 #define _VECTOR_ORPHAN_RANGE	(_ITERATOR_DEBUG_LEVEL == 2)

		// TEMPLATE CLASS _Vectorfix_const_iterator
template<class _Myvec>
	class _Vectorfix_const_iterator
		: public _Iterator012<random_access_iterator_tag,
			typename _Myvec::value_type,
			typename _Myvec::difference_type,
			typename _Myvec::const_pointer,
			typename _Myvec::const_reference,
			_Iterator_base>
	{	// iterator for nonmutable vector
public:
	typedef _Vectorfix_const_iterator<_Myvec> _Myiter;
	typedef random_access_iterator_tag iterator_category;

	typedef typename _Myvec::pointer _Tptr;
	typedef typename _Myvec::value_type value_type;
	typedef typename _Myvec::difference_type difference_type;
	typedef typename _Myvec::const_pointer pointer;
	typedef typename _Myvec::const_reference reference;

	_Vectorfix_const_iterator()
		: _Ptr(0)
		{	// construct with null pointer
		}

	_Vectorfix_const_iterator(_Tptr _Parg, const _Container_base *_Pvector)
		: _Ptr(_Parg)
		{	// construct with pointer _Parg
		this->_Adopt(_Pvector);
		}

	typedef pointer _Unchecked_type;

	_Myiter& _Rechecked(_Unchecked_type _Right)
		{	// reset from unchecked iterator
		this->_Ptr = (_Tptr)_Right;
		return (*this);
		}

	_Unchecked_type _Unchecked() const
		{	// make an unchecked iterator
		return (_Unchecked_type(this->_Ptr));
		}

	reference operator*() const
		{	// return designated object
 #if _ITERATOR_DEBUG_LEVEL == 2
		if (this->_Getcont() == 0
			|| this->_Ptr == 0
			|| this->_Ptr < ((_Myvec *)this->_Getcont())->_Myfirst
			|| ((_Myvec *)this->_Getcont())->_Mylast <= this->_Ptr)
			{	// report error
			_DEBUG_ERROR("vector iterator not dereferencable");
			_SCL_SECURE_OUT_OF_RANGE;
			}

 #elif _ITERATOR_DEBUG_LEVEL == 1
		_SCL_SECURE_VALIDATE(this->_Getcont() != 0);
		_SCL_SECURE_VALIDATE_RANGE(
			this->_Ptr != 0
			&& ((_Myvec *)this->_Getcont())->_Myfirst <= this->_Ptr
			&& this->_Ptr < ((_Myvec *)this->_Getcont())->_Mylast);
 #endif /* _ITERATOR_DEBUG_LEVEL */

		__analysis_assume(this->_Ptr != 0);

		return (*this->_Ptr);
		}

	pointer operator->() const
		{	// return pointer to class object
		return (&**this);
		}

	_Myiter& operator++()
		{	// preincrement
 #if _ITERATOR_DEBUG_LEVEL == 2
		if (this->_Getcont() == 0
			|| this->_Ptr == 0
			|| ((_Myvec *)this->_Getcont())->_Mylast <= this->_Ptr)
			{	// report error
			_DEBUG_ERROR("vector iterator not incrementable");
			_SCL_SECURE_OUT_OF_RANGE;
			}

 #elif _ITERATOR_DEBUG_LEVEL == 1
		_SCL_SECURE_VALIDATE(this->_Getcont() != 0);
		_SCL_SECURE_VALIDATE_RANGE(
			this->_Ptr != 0
			&& this->_Ptr < ((_Myvec *)this->_Getcont())->_Mylast);
 #endif /* _ITERATOR_DEBUG_LEVEL */

		++this->_Ptr;
		return (*this);
		}

	_Myiter operator++(int)
		{	// postincrement
		_Myiter _Tmp = *this;
		++*this;
		return (_Tmp);
		}

	_Myiter& operator--()
		{	// predecrement
 #if _ITERATOR_DEBUG_LEVEL == 2
		if (this->_Getcont() == 0
			|| this->_Ptr == 0
			|| this->_Ptr <= ((_Myvec *)this->_Getcont())->_Myfirst)
			{	// report error
			_DEBUG_ERROR("vector iterator not decrementable");
			_SCL_SECURE_OUT_OF_RANGE;
			}

 #elif _ITERATOR_DEBUG_LEVEL == 1
		_SCL_SECURE_VALIDATE(this->_Getcont() != 0);
		_SCL_SECURE_VALIDATE_RANGE(
			this->_Ptr != 0
			&& ((_Myvec *)this->_Getcont())->_Myfirst < this->_Ptr);
 #endif /* _ITERATOR_DEBUG_LEVEL */

		--this->_Ptr;
		return (*this);
		}

	_Myiter operator--(int)
		{	// postdecrement
		_Myiter _Tmp = *this;
		--*this;
		return (_Tmp);
		}

	_Myiter& operator+=(difference_type _Off)
		{	// increment by integer
 #if _ITERATOR_DEBUG_LEVEL == 2
		if (this->_Getcont() == 0
			|| this->_Ptr + _Off < ((_Myvec *)this->_Getcont())->_Myfirst
			|| ((_Myvec *)this->_Getcont())->_Mylast < this->_Ptr + _Off)
			{	// report error
			_DEBUG_ERROR("vector iterator + offset out of range");
			_SCL_SECURE_OUT_OF_RANGE;
			}

 #elif _ITERATOR_DEBUG_LEVEL == 1
		_SCL_SECURE_VALIDATE(this->_Getcont() != 0);
		_SCL_SECURE_VALIDATE_RANGE(
			((_Myvec *)this->_Getcont())->_Myfirst <= this->_Ptr + _Off
			&& this->_Ptr + _Off <= ((_Myvec *)this->_Getcont())->_Mylast);
 #endif /* _ITERATOR_DEBUG_LEVEL */

		_Ptr += _Off;
		return (*this);
		}

	_Myiter operator+(difference_type _Off) const
		{	// return this + integer
		_Myiter _Tmp = *this;
		return (_Tmp += _Off);
		}

	_Myiter& operator-=(difference_type _Off)
		{	// decrement by integer
		return (*this += -_Off);
		}

	_Myiter operator-(difference_type _Off) const
		{	// return this - integer
		_Myiter _Tmp = *this;
		return (_Tmp -= _Off);
		}

	difference_type operator-(const _Myiter& _Right) const
		{	// return difference of iterators
		_Compat(_Right);
		return (this->_Ptr - _Right._Ptr);
		}

	reference operator[](difference_type _Off) const
		{	// subscript
		return (*(*this + _Off));
		}

	bool operator==(const _Myiter& _Right) const
		{	// test for iterator equality
		_Compat(_Right);
		return (this->_Ptr == _Right._Ptr);
		}

	bool operator!=(const _Myiter& _Right) const
		{	// test for iterator inequality
		return (!(*this == _Right));
		}

	bool operator<(const _Myiter& _Right) const
		{	// test if this < _Right
		_Compat(_Right);
		return (this->_Ptr < _Right._Ptr);
		}

	bool operator>(const _Myiter& _Right) const
		{	// test if this > _Right
		return (_Right < *this);
		}

	bool operator<=(const _Myiter& _Right) const
		{	// test if this <= _Right
		return (!(_Right < *this));
		}

	bool operator>=(const _Myiter& _Right) const
		{	// test if this >= _Right
		return (!(*this < _Right));
		}

 #if _ITERATOR_DEBUG_LEVEL == 2
	void _Compat(const _Myiter& _Right) const
		{	// test for compatible iterator pair
		if (this->_Getcont() == 0
			|| this->_Getcont() != _Right._Getcont())
			{	// report error
			_DEBUG_ERROR("vector iterators incompatible");
			_SCL_SECURE_INVALID_ARGUMENT;
			}
		}

 #elif _ITERATOR_DEBUG_LEVEL == 1
	void _Compat(const _Myiter& _Right) const
		{	// test for compatible iterator pair
		_SCL_SECURE_VALIDATE(this->_Getcont() != 0);
		_SCL_SECURE_VALIDATE_RANGE(this->_Getcont() == _Right._Getcont());
		}

 #else /* _ITERATOR_DEBUG_LEVEL == 0 */
	void _Compat(const _Myiter&) const
		{	// test for compatible iterator pair
		}
 #endif /* _ITERATOR_DEBUG_LEVEL */

	_Tptr _Ptr;	// pointer to element in vector
	};

template<class _Myvec> inline
	typename _Vectorfix_const_iterator<_Myvec>::_Unchecked_type
		_Unchecked(_Vectorfix_const_iterator<_Myvec> _Iter)
	{	// convert to unchecked
	return (_Iter._Unchecked());
	}

template<class _Myvec> inline
	_Vectorfix_const_iterator<_Myvec>&
		_Rechecked(_Vectorfix_const_iterator<_Myvec>& _Iter,
			typename _Vectorfix_const_iterator<_Myvec>
				::_Unchecked_type _Right)
	{	// convert to checked
	return (_Iter._Rechecked(_Right));
	}

template<class _Myvec> inline
	_Vectorfix_const_iterator<_Myvec> operator+(
		typename _Vectorfix_const_iterator<_Myvec>::difference_type _Off,
		_Vectorfix_const_iterator<_Myvec> _Next)
	{	// add offset to iterator
	return (_Next += _Off);
	}

		// TEMPLATE CLASS _Vectorfix_iterator
template<class _Myvec>
	class _Vectorfix_iterator
		: public _Vectorfix_const_iterator<_Myvec>
	{	// iterator for mutable vector
public:
	typedef _Vectorfix_iterator<_Myvec> _Myiter;
	typedef _Vectorfix_const_iterator<_Myvec> _Mybase;
	typedef random_access_iterator_tag iterator_category;

	typedef typename _Myvec::value_type value_type;
	typedef typename _Myvec::difference_type difference_type;
	typedef typename _Myvec::pointer pointer;
	typedef typename _Myvec::reference reference;

	_Vectorfix_iterator()
		{	// construct with null vector pointer
		}

	_Vectorfix_iterator(pointer _Parg, const _Container_base *_Pvector)
		: _Mybase(_Parg, _Pvector)
		{	// construct with pointer _Parg
		}

	typedef pointer _Unchecked_type;

	_Myiter& _Rechecked(_Unchecked_type _Right)
		{	// reset from unchecked iterator
		this->_Ptr = _Right;
		return (*this);
		}

	_Unchecked_type _Unchecked() const
		{	// make an unchecked iterator
		return (_Unchecked_type(this->_Ptr));
		}

	reference operator*() const
		{	// return designated object
		return ((reference)**(_Mybase *)this);
		}

	pointer operator->() const
		{	// return pointer to class object
		return (&**this);
		}

	_Myiter& operator++()
		{	// preincrement
		++*(_Mybase *)this;
		return (*this);
		}

	_Myiter operator++(int)
		{	// postincrement
		_Myiter _Tmp = *this;
		++*this;
		return (_Tmp);
		}

	_Myiter& operator--()
		{	// predecrement
		--*(_Mybase *)this;
		return (*this);
		}

	_Myiter operator--(int)
		{	// postdecrement
		_Myiter _Tmp = *this;
		--*this;
		return (_Tmp);
		}

	_Myiter& operator+=(difference_type _Off)
		{	// increment by integer
		*(_Mybase *)this += _Off;
		return (*this);
		}

	_Myiter operator+(difference_type _Off) const
		{	// return this + integer
		_Myiter _Tmp = *this;
		return (_Tmp += _Off);
		}

	_Myiter& operator-=(difference_type _Off)
		{	// decrement by integer
		return (*this += -_Off);
		}

	_Myiter operator-(difference_type _Off) const
		{	// return this - integer
		_Myiter _Tmp = *this;
		return (_Tmp -= _Off);
		}

	difference_type operator-(const _Mybase& _Right) const
		{	// return difference of iterators
		return (*(_Mybase *)this - _Right);
		}

	reference operator[](difference_type _Off) const
		{	// subscript
		return (*(*this + _Off));
		}
	};

template<class _Myvec> inline
	typename _Vectorfix_iterator<_Myvec>::_Unchecked_type
		_Unchecked(_Vectorfix_iterator<_Myvec> _Iter)
	{	// convert to unchecked
	return (_Iter._Unchecked());
	}

template<class _Myvec> inline
	_Vectorfix_iterator<_Myvec>&
		_Rechecked(_Vectorfix_iterator<_Myvec>& _Iter,
			typename _Vectorfix_iterator<_Myvec>
				::_Unchecked_type _Right)
	{	// convert to checked
	return (_Iter._Rechecked(_Right));
	}

template<class _Myvec> inline
	_Vectorfix_iterator<_Myvec> operator+(
		typename _Vectorfix_iterator<_Myvec>::difference_type _Off,
		_Vectorfix_iterator<_Myvec> _Next)
	{	// add offset to iterator
	return (_Next += _Off);
	}

		// TEMPLATE CLASS _Vectorfix_val
template<class _Ty,
	class _Alloc>
	class _Vectorfix_val
		: public _Container_base
	{	// base class for vector to hold data
public:
	typedef typename _Alloc::template rebind<_Ty>::other _Alty;

 #if _ITERATOR_DEBUG_LEVEL == 0
	_Vectorfix_val(_Alloc _Al = _Alloc())
		: _Alval(_Al)
		{	// construct allocator from _Al
		_Myfirst = 0;
		_Mylast = 0;
		_Myend = 0;
		}

	~_Vectorfix_val()
		{	// destroy proxy
		}

 #else /* _ITERATOR_DEBUG_LEVEL == 0 */
	_Vectorfix_val(_Alloc _Al = _Alloc())
		: _Alval(_Al)
		{	// construct allocator from _Al
		typename _Alloc::template rebind<_Container_proxy>::other
			_Alproxy(_Alval);
		this->_Myproxy = _Alproxy.allocate(1);
		_Cons_val(_Alproxy, this->_Myproxy, _Container_proxy());
		this->_Myproxy->_Mycont = this;

		_Myfirst = 0;
		_Mylast = 0;
		_Myend = 0;
		}
Esempio n. 29
0
static void GetInitCmd( int pass )
{
    char    cmd[CMD_LEN];

    WantEquals();
    SkipSpaces();
    GetRawItem( cmd );
    if( pass == 2 ) {
        _Free( InitCmdList );
        _Alloc( InitCmdList, strlen( cmd ) + 1 );
        StrCopy( cmd, InitCmdList );
    }
}
Esempio n. 30
0
const ACLStr& ACLStr::operator=(IN const BSTR bstr)
{
	_SafeInit();
	
	if (bstr)
	{
		UINT nStrLen = SysStringLen(bstr);
		
		_Alloc(nStrLen);
		MakeLPTSTR(bstr);
	}
	
	return *this;
}