You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/12/20 03:41:00 UTC
[lucy-commits] svn commit: r1221079 - in /incubator/lucy/trunk/clownfish:
perl/buildlib/Clownfish/Build.pm src/CFCUtil.c
Author: marvin
Date: Tue Dec 20 02:41:00 2011
New Revision: 1221079
URL: http://svn.apache.org/viewvc?rev=1221079&view=rev
Log:
Make Perl headers optional for compiling CFC.
The only place where the Perl C API headers are required in CFC has been
CFCUtil, where they are used for shunting CFCUtil_warn and CFCUtil_die through
Perl's error handling mechanisms. Provide alternatives for those functions in
the absence of the Perl headers.
Modified:
incubator/lucy/trunk/clownfish/perl/buildlib/Clownfish/Build.pm
incubator/lucy/trunk/clownfish/src/CFCUtil.c
Modified: incubator/lucy/trunk/clownfish/perl/buildlib/Clownfish/Build.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/perl/buildlib/Clownfish/Build.pm?rev=1221079&r1=1221078&r2=1221079&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/perl/buildlib/Clownfish/Build.pm (original)
+++ incubator/lucy/trunk/clownfish/perl/buildlib/Clownfish/Build.pm Tue Dec 20 02:41:00 2011
@@ -31,7 +31,9 @@ my $CFC_SOURCE_DIR = catdir( updir(), 's
sub extra_ccflags {
my $self = shift;
- my $extra_ccflags = defined $ENV{CFLAGS} ? "$ENV{CFLAGS} " : "";
+ my $extra_ccflags = "-DCFCPERL ";
+ $extra_ccflags .= "$ENV{CFLAGS} " if defined $ENV{CFLAGS};
+
my $gcc_version
= $ENV{REAL_GCC_VERSION}
|| $self->config('gccversion')
Modified: incubator/lucy/trunk/clownfish/src/CFCUtil.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCUtil.c?rev=1221079&r1=1221078&r2=1221079&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/src/CFCUtil.c (original)
+++ incubator/lucy/trunk/clownfish/src/CFCUtil.c Tue Dec 20 02:41:00 2011
@@ -416,6 +416,8 @@ CFCUtil_closedir(void *dirhandle, const
/***************************************************************************/
+#ifdef CFCPERL
+
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
@@ -442,18 +444,26 @@ CFCUtil_warn(const char* format, ...) {
SvREFCNT_dec(mess);
}
-void*
-CFCUtil_make_perl_obj(void *ptr, const char *klass) {
- SV *inner_obj = newSV(0);
- SvOBJECT_on(inner_obj);
- PL_sv_objcount++;
- SvUPGRADE(inner_obj, SVt_PVMG);
- sv_setiv(inner_obj, PTR2IV(ptr));
-
- // Connect class association.
- HV *stash = gv_stashpvn((char*)klass, strlen(klass), TRUE);
- SvSTASH_set(inner_obj, (HV*)SvREFCNT_inc(stash));
+#else
+
+void
+CFCUtil_die(const char* format, ...) {
+ va_list args;
+ va_start(args, format);
+ vfprintf(stderr, format, args);
+ va_end(args);
+ fprintf(stderr, "\n");
+ exit(1);
+}
- return inner_obj;
+void
+CFCUtil_warn(const char* format, ...) {
+ va_list args;
+ va_start(args, format);
+ vfprintf(stderr, format, args);
+ va_end(args);
+ fprintf(stderr, "\n");
}
+#endif /* CFCPERL */
+