Mailing List Archive

5.002beta1g - problem building Safe extension
Building beta1g from scratch, I got this on SunOS 4.1.3 (sun C
compiler):


Making Safe (dynamic)
Writing Makefile for Safe
umask 0 && cp Safe.pm ../../lib/Safe.pm
./../../miniperl -I../../lib -I../../lib ../../lib/ExtUtils/xsubpp -typemap ../../lib/ExtUtils/typemap Safe.xs >Safe.tc && mv Safe.tc Safe.c
Please specify prototyping behavior for Safe.xs (see perlxs manual)
cc -c -I/usr/local/include -O -DVERSION=\"0.10\" -pic -I../.. Safe.c
"Safe.c", line 39: maxo undefined
"Safe.c", line 69: maxo undefined
"Safe.c", line 85: maxo undefined
"Safe.c", line 101: maxo undefined
"Safe.c", line 125: syntax error at or near type word "opcode"
"Safe.c", line 128: syntax error at or near symbol =
"Safe.c", line 129: syntax error at or near type word "opcode"
"Safe.c", line 131: syntax error at or near type word "opcode"
"Safe.c", line 136: maxo undefined
"Safe.c", line 148: maxo undefined
"Safe.c", line 165: maxo undefined
*** Error code 1
make: Fatal error: Command failed for target `Safe.o'

Here is a patch to fix it.

Paul

*** Safe.xs.orig Thu Dec 21 17:49:26 1995
--- Safe.xs Fri Dec 22 10:05:51 1995
***************
*** 19,30 ****
save_hptr(&defstash);
save_aptr(&endav);
SAVEPPTR(op_mask);
! Newz(666, op_mask, maxo, char);
SAVEFREEPV(op_mask);
str = SvPV(mask, len);
! if (maxo != len)
croak("Bad mask length");
! for (i = 0; i < maxo; i++)
op_mask[i] = str[i];
defstash = gv_stashpv(package, TRUE);
endav = (AV*)sv_2mortal((SV*)newAV()); /* Ignore END blocks for now */
--- 19,30 ----
save_hptr(&defstash);
save_aptr(&endav);
SAVEPPTR(op_mask);
! Newz(666, op_mask, MAXO, char);
SAVEFREEPV(op_mask);
str = SvPV(mask, len);
! if (MAXO != len)
croak("Bad mask length");
! for (i = 0; i < MAXO; i++)
op_mask[i] = str[i];
defstash = gv_stashpv(package, TRUE);
endav = (AV*)sv_2mortal((SV*)newAV()); /* Ignore END blocks for now */
***************
*** 43,49 ****
CODE:
ST(0) = sv_newmortal();
if (op_mask)
! sv_setpvn(ST(0), op_mask, maxo);

void
mask_to_ops(mask)
--- 43,49 ----
CODE:
ST(0) = sv_newmortal();
if (op_mask)
! sv_setpvn(ST(0), op_mask, MAXO);

void
mask_to_ops(mask)
***************
*** 52,60 ****
STRLEN len;
char *maskstr = SvPV(mask, len);
int i;
! if (maxo != len)
croak("Bad mask length");
! for (i = 0; i < maxo; i++)
if (maskstr[i])
XPUSHs(sv_2mortal(newSVpv(op_name[i], 0)));

--- 52,60 ----
STRLEN len;
char *maskstr = SvPV(mask, len);
int i;
! if (MAXO != len)
croak("Bad mask length");
! for (i = 0; i < MAXO; i++)
if (maskstr[i])
XPUSHs(sv_2mortal(newSVpv(op_name[i], 0)));

***************
*** 63,74 ****
CODE:
int i, j;
char *mask, *op;
! Newz(666, mask, maxo, char);
for (i = 0; i < items; i++)
{
op = SvPV(ST(i), na);
! for (j = 0; j < maxo && strNE(op, op_name[j]); j++) /* nothing */ ;
! if (j < maxo)
mask[j] = 1;
else
{
--- 63,74 ----
CODE:
int i, j;
char *mask, *op;
! Newz(666, mask, MAXO, char);
for (i = 0; i < items; i++)
{
op = SvPV(ST(i), na);
! for (j = 0; j < MAXO && strNE(op, op_name[j]); j++) /* nothing */ ;
! if (j < MAXO)
mask[j] = 1;
else
{
***************
*** 77,94 ****
}
}
ST(0) = sv_newmortal();
! sv_usepvn(ST(0), mask, maxo);

void
opname(...)
PPCODE:
! int i, opcode;
for (i = 0; i < items; i++)
{
! opcode = SvIV(ST(i));
! if (opcode < 0 || opcode >= maxo)
croak("opcode out of range");
! XPUSHs(sv_2mortal(newSVpv(op_name[opcode], 0)));
}

void
--- 77,94 ----
}
}
ST(0) = sv_newmortal();
! sv_usepvn(ST(0), mask, MAXO);

void
opname(...)
PPCODE:
! int i, op_code;
for (i = 0; i < items; i++)
{
! op_code = SvIV(ST(i));
! if (op_code < 0 || op_code >= MAXO)
croak("opcode out of range");
! XPUSHs(sv_2mortal(newSVpv(op_name[op_code], 0)));
}

void
***************
*** 99,106 ****
for (i = 0; i < items; i++)
{
op = SvPV(ST(i), na);
! for (j = 0; j < maxo && strNE(op, op_name[j]); j++) /* nothing */ ;
! if (j == maxo)
croak("bad op name \"%s\"", op);
XPUSHs(sv_2mortal(newSViv(j)));
}
--- 99,106 ----
for (i = 0; i < items; i++)
{
op = SvPV(ST(i), na);
! for (j = 0; j < MAXO && strNE(op, op_name[j]); j++) /* nothing */ ;
! if (j == MAXO)
croak("bad op name \"%s\"", op);
XPUSHs(sv_2mortal(newSViv(j)));
}
***************
*** 108,113 ****
int
MAXO()
CODE:
! RETVAL = maxo;
OUTPUT:
RETVAL
--- 108,113 ----
int
MAXO()
CODE:
! RETVAL = MAXO;
OUTPUT:
RETVAL