poke-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v3 1/2] libpoke: Add PK_E_* macros representing standard exce


From: Jose E. Marchesi
Subject: Re: [PATCH v3 1/2] libpoke: Add PK_E_* macros representing standard exception codes
Date: Thu, 13 Jan 2022 01:07:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hi Mohammad.

> 2022-01-12  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
>
>       * libpoke/libpoke.h (PK_E_*): Add macros for standard exception
>       codes.
>       * libpoke/pkl-rt-1.pk: Update comment to mention libpoke.h.
>       * libpoke/pvm.h: Likewise.

If you s/PK_E_*/PK_EC_*/g then OK for master! :)

> ---
>  ChangeLog           |  7 +++++++
>  libpoke/libpoke.h   | 23 +++++++++++++++++++++++
>  libpoke/pkl-rt-1.pk |  3 ++-
>  libpoke/pvm.h       |  4 ++--
>  4 files changed, 34 insertions(+), 3 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index b34f1b41..5dc360bd 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,10 @@
> +2022-01-12  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
> +
> +     * libpoke/libpoke.h (PK_E_*): Add macros for standard exception
> +     codes.
> +     * libpoke/pkl-rt-1.pk: Update comment to mention libpoke.h.
> +     * libpoke/pvm.h: Likewise.
> +
>  2022-01-11  Jose E. Marchesi  <jemarch@gnu.org>
>  
>       * libpoke/pvm-val.c (pvm_typeof): If given a type value, return
> diff --git a/libpoke/libpoke.h b/libpoke/libpoke.h
> index dd164172..8fb12356 100644
> --- a/libpoke/libpoke.h
> +++ b/libpoke/libpoke.h
> @@ -41,6 +41,29 @@ typedef uint64_t pk_val;
>  #define PK_EEOF 3
>  #define PK_EINVAL 4
>  
> +/* The following macros are standard exception codes defined in
> +   pkl-rt-1.pk.  */
> +
> +#define PK_E_GENERIC       0
> +#define PK_E_DIV_BY_ZERO   1
> +#define PK_E_NO_IOS        2
> +#define PK_E_NO_RETURN     3
> +#define PK_E_OUT_OF_BOUNDS 4
> +#define PK_E_MAP_BOUNDS    5
> +#define PK_E_EOF           6
> +#define PK_E_MAP           7
> +#define PK_E_CONV          8
> +#define PK_E_ELEM          9
> +#define PK_E_CONSTRAINT   10
> +#define PK_E_IO           11
> +#define PK_E_SIGNAL       12
> +#define PK_E_IOFLAGS      13
> +#define PK_E_INVAL        14
> +#define PK_E_EXIT         15
> +#define PK_E_ASSERT       16
> +#define PK_E_OVERFLOW     17
> +#define PK_E_PERM         18
> +
>  struct pk_color
>  {
>    int red;
> diff --git a/libpoke/pkl-rt-1.pk b/libpoke/pkl-rt-1.pk
> index 7e09326a..c90d3770 100644
> --- a/libpoke/pkl-rt-1.pk
> +++ b/libpoke/pkl-rt-1.pk
> @@ -103,7 +103,8 @@ type Exception =
>    };
>  
>  /* Standard exception codes.
> -   These codes should be in sync with PVM_E_* macros in pvm.h.
> +   These codes should be in sync with PVM_E_* macros in pvm.h and
> +   PK_E_* macros libpoke.h.
>     Note that user-defined exceptions must have codes starting with
>     255 (and should be registered using exception_code function defined
>     below).
> diff --git a/libpoke/pvm.h b/libpoke/pvm.h
> index 2bf736b7..78d5471b 100644
> --- a/libpoke/pvm.h
> +++ b/libpoke/pvm.h
> @@ -488,8 +488,8 @@ enum pvm_exit_code
>      PVM_EXIT_ERROR = 1
>    };
>  
> -/* Exceptions.  These should be in sync with the exception code
> -   variables, and the exception names, declared in pkl-rt-1.pk */
> +/* Exceptions.  These should be in sync with the exception code macros
> +   in libpoke.h, and variables and exception names, declared in pkl-rt-1.pk 
> */
>  
>  #define PVM_E_GENERIC       0
>  #define PVM_E_GENERIC_NAME "generic"



reply via email to

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