/[m4]/m4/gnulib/m4/obstack.h
ViewVC logotype

Diff of /m4/gnulib/m4/obstack.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by gary, Tue Oct 7 14:10:11 2003 UTC revision 1.3 by gary, Thu Nov 13 12:05:57 2003 UTC
# Line 248  extern int obstack_exit_failure; Line 248  extern int obstack_exit_failure;
248  #define obstack_alignment_mask(h) ((h)->alignment_mask)  #define obstack_alignment_mask(h) ((h)->alignment_mask)
249    
250  /* To prevent prototype warnings provide complete argument list.  */  /* To prevent prototype warnings provide complete argument list.  */
251  # define obstack_init(h)                                        \  #define obstack_init(h)                                         \
252    _obstack_begin ((h), 0, 0,                                    \    _obstack_begin ((h), 0, 0,                                    \
253                    (void *(*) (long)) obstack_chunk_alloc,       \                    (void *(*) (long)) obstack_chunk_alloc,       \
254                    (void (*) (void *)) obstack_chunk_free)                    (void (*) (void *)) obstack_chunk_free)
255    
256  # define obstack_begin(h, size)                                 \  #define obstack_begin(h, size)                                  \
257    _obstack_begin ((h), (size), 0,                               \    _obstack_begin ((h), (size), 0,                               \
258                    (void *(*) (long)) obstack_chunk_alloc,       \                    (void *(*) (long)) obstack_chunk_alloc,       \
259                    (void (*) (void *)) obstack_chunk_free)                    (void (*) (void *)) obstack_chunk_free)
260    
261  # define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \  #define obstack_specify_allocation(h, size, alignment, chunkfun, freefun)  \
262    _obstack_begin ((h), (size), (alignment),                                \    _obstack_begin ((h), (size), (alignment),                                \
263                    (void *(*) (long)) (chunkfun),                           \                    (void *(*) (long)) (chunkfun),                           \
264                    (void (*) (void *)) (freefun))                    (void (*) (void *)) (freefun))
265    
266  # define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \  #define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
267    _obstack_begin_1 ((h), (size), (alignment),                           \    _obstack_begin_1 ((h), (size), (alignment),                           \
268                      (void *(*) (void *, long)) (chunkfun),              \                      (void *(*) (void *, long)) (chunkfun),              \
269                      (void (*) (void *, void *)) (freefun), (arg))                      (void (*) (void *, void *)) (freefun), (arg))
270    
271  # define obstack_chunkfun(h, newchunkfun) \  #define obstack_chunkfun(h, newchunkfun) \
272    ((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun))    ((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun))
273    
274  # define obstack_freefun(h, newfreefun) \  #define obstack_freefun(h, newfreefun) \
275    ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun))    ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun))
276    
277  #define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar)  #define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar))
278    
279  #define obstack_blank_fast(h,n) ((h)->next_free += (n))  #define obstack_blank_fast(h,n) ((h)->next_free += (n))
280    
# Line 322  __extension__                                                          \ Line 322  __extension__                                                          \
322     int __len = (length);                                                \     int __len = (length);                                                \
323     if (__o->next_free + __len > __o->chunk_limit)                       \     if (__o->next_free + __len > __o->chunk_limit)                       \
324       _obstack_newchunk (__o, __len);                                    \       _obstack_newchunk (__o, __len);                                    \
325     memcpy (__o->next_free, (where), __len);                             \     memcpy (__o->next_free, where, __len);                               \
326     __o->next_free += __len;                                             \     __o->next_free += __len;                                             \
327     (void) 0; })     (void) 0; })
328    
# Line 332  __extension__                                                          \ Line 332  __extension__                                                          \
332     int __len = (length);                                                \     int __len = (length);                                                \
333     if (__o->next_free + __len + 1 > __o->chunk_limit)                   \     if (__o->next_free + __len + 1 > __o->chunk_limit)                   \
334       _obstack_newchunk (__o, __len + 1);                                \       _obstack_newchunk (__o, __len + 1);                                \
335     memcpy (__o->next_free, (where), __len);                             \     memcpy (__o->next_free, where, __len);                               \
336     __o->next_free += __len;                                             \     __o->next_free += __len;                                             \
337     *(__o->next_free)++ = 0;                                             \     *(__o->next_free)++ = 0;                                             \
338     (void) 0; })     (void) 0; })
# Line 342  __extension__                                                          \ Line 342  __extension__                                                          \
342  ({ struct obstack *__o = (OBSTACK);                                     \  ({ struct obstack *__o = (OBSTACK);                                     \
343     if (__o->next_free + 1 > __o->chunk_limit)                           \     if (__o->next_free + 1 > __o->chunk_limit)                           \
344       _obstack_newchunk (__o, 1);                                        \       _obstack_newchunk (__o, 1);                                        \
345     *(__o->next_free)++ = (datum);                                       \     obstack_1grow_fast (__o, datum);                                     \
346     (void) 0; })     (void) 0; })
347    
348  /* These assume that the obstack alignment is good enough for pointers  /* These assume that the obstack alignment is good enough for pointers
# Line 354  __extension__                                                          \ Line 354  __extension__                                                          \
354  ({ struct obstack *__o = (OBSTACK);                                     \  ({ struct obstack *__o = (OBSTACK);                                     \
355     if (__o->next_free + sizeof (void *) > __o->chunk_limit)             \     if (__o->next_free + sizeof (void *) > __o->chunk_limit)             \
356       _obstack_newchunk (__o, sizeof (void *));                          \       _obstack_newchunk (__o, sizeof (void *));                          \
357     *((void **)__o->next_free)++ = (datum);                              \     obstack_ptr_grow_fast (__o, datum); })                               \
    (void) 0; })  
358    
359  # define obstack_int_grow(OBSTACK,datum)                                \  # define obstack_int_grow(OBSTACK,datum)                                \
360  __extension__                                                           \  __extension__                                                           \
361  ({ struct obstack *__o = (OBSTACK);                                     \  ({ struct obstack *__o = (OBSTACK);                                     \
362     if (__o->next_free + sizeof (int) > __o->chunk_limit)                \     if (__o->next_free + sizeof (int) > __o->chunk_limit)                \
363       _obstack_newchunk (__o, sizeof (int));                             \       _obstack_newchunk (__o, sizeof (int));                             \
364     *((int *)__o->next_free)++ = (datum);                                \     obstack_int_grow_fast (__o, datum); })
    (void) 0; })  
365    
366  # define obstack_ptr_grow_fast(h,aptr)                                  \  # define obstack_ptr_grow_fast(OBSTACK,aptr)                            \
367    (*((void **) (h)->next_free)++ = (aptr))  __extension__                                                           \
368    ({ struct obstack *__o1 = (OBSTACK);                                    \
369       *(const void **) __o1->next_free = (aptr);                           \
370       __o1->next_free += sizeof (const void *);                            \
371       (void) 0; })
372    
373  # define obstack_int_grow_fast(h,aint)                                  \  # define obstack_int_grow_fast(OBSTACK,aint)                            \
374    (*((int *) (h)->next_free)++ = (aint))  __extension__                                                           \
375    ({ struct obstack *__o1 = (OBSTACK);                                    \
376       *(int *) __o1->next_free = (aint);                                   \
377       __o1->next_free += sizeof (int);                                     \
378       (void) 0; })
379    
380  # define obstack_blank(OBSTACK,length)                                  \  # define obstack_blank(OBSTACK,length)                                  \
381  __extension__                                                           \  __extension__                                                           \
# Line 377  __extension__                                                          \ Line 383  __extension__                                                          \
383     int __len = (length);                                                \     int __len = (length);                                                \
384     if (__o->chunk_limit - __o->next_free < __len)                       \     if (__o->chunk_limit - __o->next_free < __len)                       \
385       _obstack_newchunk (__o, __len);                                    \       _obstack_newchunk (__o, __len);                                    \
386     __o->next_free += __len;                                             \     obstack_blank_fast (__o, __len);                                     \
387     (void) 0; })     (void) 0; })
388    
389  # define obstack_alloc(OBSTACK,length)                                  \  # define obstack_alloc(OBSTACK,length)                                  \
# Line 450  __extension__                                                          \ Line 456  __extension__                                                          \
456  ( (h)->temp = (length),                                                 \  ( (h)->temp = (length),                                                 \
457    (((h)->next_free + (h)->temp > (h)->chunk_limit)                      \    (((h)->next_free + (h)->temp > (h)->chunk_limit)                      \
458     ? (_obstack_newchunk ((h), (h)->temp), 0) : 0),                      \     ? (_obstack_newchunk ((h), (h)->temp), 0) : 0),                      \
459    memcpy ((h)->next_free, (where), (h)->temp),                          \    memcpy ((h)->next_free, where, (h)->temp),                            \
460    (h)->next_free += (h)->temp)    (h)->next_free += (h)->temp)
461    
462  # define obstack_grow0(h,where,length)                                  \  # define obstack_grow0(h,where,length)                                  \
463  ( (h)->temp = (length),                                                 \  ( (h)->temp = (length),                                                 \
464    (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit)                  \    (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit)                  \
465     ? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0),                  \     ? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0),                  \
466    memcpy ((h)->next_free, (where), (h)->temp),                          \    memcpy ((h)->next_free, where, (h)->temp),                            \
467    (h)->next_free += (h)->temp,                                          \    (h)->next_free += (h)->temp,                                          \
468    *((h)->next_free)++ = 0)    *((h)->next_free)++ = 0)
469    
470  # define obstack_1grow(h,datum)                                         \  # define obstack_1grow(h,datum)                                         \
471  ( (((h)->next_free + 1 > (h)->chunk_limit)                              \  ( (((h)->next_free + 1 > (h)->chunk_limit)                              \
472     ? (_obstack_newchunk ((h), 1), 0) : 0),                              \     ? (_obstack_newchunk ((h), 1), 0) : 0),                              \
473    (*((h)->next_free)++ = (datum)))    obstack_1grow_fast (h, datum))
474    
475  # define obstack_ptr_grow(h,datum)                                      \  # define obstack_ptr_grow(h,datum)                                      \
476  ( (((h)->next_free + sizeof (char *) > (h)->chunk_limit)                \  ( (((h)->next_free + sizeof (char *) > (h)->chunk_limit)                \
477     ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0),                \     ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0),                \
478    (*((const char **) (((h)->next_free+=sizeof(char *))-sizeof(char *))) = (datum)))    obstack_ptr_grow_fast (h, datum))
479    
480  # define obstack_int_grow(h,datum)                                      \  # define obstack_int_grow(h,datum)                                      \
481  ( (((h)->next_free + sizeof (int) > (h)->chunk_limit)                   \  ( (((h)->next_free + sizeof (int) > (h)->chunk_limit)                   \
482     ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0),                   \     ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0),                   \
483    (*((int *) (((h)->next_free+=sizeof(int))-sizeof(int))) = (datum)))    obstack_int_grow_fast (h, datum))
484    
485  # define obstack_ptr_grow_fast(h,aptr)                                  \  # define obstack_ptr_grow_fast(h,aptr)                                  \
486    (*((const char **) (h)->next_free)++ = (aptr))    (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr))
487    
488  # define obstack_int_grow_fast(h,aint)                                  \  # define obstack_int_grow_fast(h,aint)                                  \
489    (*((int *) (h)->next_free)++ = (aint))    (((int *) ((h)->next_free += sizeof (int)))[-1] = (aptr))
490    
491  # define obstack_blank(h,length)                                        \  # define obstack_blank(h,length)                                        \
492  ( (h)->temp = (length),                                                 \  ( (h)->temp = (length),                                                 \
493    (((h)->chunk_limit - (h)->next_free < (h)->temp)                      \    (((h)->chunk_limit - (h)->next_free < (h)->temp)                      \
494     ? (_obstack_newchunk ((h), (h)->temp), 0) : 0),                      \     ? (_obstack_newchunk ((h), (h)->temp), 0) : 0),                      \
495    ((h)->next_free += (h)->temp))    obstack_blank_fast (h, (h)->temp))
496    
497  # define obstack_alloc(h,length)                                        \  # define obstack_alloc(h,length)                                        \
498   (obstack_blank ((h), (length)), obstack_finish ((h)))   (obstack_blank ((h), (length)), obstack_finish ((h)))
# Line 511  __extension__                                                          \ Line 517  __extension__                                                          \
517    (h)->object_base = (h)->next_free,                                    \    (h)->object_base = (h)->next_free,                                    \
518    (void *) __INT_TO_PTR ((h)->temp))    (void *) __INT_TO_PTR ((h)->temp))
519    
520  #  define obstack_free(h,obj)                                           \  # define obstack_free(h,obj)                                            \
521  ( (h)->temp = (char *) (obj) - (char *) (h)->chunk,                     \  ( (h)->temp = (char *) (obj) - (char *) (h)->chunk,                     \
522    (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\    (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
523     ? (int) ((h)->next_free = (h)->object_base                           \     ? (int) ((h)->next_free = (h)->object_base                           \

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26