Giter VIP home page Giter VIP logo

cbor's People

Contributors

spc476 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cbor's Issues

Anything needed for RFC 8949 update?

https://cbor.io cites this repo saying "supports everything mentioned in RFC 7049".
A new edition of RFC 7049 has become available as RFC 8949.
While there are no technical changes, there is, for instance, a slightly fixed "deterministic encoding" procedure alongside the one from RFC 7049.
Can you check that I can simply update that citation?

Windows support

I can not install it on Windows/MSVC with LuaRocks.
I really do not understand why need use build.type make in
such rockspecs instead of builtin. In some cases LuaRocks not
enouth but not in this. This works on my system.

build = {
  type = "builtin";
  modules = {
    ['org.conman.cbor_c'   ] = {
      sources = { 'cbor_c.c', 'dnf.c' };
      defines = {  'VERSION="1.2.0"'  };
    };
    ['org.conman.cbor'     ] = 'cbor.lua';
    ['org.conman.cbor_s'   ] = 'cbor_s.lua';
    ['org.conman.cbormisc' ] = 'cbormisc.lua';
  };
}

But it fail rains test

        Testing ARRAY ...GO!
        Testing _rains ...C:\LuaRocks\x64\5.2\bin\lua52.exe: cbor_test.lua:30: encoding for _rains failed:
DA 00 E9 9B A8 A1 00 81 82 04 A3 05 6F 77 77 77 2E 63 6F 6E 6D 61 6E 2E 6F 72 67 2E 0D 81 61 2E 0E 83 01 02 03
DA 00 E9 9B A8 A1 00 81 82 04 A3 0D 81 61 2E 05 6F 77 77 77 2E 63 6F 6E 6D 61 6E 2E 6F 72 67 2E 0E 83 01 02 03
stack traceback:
        [C]: in function 'assert'
        test.lua:30: in function 'assertf'
        test.lua:98: in function 'test'
        test.lua:655: in main chunk
        [C]: in ?

org.conman.table dependency missing

Trying to use the cbormisc module, it fails to load the library due to the org.conman.table module not being installed.
I can't seem to find it in any of your existing lua rocks?

how to encode binary data that is incidentally valid UTF-8?

cbor.encode{a='\x66\xc3\xb9'}

encodes as:

A1           # map(1)
   61        # text(1)
      61     # "a"
   63        # text(3)
      66C3B9 # "f\xC3\xB9"

however the 3 bytes '\x66\xc3\xb9' are meant as bytes(3) (0x43), not text(3) (0x63).

Is there a way to force bytes for a particular field? I mean without resorting to a low-level encoding such as:

enc = cbor.TYPE.MAP(3)
      .. cbor.encode"a" .. cbor.TYPE.BIN('\x66\xc3\xb9')

Also, I can imagine if the library has to guess wether a Lua string is text or bytes, it has to scan the string, so telling what it is upfront could also save some CPU time.

decoding tagged cbor

hi, i noticed it's not very easy to decode an item that is tagged as CBOR (tag 55799).

here's a diff that (i think) will make it easier to tag items as cbor, and decode items tagged as CBOR.

diff --git a/cbor.lua b/cbor.lua
index 22a29ad..9c34b9a 100644
--- a/cbor.lua
+++ b/cbor.lua
@@ -784,12 +784,13 @@ TAG = setmetatable(

     -- =====================================================================

-    _magic_cbor = function()
-      return cbor_c.encode(0xC0,55799)
+    _magic_cbor = function(value,sref,stref)
+      return cbor_c.encode(0xC0,55799) .. encode(value,sref,stref)
     end,

-    [55799] = function(_,pos)
-      return '_magic_cbor',pos,'_magic_cbor'
+    [55799] = function(packet,pos,conv,ref)
+      local value,npos = decode(packet,pos,conv,ref)
+      return value,npos,'_magic_cbor'
     end,

     -- **********************************************************

Minor typos in assert messages

assert(math.type(value[2]) == 'integer',"_bigfloat expecta an integer as second element")

throw(pos,"_bigfloat: watned ARRAY[2], got ARRAY[%s]",value)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.