all compiles and links cleanly
or mostly, anyway, try running next
This commit is contained in:
parent
bb813a21b5
commit
c49db35cfa
20
TODO
20
TODO
@ -1,22 +1,8 @@
|
||||
- need some way to reset descriptors for rewind, see:
|
||||
|
||||
check.c: In function ‘im_incheck’:
|
||||
check.c:235: warning: implicit declaration of function ‘im_openin’
|
||||
|
||||
is this the only place? does im_pincheck() do a rewind too?
|
||||
|
||||
yes, it also calls im__close()
|
||||
|
||||
how about ading something to vipsobject like "reset", which contains what's
|
||||
normally in the dispose handler
|
||||
|
||||
vips_object_reset() then runs that and clears the various flags governing
|
||||
members so that you can set more vars and call _build() again
|
||||
|
||||
vips_object_dispose runs the reset method for you
|
||||
|
||||
- debug.c can go?
|
||||
|
||||
make sanity a method on object
|
||||
|
||||
tools/others/sines.c and friends can go
|
||||
|
||||
|
||||
- why not rename VipsBandFormat as VipsFormat? cf. VipsCoding,
|
||||
|
148
doc/reference/libvips-scan
Executable file
148
doc/reference/libvips-scan
Executable file
@ -0,0 +1,148 @@
|
||||
#! /bin/bash
|
||||
|
||||
# libvips-scan - temporary wrapper script for .libs/libvips-scan
|
||||
# Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1
|
||||
#
|
||||
# The libvips-scan program cannot be directly executed until all the libtool
|
||||
# libraries that it depends on are installed.
|
||||
#
|
||||
# This wrapper script should never be moved out of the build directory.
|
||||
# If it is, it will not operate correctly.
|
||||
|
||||
# Sed substitution that helps us do robust quoting. It backslashifies
|
||||
# metacharacters that are still active within double-quoted strings.
|
||||
Xsed='/bin/sed -e 1s/^X//'
|
||||
sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
|
||||
|
||||
# Be Bourne compatible
|
||||
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
||||
emulate sh
|
||||
NULLCMD=:
|
||||
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
|
||||
# is contrary to our usage. Disable this feature.
|
||||
alias -g '${1+"$@"}'='"$@"'
|
||||
setopt NO_GLOB_SUBST
|
||||
else
|
||||
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
|
||||
fi
|
||||
BIN_SH=xpg4; export BIN_SH # for Tru64
|
||||
DUALCASE=1; export DUALCASE # for MKS sh
|
||||
|
||||
# The HP-UX ksh and POSIX shell print the target directory to stdout
|
||||
# if CDPATH is set.
|
||||
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
|
||||
|
||||
relink_command="(cd /home/john/GIT/libvips/doc/reference; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; LD_LIBRARY_PATH=/home/john/vips/lib:/usr/local/lib:; export LD_LIBRARY_PATH; PATH=/home/john/vips/bin:/usr/local/bin:/home/john/.gem/ruby/1.8/bin:/home/john/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games; export PATH; gcc -std=gnu99 -g -Wall .libs/libvips-scan.o -DDEBUG_FATAL -DDEBUG_LEAK -pthread -fopenmp -I/usr/lib/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/libxml2 -I/usr/include/libpng12 -I/usr/include/libexif -I/usr/include/glib-2.0 -I/usr/include/freetype2 -I/usr/include/OpenEXR -I/usr/include/ImageMagick -I/home/john/vips_stable/include/orc-0.4 -pthread -Wl,--export-dynamic -pthread -pthread -pthread -o \$progdir/\$file ../../libvips/.libs/libvips.so /usr/lib/libMagickWand.so /usr/lib/libMagickCore.so -lpng12 /usr/lib/libtiff.so /usr/lib/libjpeg.so /usr/lib/libxml2.so /usr/lib/libpangoft2-1.0.so /usr/lib/libpango-1.0.so /usr/lib/libfreetype.so -lfontconfig /usr/lib/libgobject-2.0.so /usr/lib/libgmodule-2.0.so /usr/lib/libgthread-2.0.so -lrt /usr/lib/libglib-2.0.so /usr/lib/libfftw3.so -L/home/john/vips_stable/lib /home/john/vips_stable/lib/liborc-0.4.so /usr/lib/liblcms.so /usr/lib/libIlmImf.so -lImath -lHalf -lIex -lIlmThread -lcfitsio -lpthread /usr/lib/libmatio.so -lz /usr/lib/libexif.so -lm -pthread -Wl,-rpath -Wl,/home/john/GIT/libvips/libvips/.libs -Wl,-rpath -Wl,/home/john/vips_stable/lib -Wl,-rpath -Wl,/home/john/vips/lib -Wl,-rpath -Wl,/home/john/vips_stable/lib)"
|
||||
|
||||
# This environment variable determines our operation mode.
|
||||
if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then
|
||||
# install mode needs the following variables:
|
||||
generated_by_libtool_version='2.2.6b'
|
||||
notinst_deplibs=' ../../libvips/libvips.la'
|
||||
else
|
||||
# When we are sourced in execute mode, $file and $ECHO are already set.
|
||||
if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
|
||||
ECHO="echo"
|
||||
file="$0"
|
||||
# Make sure echo works.
|
||||
if test "X$1" = X--no-reexec; then
|
||||
# Discard the --no-reexec flag, and continue.
|
||||
shift
|
||||
elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
|
||||
# Yippee, $ECHO works!
|
||||
:
|
||||
else
|
||||
# Restart under the correct shell, and then maybe $ECHO will work.
|
||||
exec /bin/bash "$0" --no-reexec ${1+"$@"}
|
||||
fi
|
||||
fi
|
||||
|
||||
# Find the directory that this script lives in.
|
||||
thisdir=`$ECHO "X$file" | $Xsed -e 's%/[^/]*$%%'`
|
||||
test "x$thisdir" = "x$file" && thisdir=.
|
||||
|
||||
# Follow symbolic links until we get to the real thisdir.
|
||||
file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'`
|
||||
while test -n "$file"; do
|
||||
destdir=`$ECHO "X$file" | $Xsed -e 's%/[^/]*$%%'`
|
||||
|
||||
# If there was a directory component, then change thisdir.
|
||||
if test "x$destdir" != "x$file"; then
|
||||
case "$destdir" in
|
||||
[\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;;
|
||||
*) thisdir="$thisdir/$destdir" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
file=`$ECHO "X$file" | $Xsed -e 's%^.*/%%'`
|
||||
file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'`
|
||||
done
|
||||
|
||||
|
||||
# Usually 'no', except on cygwin/mingw when embedded into
|
||||
# the cwrapper.
|
||||
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no
|
||||
if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then
|
||||
# special case for '.'
|
||||
if test "$thisdir" = "."; then
|
||||
thisdir=`pwd`
|
||||
fi
|
||||
# remove .libs from thisdir
|
||||
case "$thisdir" in
|
||||
*[\\/].libs ) thisdir=`$ECHO "X$thisdir" | $Xsed -e 's%[\\/][^\\/]*$%%'` ;;
|
||||
.libs ) thisdir=. ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Try to get the absolute directory name.
|
||||
absdir=`cd "$thisdir" && pwd`
|
||||
test -n "$absdir" && thisdir="$absdir"
|
||||
|
||||
program=lt-'libvips-scan'
|
||||
progdir="$thisdir/.libs"
|
||||
|
||||
if test ! -f "$progdir/$program" ||
|
||||
{ file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /bin/sed 1q`; \
|
||||
test "X$file" != "X$progdir/$program"; }; then
|
||||
|
||||
file="$$-$program"
|
||||
|
||||
if test ! -d "$progdir"; then
|
||||
mkdir "$progdir"
|
||||
else
|
||||
rm -f "$progdir/$file"
|
||||
fi
|
||||
|
||||
# relink executable if necessary
|
||||
if test -n "$relink_command"; then
|
||||
if relink_command_output=`eval $relink_command 2>&1`; then :
|
||||
else
|
||||
echo "$relink_command_output" >&2
|
||||
rm -f "$progdir/$file"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null ||
|
||||
{ rm -f "$progdir/$program";
|
||||
mv -f "$progdir/$file" "$progdir/$program"; }
|
||||
rm -f "$progdir/$file"
|
||||
fi
|
||||
|
||||
if test -f "$progdir/$program"; then
|
||||
if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
|
||||
# Run the actual program with our arguments.
|
||||
|
||||
exec "$progdir/$program" ${1+"$@"}
|
||||
|
||||
$ECHO "$0: cannot exec $program $*" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# The program doesn't exist.
|
||||
$ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2
|
||||
$ECHO "This script is just a wrapper for $program." 1>&2
|
||||
echo "See the libtool documentation for more information." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
1442
doc/reference/libvips-scan.c
Normal file
1442
doc/reference/libvips-scan.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -72,9 +72,6 @@ int im_extract( IMAGE *, IMAGE *, IMAGE_BOX * );
|
||||
DOUBLEMASK *im_measure( IMAGE *im, IMAGE_BOX *box, int h, int v,
|
||||
int *sel, int nsel, const char *name );
|
||||
|
||||
void error_exit( const char *fmt, ... )
|
||||
__attribute__((noreturn, format(printf, 1, 2)));
|
||||
|
||||
gboolean im_isuint( IMAGE *im );
|
||||
gboolean im_isint( IMAGE *im );
|
||||
gboolean im_isfloat( IMAGE *im );
|
||||
|
@ -66,26 +66,6 @@ extern "C" {
|
||||
G_STMT_START { ; } G_STMT_END
|
||||
#endif /*VIPS_DEBUG_GREEN*/
|
||||
|
||||
/* Print one line for each descriptor, complete dump for one descriptor.
|
||||
*/
|
||||
void im__print_one( int n );
|
||||
void im__print_all( void );
|
||||
|
||||
const char *im_Type2char( VipsInterpretation type );
|
||||
const char *im_BandFormat2char( VipsBandFormat fmt );
|
||||
const char *im_Coding2char( VipsCoding coding );
|
||||
const char *im_Compression2char( int n );
|
||||
const char *im_dtype2char( VipsImageType n );
|
||||
const char *im_dhint2char( VipsDemandStyle style );
|
||||
|
||||
int im_char2Type( const char *str );
|
||||
int im_char2BandFormat( const char *str );
|
||||
int im_char2Coding( const char *str );
|
||||
int im_char2Compression( const char *str );
|
||||
VipsImageType im_char2dtype( const char *str );
|
||||
im_demand_type im_char2dhint( const char *str );
|
||||
|
||||
void im_printdesc( VipsImage *image );
|
||||
int im_image_sanity( VipsImage *im );
|
||||
void im_image_sanity_all( void );
|
||||
|
||||
|
@ -52,7 +52,7 @@ void vips_diag( const char *domain, const char *fmt, ... )
|
||||
void vips_vdiag( const char *domain, const char *fmt, va_list ap );
|
||||
|
||||
void vips_error_exit( const char *fmt, ... )
|
||||
__attribute__((format(printf, 1, 2)));
|
||||
__attribute__((noreturn, format(printf, 1, 2)));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -356,7 +356,8 @@ void vips_image_invalidate_all( VipsImage *image );
|
||||
void vips_image_preeval( VipsImage *image );
|
||||
void vips_image_eval( VipsImage *image, int w, int h );
|
||||
void vips_image_posteval( VipsImage *image );
|
||||
int vips_image_test_kill( VipsImage *image );
|
||||
gboolean vips_image_get_kill( VipsImage *image );
|
||||
void vips_image_set_kill( VipsImage *image, gboolean kill );
|
||||
|
||||
VipsImage *vips_image_new( const char *mode );
|
||||
VipsImage *vips_image_new_from_file( const char *filename, const char *mode );
|
||||
|
@ -108,10 +108,6 @@ int im__has_extension_block( VipsImage *im );
|
||||
void *im__read_extension_block( VipsImage *im, int *size );
|
||||
int im__write_extension_block( VipsImage *im, void *buf, int size );
|
||||
int im__writehist( VipsImage *image );
|
||||
int im__start_eval( VipsImage *im );
|
||||
int im__handle_eval( VipsImage *im, int w, int h );
|
||||
int im__end_eval( VipsImage *im );
|
||||
int im__time_destroy( VipsImage *im );
|
||||
|
||||
void im__tiff_register( void );
|
||||
void im__jpeg_register( void );
|
||||
@ -123,7 +119,7 @@ void im__exr_register( void );
|
||||
void im__magick_register( void );
|
||||
|
||||
extern int im__read_test;
|
||||
extern GMutex *im__global_lock;
|
||||
extern GMutex *vips__global_lock;
|
||||
|
||||
typedef enum {
|
||||
IM__RGB, /* 1 or 3 bands (eg. PPM) */
|
||||
@ -196,7 +192,6 @@ 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 );
|
||||
|
||||
int im__test_kill( VipsImage *im );
|
||||
void *im__mmap( int fd, int writeable, size_t length, gint64 offset );
|
||||
int im__munmap( void *start, size_t length );
|
||||
int im__write( int, const void *, size_t );
|
||||
@ -206,7 +201,6 @@ void im__print_all( void );
|
||||
void im__print_one( int );
|
||||
int im__trigger_callbacks( GSList *cblist );
|
||||
int im__close( VipsImage * );
|
||||
int im__handle_eval( VipsImage *im, int w, int h );
|
||||
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,
|
||||
|
@ -160,8 +160,6 @@ typedef int (*VipsRegionFillFn)( struct _VipsRegion *, void * );
|
||||
int vips_region_fill( struct _VipsRegion *reg,
|
||||
Rect *r, VipsRegionFillFn fn, void *a );
|
||||
|
||||
int im_prepare_many( struct _VipsRegion **reg, Rect *r );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /*__cplusplus*/
|
||||
|
@ -137,10 +137,16 @@ extern "C" {
|
||||
#define im_vwarn vips_vwarn
|
||||
#define im_diag vips_diag
|
||||
#define im_vdiag vips_vdiag
|
||||
#define error_exit vips_error_exit
|
||||
|
||||
#define im_get_argv0 vips_get_argv0
|
||||
#define im_version_string vips_version_string
|
||||
#define im_version vips_version
|
||||
#define im_init_world vips_init
|
||||
#define im_get_option_group vips_get_option_group
|
||||
#define im_guess_prefix vips_guess_prefix
|
||||
#define im_guess_libdir vips_guess_libdir
|
||||
#define im__global_lock vips__global_lock
|
||||
|
||||
#define im_cp_desc vips_image_copy_fields
|
||||
#define im_cp_descv vips_image_copy_fieldsv
|
||||
@ -149,7 +155,16 @@ extern "C" {
|
||||
#define im_image vips_image_new_from_memory
|
||||
#define im_binfile vips_image_new_from_file_raw
|
||||
#define im__open_temp vips_image_new_disc_temp
|
||||
#define im__test_kill( I ) (!vips_image_get_kill( I ))
|
||||
#define im__start_eval( I ) (vips_image_preeval( I ), !vips_image_get_kill( I ))
|
||||
#define im__handle_eval( I, W, H ) \
|
||||
(vips_image_eval( I, W, H ), !vips_image_get_kill( I ))
|
||||
#define im__end_eval vips_image_posteval
|
||||
#define im_invalidate vips_image_invalidate_all
|
||||
#define im_isfile vips_image_isfile
|
||||
#define im_printdesc( I ) vips_object_print( VIPS_OBJECT( I ) )
|
||||
#define im_openout( F ) vips_image_new_from_file( F, "w" )
|
||||
#define im_setbuf( F ) vips_image_new( "t" )
|
||||
|
||||
#define im_initdesc( image, \
|
||||
xsize, ysize, bands, bandbits, bandfmt, coding, \
|
||||
@ -168,6 +183,7 @@ extern "C" {
|
||||
#define im_region_buffer vips_region_buffer
|
||||
#define im_region_black vips_region_black
|
||||
#define im_region_paint vips_region_paint
|
||||
#define im_prepare_many vips_region_prepare_many
|
||||
|
||||
#define im__region_no_ownership vips__region_no_ownership
|
||||
|
||||
@ -205,6 +221,20 @@ int im_local_array( VipsImage *im, void **out, int n,
|
||||
im_construct_fn cons, im_callback_fn dest, void *a, void *b, void *c );
|
||||
|
||||
int im_close( VipsImage *im );
|
||||
VipsImage *im_init( const char *filename );
|
||||
|
||||
const char *im_Type2char( VipsInterpretation type );
|
||||
const char *im_BandFmt2char( VipsBandFormat fmt );
|
||||
const char *im_Coding2char( VipsCoding coding );
|
||||
const char *im_Compression2char( int n );
|
||||
const char *im_dtype2char( VipsImageType n );
|
||||
const char *im_dhint2char( VipsDemandStyle style );
|
||||
|
||||
VipsInterpretation im_char2Type( const char *str );
|
||||
VipsBandFormat im_char2BandFmt( const char *str );
|
||||
VipsCoding im_char2Coding( const char *str );
|
||||
VipsImageType im_char2dtype( const char *str );
|
||||
VipsDemandStyle im_char2dhint( const char *str );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ libiofuncs_la_SOURCES = \
|
||||
im_histlin.c \
|
||||
im_mapfile.c \
|
||||
im_setupout.c \
|
||||
im_guess_prefix.c \
|
||||
sinkmemory.c \
|
||||
sinkscreen.c \
|
||||
sinkdisc.c \
|
||||
@ -31,7 +30,7 @@ libiofuncs_la_SOURCES = \
|
||||
semaphore.c \
|
||||
threadpool.c \
|
||||
util.c \
|
||||
im_init_world.c \
|
||||
init.c \
|
||||
buf.c \
|
||||
window.c \
|
||||
vector.c \
|
||||
|
@ -280,12 +280,12 @@ im_buffer_unref( im_buffer_t *buffer )
|
||||
im_free( buffer );
|
||||
|
||||
#ifdef DEBUG
|
||||
g_mutex_lock( im__global_lock );
|
||||
g_mutex_lock( vips__global_lock );
|
||||
g_assert( g_slist_find( im__buffers_all, buffer ) );
|
||||
im__buffers_all = g_slist_remove( im__buffers_all, buffer );
|
||||
printf( "%d buffers in vips\n",
|
||||
g_slist_length( im__buffers_all ) );
|
||||
g_mutex_unlock( im__global_lock );
|
||||
g_mutex_unlock( vips__global_lock );
|
||||
#endif /*DEBUG*/
|
||||
}
|
||||
}
|
||||
@ -321,10 +321,10 @@ im_buffer_new( IMAGE *im, Rect *area )
|
||||
#endif /*DEBUG*/
|
||||
|
||||
#ifdef DEBUG
|
||||
g_mutex_lock( im__global_lock );
|
||||
g_mutex_lock( vips__global_lock );
|
||||
im__buffers_all = g_slist_prepend( im__buffers_all, buffer );
|
||||
printf( "%d buffers in vips\n", g_slist_length( im__buffers_all ) );
|
||||
g_mutex_unlock( im__global_lock );
|
||||
g_mutex_unlock( vips__global_lock );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
return( buffer );
|
||||
|
@ -7,6 +7,8 @@
|
||||
* 2/10/09
|
||||
* - im_image_sanity() moved here
|
||||
* - im_printdesc() moved here
|
||||
* 5/3/11
|
||||
* - vips8 rewrite
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -51,36 +53,6 @@
|
||||
#include <dmalloc.h>
|
||||
#endif /*WITH_DMALLOC*/
|
||||
|
||||
/* Prettyprint various header fields. Just for vips7 compat, use
|
||||
* VIPS_ENUM_VALUE() instead.
|
||||
*/
|
||||
const char *im_Type2char( VipsInterpretation type )
|
||||
{ return( VIPS_ENUM_STRING( VIPS_TYPE_INTERPRETATION, type ) ); }
|
||||
const char *im_BandFmt2char( VipsBandFormat format )
|
||||
{ return( VIPS_ENUM_STRING( VIPS_TYPE_BAND_FORMAT, format ) ); }
|
||||
const char *im_Coding2char( VipsCoding coding )
|
||||
{ return( VIPS_ENUM_STRING( VIPS_TYPE_CODING, coding ) ); }
|
||||
const char *im_dtype2char( VipsImageType n )
|
||||
{ return( VIPS_ENUM_STRING( VIPS_TYPE_IMAGE_TYPE, n ) ); }
|
||||
const char *im_dhint2char( VipsDemandStyle style )
|
||||
{ return( VIPS_ENUM_STRING( VIPS_TYPE_DEMAND_STYLE, style ) ); }
|
||||
|
||||
int im_char2Type( const char *str )
|
||||
{ return( VIPS_ENUM_VALUE( VIPS_TYPE_INTERPRETATION, str ) ); }
|
||||
int im_char2BandFmt( const char *str )
|
||||
{ return( VIPS_ENUM_VALUE( VIPS_TYPE_BAND_FORMAT, str ) ); }
|
||||
int im_char2Coding( const char *str )
|
||||
{ return( VIPS_ENUM_VALUE( VIPS_TYPE_CODING, str ) ); }
|
||||
int im_char2dtype( const char *str )
|
||||
{ return( VIPS_ENUM_VALUE( VIPS_TYPE_IMAGE_TYPE, str ) ); }
|
||||
int im_char2dhint( const char *str )
|
||||
{ return( VIPS_ENUM_VALUE( VIPS_TYPE_DEMAND_STYLE, str ) ); }
|
||||
|
||||
/* Totally useless now.
|
||||
*/
|
||||
const char *im_Compression2char( int n ) { return( "NONE" ); }
|
||||
int im_char2Compression( const char *str ) { return( -1 ); }
|
||||
|
||||
/* Print something about all current objects.
|
||||
*/
|
||||
void
|
||||
|
@ -127,9 +127,9 @@ vips_error_buffer( void )
|
||||
{
|
||||
const char *msg;
|
||||
|
||||
g_mutex_lock( im__global_lock );
|
||||
g_mutex_lock( vips__global_lock );
|
||||
msg = vips_buf_all( &vips_error_buf );
|
||||
g_mutex_unlock( im__global_lock );
|
||||
g_mutex_unlock( vips__global_lock );
|
||||
|
||||
return( msg );
|
||||
}
|
||||
@ -147,11 +147,11 @@ vips_error_buffer( void )
|
||||
void
|
||||
vips_verror( const char *domain, const char *fmt, va_list ap )
|
||||
{
|
||||
g_mutex_lock( im__global_lock );
|
||||
g_mutex_lock( vips__global_lock );
|
||||
vips_buf_appendf( &vips_error_buf, "%s: ", domain );
|
||||
vips_buf_vappendf( &vips_error_buf, fmt, ap );
|
||||
vips_buf_appends( &vips_error_buf, "\n" );
|
||||
g_mutex_unlock( im__global_lock );
|
||||
g_mutex_unlock( vips__global_lock );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -253,9 +253,9 @@ vips_error_system( int err, const char *domain, const char *fmt, ... )
|
||||
void
|
||||
vips_error_clear( void )
|
||||
{
|
||||
g_mutex_lock( im__global_lock );
|
||||
g_mutex_lock( vips__global_lock );
|
||||
vips_buf_rewind( &vips_error_buf );
|
||||
g_mutex_unlock( im__global_lock );
|
||||
g_mutex_unlock( vips__global_lock );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -276,12 +276,12 @@ void
|
||||
vips_vdiag( const char *domain, const char *fmt, va_list ap )
|
||||
{
|
||||
if( !g_getenv( IM_DIAGNOSTICS ) ) {
|
||||
g_mutex_lock( im__global_lock );
|
||||
g_mutex_lock( vips__global_lock );
|
||||
(void) fprintf( stderr, _( "%s: " ), _( "vips diagnostic" ) );
|
||||
(void) fprintf( stderr, _( "%s: " ), domain );
|
||||
(void) vfprintf( stderr, fmt, ap );
|
||||
(void) fprintf( stderr, "\n" );
|
||||
g_mutex_unlock( im__global_lock );
|
||||
g_mutex_unlock( vips__global_lock );
|
||||
}
|
||||
}
|
||||
|
||||
@ -326,12 +326,12 @@ void
|
||||
vips_vwarn( const char *domain, const char *fmt, va_list ap )
|
||||
{
|
||||
if( !g_getenv( IM_WARNING ) ) {
|
||||
g_mutex_lock( im__global_lock );
|
||||
g_mutex_lock( vips__global_lock );
|
||||
(void) fprintf( stderr, _( "%s: " ), _( "vips warning" ) );
|
||||
(void) fprintf( stderr, _( "%s: " ), domain );
|
||||
(void) vfprintf( stderr, fmt, ap );
|
||||
(void) fprintf( stderr, "\n" );
|
||||
g_mutex_unlock( im__global_lock );
|
||||
g_mutex_unlock( vips__global_lock );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,307 +0,0 @@
|
||||
/* Start up the world of vips.
|
||||
*
|
||||
* 7/1/04 JC
|
||||
* - 1st version
|
||||
* 7/6/05
|
||||
* - g_type_init() too, so we can use gobject
|
||||
* 2/9/06
|
||||
* - also set g_prg_name() and load plugins
|
||||
* 8/12/06
|
||||
* - add liboil support
|
||||
* 5/2/07
|
||||
* - stop a loop if we're called recursively during VIPS startup ... it
|
||||
* can happen if (for example) im_guess_prefix() fails and tries to
|
||||
* i18n an error message (thanks Christian)
|
||||
* 8/6/07
|
||||
* - just warn if plugins fail to load correctly: too annoying to have
|
||||
* VIPS refuse to start because of a dodgy plugin
|
||||
* 7/11/07
|
||||
* - progress feedback option
|
||||
* 5/8/08
|
||||
* - load plugins from libdir/vips-x.x
|
||||
* 5/10/09
|
||||
* - gtkdoc comments
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
This file is part of VIPS.
|
||||
|
||||
VIPS is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
#define DEBUG
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
#include <vips/intl.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <vips/vips.h>
|
||||
#include <vips/thread.h>
|
||||
#include <vips/internal.h>
|
||||
#include <vips/vector.h>
|
||||
|
||||
#ifdef WITH_DMALLOC
|
||||
#include <dmalloc.h>
|
||||
#endif /*WITH_DMALLOC*/
|
||||
|
||||
/* Use in various small places where we need a mutex and it's not worth
|
||||
* making a private one.
|
||||
*/
|
||||
GMutex *vips__global_lock = NULL;
|
||||
|
||||
/* Keep a copy of the argv0 here.
|
||||
*/
|
||||
static char *vips__argv0 = NULL;
|
||||
|
||||
/**
|
||||
* im_get_argv0:
|
||||
*
|
||||
* See also: vips_init_world().
|
||||
*
|
||||
* Returns: a pointer to an internal copy of the argv0 string passed to
|
||||
* vips_init_world(). Do not free this value
|
||||
*/
|
||||
const char *
|
||||
vips_get_argv0( void )
|
||||
{
|
||||
return( vips__argv0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* vips_init_world:
|
||||
* @argv0: name of application
|
||||
*
|
||||
* vips_init_world() starts up the world of VIPS. You should call this on
|
||||
* program startup before using any other VIPS operations. If you do not call
|
||||
* vips_init_world(), VIPS will call it for you when you use your first VIPS
|
||||
* operation, but
|
||||
* it may not be able to get hold of @argv0 and VIPS may therefore be unable
|
||||
* to find its data files. It is much better to call this function yourself.
|
||||
*
|
||||
* vips_init_world() does approximately the following:
|
||||
*
|
||||
* <itemizedlist>
|
||||
* <listitem>
|
||||
* <para>initialises any libraries that VIPS is using, including GObject
|
||||
* and the threading system, if neccessary</para>
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* <para>guesses where the VIPS data files are and sets up
|
||||
* internationalisation --- see im_guess_prefix()
|
||||
* </para>
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* <para>loads any plugins from $libdir/vips-x.y, where x and y are the
|
||||
* major and minor version numbers for this VIPS.
|
||||
* </para>
|
||||
* </listitem>
|
||||
* </itemizedlist>
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* |[
|
||||
* int main( int argc, char **argv )
|
||||
* {
|
||||
* if( vips_init_world( argv[0] ) )
|
||||
* error_exit( "unable to start VIPS" );
|
||||
*
|
||||
* return( 0 );
|
||||
* }
|
||||
* ]|
|
||||
*
|
||||
* See also: im_get_option_group(), im_version(), im_guess_prefix(),
|
||||
* im_guess_libdir().
|
||||
*
|
||||
* Returns: 0 on success, -1 otherwise
|
||||
*/
|
||||
int
|
||||
vips_init_world( const char *argv0 )
|
||||
{
|
||||
static gboolean started = FALSE;
|
||||
static gboolean done = FALSE;
|
||||
char *prgname;
|
||||
const char *prefix;
|
||||
const char *libdir;
|
||||
char name[256];
|
||||
|
||||
/* Two stage done handling: 'done' means we've completed, 'started'
|
||||
* means we're currently initialising. Use this to prevent recursive
|
||||
* invocation.
|
||||
*/
|
||||
if( done )
|
||||
/* Called more than once, we succeeded, just return OK.
|
||||
*/
|
||||
return( 0 );
|
||||
if( started )
|
||||
/* Recursive invocation, something has broken horribly.
|
||||
* Hopefully the first init will handle it.
|
||||
*/
|
||||
return( 0 );
|
||||
started = TRUE;
|
||||
|
||||
VIPS_SETSTR( vips__argv0, argv0 );
|
||||
|
||||
/* Need gobject etc.
|
||||
*/
|
||||
g_type_init();
|
||||
|
||||
#ifdef G_THREADS_ENABLED
|
||||
if( !g_thread_supported() )
|
||||
g_thread_init( NULL );
|
||||
#endif /*G_THREADS_ENABLED*/
|
||||
|
||||
if( !vips__global_lock )
|
||||
vips__global_lock = g_mutex_new();
|
||||
|
||||
prgname = g_path_get_basename( argv0 );
|
||||
g_set_prgname( prgname );
|
||||
g_free( prgname );
|
||||
|
||||
/* Try to discover our prefix.
|
||||
*/
|
||||
if( !(prefix = vips_guess_prefix( argv0, "VIPSHOME" )) ||
|
||||
!(libdir = vips_guess_libdir( argv0, "VIPSHOME" )) )
|
||||
return( -1 );
|
||||
|
||||
/* Get i18n .mo files from $VIPSHOME/share/locale/.
|
||||
*/
|
||||
im_snprintf( name, 256,
|
||||
"%s" G_DIR_SEPARATOR_S "share" G_DIR_SEPARATOR_S "locale",
|
||||
prefix );
|
||||
bindtextdomain( GETTEXT_PACKAGE, name );
|
||||
bind_textdomain_codeset( GETTEXT_PACKAGE, "UTF-8" );
|
||||
|
||||
/* Register base vips types.
|
||||
*/
|
||||
im__meta_init_types();
|
||||
im__format_init();
|
||||
vips__interpolate_init();
|
||||
|
||||
/* Load up any plugins in the vips libdir. We don't error on failure,
|
||||
* it's too annoying to have VIPS refuse to start because of a broken
|
||||
* plugin.
|
||||
*/
|
||||
if( im_load_plugins( "%s/vips-%d.%d",
|
||||
libdir, IM_MAJOR_VERSION, IM_MINOR_VERSION ) ) {
|
||||
vips_warn( "vips_init_world", "%s", vips_error_buffer() );
|
||||
vips_error_clear();
|
||||
}
|
||||
|
||||
/* Also load from libdir. This is old and slightly broken behaviour
|
||||
* :-( kept for back compat convenience.
|
||||
*/
|
||||
if( im_load_plugins( "%s", libdir ) ) {
|
||||
vips_warn( "vips_init_world", "%s", vips_error_buffer() );
|
||||
vips_error_clear();
|
||||
}
|
||||
|
||||
/* Start up the buffer cache.
|
||||
*/
|
||||
im__buffer_init();
|
||||
|
||||
/* Get the run-time compiler going.
|
||||
*/
|
||||
vips_vector_init();
|
||||
|
||||
done = TRUE;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
const char *
|
||||
im__gettext( const char *msgid )
|
||||
{
|
||||
/* Pass in a nonsense name for argv0 ... this init path is only here
|
||||
* for old programs which are missing an vips_init_world() call. We need
|
||||
* i18n set up before we can translate.
|
||||
*/
|
||||
if( vips_init_world( "giant_banana" ) )
|
||||
vips_error_clear();
|
||||
|
||||
return( dgettext( GETTEXT_PACKAGE, msgid ) );
|
||||
}
|
||||
|
||||
const char *
|
||||
im__ngettext( const char *msgid, const char *plural, unsigned long int n )
|
||||
{
|
||||
if( vips_init_world( "giant_banana" ) )
|
||||
vips_error_clear();
|
||||
|
||||
return( dngettext( GETTEXT_PACKAGE, msgid, plural, n ) );
|
||||
}
|
||||
|
||||
static GOptionEntry option_entries[] = {
|
||||
{ "vips-concurrency", 'c', 0, G_OPTION_ARG_INT, &im__concurrency,
|
||||
N_( "evaluate with N concurrent threads" ), "N" },
|
||||
{ "vips-tile-width", 'w', 0, G_OPTION_ARG_INT, &im__tile_width,
|
||||
N_( "set tile width to N (DEBUG)" ), "N" },
|
||||
{ "vips-tile-height", 'h', 0, G_OPTION_ARG_INT, &im__tile_height,
|
||||
N_( "set tile height to N (DEBUG)" ), "N" },
|
||||
{ "vips-thinstrip-height", 't', 0,
|
||||
G_OPTION_ARG_INT, &im__thinstrip_height,
|
||||
N_( "set thinstrip height to N (DEBUG)" ), "N" },
|
||||
{ "vips-fatstrip-height", 'f', 0,
|
||||
G_OPTION_ARG_INT, &im__fatstrip_height,
|
||||
N_( "set fatstrip height to N (DEBUG)" ), "N" },
|
||||
{ "vips-progress", 'p', 0, G_OPTION_ARG_NONE, &im__progress,
|
||||
N_( "show progress feedback" ), NULL },
|
||||
{ "vips-disc-threshold", 'd', 0, G_OPTION_ARG_STRING,
|
||||
&im__disc_threshold,
|
||||
N_( "image size above which to decompress to disc" ), NULL },
|
||||
{ "vips-novector", 't', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE,
|
||||
&im__vector_enabled,
|
||||
N_( "disable vectorised versions of operations" ), NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
* im_get_option_group:
|
||||
*
|
||||
* im_get_option_group() returns a GOptionGroup containing various VIPS
|
||||
* command-line options. It can be used with GOption to help
|
||||
* parse argc/argv.
|
||||
*
|
||||
* See also: im_version(), im_guess_prefix(),
|
||||
* im_guess_libdir(), vips_init_world().
|
||||
*
|
||||
* Returns: a GOptionGroup for VIPS, see GOption
|
||||
*/
|
||||
GOptionGroup *
|
||||
im_get_option_group( void )
|
||||
{
|
||||
static GOptionGroup *option_group = NULL;
|
||||
|
||||
if( !option_group ) {
|
||||
option_group = g_option_group_new(
|
||||
"vips", _( "VIPS Options" ), _( "Show VIPS options" ),
|
||||
NULL, NULL );
|
||||
g_option_group_add_entries( option_group, option_entries );
|
||||
}
|
||||
|
||||
return( option_group );
|
||||
}
|
@ -415,7 +415,6 @@ vips_image_finalize( GObject *gobject )
|
||||
VIPS_FREE( image->Hist );
|
||||
VIPS_FREEF( im__gslist_gvalue_free, image->history_list );
|
||||
im__meta_destroy( image );
|
||||
im__time_destroy( image );
|
||||
|
||||
G_OBJECT_CLASS( vips_image_parent_class )->finalize( gobject );
|
||||
}
|
||||
@ -1346,18 +1345,25 @@ vips_image_posteval( VipsImage *image )
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
vips_image_test_kill( VipsImage *image )
|
||||
gboolean
|
||||
vips_image_get_kill( VipsImage *image )
|
||||
{
|
||||
/* Has kill been set for this image? If yes, abort evaluation.
|
||||
*/
|
||||
if( image->kill ) {
|
||||
if( image->kill )
|
||||
vips_error( "vips_image_test_kill",
|
||||
_( "killed for image \"%s\"" ), image->filename );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
return( image->kill );
|
||||
}
|
||||
|
||||
void
|
||||
vips_image_set_kill( VipsImage *image, gboolean kill )
|
||||
{
|
||||
VIPS_DEBUG_MSG( "vips_image_set_kill: %s = %d\n",
|
||||
image->filename, kill );
|
||||
|
||||
image->kill = kill;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,39 +1,26 @@
|
||||
/* guess the install prefix
|
||||
*
|
||||
* Written on: 5/2/01
|
||||
* Modified on:
|
||||
* 3/3/01 JC
|
||||
* - better behaviour for relative paths in argv0
|
||||
* 22/9/01 JC
|
||||
* - oops, SEGV in some cases for argv0 contains relative path
|
||||
* 26/9/01 JC
|
||||
* - reworked for new prefix scheme
|
||||
* 9/11/01 JC
|
||||
* - grr! added strdup() on putenv() for newer linuxes
|
||||
* 14/12/01 JC
|
||||
* - now uses realpath() for better relative pathname guessing
|
||||
* 21/10/02 JC
|
||||
* - turn off realpath() if not available
|
||||
* - path_is_absolute() from glib
|
||||
* - append ".exe" to name on w32
|
||||
* - prefix cwd() to path on w32
|
||||
* 31/7/03 JC
|
||||
* - better relative path handling
|
||||
* 23/12/04
|
||||
* - use g_setenv()/g_getenv()
|
||||
* 29/4/05
|
||||
* - gah, back to plain setenv() so we work with glib-2.2
|
||||
* 5/10/05
|
||||
* - phew, now we can use g_setenv() again
|
||||
* 18/8/06
|
||||
* - use IM_EXEEXT
|
||||
* 6/2/07 CB
|
||||
* - move trailing '\0' too in extract_prefix
|
||||
* 21/7/07
|
||||
* - fall back to configure-time prefix rather than returning an error
|
||||
* (thanks Jay)
|
||||
/* Start up the world of vips.
|
||||
*
|
||||
* 7/1/04 JC
|
||||
* - 1st version
|
||||
* 7/6/05
|
||||
* - g_type_init() too, so we can use gobject
|
||||
* 2/9/06
|
||||
* - also set g_prg_name() and load plugins
|
||||
* 8/12/06
|
||||
* - add liboil support
|
||||
* 5/2/07
|
||||
* - stop a loop if we're called recursively during VIPS startup ... it
|
||||
* can happen if (for example) vips_guess_prefix() fails and tries to
|
||||
* i18n an error message (thanks Christian)
|
||||
* 8/6/07
|
||||
* - just warn if plugins fail to load correctly: too annoying to have
|
||||
* VIPS refuse to start because of a dodgy plugin
|
||||
* 7/11/07
|
||||
* - progress feedback option
|
||||
* 5/8/08
|
||||
* - added im_guess_libdir()
|
||||
* - load plugins from libdir/vips-x.x
|
||||
* 5/10/09
|
||||
* - gtkdoc comments
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -62,7 +49,7 @@
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
#define DEBUG
|
||||
*/
|
||||
|
||||
@ -82,15 +69,255 @@
|
||||
#ifdef HAVE_DIRECT_H
|
||||
#include <direct.h>
|
||||
#endif /*HAVE_DIRECT_H*/
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <vips/vips.h>
|
||||
#include <vips/thread.h>
|
||||
#include <vips/internal.h>
|
||||
#include <vips/vector.h>
|
||||
|
||||
#ifdef WITH_DMALLOC
|
||||
#include <dmalloc.h>
|
||||
#endif /*WITH_DMALLOC*/
|
||||
|
||||
/* Use in various small places where we need a mutex and it's not worth
|
||||
* making a private one.
|
||||
*/
|
||||
GMutex *vips__global_lock = NULL;
|
||||
|
||||
/* Keep a copy of the argv0 here.
|
||||
*/
|
||||
static char *vips__argv0 = NULL;
|
||||
|
||||
/**
|
||||
* vips_get_argv0:
|
||||
*
|
||||
* See also: vips_init().
|
||||
*
|
||||
* Returns: a pointer to an internal copy of the argv0 string passed to
|
||||
* vips_init(). Do not free this value
|
||||
*/
|
||||
const char *
|
||||
vips_get_argv0( void )
|
||||
{
|
||||
return( vips__argv0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* vips_init:
|
||||
* @argv0: name of application
|
||||
*
|
||||
* vips_init() starts up the world of VIPS. You should call this on
|
||||
* program startup before using any other VIPS operations. If you do not call
|
||||
* vips_init(), VIPS will call it for you when you use your first VIPS
|
||||
* operation, but
|
||||
* it may not be able to get hold of @argv0 and VIPS may therefore be unable
|
||||
* to find its data files. It is much better to call this function yourself.
|
||||
*
|
||||
* vips_init() does approximately the following:
|
||||
*
|
||||
* <itemizedlist>
|
||||
* <listitem>
|
||||
* <para>initialises any libraries that VIPS is using, including GObject
|
||||
* and the threading system, if neccessary</para>
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* <para>guesses where the VIPS data files are and sets up
|
||||
* internationalisation --- see vips_guess_prefix()
|
||||
* </para>
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* <para>loads any plugins from $libdir/vips-x.y, where x and y are the
|
||||
* major and minor version numbers for this VIPS.
|
||||
* </para>
|
||||
* </listitem>
|
||||
* </itemizedlist>
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* |[
|
||||
* int main( int argc, char **argv )
|
||||
* {
|
||||
* if( vips_init( argv[0] ) )
|
||||
* error_exit( "unable to start VIPS" );
|
||||
*
|
||||
* return( 0 );
|
||||
* }
|
||||
* ]|
|
||||
*
|
||||
* See also: im_get_option_group(), im_version(), vips_guess_prefix(),
|
||||
* vips_guess_libdir().
|
||||
*
|
||||
* Returns: 0 on success, -1 otherwise
|
||||
*/
|
||||
int
|
||||
vips_init( const char *argv0 )
|
||||
{
|
||||
static gboolean started = FALSE;
|
||||
static gboolean done = FALSE;
|
||||
char *prgname;
|
||||
const char *prefix;
|
||||
const char *libdir;
|
||||
char name[256];
|
||||
|
||||
/* Two stage done handling: 'done' means we've completed, 'started'
|
||||
* means we're currently initialising. Use this to prevent recursive
|
||||
* invocation.
|
||||
*/
|
||||
if( done )
|
||||
/* Called more than once, we succeeded, just return OK.
|
||||
*/
|
||||
return( 0 );
|
||||
if( started )
|
||||
/* Recursive invocation, something has broken horribly.
|
||||
* Hopefully the first init will handle it.
|
||||
*/
|
||||
return( 0 );
|
||||
started = TRUE;
|
||||
|
||||
VIPS_SETSTR( vips__argv0, argv0 );
|
||||
|
||||
/* Need gobject etc.
|
||||
*/
|
||||
g_type_init();
|
||||
|
||||
#ifdef G_THREADS_ENABLED
|
||||
if( !g_thread_supported() )
|
||||
g_thread_init( NULL );
|
||||
#endif /*G_THREADS_ENABLED*/
|
||||
|
||||
if( !vips__global_lock )
|
||||
vips__global_lock = g_mutex_new();
|
||||
|
||||
prgname = g_path_get_basename( argv0 );
|
||||
g_set_prgname( prgname );
|
||||
g_free( prgname );
|
||||
|
||||
/* Try to discover our prefix.
|
||||
*/
|
||||
if( !(prefix = vips_guess_prefix( argv0, "VIPSHOME" )) ||
|
||||
!(libdir = vips_guess_libdir( argv0, "VIPSHOME" )) )
|
||||
return( -1 );
|
||||
|
||||
/* Get i18n .mo files from $VIPSHOME/share/locale/.
|
||||
*/
|
||||
im_snprintf( name, 256,
|
||||
"%s" G_DIR_SEPARATOR_S "share" G_DIR_SEPARATOR_S "locale",
|
||||
prefix );
|
||||
bindtextdomain( GETTEXT_PACKAGE, name );
|
||||
bind_textdomain_codeset( GETTEXT_PACKAGE, "UTF-8" );
|
||||
|
||||
/* Register base vips types.
|
||||
*/
|
||||
im__meta_init_types();
|
||||
im__format_init();
|
||||
vips__interpolate_init();
|
||||
|
||||
/* Load up any plugins in the vips libdir. We don't error on failure,
|
||||
* it's too annoying to have VIPS refuse to start because of a broken
|
||||
* plugin.
|
||||
*/
|
||||
if( im_load_plugins( "%s/vips-%d.%d",
|
||||
libdir, IM_MAJOR_VERSION, IM_MINOR_VERSION ) ) {
|
||||
vips_warn( "vips_init", "%s", vips_error_buffer() );
|
||||
vips_error_clear();
|
||||
}
|
||||
|
||||
/* Also load from libdir. This is old and slightly broken behaviour
|
||||
* :-( kept for back compat convenience.
|
||||
*/
|
||||
if( im_load_plugins( "%s", libdir ) ) {
|
||||
vips_warn( "vips_init", "%s", vips_error_buffer() );
|
||||
vips_error_clear();
|
||||
}
|
||||
|
||||
/* Start up the buffer cache.
|
||||
*/
|
||||
im__buffer_init();
|
||||
|
||||
/* Get the run-time compiler going.
|
||||
*/
|
||||
vips_vector_init();
|
||||
|
||||
done = TRUE;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
const char *
|
||||
im__gettext( const char *msgid )
|
||||
{
|
||||
/* Pass in a nonsense name for argv0 ... this init path is only here
|
||||
* for old programs which are missing an vips_init() call. We need
|
||||
* i18n set up before we can translate.
|
||||
*/
|
||||
if( vips_init( "giant_banana" ) )
|
||||
vips_error_clear();
|
||||
|
||||
return( dgettext( GETTEXT_PACKAGE, msgid ) );
|
||||
}
|
||||
|
||||
const char *
|
||||
im__ngettext( const char *msgid, const char *plural, unsigned long int n )
|
||||
{
|
||||
if( vips_init( "giant_banana" ) )
|
||||
vips_error_clear();
|
||||
|
||||
return( dngettext( GETTEXT_PACKAGE, msgid, plural, n ) );
|
||||
}
|
||||
|
||||
static GOptionEntry option_entries[] = {
|
||||
{ "vips-concurrency", 'c', 0, G_OPTION_ARG_INT, &im__concurrency,
|
||||
N_( "evaluate with N concurrent threads" ), "N" },
|
||||
{ "vips-tile-width", 'w', 0, G_OPTION_ARG_INT, &im__tile_width,
|
||||
N_( "set tile width to N (DEBUG)" ), "N" },
|
||||
{ "vips-tile-height", 'h', 0, G_OPTION_ARG_INT, &im__tile_height,
|
||||
N_( "set tile height to N (DEBUG)" ), "N" },
|
||||
{ "vips-thinstrip-height", 't', 0,
|
||||
G_OPTION_ARG_INT, &im__thinstrip_height,
|
||||
N_( "set thinstrip height to N (DEBUG)" ), "N" },
|
||||
{ "vips-fatstrip-height", 'f', 0,
|
||||
G_OPTION_ARG_INT, &im__fatstrip_height,
|
||||
N_( "set fatstrip height to N (DEBUG)" ), "N" },
|
||||
{ "vips-progress", 'p', 0, G_OPTION_ARG_NONE, &im__progress,
|
||||
N_( "show progress feedback" ), NULL },
|
||||
{ "vips-disc-threshold", 'd', 0, G_OPTION_ARG_STRING,
|
||||
&im__disc_threshold,
|
||||
N_( "image size above which to decompress to disc" ), NULL },
|
||||
{ "vips-novector", 't', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE,
|
||||
&im__vector_enabled,
|
||||
N_( "disable vectorised versions of operations" ), NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
* vips_get_option_group:
|
||||
*
|
||||
* vips_get_option_group() returns a GOptionGroup containing various VIPS
|
||||
* command-line options. It can be used with GOption to help
|
||||
* parse argc/argv.
|
||||
*
|
||||
* See also: vips_version(), vips_guess_prefix(),
|
||||
* vips_guess_libdir(), vips_init().
|
||||
*
|
||||
* Returns: a GOptionGroup for VIPS, see GOption
|
||||
*/
|
||||
GOptionGroup *
|
||||
vips_get_option_group( void )
|
||||
{
|
||||
static GOptionGroup *option_group = NULL;
|
||||
|
||||
if( !option_group ) {
|
||||
option_group = g_option_group_new(
|
||||
"vips", _( "VIPS Options" ), _( "Show VIPS options" ),
|
||||
NULL, NULL );
|
||||
g_option_group_add_entries( option_group, option_entries );
|
||||
}
|
||||
|
||||
return( option_group );
|
||||
}
|
||||
|
||||
/* Strip off any of a set of old suffixes (eg. [".v", ".jpg"]), add a single
|
||||
* new suffix (eg. ".tif").
|
||||
*/
|
||||
@ -266,7 +493,7 @@ find_file( const char *name )
|
||||
return( NULL );
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "im_guess_prefix: g_getenv( \"PATH\" ) == \"%s\"\n", path );
|
||||
printf( "vips_guess_prefix: g_getenv( \"PATH\" ) == \"%s\"\n", path );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
#ifdef OS_WIN32
|
||||
@ -299,7 +526,7 @@ guess_prefix( const char *argv0, const char *name )
|
||||
*/
|
||||
if( (prefix = extract_prefix( argv0, name )) ) {
|
||||
#ifdef DEBUG
|
||||
printf( "im_guess_prefix: found \"%s\" from "
|
||||
printf( "vips_guess_prefix: found \"%s\" from "
|
||||
"argv0\n", prefix );
|
||||
#endif /*DEBUG*/
|
||||
return( prefix );
|
||||
@ -310,7 +537,7 @@ guess_prefix( const char *argv0, const char *name )
|
||||
*/
|
||||
if( (prefix = find_file( name )) ) {
|
||||
#ifdef DEBUG
|
||||
printf( "im_guess_prefix: found \"%s\" from "
|
||||
printf( "vips_guess_prefix: found \"%s\" from "
|
||||
"PATH\n", prefix );
|
||||
#endif /*DEBUG*/
|
||||
return( prefix );
|
||||
@ -333,7 +560,7 @@ guess_prefix( const char *argv0, const char *name )
|
||||
if( (prefix = extract_prefix( resolved, name )) ) {
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "im_guess_prefix: found \"%s\" "
|
||||
printf( "vips_guess_prefix: found \"%s\" "
|
||||
"from cwd\n", prefix );
|
||||
#endif /*DEBUG*/
|
||||
return( prefix );
|
||||
@ -348,26 +575,26 @@ guess_prefix( const char *argv0, const char *name )
|
||||
}
|
||||
|
||||
/**
|
||||
* im_guess_prefix:
|
||||
* vips_guess_prefix:
|
||||
* @argv0: program name (typically argv[0])
|
||||
* @env_name: save prefix in this environment variable
|
||||
*
|
||||
* im_guess_prefix() tries to guess the install directory. You should pass
|
||||
* vips_guess_prefix() tries to guess the install directory. You should pass
|
||||
* in the value of argv[0] (the name your program was run as) as a clue to
|
||||
* help it out, plus the name of the environment variable you let the user
|
||||
* override your package install area with (eg. "VIPSHOME").
|
||||
*
|
||||
* On success, im_guess_prefix() returns the prefix it discovered, and as a
|
||||
* On success, vips_guess_prefix() returns the prefix it discovered, and as a
|
||||
* side effect, sets the environment variable (if it's not set).
|
||||
*
|
||||
* Don't free the return string!
|
||||
*
|
||||
* See also: im_guess_libdir().
|
||||
* See also: vips_guess_libdir().
|
||||
*
|
||||
* Returns: the install prefix as a static string, do not free.
|
||||
*/
|
||||
const char *
|
||||
im_guess_prefix( const char *argv0, const char *env_name )
|
||||
vips_guess_prefix( const char *argv0, const char *env_name )
|
||||
{
|
||||
const char *prefix;
|
||||
const char *p;
|
||||
@ -377,7 +604,7 @@ im_guess_prefix( const char *argv0, const char *env_name )
|
||||
*/
|
||||
if( (prefix = g_getenv( env_name )) ) {
|
||||
#ifdef DEBUG
|
||||
printf( "im_guess_prefix: found \"%s\" in environment\n",
|
||||
printf( "vips_guess_prefix: found \"%s\" in environment\n",
|
||||
prefix );
|
||||
#endif /*DEBUG*/
|
||||
return( prefix );
|
||||
@ -398,9 +625,9 @@ im_guess_prefix( const char *argv0, const char *env_name )
|
||||
im_strncpy( name, p, PATH_MAX );
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "im_guess_prefix: argv0 = %s\n", argv0 );
|
||||
printf( "im_guess_prefix: name = %s\n", name );
|
||||
printf( "im_guess_prefix: cwd = %s\n", get_current_dir() );
|
||||
printf( "vips_guess_prefix: argv0 = %s\n", argv0 );
|
||||
printf( "vips_guess_prefix: name = %s\n", name );
|
||||
printf( "vips_guess_prefix: cwd = %s\n", get_current_dir() );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
prefix = guess_prefix( argv0, name );
|
||||
@ -410,29 +637,29 @@ im_guess_prefix( const char *argv0, const char *env_name )
|
||||
}
|
||||
|
||||
/**
|
||||
* im_guess_libdir:
|
||||
* vips_guess_libdir:
|
||||
* @argv0: program name (typically argv[0])
|
||||
* @env_name: save prefix in this environment variable
|
||||
*
|
||||
* im_guess_libdir() tries to guess the install directory (usually the
|
||||
* vips_guess_libdir() tries to guess the install directory (usually the
|
||||
* configure libdir, or $prefix/lib). You should pass
|
||||
* in the value of argv[0] (the name your program was run as) as a clue to
|
||||
* help it out, plus the name of the environment variable you let the user
|
||||
* override your package install area with (eg. "VIPSHOME").
|
||||
*
|
||||
* On success, im_guess_libdir() returns the libdir it discovered, and as a
|
||||
* On success, vips_guess_libdir() returns the libdir it discovered, and as a
|
||||
* side effect, sets the prefix environment variable (if it's not set).
|
||||
*
|
||||
* Don't free the return string!
|
||||
*
|
||||
* See also: im_guess_prefix().
|
||||
* See also: vips_guess_prefix().
|
||||
*
|
||||
* Returns: the libdir as a static string, do not free.
|
||||
*/
|
||||
const char *
|
||||
im_guess_libdir( const char *argv0, const char *env_name )
|
||||
vips_guess_libdir( const char *argv0, const char *env_name )
|
||||
{
|
||||
const char *prefix = im_guess_prefix( argv0, env_name );
|
||||
const char *prefix = vips_guess_prefix( argv0, env_name );
|
||||
static char *libdir = NULL;
|
||||
|
||||
if( libdir )
|
||||
@ -447,10 +674,10 @@ im_guess_libdir( const char *argv0, const char *env_name )
|
||||
libdir = g_strdup_printf( "%s/lib", prefix );
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "im_guess_libdir: IM_PREFIX = %s\n", IM_PREFIX );
|
||||
printf( "im_guess_libdir: IM_LIBDIR = %s\n", IM_LIBDIR );
|
||||
printf( "im_guess_libdir: prefix = %s\n", prefix );
|
||||
printf( "im_guess_libdir: libdir = %s\n", libdir );
|
||||
printf( "vips_guess_libdir: IM_PREFIX = %s\n", IM_PREFIX );
|
||||
printf( "vips_guess_libdir: IM_LIBDIR = %s\n", IM_LIBDIR );
|
||||
printf( "vips_guess_libdir: prefix = %s\n", prefix );
|
||||
printf( "vips_guess_libdir: libdir = %s\n", libdir );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
return( libdir );
|
@ -355,7 +355,7 @@ static im_arg_desc printdesc_args[] = {
|
||||
static int
|
||||
printdesc_vec( im_object *argv )
|
||||
{
|
||||
im_printdesc( (IMAGE *) argv[0] );
|
||||
vips_object_print( VIPS_OBJECT( argv[0] ) );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -964,7 +964,7 @@ vips_region_prepare( VipsRegion *reg, Rect *r )
|
||||
|
||||
vips__region_check_ownership( reg );
|
||||
|
||||
if( vips_image_test_kill( im ) )
|
||||
if( vips_image_get_kill( im ) )
|
||||
return( -1 );
|
||||
|
||||
/* We use save for sanity checking valid: we test at the end that the
|
||||
@ -1097,7 +1097,7 @@ vips_region_prepare_to( VipsRegion *reg,
|
||||
Rect clipped2;
|
||||
Rect final;
|
||||
|
||||
if( vips_image_test_kill( im ) )
|
||||
if( vips_image_get_kill( im ) )
|
||||
return( -1 );
|
||||
|
||||
/* Sanity check.
|
||||
|
@ -529,12 +529,12 @@ im_vsnprintf( char *str, size_t size, const char *format, va_list ap )
|
||||
static char buf[MAX_BUF];
|
||||
|
||||
if( size > MAX_BUF )
|
||||
error_exit( "panic: buffer overflow "
|
||||
vips_error_exit( "panic: buffer overflow "
|
||||
"(request to write %d bytes to buffer of %d bytes)",
|
||||
size, MAX_BUF );
|
||||
n = vsprintf( buf, format, ap );
|
||||
if( n > MAX_BUF )
|
||||
error_exit( "panic: buffer overflow "
|
||||
vips_error_exit( "panic: buffer overflow "
|
||||
"(%d bytes written to buffer of %d bytes)",
|
||||
n, MAX_BUF );
|
||||
|
||||
|
@ -158,3 +158,47 @@ im_close( VipsImage *im )
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/* edvips.c needs this
|
||||
*/
|
||||
VipsImage *
|
||||
im_init( const char *filename )
|
||||
{
|
||||
VipsImage *image;
|
||||
|
||||
image = vips_image_new( "p" );
|
||||
VIPS_SETSTR( image->filename, filename );
|
||||
|
||||
return( image );
|
||||
}
|
||||
|
||||
/* Prettyprint various header fields. Just for vips7 compat, use
|
||||
* VIPS_ENUM_VALUE() instead.
|
||||
*/
|
||||
const char *im_Type2char( VipsInterpretation type )
|
||||
{ return( VIPS_ENUM_STRING( VIPS_TYPE_INTERPRETATION, type ) ); }
|
||||
const char *im_BandFmt2char( VipsBandFormat format )
|
||||
{ return( VIPS_ENUM_STRING( VIPS_TYPE_BAND_FORMAT, format ) ); }
|
||||
const char *im_Coding2char( VipsCoding coding )
|
||||
{ return( VIPS_ENUM_STRING( VIPS_TYPE_CODING, coding ) ); }
|
||||
const char *im_dtype2char( VipsImageType n )
|
||||
{ return( VIPS_ENUM_STRING( VIPS_TYPE_IMAGE_TYPE, n ) ); }
|
||||
const char *im_dhint2char( VipsDemandStyle style )
|
||||
{ return( VIPS_ENUM_STRING( VIPS_TYPE_DEMAND_STYLE, style ) ); }
|
||||
|
||||
VipsInterpretation im_char2Type( const char *str )
|
||||
{ return( VIPS_ENUM_VALUE( VIPS_TYPE_INTERPRETATION, str ) ); }
|
||||
VipsBandFormat im_char2BandFmt( const char *str )
|
||||
{ return( VIPS_ENUM_VALUE( VIPS_TYPE_BAND_FORMAT, str ) ); }
|
||||
VipsCoding im_char2Coding( const char *str )
|
||||
{ return( VIPS_ENUM_VALUE( VIPS_TYPE_CODING, str ) ); }
|
||||
VipsImageType im_char2dtype( const char *str )
|
||||
{ return( VIPS_ENUM_VALUE( VIPS_TYPE_IMAGE_TYPE, str ) ); }
|
||||
VipsDemandStyle im_char2dhint( const char *str )
|
||||
{ return( VIPS_ENUM_VALUE( VIPS_TYPE_DEMAND_STYLE, str ) ); }
|
||||
|
||||
/* Totally useless now.
|
||||
*/
|
||||
const char *im_Compression2char( int n ) { return( "NONE" ); }
|
||||
int im_char2Compression( const char *str ) { return( -1 ); }
|
||||
|
||||
|
@ -97,10 +97,10 @@ im_window_unmap( im_window_t *window )
|
||||
return( -1 );
|
||||
|
||||
#ifdef DEBUG_TOTAL
|
||||
g_mutex_lock( im__global_lock );
|
||||
g_mutex_lock( vips__global_lock );
|
||||
total_mmap_usage -= window->length;
|
||||
assert( total_mmap_usage >= 0 );
|
||||
g_mutex_unlock( im__global_lock );
|
||||
g_mutex_unlock( vips__global_lock );
|
||||
#endif /*DEBUG_TOTAL*/
|
||||
|
||||
window->data = NULL;
|
||||
@ -171,7 +171,7 @@ im_window_unref( im_window_t *window )
|
||||
static void
|
||||
trace_mmap_usage( void )
|
||||
{
|
||||
g_mutex_lock( im__global_lock );
|
||||
g_mutex_lock( vips__global_lock );
|
||||
{
|
||||
static int last_total = 0;
|
||||
int total = total_mmap_usage / (1024 * 1024);
|
||||
@ -184,7 +184,7 @@ trace_mmap_usage( void )
|
||||
last_total = total;
|
||||
}
|
||||
}
|
||||
g_mutex_unlock( im__global_lock );
|
||||
g_mutex_unlock( vips__global_lock );
|
||||
}
|
||||
#endif /*DEBUG_TOTAL*/
|
||||
|
||||
@ -257,11 +257,11 @@ im_window_set( im_window_t *window, int top, int height )
|
||||
im__read_test &= window->data[0];
|
||||
|
||||
#ifdef DEBUG_TOTAL
|
||||
g_mutex_lock( im__global_lock );
|
||||
g_mutex_lock( vips__global_lock );
|
||||
total_mmap_usage += window->length;
|
||||
if( total_mmap_usage > max_mmap_usage )
|
||||
max_mmap_usage = total_mmap_usage;
|
||||
g_mutex_unlock( im__global_lock );
|
||||
g_mutex_unlock( vips__global_lock );
|
||||
trace_mmap_usage();
|
||||
#endif /*DEBUG_TOTAL*/
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user