Melvin Smith:
# Just committed the set Sx, iy op.
#
# Patch at end.
....
# diff -u -r1.60 string.c
# --- string.c 21 Mar 2002 09:56:41 -0000 1.60
# +++ string.c 22 Mar 2002 04:09:34 -0000
# @@ -774,6 +774,35 @@
# return f;
# }
#
# +STRING *
# +string_from_int(struct Parrot_Interp * interpreter, INTVAL i) {
# + const char * digits = "0123456789";
# + char buf[128];
# + char *ptr = &buf[127];
# + int neg = 0;
# +
# + if(i < 0) {
# + neg = 1;
# + i = abs(i);
# + }
# +
# + /* Dangerous looking but no 32/64/128/.... bit int
# + * would approach 128 characters in the buffer.
# + */
# + do {
# + *--ptr = digits[i % 10];
# + i /= 10;
# + }
# + while(i);
# +
# + if(neg)
# + *--ptr = '-';
# +
# + return string_make(interpreter, ptr, (UINTVAL)(127 -
# (ptr - buf)),
# + NULL, 0, NULL);
# +}
# +
# +
Just do "$1=Parrot_sprintf_c(interpreter, "%Vd", $2);". I've already
implemented this logic there; there's no sense having it in the core
twice.
--Brent Dax <[EMAIL PROTECTED]>
@roles=map {"Parrot $_"} qw(embedding regexen Configure)
#define private public
--Spotted in a C++ program just before a #include