poke-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] pk_type_code and json schema fixes.


From: Jose E. Marchesi
Subject: Re: [PATCH] pk_type_code and json schema fixes.
Date: Mon, 03 Aug 2020 21:47:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Please consider this file and ignore the previous reply, because it also
> contains the changes on our JSON Schema.

OK for master.
Thanks!

>
> From: kostasch <sdi1600195@di.uoa.gr>
> Date: Mon, 3 Aug 2020 22:37:23 +0300
> Subject: [PATCH] pk_type_code and json schema fixes.
>
> 2020-08-03  Kostas Chasialis  <sdi1600195@di.uoa.gr>
>
>       * libpoke/pk-val.c (pk_type_code): Now return PK_UINT
>       if integral type is unsigned.
>       * etc/pk-mi-json-schema.json (json_schema) : Changed "offsets"
>       to "boffsets" on arrays and structs.
> ---
>  ChangeLog                  |  7 +++++++
>  etc/pk-mi-json-schema.json | 26 ++++++++++++++++++++------
>  libpoke/pk-val.c           |  5 ++++-
>  3 files changed, 31 insertions(+), 7 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index 2d9f6870..c0df29c5 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,10 @@
> +2020-08-03  Kostas Chasialis  <sdi1600195@di.uoa.gr>
> +
> +     * libpoke/pk-val.c (pk_type_code): Now return PK_UINT
> +     if integral type is unsigned.
> +     * etc/pk-mi-json-schema.json (json_schema) : Changed "offsets"
> +     to "boffsets" on arrays and structs.
> +
>  2020-08-02  Kostas Chasialis  <sdi1600195@di.uoa.gr>
>  
>       * libpoke/libpoke.h: Change poke to Poke on function documentations.
> diff --git a/etc/pk-mi-json-schema.json b/etc/pk-mi-json-schema.json
> index 40b83bf8..5b0a980c 100644
> --- a/etc/pk-mi-json-schema.json
> +++ b/etc/pk-mi-json-schema.json
> @@ -114,9 +114,16 @@
>          "StructField" : {
>              "type" : "object",
>              "properties" : {
> -                "offset" : {
> +                "boffset" : {
>                      "type" : "object",
> -                    "$ref" : "#/definitions/Offset"
> +                    "allOf" : [
> +                        { "$ref" : "#/definitions/UnsignedInteger" }
> +                    ],
> +                    "properties" : {
> +                        "size" : {
> +                            "const" : 64
> +                        }
> +                    }
>                  },
>                  "name" : {
>                      "type" : "object",
> @@ -136,7 +143,7 @@
>              },
>              "maxProperties": 3,
>              "required" : [
> -                "offset",
> +                "boffset",
>                  "name",
>                  "value"
>              ]
> @@ -220,15 +227,22 @@
>                                      { "$ref": "#/definitions/Null" }
>                                  ]
>                              },
> -                            "offset" : {
> +                            "boffset" : {
>                                  "type" : "object",
> -                                "$ref" : "#/definitions/Offset"
> +                                "allOf" : [
> +                                    { "$ref" : 
> "#/definitions/UnsignedInteger" }
> +                                ],
> +                                "properties" : {
> +                                    "size" : {
> +                                        "const" : 64
> +                                    }
> +                                }
>                              }
>                          },
>                          "maxProperties" : 2,
>                          "required" : [
>                              "value",
> -                            "offset"
> +                            "boffset"
>                          ]
>                      }
>                  },
> diff --git a/libpoke/pk-val.c b/libpoke/pk-val.c
> index 5f9c882c..035d9fa5 100644
> --- a/libpoke/pk-val.c
> +++ b/libpoke/pk-val.c
> @@ -164,7 +164,10 @@ pk_type_code (pk_val val)
>    switch (PVM_VAL_TYP_CODE (val))
>      {
>      case PVM_TYPE_INTEGRAL:
> -      return PK_INT;
> +      if ((pk_int_value (pk_integral_type_signed_p (pk_typeof (val)))))
> +        return PK_INT;
> +      else
> +        return PK_UINT;
>      case PVM_TYPE_STRING:
>        return PK_STRING;
>      case PVM_TYPE_ARRAY:



reply via email to

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