* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: list.h
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
* The above named program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public
* License along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
* ========== Copyright Header End ============================================
* Linear list manipulation stuff
* primarily used for the parser
#define LINEAR_LIST_INIT( _list, _type ) do { \
(_list).listbasep = (_type*)0; \
#define LINEAR_LIST_ADD( _list, _type ) ( \
(_list).listbasep = Xrealloc( (_list).listbasep,\
(_list).count * sizeof( _type ) ), \
&((_list).listbasep[ (_list).count - 1 ]) \
#define LINEAR_LIST_ENTRY( _list, _idx ) ( \
&((_list).listbasep[ (_idx) ]) \
#define LINEAR_LIST_DEF( _listname, _type ) \
* .. a dynamically allocated linear list of pointers to objects
#define LIST_INIT( _list, _type ) \
LINEAR_LIST_INIT( _list, _type * )
#define LIST_ADD( _list, _type ) ( \
*LINEAR_LIST_ADD( _list, _type * ) = (_type*)Xcalloc(1, _type) \
#define LIST_ADD_PTR( _list, _type, _ptr ) ( \
*LINEAR_LIST_ADD( _list, _type * ) = (_type*)(_ptr) \
#define LIST_ENTRY( _list, _idx ) ( \
*LINEAR_LIST_ENTRY( _list, _idx ) \
#define LIST_DEF( _listname, _type ) \
LINEAR_LIST_DEF( _listname, _type *)
#endif /* #ifndef _LIST_H_ */