Back to index

cell-binutils  2.17cvs20070401
obstack.h
Go to the documentation of this file.
00001 /* obstack.h - object stack macros
00002    Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998,
00003    1999, 2000, 2001, 2002, 2003, 2004, 2005
00004    Free Software Foundation, Inc.
00005 
00006 
00007    NOTE: The canonical source of this file is maintained with the GNU C Library.
00008    Bugs can be reported to bug-glibc@gnu.org.
00009 
00010    This program is free software; you can redistribute it and/or modify it
00011    under the terms of the GNU General Public License as published by the
00012    Free Software Foundation; either version 2, or (at your option) any
00013    later version.
00014 
00015    This program is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018    GNU General Public License for more details.
00019 
00020    You should have received a copy of the GNU General Public License
00021    along with this program; if not, write to the Free Software
00022    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
00023    USA.  */
00024 
00025 /* Summary:
00026 
00027 All the apparent functions defined here are macros. The idea
00028 is that you would use these pre-tested macros to solve a
00029 very specific set of problems, and they would run fast.
00030 Caution: no side-effects in arguments please!! They may be
00031 evaluated MANY times!!
00032 
00033 These macros operate a stack of objects.  Each object starts life
00034 small, and may grow to maturity.  (Consider building a word syllable
00035 by syllable.)  An object can move while it is growing.  Once it has
00036 been "finished" it never changes address again.  So the "top of the
00037 stack" is typically an immature growing object, while the rest of the
00038 stack is of mature, fixed size and fixed address objects.
00039 
00040 These routines grab large chunks of memory, using a function you
00041 supply, called `obstack_chunk_alloc'.  On occasion, they free chunks,
00042 by calling `obstack_chunk_free'.  You must define them and declare
00043 them before using any obstack macros.
00044 
00045 Each independent stack is represented by a `struct obstack'.
00046 Each of the obstack macros expects a pointer to such a structure
00047 as the first argument.
00048 
00049 One motivation for this package is the problem of growing char strings
00050 in symbol tables.  Unless you are "fascist pig with a read-only mind"
00051 --Gosper's immortal quote from HAKMEM item 154, out of context--you
00052 would not like to put any arbitrary upper limit on the length of your
00053 symbols.
00054 
00055 In practice this often means you will build many short symbols and a
00056 few long symbols.  At the time you are reading a symbol you don't know
00057 how long it is.  One traditional method is to read a symbol into a
00058 buffer, realloc()ating the buffer every time you try to read a symbol
00059 that is longer than the buffer.  This is beaut, but you still will
00060 want to copy the symbol from the buffer to a more permanent
00061 symbol-table entry say about half the time.
00062 
00063 With obstacks, you can work differently.  Use one obstack for all symbol
00064 names.  As you read a symbol, grow the name in the obstack gradually.
00065 When the name is complete, finalize it.  Then, if the symbol exists already,
00066 free the newly read name.
00067 
00068 The way we do this is to take a large chunk, allocating memory from
00069 low addresses.  When you want to build a symbol in the chunk you just
00070 add chars above the current "high water mark" in the chunk.  When you
00071 have finished adding chars, because you got to the end of the symbol,
00072 you know how long the chars are, and you can create a new object.
00073 Mostly the chars will not burst over the highest address of the chunk,
00074 because you would typically expect a chunk to be (say) 100 times as
00075 long as an average object.
00076 
00077 In case that isn't clear, when we have enough chars to make up
00078 the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed)
00079 so we just point to it where it lies.  No moving of chars is
00080 needed and this is the second win: potentially long strings need
00081 never be explicitly shuffled. Once an object is formed, it does not
00082 change its address during its lifetime.
00083 
00084 When the chars burst over a chunk boundary, we allocate a larger
00085 chunk, and then copy the partly formed object from the end of the old
00086 chunk to the beginning of the new larger chunk.  We then carry on
00087 accreting characters to the end of the object as we normally would.
00088 
00089 A special macro is provided to add a single char at a time to a
00090 growing object.  This allows the use of register variables, which
00091 break the ordinary 'growth' macro.
00092 
00093 Summary:
00094        We allocate large chunks.
00095        We carve out one object at a time from the current chunk.
00096        Once carved, an object never moves.
00097        We are free to append data of any size to the currently
00098          growing object.
00099        Exactly one object is growing in an obstack at any one time.
00100        You can run one obstack per control block.
00101        You may have as many control blocks as you dare.
00102        Because of the way we do it, you can `unwind' an obstack
00103          back to a previous state. (You may remove objects much
00104          as you would with a stack.)
00105 */
00106 
00107 
00108 /* Don't do the contents of this file more than once.  */
00109 
00110 #ifndef _OBSTACK_H
00111 #define _OBSTACK_H 1
00112 
00113 #ifdef __cplusplus
00114 extern "C" {
00115 #endif
00116 
00117 /* We use subtraction of (char *) 0 instead of casting to int
00118    because on word-addressable machines a simple cast to int
00119    may ignore the byte-within-word field of the pointer.  */
00120 
00121 #ifndef __PTR_TO_INT
00122 # define __PTR_TO_INT(P) ((P) - (char *) 0)
00123 #endif
00124 
00125 #ifndef __INT_TO_PTR
00126 # define __INT_TO_PTR(P) ((P) + (char *) 0)
00127 #endif
00128 
00129 /* We need the type of the resulting object.  If __PTRDIFF_TYPE__ is
00130    defined, as with GNU C, use that; that way we don't pollute the
00131    namespace with <stddef.h>'s symbols.  Otherwise, if <stddef.h> is
00132    available, include it and use ptrdiff_t.  In traditional C, long is
00133    the best that we can do.  */
00134 
00135 #ifdef __PTRDIFF_TYPE__
00136 # define PTR_INT_TYPE __PTRDIFF_TYPE__
00137 #else
00138 # ifdef HAVE_STDDEF_H
00139 #  include <stddef.h>
00140 #  define PTR_INT_TYPE ptrdiff_t
00141 # else
00142 #  define PTR_INT_TYPE long
00143 # endif
00144 #endif
00145 
00146 #if defined _LIBC || defined HAVE_STRING_H
00147 # include <string.h>
00148 # define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N))
00149 #else
00150 # ifdef memcpy
00151 #  define _obstack_memcpy(To, From, N) memcpy ((To), (char *)(From), (N))
00152 # else
00153 #  define _obstack_memcpy(To, From, N) bcopy ((char *)(From), (To), (N))
00154 # endif
00155 #endif
00156 
00157 struct _obstack_chunk              /* Lives at front of each chunk. */
00158 {
00159   char  *limit;                    /* 1 past end of this chunk */
00160   struct _obstack_chunk *prev;     /* address of prior chunk or NULL */
00161   char contents[4];         /* objects begin here */
00162 };
00163 
00164 struct obstack              /* control current object in current chunk */
00165 {
00166   long chunk_size;          /* preferred size to allocate chunks in */
00167   struct _obstack_chunk *chunk;    /* address of current struct obstack_chunk */
00168   char *object_base;        /* address of object we are building */
00169   char *next_free;          /* where to add next char to current object */
00170   char *chunk_limit;        /* address of char after current chunk */
00171   PTR_INT_TYPE temp;        /* Temporary for some macros.  */
00172   int   alignment_mask;            /* Mask of alignment for each object. */
00173   /* These prototypes vary based on `use_extra_arg', and we use
00174      casts to the prototypeless function type in all assignments,
00175      but having prototypes here quiets -Wstrict-prototypes.  */
00176   struct _obstack_chunk *(*chunkfun) (void *, long);
00177   void (*freefun) (void *, struct _obstack_chunk *);
00178   void *extra_arg;          /* first arg for chunk alloc/dealloc funcs */
00179   unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */
00180   unsigned maybe_empty_object:1;/* There is a possibility that the current
00181                                chunk contains a zero-length object.  This
00182                                prevents freeing the chunk if we allocate
00183                                a bigger chunk to replace it. */
00184   unsigned alloc_failed:1;  /* No longer used, as we now call the failed
00185                                handler on error, but retained for binary
00186                                compatibility.  */
00187 };
00188 
00189 /* Declare the external functions we use; they are in obstack.c.  */
00190 
00191 extern void _obstack_newchunk (struct obstack *, int);
00192 extern void _obstack_free (struct obstack *, void *);
00193 extern int _obstack_begin (struct obstack *, int, int,
00194                          void *(*) (long), void (*) (void *));
00195 extern int _obstack_begin_1 (struct obstack *, int, int,
00196                           void *(*) (void *, long),
00197                           void (*) (void *, void *), void *);
00198 extern int _obstack_memory_used (struct obstack *);
00199 
00200 /* Do the function-declarations after the structs
00201    but before defining the macros.  */
00202 
00203 void obstack_init (struct obstack *obstack);
00204 
00205 void * obstack_alloc (struct obstack *obstack, int size);
00206 
00207 void * obstack_copy (struct obstack *obstack, void *address, int size);
00208 void * obstack_copy0 (struct obstack *obstack, void *address, int size);
00209 
00210 void obstack_free (struct obstack *obstack, void *block);
00211 
00212 void obstack_blank (struct obstack *obstack, int size);
00213 
00214 void obstack_grow (struct obstack *obstack, void *data, int size);
00215 void obstack_grow0 (struct obstack *obstack, void *data, int size);
00216 
00217 void obstack_1grow (struct obstack *obstack, int data_char);
00218 void obstack_ptr_grow (struct obstack *obstack, void *data);
00219 void obstack_int_grow (struct obstack *obstack, int data);
00220 
00221 void * obstack_finish (struct obstack *obstack);
00222 
00223 int obstack_object_size (struct obstack *obstack);
00224 
00225 int obstack_room (struct obstack *obstack);
00226 void obstack_make_room (struct obstack *obstack, int size);
00227 void obstack_1grow_fast (struct obstack *obstack, int data_char);
00228 void obstack_ptr_grow_fast (struct obstack *obstack, void *data);
00229 void obstack_int_grow_fast (struct obstack *obstack, int data);
00230 void obstack_blank_fast (struct obstack *obstack, int size);
00231 
00232 void * obstack_base (struct obstack *obstack);
00233 void * obstack_next_free (struct obstack *obstack);
00234 int obstack_alignment_mask (struct obstack *obstack);
00235 int obstack_chunk_size (struct obstack *obstack);
00236 int obstack_memory_used (struct obstack *obstack);
00237 
00238 /* Error handler called when `obstack_chunk_alloc' failed to allocate
00239    more memory.  This can be set to a user defined function.  The
00240    default action is to print a message and abort.  */
00241 extern void (*obstack_alloc_failed_handler) (void);
00242 
00243 /* Exit value used when `print_and_abort' is used.  */
00244 extern int obstack_exit_failure;
00245 
00246 /* Pointer to beginning of object being allocated or to be allocated next.
00247    Note that this might not be the final address of the object
00248    because a new chunk might be needed to hold the final size.  */
00249 
00250 #define obstack_base(h) ((h)->object_base)
00251 
00252 /* Size for allocating ordinary chunks.  */
00253 
00254 #define obstack_chunk_size(h) ((h)->chunk_size)
00255 
00256 /* Pointer to next byte not yet allocated in current chunk.  */
00257 
00258 #define obstack_next_free(h)       ((h)->next_free)
00259 
00260 /* Mask specifying low bits that should be clear in address of an object.  */
00261 
00262 #define obstack_alignment_mask(h) ((h)->alignment_mask)
00263 
00264 /* To prevent prototype warnings provide complete argument list in
00265    standard C version.  */
00266 # define obstack_init(h) \
00267   _obstack_begin ((h), 0, 0, \
00268                 (void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
00269 
00270 # define obstack_begin(h, size) \
00271   _obstack_begin ((h), (size), 0, \
00272                 (void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
00273 
00274 # define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
00275   _obstack_begin ((h), (size), (alignment), \
00276                   (void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun))
00277 
00278 # define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
00279   _obstack_begin_1 ((h), (size), (alignment), \
00280                   (void *(*) (void *, long)) (chunkfun), \
00281                   (void (*) (void *, void *)) (freefun), (arg))
00282 
00283 # define obstack_chunkfun(h, newchunkfun) \
00284   ((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun))
00285 
00286 # define obstack_freefun(h, newfreefun) \
00287   ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun))
00288 
00289 #define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar))
00290 
00291 #define obstack_blank_fast(h,n) ((h)->next_free += (n))
00292 
00293 #define obstack_memory_used(h) _obstack_memory_used (h)
00294 
00295 #if defined __GNUC__ && defined __STDC__ && __STDC__
00296 /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
00297    does not implement __extension__.  But that compiler doesn't define
00298    __GNUC_MINOR__.  */
00299 # if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__)
00300 #  define __extension__
00301 # endif
00302 
00303 /* For GNU C, if not -traditional,
00304    we can define these macros to compute all args only once
00305    without using a global variable.
00306    Also, we can avoid using the `temp' slot, to make faster code.  */
00307 
00308 # define obstack_object_size(OBSTACK)                                 \
00309   __extension__                                                       \
00310   ({ struct obstack *__o = (OBSTACK);                                 \
00311      (unsigned) (__o->next_free - __o->object_base); })
00312 
00313 # define obstack_room(OBSTACK)                                        \
00314   __extension__                                                       \
00315   ({ struct obstack *__o = (OBSTACK);                                 \
00316      (unsigned) (__o->chunk_limit - __o->next_free); })
00317 
00318 # define obstack_make_room(OBSTACK,length)                            \
00319 __extension__                                                  \
00320 ({ struct obstack *__o = (OBSTACK);                                   \
00321    int __len = (length);                                       \
00322    if (__o->chunk_limit - __o->next_free < __len)                     \
00323      _obstack_newchunk (__o, __len);                                  \
00324    (void) 0; })
00325 
00326 # define obstack_empty_p(OBSTACK)                              \
00327   __extension__                                                       \
00328   ({ struct obstack *__o = (OBSTACK);                                 \
00329      (__o->chunk->prev == 0 && __o->next_free - __o->chunk->contents == 0); })
00330 
00331 # define obstack_grow(OBSTACK,where,length)                           \
00332 __extension__                                                  \
00333 ({ struct obstack *__o = (OBSTACK);                                   \
00334    int __len = (length);                                       \
00335    if (__o->next_free + __len > __o->chunk_limit)                     \
00336      _obstack_newchunk (__o, __len);                                  \
00337    _obstack_memcpy (__o->next_free, (where), __len);                  \
00338    __o->next_free += __len;                                    \
00339    (void) 0; })
00340 
00341 # define obstack_grow0(OBSTACK,where,length)                          \
00342 __extension__                                                  \
00343 ({ struct obstack *__o = (OBSTACK);                                   \
00344    int __len = (length);                                       \
00345    if (__o->next_free + __len + 1 > __o->chunk_limit)                 \
00346      _obstack_newchunk (__o, __len + 1);                       \
00347    _obstack_memcpy (__o->next_free, (where), __len);                  \
00348    __o->next_free += __len;                                    \
00349    *(__o->next_free)++ = 0;                                    \
00350    (void) 0; })
00351 
00352 # define obstack_1grow(OBSTACK,datum)                                 \
00353 __extension__                                                  \
00354 ({ struct obstack *__o = (OBSTACK);                                   \
00355    if (__o->next_free + 1 > __o->chunk_limit)                         \
00356      _obstack_newchunk (__o, 1);                               \
00357    obstack_1grow_fast (__o, datum);                                   \
00358    (void) 0; })
00359 
00360 /* These assume that the obstack alignment is good enough for pointers or ints,
00361    and that the data added so far to the current object
00362    shares that much alignment.  */
00363 
00364 # define obstack_ptr_grow(OBSTACK,datum)                       \
00365 __extension__                                                  \
00366 ({ struct obstack *__o = (OBSTACK);                                   \
00367    if (__o->next_free + sizeof (void *) > __o->chunk_limit)           \
00368      _obstack_newchunk (__o, sizeof (void *));                        \
00369    obstack_ptr_grow_fast (__o, datum); })
00370 
00371 # define obstack_int_grow(OBSTACK,datum)                       \
00372 __extension__                                                  \
00373 ({ struct obstack *__o = (OBSTACK);                                   \
00374    if (__o->next_free + sizeof (int) > __o->chunk_limit)              \
00375      _obstack_newchunk (__o, sizeof (int));                           \
00376    obstack_int_grow_fast (__o, datum); })
00377 
00378 # define obstack_ptr_grow_fast(OBSTACK,aptr)                          \
00379 __extension__                                                  \
00380 ({ struct obstack *__o1 = (OBSTACK);                                  \
00381    *(const void **) __o1->next_free = (aptr);                         \
00382    __o1->next_free += sizeof (const void *);                          \
00383    (void) 0; })
00384 
00385 # define obstack_int_grow_fast(OBSTACK,aint)                          \
00386 __extension__                                                  \
00387 ({ struct obstack *__o1 = (OBSTACK);                                  \
00388    *(int *) __o1->next_free = (aint);                                 \
00389    __o1->next_free += sizeof (int);                                   \
00390    (void) 0; })
00391 
00392 # define obstack_blank(OBSTACK,length)                                \
00393 __extension__                                                  \
00394 ({ struct obstack *__o = (OBSTACK);                                   \
00395    int __len = (length);                                       \
00396    if (__o->chunk_limit - __o->next_free < __len)                     \
00397      _obstack_newchunk (__o, __len);                                  \
00398    obstack_blank_fast (__o, __len);                                   \
00399    (void) 0; })
00400 
00401 # define obstack_alloc(OBSTACK,length)                                \
00402 __extension__                                                  \
00403 ({ struct obstack *__h = (OBSTACK);                                   \
00404    obstack_blank (__h, (length));                              \
00405    obstack_finish (__h); })
00406 
00407 # define obstack_copy(OBSTACK,where,length)                           \
00408 __extension__                                                  \
00409 ({ struct obstack *__h = (OBSTACK);                                   \
00410    obstack_grow (__h, (where), (length));                      \
00411    obstack_finish (__h); })
00412 
00413 # define obstack_copy0(OBSTACK,where,length)                          \
00414 __extension__                                                  \
00415 ({ struct obstack *__h = (OBSTACK);                                   \
00416    obstack_grow0 (__h, (where), (length));                            \
00417    obstack_finish (__h); })
00418 
00419 /* The local variable is named __o1 to avoid a name conflict
00420    when obstack_blank is called.  */
00421 # define obstack_finish(OBSTACK)                               \
00422 __extension__                                                  \
00423 ({ struct obstack *__o1 = (OBSTACK);                                  \
00424    void *value;                                                       \
00425    value = (void *) __o1->object_base;                                \
00426    if (__o1->next_free == value)                               \
00427      __o1->maybe_empty_object = 1;                             \
00428    __o1->next_free                                             \
00429      = __INT_TO_PTR ((__PTR_TO_INT (__o1->next_free)+__o1->alignment_mask)\
00430                    & ~ (__o1->alignment_mask));                \
00431    if (__o1->next_free - (char *)__o1->chunk                          \
00432        > __o1->chunk_limit - (char *)__o1->chunk)                     \
00433      __o1->next_free = __o1->chunk_limit;                      \
00434    __o1->object_base = __o1->next_free;                               \
00435    value; })
00436 
00437 # define obstack_free(OBSTACK, OBJ)                                   \
00438 __extension__                                                  \
00439 ({ struct obstack *__o = (OBSTACK);                                   \
00440    void *__obj = (void *) (OBJ);                               \
00441    if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit)  \
00442      __o->next_free = __o->object_base = (char *) __obj;              \
00443    else (obstack_free) (__o, __obj); })
00444 
00445 #else /* not __GNUC__ or not __STDC__ */
00446 
00447 # define obstack_object_size(h) \
00448  (unsigned) ((h)->next_free - (h)->object_base)
00449 
00450 # define obstack_room(h)           \
00451  (unsigned) ((h)->chunk_limit - (h)->next_free)
00452 
00453 # define obstack_empty_p(h) \
00454  ((h)->chunk->prev == 0 && (h)->next_free - (h)->chunk->contents == 0)
00455 
00456 /* Note that the call to _obstack_newchunk is enclosed in (..., 0)
00457    so that we can avoid having void expressions
00458    in the arms of the conditional expression.
00459    Casting the third operand to void was tried before,
00460    but some compilers won't accept it.  */
00461 
00462 # define obstack_make_room(h,length)                                  \
00463 ( (h)->temp = (length),                                               \
00464   (((h)->next_free + (h)->temp > (h)->chunk_limit)                    \
00465    ? (_obstack_newchunk ((h), (h)->temp), 0) : 0))
00466 
00467 # define obstack_grow(h,where,length)                                 \
00468 ( (h)->temp = (length),                                               \
00469   (((h)->next_free + (h)->temp > (h)->chunk_limit)                    \
00470    ? (_obstack_newchunk ((h), (h)->temp), 0) : 0),                    \
00471   _obstack_memcpy ((h)->next_free, (where), (h)->temp),               \
00472   (h)->next_free += (h)->temp)
00473 
00474 # define obstack_grow0(h,where,length)                                \
00475 ( (h)->temp = (length),                                               \
00476   (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit)                \
00477    ? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0),                \
00478   _obstack_memcpy ((h)->next_free, (where), (h)->temp),               \
00479   (h)->next_free += (h)->temp,                                        \
00480   *((h)->next_free)++ = 0)
00481 
00482 # define obstack_1grow(h,datum)                                       \
00483 ( (((h)->next_free + 1 > (h)->chunk_limit)                            \
00484    ? (_obstack_newchunk ((h), 1), 0) : 0),                            \
00485   obstack_1grow_fast (h, datum))
00486 
00487 # define obstack_ptr_grow(h,datum)                             \
00488 ( (((h)->next_free + sizeof (char *) > (h)->chunk_limit)              \
00489    ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0),              \
00490   obstack_ptr_grow_fast (h, datum))
00491 
00492 # define obstack_int_grow(h,datum)                             \
00493 ( (((h)->next_free + sizeof (int) > (h)->chunk_limit)                 \
00494    ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0),                 \
00495   obstack_int_grow_fast (h, datum))
00496 
00497 # define obstack_ptr_grow_fast(h,aptr)                                \
00498   (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr))
00499 
00500 # define obstack_int_grow_fast(h,aint)                                \
00501   (((int *) ((h)->next_free += sizeof (int)))[-1] = (aptr))
00502 
00503 # define obstack_blank(h,length)                               \
00504 ( (h)->temp = (length),                                               \
00505   (((h)->chunk_limit - (h)->next_free < (h)->temp)                    \
00506    ? (_obstack_newchunk ((h), (h)->temp), 0) : 0),                    \
00507   obstack_blank_fast (h, (h)->temp))
00508 
00509 # define obstack_alloc(h,length)                               \
00510  (obstack_blank ((h), (length)), obstack_finish ((h)))
00511 
00512 # define obstack_copy(h,where,length)                                 \
00513  (obstack_grow ((h), (where), (length)), obstack_finish ((h)))
00514 
00515 # define obstack_copy0(h,where,length)                                \
00516  (obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
00517 
00518 # define obstack_finish(h)                                            \
00519 ( ((h)->next_free == (h)->object_base                                 \
00520    ? (((h)->maybe_empty_object = 1), 0)                               \
00521    : 0),                                                       \
00522   (h)->temp = __PTR_TO_INT ((h)->object_base),                        \
00523   (h)->next_free                                               \
00524     = __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask)      \
00525                   & ~ ((h)->alignment_mask)),                         \
00526   (((h)->next_free - (char *) (h)->chunk                       \
00527     > (h)->chunk_limit - (char *) (h)->chunk)                         \
00528    ? ((h)->next_free = (h)->chunk_limit) : 0),                        \
00529   (h)->object_base = (h)->next_free,                                  \
00530   __INT_TO_PTR ((h)->temp))
00531 
00532 # define obstack_free(h,obj)                                          \
00533 ( (h)->temp = (char *) (obj) - (char *) (h)->chunk,                   \
00534   (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
00535    ? (int) ((h)->next_free = (h)->object_base                         \
00536            = (h)->temp + (char *) (h)->chunk)                         \
00537    : (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0)))
00538 
00539 #endif /* not __GNUC__ or not __STDC__ */
00540 
00541 #ifdef __cplusplus
00542 }      /* C++ */
00543 #endif
00544 
00545 #endif /* obstack.h */