Nicholas Clark wrote:
>
> I think that it's possible to partly work round this by prototyping your
> function (at the perl level), but in turn I don't think that Inline
can do
> this; you'd need XS.
>
> But even that doesn't really solve the problem at perl level, as
> @a = (%d\n%#o\n", $x, $y);
On Thu, Aug 19, 2004 at 01:42:14PM +1000, Sisyphus wrote:
> void wrap_printf(AV * arguments) {
> /* Code to transfer the referred arguments to C's printf() function */
> }
>
> I don't know, off the top of my head, exactly what *that* "Code" looks
> like either - though I'm confident I can work i
On Aug 21, 2004, at 10:42 PM, Sisyphus wrote:
I've struck something similar. I was trying the following (which I
thought *should* work, but which prints out a couple of wrong values,
then segfaults):
[...]
It looks to me like this is an Inline bug/nonfeature, not a generic C
issue. Look at the
Eric Wilhelm wrote:
# The following was supposedly scribed by
# Eric Wilhelm
# on Saturday 21 August 2004 07:38 pm:
Is there a "vgmp_printf" function? Sounds like you'll need one.
Okay, there is gmp_vprintf(), but it isn't going to do you any good.
Looking at the minprintf() example in K&R's "Th
Eric Wilhelm wrote:
http://www.faqs.org/faqs/C-faq/faq/index.html
"
15.12: How can I write a function which takes a variable number of
arguments and passes them to some other function (which takes a
variable number of arguments)?
Bah I consulted that very same FAQ a coupla day
Eric Wilhelm wrote:
Okay, but if they are all the same type of objects, you are basically only
trying to wrap something like printf("%s %s %s %s", s1, s2, s3, s4) and we
can forget about trying to detect integers vs floats and strings.
Correct.
Except, you have just said that you don't have to d
# The following was supposedly scribed by
# Eric Wilhelm
# on Saturday 21 August 2004 07:38 pm:
>Is there a "vgmp_printf" function? Sounds like you'll need one.
Okay, there is gmp_vprintf(), but it isn't going to do you any good.
Looking at the minprintf() example in K&R's "The C Programming La
# The following was supposedly scribed by
# Eric Wilhelm
# on Saturday 21 August 2004 07:28 pm:
>>Hmmm I've been starting to fear that there's going to be much more
>>to this than I originally thought. The last part of that sentence does
>>little to allay that fear :-)
>So, you need a functi
Eric Wilhelm wrote:
> # The following was supposedly scribed by
> # Sisyphus
> # on Saturday 21 August 2004 12:53 am:
>
>
>>> void c_printf(char *format, AV * arguments) {
>>>...
>>
>>
>> It's the code that goes in here that I'm struggling with. There's no
>> problem with passing the first arg
# The following was supposedly scribed by
# Sisyphus
# on Saturday 21 August 2004 06:44 pm:
>In reality, I would like to wrap the GMP library's gmp_printf function.
>That function is analogous to C's printf function - it takes a 'char *
>format' as its first argument, followed by however many GMP
# The following was supposedly scribed by
# Sisyphus
# on Saturday 21 August 2004 12:53 am:
>> void c_printf(char *format, AV * arguments) {
>> ...
>
>It's the code that goes in here that I'm struggling with. There's no
>problem with passing the first argument to C's printf function, but how
[EMAIL PROTECTED] wrote:
An alternative in c:
You can also make a new va_list out of the old one. It's basically an array of
void pointers. So you va_start, va_arg and repopulate the second array with
appropriate void casted pointers. You can then vprintf on this hacked va_list.
I wasn't fami
Williams, Kenneth (Ken) (TLR Corp) wrote:
Hey Rob,
One approach would be to use a wrapper wrapper:
use Inline C => <<'EOC';
void c_printf(char *format, AV * arguments) {
...
It's the code that goes in here that I'm struggling with. There's no
problem with passing the first argument to C's pr
printf("%#o\n", $y);
-Ken
> -Original Message-
> From: Sisyphus [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 18, 2004 10:42 PM
> To: inline
> Subject: Wrapping variable length agument lists
>
>
> Hi,
>
> Suppose I wanted to write a wrapper
Hi,
Suppose I wanted to write a wrapper for the C printf() function -
something like:
use warnings;
use Inline C => <<'EOC';
void wrap_printf(SV * a, SV * b) {
if(SvUOK(b)) printf(SvPV_nolen(a), SvUV(b));
if(SvIOK(b)) printf(SvPV_nolen(a), SvIV(b));
if(SvNOK(b)) printf(SvPV_nolen(a
15 matches
Mail list logo