Code Monkey home page Code Monkey logo

data-record's People

Contributors

dependabot[bot] avatar olliv avatar

Watchers

 avatar  avatar

data-record's Issues

Strings, arrays, and pointers

Possible cases:

  • A pointer to an array of strings
  • An array of pointers to strings
  • A pointer to an array of string pointers
  • An array of pointers to strings pointers
  • An array of pointers to arrays of strings
  • An array of pointers to arrays of strings pointers

Union type and pointers

Currently it's fairly easy to read a struct with a pointer to union data. There are indeed multiple ways, either the struct might be declared with a union of pointers or the values can be casted or memcpy()d depending on the case.

However, to create such a union in the JS side is a bit harder. Currently it requires one type definition per type in the union. If the header generator is used this will result a number of structs. data-record will make sure the alignment is always correct so they C side can technically still just use one struct.

The biggest problem in implementing a union type is that the serializer would need extra info about which type to select. Using the write functions would work for non-pointers.

Pointer types

Copy data after the end of the struct and make a pointer to it in the struct.
This doesn't need to support growing the buffer at serialization time, it's enough if the alloc function can create a large enough buffer.

Accessors should support arrays

The following functions don't currently handle arrays correctly:

readValue(compiledDef, buf, path)
readString(compiledDef, buf, path, encoding)
writeValue(compiledDef, buf, path, value)
writeString(compiledDef, buf, path, value, encoding)
createReader(compiledDef, buf, path)
createStringReader(compiledDef, buf, path)
createWriter(compiledDef, buf, path)

They should either support arrays directly or there should be array variants. Latter sounds better as it could possibly also support indexing too.

Support C struct alignment

Currently compile builds a sort of packed struct but it would be better to support normal structs for performance and ease of use.

Default endianness setting and types

Allow selecting between BE, LE, HOST, NET.

NET should always add hton() calls to the C header generator.

Add endianless-types that use either the selected endianness or the host endianness.

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.