poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] New JSON representation for Poke values in MI


From: Mohammad-Reza Nabipoor
Subject: Re: [RFC] New JSON representation for Poke values in MI
Date: Mon, 23 Aug 2021 23:26:06 +0430

Hi.

On Mon, Aug 23, 2021 at 05:42:17PM +0200, Kostas Chasialis wrote:
> Moreover, the previous schema made the generated JSON too long, by repeating
> information again and again.
> Mohammad presented an example that for a not very long Poke array they JSON
> generated was 117Kbs. As he said, this is not acceptable, and I totally agree.


That was the output of a new command `DECLS` to show the already declared
identifiers (variables, functions and type) with source info. But it prodecues
121KB data (junk, to be precise!) for only declared variables!


> 
> Any comments are welcome!
> 


A few minor comments:

1. What about removing the "value" field from "PokeValue"?


```
##
3500 as uint<32>
##
{
    "PokeType": {
        "code": "Integral",
        "info": {
            "size": 32,
            "signed_p": false
        }
    },
    "PokeValue": {
        "value": 3500
    }
}
```

to

```
    ...
    "PokeValue": 3500
}
```

And

```
##
"foo"
##
{
    "PokeType": {
        "code": "String",
    },
    "PokeValue": {
        "value": "foo"
    }
}
```

to

```
    "PokeType": { "code": "String" },
    "PokeValue": "foo"
```

And in structs, instead of

```
    ...
    "PokeValue": {
        "fields": [
            {
                "value": 1
            },
            {
                "value": 2
            }
        ],
    ...
```

```
    ...
    "PokeValue": {
        "fields": [1, 2],
    ...
```

Ditto for arrays.


2. The "unit" can be removed from the "PokeValue", because that's already part
of the type. Instead of

```
##
23U#B
##
{
    "PokeType": {
        "code": "Offset",
        "info": {
            "base_type": {
                "code": "Integral",
                "info": {
                    "size": 32,
                    "signed_p": false
                }
            },
            "unit": 8
        }
    },
    "PokeValue": {
        "magnitude": 23,
        "unit": 8
    }
}
```

We can have:

```
    ...
    },
    "PokeValue": {
        "magnitude": 23
    }
}

```

Or even this:

```
    ...
    },
    "PokeValue": 23
}
```


Regards,
Mohammad-Reza



reply via email to

[Prev in Thread] Current Thread [Next in Thread]