Imager 0.62 - unreleased
===========
+ - Makefile.PL now expands ~/path supplied to --incpath or --libpath
+ to /path under your home directory.
+ http://rt.cpan.org/Ticket/Display.html?id=29484
+
Bug fixes:
- samples/gifscale.pl sourced the base value for gif_top from
PREINIT:
int i;
DSO_handle *dso_handle;
+ func_ptr *functions;
PPCODE:
dso_handle=(DSO_handle*)dso_handle_v;
+ functions = DSO_funclist(dso_handle);
i=0;
- while( dso_handle->function_list[i].name != NULL) {
+ while( functions[i].name != NULL) {
EXTEND(SP,1);
- PUSHs(sv_2mortal(newSVpv(dso_handle->function_list[i].name,0)));
+ PUSHs(sv_2mortal(newSVpv(functions[i].name,0)));
EXTEND(SP,1);
- PUSHs(sv_2mortal(newSVpv(dso_handle->function_list[i++].pcode,0)));
+ PUSHs(sv_2mortal(newSVpv(functions[i++].pcode,0)));
}
-
void
DSO_call(handle,func_index,hv)
void* handle
my @definc = qw(/usr/include);
@definc{@definc}=(1) x @definc;
- @incs=(split(/\Q$Config{path_sep}/, $INCPATH),
- map { split /\Q$Config{path_sep}/} @incpaths );
+ @incs=
+ (
+ split(/\Q$Config{path_sep}/, $INCPATH),
+ map _tilde_expand($_), map { split /\Q$Config{path_sep}/ } @incpaths
+ );
if ($Config{locincpth}) {
push @incs, grep -d, split ' ', $Config{locincpth};
}
}
@libs= ( split(/\Q$Config{path_sep}/,$LIBPATH),
- map { split /\Q$Config{path_sep}/} @libpaths );
+ map _tilde_expand($_), map { split /\Q$Config{path_sep}/} @libpaths );
if ($Config{loclibpth}) {
push @libs, grep -d, split ' ', $Config{loclibpth};
}
}
}
+my $home;
+sub _tilde_expand {
+ my ($path) = @_;
+
+ if ($path =~ m!^~[/\\]!) {
+ defined $home or $home = $ENV{HOME};
+ if (!defined $home && $^O eq 'MSWin32'
+ && defined $ENV{HOMEDRIVE} && defined $ENV{HOMEPATH}) {
+ $home = $ENV{HOMEDRIVE} . $ENV{HOMEPATH};
+ }
+ unless (defined $home) {
+ $home = eval { (getpwuid($<))[7] };
+ }
+ defined $home or die "You supplied $path, but I can't find your home directory\n";
+ $path =~ s/^~//;
+ $path = File::Spec->catdir($home, $path);
+ }
+
+ $path;
+}
+
# This isn't a module, but some broken tools, like
# Module::Depends::Instrusive insist on treating it like one.
#
+#if defined(OS_hpux)
+#include <dl.h>
+typedef shl_t minthandle_t;
+#elif defined(WIN32)
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+typedef HMODULE minthandle_t;
+#undef WIN32_LEAN_AND_MEAN
+#elif defined(OS_darwin)
+#define DL_LOADONCEONLY
+#define DLSYMUN
+#undef environ
+#undef bool
+
+#import <mach-o/dyld.h>
+typedef void *minthandle_t;
+#else
+#include <dlfcn.h>
+typedef void *minthandle_t;
+#endif
+
+#include "plug.h"
+
+struct DSO_handle_tag {
+ minthandle_t handle;
+ char *filename;
+ func_ptr *function_list;
+};
+
#include "imager.h"
#include "dynaload.h"
/* #include "XSUB.h" so we can compile on threaded perls */
(handle->function_list[func_index].iptr)((void*)hv);
}
+func_ptr *
+DSO_funclist(DSO_handle *handle) {
+ return handle->function_list;
+}
+
#if defined( OS_hpux )
#include "log.h"
-#if defined(OS_hpux)
-#include <dl.h>
-typedef shl_t minthandle_t;
-#elif defined(WIN32)
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-typedef HMODULE minthandle_t;
-#undef WIN32_LEAN_AND_MEAN
-#elif defined(OS_darwin)
-#define DL_LOADONCEONLY
-#define DLSYMUN
-#undef environ
-#undef bool
-
-#import <mach-o/dyld.h>
-typedef void *minthandle_t;
-#else
-#include <dlfcn.h>
-typedef void *minthandle_t;
-#endif
-
#include "EXTERN.h"
#include "perl.h"
#include "ppport.h"
#include "ext.h"
-typedef struct {
- minthandle_t handle;
- char *filename;
- func_ptr *function_list;
-} DSO_handle;
+typedef struct DSO_handle_tag DSO_handle;
typedef struct {
HV* hv;
#endif
void *DSO_open(char* file,char** evalstring);
+func_ptr *DSO_funclist(DSO_handle *handle);
int DSO_close(void *);
void DSO_call(DSO_handle *handle,int func_index,HV* hv);