Back to index

cell-binutils  2.17cvs20070401
Classes | Defines | Functions | Variables
obstack.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _obstack_chunk
struct  obstack

Defines

#define __PTR_TO_INT(P)   ((P) - (char *) 0)
#define __INT_TO_PTR(P)   ((P) + (char *) 0)
#define PTR_INT_TYPE   long
#define _obstack_memcpy(To, From, N)   bcopy ((char *)(From), (To), (N))
#define obstack_base(h)   ((h)->object_base)
#define obstack_chunk_size(h)   ((h)->chunk_size)
#define obstack_next_free(h)   ((h)->next_free)
#define obstack_alignment_mask(h)   ((h)->alignment_mask)
#define obstack_init(h)
#define obstack_begin(h, size)
#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun)
#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg)
#define obstack_chunkfun(h, newchunkfun)   ((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun))
#define obstack_freefun(h, newfreefun)   ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun))
#define obstack_1grow_fast(h, achar)   (*((h)->next_free)++ = (achar))
#define obstack_blank_fast(h, n)   ((h)->next_free += (n))
#define obstack_memory_used(h)   _obstack_memory_used (h)
#define obstack_object_size(h)   (unsigned) ((h)->next_free - (h)->object_base)
#define obstack_room(h)   (unsigned) ((h)->chunk_limit - (h)->next_free)
#define obstack_empty_p(h)   ((h)->chunk->prev == 0 && (h)->next_free - (h)->chunk->contents == 0)
#define obstack_make_room(h, length)
#define obstack_grow(h, where, length)
#define obstack_grow0(h, where, length)
#define obstack_1grow(h, datum)
#define obstack_ptr_grow(h, datum)
#define obstack_int_grow(h, datum)
#define obstack_ptr_grow_fast(h, aptr)   (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr))
#define obstack_int_grow_fast(h, aint)   (((int *) ((h)->next_free += sizeof (int)))[-1] = (aptr))
#define obstack_blank(h, length)
#define obstack_alloc(h, length)   (obstack_blank ((h), (length)), obstack_finish ((h)))
#define obstack_copy(h, where, length)   (obstack_grow ((h), (where), (length)), obstack_finish ((h)))
#define obstack_copy0(h, where, length)   (obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
#define obstack_finish(h)
#define obstack_free(h, obj)

Functions

void _obstack_newchunk (struct obstack *, int)
void _obstack_free (struct obstack *, void *)
int _obstack_begin (struct obstack *, int, int, void *(*)(long), void(*)(void *))
int _obstack_begin_1 (struct obstack *, int, int, void *(*)(void *, long), void(*)(void *, void *), void *)
int _obstack_memory_used (struct obstack *)
void obstack_init (struct obstack *obstack)
void * obstack_alloc (struct obstack *obstack, int size)
void * obstack_copy (struct obstack *obstack, void *address, int size)
void * obstack_copy0 (struct obstack *obstack, void *address, int size)
void obstack_free (struct obstack *obstack, void *block)
void obstack_blank (struct obstack *obstack, int size)
void obstack_grow (struct obstack *obstack, void *data, int size)
void obstack_grow0 (struct obstack *obstack, void *data, int size)
void obstack_1grow (struct obstack *obstack, int data_char)
void obstack_ptr_grow (struct obstack *obstack, void *data)
void obstack_int_grow (struct obstack *obstack, int data)
void * obstack_finish (struct obstack *obstack)
int obstack_object_size (struct obstack *obstack)
int obstack_room (struct obstack *obstack)
void obstack_make_room (struct obstack *obstack, int size)
void obstack_1grow_fast (struct obstack *obstack, int data_char)
void obstack_ptr_grow_fast (struct obstack *obstack, void *data)
void obstack_int_grow_fast (struct obstack *obstack, int data)
void obstack_blank_fast (struct obstack *obstack, int size)
void * obstack_base (struct obstack *obstack)
void * obstack_next_free (struct obstack *obstack)
int obstack_alignment_mask (struct obstack *obstack)
int obstack_chunk_size (struct obstack *obstack)
int obstack_memory_used (struct obstack *obstack)

Variables

void(* obstack_alloc_failed_handler )(void)
int obstack_exit_failure

Class Documentation

struct _obstack_chunk

Definition at line 157 of file obstack.h.

Collaboration diagram for _obstack_chunk:
Class Members
char contents
char * limit
struct _obstack_chunk * prev

Define Documentation

#define __INT_TO_PTR (   P)    ((P) + (char *) 0)

Definition at line 126 of file obstack.h.

#define __PTR_TO_INT (   P)    ((P) - (char *) 0)

Definition at line 122 of file obstack.h.

#define _obstack_memcpy (   To,
  From,
  N 
)    bcopy ((char *)(From), (To), (N))

Definition at line 153 of file obstack.h.

#define obstack_1grow (   h,
  datum 
)
Value:
( (((h)->next_free + 1 > (h)->chunk_limit)                            \
   ? (_obstack_newchunk ((h), 1), 0) : 0),                            \
  obstack_1grow_fast (h, datum))

Definition at line 482 of file obstack.h.

#define obstack_1grow_fast (   h,
  achar 
)    (*((h)->next_free)++ = (achar))

Definition at line 289 of file obstack.h.

#define obstack_alignment_mask (   h)    ((h)->alignment_mask)

Definition at line 262 of file obstack.h.

#define obstack_alloc (   h,
  length 
)    (obstack_blank ((h), (length)), obstack_finish ((h)))

Definition at line 509 of file obstack.h.

#define obstack_base (   h)    ((h)->object_base)

Definition at line 250 of file obstack.h.

#define obstack_begin (   h,
  size 
)
Value:
_obstack_begin ((h), (size), 0, \
                (void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)

Definition at line 270 of file obstack.h.

#define obstack_blank (   h,
  length 
)
Value:
( (h)->temp = (length),                                               \
  (((h)->chunk_limit - (h)->next_free < (h)->temp)                    \
   ? (_obstack_newchunk ((h), (h)->temp), 0) : 0),                    \
  obstack_blank_fast (h, (h)->temp))

Definition at line 503 of file obstack.h.

#define obstack_blank_fast (   h,
  n 
)    ((h)->next_free += (n))

Definition at line 291 of file obstack.h.

#define obstack_chunk_size (   h)    ((h)->chunk_size)

Definition at line 254 of file obstack.h.

#define obstack_chunkfun (   h,
  newchunkfun 
)    ((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun))

Definition at line 283 of file obstack.h.

#define obstack_copy (   h,
  where,
  length 
)    (obstack_grow ((h), (where), (length)), obstack_finish ((h)))

Definition at line 512 of file obstack.h.

#define obstack_copy0 (   h,
  where,
  length 
)    (obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))

Definition at line 515 of file obstack.h.

#define obstack_empty_p (   h)    ((h)->chunk->prev == 0 && (h)->next_free - (h)->chunk->contents == 0)

Definition at line 453 of file obstack.h.

#define obstack_finish (   h)
Value:
( ((h)->next_free == (h)->object_base                                 \
   ? (((h)->maybe_empty_object = 1), 0)                               \
   : 0),                                                       \
  (h)->temp = __PTR_TO_INT ((h)->object_base),                        \
  (h)->next_free                                               \
    = __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask)      \
                  & ~ ((h)->alignment_mask)),                         \
  (((h)->next_free - (char *) (h)->chunk                       \
    > (h)->chunk_limit - (char *) (h)->chunk)                         \
   ? ((h)->next_free = (h)->chunk_limit) : 0),                        \
  (h)->object_base = (h)->next_free,                                  \
  __INT_TO_PTR ((h)->temp))

Definition at line 518 of file obstack.h.

#define obstack_free (   h,
  obj 
)
Value:
( (h)->temp = (char *) (obj) - (char *) (h)->chunk,                   \
  (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
   ? (int) ((h)->next_free = (h)->object_base                         \
           = (h)->temp + (char *) (h)->chunk)                         \
   : (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0)))

Definition at line 532 of file obstack.h.

#define obstack_freefun (   h,
  newfreefun 
)    ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun))

Definition at line 286 of file obstack.h.

#define obstack_grow (   h,
  where,
  length 
)
Value:
( (h)->temp = (length),                                               \
  (((h)->next_free + (h)->temp > (h)->chunk_limit)                    \
   ? (_obstack_newchunk ((h), (h)->temp), 0) : 0),                    \
  _obstack_memcpy ((h)->next_free, (where), (h)->temp),               \
  (h)->next_free += (h)->temp)

Definition at line 467 of file obstack.h.

#define obstack_grow0 (   h,
  where,
  length 
)
Value:
( (h)->temp = (length),                                               \
  (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit)                \
   ? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0),                \
  _obstack_memcpy ((h)->next_free, (where), (h)->temp),               \
  (h)->next_free += (h)->temp,                                        \
  *((h)->next_free)++ = 0)

Definition at line 474 of file obstack.h.

#define obstack_init (   h)
Value:
_obstack_begin ((h), 0, 0, \
                (void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)

Definition at line 266 of file obstack.h.

#define obstack_int_grow (   h,
  datum 
)
Value:
( (((h)->next_free + sizeof (int) > (h)->chunk_limit)                 \
   ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0),                 \
  obstack_int_grow_fast (h, datum))

Definition at line 492 of file obstack.h.

#define obstack_int_grow_fast (   h,
  aint 
)    (((int *) ((h)->next_free += sizeof (int)))[-1] = (aptr))

Definition at line 500 of file obstack.h.

#define obstack_make_room (   h,
  length 
)
Value:
( (h)->temp = (length),                                               \
  (((h)->next_free + (h)->temp > (h)->chunk_limit)                    \
   ? (_obstack_newchunk ((h), (h)->temp), 0) : 0))

Definition at line 462 of file obstack.h.

#define obstack_memory_used (   h)    _obstack_memory_used (h)

Definition at line 293 of file obstack.h.

#define obstack_next_free (   h)    ((h)->next_free)

Definition at line 258 of file obstack.h.

#define obstack_object_size (   h)    (unsigned) ((h)->next_free - (h)->object_base)

Definition at line 447 of file obstack.h.

#define obstack_ptr_grow (   h,
  datum 
)
Value:
( (((h)->next_free + sizeof (char *) > (h)->chunk_limit)              \
   ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0),              \
  obstack_ptr_grow_fast (h, datum))

Definition at line 487 of file obstack.h.

#define obstack_ptr_grow_fast (   h,
  aptr 
)    (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr))

Definition at line 497 of file obstack.h.

#define obstack_room (   h)    (unsigned) ((h)->chunk_limit - (h)->next_free)

Definition at line 450 of file obstack.h.

#define obstack_specify_allocation (   h,
  size,
  alignment,
  chunkfun,
  freefun 
)
Value:
_obstack_begin ((h), (size), (alignment), \
                  (void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun))

Definition at line 274 of file obstack.h.

#define obstack_specify_allocation_with_arg (   h,
  size,
  alignment,
  chunkfun,
  freefun,
  arg 
)
Value:
_obstack_begin_1 ((h), (size), (alignment), \
                  (void *(*) (void *, long)) (chunkfun), \
                  (void (*) (void *, void *)) (freefun), (arg))

Definition at line 278 of file obstack.h.

#define PTR_INT_TYPE   long

Definition at line 142 of file obstack.h.


Function Documentation

int _obstack_begin ( struct obstack ,
int  ,
int  ,
void *  *)(long,
void(*)(void *)   
)
int _obstack_begin_1 ( struct obstack ,
int  ,
int  ,
void *  *)(void *, long,
void(*)(void *, void *)  ,
void *   
)
void _obstack_free ( struct obstack ,
void *   
)

Definition at line 392 of file obstack.c.

{
  register struct _obstack_chunk* lp;
  register int nbytes = 0;

  for (lp = h->chunk; lp != 0; lp = lp->prev)
    {
      nbytes += lp->limit - (char *) lp;
    }
  return nbytes;
}
void _obstack_newchunk ( struct obstack ,
int   
)

Definition at line 238 of file obstack.c.

{
  register struct _obstack_chunk *old_chunk = h->chunk;
  register struct _obstack_chunk *new_chunk;
  register long      new_size;
  register long obj_size = h->next_free - h->object_base;
  register long i;
  long already;

  /* Compute size for new chunk.  */
  new_size = (obj_size + length) + (obj_size >> 3) + 100;
  if (new_size < h->chunk_size)
    new_size = h->chunk_size;

  /* Allocate and initialize the new chunk.  */
  new_chunk = CALL_CHUNKFUN (h, new_size);
  if (!new_chunk)
    (*obstack_alloc_failed_handler) ();
  h->chunk = new_chunk;
  new_chunk->prev = old_chunk;
  new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size;

  /* Move the existing object to the new chunk.
     Word at a time is fast and is safe if the object
     is sufficiently aligned.  */
  if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT)
    {
      for (i = obj_size / sizeof (COPYING_UNIT) - 1;
          i >= 0; i--)
       ((COPYING_UNIT *)new_chunk->contents)[i]
         = ((COPYING_UNIT *)h->object_base)[i];
      /* We used to copy the odd few remaining bytes as one extra COPYING_UNIT,
        but that can cross a page boundary on a machine
        which does not do strict alignment for COPYING_UNITS.  */
      already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT);
    }
  else
    already = 0;
  /* Copy remaining bytes one by one.  */
  for (i = already; i < obj_size; i++)
    new_chunk->contents[i] = h->object_base[i];

  /* If the object just copied was the only data in OLD_CHUNK,
     free that chunk and remove it from the chain.
     But not if that chunk might contain an empty object.  */
  if (h->object_base == old_chunk->contents && ! h->maybe_empty_object)
    {
      new_chunk->prev = old_chunk->prev;
      CALL_FREEFUN (h, old_chunk);
    }

  h->object_base = new_chunk->contents;
  h->next_free = h->object_base + obj_size;
  /* The new chunk certainly contains no empty object yet.  */
  h->maybe_empty_object = 0;
}
void obstack_1grow ( struct obstack obstack,
int  data_char 
)

Here is the caller graph for this function:

void obstack_1grow_fast ( struct obstack obstack,
int  data_char 
)

Here is the caller graph for this function:

void* obstack_alloc ( struct obstack obstack,
int  size 
)

Here is the caller graph for this function:

void* obstack_base ( struct obstack obstack)
void obstack_blank ( struct obstack obstack,
int  size 
)
void obstack_blank_fast ( struct obstack obstack,
int  size 
)

Here is the caller graph for this function:

void* obstack_copy ( struct obstack obstack,
void *  address,
int  size 
)

Here is the caller graph for this function:

void* obstack_copy0 ( struct obstack obstack,
void *  address,
int  size 
)
void* obstack_finish ( struct obstack obstack)

Here is the caller graph for this function:

void obstack_free ( struct obstack obstack,
void *  block 
)
void obstack_grow ( struct obstack obstack,
void *  data,
int  size 
)

Here is the caller graph for this function:

void obstack_grow0 ( struct obstack obstack,
void *  data,
int  size 
)
void obstack_init ( struct obstack obstack)

Here is the caller graph for this function:

void obstack_int_grow ( struct obstack obstack,
int  data 
)
void obstack_int_grow_fast ( struct obstack obstack,
int  data 
)
void obstack_make_room ( struct obstack obstack,
int  size 
)
void* obstack_next_free ( struct obstack obstack)

Here is the caller graph for this function:

void obstack_ptr_grow ( struct obstack obstack,
void *  data 
)
void obstack_ptr_grow_fast ( struct obstack obstack,
void *  data 
)
int obstack_room ( struct obstack obstack)

Here is the caller graph for this function:


Variable Documentation

Definition at line 81 of file obstack.c.

Definition at line 90 of file obstack.c.