Enlightenment CVS committal Author : mej Project : eterm Module : libast
Dir : eterm/libast/include Modified Files: libast.h libast_internal.h Log Message: Wed Nov 26 21:07:16 2003 Michael Jennings (mej) Working on cleaning up namespace issues. =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/include/libast.h,v retrieving revision 1.40 retrieving revision 1.41 diff -u -3 -r1.40 -r1.41 --- libast.h 26 Nov 2003 22:19:43 -0000 1.40 +++ libast.h 27 Nov 2003 02:08:03 -0000 1.41 @@ -30,8 +30,8 @@ * including all required system headers and LibAST Object headers. * * @author Michael Jennings <[EMAIL PROTECTED]> - * @version $Revision: 1.40 $ - * @date $Date: 2003/11/26 22:19:43 $ + * @version $Revision: 1.41 $ + * @date $Date: 2003/11/27 02:08:03 $ */ #ifndef _LIBAST_H_ @@ -830,7 +830,7 @@ * This macro is a replacement for the libc function malloc(). It * allocates the specified number of bytes of memory on the heap and * returns a pointer to that memory location. This macro calls libc's - * malloc() if memory debugging is off, and libast_malloc() if it's + * malloc() if memory debugging is off, and spifmem_malloc() if it's * on. * * @param sz The size in bytes of the block of memory to allocate. @@ -847,7 +847,7 @@ * objects of type @a type (e.g., a @a type array of size @a n). The * memory area is zeroed out prior to the pointer to it being * returned. This macro calls libc's calloc() if memory debugging is - * off and libast_calloc() if it's on. + * off and spifmem_calloc() if it's on. * * @param type The type of object to be allocated (e.g., int). * @param n The number of objects to be allocated. @@ -864,7 +864,7 @@ * malloc() or calloc() (or, by extension, the MALLOC()/CALLOC() * macros) and returns a pointer to the (possibly moved) memory area. * This macro calls libc's realloc() if memory debugging is off and - * libast_realloc() if it's on. + * spifmem_realloc() if it's on. * * @param mem The old pointer whose size will be changed. * @param sz The new size, in bytes, to be allocated. @@ -880,7 +880,7 @@ * This macro is a replacement for the libc function free(). It * returns the previously-allocated memory block pointed to by @a ptr * to the heap. This macro calls libc's free() if memory debugging is - * off and libast_free() if it's on. The @a ptr parameter is assigned + * off and spifmem_free() if it's on. The @a ptr parameter is assigned * the value of NULL after it has been freed. * * @param ptr The pointer to be freed. @@ -896,7 +896,7 @@ * (including the trailing NUL character), copies the contents of @a s * into the new buffer, and returns a pointer to the new copy. This * macro calls libc's strdup() of memory debugging is off and - * libast_strdup() if it's on. + * spifmem_strdup() if it's on. * * @param s The string to duplicate. * @return A pointer to the newly-created copy. @@ -927,7 +927,7 @@ * This macro is a replacement for the Xlib function XCreatePixmap(). * It creates a pixmap of the specified size and returns an X resource * ID for it. This macro calls Xlib's XCreatePixmap() if memory - * debugging is off and libast_x_create_pixmap() if it's on. + * debugging is off and spifmem_x_create_pixmap() if it's on. * * @param d The X display connection. * @param win The X drawable on whose display the pixmap will be @@ -945,7 +945,7 @@ * * This macro is a replacement for the Xlib function XFreePixmap(). * It frees the specified pixmap. This macro calls Xlib's - * XFreePixmap() if memory debugging is off and libast_x_free_pixmap() + * XFreePixmap() if memory debugging is off and spifmem_x_free_pixmap() * if it's on. * * @param d The X display connection. @@ -961,7 +961,7 @@ * Imlib2 could conceivably create an image. So instead, simply use * this macro to register the pixmaps Imlib2 creates. Then LibAST * will be able to track them. This macro calls - * libast_imlib_register_pixmap() if memory debugging is on and if + * spifmem_imlib_register_pixmap() if memory debugging is on and if * Imlib2 support has been enabled. Otherwise, it's a NOP(). * * @param p The Pixmap Imlib2 created. @@ -973,7 +973,7 @@ * Free a pixmap (and its mask) generated by Imlib2. * * Once an Imlib2-generated pixmap has been registered, you should - * use this macro to free it. It calls libast_imlib_free_pixmap() if + * use this macro to free it. It calls spifmem_imlib_free_pixmap() if * Imlib2 support has been enabled. Otherwise, it's a NOP(). * * @param p The Imlib2-generated Pixmap to be freed. @@ -999,7 +999,7 @@ * This macro is a replacement for the Xlib function XCreateGC(). It * creates a graphics context (GC) object and returns its X resource * ID. This macro calls Xlib's XCreateGC() if memory debugging is - * off and libast_x_create_gc() if it's on. + * off and spifmem_x_create_gc() if it's on. * * @param d The X display connection. * @param win The X drawable on whose screen the GC will be created. @@ -1017,7 +1017,7 @@ * This macro is a replacement for the Xlib function XFreeGC(). It * frees a previously allocated graphics context (GC) object. This * macro calls Xlib's XFreeGC() if memory debugging is off and - * libast_x_free_gc() if it's on. + * spifmem_x_free_gc() if it's on. * * @param d The X display connection. * @param gc The graphics context object to free. @@ -1089,25 +1089,25 @@ * @ingroup DOXGRP_MEM */ #if (DEBUG >= DEBUG_MEM) -# define MALLOC(sz) libast_malloc(__FILE__, __LINE__, (sz)) -# define CALLOC(type,n) libast_calloc(__FILE__, __LINE__, (n), (sizeof(type))) -# define REALLOC(mem,sz) libast_realloc(#mem, __FILE__, __LINE__, (mem), (sz)) -# define FREE(ptr) do { libast_free(#ptr, __FILE__, __LINE__, (ptr)); (ptr) = NULL; } while (0) -# define STRDUP(s) libast_strdup(#s, __FILE__, __LINE__, (s)) -# define MALLOC_DUMP() libast_dump_mem_tables() -# define X_CREATE_PIXMAP(d, win, w, h, depth) libast_x_create_pixmap(__FILE__, __LINE__, (d), (win), (w), (h), (depth)) -# define X_FREE_PIXMAP(d, p) libast_x_free_pixmap(#p, __FILE__, __LINE__, (d), (p)) +# define MALLOC(sz) spifmem_malloc(__FILE__, __LINE__, (sz)) +# define CALLOC(type,n) spifmem_calloc(__FILE__, __LINE__, (n), (sizeof(type))) +# define REALLOC(mem,sz) spifmem_realloc(#mem, __FILE__, __LINE__, (mem), (sz)) +# define FREE(ptr) do { spifmem_free(#ptr, __FILE__, __LINE__, (ptr)); (ptr) = NULL; } while (0) +# define STRDUP(s) spifmem_strdup(#s, __FILE__, __LINE__, (s)) +# define MALLOC_DUMP() spifmem_dump_mem_tables() +# define X_CREATE_PIXMAP(d, win, w, h, depth) spifmem_x_create_pixmap(__FILE__, __LINE__, (d), (win), (w), (h), (depth)) +# define X_FREE_PIXMAP(d, p) spifmem_x_free_pixmap(#p, __FILE__, __LINE__, (d), (p)) # if LIBAST_IMLIB2_SUPPORT -# define IMLIB_REGISTER_PIXMAP(p) libast_imlib_register_pixmap(#p, __FILE__, __LINE__, (p)) -# define IMLIB_FREE_PIXMAP(p) libast_imlib_free_pixmap(#p, __FILE__, __LINE__, (p)) +# define IMLIB_REGISTER_PIXMAP(p) spifmem_imlib_register_pixmap(#p, __FILE__, __LINE__, (p)) +# define IMLIB_FREE_PIXMAP(p) spifmem_imlib_free_pixmap(#p, __FILE__, __LINE__, (p)) # else # define IMLIB_REGISTER_PIXMAP(p) NOP # define IMLIB_FREE_PIXMAP(p) NOP # endif -# define PIXMAP_DUMP() libast_dump_pixmap_tables() -# define X_CREATE_GC(d, win, f, gcv) libast_x_create_gc(__FILE__, __LINE__, (d), (win), (f), (gcv)) -# define X_FREE_GC(d, gc) libast_x_free_gc(#gc, __FILE__, __LINE__, (d), (gc)) -# define GC_DUMP() libast_dump_gc_tables() +# define PIXMAP_DUMP() spifmem_dump_pixmap_tables() +# define X_CREATE_GC(d, win, f, gcv) spifmem_x_create_gc(__FILE__, __LINE__, (d), (win), (f), (gcv)) +# define X_FREE_GC(d, gc) spifmem_x_free_gc(#gc, __FILE__, __LINE__, (d), (gc)) +# define GC_DUMP() spifmem_dump_gc_tables() # define MALLOC_MOD 25 # define REALLOC_MOD 25 # define CALLOC_MOD 25 @@ -1282,16 +1282,16 @@ * @see @link DOXGRP_CONF Configuration File Parser @endlink * @ingroup DOXGRP_CONF */ -#define CONF_BEGIN_CHAR '\001' +#define SPIFCONF_BEGIN_CHAR '\001' /** * Special flag character string. * - * This is the string representation of CONF_BEGIN_CHAR. + * This is the string representation of SPIFCONF_BEGIN_CHAR. * * @see @link DOXGRP_CONF Configuration File Parser @endlink * @ingroup DOXGRP_CONF */ -#define CONF_BEGIN_STRING "\001" +#define SPIFCONF_BEGIN_STRING "\001" /** * Special flag character. * @@ -1301,16 +1301,16 @@ * @see @link DOXGRP_CONF Configuration File Parser @endlink * @ingroup DOXGRP_CONF */ -#define CONF_END_CHAR '\002' +#define SPIFCONF_END_CHAR '\002' /** * Special flag character string. * - * This is the string representation of CONF_END_CHAR. + * This is the string representation of SPIFCONF_END_CHAR. * * @see @link DOXGRP_CONF Configuration File Parser @endlink * @ingroup DOXGRP_CONF */ -#define CONF_END_STRING "\002" +#define SPIFCONF_END_STRING "\002" /** * Compares boolean option value to allowed true values. @@ -1376,7 +1376,7 @@ * @see @link DOXGRP_CONF_FSS File State Stack @endlink * @ingroup DOXGRP_CONF_FSS */ -#define file_push(f, p, o, l, fl) conf_register_fstate(f, p, o, l, fl) +#define file_push(f, p, o, l, fl) spifconf_register_fstate(f, p, o, l, fl) /** * Pop a state structure off the stack. * @@ -1626,7 +1626,7 @@ * @see @link DOXGRP_CONF Configuration File Parser @endlink * @ingroup DOXGRP_CONF */ -typedef char * (*conf_func_ptr_t) (char *); +typedef char * (*spifconf_func_ptr_t) (char *); extern fstate_t *fstate; extern unsigned char fstate_idx; @@ -2586,26 +2586,26 @@ extern unsigned int DEBUG_LEVEL; /* mem.c */ -extern void memrec_init(void); -extern void *libast_malloc(const char *, unsigned long, size_t); -extern void *libast_realloc(const char *, const char *, unsigned long, void *, size_t); -extern void *libast_calloc(const char *, unsigned long, size_t, size_t); -extern void libast_free(const char *, const char *, unsigned long, void *); -extern char *libast_strdup(const char *, const char *, unsigned long, const char *); -extern void libast_dump_mem_tables(void); +extern void spifmem_init(void); +extern void *spifmem_malloc(const char *, unsigned long, size_t); +extern void *spifmem_realloc(const char *, const char *, unsigned long, void *, size_t); +extern void *spifmem_calloc(const char *, unsigned long, size_t, size_t); +extern void spifmem_free(const char *, const char *, unsigned long, void *); +extern char *spifmem_strdup(const char *, const char *, unsigned long, const char *); +extern void spifmem_dump_mem_tables(void); #if LIBAST_X11_SUPPORT -extern Pixmap libast_x_create_pixmap(const char *, unsigned long, Display *, Drawable, unsigned int, unsigned int, unsigned int); -extern void libast_x_free_pixmap(const char *, const char *, unsigned long, Display *, Pixmap); +extern Pixmap spifmem_x_create_pixmap(const char *, unsigned long, Display *, Drawable, unsigned int, unsigned int, unsigned int); +extern void spifmem_x_free_pixmap(const char *, const char *, unsigned long, Display *, Pixmap); # if LIBAST_IMLIB2_SUPPORT -extern void libast_imlib_register_pixmap(const char *var, const char *filename, unsigned long line, Pixmap p); -extern void libast_imlib_free_pixmap(const char *var, const char *filename, unsigned long line, Pixmap p); +extern void spifmem_imlib_register_pixmap(const char *var, const char *filename, unsigned long line, Pixmap p); +extern void spifmem_imlib_free_pixmap(const char *var, const char *filename, unsigned long line, Pixmap p); # endif -extern void libast_dump_pixmap_tables(void); -extern GC libast_x_create_gc(const char *, unsigned long, Display *, Drawable, unsigned long, XGCValues *); -extern void libast_x_free_gc(const char *, const char *, unsigned long, Display *, GC); -extern void libast_dump_gc_tables(void); +extern void spifmem_dump_pixmap_tables(void); +extern GC spifmem_x_create_gc(const char *, unsigned long, Display *, Drawable, unsigned long, XGCValues *); +extern void spifmem_x_free_gc(const char *, const char *, unsigned long, Display *, GC); +extern void spifmem_dump_gc_tables(void); #endif -extern void free_array(void *, size_t); +extern void spiftool_free_array(void *, size_t); /* file.c */ extern int libast_temp_file(char *, size_t); @@ -2664,20 +2664,69 @@ #endif /* conf.c */ -extern void conf_init_subsystem(void); -extern unsigned char conf_register_context(char *name, ctx_handler_t handler); -extern unsigned char conf_register_fstate(FILE *fp, char *path, char *outfile, unsigned long line, unsigned char flags); -extern unsigned char conf_register_builtin(char *name, conf_func_ptr_t ptr); -extern unsigned char conf_register_context_state(unsigned char ctx_id); -extern void conf_free_subsystem(void); -extern char *shell_expand(char *); -extern char *conf_find_file(const char *file, const char *dir, const char *pathlist); -extern FILE *open_config_file(char *name); -extern void conf_parse_line(FILE *fp, char *buff); -extern char *conf_parse(char *conf_name, const char *dir, const char *path); +extern void spifconf_init_subsystem(void); +extern unsigned char spifconf_register_context(char *name, ctx_handler_t handler); +extern unsigned char spifconf_register_fstate(FILE *fp, char *path, char *outfile, unsigned long line, unsigned char flags); +extern unsigned char spifconf_register_builtin(char *name, spifconf_func_ptr_t ptr); +extern unsigned char spifconf_register_context_state(unsigned char ctx_id); +extern void spifconf_free_subsystem(void); +extern char *spifconf_shell_expand(char *); +extern char *spifconf_find_file(const char *file, const char *dir, const char *pathlist); +extern FILE *spifconf_open_file(char *name); +extern void spifconf_parse_line(FILE *fp, char *buff); +extern char *spifconf_parse(char *conf_name, const char *dir, const char *path); /* options.c */ extern void spifopt_parse(int, char **); extern void spifopt_usage(void); + + +/* Do we, or do we not, pollute the namespace like we used to? */ +#if LIBAST_COMPAT_05_API +/* The application must have defined this. */ +/* conf.c */ +# define CONF_BEGIN_CHAR SPIFCONF_BEGIN_CHAR +# define CONF_END_CHAR SPIFCONF_END_CHAR +# define CONF_BEGIN_STRING SPIFCONF_BEGIN_STRING +# define CONF_END_STRING SPIFCONF_END_STRING +typedef spifconf_func_ptr_t conf_func_ptr_t; +static void (*conf_init_subsystem)(void) = spifconf_init_subsystem; +static unsigned char (*conf_register_context)(char *, ctx_handler_t) = spifconf_register_context; +static unsigned char (*conf_register_fstate)(FILE *, char *, char *, unsigned long, unsigned char) = spifconf_register_fstate; +static unsigned char (*conf_register_builtin)(char *, conf_func_ptr_t) = spifconf_register_builtin; +static unsigned char (*conf_register_context_state)(unsigned char) = spifconf_register_context_state; +static void (*conf_free_subsystem)(void) = spifconf_free_subsystem; +static char *(*shell_expand)(char *) = spifconf_shell_expand; +static char *(*conf_find_file)(const char *, const char *, const char *) = spifconf_find_file; +static FILE *(*open_config_file)(char *) = spifconf_open_file; +static void (*conf_parse_line)(FILE *, char *) = spifconf_parse_line; +static char *(*conf_parse)(char *, const char *, const char *) = spifconf_parse; + +/* mem.c */ +static void (*memrec_init)(void) = spifmem_init; +static void *(*libast_malloc)(const char *, unsigned long, size_t) = spifmem_malloc; +static void *(*libast_realloc)(const char *, const char *, unsigned long, void *, size_t) = spifmem_realloc; +static void *(*libast_calloc)(const char *, unsigned long, size_t, size_t) = spifmem_calloc; +static void (*libast_free)(const char *, const char *, unsigned long, void *) = spifmem_free; +static char *(*libast_strdup)(const char *, const char *, unsigned long, const char *) = spifmem_strdup; +static void (*libast_dump_mem_tables)(void) = spifmem_dump_mem_tables; +# if LIBAST_X11_SUPPORT +static Pixmap (*libast_x_create_pixmap)(const char *, unsigned long, Display *, Drawable, + unsigned int, unsigned int, unsigned int) = spifmem_x_create_pixmap; +static void (*libast_x_free_pixmap)(const char *, const char *, unsigned long, Display *, Pixmap) = spifmem_x_free_pixmap; +# if LIBAST_IMLIB2_SUPPORT +static void (*libast_imlib_register_pixmap)(const char *, const char *, unsigned long, Pixmap) = spifmem_imlib_register_pixmap; +static void (*libast_imlib_free_pixmap)(const char *, const char *, unsigned long, Pixmap) = spifmem_imlib_free_pixmap; +# endif +static void (*libast_dump_pixmap_tables)(void) = spifmem_dump_pixmap_tables; +static GC (*libast_x_create_gc)(const char *, unsigned long, Display *, Drawable, + unsigned long, XGCValues *) = spifmem_x_create_gc; +static void (*libast_x_free_gc)(const char *, const char *, unsigned long, Display *, GC) = spifmem_x_free_gc; +static void (*libast_dump_gc_tables)(void) = spifmem_dump_gc_tables; +#endif +static void (*free_array)(void *, size_t) = spiftool_free_array; + + +#endif /* LIBAST_COMPAT_05_API */ #endif /* _LIBAST_H_ */ =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/include/libast_internal.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- libast_internal.h 23 Nov 2003 20:58:19 -0000 1.15 +++ libast_internal.h 27 Nov 2003 02:08:06 -0000 1.16 @@ -29,8 +29,8 @@ * are restricted to internal LibAST use only. * * @author Michael Jennings <[EMAIL PROTECTED]> - * @version $Revision: 1.15 $ - * @date $Date: 2003/11/23 20:58:19 $ + * @version $Revision: 1.16 $ + * @date $Date: 2003/11/27 02:08:06 $ */ #ifndef _LIBAST_INTERNAL_H_ @@ -189,7 +189,7 @@ * * @param ctx The context ID for the new context. */ -#define ctx_push(ctx) conf_register_context_state(ctx) +#define ctx_push(ctx) spifconf_register_context_state(ctx) /** * Pops a context structure off the stack. Pops a context structure * off the stack. @@ -262,7 +262,7 @@ name = get_word(idx, buff); \ ctx_name_to_id(id, name, i); \ ctx_push(id); \ - state = (*ctx_id_to_func(id))(CONF_BEGIN_STRING, ctx_peek_last_state()); \ + state = (*ctx_id_to_func(id))(SPIFCONF_BEGIN_STRING, ctx_peek_last_state()); \ ctx_poke_state(state); \ FREE(name); \ } while (0) @@ -270,14 +270,14 @@ * Convenience macro for ending a context. * * This macro simplifies the ending of a context. The context handler - * for the context is called with CONF_END_STRING. The old context is + * for the context is called with SPIFCONF_END_STRING. The old context is * then popped off the stack, and the returned state is saved for the * parent context. * */ #define ctx_end() do { \ if (ctx_get_depth()) { \ - state = (*ctx_id_to_func(id))(CONF_END_STRING, ctx_peek_state()); \ + state = (*ctx_id_to_func(id))(SPIFCONF_END_STRING, ctx_peek_state()); \ ctx_poke_state(NULL); \ ctx_pop(); \ id = ctx_peek_id(); \ @@ -356,7 +356,7 @@ * @see @link DOXGRP_CONF_CTX Context Handling @endlink * @ingroup DOXGRP_CONF_CTX */ -typedef struct conf_func_t_struct { +typedef struct spifconf_func_t_struct { /** * Function name. * @@ -369,8 +369,8 @@ * * Pointer to the handler for the built-in function. */ - conf_func_ptr_t ptr; -} conf_func_t; + spifconf_func_ptr_t ptr; +} spifconf_func_t; /** * Linked list for user-defined config file variables. @@ -383,7 +383,7 @@ * @see @link DOXGRP_CONF_CTX Context Handling @endlink, builtin_get(), builtin_put() * @ingroup DOXGRP_CONF_CTX */ -typedef struct conf_var_t_struct { +typedef struct spifconf_var_t_struct { /** * Variable name. * @@ -403,8 +403,8 @@ * * Pointer to the next variable in the list. */ - struct conf_var_t_struct *next; -} conf_var_t; + struct spifconf_var_t_struct *next; +} spifconf_var_t; ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ enlightenment-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs