chiark
/
gitweb
/
~mdw
/
catacomb-perl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Much wider support for Catacomb in all its glory.
[catacomb-perl]
/
mpstuff.c
diff --git
a/mpstuff.c
b/mpstuff.c
index e048ff161cdaf1eb590d9ef20c5ef82fc5a27f19..9881edc1fe48a463eb5bf6a277aaf9124164acb7 100644
(file)
--- a/
mpstuff.c
+++ b/
mpstuff.c
@@
-94,12
+94,23
@@
mp *mp_readsv(mp *m, SV *sv, STRLEN *off, int radix)
return (m);
}
return (m);
}
+int group_writesv(group *g, ge *x, SV *sv)
+{
+ mptext_svctx c;
+ int rc;
+ STRLEN len;
+ sv_setpvn(sv, "", 0);
+ c.sv = sv;
+ rc = G_WRITE(g, x, &mptext_svops, &c);
+ return (rc);
+}
+
int mp_writesv(mp *m, SV *sv, int radix)
{
mptext_svctx c;
int rc;
STRLEN len;
int mp_writesv(mp *m, SV *sv, int radix)
{
mptext_svctx c;
int rc;
STRLEN len;
-
SvPV(sv, len
);
+
sv_setpvn(sv, "", 0
);
c.sv = sv;
rc = mp_write(m, radix, &mptext_svops, &c);
return (rc);
c.sv = sv;
rc = mp_write(m, radix, &mptext_svops, &c);
return (rc);
@@
-107,8
+118,7
@@
int mp_writesv(mp *m, SV *sv, int radix)
/* --- Conversion to and from SVs --- */
/* --- Conversion to and from SVs --- */
-mp *mp_fromsv(SV *sv, const char *what, const char *ty,
- int radix, int keep, ...)
+mp *mp_fromsv(SV *sv, const char *what, int radix, int keep, ...)
{
mp *m;
if (SvROK(sv)) {
{
mp *m;
if (SvROK(sv)) {
@@
-119,7
+129,7
@@
mp *mp_fromsv(SV *sv, const char *what, const char *ty,
SV *t = sv_newmortal();
va_start(ap, keep);
sv_vsetpvfn(t, what, strlen(what), &ap, 0, 0, 0);
SV *t = sv_newmortal();
va_start(ap, keep);
sv_vsetpvfn(t, what, strlen(what), &ap, 0, 0, 0);
- croak("%s is not of type
%s", SvPVX(t), ty
);
+ croak("%s is not of type
Catacomb::MP", SvPVX(t)
);
}
if (m && keep)
MP_COPY(m);
}
if (m && keep)
MP_COPY(m);
@@
-129,7
+139,7
@@
mp *mp_fromsv(SV *sv, const char *what, const char *ty,
else
m = mp_readsv(MP_NEW, sv, 0, radix);
if (m && !keep)
else
m = mp_readsv(MP_NEW, sv, 0, radix);
if (m && !keep)
- RET
(m, ty);
/* Kill temporary later */
+ RET
_MP(m);
/* Kill temporary later */
}
return (m);
}
}
return (m);
}