Main Page | Class List | Directories | File List | Class Members | File Members

pike_macros.h File Reference

#include <global.h>
#include "pike_memory.h"

Go to the source code of this file.

Defines

#define PTR_TO_INT(PTR)   ((size_t) ((char *) (PTR) - (char *) NULL))
#define OFFSETOF(str_type, field)   PTR_TO_INT(& (((struct str_type *)NULL)->field))
#define BASEOF(ptr, str_type, field)   ((struct str_type *)((char*)ptr - OFFSETOF(str_type, field)))
#define ALIGNOF(X)   OFFSETOF({ char ignored_; X fooo_;}, fooo_)
#define NELEM(a)   (sizeof (a) / sizeof ((a)[0]))
#define ALLOC_STRUCT(X)   ( (struct X *)xalloc(sizeof(struct X)) )
#define MINIMUM(X, Y)   ((X)<(Y)?(X):(Y))
#define MAXIMUM(X, Y)   ((X)>(Y)?(X):(Y))
#define is8bitalnum(X)   (Pike_is8bitalnum_vector[((unsigned)(X))&0xff] == '1')
#define isidchar(X)   is8bitalnum(X)
#define isgraph(X)   (ispunct(X) || isupper(X) || islower(X) || isdigit(X))
#define DO_ALIGN(X, Y)   (((size_t)(X)+((Y)-1)) & -(Y))
#define CONSTANT_STRLEN(X)   (sizeof(X) - sizeof(""))
#define SET_NEXT_AND_FREE(p, free_item)
#define FREE_AND_GET_REFERENCED(p, item_type, free_item)
#define DOUBLELINK(first_object, o)
#define DOUBLEUNLINK(first_object, o)
#define PIKE_XCONCAT(X, Y)   PIKE_CONCAT(X,Y)
#define PIKE_XCONCAT3(X, Y, Z)   PIKE_CONCAT(X,Y,Z)
#define PIKE_XCONCAT4(X, Y, Z, Q)   PIKE_CONCAT(X,Y,Z,Q)
#define COMMA   ,

Functions

PMOD_EXPORT int my_log2 (size_t x)

Variables

PMOD_EXPORT const char Pike_is8bitalnum_vector []


Define Documentation

#define ALIGNOF  )     OFFSETOF({ char ignored_; X fooo_;}, fooo_)
 

#define ALLOC_STRUCT  )     ( (struct X *)xalloc(sizeof(struct X)) )
 

#define BASEOF ptr,
str_type,
field   )     ((struct str_type *)((char*)ptr - OFFSETOF(str_type, field)))
 

#define COMMA   ,
 

#define CONSTANT_STRLEN  )     (sizeof(X) - sizeof(""))
 

#define DO_ALIGN X,
 )     (((size_t)(X)+((Y)-1)) & -(Y))
 

#define DOUBLELINK first_object,
 ) 
 

Value:

do {    \
  debug_malloc_touch(o);                        \
  o->next=first_object;                         \
  o->prev=0;                                    \
  if(first_object) first_object->prev=o;        \
  first_object=o;                               \
}while(0)

#define DOUBLEUNLINK first_object,
 ) 
 

Value:

do{     \
  debug_malloc_touch(o);                        \
  if(o->prev) {                                 \
    o->prev->next=o->next;                      \
  }else {                                       \
    DO_IF_DEBUG(                                \
      if(first_object != o) {                   \
        describe(o);                            \
        Pike_fatal("Linked in wrong list!\n");  \
      }                                         \
    )                                           \
    first_object=o->next;                       \
  }                                             \
                                                \
  if(o->next) o->next->prev=o->prev;            \
}while(0)

#define FREE_AND_GET_REFERENCED p,
item_type,
free_item   ) 
 

Value:

do {            \
  item_type *next;                                                      \
  while (1) {                                                           \
    if (p->refs > 1) {                                                  \
      free_item(p);                                                     \
      break;                                                            \
    }                                                                   \
    if (!(next = p->next)) {                                            \
      free_item(p);                                                     \
      p = 0;                                                            \
      break;                                                            \
    }                                                                   \
    add_ref(next);                                                      \
    free_item(p);                                                       \
    p = next;                                                           \
  }                                                                     \
} while (0)

#define is8bitalnum  )     (Pike_is8bitalnum_vector[((unsigned)(X))&0xff] == '1')
 

#define isgraph  )     (ispunct(X) || isupper(X) || islower(X) || isdigit(X))
 

#define isidchar  )     is8bitalnum(X)
 

#define MAXIMUM X,
 )     ((X)>(Y)?(X):(Y))
 

#define MINIMUM X,
 )     ((X)<(Y)?(X):(Y))
 

#define NELEM  )     (sizeof (a) / sizeof ((a)[0]))
 

#define OFFSETOF str_type,
field   )     PTR_TO_INT(& (((struct str_type *)NULL)->field))
 

#define PIKE_XCONCAT X,
 )     PIKE_CONCAT(X,Y)
 

#define PIKE_XCONCAT3 X,
Y,
 )     PIKE_CONCAT(X,Y,Z)
 

#define PIKE_XCONCAT4 X,
Y,
Z,
 )     PIKE_CONCAT(X,Y,Z,Q)
 

#define PTR_TO_INT PTR   )     ((size_t) ((char *) (PTR) - (char *) NULL))
 

#define SET_NEXT_AND_FREE p,
free_item   ) 
 

Value:

do{     \
  next=p->next;                                 \
  while(p->refs == 1 && (next=p->next))         \
  {                                             \
    add_ref(next);                              \
    free_item(p);                               \
    p=next;                                     \
  }                                             \
  free_item(p);                                 \
}while(0)


Function Documentation

PMOD_EXPORT int my_log2 size_t  x  ) 
 


Variable Documentation

PMOD_EXPORT const char Pike_is8bitalnum_vector[]
 


Generated on Fri Jul 22 23:44:30 2005 for Pike by  doxygen 1.3.9.1