[libimdb-commit] CVS: libimdb/perl Log.perlswig,NONE,1.1 Makefile,NONE,1.1 test.pl,NONE,1.1
Status: Pre-Alpha
Brought to you by:
jveldhuis
|
From: Jerry V. <jve...@us...> - 2003-06-16 04:37:14
|
Update of /cvsroot/libimdb/libimdb/perl
In directory sc8-pr-cvs1:/tmp/cvs-serv15088
Added Files:
Log.perlswig Makefile test.pl
Log Message:
initial checkin
--- NEW FILE: Log.perlswig ---
%{
#define _USE_STDIO
#define _USE_STDLIB
#define _USE_STDARG
#define _USE_TYPES
#define _USE_STRINGS
#define _USE_ASSERT
#include "sysincludes.h"
#include "log/log.h"
%}
%include "typemaps.i"
%include "../../include/mytypemaps.i"
%typemap(jni) logHandle_t * "jlong"
%typemap(jtype) logHandle_t * "long"
%typemap(jstype) logHandle_t * "org.libimdb.swig.Log"
%typemap(javain) logHandle_t * "org.libimdb.swig.Log.getCPtr($javainput)"
%typemap(javaout) logHandle_t * {return new org.libimdb.swig.Log($jnicall);}
@todo - write perl specific entry points that it easier to use from
perl (or write swig code).
ie: log_getMessageDetails could return a char **, then write
a perl module that decodes each entry into a perl object :)
Could look at perl C interface to determine if you can send an
array back with different types in it.... pain probably.
@todo - need to investigate calling a method on a perl object from C..
May be hard to find a decent example, but again could call back
with an array of strings instead. Could try and submit a
minimal example to the swig mailing list and ask for help.
%include "../../include/log/log.h"
--- NEW FILE: Makefile ---
#
# $Id: Makefile,v 1.1 2003/06/16 04:37:11 jveldhuis Exp $
#
include ../config.mk
include ../constants.mk
CPPFLAGS += -I../include -I$(PERL_INCLUDE)
CFLAGS:=-g
LIBS= ../parser/$(BUILD_DIR)/libimdbParser.a \
../liblog/$(BUILD_DIR)/liblog.a
SWIG_MODULE=Log
LIB_BASE = Log
LIB_VERSION = 1.0
build:
$(MAKE) $(MYDYNAMIC) DYNAMIC=$(MYDYNAMIC)
install:; @true;
test:
LD_LIBRARY_PATH=bdir-LINUX ./test.pl
include ../rules.mk
--- NEW FILE: test.pl ---
#!/usr/bin/perl -w
use strict;
use lib 'gen_LINUX';
use Log;
my $log = Log::log_openMain(undef, "test.pl", "main", 7);
print "".Log::log_getModuleShortNames($log)."\n";
print "".$log."\n";
exit 0;
|