Giter VIP home page Giter VIP logo

jstruct's People

Contributors

hanhui03 avatar wancy-x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

jstruct's Issues

Why does the structure need void *json member?

for example:
struct json_attitude { float roll; float yaw; float pitch; void *json; };
In the user's perspective, we don't know when to use void *json member in structure.In what scenarios do we need to use it?

Value error during deserialization of 'Int' type

For example, data like this:
{"foo":1203456,"bar":100,"boo":true, "str":"hello!","arr":[1.0,1.1,1.2,1.3],"han":3,1414999961853027}
The result after deserialization is as follows:
foo : 1
bar : 0
boo : 1
str : hello!
arr[0] : 1.000000
arr[1] : 1.100000
arr[2] : 1.200000
arr[3 ]: 1.300000
han : 3.141500

The result of using method yyjson_get_real() to parse int type data is incorrect, and using method yyjson_get_int() instead has the correct result.

ubuntu 14.04 node v0.10.25 run error

cheng@cheng-virtual-machine:~/jstruct$ node jstruct.js conf.json

/home/cheng/jstruct/jstruct.js:72
        for (var item of member) {
                      ^^
SyntaxError: Unexpected identifier
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

In industrial scenarios, it is necessary to increase the processing of special data structures such as union and bit fields.

At present, there is a very common data structure as follows:

typedef struct
{
	union
	{
		unsigned short word;
		struct
		{
			unsigned code1		:3;
			unsigned code2		:5;
			unsigned code3		:2;
			unsigned code4		:6;
		}block;
	}order;
	...
}

In order to be compatible with a large number of early module codes, this is a necessary data structure, and this data structure will be transmitted with high-level programming languages.

After careful study, the conclusion is that under the current use scenario, the union cannot be serialized in general, but can only be parsed in a targeted way. In consideration of the universality of Jstruct, it is recommended to negotiate the special data types that may be encountered at present and in the future.

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.