2016-09-28 14:40:37 +00:00
|
|
|
/*
|
|
|
|
* $Id$
|
|
|
|
*
|
2018-02-07 14:13:13 +00:00
|
|
|
Copyright (c) 2016-2018 Chung, Hyung-Hwan. All rights reserved.
|
2016-09-28 14:40:37 +00:00
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
modification, are permitted provided that the following conditions
|
|
|
|
are met:
|
|
|
|
1. Redistributions of source code must retain the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer in the
|
|
|
|
documentation and/or other materials provided with the distribution.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
|
|
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _HCL_PRV_H_
|
|
|
|
#define _HCL_PRV_H_
|
|
|
|
|
2021-01-12 09:06:25 +00:00
|
|
|
#include <hcl.h>
|
|
|
|
#include <hcl-fmt.h>
|
|
|
|
#include <hcl-utl.h>
|
2016-09-28 14:40:37 +00:00
|
|
|
|
|
|
|
/* you can define this to either 1 or 2 */
|
2021-01-29 12:39:31 +00:00
|
|
|
#define HCL_CODE_LONG_PARAM_SIZE 2
|
2016-09-28 14:40:37 +00:00
|
|
|
|
2021-03-28 03:44:27 +00:00
|
|
|
/* this is useful for debugging. hcl_gc() can be called
|
2016-09-28 14:40:37 +00:00
|
|
|
* while hcl has not been fully initialized when this is defined*/
|
|
|
|
#define HCL_SUPPORT_GC_DURING_IGNITION
|
|
|
|
|
2018-02-05 10:43:25 +00:00
|
|
|
/* define this to enable karatsuba multiplication in bigint */
|
|
|
|
#define HCL_ENABLE_KARATSUBA
|
|
|
|
#define HCL_KARATSUBA_CUTOFF 32
|
|
|
|
#define HCL_KARATSUBA_CUTOFF_DEBUG 3
|
|
|
|
|
2020-11-15 10:26:14 +00:00
|
|
|
/* enable floating-pointer number support in the basic formatting functions */
|
|
|
|
#define HCL_ENABLE_FLTFMT
|
|
|
|
|
2018-02-21 09:30:18 +00:00
|
|
|
#if defined(HCL_BUILD_DEBUG)
|
2021-01-27 08:47:08 +00:00
|
|
|
/*#define HCL_DEBUG_LEXER 1*/
|
2018-02-08 09:21:18 +00:00
|
|
|
#define HCL_DEBUG_VM_PROCESSOR 1
|
|
|
|
#define HCL_DEBUG_VM_EXEC 1
|
2021-01-03 13:51:23 +00:00
|
|
|
/*#define HCL_PROFILE_VM 1*/
|
2018-02-08 09:21:18 +00:00
|
|
|
#endif
|
2016-09-28 14:40:37 +00:00
|
|
|
|
2016-10-06 17:49:47 +00:00
|
|
|
/* allow the caller to drive process switching by calling
|
|
|
|
* stix_switchprocess(). */
|
|
|
|
#define HCL_EXTERNAL_PROCESS_SWITCH
|
|
|
|
|
2016-09-28 14:40:37 +00:00
|
|
|
/* limit the maximum object size such that:
|
|
|
|
* 1. an index to an object field can be represented in a small integer.
|
|
|
|
* 2. the maximum number of bits including bit-shifts can be represented
|
|
|
|
* in the hcl_oow_t type.
|
|
|
|
*/
|
|
|
|
#define HCL_LIMIT_OBJ_SIZE
|
|
|
|
|
2018-03-08 10:00:57 +00:00
|
|
|
|
|
|
|
#define HCL_BC_BUFFER_INIT 10240
|
|
|
|
#define HCL_BC_BUFFER_ALIGN 10240
|
|
|
|
|
|
|
|
#define HCL_LIT_BUFFER_INIT 1024
|
|
|
|
#define HCL_LIT_BUFFER_ALIGN 1024
|
|
|
|
|
2016-09-28 14:40:37 +00:00
|
|
|
#if defined(__has_builtin)
|
2018-02-21 13:02:05 +00:00
|
|
|
|
|
|
|
# if (!__has_builtin(__builtin_memset) || !__has_builtin(__builtin_memcpy) || !__has_builtin(__builtin_memmove) || !__has_builtin(__builtin_memcmp))
|
|
|
|
# include <string.h>
|
|
|
|
# endif
|
|
|
|
|
2016-09-28 14:40:37 +00:00
|
|
|
# if __has_builtin(__builtin_memset)
|
|
|
|
# define HCL_MEMSET(dst,src,size) __builtin_memset(dst,src,size)
|
|
|
|
# else
|
|
|
|
# define HCL_MEMSET(dst,src,size) memset(dst,src,size)
|
|
|
|
# endif
|
|
|
|
# if __has_builtin(__builtin_memcpy)
|
|
|
|
# define HCL_MEMCPY(dst,src,size) __builtin_memcpy(dst,src,size)
|
|
|
|
# else
|
|
|
|
# define HCL_MEMCPY(dst,src,size) memcpy(dst,src,size)
|
|
|
|
# endif
|
|
|
|
# if __has_builtin(__builtin_memmove)
|
|
|
|
# define HCL_MEMMOVE(dst,src,size) __builtin_memmove(dst,src,size)
|
|
|
|
# else
|
|
|
|
# define HCL_MEMMOVE(dst,src,size) memmove(dst,src,size)
|
|
|
|
# endif
|
|
|
|
# if __has_builtin(__builtin_memcmp)
|
|
|
|
# define HCL_MEMCMP(dst,src,size) __builtin_memcmp(dst,src,size)
|
|
|
|
# else
|
|
|
|
# define HCL_MEMCMP(dst,src,size) memcmp(dst,src,size)
|
|
|
|
# endif
|
|
|
|
|
|
|
|
#else
|
2022-07-19 02:58:28 +00:00
|
|
|
|
|
|
|
/* g++ 2.95 had a problem with __builtin_memxxx functions:
|
|
|
|
* implicit declaration of function `__builtin_memmove' */
|
|
|
|
# if defined(__cplusplus) && defined(__GNUC__) && (__GNUC__ <= 2)
|
|
|
|
# undef HAVE___BUILTIN_MEMSET
|
|
|
|
# undef HAVE___BUILTIN_MEMCPY
|
|
|
|
# undef HAVE___BUILTIN_MEMMOVE
|
|
|
|
# undef HAVE___BUILTIN_MEMCMP
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# if !defined(HAVE___BUILTIN_MEMSET) || \
|
|
|
|
!defined(HAVE___BUILTIN_MEMCPY) || \
|
|
|
|
!defined(HAVE___BUILTIN_MEMMOVE) || \
|
2023-10-23 09:49:15 +00:00
|
|
|
!defined(HAVE___BUILTIN_MEMCMP)
|
2022-07-19 02:58:28 +00:00
|
|
|
# include <string.h>
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# if defined(HAVE___BUILTIN_MEMSET)
|
|
|
|
# define HCL_MEMSET(dst,src,size) __builtin_memset(dst,src,size)
|
|
|
|
# else
|
|
|
|
# define HCL_MEMSET(dst,src,size) memset(dst,src,size)
|
|
|
|
# endif
|
|
|
|
# if defined(HAVE___BUILTIN_MEMCPY)
|
|
|
|
# define HCL_MEMCPY(dst,src,size) __builtin_memcpy(dst,src,size)
|
|
|
|
# else
|
|
|
|
# define HCL_MEMCPY(dst,src,size) memcpy(dst,src,size)
|
|
|
|
# endif
|
|
|
|
# if defined(HAVE___BUILTIN_MEMMOVE)
|
|
|
|
# define HCL_MEMMOVE(dst,src,size) __builtin_memmove(dst,src,size)
|
|
|
|
# else
|
|
|
|
# define HCL_MEMMOVE(dst,src,size) memmove(dst,src,size)
|
|
|
|
# endif
|
|
|
|
# if defined(HAVE___BUILTIN_MEMCMP)
|
|
|
|
# define HCL_MEMCMP(dst,src,size) __builtin_memcmp(dst,src,size)
|
|
|
|
# else
|
|
|
|
# define HCL_MEMCMP(dst,src,size) memcmp(dst,src,size)
|
|
|
|
# endif
|
|
|
|
|
2016-09-28 14:40:37 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(HCL_LIMIT_OBJ_SIZE)
|
|
|
|
/* limit the maximum object size such that:
|
|
|
|
* 1. an index to an object field can be represented in a small integer.
|
|
|
|
* 2. the maximum number of bit shifts can be represented in the hcl_oow_t type.
|
|
|
|
*/
|
|
|
|
# define HCL_OBJ_SIZE_MAX ((hcl_oow_t)HCL_SMOOI_MAX)
|
2019-05-04 17:56:45 +00:00
|
|
|
# define HCL_OBJ_SIZE_BITS_MAX (HCL_OBJ_SIZE_MAX * HCL_BITS_PER_BYTE)
|
2016-09-28 14:40:37 +00:00
|
|
|
#else
|
|
|
|
# define HCL_OBJ_SIZE_MAX ((hcl_oow_t)HCL_TYPE_MAX(hcl_oow_t))
|
2019-05-04 17:56:45 +00:00
|
|
|
# define HCL_OBJ_SIZE_BITS_MAX (HCL_OBJ_SIZE_MAX * HCL_BITS_PER_BYTE)
|
2016-09-28 14:40:37 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(HCL_INCLUDE_COMPILER)
|
|
|
|
|
|
|
|
/* ========================================================================= */
|
|
|
|
/* SOURCE CODE I/O FOR COMPILER */
|
|
|
|
/* ========================================================================= */
|
2023-11-04 13:58:31 +00:00
|
|
|
enum hcl_tok_type_t
|
2018-02-26 15:24:45 +00:00
|
|
|
{
|
2023-11-07 10:19:06 +00:00
|
|
|
HCL_TOK_EOF,
|
|
|
|
HCL_TOK_CHARLIT,
|
|
|
|
HCL_TOK_STRLIT,
|
|
|
|
HCL_TOK_NUMLIT,
|
|
|
|
HCL_TOK_RADNUMLIT,
|
|
|
|
HCL_TOK_FPDECLIT,
|
|
|
|
HCL_TOK_SMPTRLIT,
|
|
|
|
HCL_TOK_ERRLIT,
|
|
|
|
HCL_TOK_NIL,
|
|
|
|
HCL_TOK_TRUE,
|
|
|
|
HCL_TOK_FALSE,
|
|
|
|
HCL_TOK_SELF,
|
|
|
|
HCL_TOK_SUPER,
|
|
|
|
|
|
|
|
HCL_TOK_IDENT,
|
|
|
|
HCL_TOK_IDENT_DOTTED,
|
|
|
|
HCL_TOK_DOT, /* . */
|
|
|
|
HCL_TOK_DBLDOTS, /* .. */
|
|
|
|
HCL_TOK_ELLIPSIS, /* ... */
|
|
|
|
HCL_TOK_COLON, /* : */
|
|
|
|
HCL_TOK_DBLCOLONS, /* :: */
|
|
|
|
HCL_TOK_TRPCOLONS, /* ::: */
|
|
|
|
HCL_TOK_DCSTAR, /* ::* */
|
2023-11-07 10:47:37 +00:00
|
|
|
HCL_TOK_SEMICOLON, /* ; */
|
2023-11-07 10:19:06 +00:00
|
|
|
HCL_TOK_COMMA, /* , */
|
|
|
|
HCL_TOK_LPAREN, /* ( */
|
|
|
|
HCL_TOK_RPAREN, /* ) */
|
|
|
|
HCL_TOK_LPARCOLON, /* (: */
|
|
|
|
HCL_TOK_BAPAREN, /* #[ - byte array parenthesis */
|
|
|
|
HCL_TOK_QLPAREN, /* #( - quoted-list parenthesis */
|
|
|
|
HCL_TOK_DLPAREN, /* #{ - dictionary parenthese */
|
|
|
|
HCL_TOK_LBRACK, /* [ - array */
|
|
|
|
HCL_TOK_RBRACK, /* ] */
|
|
|
|
HCL_TOK_LBRACE, /* { - block */
|
|
|
|
HCL_TOK_RBRACE, /* } */
|
|
|
|
HCL_TOK_VBAR, /* | */
|
|
|
|
HCL_TOK_EOL, /* end of line */
|
|
|
|
|
|
|
|
HCL_TOK_INCLUDE,
|
|
|
|
HCL_TOK_PRAGMA
|
2018-02-26 15:24:45 +00:00
|
|
|
};
|
2023-11-04 13:58:31 +00:00
|
|
|
typedef enum hcl_tok_type_t hcl_tok_type_t;
|
2018-02-26 15:24:45 +00:00
|
|
|
|
2023-11-04 13:58:31 +00:00
|
|
|
typedef struct hcl_tok_t hcl_tok_t;
|
|
|
|
struct hcl_tok_t
|
2016-09-28 14:40:37 +00:00
|
|
|
{
|
2023-11-04 13:58:31 +00:00
|
|
|
hcl_tok_type_t type;
|
2016-09-28 14:40:37 +00:00
|
|
|
hcl_oocs_t name;
|
|
|
|
hcl_oow_t name_capa;
|
2023-11-04 13:58:31 +00:00
|
|
|
hcl_loc_t loc;
|
2016-09-28 14:40:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2023-11-04 13:58:31 +00:00
|
|
|
typedef struct hcl_link_t hcl_link_t;
|
|
|
|
struct hcl_link_t
|
2016-09-28 14:40:37 +00:00
|
|
|
{
|
2023-11-04 13:58:31 +00:00
|
|
|
hcl_link_t* link;
|
2016-09-28 14:40:37 +00:00
|
|
|
};
|
|
|
|
|
2021-01-03 17:58:57 +00:00
|
|
|
enum hcl_cnode_type_t
|
|
|
|
{
|
|
|
|
HCL_CNODE_CHARLIT,
|
2021-01-12 09:06:25 +00:00
|
|
|
HCL_CNODE_SYMBOL,
|
2021-01-17 17:45:39 +00:00
|
|
|
HCL_CNODE_DSYMBOL, /* dotted symbol */
|
2021-01-03 17:58:57 +00:00
|
|
|
HCL_CNODE_STRLIT,
|
|
|
|
HCL_CNODE_NUMLIT,
|
|
|
|
HCL_CNODE_RADNUMLIT,
|
|
|
|
HCL_CNODE_FPDECLIT,
|
|
|
|
HCL_CNODE_SMPTRLIT,
|
2021-01-06 09:37:29 +00:00
|
|
|
HCL_CNODE_ERRLIT,
|
2021-01-03 17:58:57 +00:00
|
|
|
HCL_CNODE_NIL,
|
|
|
|
HCL_CNODE_TRUE,
|
|
|
|
HCL_CNODE_FALSE,
|
2022-02-05 17:35:10 +00:00
|
|
|
HCL_CNODE_SELF,
|
2022-02-18 16:32:19 +00:00
|
|
|
HCL_CNODE_SUPER,
|
2021-05-07 08:53:01 +00:00
|
|
|
HCL_CNODE_ELLIPSIS,
|
2021-05-09 15:32:54 +00:00
|
|
|
HCL_CNODE_TRPCOLONS,
|
2022-02-24 16:47:26 +00:00
|
|
|
HCL_CNODE_DCSTAR,
|
2021-01-03 17:58:57 +00:00
|
|
|
|
2021-01-13 09:54:44 +00:00
|
|
|
HCL_CNODE_CONS,
|
2021-01-25 15:23:24 +00:00
|
|
|
HCL_CNODE_ELIST, /* empty list */
|
|
|
|
HCL_CNODE_SHELL /* pseudo-node to hold another actual node */
|
2021-01-03 17:58:57 +00:00
|
|
|
};
|
|
|
|
typedef enum hcl_cnode_type_t hcl_cnode_type_t;
|
|
|
|
|
2021-01-19 14:07:42 +00:00
|
|
|
#define HCL_CNODE_GET_TYPE(x) ((x)->cn_type)
|
|
|
|
#define HCL_CNODE_GET_LOC(x) (&(x)->cn_loc)
|
|
|
|
#define HCL_CNODE_GET_TOK(x) (&(x)->cn_tok)
|
|
|
|
#define HCL_CNODE_GET_TOKPTR(x) ((x)->cn_tok.ptr)
|
|
|
|
#define HCL_CNODE_GET_TOKLEN(x) ((x)->cn_tok.len)
|
|
|
|
|
2021-05-07 08:53:01 +00:00
|
|
|
#define HCL_CNODE_IS_ELLIPSIS(x) ((x)->cn_type == HCL_CNODE_ELLIPSIS)
|
2021-05-09 15:32:54 +00:00
|
|
|
#define HCL_CNODE_IS_TRPCOLONS(x) ((x)->cn_type == HCL_CNODE_TRPCOLONS)
|
2022-02-24 16:47:26 +00:00
|
|
|
#define HCL_CNODE_IS_DCSTAR(x) ((x)->cn_type == HCL_CNODE_DCSTAR)
|
2021-05-07 08:53:01 +00:00
|
|
|
|
2021-01-19 14:07:42 +00:00
|
|
|
#define HCL_CNODE_IS_SYMBOL(x) ((x)->cn_type == HCL_CNODE_SYMBOL)
|
2021-06-27 17:47:51 +00:00
|
|
|
#define HCL_CNODE_IS_SYMBOL_PLAIN(x) ((x)->cn_type == HCL_CNODE_SYMBOL && (x)->u.symbol.syncode == 0)
|
2021-01-19 14:07:42 +00:00
|
|
|
#define HCL_CNODE_IS_SYMBOL_SYNCODED(x, code) ((x)->cn_type == HCL_CNODE_SYMBOL && (x)->u.symbol.syncode == (code))
|
|
|
|
#define HCL_CNODE_SYMBOL_SYNCODE(x) ((x)->u.symbol.syncode)
|
|
|
|
|
2021-01-22 15:07:47 +00:00
|
|
|
#define HCL_CNODE_IS_DSYMBOL(x) ((x)->cn_type == HCL_CNODE_DSYMBOL)
|
|
|
|
|
2021-01-19 14:07:42 +00:00
|
|
|
#define HCL_CNODE_IS_CONS(x) ((x)->cn_type == HCL_CNODE_CONS)
|
|
|
|
#define HCL_CNODE_IS_CONS_CONCODED(x, code) ((x)->cn_type == HCL_CNODE_CONS && (x)->u.cons.concode == (code))
|
|
|
|
#define HCL_CNODE_CONS_CONCODE(x) ((x)->u.cons.concode)
|
|
|
|
#define HCL_CNODE_CONS_CAR(x) ((x)->u.cons.car)
|
|
|
|
#define HCL_CNODE_CONS_CDR(x) ((x)->u.cons.cdr)
|
|
|
|
|
2021-01-25 15:23:24 +00:00
|
|
|
#define HCL_CNODE_IS_ELIST(x) ((x)->cn_type == HCL_CNODE_ELIST)
|
2021-02-01 13:20:46 +00:00
|
|
|
#define HCL_CNODE_IS_ELIST_CONCODED(x, code) ((x)->cn_type == HCL_CNODE_ELIST && (x)->u.elist.concode == (code))
|
2021-01-25 15:23:24 +00:00
|
|
|
#define HCL_CNODE_ELIST_CONCODE(x) ((x)->u.elist.concode)
|
2021-01-19 14:07:42 +00:00
|
|
|
|
2021-01-03 17:58:57 +00:00
|
|
|
/* NOTE: hcl_cnode_t used by the built-in compiler is not an OOP object */
|
|
|
|
struct hcl_cnode_t
|
|
|
|
{
|
2021-01-19 14:07:42 +00:00
|
|
|
hcl_cnode_type_t cn_type;
|
2023-11-04 13:58:31 +00:00
|
|
|
hcl_loc_t cn_loc;
|
2021-01-19 14:07:42 +00:00
|
|
|
hcl_oocs_t cn_tok;
|
2021-01-03 17:58:57 +00:00
|
|
|
|
|
|
|
union
|
|
|
|
{
|
2021-01-06 09:37:29 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_ooch_t v;
|
|
|
|
} charlit;
|
2021-01-17 17:45:39 +00:00
|
|
|
|
2021-01-19 14:07:42 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_syncode_t syncode; /* special if non-zero */
|
|
|
|
} symbol;
|
2021-01-17 17:45:39 +00:00
|
|
|
|
2021-01-09 16:53:35 +00:00
|
|
|
struct
|
2021-01-10 16:04:36 +00:00
|
|
|
{
|
|
|
|
hcl_oow_t v;
|
|
|
|
} smptrlit;
|
|
|
|
struct
|
2021-01-06 09:37:29 +00:00
|
|
|
{
|
|
|
|
hcl_ooi_t v;
|
|
|
|
} errlit;
|
2021-01-10 16:04:36 +00:00
|
|
|
struct
|
|
|
|
{
|
2021-01-19 14:07:42 +00:00
|
|
|
hcl_concode_t concode;
|
2021-01-10 16:04:36 +00:00
|
|
|
hcl_cnode_t* car;
|
|
|
|
hcl_cnode_t* cdr;
|
|
|
|
} cons;
|
2021-01-13 09:54:44 +00:00
|
|
|
struct
|
|
|
|
{
|
2021-01-19 14:07:42 +00:00
|
|
|
hcl_concode_t concode;
|
2021-01-25 15:23:24 +00:00
|
|
|
} elist;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_cnode_t* obj;
|
|
|
|
} shell;
|
2021-01-03 17:58:57 +00:00
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
2021-11-23 14:42:20 +00:00
|
|
|
struct hcl_var_info_t
|
|
|
|
{
|
|
|
|
int type;
|
|
|
|
/* ctx_offset 0 means the current context.
|
|
|
|
* 1 means current->home.
|
2023-10-23 09:49:15 +00:00
|
|
|
* 2 means current->home->home.
|
2021-11-23 14:42:20 +00:00
|
|
|
* index_in_ctx is a relative index within the context found.
|
|
|
|
*/
|
|
|
|
hcl_oow_t ctx_offset; /* context offset */
|
|
|
|
hcl_oow_t index_in_ctx; /* index in the current scope */
|
|
|
|
};
|
|
|
|
typedef struct hcl_var_info_t hcl_var_info_t;
|
|
|
|
|
|
|
|
|
2016-09-28 14:40:37 +00:00
|
|
|
/* NOTE: hcl_cframe_t used by the built-in compiler is not an OOP object */
|
|
|
|
struct hcl_cframe_t
|
2021-01-17 17:45:39 +00:00
|
|
|
{
|
|
|
|
int opcode;
|
|
|
|
hcl_cnode_t* operand;
|
|
|
|
|
|
|
|
union
|
|
|
|
{
|
2021-05-15 05:31:36 +00:00
|
|
|
/* COP_COMPILE_OBJECT_R */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_ooi_t nrets;
|
|
|
|
} obj_r;
|
|
|
|
|
2021-01-28 08:17:50 +00:00
|
|
|
/* COP_EMIT_CALL */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_ooi_t index;
|
2021-05-15 05:31:36 +00:00
|
|
|
hcl_ooi_t nrets;
|
2021-01-28 08:17:50 +00:00
|
|
|
} call;
|
|
|
|
|
2022-01-22 15:40:38 +00:00
|
|
|
/* COP_EMIT_SEND_MESSAGE */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_ooi_t nargs;
|
|
|
|
hcl_ooi_t nrets;
|
2022-02-19 17:26:26 +00:00
|
|
|
int to_super;
|
2022-01-22 15:40:38 +00:00
|
|
|
} sendmsg;
|
|
|
|
|
2021-01-28 08:17:50 +00:00
|
|
|
/* COP_EMIT_SET */
|
2021-01-17 17:45:39 +00:00
|
|
|
struct
|
|
|
|
{
|
2021-11-23 15:52:01 +00:00
|
|
|
int mode; /* VAR_ACCESS_STORE or VAR_ACCESS_POP */
|
2021-11-23 14:42:20 +00:00
|
|
|
hcl_var_info_t vi;
|
2021-01-17 17:45:39 +00:00
|
|
|
} set;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_ooi_t cond_pos;
|
|
|
|
hcl_ooi_t body_pos;
|
2021-01-28 10:09:38 +00:00
|
|
|
hcl_ooi_t jump_inst_pos;
|
2023-11-04 13:58:31 +00:00
|
|
|
hcl_loc_t start_loc;
|
2021-01-17 17:45:39 +00:00
|
|
|
} post_while;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_ooi_t body_pos;
|
2021-01-28 08:17:50 +00:00
|
|
|
hcl_ooi_t jump_inst_pos;
|
2023-11-04 13:58:31 +00:00
|
|
|
hcl_loc_t start_loc;
|
2023-11-13 15:31:50 +00:00
|
|
|
hcl_cnode_t* cmd_cnode;
|
2021-01-17 17:45:39 +00:00
|
|
|
} post_if;
|
|
|
|
|
2021-01-28 10:09:38 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_ooi_t jump_inst_pos;
|
|
|
|
} post_and;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_ooi_t jump_inst_pos;
|
|
|
|
} post_or;
|
|
|
|
|
2021-04-22 09:35:26 +00:00
|
|
|
/* COP_POST_TRY */
|
2021-02-22 09:20:45 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_oow_t jump_inst_pos;
|
2021-04-22 09:35:26 +00:00
|
|
|
} post_try;
|
|
|
|
|
|
|
|
/* COP_POST_CATCH */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_oow_t jump_inst_pos;
|
|
|
|
hcl_oow_t exarg_offset;
|
|
|
|
} post_catch;
|
2021-02-22 09:20:45 +00:00
|
|
|
|
2022-05-03 14:43:12 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_oow_t lvar_start;
|
|
|
|
hcl_oow_t lvar_end;
|
|
|
|
} post_do;
|
|
|
|
|
2021-01-28 07:25:05 +00:00
|
|
|
/* COP_COMPILE_ARRAY_LIST, COP_POP_INTO_ARRAY, COP_EMIT_MAKE_ARRAY */
|
2021-01-17 17:45:39 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_ooi_t index;
|
|
|
|
} array_list;
|
|
|
|
|
2021-01-28 07:25:05 +00:00
|
|
|
/* COP_COMPILE_BYTEARRAY_LIST, COP_POP_INTO_BYTEARRAY, COP_EMIT_MAKE_BYTEARRAY */
|
2021-01-17 17:45:39 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_ooi_t index;
|
|
|
|
} bytearray_list;
|
|
|
|
|
2021-01-28 07:25:05 +00:00
|
|
|
/* COP_EMIT_MAKE_DIC */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_ooi_t index;
|
|
|
|
} dic_list;
|
|
|
|
|
2022-02-13 02:39:37 +00:00
|
|
|
/* COP_POST_LAMBDA, COP_EMIT_LAMBDA */
|
2021-01-17 17:45:39 +00:00
|
|
|
struct
|
|
|
|
{
|
2022-02-24 16:47:26 +00:00
|
|
|
int fun_type;
|
2021-01-27 08:47:08 +00:00
|
|
|
hcl_oow_t jump_inst_pos;
|
2021-01-17 17:45:39 +00:00
|
|
|
hcl_ooi_t lfbase_pos;
|
|
|
|
hcl_ooi_t lfsize_pos;
|
|
|
|
} lambda;
|
2021-01-27 08:47:08 +00:00
|
|
|
|
2021-01-27 16:01:36 +00:00
|
|
|
/* COP_EMIT_RETURN */
|
2021-01-27 08:47:08 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
int from_home;
|
|
|
|
} _return;
|
2021-01-29 08:13:18 +00:00
|
|
|
|
2021-02-01 13:20:46 +00:00
|
|
|
/* COP_POST_BREAK */
|
2021-01-29 08:13:18 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_ooi_t jump_inst_pos;
|
|
|
|
} _break;
|
2021-06-25 15:19:11 +00:00
|
|
|
|
|
|
|
/* COP_COMPILE_CLASS_P1, COP_COMPILE_CLASS_P2 */
|
2023-10-23 09:49:15 +00:00
|
|
|
struct
|
2021-06-25 15:19:11 +00:00
|
|
|
{
|
|
|
|
hcl_ooi_t nsuperclasses;
|
2023-11-04 13:58:31 +00:00
|
|
|
hcl_loc_t start_loc;
|
2021-06-25 15:19:11 +00:00
|
|
|
} _class;
|
2021-01-17 17:45:39 +00:00
|
|
|
} u;
|
|
|
|
};
|
2021-01-29 09:41:39 +00:00
|
|
|
typedef struct hcl_cframe_t hcl_cframe_t;
|
2021-01-17 17:45:39 +00:00
|
|
|
|
2021-04-09 01:23:08 +00:00
|
|
|
enum hcl_cblk_type_t
|
|
|
|
{
|
|
|
|
HCL_CBLK_TYPE_LOOP,
|
2021-06-19 17:19:24 +00:00
|
|
|
HCL_CBLK_TYPE_TRY,
|
|
|
|
HCL_CBLK_TYPE_CLASS
|
2021-04-09 01:23:08 +00:00
|
|
|
};
|
|
|
|
typedef enum hcl_cblk_type_t hcl_cblk_type_t;
|
|
|
|
|
2021-06-07 01:11:17 +00:00
|
|
|
/* control block information for the compiler */
|
2021-04-09 01:23:08 +00:00
|
|
|
struct hcl_cblk_info_t
|
|
|
|
{
|
|
|
|
hcl_cblk_type_t _type;
|
|
|
|
};
|
|
|
|
typedef struct hcl_cblk_info_t hcl_cblk_info_t;
|
|
|
|
|
2021-06-07 01:11:17 +00:00
|
|
|
/* function block information for the compiler */
|
2021-04-09 01:23:08 +00:00
|
|
|
struct hcl_fnblk_info_t
|
2020-09-28 15:44:04 +00:00
|
|
|
{
|
2022-02-24 16:47:26 +00:00
|
|
|
int fun_type;
|
|
|
|
|
2021-06-02 16:28:34 +00:00
|
|
|
hcl_oow_t tmprlen; /* accumulated length of the temporaries string including outer blocks */
|
|
|
|
hcl_oow_t tmprcnt; /* accumulated number of temporaries including outer blocks */
|
|
|
|
|
|
|
|
hcl_oow_t tmpr_va; /* 0 or 1 */
|
|
|
|
hcl_oow_t tmpr_nargs; /* number of fixed arguments */
|
|
|
|
hcl_oow_t tmpr_nrvars; /* number of return variables */
|
|
|
|
hcl_oow_t tmpr_nlvars; /* number of local variables */
|
|
|
|
|
2021-04-22 09:35:26 +00:00
|
|
|
hcl_oow_t make_inst_pos;
|
2020-10-05 09:37:26 +00:00
|
|
|
hcl_oow_t lfbase;
|
2021-04-09 01:23:08 +00:00
|
|
|
|
2021-04-09 08:22:40 +00:00
|
|
|
hcl_ooi_t cblk_base;
|
2021-05-09 15:32:54 +00:00
|
|
|
|
2021-06-18 18:54:50 +00:00
|
|
|
hcl_ooi_t clsblk_base;
|
|
|
|
hcl_ooi_t clsblk_top;
|
|
|
|
|
2021-05-09 15:32:54 +00:00
|
|
|
unsigned int access_outer: 1;
|
|
|
|
unsigned int accessed_by_inner: 1;
|
2020-09-28 15:44:04 +00:00
|
|
|
};
|
2021-04-09 01:23:08 +00:00
|
|
|
typedef struct hcl_fnblk_info_t hcl_fnblk_info_t;
|
2020-09-28 15:44:04 +00:00
|
|
|
|
2021-06-07 01:11:17 +00:00
|
|
|
/* class block information for the compiler */
|
|
|
|
|
|
|
|
struct hcl_clsblk_info_t
|
|
|
|
{
|
|
|
|
hcl_oow_t nivars;
|
|
|
|
hcl_oow_t ncvars;
|
2021-06-27 17:47:51 +00:00
|
|
|
hcl_ooch_t* ivars_str;
|
|
|
|
hcl_ooch_t* cvars_str;
|
2021-06-07 01:11:17 +00:00
|
|
|
hcl_oow_t spec; /* TODO: byte indexed, word indexed? */
|
|
|
|
|
|
|
|
hcl_ooi_t fnblk_base;
|
2021-12-24 00:05:58 +00:00
|
|
|
hcl_ooi_t class_start_inst_pos; /* the position of the first instruction in the class body after CLASS_ENTER */
|
2021-06-07 01:11:17 +00:00
|
|
|
};
|
|
|
|
typedef struct hcl_clsblk_info_t hcl_clsblk_info_t;
|
|
|
|
|
|
|
|
|
|
|
|
/* reader stack for list reading */
|
2021-01-13 09:54:44 +00:00
|
|
|
typedef struct hcl_rstl_t hcl_rstl_t;
|
2023-10-23 09:49:15 +00:00
|
|
|
struct hcl_rstl_t
|
2021-01-13 09:54:44 +00:00
|
|
|
{
|
|
|
|
hcl_cnode_t* head;
|
|
|
|
hcl_cnode_t* tail;
|
2023-11-04 13:58:31 +00:00
|
|
|
hcl_loc_t loc;
|
2021-01-13 09:54:44 +00:00
|
|
|
int flagv;
|
|
|
|
hcl_oow_t count;
|
|
|
|
hcl_rstl_t* prev;
|
|
|
|
};
|
|
|
|
|
2022-07-22 08:02:14 +00:00
|
|
|
typedef struct hcl_flx_dt_t hcl_flx_dt_t; /* delemiter token */
|
|
|
|
struct hcl_flx_dt_t
|
2022-05-25 14:23:43 +00:00
|
|
|
{
|
|
|
|
int row_start;
|
|
|
|
int row_end;
|
|
|
|
int col_next;
|
|
|
|
};
|
|
|
|
|
2022-07-23 06:57:01 +00:00
|
|
|
|
|
|
|
typedef struct hcl_flx_hc_t hcl_flx_hc_t; /* hash-marked character like #\, #\newline */
|
|
|
|
struct hcl_flx_hc_t
|
|
|
|
{
|
|
|
|
/* state data */
|
|
|
|
hcl_oow_t char_count;
|
|
|
|
};
|
|
|
|
|
2022-07-23 10:09:36 +00:00
|
|
|
typedef struct hcl_flx_hi_t hcl_flx_hi_t; /* hash-marked identifier */
|
|
|
|
struct hcl_flx_hi_t
|
|
|
|
{
|
|
|
|
/* state data */
|
|
|
|
hcl_oow_t char_count;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct hcl_flx_hn_t hcl_flx_hn_t; /* hash-marked number - radixed number */
|
|
|
|
struct hcl_flx_hn_t
|
2022-07-23 06:57:01 +00:00
|
|
|
{
|
|
|
|
/* input data */
|
2023-11-04 13:58:31 +00:00
|
|
|
hcl_tok_type_t tok_type;
|
2022-07-23 06:57:01 +00:00
|
|
|
hcl_synerrnum_t synerr_code;
|
|
|
|
int radix;
|
|
|
|
|
|
|
|
/* state data */
|
|
|
|
hcl_oow_t digit_count;
|
2022-07-24 00:49:03 +00:00
|
|
|
hcl_oow_t invalid_digit_count;
|
2022-07-23 06:57:01 +00:00
|
|
|
};
|
|
|
|
|
2022-07-26 00:06:29 +00:00
|
|
|
typedef struct hcl_flx_pi_t hcl_flx_pi_t;
|
|
|
|
struct hcl_flx_pi_t
|
|
|
|
{
|
|
|
|
/* state data */
|
|
|
|
hcl_oow_t char_count;
|
|
|
|
hcl_oow_t seg_count;
|
|
|
|
hcl_oow_t seg_len;
|
|
|
|
hcl_oow_t non_ident_seg_count;
|
2023-11-04 13:58:31 +00:00
|
|
|
hcl_tok_type_t last_non_ident_type;
|
2022-07-26 00:06:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct hcl_flx_pn_t hcl_flx_pn_t;
|
|
|
|
struct hcl_flx_pn_t
|
|
|
|
{
|
|
|
|
/* state data */
|
|
|
|
int fpdec;
|
|
|
|
hcl_oow_t digit_count[2];
|
|
|
|
};
|
|
|
|
|
2022-07-22 08:02:14 +00:00
|
|
|
typedef struct hcl_flx_qt_t hcl_flx_qt_t; /* quoted token */
|
|
|
|
struct hcl_flx_qt_t
|
2022-05-25 14:23:43 +00:00
|
|
|
{
|
2022-07-22 08:02:14 +00:00
|
|
|
/* input data */
|
2023-11-04 13:58:31 +00:00
|
|
|
hcl_tok_type_t tok_type;
|
2022-07-23 06:57:01 +00:00
|
|
|
hcl_synerrnum_t synerr_code;
|
2022-07-22 08:02:14 +00:00
|
|
|
hcl_ooch_t end_char;
|
|
|
|
hcl_ooch_t esc_char;
|
|
|
|
hcl_oow_t min_len;
|
|
|
|
hcl_oow_t max_len;
|
|
|
|
int regex;
|
|
|
|
|
|
|
|
/* state data */
|
|
|
|
int escaped;
|
|
|
|
int digit_count;
|
|
|
|
hcl_ooci_t c_acc;
|
2022-05-25 14:23:43 +00:00
|
|
|
};
|
2022-07-22 08:02:14 +00:00
|
|
|
|
2022-07-26 00:06:29 +00:00
|
|
|
typedef struct hcl_flx_st_t hcl_flx_st_t;
|
|
|
|
struct hcl_flx_st_t
|
|
|
|
{
|
|
|
|
/* input data */
|
|
|
|
hcl_ooch_t sign_c;
|
|
|
|
|
|
|
|
/* state data */
|
|
|
|
hcl_oow_t char_count;
|
|
|
|
int hmarked;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2022-07-22 08:02:14 +00:00
|
|
|
enum hcl_flx_state_t
|
|
|
|
{
|
|
|
|
HCL_FLX_START,
|
|
|
|
HCL_FLX_COMMENT,
|
2022-07-23 06:57:01 +00:00
|
|
|
HCL_FLX_DELIM_TOKEN,
|
2022-07-26 00:06:29 +00:00
|
|
|
HCL_FLX_HMARKED_TOKEN, /* hash-marked token */
|
|
|
|
HCL_FLX_HMARKED_CHAR, /* hash-marked character that begins with #\ */
|
|
|
|
HCL_FLX_HMARKED_IDENT, /* hash-marked identifier like #include, etc */
|
2022-07-23 14:06:46 +00:00
|
|
|
HCL_FLX_HMARKED_NUMBER, /* hash-marked number - radixed number like #xABCD */
|
2022-07-26 00:06:29 +00:00
|
|
|
HCL_FLX_PLAIN_IDENT, /* plain identifier */
|
|
|
|
HCL_FLX_PLAIN_NUMBER, /* plain number */
|
|
|
|
HCL_FLX_QUOTED_TOKEN, /* string, character */
|
|
|
|
HCL_FLX_SIGNED_TOKEN /* prefixed with + or - */
|
2022-07-22 08:02:14 +00:00
|
|
|
};
|
|
|
|
typedef enum hcl_flx_state_t hcl_flx_state_t;
|
2022-05-25 14:23:43 +00:00
|
|
|
|
2022-07-26 15:06:53 +00:00
|
|
|
typedef struct hcl_frd_t hcl_frd_t;
|
|
|
|
struct hcl_frd_t
|
|
|
|
{
|
|
|
|
int level;
|
|
|
|
int flagv;
|
2022-07-28 14:07:18 +00:00
|
|
|
int expect_include_file;
|
2022-07-30 03:02:57 +00:00
|
|
|
int expect_vlist_item;
|
2022-07-28 14:20:28 +00:00
|
|
|
int do_include_file;
|
2022-07-26 15:06:53 +00:00
|
|
|
hcl_cnode_t* obj;
|
2023-11-12 12:54:17 +00:00
|
|
|
hcl_loc_t list_loc;
|
2022-07-26 15:06:53 +00:00
|
|
|
};
|
|
|
|
|
2016-09-28 14:40:37 +00:00
|
|
|
struct hcl_compiler_t
|
|
|
|
{
|
2023-11-09 15:03:03 +00:00
|
|
|
/* flags passed in via hcl_compile() */
|
|
|
|
int flags;
|
|
|
|
|
2023-05-18 01:24:01 +00:00
|
|
|
/* callback pointer registerd upon compiler creation */
|
|
|
|
hcl_cb_t* cbp;
|
2016-09-28 14:40:37 +00:00
|
|
|
|
|
|
|
/* input handler */
|
2023-11-05 13:31:33 +00:00
|
|
|
hcl_io_impl_t cci_rdr;
|
2016-09-28 14:40:37 +00:00
|
|
|
|
|
|
|
/* static input data buffer */
|
2023-11-05 13:31:33 +00:00
|
|
|
hcl_io_cciarg_t cci_arg;
|
2016-09-28 14:40:37 +00:00
|
|
|
|
|
|
|
/* pointer to the current input data. initially, it points to &inarg */
|
2023-11-05 13:31:33 +00:00
|
|
|
hcl_io_cciarg_t* curinp;
|
2016-09-28 14:40:37 +00:00
|
|
|
|
|
|
|
/* information about the last meaningful character read.
|
|
|
|
* this is a copy of curinp->lxc if no ungetting is performed.
|
|
|
|
* if there is something in the unget buffer, this is overwritten
|
|
|
|
* by a value from the buffer when the request to read a character
|
|
|
|
* is served */
|
2023-11-04 13:58:31 +00:00
|
|
|
hcl_lxc_t lxc;
|
2016-09-28 14:40:37 +00:00
|
|
|
|
|
|
|
/* unget buffer */
|
2023-11-04 13:58:31 +00:00
|
|
|
hcl_lxc_t ungot[10];
|
2023-11-04 14:13:52 +00:00
|
|
|
int nungots;
|
2016-09-28 14:40:37 +00:00
|
|
|
|
|
|
|
/* the last token read */
|
2023-11-04 14:13:52 +00:00
|
|
|
hcl_tok_t tok;
|
2023-11-04 13:58:31 +00:00
|
|
|
hcl_link_t* sr_names;
|
2016-09-28 14:40:37 +00:00
|
|
|
|
|
|
|
hcl_synerr_t synerr;
|
|
|
|
|
|
|
|
/* temporary space to handle an illegal character */
|
|
|
|
hcl_ooch_t ilchr;
|
|
|
|
hcl_oocs_t ilchr_ucs;
|
|
|
|
|
|
|
|
/* == READER == */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_oop_t s; /* stack for reading */
|
|
|
|
hcl_oop_t e; /* last object read */
|
2021-01-13 09:54:44 +00:00
|
|
|
hcl_rstl_t* st;
|
2016-09-28 14:40:37 +00:00
|
|
|
} r; /* reading */
|
|
|
|
/* == END READER == */
|
|
|
|
|
2022-05-25 14:23:43 +00:00
|
|
|
struct
|
|
|
|
{
|
2023-11-03 09:04:46 +00:00
|
|
|
#if defined(HCL_OOCH_IS_UCH)
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_bch_t buf[HCL_BCSIZE_MAX];
|
|
|
|
hcl_oow_t len;
|
|
|
|
int no_check;
|
|
|
|
} rsd; /* residue - incomplete sequence at the end of the last data fed by hcl_feedbchars() */
|
|
|
|
#endif
|
|
|
|
|
2022-05-25 14:23:43 +00:00
|
|
|
struct
|
|
|
|
{
|
2022-07-22 08:02:14 +00:00
|
|
|
hcl_flx_state_t state;
|
2023-11-04 13:58:31 +00:00
|
|
|
hcl_loc_t loc;
|
|
|
|
hcl_loc_t _oloc;
|
2022-07-22 08:02:14 +00:00
|
|
|
|
2023-10-23 09:49:15 +00:00
|
|
|
union
|
2022-07-22 08:02:14 +00:00
|
|
|
{
|
|
|
|
hcl_flx_dt_t dt; /* delimiter token */
|
2022-07-23 06:57:01 +00:00
|
|
|
hcl_flx_hc_t hc; /* hash-marked character */
|
2022-07-23 10:09:36 +00:00
|
|
|
hcl_flx_hi_t hi; /* hash-marked identifier */
|
|
|
|
hcl_flx_hn_t hn; /* hash-marked number - radixed number */
|
2022-07-26 00:06:29 +00:00
|
|
|
hcl_flx_pi_t pi; /* plain identifier */
|
|
|
|
hcl_flx_pn_t pn; /* plain number */
|
2022-07-22 08:02:14 +00:00
|
|
|
hcl_flx_qt_t qt; /* quoted token */
|
2022-07-26 00:06:29 +00:00
|
|
|
hcl_flx_st_t st; /* signed token */
|
2022-07-22 08:02:14 +00:00
|
|
|
} u;
|
2022-05-25 14:23:43 +00:00
|
|
|
} lx;
|
|
|
|
|
2022-07-26 15:06:53 +00:00
|
|
|
struct hcl_frd_t rd;
|
2022-07-29 11:29:47 +00:00
|
|
|
hcl_on_cnode_t on_cnode;
|
2022-05-25 14:23:43 +00:00
|
|
|
} feed;
|
|
|
|
|
2016-09-28 14:40:37 +00:00
|
|
|
/* == COMPILER STACK == */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_cframe_t* ptr;
|
|
|
|
hcl_ooi_t top;
|
|
|
|
hcl_oow_t capa;
|
|
|
|
} cfs;
|
|
|
|
/* == END COMPILER STACK == */
|
2016-09-29 13:20:09 +00:00
|
|
|
|
2021-01-21 14:59:01 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_oocs_t s; /* buffer */
|
|
|
|
hcl_oow_t capa; /* bufer capacity */
|
|
|
|
hcl_oow_t wcount; /* word count */
|
2021-02-01 13:20:46 +00:00
|
|
|
} tv; /* temporary variables including arguments */
|
2021-01-17 17:45:39 +00:00
|
|
|
|
2016-09-29 13:20:09 +00:00
|
|
|
struct
|
|
|
|
{
|
2021-04-09 01:23:08 +00:00
|
|
|
hcl_ooi_t depth; /* signed because it starts with -1 */
|
|
|
|
hcl_cblk_info_t* info;
|
|
|
|
hcl_oow_t info_capa;
|
|
|
|
} cblk; /* control block - loop, try-catch */
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_ooi_t depth; /* signed because it starts with -1 */
|
|
|
|
hcl_fnblk_info_t* info;
|
2020-09-28 15:44:04 +00:00
|
|
|
hcl_oow_t info_capa;
|
2021-04-09 01:23:08 +00:00
|
|
|
} fnblk; /* lambda/function block */
|
2021-06-07 01:11:17 +00:00
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_ooi_t depth; /* signed because it starts with -1 */
|
|
|
|
hcl_clsblk_info_t* info;
|
|
|
|
hcl_oow_t info_capa;
|
|
|
|
} clsblk; /* class block */
|
2023-11-12 12:54:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
hcl_cnode_t cons_to_nil;
|
|
|
|
hcl_cnode_t nil;
|
|
|
|
} fake_cnode;
|
2016-09-28 14:40:37 +00:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2021-05-04 09:48:19 +00:00
|
|
|
|
2023-11-09 15:03:03 +00:00
|
|
|
/* hcl_context_t, hcl_lambda_t, hcl_function_t stores the local variable information
|
2023-10-23 09:49:15 +00:00
|
|
|
*
|
2021-05-04 09:48:19 +00:00
|
|
|
* Use up to 29 bits in a 32-bit hcl_ooi_t. Exclude the tag bit and the sign bit.
|
2022-03-19 07:32:51 +00:00
|
|
|
* | SIGN | INSTA | VA | NARGS | NRVARS | NLVARS | TAG |
|
|
|
|
* 1 1 8 8 11 2 <= 32
|
2021-05-04 09:48:19 +00:00
|
|
|
* -----------------------------------------------------------
|
2023-11-09 15:03:03 +00:00
|
|
|
* Parameters to the MAKE_LAMBDA or MAKE_FUNCTION instructions
|
2023-10-23 09:49:15 +00:00
|
|
|
* | INSTA | VA | NARGS | NRVARS | NLVARS
|
2022-03-19 07:32:51 +00:00
|
|
|
* 1 1 4 4 6 <= 16 (HCL_CODE_LONG_PARAM_SIZE 1, two params)
|
|
|
|
* 1 1 8 8 11 <= 32 (HCL_CODE_LONG_PARAM_SIZE 2, two params, use 29 bits to avoid collection when converted to a smooi)
|
2021-05-11 15:04:53 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* NARGS and NRVARS are also used for the CALL and CALL2 instructions.
|
|
|
|
* CALL encodes NARGS in one parameter.
|
|
|
|
* CALLR encodes NARGS in one parameter and NRVARS in another parameter.
|
2023-10-23 09:49:15 +00:00
|
|
|
* NARGS and NRVARS must not exceed a single parameter size.
|
2021-05-04 09:48:19 +00:00
|
|
|
*/
|
2023-10-23 09:49:15 +00:00
|
|
|
|
2021-01-29 12:39:31 +00:00
|
|
|
#if defined(HCL_CODE_LONG_PARAM_SIZE) && (HCL_CODE_LONG_PARAM_SIZE == 1)
|
2021-05-11 15:04:53 +00:00
|
|
|
|
2022-03-17 13:22:17 +00:00
|
|
|
# define MAX_CODE_NBLKARGS (0xFu) /* 15 - 4 bits*/
|
|
|
|
# define MAX_CODE_NBLKRVARS (0xFu) /* 15 - 4 bits*/
|
|
|
|
# define MAX_CODE_NBLKLVARS (0x3Fu) /* 63 - 6 bits */
|
|
|
|
|
|
|
|
# define ENCODE_BLK_MASK(insta,va,nargs,nrvars,nlvars) \
|
|
|
|
((((insta) & 0x1) << 15) | (((va) & 0x1) << 14) | (((nargs) & 0xF) << 10) | (((nrvars) & 0xF) << 6) | (((nlvars) & 0x3FF)))
|
|
|
|
# define GET_BLK_MASK_INSTA(x) (((x) >> 15) & 0x1)
|
|
|
|
# define GET_BLK_MASK_VA(x) (((x) >> 14) & 0x1)
|
|
|
|
# define GET_BLK_MASK_NARGS(x) (((x) >> 10) & 0xF)
|
|
|
|
# define GET_BLK_MASK_NRVARS(x) (((x) >> 6) & 0xF)
|
|
|
|
# define GET_BLK_MASK_NLVARS(x) ((x) & 0x3F)
|
2021-05-04 09:48:19 +00:00
|
|
|
|
2016-09-28 14:40:37 +00:00
|
|
|
# define MAX_CODE_JUMP (0xFFu)
|
|
|
|
# define MAX_CODE_PARAM (0xFFu)
|
2022-03-17 13:22:17 +00:00
|
|
|
# define MAX_CODE_PARAM2 (0xFFFFu) /* 16 bits */
|
2021-01-29 12:39:31 +00:00
|
|
|
#elif defined(HCL_CODE_LONG_PARAM_SIZE) && (HCL_CODE_LONG_PARAM_SIZE == 2)
|
2021-05-11 15:04:53 +00:00
|
|
|
|
2022-03-17 13:22:17 +00:00
|
|
|
# define MAX_CODE_NBLKARGS (0xFFu) /* 255, 8 bits */
|
|
|
|
# define MAX_CODE_NBLKRVARS (0xFFu) /* 255, 8 bits */
|
2022-03-19 07:32:51 +00:00
|
|
|
# define MAX_CODE_NBLKLVARS (0x7FFu) /* 2047, 11 bits */
|
2022-03-17 13:22:17 +00:00
|
|
|
# define ENCODE_BLK_MASK(insta,va,nargs,nrvars,nlvars) \
|
2022-03-19 07:32:51 +00:00
|
|
|
((((insta) & 0x1) << 28) | (((va) & 0x1) << 27) | (((nargs) & 0xFF) << 19) | (((nrvars) & 0xFF) << 11) | (((nlvars) & 0x7FF)))
|
|
|
|
# define GET_BLK_MASK_INSTA(x) (((x) >> 28) & 0x1)
|
|
|
|
# define GET_BLK_MASK_VA(x) (((x) >> 27) & 0x1)
|
|
|
|
# define GET_BLK_MASK_NARGS(x) (((x) >> 19) & 0xFF)
|
|
|
|
# define GET_BLK_MASK_NRVARS(x) (((x) >> 11) & 0xFF)
|
|
|
|
# define GET_BLK_MASK_NLVARS(x) ((x) & 0x7FF)
|
2023-10-23 09:49:15 +00:00
|
|
|
|
2016-09-28 14:40:37 +00:00
|
|
|
# define MAX_CODE_JUMP (0xFFFFu)
|
|
|
|
# define MAX_CODE_PARAM (0xFFFFu)
|
2022-03-17 13:22:17 +00:00
|
|
|
# define MAX_CODE_PARAM2 (0xFFFFFFFFu) /* 32 bits */
|
2016-09-28 14:40:37 +00:00
|
|
|
#else
|
2021-01-29 12:39:31 +00:00
|
|
|
# error Unsupported HCL_CODE_LONG_PARAM_SIZE
|
2016-09-28 14:40:37 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2021-05-04 09:48:19 +00:00
|
|
|
|
2016-09-28 14:40:37 +00:00
|
|
|
/*
|
|
|
|
----------------------------------------------------------------------------------------------------------------
|
|
|
|
SHORT INSTRUCTION CODE LONG INSTRUCTION CODE
|
|
|
|
----------------------------------------------------------------------------------------------------------------
|
|
|
|
v v
|
2022-02-17 12:40:22 +00:00
|
|
|
0-3 0000 00XX STORE_INTO_INSTVAR 128 1000 0000 XXXXXXXX STORE_INTO_IVAR_X (bit 4 off, bit 3 off)
|
2016-09-28 14:40:37 +00:00
|
|
|
4-7 0000 01XX STORE_INTO_INSTVAR
|
2022-02-17 12:40:22 +00:00
|
|
|
8-11 0000 10XX POP_INTO_INSTVAR 136 1000 1000 XXXXXXXX POP_INTO_IVAR_X (bit 4 off, bit 3 on)
|
2016-09-28 14:40:37 +00:00
|
|
|
12-15 0000 11XX POP_INTO_INSTVAR
|
2022-02-17 12:40:22 +00:00
|
|
|
16-19 0001 00XX PUSH_INSTVAR 144 1001 0000 XXXXXXXX PUSH_IVAR_X (bit 4 on)
|
2016-09-28 14:40:37 +00:00
|
|
|
20-23 0001 01XX PUSH_INSTVAR
|
|
|
|
|
|
|
|
v v
|
|
|
|
24-27 0001 10XX PUSH_TEMPVAR 152 1001 1000 XXXXXXXX PUSH_TEMPVAR_X (bit 4 on)
|
|
|
|
28-31 0001 11XX PUSH_TEMPVAR
|
|
|
|
32-35 0010 00XX STORE_INTO_TEMPVAR 160 1010 0000 XXXXXXXX STORE_INTO_TEMPVAR_X (bit 4 off, bit 3 off)
|
|
|
|
36-39 0010 01XX STORE_INTO_TEMPVAR
|
|
|
|
40-43 0010 10XX POP_INTO_TEMPVAR 168 1010 1000 XXXXXXXX POP_INTO_TEMPVAR_X (bit 4 off, bit 3 on)
|
|
|
|
44-47 0010 11XX POP_INTO_TEMPVAR
|
|
|
|
|
|
|
|
48-51 0011 00XX PUSH_LITERAL 176 1011 0000 XXXXXXXX PUSH_LITERAL_X
|
|
|
|
52-55 0011 01XX PUSH_LITERAL 177 1011 0001 XXXXXXXX XXXXXXXX PUSH_LITERAL_X2
|
|
|
|
|
|
|
|
vv
|
|
|
|
56-59 0011 10XX STORE_INTO_OBJECT 184 1011 1000 XXXXXXXX STORE_INTO_OBJECT (bit 3 on, bit 2 off)
|
|
|
|
60-63 0011 11XX POP_INTO_OBJECT 188 1011 1100 XXXXXXXX POP_INTO_OBJECT (bit 3 on, bit 2 on)
|
|
|
|
64-67 0100 00XX PUSH_OBJECT 192 1100 0000 XXXXXXXX PUSH_OBJECT (bit 3 off)
|
|
|
|
|
|
|
|
|
|
|
|
68-71 0100 01XX JUMP_FORWARD 196 1100 0100 XXXXXXXX JUMP_FORWARD_X
|
2016-10-15 08:49:27 +00:00
|
|
|
197 1100 0101 XXXXXXXX JUMP2_FORWARD
|
2016-09-28 14:40:37 +00:00
|
|
|
72-75 0100 10XX JUMP_BACKWARD 200 1100 1000 XXXXXXXX JUMP_BACKWARD_X
|
2016-10-15 08:49:27 +00:00
|
|
|
201 1100 1001 XXXXXXXX JUMP2_BACKWARD
|
2016-10-12 07:30:54 +00:00
|
|
|
76-79 0100 11XX UNUSED 204 1100 1100 XXXXXXXX JUMP_FORWARD_IF_TRUE
|
|
|
|
205 1100 1101 XXXXXXXX JUMP2_FORWARD_IF_TRUE
|
2021-01-24 15:45:28 +00:00
|
|
|
206 1100 1110 XXXXXXXX JUMP_BACKWARD_IF_TRUE
|
|
|
|
207 1100 1111 XXXXXXXX JUMP2_BACKWARD_IF_TRUE
|
2016-10-12 07:30:54 +00:00
|
|
|
80-83 0101 00XX UNUSED 208 1101 0000 XXXXXXXX JUMP_FORWARD_IF_FALSE
|
|
|
|
209 1101 0001 XXXXXXXX JUMP2_FORWARD_IF_FALSE
|
2021-01-24 15:45:28 +00:00
|
|
|
210 1101 0010 XXXXXXXX JUMP_BACKWARD_IF_FALSE
|
|
|
|
211 1101 0011 XXXXXXXX JUMP2_BACKWARD_IF_FALSE
|
2016-09-28 14:40:37 +00:00
|
|
|
|
|
|
|
84-87 0101 01XX CALL 212 1101 0100 XXXXXXXX CALL_X
|
|
|
|
|
|
|
|
vv
|
|
|
|
88-91 0101 10XX YYYYYYYY STORE_INTO_CTXTEMPVAR 216 1101 1000 XXXXXXXX YYYYYYYY STORE_INTO_CTXTEMPVAR_X (bit 3 on, bit 2 off)
|
|
|
|
92-95 0101 11XX YYYYYYYY POP_INTO_CTXTEMPVAR 220 1101 1100 XXXXXXXX YYYYYYYY POP_INTO_CTXTEMPVAR_X (bit 3 on, bit 2 on)
|
|
|
|
96-99 0110 00XX YYYYYYYY PUSH_CTXTEMPVAR 224 1110 0000 XXXXXXXX YYYYYYYY PUSH_CTXTEMPVAR_X (bit 3 off)
|
|
|
|
# XXXth outer-frame, YYYYYYYY local variable
|
|
|
|
|
|
|
|
100-103 0110 01XX YYYYYYYY PUSH_OBJVAR 228 1110 0100 XXXXXXXX YYYYYYYY PUSH_OBJVAR_X (bit 3 off)
|
|
|
|
104-107 0110 10XX YYYYYYYY STORE_INTO_OBJVAR 232 1110 1000 XXXXXXXX YYYYYYYY STORE_INTO_OBJVAR_X (bit 3 on, bit 2 off)
|
|
|
|
108-111 0110 11XX YYYYYYYY POP_INTO_OBJVAR 236 1110 1100 XXXXXXXX YYYYYYYY POP_INTO_OBJVAR_X (bit 3 on, bit 2 on)
|
|
|
|
# XXXth instance variable of YYYYYYYY object
|
|
|
|
|
|
|
|
v
|
2022-01-23 16:46:13 +00:00
|
|
|
112-115 0111 00XX YYYYYYYY SEND_MESSAGE 240 1111 0000 XXXXXXXX YYYYYYYY SEND_X (bit 2 off)
|
|
|
|
116-119 0111 01XX YYYYYYYY SEND_TO_SUPER 244 1111 0100 XXXXXXXX YYYYYYYY SEND_TO_SUPER_X (bit 2 on)
|
2016-09-28 14:40:37 +00:00
|
|
|
# XXX args, YYYYYYYY message
|
|
|
|
|
2022-02-17 12:40:22 +00:00
|
|
|
120 0111 1000 YYYYYYYY PUSH_CVAR_I_X
|
|
|
|
121 0111 1001 YYYYYYYY STORE_INTO_CVAR_I_X
|
|
|
|
122 0111 1010 YYYYYYYY POP_INTO_CVAR_I_X
|
2022-01-01 14:58:57 +00:00
|
|
|
|
2022-02-17 12:40:22 +00:00
|
|
|
123 0111 1011 YYYYYYYY PUSH_CVAR_M_X
|
|
|
|
124 0111 1100 YYYYYYYY STORE_INTO_CVAR_M_X
|
|
|
|
125 0111 1101 YYYYYYYY POP_INTO_CVAR_M_X
|
2022-01-09 16:47:38 +00:00
|
|
|
|
|
|
|
126 0111 1110 UNUSED
|
|
|
|
127 0111 1111 UNUSED
|
2016-09-28 14:40:37 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
## "SHORT_CODE_0 | 0x80" becomes "LONG_CODE_X".
|
|
|
|
## A special single byte instruction is assigned an unused number greater than 128.
|
|
|
|
##
|
|
|
|
*/
|
|
|
|
|
|
|
|
enum hcl_bcode_t
|
|
|
|
{
|
2022-02-17 12:40:22 +00:00
|
|
|
HCL_CODE_STORE_INTO_IVAR_0 = 0x00,
|
|
|
|
HCL_CODE_STORE_INTO_IVAR_1 = 0x01,
|
|
|
|
HCL_CODE_STORE_INTO_IVAR_2 = 0x02,
|
|
|
|
HCL_CODE_STORE_INTO_IVAR_3 = 0x03,
|
|
|
|
|
|
|
|
HCL_CODE_STORE_INTO_IVAR_4 = 0x04,
|
|
|
|
HCL_CODE_STORE_INTO_IVAR_5 = 0x05,
|
|
|
|
HCL_CODE_STORE_INTO_IVAR_6 = 0x06,
|
|
|
|
HCL_CODE_STORE_INTO_IVAR_7 = 0x07,
|
|
|
|
|
|
|
|
HCL_CODE_POP_INTO_IVAR_0 = 0x08,
|
|
|
|
HCL_CODE_POP_INTO_IVAR_1 = 0x09,
|
|
|
|
HCL_CODE_POP_INTO_IVAR_2 = 0x0A,
|
|
|
|
HCL_CODE_POP_INTO_IVAR_3 = 0x0B,
|
|
|
|
|
|
|
|
HCL_CODE_POP_INTO_IVAR_4 = 0x0C,
|
|
|
|
HCL_CODE_POP_INTO_IVAR_5 = 0x0D,
|
|
|
|
HCL_CODE_POP_INTO_IVAR_6 = 0x0E,
|
|
|
|
HCL_CODE_POP_INTO_IVAR_7 = 0x0F,
|
|
|
|
|
|
|
|
HCL_CODE_PUSH_IVAR_0 = 0x10,
|
|
|
|
HCL_CODE_PUSH_IVAR_1 = 0x11,
|
|
|
|
HCL_CODE_PUSH_IVAR_2 = 0x12,
|
|
|
|
HCL_CODE_PUSH_IVAR_3 = 0x13,
|
|
|
|
|
|
|
|
HCL_CODE_PUSH_IVAR_4 = 0x14,
|
|
|
|
HCL_CODE_PUSH_IVAR_5 = 0x15,
|
|
|
|
HCL_CODE_PUSH_IVAR_6 = 0x16,
|
|
|
|
HCL_CODE_PUSH_IVAR_7 = 0x17,
|
2020-09-22 09:19:53 +00:00
|
|
|
|
|
|
|
HCL_CODE_PUSH_TEMPVAR_0 = 0x18,
|
|
|
|
HCL_CODE_PUSH_TEMPVAR_1 = 0x19,
|
|
|
|
HCL_CODE_PUSH_TEMPVAR_2 = 0x1A,
|
|
|
|
HCL_CODE_PUSH_TEMPVAR_3 = 0x1B,
|
|
|
|
|
|
|
|
HCL_CODE_PUSH_TEMPVAR_4 = 0x1C,
|
|
|
|
HCL_CODE_PUSH_TEMPVAR_5 = 0x1D,
|
|
|
|
HCL_CODE_PUSH_TEMPVAR_6 = 0x1E,
|
|
|
|
HCL_CODE_PUSH_TEMPVAR_7 = 0x1F,
|
|
|
|
|
|
|
|
HCL_CODE_STORE_INTO_TEMPVAR_0 = 0x20,
|
|
|
|
HCL_CODE_STORE_INTO_TEMPVAR_1 = 0x21,
|
|
|
|
HCL_CODE_STORE_INTO_TEMPVAR_2 = 0x22,
|
|
|
|
HCL_CODE_STORE_INTO_TEMPVAR_3 = 0x23,
|
|
|
|
|
|
|
|
HCL_CODE_STORE_INTO_TEMPVAR_4 = 0x24,
|
|
|
|
HCL_CODE_STORE_INTO_TEMPVAR_5 = 0x25,
|
|
|
|
HCL_CODE_STORE_INTO_TEMPVAR_6 = 0x26,
|
|
|
|
HCL_CODE_STORE_INTO_TEMPVAR_7 = 0x27,
|
|
|
|
|
|
|
|
HCL_CODE_POP_INTO_TEMPVAR_0 = 0x28,
|
|
|
|
HCL_CODE_POP_INTO_TEMPVAR_1 = 0x29,
|
|
|
|
HCL_CODE_POP_INTO_TEMPVAR_2 = 0x2A,
|
|
|
|
HCL_CODE_POP_INTO_TEMPVAR_3 = 0x2B,
|
|
|
|
|
|
|
|
HCL_CODE_POP_INTO_TEMPVAR_4 = 0x2C,
|
|
|
|
HCL_CODE_POP_INTO_TEMPVAR_5 = 0x2D,
|
|
|
|
HCL_CODE_POP_INTO_TEMPVAR_6 = 0x2E,
|
|
|
|
HCL_CODE_POP_INTO_TEMPVAR_7 = 0x2F,
|
|
|
|
|
|
|
|
HCL_CODE_PUSH_LITERAL_0 = 0x30,
|
|
|
|
HCL_CODE_PUSH_LITERAL_1 = 0x31,
|
|
|
|
HCL_CODE_PUSH_LITERAL_2 = 0x32,
|
|
|
|
HCL_CODE_PUSH_LITERAL_3 = 0x33,
|
|
|
|
|
|
|
|
HCL_CODE_PUSH_LITERAL_4 = 0x34,
|
|
|
|
HCL_CODE_PUSH_LITERAL_5 = 0x35,
|
|
|
|
HCL_CODE_PUSH_LITERAL_6 = 0x36,
|
|
|
|
HCL_CODE_PUSH_LITERAL_7 = 0x37,
|
2016-09-28 14:40:37 +00:00
|
|
|
|
|
|
|
/* -------------------------------------- */
|
|
|
|
|
|
|
|
HCL_CODE_STORE_INTO_OBJECT_0 = 0x38,
|
|
|
|
HCL_CODE_STORE_INTO_OBJECT_1 = 0x39,
|
|
|
|
HCL_CODE_STORE_INTO_OBJECT_2 = 0x3A,
|
|
|
|
HCL_CODE_STORE_INTO_OBJECT_3 = 0x3B,
|
|
|
|
|
2020-09-22 09:19:53 +00:00
|
|
|
HCL_CODE_POP_INTO_OBJECT_0 = 0x3C,
|
|
|
|
HCL_CODE_POP_INTO_OBJECT_1 = 0x3D,
|
|
|
|
HCL_CODE_POP_INTO_OBJECT_2 = 0x3E,
|
|
|
|
HCL_CODE_POP_INTO_OBJECT_3 = 0x3F,
|
2016-10-10 11:36:24 +00:00
|
|
|
|
|
|
|
HCL_CODE_PUSH_OBJECT_0 = 0x40,
|
|
|
|
HCL_CODE_PUSH_OBJECT_1 = 0x41,
|
|
|
|
HCL_CODE_PUSH_OBJECT_2 = 0x42,
|
|
|
|
HCL_CODE_PUSH_OBJECT_3 = 0x43,
|
|
|
|
|
|
|
|
HCL_CODE_JUMP_FORWARD_0 = 0x44, /* 68 */
|
|
|
|
HCL_CODE_JUMP_FORWARD_1 = 0x45, /* 69 */
|
|
|
|
HCL_CODE_JUMP_FORWARD_2 = 0x46, /* 70 */
|
|
|
|
HCL_CODE_JUMP_FORWARD_3 = 0x47, /* 71 */
|
|
|
|
|
2016-10-12 07:30:54 +00:00
|
|
|
HCL_CODE_JUMP_BACKWARD_0 = 0x48, /* 72 */
|
|
|
|
HCL_CODE_JUMP_BACKWARD_1 = 0x49, /* 73 */
|
|
|
|
HCL_CODE_JUMP_BACKWARD_2 = 0x4A, /* 74 */
|
|
|
|
HCL_CODE_JUMP_BACKWARD_3 = 0x4B, /* 75 */
|
2016-10-10 11:36:24 +00:00
|
|
|
|
2021-01-24 15:45:28 +00:00
|
|
|
/* UNUSED 0x4C - 0x53 */
|
2018-02-06 13:52:58 +00:00
|
|
|
|
2016-10-10 11:36:24 +00:00
|
|
|
HCL_CODE_CALL_0 = 0x54, /* 84 */
|
|
|
|
HCL_CODE_CALL_1 = 0x55, /* 85 */
|
|
|
|
HCL_CODE_CALL_2 = 0x56, /* 86 */
|
|
|
|
HCL_CODE_CALL_3 = 0x57, /* 87 */
|
2016-09-28 14:40:37 +00:00
|
|
|
|
2016-09-29 13:20:09 +00:00
|
|
|
HCL_CODE_STORE_INTO_CTXTEMPVAR_0 = 0x58, /* 88 */
|
|
|
|
HCL_CODE_STORE_INTO_CTXTEMPVAR_1 = 0x59, /* 89 */
|
|
|
|
HCL_CODE_STORE_INTO_CTXTEMPVAR_2 = 0x5A, /* 90 */
|
|
|
|
HCL_CODE_STORE_INTO_CTXTEMPVAR_3 = 0x5B, /* 91 */
|
2016-09-28 14:40:37 +00:00
|
|
|
|
2020-09-22 09:19:53 +00:00
|
|
|
HCL_CODE_POP_INTO_CTXTEMPVAR_0 = 0x5C, /* 92 */
|
|
|
|
HCL_CODE_POP_INTO_CTXTEMPVAR_1 = 0x5D, /* 93 */
|
|
|
|
HCL_CODE_POP_INTO_CTXTEMPVAR_2 = 0x5E, /* 94 */
|
|
|
|
HCL_CODE_POP_INTO_CTXTEMPVAR_3 = 0x5F, /* 95 */
|
2016-10-10 11:36:24 +00:00
|
|
|
|
|
|
|
HCL_CODE_PUSH_CTXTEMPVAR_0 = 0x60, /* 96 */
|
|
|
|
HCL_CODE_PUSH_CTXTEMPVAR_1 = 0x61, /* 97 */
|
|
|
|
HCL_CODE_PUSH_CTXTEMPVAR_2 = 0x62, /* 98 */
|
|
|
|
HCL_CODE_PUSH_CTXTEMPVAR_3 = 0x63, /* 99 */
|
|
|
|
|
2020-09-22 09:19:53 +00:00
|
|
|
HCL_CODE_PUSH_OBJVAR_0 = 0x64,
|
|
|
|
HCL_CODE_PUSH_OBJVAR_1 = 0x65,
|
|
|
|
HCL_CODE_PUSH_OBJVAR_2 = 0x66,
|
|
|
|
HCL_CODE_PUSH_OBJVAR_3 = 0x67,
|
2016-10-10 11:36:24 +00:00
|
|
|
|
2020-09-22 09:19:53 +00:00
|
|
|
HCL_CODE_STORE_INTO_OBJVAR_0 = 0x68,
|
|
|
|
HCL_CODE_STORE_INTO_OBJVAR_1 = 0x69,
|
|
|
|
HCL_CODE_STORE_INTO_OBJVAR_2 = 0x6A,
|
|
|
|
HCL_CODE_STORE_INTO_OBJVAR_3 = 0x6B,
|
2016-10-10 11:36:24 +00:00
|
|
|
|
2020-09-22 09:19:53 +00:00
|
|
|
HCL_CODE_POP_INTO_OBJVAR_0 = 0x6C,
|
|
|
|
HCL_CODE_POP_INTO_OBJVAR_1 = 0x6D,
|
|
|
|
HCL_CODE_POP_INTO_OBJVAR_2 = 0x6E,
|
|
|
|
HCL_CODE_POP_INTO_OBJVAR_3 = 0x6F,
|
2016-10-10 11:36:24 +00:00
|
|
|
|
2022-01-23 16:46:13 +00:00
|
|
|
HCL_CODE_SEND_0 = 0x70, /* 112 */
|
|
|
|
HCL_CODE_SEND_1 = 0x71, /* 113 */
|
|
|
|
HCL_CODE_SEND_2 = 0x72, /* 114 */
|
|
|
|
HCL_CODE_SEND_3 = 0x73, /* 115 */
|
2022-01-01 14:58:57 +00:00
|
|
|
|
2022-01-23 16:46:13 +00:00
|
|
|
HCL_CODE_SEND_TO_SUPER_0 = 0x74, /* 116 */
|
|
|
|
HCL_CODE_SEND_TO_SUPER_1 = 0x75, /* 117 */
|
|
|
|
HCL_CODE_SEND_TO_SUPER_2 = 0x76, /* 118 */
|
|
|
|
HCL_CODE_SEND_TO_SUPER_3 = 0x77, /* 119 */
|
2022-01-01 14:58:57 +00:00
|
|
|
|
2022-02-17 12:40:22 +00:00
|
|
|
HCL_CODE_PUSH_CVAR_I_X = 0x78, /* 120 */
|
|
|
|
HCL_CODE_STORE_INTO_CVAR_I_X = 0x79, /* 121 */
|
|
|
|
HCL_CODE_POP_INTO_CVAR_I_X = 0x7A, /* 122 */
|
2022-01-09 16:47:38 +00:00
|
|
|
|
2022-02-17 12:40:22 +00:00
|
|
|
HCL_CODE_PUSH_CVAR_M_X = 0x7B, /* 123 */
|
|
|
|
HCL_CODE_STORE_INTO_CVAR_M_X = 0x7C, /* 124 */
|
|
|
|
HCL_CODE_POP_INTO_CVAR_M_X = 0x7D, /* 125 */
|
2016-09-28 14:40:37 +00:00
|
|
|
|
2022-01-23 16:46:13 +00:00
|
|
|
/* UNUSED 0x7E - 0x7F */
|
2022-02-17 12:40:22 +00:00
|
|
|
HCL_CODE_STORE_INTO_IVAR_X = 0x80, /* 128 */
|
2016-09-28 14:40:37 +00:00
|
|
|
|
2020-09-22 09:19:53 +00:00
|
|
|
HCL_CODE_PUSH_RECEIVER = 0x81, /* 129 */
|
2018-02-06 13:52:58 +00:00
|
|
|
HCL_CODE_PUSH_NIL = 0x82, /* 130 */
|
|
|
|
HCL_CODE_PUSH_TRUE = 0x83, /* 131 */
|
|
|
|
HCL_CODE_PUSH_FALSE = 0x84, /* 132 */
|
2020-09-22 09:19:53 +00:00
|
|
|
HCL_CODE_PUSH_CONTEXT = 0x85, /* 133 */
|
|
|
|
HCL_CODE_PUSH_PROCESS = 0x86, /* 134 */
|
2022-03-21 15:38:31 +00:00
|
|
|
/* UNUSED 0x87 */
|
2016-09-28 14:40:37 +00:00
|
|
|
|
2022-02-17 12:40:22 +00:00
|
|
|
HCL_CODE_POP_INTO_IVAR_X = 0x88, /* 136 ## */
|
2016-09-28 14:40:37 +00:00
|
|
|
|
2018-02-06 13:52:58 +00:00
|
|
|
HCL_CODE_PUSH_NEGONE = 0x89, /* 137 */
|
|
|
|
HCL_CODE_PUSH_ZERO = 0x8A, /* 138 */
|
|
|
|
HCL_CODE_PUSH_ONE = 0x8B, /* 139 */
|
|
|
|
HCL_CODE_PUSH_TWO = 0x8C, /* 140 */
|
2016-09-28 14:40:37 +00:00
|
|
|
|
2022-02-17 12:40:22 +00:00
|
|
|
HCL_CODE_PUSH_IVAR_X = 0x90, /* 144 ## */
|
2018-02-06 13:52:58 +00:00
|
|
|
HCL_CODE_PUSH_TEMPVAR_X = 0x98, /* 152 ## */
|
|
|
|
HCL_CODE_STORE_INTO_TEMPVAR_X = 0xA0, /* 160 ## */
|
2020-09-22 09:19:53 +00:00
|
|
|
HCL_CODE_POP_INTO_TEMPVAR_X = 0xA8, /* 168 ## */
|
2016-09-28 14:40:37 +00:00
|
|
|
|
2018-02-06 13:52:58 +00:00
|
|
|
HCL_CODE_PUSH_LITERAL_X = 0xB0, /* 176 ## */
|
|
|
|
HCL_CODE_PUSH_LITERAL_X2 = 0xB1, /* 177 */
|
2016-09-28 14:40:37 +00:00
|
|
|
|
2018-02-06 13:52:58 +00:00
|
|
|
HCL_CODE_PUSH_INTLIT = 0xB2, /* 178 */
|
|
|
|
HCL_CODE_PUSH_NEGINTLIT = 0xB3, /* 179 */
|
|
|
|
HCL_CODE_PUSH_CHARLIT = 0xB4, /* 180 */
|
2016-09-28 14:40:37 +00:00
|
|
|
|
2022-03-21 15:38:31 +00:00
|
|
|
HCL_CODE_PLUS = 0xB5, /* 181 TOOD: move it to a lower code number later after killing OBJVAR instructions */
|
|
|
|
/* UNUSED - 0xB6 - 0xB7 */
|
2021-01-24 15:45:28 +00:00
|
|
|
|
2018-02-06 13:52:58 +00:00
|
|
|
HCL_CODE_STORE_INTO_OBJECT_X = 0xB8, /* 184 ## */
|
2020-09-22 09:19:53 +00:00
|
|
|
HCL_CODE_POP_INTO_OBJECT_X = 0xBC, /* 188 ## */
|
2018-02-06 13:52:58 +00:00
|
|
|
HCL_CODE_PUSH_OBJECT_X = 0xC0, /* 192 ## */
|
2016-09-28 14:40:37 +00:00
|
|
|
|
2021-01-24 15:45:28 +00:00
|
|
|
/* UNUSED - 0xC1 - 0xC3 */
|
|
|
|
|
2018-02-06 13:52:58 +00:00
|
|
|
HCL_CODE_JUMP_FORWARD_X = 0xC4, /* 196 ## */
|
2016-10-10 11:36:24 +00:00
|
|
|
HCL_CODE_JUMP2_FORWARD = 0xC5, /* 197 */
|
2018-02-06 13:52:58 +00:00
|
|
|
|
2021-01-24 15:45:28 +00:00
|
|
|
/* UNUSED - 0xC6 - 0xC7 */
|
|
|
|
|
2018-02-06 13:52:58 +00:00
|
|
|
HCL_CODE_JUMP_BACKWARD_X = 0xC8, /* 200 ## */
|
2016-10-10 11:36:24 +00:00
|
|
|
HCL_CODE_JUMP2_BACKWARD = 0xC9, /* 201 */
|
2018-02-06 13:52:58 +00:00
|
|
|
|
2021-01-24 15:45:28 +00:00
|
|
|
/* UNUSED - 0xCA - 0xCB */
|
|
|
|
|
2018-02-06 13:52:58 +00:00
|
|
|
HCL_CODE_JUMP_FORWARD_IF_TRUE = 0xCC, /* 204 ## */
|
2016-10-12 07:30:54 +00:00
|
|
|
HCL_CODE_JUMP2_FORWARD_IF_TRUE = 0xCD, /* 205 */
|
2021-01-24 15:45:28 +00:00
|
|
|
HCL_CODE_JUMP_BACKWARD_IF_TRUE = 0xCE, /* 206 ## */
|
|
|
|
HCL_CODE_JUMP2_BACKWARD_IF_TRUE = 0xCF, /* 207 */
|
|
|
|
|
2018-02-06 13:52:58 +00:00
|
|
|
HCL_CODE_JUMP_FORWARD_IF_FALSE = 0xD0, /* 208 ## */
|
2016-10-12 07:30:54 +00:00
|
|
|
HCL_CODE_JUMP2_FORWARD_IF_FALSE = 0xD1, /* 209 */
|
2021-01-24 15:45:28 +00:00
|
|
|
HCL_CODE_JUMP_BACKWARD_IF_FALSE = 0xD2, /* 210 ## */
|
|
|
|
HCL_CODE_JUMP2_BACKWARD_IF_FALSE = 0xD3, /* 211 */
|
2016-09-28 14:40:37 +00:00
|
|
|
|
2021-05-11 15:04:53 +00:00
|
|
|
HCL_CODE_CALL_X = 0xD4, /* 212 ## */
|
|
|
|
HCL_CODE_CALL_R = 0xD5, /* 213 ## ##*/
|
2023-10-23 09:49:15 +00:00
|
|
|
HCL_CODE_PUSH_RETURN_R = 0xD6, /* 214 */
|
|
|
|
HCL_CODE_TRY_ENTER = 0xD7, /* 215 ## */
|
2021-05-11 15:04:53 +00:00
|
|
|
|
2018-02-06 13:52:58 +00:00
|
|
|
HCL_CODE_STORE_INTO_CTXTEMPVAR_X = 0xD8, /* 216 ## */
|
2023-10-23 09:49:15 +00:00
|
|
|
HCL_CODE_TRY_ENTER2 = 0xD9, /* 217 ## */
|
2021-05-13 14:43:40 +00:00
|
|
|
HCL_CODE_TRY_EXIT = 0xDA, /* 218 */
|
|
|
|
HCL_CODE_THROW = 0xDB, /* 219 */
|
2021-01-24 15:45:28 +00:00
|
|
|
|
2020-09-22 09:19:53 +00:00
|
|
|
HCL_CODE_POP_INTO_CTXTEMPVAR_X = 0xDC, /* 220 ## */
|
2021-01-24 15:45:28 +00:00
|
|
|
/* UNUSED - 0xDD - 0xDF */
|
|
|
|
|
2018-02-06 13:52:58 +00:00
|
|
|
HCL_CODE_PUSH_CTXTEMPVAR_X = 0xE0, /* 224 ## */
|
2021-06-18 18:54:50 +00:00
|
|
|
HCL_CODE_CLASS_ENTER = 0xE1, /* 225 ## */
|
2021-12-24 00:05:58 +00:00
|
|
|
HCL_CODE_CLASS_EXIT = 0xE2, /* 226 */
|
2022-01-29 17:43:11 +00:00
|
|
|
HCL_CODE_CLASS_PEXIT = 0xE3, /* 227 */
|
2018-02-06 13:52:58 +00:00
|
|
|
|
2020-09-22 09:19:53 +00:00
|
|
|
HCL_CODE_PUSH_OBJVAR_X = 0xE4, /* 228 ## */
|
2022-02-12 15:05:31 +00:00
|
|
|
HCL_CODE_CLASS_CMSTORE = 0xE5, /* 229 */
|
2022-03-17 13:22:17 +00:00
|
|
|
HCL_CODE_CLASS_CIMSTORE = 0xE6, /* 230 */
|
|
|
|
HCL_CODE_CLASS_IMSTORE = 0xE7, /* 231 */
|
2021-01-24 15:45:28 +00:00
|
|
|
|
2020-09-22 09:19:53 +00:00
|
|
|
HCL_CODE_STORE_INTO_OBJVAR_X = 0xE8, /* 232 ## */
|
2021-01-24 15:45:28 +00:00
|
|
|
HCL_CODE_MAKE_ARRAY = 0xE9, /* 233 ## */
|
|
|
|
HCL_CODE_MAKE_BYTEARRAY = 0xEA, /* 234 ## */
|
|
|
|
HCL_CODE_MAKE_DIC = 0xEB, /* 235 ## */
|
2021-03-28 03:44:27 +00:00
|
|
|
|
2020-09-22 09:19:53 +00:00
|
|
|
HCL_CODE_POP_INTO_OBJVAR_X = 0xEC, /* 236 ## */
|
2021-01-24 15:45:28 +00:00
|
|
|
HCL_CODE_POP_INTO_ARRAY = 0xED, /* 237 ## */
|
|
|
|
HCL_CODE_POP_INTO_BYTEARRAY = 0xEE, /* 238 ## */
|
|
|
|
HCL_CODE_POP_INTO_DIC = 0xEF, /* 239 */
|
2018-02-07 13:55:22 +00:00
|
|
|
|
2022-01-23 16:46:13 +00:00
|
|
|
HCL_CODE_SEND_X = 0xF0, /* 240 ## */
|
2022-02-21 16:07:55 +00:00
|
|
|
HCL_CODE_SEND_R = 0xF1, /* 241 ## ## - [NOTE] ((code >> 2) & 1) must be 0 */
|
2022-01-23 16:46:13 +00:00
|
|
|
|
|
|
|
HCL_CODE_MAKE_CONS = 0xF2, /* 242 */
|
|
|
|
HCL_CODE_POP_INTO_CONS = 0xF3, /* 243 */
|
|
|
|
|
|
|
|
HCL_CODE_SEND_TO_SUPER_X = 0xF4, /* 244 ## */
|
2022-02-21 16:07:55 +00:00
|
|
|
HCL_CODE_SEND_TO_SUPER_R = 0xF5, /* 245 ## ## - [NOTE] ((code >> 2) & 1) must be 0 */
|
2021-01-24 15:45:28 +00:00
|
|
|
|
2022-01-23 16:46:13 +00:00
|
|
|
HCL_CODE_POP_INTO_CONS_END = 0xF6, /* 246 */
|
|
|
|
HCL_CODE_POP_INTO_CONS_CDR = 0xF7, /* 247 */
|
2018-02-06 13:52:58 +00:00
|
|
|
/* -------------------------------------- */
|
2016-09-28 14:40:37 +00:00
|
|
|
|
2022-01-23 16:46:13 +00:00
|
|
|
HCL_CODE_DUP_STACKTOP = 0xF8, /* 248 */
|
|
|
|
HCL_CODE_POP_STACKTOP = 0xF9, /* 249 */
|
|
|
|
HCL_CODE_RETURN_STACKTOP = 0xFA, /* 250 */
|
|
|
|
HCL_CODE_RETURN_RECEIVER = 0xFB, /* 251 */
|
|
|
|
HCL_CODE_RETURN_FROM_BLOCK = 0xFC, /* 252, return the stack top from a block */
|
2020-10-04 18:21:05 +00:00
|
|
|
|
2022-01-23 16:46:13 +00:00
|
|
|
HCL_CODE_MAKE_FUNCTION = 0xFD, /* 253 */
|
2023-11-09 15:03:03 +00:00
|
|
|
HCL_CODE_MAKE_LAMBDA = 0xFE, /* 254 */
|
2018-02-06 13:52:58 +00:00
|
|
|
HCL_CODE_NOOP = 0xFF /* 255 */
|
2016-09-28 14:40:37 +00:00
|
|
|
};
|
|
|
|
|
2018-02-13 16:10:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
typedef hcl_ooi_t (*hcl_outbfmt_t) (
|
|
|
|
hcl_t* hcl,
|
2018-04-26 04:39:20 +00:00
|
|
|
hcl_bitmask_t mask,
|
2018-02-13 16:10:41 +00:00
|
|
|
const hcl_bch_t* fmt,
|
|
|
|
...
|
|
|
|
);
|
|
|
|
|
2021-03-28 03:44:27 +00:00
|
|
|
/* i don't want an error raised inside the callback to override
|
2018-02-22 04:35:55 +00:00
|
|
|
* the existing error number and message. */
|
|
|
|
#define vmprim_log_write(hcl,mask,ptr,len) do { \
|
|
|
|
int shuterr = (hcl)->shuterr; \
|
|
|
|
(hcl)->shuterr = 1; \
|
|
|
|
(hcl)->vmprim.log_write (hcl, mask, ptr, len); \
|
|
|
|
(hcl)->shuterr = shuterr; \
|
|
|
|
} while(0)
|
|
|
|
|
2016-09-28 14:40:37 +00:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* ========================================================================= */
|
|
|
|
/* heap.c */
|
|
|
|
/* ========================================================================= */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The hcl_makeheap() function creates a new heap of the \a size bytes.
|
|
|
|
*
|
|
|
|
* \return heap pointer on success and #HCL_NULL on failure.
|
|
|
|
*/
|
|
|
|
hcl_heap_t* hcl_makeheap (
|
2021-03-28 03:44:27 +00:00
|
|
|
hcl_t* hcl,
|
2016-09-28 14:40:37 +00:00
|
|
|
hcl_oow_t size
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The hcl_killheap() function destroys the heap pointed to by \a heap.
|
|
|
|
*/
|
|
|
|
void hcl_killheap (
|
2021-03-28 03:44:27 +00:00
|
|
|
hcl_t* hcl,
|
2016-09-28 14:40:37 +00:00
|
|
|
hcl_heap_t* heap
|
|
|
|
);
|
|
|
|
|
2021-03-28 03:44:27 +00:00
|
|
|
/**
|
2020-12-31 17:48:47 +00:00
|
|
|
* The hcl_allocheapmem() function allocates \a size bytes from the given heap
|
|
|
|
* and clears it with zeros.
|
2016-09-28 14:40:37 +00:00
|
|
|
*/
|
2020-12-31 17:48:47 +00:00
|
|
|
void* hcl_callocheapmem (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_heap_t* heap,
|
|
|
|
hcl_oow_t size
|
|
|
|
);
|
|
|
|
|
2021-01-17 17:45:39 +00:00
|
|
|
void* hcl_callocheapmem_noseterr (
|
2020-12-31 17:48:47 +00:00
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_heap_t* heap,
|
|
|
|
hcl_oow_t size
|
|
|
|
);
|
|
|
|
|
|
|
|
void hcl_freeheapmem (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_heap_t* heap,
|
|
|
|
void* ptr
|
2016-09-28 14:40:37 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
/* ========================================================================= */
|
|
|
|
/* obj.c */
|
|
|
|
/* ========================================================================= */
|
|
|
|
void* hcl_allocbytes (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oow_t size
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The hcl_allocoopobj() function allocates a raw object composed of \a size
|
|
|
|
* pointer fields excluding the header.
|
|
|
|
*/
|
|
|
|
hcl_oop_t hcl_allocoopobj (
|
|
|
|
hcl_t* hcl,
|
2016-10-04 17:56:28 +00:00
|
|
|
int brand,
|
2016-09-28 14:40:37 +00:00
|
|
|
hcl_oow_t size
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_allocoopobjwithtrailer (
|
|
|
|
hcl_t* hcl,
|
2020-10-04 18:21:05 +00:00
|
|
|
int brand,
|
2016-09-28 14:40:37 +00:00
|
|
|
hcl_oow_t size,
|
|
|
|
const hcl_oob_t* tptr,
|
|
|
|
hcl_oow_t tlen
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_alloccharobj (
|
|
|
|
hcl_t* hcl,
|
2016-10-04 17:56:28 +00:00
|
|
|
int brand,
|
2016-09-28 14:40:37 +00:00
|
|
|
const hcl_ooch_t* ptr,
|
|
|
|
hcl_oow_t len
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_allocbyteobj (
|
2016-10-04 17:56:28 +00:00
|
|
|
hcl_t* hcl,
|
|
|
|
int brand,
|
|
|
|
const hcl_oob_t* ptr,
|
|
|
|
hcl_oow_t len
|
2016-09-28 14:40:37 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_allochalfwordobj (
|
|
|
|
hcl_t* hcl,
|
2016-10-04 17:56:28 +00:00
|
|
|
int brand,
|
2016-09-28 14:40:37 +00:00
|
|
|
const hcl_oohw_t* ptr,
|
|
|
|
hcl_oow_t len
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_allocwordobj (
|
|
|
|
hcl_t* hcl,
|
2016-10-04 17:56:28 +00:00
|
|
|
int brand,
|
2016-09-28 14:40:37 +00:00
|
|
|
const hcl_oow_t* ptr,
|
|
|
|
hcl_oow_t len
|
|
|
|
);
|
|
|
|
|
2021-12-31 08:39:12 +00:00
|
|
|
hcl_oop_t hcl_instantiate (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_class_t _class,
|
|
|
|
const void* vptr,
|
|
|
|
hcl_oow_t vlen
|
|
|
|
);
|
|
|
|
|
2016-09-28 14:40:37 +00:00
|
|
|
/* ========================================================================= */
|
|
|
|
/* sym.c */
|
|
|
|
/* ========================================================================= */
|
|
|
|
hcl_oop_t hcl_makesymbol (
|
|
|
|
hcl_t* hcl,
|
|
|
|
const hcl_ooch_t* ptr,
|
|
|
|
hcl_oow_t len
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_findsymbol (
|
|
|
|
hcl_t* hcl,
|
|
|
|
const hcl_ooch_t* ptr,
|
|
|
|
hcl_oow_t len
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/* ========================================================================= */
|
|
|
|
/* proc.c */
|
|
|
|
/* ========================================================================= */
|
|
|
|
hcl_oop_process_t hcl_makeproc (
|
|
|
|
hcl_t* hcl
|
|
|
|
);
|
|
|
|
|
|
|
|
/* ========================================================================= */
|
2020-12-31 17:48:47 +00:00
|
|
|
/* gc.c */
|
|
|
|
/* ========================================================================= */
|
|
|
|
|
|
|
|
hcl_oow_t hcl_getobjpayloadbytes (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t oop
|
|
|
|
);
|
|
|
|
|
|
|
|
void hcl_gc_ms_sweep_lazy (
|
2021-01-17 17:45:39 +00:00
|
|
|
hcl_t* hcl,
|
2020-12-31 17:48:47 +00:00
|
|
|
hcl_oow_t allocsize
|
|
|
|
);
|
|
|
|
|
2021-01-17 17:45:39 +00:00
|
|
|
int hcl_getsyncodebyoocs_noseterr (
|
|
|
|
hcl_t* hcl,
|
|
|
|
const hcl_oocs_t* name
|
|
|
|
);
|
|
|
|
|
2021-01-19 14:07:42 +00:00
|
|
|
int hcl_getsyncode_noseterr (
|
|
|
|
hcl_t* hcl,
|
|
|
|
const hcl_ooch_t* ptr,
|
|
|
|
const hcl_oow_t len
|
|
|
|
);
|
|
|
|
|
|
|
|
const hcl_ooch_t* hcl_getsyncodename_noseterr (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_syncode_t syncode
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2020-12-31 17:48:47 +00:00
|
|
|
/* ========================================================================= */
|
2016-09-28 14:40:37 +00:00
|
|
|
/* utf8.c */
|
|
|
|
/* ========================================================================= */
|
2018-04-06 16:33:17 +00:00
|
|
|
hcl_oow_t hcl_uc_to_utf8 (
|
2016-09-28 14:40:37 +00:00
|
|
|
hcl_uch_t uc,
|
|
|
|
hcl_bch_t* utf8,
|
|
|
|
hcl_oow_t size
|
|
|
|
);
|
|
|
|
|
2018-04-06 16:33:17 +00:00
|
|
|
hcl_oow_t hcl_utf8_to_uc (
|
2016-09-28 14:40:37 +00:00
|
|
|
const hcl_bch_t* utf8,
|
|
|
|
hcl_oow_t size,
|
|
|
|
hcl_uch_t* uc
|
|
|
|
);
|
|
|
|
|
|
|
|
int hcl_ucstoutf8 (
|
|
|
|
const hcl_uch_t* ucs,
|
|
|
|
hcl_oow_t* ucslen,
|
|
|
|
hcl_bch_t* bcs,
|
|
|
|
hcl_oow_t* bcslen
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2018-04-06 16:33:17 +00:00
|
|
|
* The hcl_utf8_to_ucs() function converts a UTF8 string to a uncide string.
|
2016-09-28 14:40:37 +00:00
|
|
|
*
|
|
|
|
* It never returns -2 if \a ucs is #HCL_NULL.
|
|
|
|
*
|
|
|
|
* \code
|
|
|
|
* const hcl_bch_t* bcs = "test string";
|
|
|
|
* hcl_uch_t ucs[100];
|
|
|
|
* hcl_oow_t ucslen = HCL_COUNTOF(buf), n;
|
|
|
|
* hcl_oow_t bcslen = 11;
|
|
|
|
* int n;
|
2018-04-06 16:33:17 +00:00
|
|
|
* n = hcl_utf8_to_ucs (bcs, &bcslen, ucs, &ucslen);
|
2016-09-28 14:40:37 +00:00
|
|
|
* if (n <= -1) { invalid/incomplenete sequence or buffer to small }
|
|
|
|
* \endcode
|
|
|
|
*
|
|
|
|
* For a null-terminated string, you can specify ~(hcl_oow_t)0 in
|
|
|
|
* \a bcslen. The destination buffer \a ucs also must be large enough to
|
|
|
|
* store a terminating null. Otherwise, -2 is returned.
|
2021-03-28 03:44:27 +00:00
|
|
|
*
|
2016-09-28 14:40:37 +00:00
|
|
|
* The resulting \a ucslen can still be greater than 0 even if the return
|
|
|
|
* value is negative. The value indiates the number of characters converted
|
|
|
|
* before the error has occurred.
|
|
|
|
*
|
|
|
|
* \return 0 on success.
|
|
|
|
* -1 if \a bcs contains an illegal character.
|
|
|
|
* -2 if the wide-character string buffer is too small.
|
|
|
|
* -3 if \a bcs is not a complete sequence.
|
|
|
|
*/
|
2018-04-06 16:33:17 +00:00
|
|
|
int hcl_utf8_to_ucs (
|
2016-09-28 14:40:37 +00:00
|
|
|
const hcl_bch_t* bcs,
|
|
|
|
hcl_oow_t* bcslen,
|
|
|
|
hcl_uch_t* ucs,
|
|
|
|
hcl_oow_t* ucslen
|
|
|
|
);
|
|
|
|
|
|
|
|
/* ========================================================================= */
|
2018-03-28 16:40:42 +00:00
|
|
|
/* bigint.c */
|
2016-09-28 14:40:37 +00:00
|
|
|
/* ========================================================================= */
|
2019-05-04 17:56:45 +00:00
|
|
|
static HCL_INLINE int hcl_isbigint (hcl_t* hcl, hcl_oop_t x)
|
|
|
|
{
|
|
|
|
return HCL_IS_BIGINT(hcl, x);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HCL_INLINE int hcl_isint (hcl_t* hcl, hcl_oop_t x)
|
|
|
|
{
|
|
|
|
return HCL_OOP_IS_SMOOI(x) || HCL_IS_BIGINT(hcl, x);
|
|
|
|
}
|
2016-09-28 14:40:37 +00:00
|
|
|
|
|
|
|
hcl_oop_t hcl_addints (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_subints (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_mulints (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_divints (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y,
|
2021-01-10 16:04:36 +00:00
|
|
|
int modulo,
|
2016-09-28 14:40:37 +00:00
|
|
|
hcl_oop_t* rem
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_negateint (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_bitatint (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_bitandints (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_bitorints (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_bitxorints (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_bitinvint (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_bitshiftint (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_eqints (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_neints (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_gtints (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_geints (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_ltints (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_leints (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
2018-04-03 14:02:40 +00:00
|
|
|
hcl_oop_t hcl_sqrtint (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x
|
|
|
|
);
|
|
|
|
|
2018-04-07 02:28:38 +00:00
|
|
|
hcl_oop_t hcl_absint (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x
|
|
|
|
);
|
|
|
|
|
2016-09-28 14:40:37 +00:00
|
|
|
hcl_oop_t hcl_strtoint (
|
|
|
|
hcl_t* hcl,
|
|
|
|
const hcl_ooch_t* str,
|
|
|
|
hcl_oow_t len,
|
2018-02-13 16:10:41 +00:00
|
|
|
int radix
|
2016-09-28 14:40:37 +00:00
|
|
|
);
|
|
|
|
|
2019-04-16 15:46:00 +00:00
|
|
|
|
|
|
|
#define HCL_INTTOSTR_RADIXMASK (0xFF)
|
|
|
|
#define HCL_INTTOSTR_LOWERCASE (1 << 8)
|
|
|
|
#define HCL_INTTOSTR_NONEWOBJ (1 << 9)
|
2018-02-15 08:05:48 +00:00
|
|
|
/**
|
|
|
|
* The hcl_inttostr() function converts an integer object to a string object
|
2019-04-16 15:46:00 +00:00
|
|
|
* printed in the given radix. If HCL_INTTOSTR_NONEWOBJ is set in flags_radix,
|
2021-03-28 03:44:27 +00:00
|
|
|
* it returns hcl->_nil but keeps the result in the buffer pointed to by
|
2019-04-16 15:46:00 +00:00
|
|
|
* hcl->inttostr.xbuf.ptr with the length stored in hcl->inttostr.xbuf.len.
|
|
|
|
* If the function fails, it returns #HCL_NULL.
|
2018-02-15 08:05:48 +00:00
|
|
|
*/
|
2016-09-28 14:40:37 +00:00
|
|
|
hcl_oop_t hcl_inttostr (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t num,
|
2019-04-16 15:46:00 +00:00
|
|
|
int flagged_radix /* radix between 2 and 36 inclusive, optionally bitwise ORed of HCL_INTTOSTR_XXX bits */
|
2016-09-28 14:40:37 +00:00
|
|
|
);
|
|
|
|
|
2018-03-28 16:40:42 +00:00
|
|
|
/* ========================================================================= */
|
|
|
|
/* number.c */
|
|
|
|
/* ========================================================================= */
|
|
|
|
hcl_oop_t hcl_addnums (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_subnums (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
2018-03-30 15:43:09 +00:00
|
|
|
|
|
|
|
hcl_oop_t hcl_mulnums (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
2018-04-02 12:52:10 +00:00
|
|
|
hcl_oop_t hcl_mltnums (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
2018-03-30 15:43:09 +00:00
|
|
|
hcl_oop_t hcl_divnums (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
2018-04-01 17:09:07 +00:00
|
|
|
hcl_oop_t hcl_truncfpdecval (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t iv, /* integer */
|
|
|
|
hcl_ooi_t cs, /* current scale */
|
|
|
|
hcl_ooi_t ns /* new scale */
|
|
|
|
);
|
|
|
|
|
2018-04-02 12:28:09 +00:00
|
|
|
hcl_oop_t hcl_gtnums (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_genums (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_ltnums (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_lenums (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_eqnums (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
hcl_oop_t hcl_nenums (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x,
|
|
|
|
hcl_oop_t y
|
|
|
|
);
|
2018-04-03 14:02:40 +00:00
|
|
|
|
|
|
|
hcl_oop_t hcl_sqrtnum (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x
|
|
|
|
);
|
|
|
|
|
2018-04-07 02:28:38 +00:00
|
|
|
hcl_oop_t hcl_absnum (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oop_t x
|
2016-09-28 14:40:37 +00:00
|
|
|
);
|
|
|
|
|
2018-02-09 04:24:50 +00:00
|
|
|
/* ========================================================================= */
|
|
|
|
/* hcl.c */
|
|
|
|
/* ========================================================================= */
|
|
|
|
|
|
|
|
hcl_mod_data_t* hcl_openmod (
|
|
|
|
hcl_t* hcl,
|
|
|
|
const hcl_ooch_t* name,
|
2018-02-12 16:51:38 +00:00
|
|
|
hcl_oow_t namelen
|
2018-02-09 04:24:50 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
void hcl_closemod (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_mod_data_t* mdp
|
|
|
|
);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The hcl_querymod() function finds a primitive function in modules
|
|
|
|
* with a full primitive identifier.
|
|
|
|
*/
|
|
|
|
hcl_pfbase_t* hcl_querymod (
|
|
|
|
hcl_t* hcl,
|
|
|
|
const hcl_ooch_t* pfid,
|
2018-02-28 04:52:01 +00:00
|
|
|
hcl_oow_t pfidlen,
|
|
|
|
hcl_mod_t** mod
|
2018-02-09 04:24:50 +00:00
|
|
|
);
|
|
|
|
|
2018-02-05 15:59:32 +00:00
|
|
|
/* ========================================================================= */
|
2020-10-08 09:25:54 +00:00
|
|
|
/* fmt.c */
|
2018-02-05 15:59:32 +00:00
|
|
|
/* ========================================================================= */
|
2019-05-31 10:54:13 +00:00
|
|
|
int hcl_fmt_object_ (
|
|
|
|
hcl_fmtout_t* fmtout,
|
|
|
|
hcl_oop_t oop
|
2018-02-05 15:59:32 +00:00
|
|
|
);
|
|
|
|
|
2019-05-31 10:54:13 +00:00
|
|
|
int hcl_prfmtcallstack (
|
2018-03-01 09:46:02 +00:00
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_ooi_t nargs
|
|
|
|
);
|
|
|
|
|
2019-05-31 10:54:13 +00:00
|
|
|
int hcl_logfmtcallstack (
|
2018-02-28 15:57:19 +00:00
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_ooi_t nargs
|
|
|
|
);
|
2018-02-05 15:59:32 +00:00
|
|
|
|
2019-05-31 10:54:13 +00:00
|
|
|
int hcl_strfmtcallstack (
|
2018-03-05 03:35:44 +00:00
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_ooi_t nargs
|
|
|
|
);
|
|
|
|
|
2020-10-08 09:25:54 +00:00
|
|
|
/* ========================================================================= */
|
|
|
|
/* comp.c */
|
|
|
|
/* ========================================================================= */
|
|
|
|
int hcl_emitbyteinstruction (
|
|
|
|
hcl_t* hcl,
|
|
|
|
hcl_oob_t bc
|
|
|
|
);
|
|
|
|
|
2021-01-09 16:53:35 +00:00
|
|
|
/* ========================================================================= */
|
|
|
|
/* cnode.c */
|
|
|
|
/* ========================================================================= */
|
2023-11-04 13:58:31 +00:00
|
|
|
hcl_cnode_t* hcl_makecnodenil (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
|
|
|
|
hcl_cnode_t* hcl_makecnodetrue (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
|
|
|
|
hcl_cnode_t* hcl_makecnodefalse (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
|
|
|
|
hcl_cnode_t* hcl_makecnodeself (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
|
|
|
|
hcl_cnode_t* hcl_makecnodesuper (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
|
|
|
|
hcl_cnode_t* hcl_makecnodeellipsis (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
|
|
|
|
hcl_cnode_t* hcl_makecnodetrpcolons (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
|
|
|
|
hcl_cnode_t* hcl_makecnodedcstar (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
|
|
|
|
hcl_cnode_t* hcl_makecnodecharlit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok, const hcl_ooch_t v);
|
|
|
|
hcl_cnode_t* hcl_makecnodesymbol (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
|
|
|
|
hcl_cnode_t* hcl_makecnodedsymbol (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
|
|
|
|
hcl_cnode_t* hcl_makecnodestrlit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
|
|
|
|
hcl_cnode_t* hcl_makecnodenumlit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
|
|
|
|
hcl_cnode_t* hcl_makecnoderadnumlit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
|
|
|
|
hcl_cnode_t* hcl_makecnodefpdeclit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
|
|
|
|
hcl_cnode_t* hcl_makecnodesmptrlit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok, hcl_oow_t v);
|
|
|
|
hcl_cnode_t* hcl_makecnodeerrlit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok, hcl_ooi_t v);
|
2023-11-12 12:54:17 +00:00
|
|
|
hcl_cnode_t* hcl_makecnodecons (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok, hcl_cnode_t* car, hcl_cnode_t* cdr);
|
2023-11-04 13:58:31 +00:00
|
|
|
hcl_cnode_t* hcl_makecnodeelist (hcl_t* hcl, const hcl_loc_t* loc, hcl_concode_t type);
|
|
|
|
hcl_cnode_t* hcl_makecnodeshell (hcl_t* hcl, const hcl_loc_t* loc, hcl_cnode_t* obj);
|
2021-01-13 09:54:44 +00:00
|
|
|
void hcl_freesinglecnode (hcl_t* hcl, hcl_cnode_t* c);
|
2021-01-19 14:07:42 +00:00
|
|
|
hcl_oow_t hcl_countcnodecons (hcl_t* hcl, hcl_cnode_t* cons);
|
2023-11-12 12:54:17 +00:00
|
|
|
void hcl_dumpcnode (hcl_t* hcl, hcl_cnode_t* c, int newline);
|
2021-01-09 16:53:35 +00:00
|
|
|
|
2021-02-01 13:20:46 +00:00
|
|
|
|
|
|
|
/* ========================================================================= */
|
|
|
|
/* exec.c */
|
|
|
|
/* ========================================================================= */
|
2021-05-15 11:19:52 +00:00
|
|
|
hcl_pfrc_t hcl_pf_process_current (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
2021-02-01 13:20:46 +00:00
|
|
|
hcl_pfrc_t hcl_pf_process_fork (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
|
|
|
hcl_pfrc_t hcl_pf_process_resume (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
|
|
|
hcl_pfrc_t hcl_pf_process_suspend (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
2021-05-15 11:19:52 +00:00
|
|
|
hcl_pfrc_t hcl_pf_process_terminate (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
|
|
|
hcl_pfrc_t hcl_pf_process_terminate_all (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
2021-02-01 13:20:46 +00:00
|
|
|
hcl_pfrc_t hcl_pf_process_yield (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
2021-02-03 14:50:51 +00:00
|
|
|
|
2021-02-05 15:22:39 +00:00
|
|
|
hcl_pfrc_t hcl_pf_semaphore_new (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
2021-02-03 14:50:51 +00:00
|
|
|
hcl_pfrc_t hcl_pf_semaphore_wait (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
2021-02-05 15:22:39 +00:00
|
|
|
hcl_pfrc_t hcl_pf_semaphore_signal (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
2021-02-03 14:50:51 +00:00
|
|
|
hcl_pfrc_t hcl_pf_semaphore_signal_timed (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
|
|
|
hcl_pfrc_t hcl_pf_semaphore_signal_on_input (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
|
|
|
hcl_pfrc_t hcl_pf_semaphore_signal_on_output (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
2021-02-07 17:57:35 +00:00
|
|
|
/*hcl_pfrc_t hcl_pf_semaphore_signal_on_gcfin (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);*/
|
2021-02-03 14:50:51 +00:00
|
|
|
hcl_pfrc_t hcl_pf_semaphore_unsignal (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
|
|
|
|
2021-02-05 15:22:39 +00:00
|
|
|
hcl_pfrc_t hcl_pf_semaphore_group_new (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
2021-02-03 14:50:51 +00:00
|
|
|
hcl_pfrc_t hcl_pf_semaphore_group_add_semaphore (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
|
|
|
hcl_pfrc_t hcl_pf_semaphore_group_remove_semaphore (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
|
|
|
hcl_pfrc_t hcl_pf_semaphore_group_wait (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs);
|
2021-02-01 13:20:46 +00:00
|
|
|
|
2016-09-28 14:40:37 +00:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2021-02-01 13:20:46 +00:00
|
|
|
|
|
|
|
|
2016-09-28 14:40:37 +00:00
|
|
|
#endif
|