ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/JSON-XS/XS.xs
(Generate patch)

Comparing JSON-XS/XS.xs (file contents):
Revision 1.66 by root, Sun Nov 25 19:02:42 2007 UTC vs.
Revision 1.69 by root, Wed Dec 5 10:59:28 2007 UTC

1457{ 1457{
1458 SV *pv = NEWSV (0, sizeof (JSON)); 1458 SV *pv = NEWSV (0, sizeof (JSON));
1459 SvPOK_only (pv); 1459 SvPOK_only (pv);
1460 Zero (SvPVX (pv), 1, JSON); 1460 Zero (SvPVX (pv), 1, JSON);
1461 ((JSON *)SvPVX (pv))->flags = F_DEFAULT; 1461 ((JSON *)SvPVX (pv))->flags = F_DEFAULT;
1462 XPUSHs (sv_2mortal (sv_bless (newRV_noinc (pv), JSON_STASH))); 1462 XPUSHs (sv_2mortal (sv_bless (
1463 newRV_noinc (pv),
1464 strEQ (klass, "JSON::XS") ? JSON_STASH : gv_stashpv (klass, 1)
1465 )));
1463} 1466}
1464 1467
1465void ascii (JSON *self, int enable = 1) 1468void ascii (JSON *self, int enable = 1)
1466 ALIAS: 1469 ALIAS:
1467 ascii = F_ASCII 1470 ascii = F_ASCII
1494 get_utf8 = F_UTF8 1497 get_utf8 = F_UTF8
1495 get_indent = F_INDENT 1498 get_indent = F_INDENT
1496 get_canonical = F_CANONICAL 1499 get_canonical = F_CANONICAL
1497 get_space_before = F_SPACE_BEFORE 1500 get_space_before = F_SPACE_BEFORE
1498 get_space_after = F_SPACE_AFTER 1501 get_space_after = F_SPACE_AFTER
1499 get_pretty = F_PRETTY
1500 get_allow_nonref = F_ALLOW_NONREF 1502 get_allow_nonref = F_ALLOW_NONREF
1501 get_shrink = F_SHRINK 1503 get_shrink = F_SHRINK
1502 get_allow_blessed = F_ALLOW_BLESSED 1504 get_allow_blessed = F_ALLOW_BLESSED
1503 get_convert_blessed = F_CONV_BLESSED 1505 get_convert_blessed = F_CONV_BLESSED
1504 get_relaxed = F_RELAXED 1506 get_relaxed = F_RELAXED
1518 self->flags = self->flags & ~F_MAXDEPTH | (log2 << S_MAXDEPTH); 1520 self->flags = self->flags & ~F_MAXDEPTH | (log2 << S_MAXDEPTH);
1519 1521
1520 XPUSHs (ST (0)); 1522 XPUSHs (ST (0));
1521} 1523}
1522 1524
1523int get_max_depth (JSON *self) 1525U32 get_max_depth (JSON *self)
1524 CODE: 1526 CODE:
1525 RETVAL = DEC_DEPTH (self->flags); 1527 RETVAL = DEC_DEPTH (self->flags);
1526 OUTPUT: 1528 OUTPUT:
1527 RETVAL 1529 RETVAL
1528 1530
1601 SvREFCNT_dec (self->cb_sk_object); 1603 SvREFCNT_dec (self->cb_sk_object);
1602 SvREFCNT_dec (self->cb_object); 1604 SvREFCNT_dec (self->cb_object);
1603 1605
1604PROTOTYPES: ENABLE 1606PROTOTYPES: ENABLE
1605 1607
1606void to_json (SV *scalar) 1608void encode_json (SV *scalar)
1607 PPCODE: 1609 PPCODE:
1608{ 1610{
1609 JSON json = { F_DEFAULT | F_UTF8 }; 1611 JSON json = { F_DEFAULT | F_UTF8 };
1610 XPUSHs (encode_json (scalar, &json)); 1612 XPUSHs (encode_json (scalar, &json));
1611} 1613}
1612 1614
1613void from_json (SV *jsonstr) 1615void decode_json (SV *jsonstr)
1614 PPCODE: 1616 PPCODE:
1615{ 1617{
1616 JSON json = { F_DEFAULT | F_UTF8 }; 1618 JSON json = { F_DEFAULT | F_UTF8 };
1617 XPUSHs (decode_json (jsonstr, &json, 0)); 1619 XPUSHs (decode_json (jsonstr, &json, 0));
1618} 1620}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines