Buenas, estoy trabajando con java y la libreria libcurl de c, necesito utilizar un biding para poder usarla mediante java. Mi problema con perl esque en el binding para java tengo un fichero llamado MakeCurlGlue.pl, que CREO q debo ejecutar en linux con el siguiente comando:
perl MakeCurlGue.pl < /usr/include/curl.h > CurlGlue.java
El problema esque en CurlGlue deberian de aparecer una serie de definiciones d eterminos k no me aparecen, esta parte:
// start of generated list - this list is up-to-date as of Curl
public static final int CURLOPT_ ## name = CURLOPTTYPE_ ## type + number;
public static final int CURLOPT_/**/name = type + number;
// end of generated list
Y el fichero MakeCurlGlue.pl que lo genera, contiene lo siguiente:
#!/usr/bin/perl
# Hack to create CurlGlue.java from curl.h
# Reads a preprocessed compiler output from STDIN and parses with
# a regex for the wanted defines, then writes them to STDOUT.
open(IN, "${ARGV[0]}");
while(<IN>) {
if(/^#define LIBCURL_VERSION \"(\d+\.\d+\.\d+.*)\"$/) {
$curl_ver = $1;
}
}
close(IN);
print <<EOTXT;
/*
* The curl class is a JNI wrapper for libcurl.
* Please bear with me, I'm no true java dude (yet) - Daniel S.
* Improve what you think is bad and send the updates to the libcurl list!
*
* This is meant as a raw, crude and low-level interface to libcurl.
* If you want fancy stuff, build upon this.
*/
public class CurlGlue
{
// start of generated list - this list is up-to-date as of Curl $curl_ver
EOTXT
while(<STDIN>) {
if($_ =~ /(CURLOPT_(.*)) += (.*)/) {
$var= $1;
$expr = $3;
$f=$3;
if($expr =~ / *(\d+) *\+ *(\d+)/) {
$expr = $1+$2;
}
# nah, keep the CURL prefix to make them look like other
# languages' defines
# $var =~ s/^CURL//g;
$var =~ s/ $//g;
print " public static final int $var = $expr;\n";
}
}
print <<EOTXT;
// end of generated list
public CurlGlue() {
try {
cur
........................
e.printStackTrace();
}
}
}
EOTXT
Lo que necesito saber es porque no lo esta generado bien, que hace exactamente la parte del while, espero que puedan ayudarme, un saludo.