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

Comparing CBOR-XS/XS.xs (file contents):
Revision 1.7 by root, Sat Oct 26 23:02:55 2013 UTC vs.
Revision 1.8 by root, Sun Oct 27 10:12:01 2013 UTC

8#include <stdio.h> 8#include <stdio.h>
9#include <limits.h> 9#include <limits.h>
10#include <float.h> 10#include <float.h>
11 11
12#include "ecb.h" 12#include "ecb.h"
13
14// known tags, rfc7049
15enum cbor_tag
16{
17 CBOR_TAG_DATETIME = 0, // rfc4287, utf-8
18 CBOR_TAG_TIMESTAMP = 1, // unix timestamp, any
19 CBOR_TAG_POS_BIGNUM = 2, // byte string
20 CBOR_TAG_NEG_BIGNUM = 3, // byte string
21 CBOR_TAG_DECIMAL = 4, // decimal fraction, array
22 CBOR_TAG_BIGFLOAT = 5, // array
23
24 CBOR_TAG_CONV_B64U = 21, // base64url, any
25 CBOR_TAG_CONV_B64 = 22, // base64, any
26 CBOR_TAG_CONV_HEX = 23, // base16, any
27 CBOR_TAG_CBOR = 24, // embedded cbor, byte string
28
29 CBOR_TAG_URI = 32, // URI rfc3986, utf-8
30 CBOR_TAG_B64U = 33, // base64url rfc4648, utf-8
31 CBOR_TAG_B64 = 34, // base6 rfc46484, utf-8
32 CBOR_TAG_REGEX = 35, // regex pcre/ecma262, utf-8
33 CBOR_TAG_MIME = 36, // mime message rfc2045, utf-8
34
35 CBOR_TAG_MAGIC = 55799
36};
13 37
14#define F_SHRINK 0x00000200UL 38#define F_SHRINK 0x00000200UL
15#define F_ALLOW_UNKNOWN 0x00002000UL 39#define F_ALLOW_UNKNOWN 0x00002000UL
16 40
17#define INIT_SIZE 32 // initial scalar size to be allocated 41#define INIT_SIZE 32 // initial scalar size to be allocated
612decode_tagged (dec_t *dec) 636decode_tagged (dec_t *dec)
613{ 637{
614 UV tag = decode_uint (dec); 638 UV tag = decode_uint (dec);
615 SV *sv = decode_sv (dec); 639 SV *sv = decode_sv (dec);
616 640
617 if (tag == 55799) // 2.4.5 Self-Describe CBOR 641 if (tag == CBOR_TAG_MAGIC) // 2.4.5 Self-Describe CBOR
618 return sv; 642 return sv;
619 643
620 AV *av = newAV (); 644 AV *av = newAV ();
621 av_push (av, newSVuv (tag)); 645 av_push (av, newSVuv (tag));
622 av_push (av, sv); 646 av_push (av, sv);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines