From 8ddc80587864923a97fb482f7b426db352c2f63e Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 28 Mar 2011 17:18:06 +0100 Subject: [PATCH] phew all done iofuncs is now all on the vips_ namespace, and all revised, hopefully --- Makefile.am | 8 ++-- configure.in | 36 ++++++++-------- libvips/include/vips/debug.h | 6 +-- libvips/include/vips/error.h | 6 +-- libvips/include/vips/generate.h | 6 +-- libvips/include/vips/header.h | 6 +-- libvips/include/vips/image.h | 17 ++++---- libvips/include/vips/internal.h | 66 +++++++++++----------------- libvips/include/vips/intl.h | 6 +-- libvips/include/vips/private.h | 27 ++++++------ libvips/include/vips/region.h | 12 +++--- libvips/include/vips/semaphore.h | 6 +-- libvips/include/vips/thread.h | 40 ++++++++--------- libvips/include/vips/threadpool.h | 10 ++--- libvips/include/vips/vector.h | 6 +-- libvips/include/vips/version.h.in | 18 ++++---- libvips/include/vips/vips7compat.h | 12 ++++++ libvips/iofuncs/error.c | 14 +++--- libvips/iofuncs/generate.c | 6 +-- libvips/iofuncs/image.c | 69 +++++++++++++++--------------- libvips/iofuncs/init.c | 32 +++++++------- libvips/iofuncs/memory.c | 12 +++--- libvips/iofuncs/region.c | 28 ++++++------ libvips/iofuncs/semaphore.c | 2 +- libvips/iofuncs/sinkdisc.c | 6 +-- libvips/iofuncs/sinkscreen.c | 2 +- libvips/iofuncs/threadpool.c | 62 +++++++++++++-------------- libvips/iofuncs/vips.c | 11 ++--- libvips/iofuncs/window.c | 4 +- vips-7.25.pc.in | 2 +- vipsCC-7.25.pc.in | 4 +- 31 files changed, 270 insertions(+), 272 deletions(-) diff --git a/Makefile.am b/Makefile.am index 532a0542..fc8502ce 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,7 @@ if ENABLE_CXX C_COMPILE_DIR = libvipsCC C_DIST_DIR = -C_PKGCONFIG = vipsCC-7.${IM_MINOR_VERSION}.pc +C_PKGCONFIG = vipsCC-7.${VIPS_MINOR_VERSION}.pc # turn on Python if we can (requires C++) if HAVE_PYTHON @@ -31,15 +31,15 @@ EXTRA_DIST = \ m4 \ benchmark \ bootstrap.sh \ - vips-7.${IM_MINOR_VERSION}.pc.in \ - vipsCC-7.${IM_MINOR_VERSION}.pc.in \ + vips-7.${VIPS_MINOR_VERSION}.pc.in \ + vipsCC-7.${VIPS_MINOR_VERSION}.pc.in \ acinclude.m4 \ depcomp \ $(C_DIST_DIR) \ $(P_DIST_DIR) pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = vips-7.${IM_MINOR_VERSION}.pc $(C_PKGCONFIG) +pkgconfig_DATA = vips-7.${VIPS_MINOR_VERSION}.pc $(C_PKGCONFIG) install-exec-hook: -rm -rf ${DESTDIR}$(datadir)/doc/vips diff --git a/configure.in b/configure.in index 10e3532c..a12f7032 100644 --- a/configure.in +++ b/configure.in @@ -10,13 +10,13 @@ m4_define([vips_micro_version], [0]) m4_define([vips_version], [vips_major_version.vips_minor_version.vips_micro_version]) -IM_MAJOR_VERSION=vips_major_version -IM_MINOR_VERSION=vips_minor_version -IM_MICRO_VERSION=vips_micro_version -IM_VERSION=vips_version() -IM_VERSION_STRING=$IM_VERSION-`date` +VIPS_MAJOR_VERSION=vips_major_version +VIPS_MINOR_VERSION=vips_minor_version +VIPS_MICRO_VERSION=vips_micro_version +VIPS_VERSION=vips_version() +VIPS_VERSION_STRING=$VIPS_VERSION-`date` -VERSION=$IM_VERSION +VERSION=$VIPS_VERSION PACKAGE=vips # libtool library versioning ... not user-visible (except as part of the @@ -35,11 +35,11 @@ LIBRARY_AGE=15 AM_INIT_AUTOMAKE($PACKAGE,$VERSION) # patched into include/vips/version.h -AC_SUBST(IM_VERSION) -AC_SUBST(IM_VERSION_STRING) -AC_SUBST(IM_MAJOR_VERSION) -AC_SUBST(IM_MINOR_VERSION) -AC_SUBST(IM_MICRO_VERSION) +AC_SUBST(VIPS_VERSION) +AC_SUBST(VIPS_VERSION_STRING) +AC_SUBST(VIPS_MAJOR_VERSION) +AC_SUBST(VIPS_MINOR_VERSION) +AC_SUBST(VIPS_MICRO_VERSION) # put into library name by libsrc/Makefile.am and libsrcCC/Makefile.am AC_SUBST(LIBRARY_CURRENT) @@ -173,7 +173,7 @@ fi # we need a fully expanded version of $libdir # without this we get something like -# define IM_LIBDIR ${exec_prefix}/lib +# define VIPS_LIBDIR ${exec_prefix}/lib # argh test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' @@ -187,13 +187,13 @@ expand () { } expand $libdir -IM_LIBDIR=$expanded_value +VIPS_LIBDIR=$expanded_value # vips.c/im_guess_prefix.c need to know the exe suffix and (as a fallback) # the configure-time install prefix -AC_DEFINE_UNQUOTED(IM_EXEEXT,"$EXEEXT",[extension for executable files]) -AC_DEFINE_UNQUOTED(IM_PREFIX,"$prefix",[configure-time install prefix]) -AC_DEFINE_UNQUOTED(IM_LIBDIR,"$IM_LIBDIR",[configure-time library directory]) +AC_DEFINE_UNQUOTED(VIPS_EXEEXT,"$EXEEXT",[extension for executable files]) +AC_DEFINE_UNQUOTED(VIPS_PREFIX,"$prefix",[configure-time install prefix]) +AC_DEFINE_UNQUOTED(VIPS_LIBDIR,"$VIPS_LIBDIR",[configure-time library directory]) # i18n GETTEXT_PACKAGE=vips7 @@ -601,7 +601,7 @@ VIPS_LIBS="$MAGICK_LIBS $PNG_LIBS $TIFF_LIBS $ZIP_LIBS $JPEG_LIBS $GTHREAD_LIBS # we need this to generate paths in swig/python/setup.py.in AC_SUBST(top_srcdir) -AC_SUBST(IM_LIBDIR) +AC_SUBST(VIPS_LIBDIR) AC_SUBST(VIPS_CFLAGS) AC_SUBST(VIPS_INCLUDES) @@ -610,7 +610,7 @@ AC_SUBST(VIPS_CXX_LIBS) AC_SUBST(PACKAGES_USED) # you'd think we could have -# vips-$IM_MAJOR_VERSION.$IM_MINOR_VERSION.pc +# vips-$VIPS_MAJOR_VERSION.$VIPS_MINOR_VERSION.pc # in AC_OUTPUT, but that seems to break for some combinations of sh/m4 AC_OUTPUT([ vips-7.25.pc diff --git a/libvips/include/vips/debug.h b/libvips/include/vips/debug.h index 14fdea21..b4b45bc0 100644 --- a/libvips/include/vips/debug.h +++ b/libvips/include/vips/debug.h @@ -27,8 +27,8 @@ */ -#ifndef IM_DEBUG_H -#define IM_DEBUG_H +#ifndef VIPS_DEBUG_H +#define VIPS_DEBUG_H #ifdef __cplusplus extern "C" { @@ -70,4 +70,4 @@ extern "C" { } #endif /*__cplusplus*/ -#endif /* IM_DEBUG_H */ +#endif /* VIPS_DEBUG_H */ diff --git a/libvips/include/vips/error.h b/libvips/include/vips/error.h index 970c2e9d..d525c977 100644 --- a/libvips/include/vips/error.h +++ b/libvips/include/vips/error.h @@ -27,8 +27,8 @@ */ -#ifndef IM_ERROR_H -#define IM_ERROR_H +#ifndef VIPS_ERROR_H +#define VIPS_ERROR_H #ifdef __cplusplus extern "C" { @@ -87,4 +87,4 @@ int vips_check_dmask( const char *domain, DOUBLEMASK *mask ); } #endif /*__cplusplus*/ -#endif /*!IM_ERROR_H*/ +#endif /*VIPS_ERROR_H*/ diff --git a/libvips/include/vips/generate.h b/libvips/include/vips/generate.h index a55cb5d2..b11f9a04 100644 --- a/libvips/include/vips/generate.h +++ b/libvips/include/vips/generate.h @@ -29,8 +29,8 @@ */ -#ifndef IM_GENERATE_H -#define IM_GENERATE_H +#ifndef VIPS_GENERATE_H +#define VIPS_GENERATE_H #ifdef __cplusplus extern "C" { @@ -61,4 +61,4 @@ int vips_demand_hint( VipsImage *image, VipsDemandStyle hint, ... ) } #endif /*__cplusplus*/ -#endif /*IM_GENERATE_H*/ +#endif /*VIPS_GENERATE_H*/ diff --git a/libvips/include/vips/header.h b/libvips/include/vips/header.h index 952aede1..a4900897 100644 --- a/libvips/include/vips/header.h +++ b/libvips/include/vips/header.h @@ -30,8 +30,8 @@ */ -#ifndef IM_HEADER_H -#define IM_HEADER_H +#ifndef VIPS_HEADER_H +#define VIPS_HEADER_H #ifdef __cplusplus extern "C" { @@ -182,4 +182,4 @@ const char *vips_image_get_history( VipsImage *image ); } #endif /*__cplusplus*/ -#endif /*IM_HEADER_H*/ +#endif /*VIPS_HEADER_H*/ diff --git a/libvips/include/vips/image.h b/libvips/include/vips/image.h index 0b3c05f4..68a3f9e6 100644 --- a/libvips/include/vips/image.h +++ b/libvips/include/vips/image.h @@ -181,7 +181,7 @@ typedef struct _VipsImage { /* Derived fields that some code can fiddle with. New code should use * vips_image_get_history() and friends. */ - char *Hist; /* don't use ... call im_history_get() */ + char *Hist; /* don't use, see vips_image_get_history() */ char *filename; /* pointer to copy of filename */ char *data; /* start of image data for WIO */ int kill; /* set to non-zero to block eval */ @@ -198,7 +198,7 @@ typedef struct _VipsImage { guint32 magic; /* magic from header, endian-ness of image */ /* Partial image stuff. All private! All these fields are initialised - * to NULL and ignored unless set by im_generate() or im_partial(). + * to NULL and ignored unless set by vips_image_generate() etc. */ void *(*start)(); /* user-supplied start function */ int (*generate)(); /* user-supplied generate function */ @@ -209,7 +209,7 @@ typedef struct _VipsImage { GSList *regions; /* list of regions current for this image */ VipsDemandStyle dhint; /* demand style hint */ - /* Extra user-defined fields ... see im_meta_get_int() etc. + /* Extra user-defined fields ... see vips_image_get() etc. */ GHashTable *meta; /* GhashTable of GValue */ GSList *meta_traverse; /* traverse order for Meta */ @@ -222,12 +222,12 @@ typedef struct _VipsImage { /* If this is a large disc image, don't map the whole thing, instead * have a set of windows shared between the regions active on the - * image. List of im_window_t. + * image. List of VipsWindow. */ GSList *windows; /* Upstream/downstream relationships, built from args to - * im_demand_hint(). + * vips_demand_hint(). * * We use these to invalidate downstream pixel buffers. * Use 'serial' to spot circular dependencies. @@ -256,10 +256,10 @@ typedef struct _VipsImage { */ gint64 file_length; - /* Set this when im_demand_hint_array() is called, and check in any + /* Set this when vips_demand_hint_array() is called, and check in any * operation that will demand pixels from the image. * - * We use im_demand_hint_array() to build the tree of + * We use vips_demand_hint_array() to build the tree of * upstream/downstream relationships, so it's a mandatory thing. */ gboolean hint_set; @@ -285,7 +285,8 @@ typedef struct _VipsImageClass { void (*posteval)( VipsImage *image, VipsProgress *progress ); /* An image has been written to. - * Used by eg. im_open("x.jpg", "w") to do the final write to jpeg. + * Used by eg. vips_image_new_from_file("x.jpg", "w") to do the + * final write to jpeg. * Set *result to non-zero to indicate an error on write. */ void (*written)( VipsImage *image, int *result ); diff --git a/libvips/include/vips/internal.h b/libvips/include/vips/internal.h index aba3fd8e..efdabbdb 100644 --- a/libvips/include/vips/internal.h +++ b/libvips/include/vips/internal.h @@ -31,8 +31,8 @@ */ -#ifndef IM_INTERNAL_H -#define IM_INTERNAL_H +#ifndef VIPS_INTERNAL_H +#define VIPS_INTERNAL_H #ifdef __cplusplus extern "C" { @@ -57,23 +57,23 @@ int vips__meta_cp( VipsImage *, const VipsImage * ); /* Default tile geometry. */ -extern int im__tile_width; -extern int im__tile_height; -extern int im__fatstrip_height; -extern int im__thinstrip_height; +extern int vips__tile_width; +extern int vips__tile_height; +extern int vips__fatstrip_height; +extern int vips__thinstrip_height; /* Default n threads. */ -extern int im__concurrency; +extern int vips__concurrency; /* Give progress feedback. */ -extern int im__progress; +extern int vips__progress; /* A string giving the image size (in bytes of uncompressed image) above which * we decompress to disc on open. */ -extern char *im__disc_threshold; +extern char *vips__disc_threshold; typedef int (*im__fftproc_fn)( VipsImage *, VipsImage *, VipsImage * ); @@ -83,6 +83,20 @@ int vips__open_image_read( const char *filename ); int vips_image_open_input( VipsImage *image ); int vips_image_open_output( VipsImage *image ); +void vips__link_break_all( VipsImage *im ); +void *vips__link_map( VipsImage *im, VipsSListMap2Fn fn, void *a, void *b ); + +char *vips__b64_encode( const unsigned char *data, size_t data_length ); +unsigned char *vips__b64_decode( const char *buffer, size_t *data_length ); + +void *vips__mmap( int fd, int writeable, size_t length, gint64 offset ); +int vips__munmap( void *start, size_t length ); +int vips_mapfile( VipsImage * ); +int vips_mapfilerw( VipsImage * ); +int vips_remapfilerw( VipsImage * ); + +void vips__buffer_init( void ); + void vips__read_4byte( int msb_first, unsigned char *to, unsigned char **from ); void vips__read_2byte( int msb_first, unsigned char *to, unsigned char **from ); void vips__write_4byte( unsigned char **to, unsigned char *from ); @@ -94,12 +108,9 @@ int vips__writehist( VipsImage *image ); int vips__read_header_bytes( VipsImage *im, unsigned char *from ); int vips__write_header_bytes( VipsImage *im, unsigned char *to ); -int im__ftruncate( int fd, gint64 pos ); -int im__seek( int fd, gint64 pos ); +extern GMutex *vips__global_lock; -int im__open_image_file( const char * ); void im__format_init( void ); -void im__type_init( void ); void im__tiff_register( void ); void im__jpeg_register( void ); @@ -110,9 +121,6 @@ void im__analyze_register( void ); void im__exr_register( void ); void im__magick_register( void ); -extern int im__read_test; -extern GMutex *vips__global_lock; - typedef enum { IM__RGB, /* 1 or 3 bands (eg. PPM) */ IM__RGBA, /* 1, 2, 3 or 4 bands (eg. PNG) */ @@ -123,17 +131,6 @@ typedef enum { VipsImage *im__convert_saveable( VipsImage *in, im__saveable_t saveable, int format_table[10] ); -void vips__link_break_all( VipsImage *im ); -void *vips__link_map( VipsImage *im, VipsSListMap2Fn fn, void *a, void *b ); - -GValue *im__gvalue_ref_string_new( const char *text ); -void im__gslist_gvalue_free( GSList *list ); -GSList *im__gslist_gvalue_copy( const GSList *list ); -GSList *im__gslist_gvalue_merge( GSList *a, const GSList *b ); -char *im__gslist_gvalue_get( const GSList *list ); - -void vips__buffer_init( void ); - int im__bandup( const char *domain, VipsImage *in, VipsImage *out, int n ); int im__bandalike_vec( const char *domain, VipsImage **in, VipsImage **out, int n ); int im__bandalike( const char *domain, @@ -184,20 +181,9 @@ struct im_col_tab_disp *im_col_make_tables_RGB( VipsImage *im, struct im_col_display *d ); struct im_col_tab_disp *im_col_display_get_table( struct im_col_display *d ); -char *vips__b64_encode( const unsigned char *data, size_t data_length ); -unsigned char *vips__b64_decode( const char *buffer, size_t *data_length ); - -void *vips__mmap( int fd, int writeable, size_t length, gint64 offset ); -int vips__munmap( void *start, size_t length ); -int vips_mapfile( VipsImage * ); -int vips_mapfilerw( VipsImage * ); -int vips_remapfilerw( VipsImage * ); - -int im__write( int, const void *, size_t ); -int im__trigger_callbacks( GSList *cblist ); -int im__close( VipsImage * ); int im__fft_sp( float *rvec, float *ivec, int logrows, int logcols ); int im__fftproc( VipsImage *dummy, VipsImage *in, VipsImage *out, im__fftproc_fn fn ); + int im__find_lroverlap( VipsImage *ref_in, VipsImage *sec_in, VipsImage *out, int bandno_in, int xref, int yref, int xsec, int ysec, @@ -276,4 +262,4 @@ void vips__interpolate_init( void ); } #endif /*__cplusplus*/ -#endif /*IM_INTERNAL_H*/ +#endif /*VIPS_INTERNAL_H*/ diff --git a/libvips/include/vips/intl.h b/libvips/include/vips/intl.h index edfea4bb..83efd7ed 100644 --- a/libvips/include/vips/intl.h +++ b/libvips/include/vips/intl.h @@ -1,8 +1,8 @@ /* i18n stuff for vips. */ -#ifndef IM_VIPS_INTL_H -#define IM_VIPS_INTL_H +#ifndef VIPS_INTL_H +#define VIPS_INTL_H #ifdef __cplusplus extern "C" { @@ -47,4 +47,4 @@ const char *vips__ngettext( const char *msgid, } #endif /*__cplusplus*/ -#endif /* IM_VIPS_INTL_H */ +#endif /* VIPS_INTL_H */ diff --git a/libvips/include/vips/private.h b/libvips/include/vips/private.h index e13fd453..ef8b0649 100644 --- a/libvips/include/vips/private.h +++ b/libvips/include/vips/private.h @@ -32,28 +32,28 @@ */ -#ifndef IM_PRIVATE_H -#define IM_PRIVATE_H +#ifndef VIPS_PRIVATE_H +#define VIPS_PRIVATE_H #ifdef __cplusplus extern "C" { #endif /*__cplusplus*/ -#define IM_SPARE (8) +#define VIPS_SPARE (8) /* Private to iofuncs: the minimum number of scanlines we add above and below * the window as a margin for slop. */ -#define IM__WINDOW_MARGIN_PIXELS (128) +#define VIPS__WINDOW_MARGIN_PIXELS (128) /* Private to iofuncs: add at least this many bytes above and below the window. * There's no point mapping just a few KB of a small image. */ -#define IM__WINDOW_MARGIN_BYTES (1024 * 1024 * 10) +#define VIPS__WINDOW_MARGIN_BYTES (1024 * 1024 * 10) /* sizeof() a VIPS header on disc. */ -#define IM_SIZEOF_HEADER (64) +#define VIPS_SIZEOF_HEADER (64) typedef unsigned char PEL; /* useful datum */ @@ -132,16 +132,17 @@ typedef enum region_type { VIPS_REGION_WINDOW /* mmap() buffer on fd on another image */ } RegionType; -/* Private to iofuncs: the size of the `tiles' requested by im_generate() +/* Private to iofuncs: the size of the `tiles' requested by + * vips_image_generate() * when acting as a data sink. */ -#define IM__TILE_WIDTH (64) -#define IM__TILE_HEIGHT (64) +#define VIPS__TILE_WIDTH (64) +#define VIPS__TILE_HEIGHT (64) /* The height of the strips for the other two request styles. */ -#define IM__THINSTRIP_HEIGHT (1) -#define IM__FATSTRIP_HEIGHT (16) +#define VIPS__THINSTRIP_HEIGHT (1) +#define VIPS__FATSTRIP_HEIGHT (16) /* Functions on regions. */ @@ -150,8 +151,6 @@ void vips__region_take_ownership( struct _VipsRegion *reg ); void vips__region_check_ownership( struct _VipsRegion *reg ); void vips__region_no_ownership( struct _VipsRegion *reg ); -void im__find_demand_size( struct _VipsImage *im, int *pw, int *ph ); - int vips__region_start( struct _VipsRegion *reg ); void vips__region_stop( struct _VipsRegion *reg ); @@ -167,4 +166,4 @@ int vips__image_write_prepare( struct _VipsImage *image ); } #endif /*__cplusplus*/ -#endif /*IM_PRIVATE_H*/ +#endif /*VIPS_PRIVATE_H*/ diff --git a/libvips/include/vips/region.h b/libvips/include/vips/region.h index c465359c..884a5c23 100644 --- a/libvips/include/vips/region.h +++ b/libvips/include/vips/region.h @@ -32,8 +32,8 @@ */ -#ifndef IM_REGION_H -#define IM_REGION_H +#ifndef VIPS_REGION_H +#define VIPS_REGION_H #ifdef __cplusplus extern "C" { @@ -65,7 +65,7 @@ typedef struct _VipsRegion { VipsImage *im; /* Link back to parent image */ VipsRect valid; /* Area of parent we can see */ - /* The rest of REGION is private. + /* The rest of VipsRegion is private. */ /*< private >*/ RegionType type; /* What kind of attachment */ @@ -118,7 +118,7 @@ int vips_region_prepare_to( VipsRegion *reg, VipsRegion *dest, VipsRect *r, int x, int y ); int vips_region_prepare_many( VipsRegion **reg, VipsRect *r ); -/* Macros on REGIONs. +/* Macros on VipsRegion. * VIPS_REGION_LSKIP() add to move down line * VIPS_REGION_N_ELEMENTS() number of elements across region * VIPS_REGION_SIZEOF_LINE() sizeof width of region @@ -135,7 +135,7 @@ int vips_region_prepare_many( VipsRegion **reg, VipsRect *r ); */ #ifdef DEBUG #define VIPS_REGION_ADDR( R, X, Y ) \ - ( (im_rect_includespoint( &(R)->valid, (X), (Y) ))? \ + ( (vips_rect_includespoint( &(R)->valid, (X), (Y) ))? \ ((R)->data + ((Y) - (R)->valid.top) * VIPS_REGION_LSKIP(R) + \ ((X) - (R)->valid.left) * VIPS_IMAGE_SIZEOF_PEL((R)->im)): \ (fprintf( stderr, \ @@ -164,4 +164,4 @@ int vips_region_prepare_many( VipsRegion **reg, VipsRect *r ); } #endif /*__cplusplus*/ -#endif /*IM_REGION_H*/ +#endif /*VIPS_REGION_H*/ diff --git a/libvips/include/vips/semaphore.h b/libvips/include/vips/semaphore.h index bcd2a168..83560801 100644 --- a/libvips/include/vips/semaphore.h +++ b/libvips/include/vips/semaphore.h @@ -33,8 +33,8 @@ */ -#ifndef IM_SEMAPHORE_H -#define IM_SEMAPHORE_H +#ifndef VIPS_SEMAPHORE_H +#define VIPS_SEMAPHORE_H #ifdef __cplusplus extern "C" { @@ -61,4 +61,4 @@ void vips_semaphore_init( VipsSemaphore *s, int v, char *name ); } #endif /*__cplusplus*/ -#endif /*IM_SEMAPHORE_H*/ +#endif /*VIPS_SEMAPHORE_H*/ diff --git a/libvips/include/vips/thread.h b/libvips/include/vips/thread.h index 46a8550f..77b32635 100644 --- a/libvips/include/vips/thread.h +++ b/libvips/include/vips/thread.h @@ -28,8 +28,8 @@ */ -#ifndef IM_THREAD_H -#define IM_THREAD_H +#ifndef VIPS_THREAD_H +#define VIPS_THREAD_H #ifdef __cplusplus extern "C" { @@ -41,25 +41,25 @@ extern "C" { FIXME ... should have an environment variable for this? */ -#define IM__DEFAULT_STACK_SIZE (2 * 1024 * 1024) +#define VIPS__DEFAULT_STACK_SIZE (2 * 1024 * 1024) #ifndef HAVE_THREADS #undef g_thread_supported #define g_thread_supported() (0) -#define g_thread_init im__g_thread_init -#define g_thread_join im__g_thread_join -#define g_thread_self im__g_thread_self -#define g_thread_create_full im__g_thread_create_full +#define g_thread_init vips__g_thread_init +#define g_thread_join vips__g_thread_join +#define g_thread_self vips__g_thread_self +#define g_thread_create_full vips__g_thread_create_full /* We don't need a shadow imlementation of g_thread_create(), even though we * use it, because it's just a macro over g_thread_create_full(). */ -void im__g_thread_init( GThreadFunctions *vtable ); -gpointer im__g_thread_join( GThread * ); -gpointer im__g_thread_self( void ); -GThread *im__g_thread_create_full( GThreadFunc, +void vips__g_thread_init( GThreadFunctions *vtable ); +gpointer vips__g_thread_join( GThread * ); +gpointer vips__g_thread_self( void ); +GThread *vips__g_thread_create_full( GThreadFunc, gpointer, gulong, gboolean, gboolean, GThreadPriority, GError ** ); #undef g_mutex_new @@ -67,19 +67,19 @@ GThread *im__g_thread_create_full( GThreadFunc, #undef g_mutex_lock #undef g_mutex_unlock -#define g_mutex_new im__g_mutex_new -#define g_mutex_free im__g_mutex_free -#define g_mutex_lock im__g_mutex_lock -#define g_mutex_unlock im__g_mutex_unlock +#define g_mutex_new vips__g_mutex_new +#define g_mutex_free vips__g_mutex_free +#define g_mutex_lock vips__g_mutex_lock +#define g_mutex_unlock vips__g_mutex_unlock -GMutex *im__g_mutex_new( void ); -void im__g_mutex_free( GMutex * ); -void im__g_mutex_lock( GMutex * ); -void im__g_mutex_unlock( GMutex * ); +GMutex *vips__g_mutex_new( void ); +void vips__g_mutex_free( GMutex * ); +void vips__g_mutex_lock( GMutex * ); +void vips__g_mutex_unlock( GMutex * ); #endif /*!HAVE_THREADS*/ #ifdef __cplusplus } #endif /*__cplusplus*/ -#endif /*IM_THREAD_H*/ +#endif /*VIPS_THREAD_H*/ diff --git a/libvips/include/vips/threadpool.h b/libvips/include/vips/threadpool.h index a6deb3a7..024ac9b3 100644 --- a/libvips/include/vips/threadpool.h +++ b/libvips/include/vips/threadpool.h @@ -33,8 +33,8 @@ */ -#ifndef IM_THREADPOOL_H -#define IM_THREADPOOL_H +#ifndef VIPS_THREADPOOL_H +#define VIPS_THREADPOOL_H #ifdef __cplusplus extern "C" { @@ -152,11 +152,11 @@ int vips_sink_memory( VipsImage *im ); void vips__print_renders( void ); -void im_concurrency_set( int concurrency ); -int im_concurrency_get( void ); +void vips_concurrency_set( int concurrency ); +int vips_concurrency_get( void ); #ifdef __cplusplus } #endif /*__cplusplus*/ -#endif /*IM_THREADPOOL_H*/ +#endif /*VIPS_THREADPOOL_H*/ diff --git a/libvips/include/vips/vector.h b/libvips/include/vips/vector.h index 76ecad6b..6b17e85e 100644 --- a/libvips/include/vips/vector.h +++ b/libvips/include/vips/vector.h @@ -30,8 +30,8 @@ */ -#ifndef IM_VECTOR_H -#define IM_VECTOR_H +#ifndef VIPS_VECTOR_H +#define VIPS_VECTOR_H #ifdef HAVE_ORC #include @@ -135,4 +135,4 @@ void vips_executor_run( VipsExecutor *executor ); } #endif /*__cplusplus*/ -#endif /*IM_VECTOR_H*/ +#endif /*VIPS_VECTOR_H*/ diff --git a/libvips/include/vips/version.h.in b/libvips/include/vips/version.h.in index 2529a6da..53988910 100644 --- a/libvips/include/vips/version.h.in +++ b/libvips/include/vips/version.h.in @@ -1,15 +1,13 @@ /* Macros for the header version. */ -#ifndef IM_VERSION_H -#define IM_VERSION_H +#ifndef VIPS_VERSION_H +#define VIPS_VERSION_H -#define IM_VERSION "@IM_VERSION@" -#define IM_VERSION_STRING "@IM_VERSION_STRING@" -#define IM_MAJOR_VERSION (@IM_MAJOR_VERSION@) -#define IM_MINOR_VERSION (@IM_MINOR_VERSION@) -#define IM_MICRO_VERSION (@IM_MICRO_VERSION@) -#define IM_INTERFACE_AGE (@IM_INTERFACE_AGE@) -#define IM_BINARY_AGE (@IM_BINARY_AGE@) +#define VIPS_VERSION "@VIPS_VERSION@" +#define VIPS_VERSION_STRING "@VIPS_VERSION_STRING@" +#define VIPS_MAJOR_VERSION (@VIPS_MAJOR_VERSION@) +#define VIPS_MINOR_VERSION (@VIPS_MINOR_VERSION@) +#define VIPS_MICRO_VERSION (@VIPS_MICRO_VERSION@) -#endif /*IM_VERSION_H*/ +#endif /*VIPS_VERSION_H*/ diff --git a/libvips/include/vips/vips7compat.h b/libvips/include/vips/vips7compat.h index bfefd691..aa9052ab 100644 --- a/libvips/include/vips/vips7compat.h +++ b/libvips/include/vips/vips7compat.h @@ -473,6 +473,18 @@ int im_wrapmany( VipsImage **in, VipsImage *out, #define im_amiMSBfirst vips_amiMSBfirst #define im__temp_name vips__temp_name +#define IM_VERSION_STRING VIPS_VERSION_STRING +#define IM_MAJOR_VERSION VIPS_MAJOR_VERSION +#define IM_MINOR_VERSION VIPS_MINOR_VERSION +#define IM_MICRO_VERSION VIPS_MICRO_VERSION + +#define IM_EXEEXT VIPS_EXEEXT + +#define IM_SIZEOF_HEADER VIPS_SIZEOF_HEADER + +#define im_concurrency_set vips_concurrency_set +#define im_concurrency_get vips_concurrency_get + #ifdef __cplusplus } #endif /*__cplusplus*/ diff --git a/libvips/iofuncs/error.c b/libvips/iofuncs/error.c index 7c334c8c..73e376f0 100644 --- a/libvips/iofuncs/error.c +++ b/libvips/iofuncs/error.c @@ -93,13 +93,13 @@ * |[ * IMAGE *im; * - * if( !(im = im_open( filename, "r" )) ) - * // im_open will set a mmessage, we don't need to + * if( !(im = vips_image_new_from_file( filename, "r" )) ) + * // vips_image_new_from_file() will set a mmessage, we don't need to * return( -1 ); * - * if( im->Xsize < 100 ) { + * if( vips_image_get_width( im ) < 100 ) { * // we have detected an error, we must set a message - * vips_error( "myprogram", "%s", _( "XSize too small" ) ); + * vips_error( "myprogram", "%s", _( "width too small" ) ); * return( -1 ); * } * ]| @@ -110,8 +110,8 @@ /* Make global array to keep the error message buffer. */ -#define IM_MAX_ERROR (10240) -static char vips_error_text[IM_MAX_ERROR] = ""; +#define VIPS_MAX_ERROR (10240) +static char vips_error_text[VIPS_MAX_ERROR] = ""; static VipsBuf vips_error_buf = VIPS_BUF_STATIC( vips_error_text ); #define IM_DIAGNOSTICS "IM_DIAGNOSTICS" @@ -211,7 +211,7 @@ vips_verror_system( int err, const char *domain, const char *fmt, va_list ap ) err, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), (LPSTR) &buf, 0, NULL ) ) { - im_error( _( "windows error" ), "%s", buf ); + vips_error( _( "windows error" ), "%s", buf ); LocalFree( buf ); } } diff --git a/libvips/iofuncs/generate.c b/libvips/iofuncs/generate.c index fc70787e..79a77894 100644 --- a/libvips/iofuncs/generate.c +++ b/libvips/iofuncs/generate.c @@ -270,7 +270,7 @@ vips_demand_hint_array( VipsImage *image, VipsDemandStyle hint, VipsImage **in ) int i, len, nany; VipsDemandStyle set_hint; - /* How many input images are there? And how many are IM_ANY? + /* How many input images are there? And how many are ANY? */ for( i = 0, len = 0, nany = 0; in[i]; i++, len++ ) if( in[i]->dhint == VIPS_DEMAND_STYLE_ANY ) @@ -285,8 +285,8 @@ vips_demand_hint_array( VipsImage *image, VipsDemandStyle hint, VipsImage **in ) */ ; else if( nany == len ) - /* Special case: if all the inputs are IM_ANY, then output can - * be IM_ANY regardless of what this function wants. + /* Special case: if all the inputs are ANY, then output can + * be ANY regardless of what this function wants. */ set_hint = VIPS_DEMAND_STYLE_ANY; else diff --git a/libvips/iofuncs/image.c b/libvips/iofuncs/image.c index 8231f4db..2670b148 100644 --- a/libvips/iofuncs/image.c +++ b/libvips/iofuncs/image.c @@ -88,7 +88,7 @@ * @VIPS_DEMAND_STYLE_THINSTRIP: demand in thin (typically 1 pixel high) strips * @VIPS_DEMAND_STYLE_ANY: demand geometry does not matter * - * See im_demand_hint(). Operations can hint to the VIPS image IO system about + * See vips_demand_hint(). Operations can hint to the VIPS image IO system about * the kind of demand geometry they prefer. * * These demand styles are given below in order of increasing @@ -191,7 +191,7 @@ * @start: Start time * * A structure available to eval callbacks giving information on evaluation - * progress. See im_add_eval_callback(). + * progress. See #VipsImage::eval. */ /** @@ -319,12 +319,12 @@ enum { /* Progress feedback. Only really useful for testing, tbh. */ -int im__progress = 0; +int vips__progress = 0; /* A string giving the image size (in bytes of uncompressed image) above which * we decompress to disc on open. Can be eg. "12m" for 12 megabytes. */ -char *im__disc_threshold = NULL; +char *vips__disc_threshold = NULL; static guint vips_image_signals[SIG_LAST] = { 0 }; @@ -490,19 +490,19 @@ vips_image_print( VipsObject *object, VipsBuf *buf ) } static void * -vips_image_sanity_upstream( VipsImage *im_up, VipsImage *im_down ) +vips_image_sanity_upstream( VipsImage *up, VipsImage *down ) { - if( !g_slist_find( im_up->downstream, im_down ) || - !g_slist_find( im_down->upstream, im_up ) ) - return( im_up ); + if( !g_slist_find( up->downstream, down ) || + !g_slist_find( down->upstream, up ) ) + return( up ); return( NULL ); } static void * -vips_image_sanity_downstream( VipsImage *im_down, VipsImage *im_up ) +vips_image_sanity_downstream( VipsImage *down, VipsImage *up ) { - return( vips_image_sanity_upstream( im_up, im_down ) ); + return( vips_image_sanity_upstream( up, down ) ); } static void @@ -676,8 +676,8 @@ disc_threshold( void ) if( (env = g_getenv( "IM_DISC_THRESHOLD" )) ) threshold = parse_size( env ); - if( im__disc_threshold ) - threshold = parse_size( im__disc_threshold ); + if( vips__disc_threshold ) + threshold = parse_size( vips__disc_threshold ); VIPS_DEBUG_MSG( "disc_threshold: %zd bytes\n", threshold ); } @@ -845,7 +845,7 @@ vips_image_preeval_cb( VipsImage *image, VipsProgress *progress, int *last ) &tile_width, &tile_height, &nlines ); printf( _( "%s %s: %d threads, %d x %d tiles, groups of %d scanlines" ), g_get_prgname(), image->filename, - im_concurrency_get(), + vips_concurrency_get(), tile_width, tile_height, nlines ); printf( "\n" ); @@ -884,7 +884,7 @@ vips_image_posteval_cb( VipsImage *image, VipsProgress *progress ) static void vips_image_add_progress( VipsImage *image ) { - if( im__progress || + if( vips__progress || g_getenv( "IM_PROGRESS" ) ) { /* Keep the %complete we displayed last time here. @@ -1079,7 +1079,7 @@ vips_image_class_init( VipsImageClass *class ) GParamSpec *pspec; /* Pass in a nonsense name for argv0 ... this init world is only here - * for old programs which are missing an im_init_world() call. We must + * for old programs which are missing an vips_init() call. We must * have threads set up before we can process. */ if( vips_init( "vips" ) ) @@ -1177,7 +1177,7 @@ vips_image_class_init( VipsImageClass *class ) pspec = g_param_spec_int( "sizeof_header", "Size of header", _( "Offset in bytes from start of file" ), - 0, 1000000, IM_SIZEOF_HEADER, + 0, 1000000, VIPS_SIZEOF_HEADER, G_PARAM_READWRITE ); g_object_class_install_property( gobject_class, PROP_SIZEOF_HEADER, pspec ); @@ -1253,7 +1253,7 @@ vips_image_init( VipsImage *image ) image->fd = -1; /* since 0 is stdout */ image->sslock = g_mutex_new(); - image->sizeof_header = IM_SIZEOF_HEADER; + image->sizeof_header = VIPS_SIZEOF_HEADER; } int @@ -1661,9 +1661,9 @@ vips_image_new_from_file_raw( const char *filename, * * This function wraps an #IMAGE around a memory buffer. VIPS does not take * responsibility for the area of memory, it's up to you to make sure it's - * freed when the image is closed. See for example im_add_close_callback(). + * freed when the image is closed. See for example #VipsObject::close. * - * See also: im_binfile(), im_raw2vips(), im_open(). + * See also: im_binfile(), im_raw2vips(), vips_image_new(). * * Returns: the new #VipsImage, or %NULL on error. */ @@ -1706,9 +1706,9 @@ vips_image_new_temp_cb( VipsImage *image ) * Make a "w" disc #VipsImage which will be automatically unlinked when it is * destroyed. @format is something like "%s.v" for a vips file. * - * The file is created in the temporary directory, see im__temp_name(). + * The file is created in the temporary directory, see vips__temp_name(). * - * See also: im__temp_name(). + * See also: vips__temp_name(). * * Returns: the new #VipsImage, or %NULL on error. */ @@ -1808,8 +1808,8 @@ vips_image_new_array( VipsImage *parent, VipsImage **images, int n ) } /* Get the image ready for writing. This can get called many - * times. Used by vips_image_generate() and vips_image_write_line(). vips7 compat can - * call this as im_setupout(). + * times. Used by vips_image_generate() and vips_image_write_line(). vips7 + * compat can call this as im_setupout(). */ int vips__image_write_prepare( VipsImage *image ) @@ -1829,8 +1829,6 @@ vips__image_write_prepare( VipsImage *image ) image->Bbits = vips_format_sizeof( image->BandFmt ) << 3; if( image->dtype == VIPS_IMAGE_PARTIAL ) { - /* Make it into a im_setbuf() image. - */ VIPS_DEBUG_MSG( "vips__image_write_prepare: " "old-style output for %s\n", image->filename ); @@ -1874,7 +1872,7 @@ vips__image_write_prepare( VipsImage *image ) * * Write a line of pixels to an image. This function must be called repeatedly * with @ypos increasing from 0 to @YSize - - * @linebuffer must be IM_IMAGE_SIZEOF_LINE() bytes long. + * @linebuffer must be VIPS_IMAGE_SIZEOF_LINE() bytes long. * * See also: vips_image_generate(). * @@ -1904,7 +1902,7 @@ vips_image_write_line( VipsImage *image, int ypos, PEL *linebuffer ) case VIPS_IMAGE_OPENOUT: /* Don't use ypos for this. */ - if( im__write( image->fd, linebuffer, linesize ) ) + if( vips__write( image->fd, linebuffer, linesize ) ) return( -1 ); break; @@ -2011,7 +2009,8 @@ vips_image_wio_input( VipsImage *image ) case VIPS_IMAGE_PARTIAL: #ifdef DEBUG_IO - printf( "im_incheck: converting partial image to WIO\n" ); + printf( "vips_image_wio_input: " + "converting partial image to WIO\n" ); #endif/*DEBUG_IO*/ /* Change to VIPS_IMAGE_SETBUF. First, make a memory @@ -2040,7 +2039,8 @@ vips_image_wio_input( VipsImage *image ) case VIPS_IMAGE_OPENIN: #ifdef DEBUG_IO - printf( "im_incheck: converting openin image for wio input\n" ); + printf( "vips_image_wio_input: " + "converting openin image for wio input\n" ); #endif/*DEBUG_IO*/ /* just mmap() the whole thing. @@ -2245,7 +2245,8 @@ vips_image_pio_input( VipsImage *image ) break; default: - vips_error( "im_pincheck", "%s", _( "image not readable" ) ); + vips_error( "vips_image_pio_input", + "%s", _( "image not readable" ) ); return( -1 ); } @@ -2274,8 +2275,8 @@ vips_image_pio_output( VipsImage *image ) switch( image->dtype ) { case VIPS_IMAGE_SETBUF: if( image->data ) { - vips_error( "im_poutcheck", "%s", - _( "image already written" ) ); + vips_error( "vips_image_pio_output", + "%s", _( "image already written" ) ); return( -1 ); } @@ -2283,8 +2284,8 @@ vips_image_pio_output( VipsImage *image ) case VIPS_IMAGE_PARTIAL: if( image->generate ) { - vips_error( "im_poutcheck", "%s", - _( "image already written" ) ); + vips_error( "im_poutcheck", + "%s", _( "image already written" ) ); return( -1 ); } diff --git a/libvips/iofuncs/init.c b/libvips/iofuncs/init.c index 263629af..c749318e 100644 --- a/libvips/iofuncs/init.c +++ b/libvips/iofuncs/init.c @@ -222,7 +222,7 @@ vips_init( const char *argv0 ) * plugin. */ if( im_load_plugins( "%s/vips-%d.%d", - libdir, IM_MAJOR_VERSION, IM_MINOR_VERSION ) ) { + libdir, VIPS_MAJOR_VERSION, VIPS_MINOR_VERSION ) ) { vips_warn( "vips_init", "%s", vips_error_buffer() ); vips_error_clear(); } @@ -271,22 +271,22 @@ vips__ngettext( const char *msgid, const char *plural, unsigned long int n ) } static GOptionEntry option_entries[] = { - { "vips-concurrency", 'c', 0, G_OPTION_ARG_INT, &im__concurrency, + { "vips-concurrency", 'c', 0, G_OPTION_ARG_INT, &vips__concurrency, N_( "evaluate with N concurrent threads" ), "N" }, - { "vips-tile-width", 'w', 0, G_OPTION_ARG_INT, &im__tile_width, + { "vips-tile-width", 'w', 0, G_OPTION_ARG_INT, &vips__tile_width, N_( "set tile width to N (DEBUG)" ), "N" }, - { "vips-tile-height", 'h', 0, G_OPTION_ARG_INT, &im__tile_height, + { "vips-tile-height", 'h', 0, G_OPTION_ARG_INT, &vips__tile_height, N_( "set tile height to N (DEBUG)" ), "N" }, { "vips-thinstrip-height", 't', 0, - G_OPTION_ARG_INT, &im__thinstrip_height, + G_OPTION_ARG_INT, &vips__thinstrip_height, N_( "set thinstrip height to N (DEBUG)" ), "N" }, { "vips-fatstrip-height", 'f', 0, - G_OPTION_ARG_INT, &im__fatstrip_height, + G_OPTION_ARG_INT, &vips__fatstrip_height, N_( "set fatstrip height to N (DEBUG)" ), "N" }, - { "vips-progress", 'p', 0, G_OPTION_ARG_NONE, &im__progress, + { "vips-progress", 'p', 0, G_OPTION_ARG_NONE, &vips__progress, N_( "show progress feedback" ), NULL }, { "vips-disc-threshold", 'd', 0, G_OPTION_ARG_STRING, - &im__disc_threshold, + &vips__disc_threshold, N_( "image size above which to decompress to disc" ), NULL }, { "vips-novector", 't', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &vips__vector_enabled, @@ -535,7 +535,7 @@ guess_prefix( const char *argv0, const char *name ) /* Fall back to the configure-time prefix. */ - return( IM_PREFIX ); + return( VIPS_PREFIX ); } /** @@ -580,10 +580,10 @@ vips_guess_prefix( const char *argv0, const char *env_name ) /* Add the exe suffix, if it's missing. */ - if( strlen( IM_EXEEXT ) > 0 ) { - const char *olds[] = { IM_EXEEXT }; + if( strlen( VIPS_EXEEXT ) > 0 ) { + const char *olds[] = { VIPS_EXEEXT }; - vips__change_suffix( p, name, PATH_MAX, IM_EXEEXT, olds, 1 ); + vips__change_suffix( p, name, PATH_MAX, VIPS_EXEEXT, olds, 1 ); } else vips_strncpy( name, p, PATH_MAX ); @@ -632,14 +632,14 @@ vips_guess_libdir( const char *argv0, const char *env_name ) /* Have we been moved since configure? If not, use the configure-time * libdir. */ - if( strcmp( prefix, IM_PREFIX ) == 0 ) - libdir = IM_LIBDIR; + if( strcmp( prefix, VIPS_PREFIX ) == 0 ) + libdir = VIPS_LIBDIR; else libdir = g_strdup_printf( "%s/lib", prefix ); #ifdef DEBUG - printf( "vips_guess_libdir: IM_PREFIX = %s\n", IM_PREFIX ); - printf( "vips_guess_libdir: IM_LIBDIR = %s\n", IM_LIBDIR ); + printf( "vips_guess_libdir: VIPS_PREFIX = %s\n", VIPS_PREFIX ); + printf( "vips_guess_libdir: VIPS_LIBDIR = %s\n", VIPS_LIBDIR ); printf( "vips_guess_libdir: prefix = %s\n", prefix ); printf( "vips_guess_libdir: libdir = %s\n", libdir ); #endif /*DEBUG*/ diff --git a/libvips/iofuncs/memory.c b/libvips/iofuncs/memory.c index a87d9077..804a38bd 100644 --- a/libvips/iofuncs/memory.c +++ b/libvips/iofuncs/memory.c @@ -155,7 +155,7 @@ vips_free( void *s ) next_trace += 1; if( next_trace > trace_freq ) { - printf( "im_free: %d, %d allocs, total %.3gM, " + printf( "vips_free: %d, %d allocs, total %.3gM, " "high water %.3gM\n", size, total_allocs, @@ -191,8 +191,8 @@ vips_malloc_cb( VipsImage *image, char *buf ) * * Malloc local to @im, that is, the memory will be automatically * freed for you when the image is closed. If @im is %NULL, you need to free - * the memory explicitly with im_free(). - * If allocation fails im_malloc() returns %NULL and + * the memory explicitly with vips_free(). + * If allocation fails vips_malloc() returns %NULL and * sets an error message. * * If two threads try to allocate local to the same @im at the same time, you @@ -206,7 +206,7 @@ vips_malloc( VipsImage *image, size_t size ) void *buf; #ifdef DEBUGM - /* Assume the first im_malloc() is single-threaded. + /* Assume the first vips_malloc() is single-threaded. */ if( !malloc_mutex ) malloc_mutex = g_mutex_new(); @@ -225,10 +225,10 @@ vips_malloc( VipsImage *image, size_t size ) g_assert( 0 ); #endif /*DEBUG*/ - vips_error( "im_malloc", + vips_error( "vips_malloc", _( "out of memory --- size == %dMB" ), (int) (size / (1024.0*1024.0)) ); - vips_warn( "im_malloc", + vips_warn( "vips_malloc", _( "out of memory --- size == %dMB" ), (int) (size / (1024.0*1024.0)) ); return( NULL ); diff --git a/libvips/iofuncs/region.c b/libvips/iofuncs/region.c index 87e3d899..63664f49 100644 --- a/libvips/iofuncs/region.c +++ b/libvips/iofuncs/region.c @@ -329,13 +329,13 @@ vips_region_print( VipsObject *object, VipsBuf *buf ) /* If a region is being created in one thread (eg. the main thread) and then * used in another (eg. a worker thread), the new thread needs to tell VIPS * to stop sanity g_assert() fails. The previous owner needs to - * im__region_no_ownership() before we can call this. + * vips__region_no_ownership() before we can call this. */ void vips__region_take_ownership( VipsRegion *region ) { /* Lock so that there's a memory barrier with the thread doing the - * im__region_no_ownership() before us. + * vips__region_no_ownership() before us. */ g_mutex_lock( region->im->sslock ); @@ -943,10 +943,10 @@ vips_region_generate( VipsRegion *reg ) * blocks until the pixels are ready. * * Use vips_region_prepare_thread() to calculate an area of pixels with many - * threads. Use im_render_priority() to calculate an area of pixels in the + * threads. Use vips_sink_screen() to calculate an area of pixels in the * background. * - * See also: vips_region_prepare_thread(), im_render_priority(), + * See also: vips_region_prepare_thread(), vips_sink_screen(), * vips_region_prepare_to(). * * Returns: 0 on success, or -1 on error. @@ -1031,7 +1031,8 @@ vips_region_prepare_to_generate( VipsRegion *reg, char *p; if( !im->generate ) { - vips_error( "im_prepare_to", "%s", _( "incomplete header" ) ); + vips_error( "vips_region_prepare_to", + "%s", _( "incomplete header" ) ); return( -1 ); } @@ -1101,14 +1102,14 @@ vips_region_prepare_to( VipsRegion *reg, if( !dest->data || dest->im->BandFmt != reg->im->BandFmt || dest->im->Bands != reg->im->Bands ) { - vips_error( "im_prepare_to", + vips_error( "vips_region_prepare_to", "%s", _( "inappropriate region type" ) ); return( -1 ); } /* clip r first against the size of reg->im, then again against the * memory we have available to write to on dest. Just like - * im_region_region() + * vips_region_region() */ image.top = 0; image.left = 0; @@ -1127,7 +1128,8 @@ vips_region_prepare_to( VipsRegion *reg, /* Test that dest->valid is large enough. */ if( !vips_rect_includesrect( &dest->valid, &wanted ) ) { - vips_error( "im_prepare_to", "%s", _( "dest too small" ) ); + vips_error( "vips_region_prepare_to", + "%s", _( "dest too small" ) ); return( -1 ); } @@ -1144,13 +1146,14 @@ vips_region_prepare_to( VipsRegion *reg, y = clipped2.top; if( vips_rect_isempty( &final ) ) { - vips_error( "im_prepare_to", + vips_error( "vips_region_prepare_to", "%s", _( "valid clipped to nothing" ) ); return( -1 ); } #ifdef DEBUG - printf( "im_prepare_to: left = %d, top = %d, width = %d, height = %d\n", + printf( "vips_region_prepare_to: " + "left = %d, top = %d, width = %d, height = %d\n", final.left, final.top, final.width, final.height ); #endif /*DEBUG*/ @@ -1196,8 +1199,9 @@ vips_region_prepare_to( VipsRegion *reg, break; default: - vips_error( "im_prepare_to", _( "unable to input from a " - "%s image" ), im_dtype2char( im->dtype ) ); + vips_error( "vips_region_prepare_to", + _( "unable to input from a %s image" ), + VIPS_ENUM_NICK( VIPS_TYPE_DEMAND_STYLE, im->dtype ) ); return( -1 ); } diff --git a/libvips/iofuncs/semaphore.c b/libvips/iofuncs/semaphore.c index 69d3a05c..f5122dd1 100644 --- a/libvips/iofuncs/semaphore.c +++ b/libvips/iofuncs/semaphore.c @@ -99,7 +99,7 @@ vips_semaphore_upn( VipsSemaphore *s, int n ) printf( "vips_semaphore_upn(\"%s\",%d) = %d\n", s->name, n, value_after_op ); if( value_after_op > 1 ) - im_errormsg( "up over 1!" ); + vips_error( "vips_semaphore_upn", "up over 1!" ); #endif /*DEBUG_IO*/ return( value_after_op ); diff --git a/libvips/iofuncs/sinkdisc.c b/libvips/iofuncs/sinkdisc.c index f9d9994c..51c4220f 100644 --- a/libvips/iofuncs/sinkdisc.c +++ b/libvips/iofuncs/sinkdisc.c @@ -99,10 +99,6 @@ typedef struct _Write { void *a; } Write; -/* Enable im_wbuffer2 ... set from the cmd line, tested by our users. - */ -int im__wbuffer2 = 0; - /* Our per-thread state ... we need to also track the buffer that pos is * supposed to write to. */ @@ -468,7 +464,7 @@ write_free( Write *write ) * This operation is handy for making image sinks which output to things like * disc files. * - * See also: im_concurrency_set(). + * See also: vips_concurrency_set(). * * Returns: 0 on success, -1 on error. */ diff --git a/libvips/iofuncs/sinkscreen.c b/libvips/iofuncs/sinkscreen.c index f98ff038..14af7bab 100644 --- a/libvips/iofuncs/sinkscreen.c +++ b/libvips/iofuncs/sinkscreen.c @@ -535,7 +535,7 @@ render_thread_create( void ) if( !render_thread && have_threads ) { if( !(render_thread = g_thread_create_full( render_thread_main, NULL, - IM__DEFAULT_STACK_SIZE, TRUE, FALSE, + VIPS__DEFAULT_STACK_SIZE, TRUE, FALSE, G_THREAD_PRIORITY_NORMAL, NULL )) ) { vips_error( "sink_screen", "%s", _( "unable to create thread" ) ); diff --git a/libvips/iofuncs/threadpool.c b/libvips/iofuncs/threadpool.c index db38e9b6..4939c549 100644 --- a/libvips/iofuncs/threadpool.c +++ b/libvips/iofuncs/threadpool.c @@ -96,14 +96,14 @@ /* Default tile geometry ... can be set by init_world. */ -int im__tile_width = IM__TILE_WIDTH; -int im__tile_height = IM__TILE_HEIGHT; -int im__fatstrip_height = IM__FATSTRIP_HEIGHT; -int im__thinstrip_height = IM__THINSTRIP_HEIGHT; +int vips__tile_width = VIPS__TILE_WIDTH; +int vips__tile_height = VIPS__TILE_HEIGHT; +int vips__fatstrip_height = VIPS__FATSTRIP_HEIGHT; +int vips__thinstrip_height = VIPS__THINSTRIP_HEIGHT; /* Default n threads ... 0 means get from environment. */ -int im__concurrency = 0; +int vips__concurrency = 0; #ifndef HAVE_THREADS /* If we're building without gthread, we need stubs for the g_thread_*() and @@ -111,24 +111,24 @@ int im__concurrency = 0; * names here. */ -void im__g_thread_init( GThreadFunctions *vtable ) {} -gpointer im__g_thread_join( GThread *dummy ) { return( NULL ); } -gpointer im__g_thread_self( void ) { return( NULL ); } -GThread *im__g_thread_create_full( GThreadFunc d1, +void vips__g_thread_init( GThreadFunctions *vtable ) {} +gpointer vips__g_thread_join( GThread *dummy ) { return( NULL ); } +gpointer vips__g_thread_self( void ) { return( NULL ); } +GThread *vips__g_thread_create_full( GThreadFunc d1, gpointer d2, gulong d3, gboolean d4, gboolean d5, GThreadPriority d6, GError **d7 ) { return( NULL ); } -GMutex *im__g_mutex_new( void ) { return( NULL ); } -void im__g_mutex_free( GMutex *d ) {} -void im__g_mutex_lock( GMutex *d ) {} -void im__g_mutex_unlock( GMutex *d ) {} +GMutex *vips__g_mutex_new( void ) { return( NULL ); } +void vips__g_mutex_free( GMutex *d ) {} +void vips__g_mutex_lock( GMutex *d ) {} +void vips__g_mutex_unlock( GMutex *d ) {} #endif /*!HAVE_THREADS*/ void -im_concurrency_set( int concurrency ) +vips_concurrency_set( int concurrency ) { - im__concurrency = concurrency; + vips__concurrency = concurrency; } static int @@ -198,7 +198,7 @@ get_num_processors( void ) * the number of regions we should pass over the image. */ int -im_concurrency_get( void ) +vips_concurrency_get( void ) { const char *str; int nthr; @@ -206,8 +206,8 @@ im_concurrency_get( void ) /* Tell the threads system how much concurrency we expect. */ - if( im__concurrency > 0 ) - nthr = im__concurrency; + if( vips__concurrency > 0 ) + nthr = vips__concurrency; else if( (str = g_getenv( IM_CONCURRENCY )) && (x = atoi( str )) > 0 ) nthr = x; @@ -217,13 +217,13 @@ im_concurrency_get( void ) if( nthr < 1 || nthr > MAX_THREADS ) { nthr = VIPS_CLIP( 1, nthr, MAX_THREADS ); - vips_warn( "im_concurrency_get", + vips_warn( "vips_concurrency_get", _( "threads clipped to %d" ), nthr ); } /* Save for next time around. */ - im_concurrency_set( nthr ); + vips_concurrency_set( nthr ); return( nthr ); } @@ -400,10 +400,10 @@ vips_thread_save_time_buffers( VipsThread *thr ) FILE *fp; char name[256]; - im_snprintf( name, 256, "time%d", rn++ ); + vips_snprintf( name, 256, "time%d", rn++ ); printf( "vips_thread_save_time_buffers: " "saving buffer to \"%s\"\n", name ); - if( !(fp = im__file_open_write( name, TRUE )) ) + if( !(fp = vips__file_open_write( name, TRUE )) ) return( -1 ); for( i = 0; i < thr->tpos; i++ ) fprintf( fp, "%g, %g\n", thr->btime[i], thr->etime[i] ); @@ -603,7 +603,7 @@ vips_thread_new( VipsThreadpool *pool ) * very small values (eg. various BSDs). */ if( !(thr->thread = g_thread_create_full( vips_thread_main_loop, thr, - IM__DEFAULT_STACK_SIZE, TRUE, FALSE, + VIPS__DEFAULT_STACK_SIZE, TRUE, FALSE, G_THREAD_PRIORITY_NORMAL, NULL )) ) { vips_error( "vips_thread_new", "%s", _( "unable to create thread" ) ); @@ -669,7 +669,7 @@ vips_threadpool_new( VipsImage *im ) pool->allocate = NULL; pool->work = NULL; pool->allocate_lock = g_mutex_new(); - pool->nthr = im_concurrency_get(); + pool->nthr = vips_concurrency_get(); pool->thr = NULL; vips_semaphore_init( &pool->finish, 0, "finish" ); vips_semaphore_init( &pool->tick, 0, "tick" ); @@ -813,7 +813,7 @@ vips_threadpool_create_threads( VipsThreadpool *pool ) * always called by * the main thread (ie. the thread which called vips_threadpool_run()). * - * See also: im_wbuffer2(), im_concurrency_set(). + * See also: vips_concurrency_set(). * * Returns: 0 on success, or -1 on error. */ @@ -893,21 +893,21 @@ vips_threadpool_run( VipsImage *im, * @nlines: return buffer height in scanlines * * Pick a tile size and a buffer height for this image and the current - * value of im_concurrency_get(). The buffer height + * value of vips_concurrency_get(). The buffer height * will always be a multiple of tile_height. */ void vips_get_tile_size( VipsImage *im, int *tile_width, int *tile_height, int *nlines ) { - const int nthr = im_concurrency_get(); + const int nthr = vips_concurrency_get(); /* Pick a render geometry. */ switch( im->dhint ) { case VIPS_DEMAND_STYLE_SMALLTILE: - *tile_width = im__tile_width; - *tile_height = im__tile_height; + *tile_width = vips__tile_width; + *tile_height = vips__tile_height; /* Enough lines of tiles that we can expect to be able to keep * nthr busy. Then double it. @@ -919,13 +919,13 @@ vips_get_tile_size( VipsImage *im, case VIPS_DEMAND_STYLE_ANY: case VIPS_DEMAND_STYLE_FATSTRIP: *tile_width = im->Xsize; - *tile_height = im__fatstrip_height; + *tile_height = vips__fatstrip_height; *nlines = *tile_height * nthr * 2; break; case VIPS_DEMAND_STYLE_THINSTRIP: *tile_width = im->Xsize; - *tile_height = im__thinstrip_height; + *tile_height = vips__thinstrip_height; *nlines = *tile_height * nthr * 2; break; diff --git a/libvips/iofuncs/vips.c b/libvips/iofuncs/vips.c index f4345582..b6497b4c 100644 --- a/libvips/iofuncs/vips.c +++ b/libvips/iofuncs/vips.c @@ -846,7 +846,7 @@ vips__writehist( VipsImage *im ) vips_snprintf( namespace, 256, "%s/%d.%d.%d", NAMESPACE, - IM_MAJOR_VERSION, IM_MINOR_VERSION, IM_MICRO_VERSION ); + VIPS_MAJOR_VERSION, VIPS_MINOR_VERSION, VIPS_MICRO_VERSION ); if( !(doc->children = xmlNewDocNode( doc, NULL, (xmlChar *) "root", NULL )) || set_sprop( doc->children, "xmlns", namespace ) || @@ -908,7 +908,7 @@ vips_image_open_input( VipsImage *image ) /* We don't use im->sizeof_header here, but we know we're reading a * VIPS image anyway. */ - unsigned char header[IM_SIZEOF_HEADER]; + unsigned char header[VIPS_SIZEOF_HEADER]; gint64 psize; gint64 rsize; @@ -916,7 +916,8 @@ vips_image_open_input( VipsImage *image ) image->dtype = VIPS_IMAGE_OPENIN; if( (image->fd = vips__open_image_read( image->filename )) == -1 ) return( -1 ); - if( read( image->fd, header, IM_SIZEOF_HEADER ) != IM_SIZEOF_HEADER || + if( read( image->fd, header, VIPS_SIZEOF_HEADER ) != + VIPS_SIZEOF_HEADER || vips__read_header_bytes( image, header ) ) { vips_error_system( errno, "VipsImage", _( "unable to read header for \"%s\"" ), @@ -959,7 +960,7 @@ vips_image_open_output( VipsImage *image ) /* Don't use im->sizeof_header here, but we know we're * writing a VIPS image anyway. */ - unsigned char header[IM_SIZEOF_HEADER]; + unsigned char header[VIPS_SIZEOF_HEADER]; if( (image->fd = open( image->filename, MODE_WRITE, 0666 )) < 0 ) { @@ -970,7 +971,7 @@ vips_image_open_output( VipsImage *image ) } if( vips__write_header_bytes( image, header ) || - vips__write( image->fd, header, IM_SIZEOF_HEADER ) ) + vips__write( image->fd, header, VIPS_SIZEOF_HEADER ) ) return( -1 ); } diff --git a/libvips/iofuncs/window.c b/libvips/iofuncs/window.c index a43cc572..fbfa5af3 100644 --- a/libvips/iofuncs/window.c +++ b/libvips/iofuncs/window.c @@ -73,12 +73,12 @@ int vips__read_test; /* Add this many lines above and below the mmap() window. */ -int vips__window_margin_pixels = IM__WINDOW_MARGIN_PIXELS; +int vips__window_margin_pixels = VIPS__WINDOW_MARGIN_PIXELS; /* Always map at least this many bytes. There's no point making tiny windows * on small files. */ -int vips__window_margin_bytes = IM__WINDOW_MARGIN_BYTES; +int vips__window_margin_bytes = VIPS__WINDOW_MARGIN_BYTES; /* Track global mmap usage. */ diff --git a/vips-7.25.pc.in b/vips-7.25.pc.in index 864c4ba3..8d411991 100644 --- a/vips-7.25.pc.in +++ b/vips-7.25.pc.in @@ -3,7 +3,7 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -Name: vips-@IM_MAJOR_VERSION@.@IM_MINOR_VERSION@ +Name: vips-@VIPS_MAJOR_VERSION@.@VIPS_MINOR_VERSION@ Description: Image processing library Version: @VERSION@ Requires: @PACKAGES_USED@ diff --git a/vipsCC-7.25.pc.in b/vipsCC-7.25.pc.in index ea68e6d1..0aca1b9a 100644 --- a/vipsCC-7.25.pc.in +++ b/vipsCC-7.25.pc.in @@ -3,8 +3,8 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -Name: vipsCC-@IM_MAJOR_VERSION@.@IM_MINOR_VERSION@ +Name: vipsCC-@VIPS_MAJOR_VERSION@.@VIPS_MINOR_VERSION@ Description: C++ API for vips image processing library Version: @VERSION@ -Requires: vips-@IM_MAJOR_VERSION@.@IM_MINOR_VERSION@ = @VERSION@ +Requires: vips-@VIPS_MAJOR_VERSION@.@VIPS_MINOR_VERSION@ = @VERSION@ Libs: -L${libdir} -lvipsCC