2015-04-30 15:56:05 +00:00
|
|
|
/*
|
|
|
|
* $Id$
|
|
|
|
*
|
2019-11-19 09:40:26 +00:00
|
|
|
Copyright (c) 2014-2019 Chung, Hyung-Hwan. All rights reserved.
|
2015-04-30 15:56:05 +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.
|
|
|
|
*/
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
#ifndef _MOO_PRV_H_
|
|
|
|
#define _MOO_PRV_H_
|
2015-04-30 15:56:05 +00:00
|
|
|
|
2019-11-15 09:39:12 +00:00
|
|
|
#include <moo.h>
|
2019-11-26 05:10:34 +00:00
|
|
|
#include <moo-chr.h>
|
2019-11-21 09:04:53 +00:00
|
|
|
#include <moo-fmt.h>
|
2019-11-15 09:39:12 +00:00
|
|
|
#include <moo-utl.h>
|
2015-04-30 15:56:05 +00:00
|
|
|
|
2015-06-23 14:00:26 +00:00
|
|
|
/* you can define this to either 1 or 2 */
|
2017-01-09 09:54:49 +00:00
|
|
|
#define MOO_BCODE_LONG_PARAM_SIZE 2
|
2015-06-23 14:00:26 +00:00
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
/* this is useful for debugging. moo_gc() can be called
|
|
|
|
* while moo has not been fully initialized when this is defined*/
|
|
|
|
#define MOO_SUPPORT_GC_DURING_IGNITION
|
2015-05-07 15:58:04 +00:00
|
|
|
|
2015-07-03 13:06:01 +00:00
|
|
|
/* define this to generate XXXX_CTXTEMVAR instructions */
|
2017-01-09 09:54:49 +00:00
|
|
|
#define MOO_USE_CTXTEMPVAR
|
2015-06-30 14:47:39 +00:00
|
|
|
|
2017-12-16 16:14:23 +00:00
|
|
|
/* define this to enable karatsuba multiplication in bigint */
|
|
|
|
#define MOO_ENABLE_KARATSUBA
|
|
|
|
#define MOO_KARATSUBA_CUTOFF 32
|
|
|
|
#define MOO_KARATSUBA_CUTOFF_DEBUG 3
|
|
|
|
|
2019-11-23 04:21:07 +00:00
|
|
|
/* enable floating-pointer number support in the basic formatting functions */
|
|
|
|
#define MOO_ENABLE_FLTFMT
|
2017-12-16 16:14:23 +00:00
|
|
|
|
2016-05-17 15:12:27 +00:00
|
|
|
/* allow the caller to drive process switching by calling
|
2017-01-09 09:54:49 +00:00
|
|
|
* moo_switchprocess(). */
|
|
|
|
#define MOO_EXTERNAL_PROCESS_SWITCH
|
2016-02-12 16:23:26 +00:00
|
|
|
|
2015-12-22 15:50:01 +00:00
|
|
|
/* limit the maximum object size such that:
|
|
|
|
* 1. an index to an object field can be represented in a small integer.
|
2015-12-24 14:11:04 +00:00
|
|
|
* 2. the maximum number of bits including bit-shifts can be represented
|
2017-01-09 09:54:49 +00:00
|
|
|
* in the moo_oow_t type.
|
2015-12-22 15:50:01 +00:00
|
|
|
*/
|
2017-01-09 09:54:49 +00:00
|
|
|
#define MOO_LIMIT_OBJ_SIZE
|
2015-12-22 15:50:01 +00:00
|
|
|
|
2017-05-12 16:38:16 +00:00
|
|
|
|
2019-11-23 04:21:07 +00:00
|
|
|
#if defined(MOO_BUILD_DEBUG)
|
|
|
|
/*#define MOO_DEBUG_LEXER 1*/
|
|
|
|
#define MOO_DEBUG_COMPILER 1
|
|
|
|
#define MOO_DEBUG_VM_PROCESSOR 1
|
|
|
|
/*#define MOO_DEBUG_VM_EXEC 1*/
|
|
|
|
#define MOO_PROFILE_VM 1
|
|
|
|
#endif /* MOO_BUILD_DEBUG */
|
|
|
|
|
|
|
|
|
2015-11-09 14:26:58 +00:00
|
|
|
#if defined(__has_builtin)
|
2018-02-21 12:59:14 +00:00
|
|
|
|
|
|
|
# if (!__has_builtin(__builtin_memset) || !__has_builtin(__builtin_memcpy) || !__has_builtin(__builtin_memmove) || !__has_builtin(__builtin_memcmp))
|
|
|
|
# include <string.h>
|
|
|
|
# endif
|
|
|
|
|
2015-11-09 14:26:58 +00:00
|
|
|
# if __has_builtin(__builtin_memset)
|
2017-01-09 09:54:49 +00:00
|
|
|
# define MOO_MEMSET(dst,src,size) __builtin_memset(dst,src,size)
|
2015-11-09 14:26:58 +00:00
|
|
|
# else
|
2017-01-09 09:54:49 +00:00
|
|
|
# define MOO_MEMSET(dst,src,size) memset(dst,src,size)
|
2015-11-09 14:26:58 +00:00
|
|
|
# endif
|
|
|
|
# if __has_builtin(__builtin_memcpy)
|
2017-01-09 09:54:49 +00:00
|
|
|
# define MOO_MEMCPY(dst,src,size) __builtin_memcpy(dst,src,size)
|
2015-11-09 14:26:58 +00:00
|
|
|
# else
|
2017-01-09 09:54:49 +00:00
|
|
|
# define MOO_MEMCPY(dst,src,size) memcpy(dst,src,size)
|
2015-11-09 14:26:58 +00:00
|
|
|
# endif
|
|
|
|
# if __has_builtin(__builtin_memmove)
|
2017-01-09 09:54:49 +00:00
|
|
|
# define MOO_MEMMOVE(dst,src,size) __builtin_memmove(dst,src,size)
|
2015-11-09 14:26:58 +00:00
|
|
|
# else
|
2017-01-09 09:54:49 +00:00
|
|
|
# define MOO_MEMMOVE(dst,src,size) memmove(dst,src,size)
|
2015-11-09 14:26:58 +00:00
|
|
|
# endif
|
|
|
|
# if __has_builtin(__builtin_memcmp)
|
2017-01-09 09:54:49 +00:00
|
|
|
# define MOO_MEMCMP(dst,src,size) __builtin_memcmp(dst,src,size)
|
2015-11-09 14:26:58 +00:00
|
|
|
# else
|
2017-01-09 09:54:49 +00:00
|
|
|
# define MOO_MEMCMP(dst,src,size) memcmp(dst,src,size)
|
2015-11-09 14:26:58 +00:00
|
|
|
# endif
|
2018-02-21 12:59:14 +00:00
|
|
|
|
2015-11-09 14:26:58 +00:00
|
|
|
#else
|
2018-02-21 12:59:14 +00:00
|
|
|
|
2019-11-24 05:11:18 +00:00
|
|
|
# if !defined(HAVE___BUILTIN_MEMSET) || !defined(HAVE___BUILTIN_MEMCPY) || !defined(HAVE___BUILTIN_MEMMOVE) || !defined(HAVE___BUILTIN_MEMCMP)
|
2018-02-21 12:59:14 +00:00
|
|
|
# include <string.h>
|
|
|
|
# endif
|
|
|
|
|
2017-04-30 05:07:08 +00:00
|
|
|
# if defined(HAVE___BUILTIN_MEMSET)
|
|
|
|
# define MOO_MEMSET(dst,src,size) __builtin_memset(dst,src,size)
|
|
|
|
# else
|
|
|
|
# define MOO_MEMSET(dst,src,size) memset(dst,src,size)
|
|
|
|
# endif
|
|
|
|
# if defined(HAVE___BUILTIN_MEMCPY)
|
|
|
|
# define MOO_MEMCPY(dst,src,size) __builtin_memcpy(dst,src,size)
|
|
|
|
# else
|
|
|
|
# define MOO_MEMCPY(dst,src,size) memcpy(dst,src,size)
|
|
|
|
# endif
|
|
|
|
# if defined(HAVE___BUILTIN_MEMMOVE)
|
|
|
|
# define MOO_MEMMOVE(dst,src,size) __builtin_memmove(dst,src,size)
|
|
|
|
# else
|
|
|
|
# define MOO_MEMMOVE(dst,src,size) memmove(dst,src,size)
|
|
|
|
# endif
|
|
|
|
# if defined(HAVE___BUILTIN_MEMCMP)
|
|
|
|
# define MOO_MEMCMP(dst,src,size) __builtin_memcmp(dst,src,size)
|
|
|
|
# else
|
|
|
|
# define MOO_MEMCMP(dst,src,size) memcmp(dst,src,size)
|
|
|
|
# endif
|
2018-02-21 12:59:14 +00:00
|
|
|
|
2015-11-09 14:26:58 +00:00
|
|
|
#endif
|
|
|
|
|
2015-11-11 13:31:05 +00:00
|
|
|
|
2015-04-30 15:56:05 +00:00
|
|
|
/* ========================================================================= */
|
2015-05-07 15:58:04 +00:00
|
|
|
/* CLASS SPEC ENCODING */
|
2015-04-30 15:56:05 +00:00
|
|
|
/* ========================================================================= */
|
|
|
|
|
|
|
|
/*
|
2015-05-03 17:10:30 +00:00
|
|
|
* The spec field of a class object encodes the number of the fixed part
|
2015-05-04 16:48:38 +00:00
|
|
|
* and the type of the indexed part. The fixed part is the number of
|
|
|
|
* named instance variables. If the spec of a class is indexed, the object
|
2017-02-13 13:40:35 +00:00
|
|
|
* of the class can be instantiated with the size of the indexed part.
|
2015-04-30 15:56:05 +00:00
|
|
|
*
|
2017-01-09 09:54:49 +00:00
|
|
|
* For example, on a platform where sizeof(moo_oow_t) is 4,
|
2015-05-04 16:48:38 +00:00
|
|
|
* the layout of the spec field of a class as an OOP value looks like this:
|
|
|
|
*
|
2019-09-22 15:59:09 +00:00
|
|
|
* 31 12 11 10 9 8 7 6 5 4 3 2 1 0
|
|
|
|
* |number of named instance variables|indexed-type|flags |oop-tag|
|
2015-05-04 16:48:38 +00:00
|
|
|
*
|
2019-09-22 15:59:09 +00:00
|
|
|
* the number of named instance variables is stored in high 21 bits.
|
|
|
|
* the indexed type takes up bit 5 to bit 10 (assuming MOO_OBJ_TYPE_BITS is 6.
|
2017-01-09 09:54:49 +00:00
|
|
|
* MOO_OBJ_TYPE_XXX enumerators are used to represent actual values).
|
2019-09-22 15:59:09 +00:00
|
|
|
* and the indexability is stored in the flag bits which span from bit 2 to 4.
|
2015-04-30 15:56:05 +00:00
|
|
|
*
|
|
|
|
* The maximum number of named(fixed) instance variables for a class is:
|
2018-01-05 17:46:10 +00:00
|
|
|
* 2 ^ ((BITS-IN-OOW - MOO_OOP_TAG_BITS_LO) - MOO_OBJ_TYPE_BITS - 1 - 2) - 1
|
2015-05-04 16:48:38 +00:00
|
|
|
*
|
2017-04-02 13:13:33 +00:00
|
|
|
* MOO_OOP_TAG_BITS_LO are decremented from the number of bits in OOW because
|
2015-05-04 16:48:38 +00:00
|
|
|
* the spec field is always encoded as a small integer.
|
2015-04-30 15:56:05 +00:00
|
|
|
*
|
2015-05-03 17:10:30 +00:00
|
|
|
* The number of named instance variables can be greater than 0 if the
|
|
|
|
* class spec is not indexed or if it's a pointer indexed class
|
2017-01-09 09:54:49 +00:00
|
|
|
* (indexed_type == MOO_OBJ_TYPE_OOP)
|
2015-05-04 16:48:38 +00:00
|
|
|
*
|
2017-01-09 09:54:49 +00:00
|
|
|
* indexed_type is one of the #moo_obj_type_t enumerators.
|
2015-05-04 16:48:38 +00:00
|
|
|
*/
|
|
|
|
|
2019-09-22 15:59:09 +00:00
|
|
|
#define MOO_CLASS_SPEC_FLAG_BITS (3)
|
|
|
|
|
2015-05-04 16:48:38 +00:00
|
|
|
/*
|
2017-01-09 09:54:49 +00:00
|
|
|
* The MOO_CLASS_SPEC_MAKE() macro creates a class spec value.
|
|
|
|
* _class->spec = MOO_SMOOI_TO_OOP(MOO_CLASS_SPEC_MAKE(0, 1, MOO_OBJ_TYPE_CHAR));
|
2015-04-30 15:56:05 +00:00
|
|
|
*/
|
2017-05-07 05:18:21 +00:00
|
|
|
#define MOO_CLASS_SPEC_MAKE(named_instvar,flags,indexed_type) ( \
|
2019-09-22 15:59:09 +00:00
|
|
|
(((moo_oow_t)(named_instvar)) << (MOO_OBJ_FLAGS_TYPE_BITS + MOO_CLASS_SPEC_FLAG_BITS)) | \
|
|
|
|
(((moo_oow_t)(indexed_type)) << (MOO_CLASS_SPEC_FLAG_BITS)) | (((moo_oow_t)flags) & MOO_LBMASK(moo_oow_t,MOO_CLASS_SPEC_FLAG_BITS)))
|
2015-04-30 15:56:05 +00:00
|
|
|
|
2015-05-04 16:48:38 +00:00
|
|
|
/* what is the number of named instance variables?
|
2017-05-08 16:00:55 +00:00
|
|
|
* MOO_CLASS_SPEC_NAMED_INSTVARS(MOO_OOP_TO_SMOOI(_class->spec))
|
|
|
|
* ensure to update Class<<specNumInstVars if you change this macro. */
|
2017-05-01 12:54:41 +00:00
|
|
|
#define MOO_CLASS_SPEC_NAMED_INSTVARS(spec) \
|
2019-09-22 15:59:09 +00:00
|
|
|
(((moo_oow_t)(spec)) >> (MOO_OBJ_FLAGS_TYPE_BITS + MOO_CLASS_SPEC_FLAG_BITS))
|
2015-05-03 17:10:30 +00:00
|
|
|
|
|
|
|
/* is it a user-indexable class?
|
|
|
|
* all objects can be indexed with basicAt:.
|
|
|
|
* this indicates if an object can be instantiated with a dynamic size
|
|
|
|
* (new: size) and and can be indexed with at:.
|
|
|
|
*/
|
2019-09-22 15:59:09 +00:00
|
|
|
#define MOO_CLASS_SPEC_FLAGS(spec) (((moo_oow_t)(spec)) & MOO_LBMASK(moo_oow_t,MOO_CLASS_SPEC_FLAG_BITS))
|
2015-04-30 15:56:05 +00:00
|
|
|
|
2015-05-03 17:10:30 +00:00
|
|
|
/* if so, what is the indexing type? character? pointer? etc? */
|
2017-01-09 09:54:49 +00:00
|
|
|
#define MOO_CLASS_SPEC_INDEXED_TYPE(spec) \
|
2019-09-22 15:59:09 +00:00
|
|
|
((((moo_oow_t)(spec)) >> MOO_CLASS_SPEC_FLAG_BITS) & MOO_LBMASK(moo_oow_t, MOO_OBJ_FLAGS_TYPE_BITS))
|
2017-05-07 05:18:21 +00:00
|
|
|
|
2019-09-22 15:59:09 +00:00
|
|
|
#define MOO_CLASS_SPEC_FLAG_INDEXED (1 << 0)
|
|
|
|
#define MOO_CLASS_SPEC_FLAG_IMMUTABLE (1 << 1)
|
|
|
|
#define MOO_CLASS_SPEC_FLAG_UNCOPYABLE (1 << 2)
|
2017-05-07 05:18:21 +00:00
|
|
|
|
|
|
|
#define MOO_CLASS_SPEC_IS_INDEXED(spec) (MOO_CLASS_SPEC_FLAGS(spec) & MOO_CLASS_SPEC_FLAG_INDEXED)
|
|
|
|
#define MOO_CLASS_SPEC_IS_IMMUTABLE(spec) (MOO_CLASS_SPEC_FLAGS(spec) & MOO_CLASS_SPEC_FLAG_IMMUTABLE)
|
2019-09-22 15:59:09 +00:00
|
|
|
#define MOO_CLASS_SPEC_IS_UNCOPYABLE(spec) (MOO_CLASS_SPEC_FLAGS(spec) & MOO_CLASS_SPEC_FLAG_UNCOPYABLE)
|
2015-05-04 16:48:38 +00:00
|
|
|
|
|
|
|
/* What is the maximum number of named instance variables?
|
2018-01-05 17:46:10 +00:00
|
|
|
* This limit is set this way because the number must be encoded into
|
|
|
|
* the spec field of the class with limited number of bits assigned to
|
|
|
|
* the number of named instance variables.
|
2015-05-04 16:48:38 +00:00
|
|
|
*/
|
2017-01-09 09:54:49 +00:00
|
|
|
#define MOO_MAX_NAMED_INSTVARS \
|
2019-09-22 15:59:09 +00:00
|
|
|
MOO_BITS_MAX(moo_oow_t, MOO_SMOOI_ABS_BITS - (MOO_OBJ_FLAGS_TYPE_BITS + MOO_CLASS_SPEC_FLAG_BITS))
|
2015-05-03 17:10:30 +00:00
|
|
|
|
|
|
|
/* Given the number of named instance variables, what is the maximum number
|
2015-05-04 16:48:38 +00:00
|
|
|
* of indexed instance variables? The number of indexed instance variables
|
|
|
|
* is not stored in the spec field of the class. It only affects the actual
|
|
|
|
* size of an object(obj->_size) selectively combined with the number of
|
|
|
|
* named instance variables. So it's the maximum value of obj->_size minus
|
|
|
|
* the number of named instance variables.
|
|
|
|
*/
|
2017-01-09 09:54:49 +00:00
|
|
|
#define MOO_MAX_INDEXED_INSTVARS(named_instvar) (MOO_OBJ_SIZE_MAX - named_instvar)
|
2015-05-15 14:55:12 +00:00
|
|
|
|
2015-06-04 18:34:37 +00:00
|
|
|
/*
|
2017-05-01 12:54:41 +00:00
|
|
|
* self-specification of a class
|
|
|
|
* | classinstvars | classvars | flags |
|
|
|
|
*
|
|
|
|
* When converted to a small integer
|
|
|
|
* | sign-bit | classinstvars | classvars | flags | tag |
|
2015-06-04 18:34:37 +00:00
|
|
|
*/
|
2017-05-01 12:54:41 +00:00
|
|
|
#define MOO_CLASS_SELFSPEC_FLAG_BITS (3)
|
|
|
|
#define MOO_CLASS_SELFSPEC_CLASSINSTVAR_BITS ((MOO_SMOOI_ABS_BITS - MOO_CLASS_SELFSPEC_FLAG_BITS) / 2)
|
|
|
|
#define MOO_CLASS_SELFSPEC_CLASSVAR_BITS (MOO_SMOOI_ABS_BITS - (MOO_CLASS_SELFSPEC_CLASSINSTVAR_BITS + MOO_CLASS_SELFSPEC_FLAG_BITS))
|
|
|
|
|
|
|
|
#define MOO_CLASS_SELFSPEC_MAKE(class_var,classinst_var,flag) \
|
|
|
|
((((moo_oow_t)class_var) << (MOO_CLASS_SELFSPEC_CLASSINSTVAR_BITS + MOO_CLASS_SELFSPEC_FLAG_BITS)) | \
|
|
|
|
(((moo_oow_t)classinst_var) << (MOO_CLASS_SELFSPEC_FLAG_BITS)) | \
|
|
|
|
(((moo_oow_t)flag) << (0)))
|
|
|
|
|
|
|
|
#define MOO_CLASS_SELFSPEC_CLASSVARS(spec) \
|
|
|
|
(((moo_oow_t)spec) >> (MOO_CLASS_SELFSPEC_CLASSINSTVAR_BITS + MOO_CLASS_SELFSPEC_FLAG_BITS))
|
|
|
|
|
|
|
|
#define MOO_CLASS_SELFSPEC_CLASSINSTVARS(spec) \
|
|
|
|
((((moo_oow_t)spec) >> MOO_CLASS_SELFSPEC_FLAG_BITS) & MOO_LBMASK(moo_oow_t, MOO_CLASS_SELFSPEC_CLASSINSTVAR_BITS))
|
|
|
|
|
|
|
|
#define MOO_CLASS_SELFSPEC_FLAGS(spec) \
|
|
|
|
(((moo_oow_t)spec) & MOO_LBMASK(moo_oow_t, MOO_CLASS_SELFSPEC_FLAG_BITS))
|
|
|
|
|
|
|
|
#define MOO_CLASS_SELFSPEC_FLAG_FINAL (1 << 0)
|
|
|
|
#define MOO_CLASS_SELFSPEC_FLAG_LIMITED (1 << 1)
|
|
|
|
|
|
|
|
|
|
|
|
#define MOO_MAX_CLASSVARS MOO_BITS_MAX(moo_oow_t, MOO_CLASS_SELFSPEC_CLASSVAR_BITS)
|
|
|
|
#define MOO_MAX_CLASSINSTVARS MOO_BITS_MAX(moo_oow_t, MOO_CLASS_SELFSPEC_CLASSINSTVAR_BITS)
|
2015-05-26 16:31:47 +00:00
|
|
|
|
2015-12-22 15:50:01 +00:00
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
#if defined(MOO_LIMIT_OBJ_SIZE)
|
2015-12-22 15:50:01 +00:00
|
|
|
/* limit the maximum object size such that:
|
|
|
|
* 1. an index to an object field can be represented in a small integer.
|
2017-01-09 09:54:49 +00:00
|
|
|
* 2. the maximum number of bit shifts can be represented in the moo_oow_t type.
|
2015-12-22 15:50:01 +00:00
|
|
|
*/
|
2017-01-09 09:54:49 +00:00
|
|
|
# define MOO_OBJ_SIZE_MAX ((moo_oow_t)MOO_SMOOI_MAX)
|
2019-05-04 04:27:27 +00:00
|
|
|
# define MOO_OBJ_SIZE_BITS_MAX (MOO_OBJ_SIZE_MAX * MOO_BITS_PER_BYTE)
|
2015-12-22 15:50:01 +00:00
|
|
|
#else
|
2017-01-09 09:54:49 +00:00
|
|
|
# define MOO_OBJ_SIZE_MAX ((moo_oow_t)MOO_TYPE_MAX(moo_oow_t))
|
2019-05-04 04:27:27 +00:00
|
|
|
# define MOO_OBJ_SIZE_BITS_MAX (MOO_OBJ_SIZE_MAX * MOO_BITS_PER_BYTE)
|
2015-12-22 15:50:01 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2018-12-21 16:25:25 +00:00
|
|
|
#define MOO_OOP_IS_PBIGINT(moo,x) (MOO_CLASSOF(moo,x) == (moo)->_large_positive_integer)
|
|
|
|
#define MOO_OOP_IS_NBIGINT(moo,x) (MOO_CLASSOF(moo,x) == (moo)->_large_negative_integer)
|
|
|
|
#define MOO_OOP_IS_BIGINT(moo,x) (MOO_OOP_IS_PBIGINT(moo,x) || MOO_OOP_IS_NBIGINT(moo,x))
|
|
|
|
|
|
|
|
#define MOO_POINTER_IS_PBIGINT(moo,x) (MOO_OBJ_GET_CLASS(x) == (moo)->_large_positive_integer)
|
|
|
|
#define MOO_POINTER_IS_NBIGINT(moo,x) (MOO_OBJ_GET_CLASS(x) == (moo)->_large_negative_integer)
|
|
|
|
#define MOO_POINTER_IS_BIGINT(moo,x) (MOO_OOP_IS_PBIGINT(moo,x) || MOO_OOP_IS_NBIGINT(moo,x))
|
|
|
|
|
|
|
|
#define MOO_OOP_IS_FPDEC(moo,x) (MOO_CLASSOF(moo,x) == (moo)->_fixed_point_decimal)
|
|
|
|
#define MOO_POINTER_IS_FPDEC(moo,x) (MOO_OBJ_GET_CLASS(x) == (moo)->_fixed_point_Decimal)
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
#if defined(MOO_INCLUDE_COMPILER)
|
2015-05-15 14:55:12 +00:00
|
|
|
|
|
|
|
/* ========================================================================= */
|
|
|
|
/* SOURCE CODE I/O FOR COMPILER */
|
|
|
|
/* ========================================================================= */
|
|
|
|
|
2018-02-26 15:30:38 +00:00
|
|
|
enum moo_iotok_type_t
|
2015-05-19 15:16:18 +00:00
|
|
|
{
|
2018-02-26 15:30:38 +00:00
|
|
|
MOO_IOTOK_EOF,
|
2019-07-17 17:04:27 +00:00
|
|
|
|
2018-02-26 15:30:38 +00:00
|
|
|
MOO_IOTOK_CHARLIT,
|
|
|
|
MOO_IOTOK_STRLIT,
|
|
|
|
MOO_IOTOK_SYMLIT,
|
2019-01-09 09:55:27 +00:00
|
|
|
MOO_IOTOK_INTLIT,
|
|
|
|
MOO_IOTOK_RADINTLIT,
|
|
|
|
MOO_IOTOK_FPDECLIT,
|
2019-02-18 17:13:33 +00:00
|
|
|
MOO_IOTOK_SCALEDFPDECLIT, /* NNpNNNN.NN e.g. 5p10.3 ===> 10.30000 */
|
2018-05-13 18:55:22 +00:00
|
|
|
MOO_IOTOK_ERRLIT, /* #\eNN */
|
|
|
|
MOO_IOTOK_SMPTRLIT, /* #\pXX */
|
2019-06-27 07:43:17 +00:00
|
|
|
MOO_IOTOK_BYTEARRAYLIT, /* B"ab\x99\x77" */
|
2018-02-26 15:30:38 +00:00
|
|
|
|
|
|
|
MOO_IOTOK_NIL,
|
|
|
|
MOO_IOTOK_SELF,
|
|
|
|
MOO_IOTOK_SUPER,
|
|
|
|
MOO_IOTOK_TRUE,
|
|
|
|
MOO_IOTOK_FALSE,
|
|
|
|
MOO_IOTOK_THIS_CONTEXT,
|
|
|
|
MOO_IOTOK_THIS_PROCESS,
|
|
|
|
MOO_IOTOK_SELFNS,
|
|
|
|
|
|
|
|
MOO_IOTOK_IF,
|
2018-06-19 16:11:20 +00:00
|
|
|
MOO_IOTOK_IFNOT,
|
2018-02-26 15:30:38 +00:00
|
|
|
MOO_IOTOK_ELSE,
|
2019-07-26 04:40:33 +00:00
|
|
|
MOO_IOTOK_ELIF,
|
|
|
|
MOO_IOTOK_ELIFNOT,
|
2018-02-26 15:30:38 +00:00
|
|
|
|
|
|
|
MOO_IOTOK_WHILE,
|
|
|
|
MOO_IOTOK_UNTIL,
|
|
|
|
MOO_IOTOK_DO,
|
|
|
|
MOO_IOTOK_BREAK,
|
|
|
|
MOO_IOTOK_CONTINUE,
|
2019-07-26 04:40:33 +00:00
|
|
|
MOO_IOTOK_GOTO,
|
2018-02-26 15:30:38 +00:00
|
|
|
|
2018-05-30 11:31:26 +00:00
|
|
|
MOO_IOTOK_AND,
|
|
|
|
MOO_IOTOK_OR,
|
|
|
|
|
2018-02-26 15:30:38 +00:00
|
|
|
MOO_IOTOK_IDENT,
|
|
|
|
MOO_IOTOK_IDENT_DOTTED,
|
|
|
|
MOO_IOTOK_BINSEL,
|
2019-07-17 09:52:26 +00:00
|
|
|
MOO_IOTOK_KEYWORD, /* word ending with : such as basicAt:*/
|
2018-02-26 15:30:38 +00:00
|
|
|
MOO_IOTOK_ASSIGN, /* := */
|
|
|
|
MOO_IOTOK_COLON, /* : */
|
2019-06-27 07:43:17 +00:00
|
|
|
MOO_IOTOK_DHASH, /* ## */
|
2018-02-26 15:30:38 +00:00
|
|
|
MOO_IOTOK_RETURN, /* ^ */
|
|
|
|
MOO_IOTOK_LOCAL_RETURN, /* ^^ */
|
|
|
|
MOO_IOTOK_LBRACE,
|
|
|
|
MOO_IOTOK_RBRACE,
|
|
|
|
MOO_IOTOK_LBRACK,
|
|
|
|
MOO_IOTOK_RBRACK,
|
|
|
|
MOO_IOTOK_LPAREN,
|
|
|
|
MOO_IOTOK_RPAREN,
|
|
|
|
MOO_IOTOK_HASHPAREN, /* #( - array literal */
|
|
|
|
MOO_IOTOK_HASHBRACK, /* #[ - byte array literal */
|
2018-04-19 09:48:45 +00:00
|
|
|
MOO_IOTOK_HASHBRACE, /* #{ - dictionary literal */
|
2019-06-27 07:43:17 +00:00
|
|
|
MOO_IOTOK_DHASHPAREN, /* #( - array expression */
|
|
|
|
MOO_IOTOK_DHASHBRACK, /* #[ - byte array expression */
|
|
|
|
MOO_IOTOK_DHASHBRACE, /* #{ - dictionary expression */
|
2018-02-26 15:30:38 +00:00
|
|
|
MOO_IOTOK_PERIOD,
|
|
|
|
MOO_IOTOK_COMMA,
|
|
|
|
MOO_IOTOK_SEMICOLON
|
|
|
|
};
|
|
|
|
typedef enum moo_iotok_type_t moo_iotok_type_t;
|
2015-05-19 15:16:18 +00:00
|
|
|
|
2018-02-26 15:30:38 +00:00
|
|
|
struct moo_iotok_t
|
|
|
|
{
|
|
|
|
moo_iotok_type_t type;
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oocs_t name;
|
|
|
|
moo_oow_t name_capa;
|
|
|
|
moo_ioloc_t loc;
|
2015-05-19 15:16:18 +00:00
|
|
|
};
|
2017-01-09 09:54:49 +00:00
|
|
|
typedef struct moo_iotok_t moo_iotok_t;
|
2015-05-19 15:16:18 +00:00
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
typedef struct moo_iolink_t moo_iolink_t;
|
|
|
|
struct moo_iolink_t
|
2015-05-19 15:16:18 +00:00
|
|
|
{
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_iolink_t* link;
|
2015-05-19 15:16:18 +00:00
|
|
|
};
|
|
|
|
|
2017-01-27 15:25:46 +00:00
|
|
|
typedef struct moo_code_t moo_code_t;
|
2017-01-09 09:54:49 +00:00
|
|
|
struct moo_code_t
|
2015-05-22 15:09:45 +00:00
|
|
|
{
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_uint8_t* ptr;
|
|
|
|
moo_oow_t len;
|
2019-07-02 09:48:56 +00:00
|
|
|
moo_oow_t capa;
|
|
|
|
|
|
|
|
/* array that hold the location of the byte code emitted */
|
|
|
|
moo_oow_t* locptr;
|
2015-05-22 15:09:45 +00:00
|
|
|
};
|
2017-01-27 15:25:46 +00:00
|
|
|
|
2017-01-29 07:14:36 +00:00
|
|
|
typedef struct moo_oow_pool_chunk_t moo_oow_pool_chunk_t;
|
|
|
|
struct moo_oow_pool_chunk_t
|
|
|
|
{
|
2019-08-07 05:33:35 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
moo_oow_t v;
|
|
|
|
moo_ioloc_t loc;
|
|
|
|
} buf[16];
|
2017-01-29 07:14:36 +00:00
|
|
|
moo_oow_pool_chunk_t* next;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct moo_oow_pool_t moo_oow_pool_t;
|
|
|
|
struct moo_oow_pool_t
|
|
|
|
{
|
|
|
|
moo_oow_pool_chunk_t static_chunk;
|
|
|
|
moo_oow_pool_chunk_t* head;
|
|
|
|
moo_oow_pool_chunk_t* tail;
|
|
|
|
moo_oow_t count;
|
|
|
|
};
|
|
|
|
|
2017-01-30 16:48:42 +00:00
|
|
|
enum moo_loop_type_t
|
|
|
|
{
|
|
|
|
MOO_LOOP_WHILE,
|
|
|
|
MOO_LOOP_DO_WHILE
|
|
|
|
};
|
|
|
|
typedef enum moo_loop_type_t moo_loop_type_t;
|
|
|
|
|
2017-01-27 15:25:46 +00:00
|
|
|
typedef struct moo_loop_t moo_loop_t;
|
|
|
|
struct moo_loop_t
|
|
|
|
{
|
2017-01-30 16:48:42 +00:00
|
|
|
moo_loop_type_t type;
|
2017-01-27 15:25:46 +00:00
|
|
|
moo_oow_t startpos;
|
2017-01-30 16:48:42 +00:00
|
|
|
moo_oow_pool_t break_ip_pool; /* a pool that holds jump instruction pointers for break */
|
|
|
|
moo_oow_pool_t continue_ip_pool; /* a pool that hold jump instructino pointers for continue. only for do-while */
|
2017-01-29 07:14:36 +00:00
|
|
|
moo_oow_t blkcount; /* number of inner blocks enclosed in square brackets */
|
2017-01-27 15:25:46 +00:00
|
|
|
moo_loop_t* next;
|
|
|
|
};
|
2015-05-22 15:09:45 +00:00
|
|
|
|
2019-07-18 15:51:55 +00:00
|
|
|
typedef struct moo_label_t moo_label_t;
|
|
|
|
struct moo_label_t
|
|
|
|
{
|
2019-08-07 09:16:28 +00:00
|
|
|
moo_oow_t blk_id; /* block id where this label belongs to */
|
|
|
|
moo_oow_t blk_depth; /* level of the block where thsi label belongs to */
|
|
|
|
moo_ioloc_t loc; /* location inside source */
|
|
|
|
moo_oow_t ip; /* instruction pointer where this label points to */
|
2019-07-18 15:51:55 +00:00
|
|
|
moo_label_t* next;
|
2019-07-28 15:37:01 +00:00
|
|
|
/* ... label name at the back ... */
|
2019-07-18 15:51:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct moo_goto_t moo_goto_t;
|
|
|
|
struct moo_goto_t
|
|
|
|
{
|
2019-08-07 09:16:28 +00:00
|
|
|
moo_oow_t blk_id;
|
|
|
|
moo_oow_t blk_depth;
|
2019-08-01 16:05:04 +00:00
|
|
|
moo_ioloc_t loc;
|
2019-07-26 07:40:58 +00:00
|
|
|
moo_oow_t ip;
|
2019-07-18 15:51:55 +00:00
|
|
|
moo_goto_t* next;
|
2019-07-28 15:37:01 +00:00
|
|
|
/* ... target label name at the back ... */
|
2019-07-18 15:51:55 +00:00
|
|
|
};
|
|
|
|
|
2017-05-16 15:01:31 +00:00
|
|
|
typedef struct moo_oopbuf_t moo_oopbuf_t;
|
|
|
|
struct moo_oopbuf_t
|
|
|
|
{
|
|
|
|
moo_oop_t* ptr;
|
|
|
|
moo_oow_t count;
|
|
|
|
moo_oow_t capa;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct moo_oobbuf_t moo_oobbuf_t;
|
|
|
|
struct moo_oobbuf_t
|
|
|
|
{
|
|
|
|
moo_oob_t* ptr;
|
|
|
|
moo_oow_t count;
|
|
|
|
moo_oow_t capa;
|
|
|
|
};
|
|
|
|
|
2017-06-01 15:42:05 +00:00
|
|
|
typedef struct moo_initv_t moo_initv_t;
|
|
|
|
struct moo_initv_t
|
|
|
|
{
|
|
|
|
moo_oop_t v;
|
|
|
|
int flags;
|
|
|
|
};
|
|
|
|
|
2017-11-26 06:45:59 +00:00
|
|
|
enum moo_pragma_flag_t
|
|
|
|
{
|
2019-05-30 15:44:24 +00:00
|
|
|
MOO_PRAGMA_QC = (1 << 0) /* quoted commented. treat a double quoted text as a comment */
|
2017-11-26 06:45:59 +00:00
|
|
|
};
|
|
|
|
|
2018-09-30 16:06:19 +00:00
|
|
|
enum moo_cunit_type_t
|
|
|
|
{
|
2019-10-03 16:38:15 +00:00
|
|
|
/* [NOTE] get_cunit_method_data() in comp.c depends on the order of the
|
|
|
|
* following enumerators */
|
2018-09-30 16:06:19 +00:00
|
|
|
MOO_CUNIT_BLANK = 0,
|
2018-10-08 16:00:14 +00:00
|
|
|
MOO_CUNIT_POOLDIC,
|
2018-09-30 16:06:19 +00:00
|
|
|
MOO_CUNIT_CLASS,
|
2018-10-08 16:00:14 +00:00
|
|
|
MOO_CUNIT_INTERFACE
|
2018-09-30 16:06:19 +00:00
|
|
|
};
|
|
|
|
typedef enum moo_cunit_type_t moo_cunit_type_t;
|
|
|
|
|
|
|
|
#define MOO_CUNIT_HEADER \
|
|
|
|
moo_cunit_type_t cunit_type; \
|
|
|
|
moo_cunit_t* cunit_parent
|
|
|
|
|
|
|
|
typedef struct moo_cunit_t moo_cunit_t;
|
|
|
|
struct moo_cunit_t
|
|
|
|
{
|
|
|
|
MOO_CUNIT_HEADER;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct moo_cunit_pooldic_t moo_cunit_pooldic_t;
|
|
|
|
struct moo_cunit_pooldic_t
|
|
|
|
{
|
|
|
|
MOO_CUNIT_HEADER;
|
|
|
|
|
|
|
|
moo_oocs_t name;
|
|
|
|
moo_oocs_t fqn;
|
|
|
|
moo_oow_t fqn_capa;
|
|
|
|
moo_ioloc_t fqn_loc;
|
|
|
|
|
|
|
|
moo_oop_dic_t pd_oop;
|
|
|
|
moo_oop_nsdic_t ns_oop;
|
|
|
|
|
|
|
|
moo_oow_t start;
|
|
|
|
moo_oow_t end;
|
|
|
|
};
|
|
|
|
|
2018-10-05 16:25:17 +00:00
|
|
|
typedef struct moo_pooldic_import_data_t moo_pooldic_import_data_t;
|
|
|
|
struct moo_pooldic_import_data_t
|
2018-09-30 16:06:19 +00:00
|
|
|
{
|
2018-10-05 16:25:17 +00:00
|
|
|
moo_oocs_t dcl;
|
2019-10-04 09:41:43 +00:00
|
|
|
moo_oow_t dcl_capa; /* capacity of the dcl string */
|
|
|
|
moo_oopbuf_t dics; /* dictionary objects imported */
|
2018-09-30 16:06:19 +00:00
|
|
|
};
|
|
|
|
|
2019-07-02 09:48:56 +00:00
|
|
|
/* data kept by compiler to complie a method */
|
2018-10-05 16:25:17 +00:00
|
|
|
typedef struct moo_method_data_t moo_method_data_t;
|
|
|
|
struct moo_method_data_t
|
2018-09-30 16:06:19 +00:00
|
|
|
{
|
|
|
|
int active;
|
|
|
|
|
|
|
|
moo_method_type_t type;
|
|
|
|
int primitive; /* true if method(#primitive) */
|
|
|
|
int lenient; /* true if method(#lenient) */
|
|
|
|
|
|
|
|
/* method source text */
|
|
|
|
moo_oocs_t text;
|
|
|
|
moo_oow_t text_capa;
|
|
|
|
|
|
|
|
/* buffer to store identifier names to be assigned */
|
|
|
|
moo_oocs_t assignees;
|
|
|
|
moo_oow_t assignees_capa;
|
|
|
|
|
|
|
|
/* buffer to store binary selectors being worked on */
|
|
|
|
moo_oocs_t binsels;
|
|
|
|
moo_oow_t binsels_capa;
|
|
|
|
|
|
|
|
/* buffer to store keyword selectors being worked on */
|
|
|
|
moo_oocs_t kwsels;
|
|
|
|
moo_oow_t kwsels_capa;
|
|
|
|
|
|
|
|
/* method name */
|
|
|
|
moo_oocs_t name;
|
|
|
|
moo_oow_t name_capa;
|
|
|
|
moo_ioloc_t name_loc;
|
2019-07-12 08:05:44 +00:00
|
|
|
moo_ioloc_t start_loc; /* location where the method definition begins */
|
2018-09-30 16:06:19 +00:00
|
|
|
|
|
|
|
/* is the unary method followed by parameter list? */
|
|
|
|
int variadic;
|
|
|
|
|
|
|
|
/* single string containing a space separated list of temporaries */
|
|
|
|
moo_oocs_t tmprs;
|
|
|
|
moo_oow_t tmprs_capa;
|
|
|
|
moo_oow_t tmpr_count; /* total number of temporaries including arguments */
|
|
|
|
moo_oow_t tmpr_nargs;
|
|
|
|
|
|
|
|
/* literals */
|
|
|
|
moo_oopbuf_t literals;
|
|
|
|
|
|
|
|
/* 0 for no primitive, 1 for a normal primitive, 2 for a named primitive */
|
|
|
|
int pftype;
|
|
|
|
/* primitive function number */
|
|
|
|
moo_ooi_t pfnum;
|
|
|
|
|
2019-07-31 08:53:44 +00:00
|
|
|
/* block depth - [ ... ]*/
|
2019-08-07 09:16:28 +00:00
|
|
|
moo_oow_t blk_idseq;
|
|
|
|
moo_oow_t blk_id;
|
2018-09-30 16:06:19 +00:00
|
|
|
moo_oow_t blk_depth;
|
|
|
|
moo_oow_t* blk_tmprcnt;
|
|
|
|
moo_oow_t blk_tmprcnt_capa;
|
|
|
|
|
|
|
|
/* information about loop constructs */
|
|
|
|
moo_loop_t* loop;
|
|
|
|
|
2019-07-18 15:51:55 +00:00
|
|
|
moo_goto_t* _goto;
|
|
|
|
moo_label_t* _label;
|
|
|
|
|
2018-09-30 16:06:19 +00:00
|
|
|
/* byte code */
|
|
|
|
moo_code_t code;
|
|
|
|
};
|
|
|
|
|
2018-10-05 16:25:17 +00:00
|
|
|
typedef struct moo_cunit_class_t moo_cunit_class_t;
|
|
|
|
struct moo_cunit_class_t
|
|
|
|
{
|
|
|
|
MOO_CUNIT_HEADER;
|
|
|
|
|
|
|
|
int flags;
|
|
|
|
int indexed_type;
|
|
|
|
|
|
|
|
/* fixed instance size specified for a non-pointer class. class(#byte(N)), etc */
|
|
|
|
moo_oow_t non_pointer_instsize;
|
|
|
|
|
|
|
|
moo_oop_class_t self_oop;
|
|
|
|
moo_oop_t super_oop; /* this may be nil. so the type is moo_oop_t */
|
|
|
|
moo_oop_nsdic_t ns_oop;
|
|
|
|
moo_oocs_t fqn;
|
|
|
|
moo_oocs_t name;
|
|
|
|
moo_oow_t fqn_capa;
|
|
|
|
moo_ioloc_t fqn_loc;
|
|
|
|
|
|
|
|
moo_oop_nsdic_t superns_oop;
|
|
|
|
moo_oocs_t superfqn;
|
|
|
|
moo_oocs_t supername;
|
|
|
|
moo_oow_t superfqn_capa;
|
|
|
|
moo_ioloc_t superfqn_loc;
|
|
|
|
|
|
|
|
moo_oocs_t modname; /* module name after 'from' */
|
|
|
|
moo_oow_t modname_capa;
|
|
|
|
moo_ioloc_t modname_loc;
|
|
|
|
|
2019-10-10 15:06:08 +00:00
|
|
|
moo_oopbuf_t ifces; /* interfaces that this class implement */
|
|
|
|
moo_oopbuf_t ifce_mths[2]; /* interface methods that this class needs to take */
|
2018-10-12 09:09:45 +00:00
|
|
|
int in_class_body; /* set to non-zero after '{' has been encountered */
|
2018-10-11 10:01:34 +00:00
|
|
|
|
2018-10-05 16:25:17 +00:00
|
|
|
/* instance variable, class variable, class instance variable, constant
|
|
|
|
* var[0] - named instance variables
|
|
|
|
* var[1] - class instance variables
|
|
|
|
* var[2] - class variables
|
|
|
|
*/
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
moo_oocs_t str; /* long string containing all variables declared delimited by a space */
|
|
|
|
moo_oow_t str_capa;
|
|
|
|
|
|
|
|
moo_oow_t count; /* the number of variables declared in this class only */
|
|
|
|
moo_oow_t total_count; /* the number of variables declared in this class and superclasses */
|
|
|
|
|
|
|
|
moo_initv_t* initv;
|
|
|
|
moo_oow_t initv_capa;
|
|
|
|
/* initv_count holds the index to the last variable with a
|
|
|
|
* default initial value defined in this class only plus one.
|
|
|
|
* inheritance is handled by the compiler separately using
|
|
|
|
* the reference to the superclass. so it doesn't include
|
|
|
|
* the variables defined in the superclass chain.
|
|
|
|
* for a definition: class ... { var a, b := 0, c },
|
|
|
|
* initv_count is set to 2 while count is 3. totoal_count
|
|
|
|
* will be 3 too if there is no variabled defined in the
|
|
|
|
* superclass chain. */
|
|
|
|
moo_oow_t initv_count;
|
|
|
|
} var[3];
|
|
|
|
|
2019-07-10 09:19:38 +00:00
|
|
|
moo_oow_t dbgi_class_offset;
|
|
|
|
|
2018-10-05 16:25:17 +00:00
|
|
|
moo_pooldic_import_data_t pdimp;
|
|
|
|
moo_method_data_t mth;
|
|
|
|
};
|
|
|
|
|
2018-10-08 16:00:14 +00:00
|
|
|
typedef struct moo_cunit_interface_t moo_cunit_interface_t;
|
|
|
|
struct moo_cunit_interface_t
|
|
|
|
{
|
|
|
|
MOO_CUNIT_HEADER;
|
|
|
|
|
2018-10-09 15:21:58 +00:00
|
|
|
moo_oop_interface_t self_oop;
|
2018-10-08 16:00:14 +00:00
|
|
|
moo_oop_nsdic_t ns_oop;
|
|
|
|
moo_oocs_t fqn;
|
|
|
|
moo_oocs_t name;
|
|
|
|
moo_oow_t fqn_capa;
|
|
|
|
moo_ioloc_t fqn_loc;
|
|
|
|
|
2019-10-04 09:41:43 +00:00
|
|
|
moo_oow_t dbgi_interface_offset;
|
2018-10-09 15:21:58 +00:00
|
|
|
moo_method_data_t mth;
|
2018-10-08 16:00:14 +00:00
|
|
|
};
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
struct moo_compiler_t
|
2015-05-15 14:55:12 +00:00
|
|
|
{
|
2017-11-26 06:45:59 +00:00
|
|
|
int pragma_flags;
|
|
|
|
|
2015-05-19 15:16:18 +00:00
|
|
|
/* input handler */
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_ioimpl_t impl;
|
2019-07-10 09:19:38 +00:00
|
|
|
moo_ooch_t* iid; /* input id that represents the current main input file */
|
2015-05-19 15:16:18 +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 */
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_iolxc_t lxc;
|
2015-05-19 15:16:18 +00:00
|
|
|
|
|
|
|
/* unget buffer */
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_iolxc_t ungot[10];
|
2017-01-12 10:06:43 +00:00
|
|
|
int nungots;
|
2015-05-19 15:16:18 +00:00
|
|
|
|
|
|
|
/* static input data buffer */
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_ioarg_t arg;
|
2015-05-19 15:16:18 +00:00
|
|
|
|
|
|
|
/* pointer to the current input data. initially, it points to &arg */
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_ioarg_t* curinp;
|
2015-05-19 15:16:18 +00:00
|
|
|
|
|
|
|
/* the last token read */
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_iotok_t tok;
|
|
|
|
moo_iolink_t* io_names;
|
2015-05-19 15:16:18 +00:00
|
|
|
|
2017-05-20 02:27:48 +00:00
|
|
|
/* syntax error information */
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_synerr_t synerr;
|
2018-10-08 06:51:31 +00:00
|
|
|
moo_ooch_t synerr_tgtbuf[256];
|
2015-05-19 15:16:18 +00:00
|
|
|
|
2017-05-16 15:01:31 +00:00
|
|
|
/* temporary space used when dealing with an illegal character */
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_ooch_t ilchr;
|
|
|
|
moo_oocs_t ilchr_ucs;
|
2015-05-21 17:07:55 +00:00
|
|
|
|
2017-05-16 15:01:31 +00:00
|
|
|
/* workspace to use when reading byte array elements */
|
|
|
|
moo_oobbuf_t balit;
|
|
|
|
|
|
|
|
/* workspace space to use when reading an array */
|
|
|
|
moo_oopbuf_t arlit;
|
|
|
|
|
2018-09-30 16:06:19 +00:00
|
|
|
/* the current compilation unit being processed */
|
|
|
|
moo_cunit_t* cunit;
|
2015-05-15 14:55:12 +00:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
#if defined(MOO_BCODE_LONG_PARAM_SIZE) && (MOO_BCODE_LONG_PARAM_SIZE == 1)
|
2015-06-23 14:00:26 +00:00
|
|
|
# define MAX_CODE_INDEX (0xFFu)
|
|
|
|
# define MAX_CODE_NTMPRS (0xFFu)
|
|
|
|
# define MAX_CODE_NARGS (0xFFu)
|
|
|
|
# define MAX_CODE_NBLKARGS (0xFFu)
|
|
|
|
# define MAX_CODE_NBLKTMPRS (0xFFu)
|
2015-07-01 07:21:54 +00:00
|
|
|
# define MAX_CODE_JUMP (0xFFu)
|
2015-07-02 15:45:48 +00:00
|
|
|
# define MAX_CODE_PARAM (0xFFu)
|
2017-01-09 09:54:49 +00:00
|
|
|
#elif defined(MOO_BCODE_LONG_PARAM_SIZE) && (MOO_BCODE_LONG_PARAM_SIZE == 2)
|
2015-06-23 14:00:26 +00:00
|
|
|
# define MAX_CODE_INDEX (0xFFFFu)
|
|
|
|
# define MAX_CODE_NTMPRS (0xFFFFu)
|
|
|
|
# define MAX_CODE_NARGS (0xFFFFu)
|
|
|
|
# define MAX_CODE_NBLKARGS (0xFFFFu)
|
|
|
|
# define MAX_CODE_NBLKTMPRS (0xFFFFu)
|
2015-07-01 07:21:54 +00:00
|
|
|
# define MAX_CODE_JUMP (0xFFFFu)
|
2015-07-02 15:45:48 +00:00
|
|
|
# define MAX_CODE_PARAM (0xFFFFu)
|
2015-06-23 14:00:26 +00:00
|
|
|
#else
|
2017-01-09 09:54:49 +00:00
|
|
|
# error Unsupported MOO_BCODE_LONG_PARAM_SIZE
|
2015-06-23 14:00:26 +00:00
|
|
|
#endif
|
2015-05-15 14:55:12 +00:00
|
|
|
|
2015-06-25 13:37:50 +00:00
|
|
|
/*
|
2015-06-29 13:52:40 +00:00
|
|
|
----------------------------------------------------------------------------------------------------------------
|
|
|
|
SHORT INSTRUCTION CODE LONG INSTRUCTION CODE
|
|
|
|
----------------------------------------------------------------------------------------------------------------
|
|
|
|
v v
|
|
|
|
0-3 0000 00XX STORE_INTO_INSTVAR 128 1000 0000 XXXXXXXX STORE_INTO_INSTVAR_X (bit 4 off, bit 3 off)
|
|
|
|
4-7 0000 01XX STORE_INTO_INSTVAR
|
|
|
|
8-11 0000 10XX POP_INTO_INSTVAR 136 1000 1000 XXXXXXXX POP_INTO_INSTVAR_X (bit 4 off, bit 3 on)
|
|
|
|
12-15 0000 11XX POP_INTO_INSTVAR
|
|
|
|
16-19 0001 00XX PUSH_INSTVAR 144 1001 0000 XXXXXXXX PUSH_INSTVAR_X (bit 4 on)
|
|
|
|
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
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
2019-08-02 09:23:08 +00:00
|
|
|
68-87 0100 01XX UNUSED 196 1100 0100 XXXXXXXX JUMP_FORWARD
|
2018-05-30 15:32:09 +00:00
|
|
|
197 1100 0101 XXXXXXXX JUMP2_FORWARD
|
|
|
|
198 1100 0110 XXXXXXXX JUMP_FORWARD_IF_TRUE
|
|
|
|
199 1100 0111 XXXXXXXX JUMP2_FORWARD_IF_TRUE
|
2019-08-02 09:23:08 +00:00
|
|
|
200 1100 1000 XXXXXXXX JUMP_FORWARD_IF_FALSE
|
|
|
|
201 1100 1001 XXXXXXXX JUMP2_FORWARD_IF_FALSE
|
2019-08-02 15:59:19 +00:00
|
|
|
202 1100 1010 XXXXXXXX JMPOP_FORWARD_IF_TRUE
|
|
|
|
203 1100 1011 XXXXXXXX JMPOP2_FORWARD_IF_TRUE
|
|
|
|
204 1100 1100 XXXXXXXX JMPOP_FORWARD_IF_FALSE
|
|
|
|
205 1100 1101 XXXXXXXX JMPOP2_FORWARD_IF_FALSE
|
|
|
|
|
|
|
|
206 1100 1110 XXXXXXXX JUMP_BACKWARD
|
|
|
|
207 1100 1111 XXXXXXXX JUMP2_BACKWARD
|
|
|
|
208 1101 0000 XXXXXXXX JUMP_BACKWARD_IF_TRUE
|
|
|
|
209 1101 0001 XXXXXXXX JUMP2_BACKWARD_IF_TRUE
|
|
|
|
210 1101 0010 XXXXXXXX JUMP_BACKWARD_IF_FALSE
|
|
|
|
211 1101 0011 XXXXXXXX JUMP2_BACKWARD_IF_FALSE
|
2019-08-02 09:23:08 +00:00
|
|
|
212 1101 0100 XXXXXXXX JMPOP_BACKWARD_IF_TRUE
|
|
|
|
213 1101 0101 XXXXXXXX JMPOP2_BACKWARD_IF_TRUE
|
|
|
|
214 1101 0110 XXXXXXXX JMPOP_BACKWARD_IF_FALSE
|
|
|
|
215 1101 0111 XXXXXXXX JMPOP2_BACKWARD_IF_FALSE
|
2015-06-29 13:52:40 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
112-115 0111 00XX YYYYYYYY SEND_MESSAGE 240 1111 0000 XXXXXXXX YYYYYYYY SEND_MESSAGE_X (bit 2 off)
|
|
|
|
116-119 0111 01XX YYYYYYYY SEND_MESSAGE_TO_SUPER 244 1111 0100 XXXXXXXX YYYYYYYY SEND_MESSAGE_TO_SUPER_X (bit 2 on)
|
|
|
|
# XXX args, YYYYYYYY message
|
|
|
|
|
|
|
|
120-123 0111 10XX UNUSED
|
|
|
|
124-127 0111 11XX UNUSED
|
|
|
|
|
|
|
|
##
|
|
|
|
## "SHORT_CODE_0 | 0x80" becomes "LONG_CODE_X".
|
|
|
|
## A special single byte instruction is assigned an unused number greater than 128.
|
|
|
|
##
|
2015-06-25 13:37:50 +00:00
|
|
|
*/
|
2015-06-07 14:36:26 +00:00
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
enum moo_bcode_t
|
2015-06-29 13:52:40 +00:00
|
|
|
{
|
2015-07-01 07:21:54 +00:00
|
|
|
BCODE_STORE_INTO_INSTVAR_0 = 0x00,
|
|
|
|
BCODE_STORE_INTO_INSTVAR_1 = 0x01,
|
|
|
|
BCODE_STORE_INTO_INSTVAR_2 = 0x02,
|
|
|
|
BCODE_STORE_INTO_INSTVAR_3 = 0x03,
|
|
|
|
|
|
|
|
BCODE_STORE_INTO_INSTVAR_4 = 0x04,
|
|
|
|
BCODE_STORE_INTO_INSTVAR_5 = 0x05,
|
|
|
|
BCODE_STORE_INTO_INSTVAR_6 = 0x06,
|
|
|
|
BCODE_STORE_INTO_INSTVAR_7 = 0x07,
|
|
|
|
|
|
|
|
BCODE_POP_INTO_INSTVAR_0 = 0x08,
|
|
|
|
BCODE_POP_INTO_INSTVAR_1 = 0x09,
|
|
|
|
BCODE_POP_INTO_INSTVAR_2 = 0x0A,
|
|
|
|
BCODE_POP_INTO_INSTVAR_3 = 0x0B,
|
|
|
|
|
|
|
|
BCODE_POP_INTO_INSTVAR_4 = 0x0C,
|
|
|
|
BCODE_POP_INTO_INSTVAR_5 = 0x0D,
|
|
|
|
BCODE_POP_INTO_INSTVAR_6 = 0x0E,
|
|
|
|
BCODE_POP_INTO_INSTVAR_7 = 0x0F,
|
|
|
|
|
|
|
|
BCODE_PUSH_INSTVAR_0 = 0x10,
|
|
|
|
BCODE_PUSH_INSTVAR_1 = 0x11,
|
|
|
|
BCODE_PUSH_INSTVAR_2 = 0x12,
|
|
|
|
BCODE_PUSH_INSTVAR_3 = 0x13,
|
|
|
|
|
|
|
|
BCODE_PUSH_INSTVAR_4 = 0x14,
|
|
|
|
BCODE_PUSH_INSTVAR_5 = 0x15,
|
|
|
|
BCODE_PUSH_INSTVAR_6 = 0x16,
|
|
|
|
BCODE_PUSH_INSTVAR_7 = 0x17,
|
|
|
|
|
|
|
|
BCODE_PUSH_TEMPVAR_0 = 0x18,
|
|
|
|
BCODE_PUSH_TEMPVAR_1 = 0x19,
|
|
|
|
BCODE_PUSH_TEMPVAR_2 = 0x1A,
|
|
|
|
BCODE_PUSH_TEMPVAR_3 = 0x1B,
|
|
|
|
|
|
|
|
BCODE_PUSH_TEMPVAR_4 = 0x1C,
|
|
|
|
BCODE_PUSH_TEMPVAR_5 = 0x1D,
|
|
|
|
BCODE_PUSH_TEMPVAR_6 = 0x1E,
|
|
|
|
BCODE_PUSH_TEMPVAR_7 = 0x1F,
|
|
|
|
|
|
|
|
BCODE_STORE_INTO_TEMPVAR_0 = 0x20,
|
|
|
|
BCODE_STORE_INTO_TEMPVAR_1 = 0x21,
|
|
|
|
BCODE_STORE_INTO_TEMPVAR_2 = 0x22,
|
|
|
|
BCODE_STORE_INTO_TEMPVAR_3 = 0x23,
|
|
|
|
|
|
|
|
BCODE_STORE_INTO_TEMPVAR_4 = 0x24,
|
|
|
|
BCODE_STORE_INTO_TEMPVAR_5 = 0x25,
|
|
|
|
BCODE_STORE_INTO_TEMPVAR_6 = 0x26,
|
|
|
|
BCODE_STORE_INTO_TEMPVAR_7 = 0x27,
|
|
|
|
|
|
|
|
BCODE_POP_INTO_TEMPVAR_0 = 0x28,
|
|
|
|
BCODE_POP_INTO_TEMPVAR_1 = 0x29,
|
|
|
|
BCODE_POP_INTO_TEMPVAR_2 = 0x2A,
|
|
|
|
BCODE_POP_INTO_TEMPVAR_3 = 0x2B,
|
|
|
|
|
|
|
|
BCODE_POP_INTO_TEMPVAR_4 = 0x2C,
|
|
|
|
BCODE_POP_INTO_TEMPVAR_5 = 0x2D,
|
|
|
|
BCODE_POP_INTO_TEMPVAR_6 = 0x2E,
|
|
|
|
BCODE_POP_INTO_TEMPVAR_7 = 0x2F,
|
|
|
|
|
|
|
|
BCODE_PUSH_LITERAL_0 = 0x30,
|
|
|
|
BCODE_PUSH_LITERAL_1 = 0x31,
|
|
|
|
BCODE_PUSH_LITERAL_2 = 0x32,
|
|
|
|
BCODE_PUSH_LITERAL_3 = 0x33,
|
|
|
|
|
|
|
|
BCODE_PUSH_LITERAL_4 = 0x34,
|
|
|
|
BCODE_PUSH_LITERAL_5 = 0x35,
|
|
|
|
BCODE_PUSH_LITERAL_6 = 0x36,
|
|
|
|
BCODE_PUSH_LITERAL_7 = 0x37,
|
2015-06-29 13:52:40 +00:00
|
|
|
|
|
|
|
/* -------------------------------------- */
|
|
|
|
|
2015-07-01 07:21:54 +00:00
|
|
|
BCODE_STORE_INTO_OBJECT_0 = 0x38,
|
|
|
|
BCODE_STORE_INTO_OBJECT_1 = 0x39,
|
|
|
|
BCODE_STORE_INTO_OBJECT_2 = 0x3A,
|
|
|
|
BCODE_STORE_INTO_OBJECT_3 = 0x3B,
|
|
|
|
|
|
|
|
BCODE_POP_INTO_OBJECT_0 = 0x3C,
|
|
|
|
BCODE_POP_INTO_OBJECT_1 = 0x3D,
|
|
|
|
BCODE_POP_INTO_OBJECT_2 = 0x3E,
|
|
|
|
BCODE_POP_INTO_OBJECT_3 = 0x3F,
|
|
|
|
|
|
|
|
BCODE_PUSH_OBJECT_0 = 0x40,
|
|
|
|
BCODE_PUSH_OBJECT_1 = 0x41,
|
|
|
|
BCODE_PUSH_OBJECT_2 = 0x42,
|
2019-08-02 09:23:08 +00:00
|
|
|
BCODE_PUSH_OBJECT_3 = 0x43, /* 67 */
|
2015-07-01 07:21:54 +00:00
|
|
|
|
2019-08-02 09:23:08 +00:00
|
|
|
/* UNUSED 0x44 - 0x57 */
|
2017-01-30 16:48:42 +00:00
|
|
|
|
2015-06-30 14:47:39 +00:00
|
|
|
BCODE_STORE_INTO_CTXTEMPVAR_0 = 0x58, /* 88 */
|
|
|
|
BCODE_STORE_INTO_CTXTEMPVAR_1 = 0x59, /* 89 */
|
|
|
|
BCODE_STORE_INTO_CTXTEMPVAR_2 = 0x5A, /* 90 */
|
|
|
|
BCODE_STORE_INTO_CTXTEMPVAR_3 = 0x5B, /* 91 */
|
|
|
|
|
|
|
|
BCODE_POP_INTO_CTXTEMPVAR_0 = 0x5C, /* 92 */
|
|
|
|
BCODE_POP_INTO_CTXTEMPVAR_1 = 0x5D, /* 93 */
|
|
|
|
BCODE_POP_INTO_CTXTEMPVAR_2 = 0x5E, /* 94 */
|
|
|
|
BCODE_POP_INTO_CTXTEMPVAR_3 = 0x5F, /* 95 */
|
|
|
|
|
|
|
|
BCODE_PUSH_CTXTEMPVAR_0 = 0x60, /* 96 */
|
|
|
|
BCODE_PUSH_CTXTEMPVAR_1 = 0x61, /* 97 */
|
|
|
|
BCODE_PUSH_CTXTEMPVAR_2 = 0x62, /* 98 */
|
|
|
|
BCODE_PUSH_CTXTEMPVAR_3 = 0x63, /* 99 */
|
|
|
|
|
|
|
|
BCODE_PUSH_OBJVAR_0 = 0x64,
|
|
|
|
BCODE_PUSH_OBJVAR_1 = 0x65,
|
|
|
|
BCODE_PUSH_OBJVAR_2 = 0x66,
|
|
|
|
BCODE_PUSH_OBJVAR_3 = 0x67,
|
|
|
|
|
|
|
|
BCODE_STORE_INTO_OBJVAR_0 = 0x68,
|
|
|
|
BCODE_STORE_INTO_OBJVAR_1 = 0x69,
|
|
|
|
BCODE_STORE_INTO_OBJVAR_2 = 0x6A,
|
|
|
|
BCODE_STORE_INTO_OBJVAR_3 = 0x6B,
|
|
|
|
|
|
|
|
BCODE_POP_INTO_OBJVAR_0 = 0x6C,
|
|
|
|
BCODE_POP_INTO_OBJVAR_1 = 0x6D,
|
|
|
|
BCODE_POP_INTO_OBJVAR_2 = 0x6E,
|
|
|
|
BCODE_POP_INTO_OBJVAR_3 = 0x6F,
|
|
|
|
|
|
|
|
BCODE_SEND_MESSAGE_0 = 0x70,
|
|
|
|
BCODE_SEND_MESSAGE_1 = 0x71,
|
|
|
|
BCODE_SEND_MESSAGE_2 = 0x72,
|
|
|
|
BCODE_SEND_MESSAGE_3 = 0x73,
|
2015-06-29 13:52:40 +00:00
|
|
|
|
|
|
|
BCODE_SEND_MESSAGE_TO_SUPER_0 = 0x74,
|
|
|
|
BCODE_SEND_MESSAGE_TO_SUPER_1 = 0x75,
|
|
|
|
BCODE_SEND_MESSAGE_TO_SUPER_2 = 0x76,
|
|
|
|
BCODE_SEND_MESSAGE_TO_SUPER_3 = 0x77,
|
|
|
|
|
|
|
|
/* UNUSED 0x78 - 0x7F */
|
|
|
|
|
2017-01-18 17:17:05 +00:00
|
|
|
BCODE_STORE_INTO_INSTVAR_X = 0x80, /* 128 ## */
|
2015-07-01 07:21:54 +00:00
|
|
|
|
|
|
|
BCODE_PUSH_RECEIVER = 0x81, /* 129 */
|
|
|
|
BCODE_PUSH_NIL = 0x82, /* 130 */
|
|
|
|
BCODE_PUSH_TRUE = 0x83, /* 131 */
|
|
|
|
BCODE_PUSH_FALSE = 0x84, /* 132 */
|
|
|
|
BCODE_PUSH_CONTEXT = 0x85, /* 133 */
|
2016-07-05 15:22:29 +00:00
|
|
|
BCODE_PUSH_PROCESS = 0x86, /* 134 */
|
2017-06-01 15:42:05 +00:00
|
|
|
BCODE_PUSH_RECEIVER_NS = 0x87, /* 135 */
|
2017-01-18 17:17:05 +00:00
|
|
|
|
|
|
|
BCODE_POP_INTO_INSTVAR_X = 0x88, /* 136 ## */
|
|
|
|
|
2017-06-01 15:42:05 +00:00
|
|
|
BCODE_PUSH_NEGONE = 0x89, /* 137 */
|
|
|
|
BCODE_PUSH_ZERO = 0x8A, /* 138 */
|
|
|
|
BCODE_PUSH_ONE = 0x8B, /* 139 */
|
|
|
|
BCODE_PUSH_TWO = 0x8C, /* 140 */
|
2015-06-29 13:52:40 +00:00
|
|
|
|
2017-01-18 17:17:05 +00:00
|
|
|
BCODE_PUSH_INSTVAR_X = 0x90, /* 144 ## */
|
|
|
|
BCODE_PUSH_TEMPVAR_X = 0x98, /* 152 ## */
|
|
|
|
BCODE_STORE_INTO_TEMPVAR_X = 0xA0, /* 160 ## */
|
|
|
|
BCODE_POP_INTO_TEMPVAR_X = 0xA8, /* 168 ## */
|
|
|
|
BCODE_PUSH_LITERAL_X = 0xB0, /* 176 ## */
|
|
|
|
|
2016-09-14 04:56:00 +00:00
|
|
|
/* UNUSED - 0xB1 */
|
2019-08-02 09:23:08 +00:00
|
|
|
|
2016-09-14 04:56:00 +00:00
|
|
|
BCODE_PUSH_INTLIT = 0xB2, /* 178 */
|
|
|
|
BCODE_PUSH_NEGINTLIT = 0xB3, /* 179 */
|
|
|
|
BCODE_PUSH_CHARLIT = 0xB4, /* 180 */
|
2015-07-02 15:45:48 +00:00
|
|
|
|
2021-01-23 04:00:03 +00:00
|
|
|
/* UNUSED - 0xB5 - 0xB7 */
|
|
|
|
|
2017-01-18 17:17:05 +00:00
|
|
|
BCODE_STORE_INTO_OBJECT_X = 0xB8, /* 184 ## */
|
|
|
|
BCODE_POP_INTO_OBJECT_X = 0xBC, /* 188 ## */
|
|
|
|
BCODE_PUSH_OBJECT_X = 0xC0, /* 192 ## */
|
|
|
|
|
2021-01-23 04:00:03 +00:00
|
|
|
/* UNUSED - 0xC1 - 0xC3 */
|
2019-08-02 15:59:19 +00:00
|
|
|
|
2019-08-02 09:23:08 +00:00
|
|
|
BCODE_JUMP_FORWARD = 0xC4, /* 196 ## */
|
|
|
|
BCODE_JUMP2_FORWARD = 0xC5, /* 197 ## */
|
2018-05-30 15:32:09 +00:00
|
|
|
BCODE_JUMP_FORWARD_IF_TRUE = 0xC6, /* 198 ## */
|
2019-08-02 09:23:08 +00:00
|
|
|
BCODE_JUMP2_FORWARD_IF_TRUE = 0xC7, /* 199 ## */
|
|
|
|
BCODE_JUMP_FORWARD_IF_FALSE = 0xC8, /* 200 ## */
|
|
|
|
BCODE_JUMP2_FORWARD_IF_FALSE = 0xC9, /* 201 ## */
|
2019-08-04 16:38:09 +00:00
|
|
|
/* JMPOP = JUMP + POP -> it pops the stack top always but it jumps only if the condition is met */
|
2019-08-02 15:59:19 +00:00
|
|
|
BCODE_JMPOP_FORWARD_IF_TRUE = 0xCA, /* 202 ## */
|
|
|
|
BCODE_JMPOP2_FORWARD_IF_TRUE = 0xCB, /* 203 ## */
|
|
|
|
BCODE_JMPOP_FORWARD_IF_FALSE = 0xCC, /* 204 ## */
|
|
|
|
BCODE_JMPOP2_FORWARD_IF_FALSE = 0xCD, /* 205 ## */
|
|
|
|
|
|
|
|
BCODE_JUMP_BACKWARD = 0xCE, /* 206 ## */
|
|
|
|
BCODE_JUMP2_BACKWARD = 0xCF, /* 207 ## */
|
|
|
|
BCODE_JUMP_BACKWARD_IF_TRUE = 0xD0, /* 208 ## */
|
|
|
|
BCODE_JUMP2_BACKWARD_IF_TRUE = 0xD1, /* 209 ## */
|
|
|
|
BCODE_JUMP_BACKWARD_IF_FALSE = 0xD2, /* 210 ## */
|
|
|
|
BCODE_JUMP2_BACKWARD_IF_FALSE = 0xD3, /* 211 ## */
|
2019-08-02 09:23:08 +00:00
|
|
|
BCODE_JMPOP_BACKWARD_IF_TRUE = 0xD4, /* 212 ## */
|
|
|
|
BCODE_JMPOP2_BACKWARD_IF_TRUE = 0xD5, /* 213 ## */
|
|
|
|
BCODE_JMPOP_BACKWARD_IF_FALSE = 0xD6, /* 214 ## */
|
|
|
|
BCODE_JMPOP2_BACKWARD_IF_FALSE = 0xD7, /* 215 ## */
|
2017-01-18 17:17:05 +00:00
|
|
|
|
|
|
|
BCODE_STORE_INTO_CTXTEMPVAR_X = 0xD8, /* 216 ## */
|
|
|
|
BCODE_POP_INTO_CTXTEMPVAR_X = 0xDC, /* 220 ## */
|
|
|
|
BCODE_PUSH_CTXTEMPVAR_X = 0xE0, /* 224 ## */
|
|
|
|
|
|
|
|
BCODE_PUSH_OBJVAR_X = 0xE4, /* 228 ## */
|
|
|
|
BCODE_STORE_INTO_OBJVAR_X = 0xE8, /* 232 ## */
|
|
|
|
BCODE_POP_INTO_OBJVAR_X = 0xEC, /* 236 ## */
|
|
|
|
|
2019-08-02 15:59:19 +00:00
|
|
|
/* UNUSED 0xED */
|
2019-08-02 09:23:08 +00:00
|
|
|
BCODE_MAKE_BYTEARRAY = 0xEE, /* 238 */
|
|
|
|
BCODE_POP_INTO_BYTEARRAY = 0xEF, /* 239 */
|
2017-02-07 17:40:34 +00:00
|
|
|
|
2019-08-02 09:23:08 +00:00
|
|
|
BCODE_SEND_MESSAGE_X = 0xF0, /* 240 ## */
|
2019-08-02 15:59:19 +00:00
|
|
|
/* UNUSED 0xF1 */
|
2019-08-02 09:23:08 +00:00
|
|
|
BCODE_MAKE_DICTIONARY = 0xF2, /* 242 */
|
|
|
|
BCODE_POP_INTO_DICTIONARY = 0xF3, /* 243 */
|
|
|
|
BCODE_SEND_MESSAGE_TO_SUPER_X = 0xF4, /* 244 ## */
|
2017-01-18 17:17:05 +00:00
|
|
|
|
|
|
|
/* -------------------------------------- */
|
2015-06-29 13:52:40 +00:00
|
|
|
|
2019-08-02 09:23:08 +00:00
|
|
|
BCODE_MAKE_ARRAY = 0xF5, /* 245 */
|
|
|
|
BCODE_POP_INTO_ARRAY = 0xF6, /* 246 */
|
|
|
|
BCODE_DUP_STACKTOP = 0xF7, /* 247 */
|
|
|
|
BCODE_POP_STACKTOP = 0xF8,
|
|
|
|
BCODE_RETURN_STACKTOP = 0xF9, /* ^something */
|
|
|
|
BCODE_RETURN_RECEIVER = 0xFA, /* ^self */
|
|
|
|
BCODE_RETURN_FROM_BLOCK = 0xFB, /* return the stack top from a block */
|
|
|
|
BCODE_LOCAL_RETURN = 0xFC,
|
|
|
|
BCODE_MAKE_BLOCK = 0xFD,
|
2020-10-15 14:50:08 +00:00
|
|
|
/* UNUSED 0xFE */
|
2019-08-02 09:23:08 +00:00
|
|
|
BCODE_NOOP = 0xFF
|
2015-06-12 13:52:30 +00:00
|
|
|
};
|
2015-06-09 12:14:18 +00:00
|
|
|
|
2018-02-22 04:44:34 +00:00
|
|
|
/* i don't want an error raised inside the callback to override
|
|
|
|
* the existing error number and message. */
|
|
|
|
#define vmprim_log_write(moo,mask,ptr,len) do { \
|
|
|
|
int shuterr = (moo)->shuterr; \
|
|
|
|
(moo)->shuterr = 1; \
|
|
|
|
(moo)->vmprim.log_write (moo, mask, ptr, len); \
|
|
|
|
(moo)->shuterr = shuterr; \
|
|
|
|
} while(0)
|
|
|
|
|
2018-10-11 14:03:16 +00:00
|
|
|
typedef int (*moo_dic_walker_t) (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_dic_t dic,
|
|
|
|
moo_oop_association_t ass,
|
|
|
|
void* ctx
|
|
|
|
);
|
|
|
|
|
2015-04-30 15:56:05 +00:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2018-01-07 08:00:23 +00:00
|
|
|
/* ========================================================================= */
|
2019-01-26 16:45:23 +00:00
|
|
|
/* err.c */
|
2018-01-07 08:00:23 +00:00
|
|
|
/* ========================================================================= */
|
|
|
|
|
|
|
|
void moo_seterrbfmtv (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_errnum_t errnum,
|
|
|
|
const moo_bch_t* fmt,
|
|
|
|
va_list ap
|
|
|
|
);
|
|
|
|
|
|
|
|
void moo_seterrufmtv (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_errnum_t errnum,
|
|
|
|
const moo_uch_t* fmt,
|
|
|
|
va_list ap
|
|
|
|
);
|
2015-10-28 14:58:58 +00:00
|
|
|
|
2018-02-07 14:08:05 +00:00
|
|
|
|
|
|
|
#if defined(MOO_INCLUDE_COMPILER)
|
2018-02-08 05:31:35 +00:00
|
|
|
void moo_setsynerrbfmt (
|
2018-02-07 14:08:05 +00:00
|
|
|
moo_t* moo,
|
|
|
|
moo_synerrnum_t num,
|
|
|
|
const moo_ioloc_t* loc,
|
|
|
|
const moo_oocs_t* tgt,
|
|
|
|
const moo_bch_t* msgfmt,
|
|
|
|
...
|
|
|
|
);
|
|
|
|
|
2018-02-08 05:31:35 +00:00
|
|
|
void moo_setsynerrufmt (
|
2018-02-07 14:08:05 +00:00
|
|
|
moo_t* moo,
|
|
|
|
moo_synerrnum_t num,
|
|
|
|
const moo_ioloc_t* loc,
|
|
|
|
const moo_oocs_t* tgt,
|
|
|
|
const moo_uch_t* msgfmt,
|
|
|
|
...
|
|
|
|
);
|
|
|
|
|
2018-02-08 05:31:35 +00:00
|
|
|
void moo_setsynerr (
|
2018-02-07 14:08:05 +00:00
|
|
|
moo_t* moo,
|
|
|
|
moo_synerrnum_t num,
|
|
|
|
const moo_ioloc_t* loc,
|
|
|
|
const moo_oocs_t* tgt
|
|
|
|
);
|
|
|
|
#endif
|
|
|
|
|
2015-04-30 15:56:05 +00:00
|
|
|
/* ========================================================================= */
|
|
|
|
/* heap.c */
|
|
|
|
/* ========================================================================= */
|
|
|
|
|
|
|
|
/**
|
2017-01-09 09:54:49 +00:00
|
|
|
* The moo_makeheap() function creates a new heap of the \a size bytes.
|
2015-04-30 15:56:05 +00:00
|
|
|
*
|
2017-01-09 09:54:49 +00:00
|
|
|
* \return heap pointer on success and #MOO_NULL on failure.
|
2015-04-30 15:56:05 +00:00
|
|
|
*/
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_heap_t* moo_makeheap (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oow_t size
|
2015-04-30 15:56:05 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2017-01-09 09:54:49 +00:00
|
|
|
* The moo_killheap() function destroys the heap pointed to by \a heap.
|
2015-04-30 15:56:05 +00:00
|
|
|
*/
|
2017-01-09 09:54:49 +00:00
|
|
|
void moo_killheap (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_heap_t* heap
|
2015-04-30 15:56:05 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2020-11-25 14:48:26 +00:00
|
|
|
* The moo_allocheapspace() function allocates \a size bytes in a semi-space
|
|
|
|
* of the heap pointed to by \a heap.
|
2015-04-30 15:56:05 +00:00
|
|
|
*
|
2017-01-09 09:54:49 +00:00
|
|
|
* \return memory pointer on success and #MOO_NULL on failure.
|
2015-04-30 15:56:05 +00:00
|
|
|
*/
|
2018-11-30 13:37:15 +00:00
|
|
|
void* moo_allocheapspace (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_space_t* space,
|
|
|
|
moo_oow_t size
|
2015-04-30 15:56:05 +00:00
|
|
|
);
|
|
|
|
|
2020-11-25 14:48:26 +00:00
|
|
|
/**
|
2020-11-29 16:12:28 +00:00
|
|
|
* The moo_allocheapmem() function allocates \a size bytes from the given heap
|
|
|
|
* and clears it with zeros.
|
2020-11-25 14:48:26 +00:00
|
|
|
*/
|
2020-11-29 16:12:28 +00:00
|
|
|
void* moo_callocheapmem (
|
2020-11-25 14:48:26 +00:00
|
|
|
moo_t* moo,
|
|
|
|
moo_heap_t* heap,
|
|
|
|
moo_oow_t size
|
|
|
|
);
|
|
|
|
|
2020-11-29 16:12:28 +00:00
|
|
|
void* moo_callocheapmem_noerr (
|
2020-11-25 14:48:26 +00:00
|
|
|
moo_t* moo,
|
|
|
|
moo_heap_t* heap,
|
|
|
|
moo_oow_t size
|
|
|
|
);
|
|
|
|
|
|
|
|
void moo_freeheapmem (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_heap_t* heap,
|
|
|
|
void* ptr
|
|
|
|
);
|
2020-11-29 16:12:28 +00:00
|
|
|
|
2015-04-30 15:56:05 +00:00
|
|
|
/* ========================================================================= */
|
|
|
|
/* obj.c */
|
|
|
|
/* ========================================================================= */
|
2017-01-09 09:54:49 +00:00
|
|
|
void* moo_allocbytes (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oow_t size
|
2015-05-03 17:10:30 +00:00
|
|
|
);
|
|
|
|
|
2015-05-07 15:58:04 +00:00
|
|
|
/**
|
2017-01-09 09:54:49 +00:00
|
|
|
* The moo_allocoopobj() function allocates a raw object composed of \a size
|
2015-05-07 15:58:04 +00:00
|
|
|
* pointer fields excluding the header.
|
|
|
|
*/
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_allocoopobj (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oow_t size
|
2015-04-30 15:56:05 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_allocoopobjwithtrailer (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oow_t size,
|
|
|
|
const moo_oob_t* tptr,
|
|
|
|
moo_oow_t tlen
|
2015-07-01 15:01:39 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_alloccharobj (
|
|
|
|
moo_t* moo,
|
|
|
|
const moo_ooch_t* ptr,
|
|
|
|
moo_oow_t len
|
2015-04-30 15:56:05 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_allocbyteobj (
|
|
|
|
moo_t* moo,
|
|
|
|
const moo_oob_t* ptr,
|
|
|
|
moo_oow_t len
|
2015-04-30 15:56:05 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_allochalfwordobj (
|
|
|
|
moo_t* moo,
|
|
|
|
const moo_oohw_t* ptr,
|
|
|
|
moo_oow_t len
|
2015-05-26 16:31:47 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_allocwordobj (
|
|
|
|
moo_t* moo,
|
|
|
|
const moo_oow_t* ptr,
|
|
|
|
moo_oow_t len
|
2015-12-03 15:31:21 +00:00
|
|
|
);
|
|
|
|
|
2015-05-07 15:58:04 +00:00
|
|
|
/* ========================================================================= */
|
|
|
|
/* sym.c */
|
|
|
|
/* ========================================================================= */
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_findsymbol (
|
|
|
|
moo_t* moo,
|
|
|
|
const moo_ooch_t* ptr,
|
|
|
|
moo_oow_t len
|
2015-05-07 15:58:04 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
/* ========================================================================= */
|
|
|
|
/* dic.c */
|
|
|
|
/* ========================================================================= */
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_association_t moo_putatsysdic (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t key,
|
|
|
|
moo_oop_t value
|
2015-05-07 15:58:04 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_association_t moo_getatsysdic (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t key
|
2015-05-07 15:58:04 +00:00
|
|
|
);
|
2015-05-03 17:10:30 +00:00
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_association_t moo_lookupsysdic (
|
|
|
|
moo_t* moo,
|
|
|
|
const moo_oocs_t* name
|
2015-05-25 17:10:49 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_association_t moo_putatdic (
|
|
|
|
moo_t* moo,
|
2017-05-20 02:27:48 +00:00
|
|
|
moo_oop_dic_t dic,
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t key,
|
|
|
|
moo_oop_t value
|
2015-05-28 16:51:37 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_association_t moo_getatdic (
|
|
|
|
moo_t* moo,
|
2017-05-20 02:27:48 +00:00
|
|
|
moo_oop_dic_t dic,
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t key
|
2015-05-28 16:51:37 +00:00
|
|
|
);
|
|
|
|
|
2018-12-10 13:34:31 +00:00
|
|
|
moo_oop_association_t moo_lookupdic_noseterr (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_dic_t dic,
|
|
|
|
const moo_oocs_t* name
|
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_association_t moo_lookupdic (
|
|
|
|
moo_t* moo,
|
2017-05-20 02:27:48 +00:00
|
|
|
moo_oop_dic_t dic,
|
2017-01-09 09:54:49 +00:00
|
|
|
const moo_oocs_t* name
|
2015-05-28 16:51:37 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
int moo_deletedic (
|
|
|
|
moo_t* moo,
|
2017-05-20 02:27:48 +00:00
|
|
|
moo_oop_dic_t dic,
|
2017-01-09 09:54:49 +00:00
|
|
|
const moo_oocs_t* name
|
2017-01-09 09:11:36 +00:00
|
|
|
);
|
|
|
|
|
2018-10-11 14:03:16 +00:00
|
|
|
int moo_walkdic (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_dic_t dic,
|
|
|
|
moo_dic_walker_t walker,
|
|
|
|
void* ctx
|
|
|
|
);
|
|
|
|
|
2017-05-20 02:27:48 +00:00
|
|
|
moo_oop_dic_t moo_makedic (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_class_t _class,
|
|
|
|
moo_oow_t size
|
|
|
|
);
|
|
|
|
|
|
|
|
moo_oop_nsdic_t moo_makensdic (
|
2017-02-15 11:57:24 +00:00
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_class_t _class,
|
|
|
|
moo_oow_t size
|
2015-05-28 16:51:37 +00:00
|
|
|
);
|
|
|
|
|
2017-07-20 16:33:53 +00:00
|
|
|
|
|
|
|
/* ========================================================================= */
|
|
|
|
/* gc.c */
|
|
|
|
/* ========================================================================= */
|
|
|
|
int moo_regfinalizable (moo_t* moo, moo_oop_t oop);
|
|
|
|
int moo_deregfinalizable (moo_t* moo, moo_oop_t oop);
|
2018-05-16 08:03:34 +00:00
|
|
|
void moo_deregallfinalizables (moo_t* moo);
|
2017-07-20 16:33:53 +00:00
|
|
|
|
2019-09-17 23:15:20 +00:00
|
|
|
moo_oow_t moo_getobjpayloadbytes (moo_t* moo, moo_oop_t oop);
|
|
|
|
|
2020-11-29 16:12:28 +00:00
|
|
|
#if defined(MOO_ENABLE_GC_MARK_SWEEP)
|
|
|
|
void moo_gc_ms_sweep_lazy (moo_t* moo, moo_oow_t allocsize);
|
|
|
|
#endif
|
2015-10-29 15:24:46 +00:00
|
|
|
/* ========================================================================= */
|
2017-01-09 09:11:36 +00:00
|
|
|
/* bigint.c */
|
2015-10-29 15:24:46 +00:00
|
|
|
/* ========================================================================= */
|
2019-05-04 17:53:16 +00:00
|
|
|
static MOO_INLINE int moo_isbigint (moo_t* moo, moo_oop_t x)
|
|
|
|
{
|
|
|
|
if (!MOO_OOP_IS_POINTER(x)) return 0;
|
|
|
|
|
|
|
|
/* TODO: is it better to introduce a special integer mark into the class itself */
|
|
|
|
/* TODO: or should it check if it's a subclass, subsubclass, subsubsubclass, etc of a large_integer as well? */
|
|
|
|
return MOO_POINTER_IS_BIGINT(moo, x);
|
|
|
|
}
|
|
|
|
|
|
|
|
static MOO_INLINE int moo_isint (moo_t* moo, moo_oop_t x)
|
|
|
|
{
|
|
|
|
if (MOO_OOP_IS_SMOOI(x)) return 1;
|
|
|
|
if (MOO_OOP_IS_POINTER(x)) return MOO_POINTER_IS_BIGINT(moo, x); /* is_bigint? */
|
|
|
|
return 0;
|
|
|
|
}
|
2015-12-27 18:02:59 +00:00
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_addints (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
2015-10-29 15:24:46 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_subints (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
2015-10-29 15:24:46 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_mulints (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
2015-11-11 13:31:05 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_divints (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y,
|
2017-12-27 10:32:57 +00:00
|
|
|
int modulo,
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t* rem
|
2015-11-17 14:13:59 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_negateint (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x
|
2015-12-25 05:09:17 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_bitatint (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
2015-12-25 05:09:17 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_bitandints (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
2015-12-10 14:23:09 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_bitorints (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
2015-12-10 14:23:09 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_bitxorints (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
2015-12-10 14:23:09 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_bitinvint (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x
|
2015-12-17 16:37:26 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_bitshiftint (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
2015-12-18 15:58:45 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_eqints (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
2015-12-27 18:02:59 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_neints (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
2015-12-27 18:02:59 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_gtints (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
2015-12-27 18:02:59 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_geints (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
2015-12-27 18:02:59 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_ltints (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
2015-12-27 18:02:59 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_leints (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
2015-12-27 18:02:59 +00:00
|
|
|
);
|
|
|
|
|
2018-04-07 06:29:17 +00:00
|
|
|
moo_oop_t moo_sqrtint (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x
|
|
|
|
);
|
|
|
|
|
|
|
|
moo_oop_t moo_absint (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x
|
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_strtoint (
|
|
|
|
moo_t* moo,
|
|
|
|
const moo_ooch_t* str,
|
|
|
|
moo_oow_t len,
|
2017-12-27 10:32:57 +00:00
|
|
|
int radix
|
2015-11-04 17:32:28 +00:00
|
|
|
);
|
2015-12-02 15:24:13 +00:00
|
|
|
|
2019-01-10 10:01:50 +00:00
|
|
|
#define MOO_INTTOSTR_RADIXMASK (0xFF)
|
|
|
|
#define MOO_INTTOSTR_LOWERCASE (1 << 8)
|
|
|
|
#define MOO_INTTOSTR_NONEWOBJ (1 << 9)
|
2018-12-21 16:25:25 +00:00
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_oop_t moo_inttostr (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t num,
|
2018-12-21 16:25:25 +00:00
|
|
|
int flagged_radix /* radix between 2 and 36 inclusive, optionally bitwise ORed of MOO_INTTOSTR_XXX bits */
|
|
|
|
);
|
|
|
|
|
|
|
|
/* ========================================================================= */
|
|
|
|
/* number.c */
|
|
|
|
/* ========================================================================= */
|
|
|
|
moo_oop_t moo_makefpdec (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t value,
|
|
|
|
moo_ooi_t scale
|
|
|
|
);
|
|
|
|
|
|
|
|
moo_oop_t moo_truncfpdecval (
|
2019-01-01 06:44:28 +00:00
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t iv, /* integer */
|
|
|
|
moo_ooi_t cs, /* current scale */
|
|
|
|
moo_ooi_t ns /* new scale */
|
|
|
|
);
|
|
|
|
|
2019-02-18 08:57:59 +00:00
|
|
|
moo_oop_t moo_truncfpdec (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t iv, /* integer */
|
|
|
|
moo_ooi_t ns /* new scale */
|
|
|
|
);
|
|
|
|
|
2019-01-01 06:44:28 +00:00
|
|
|
moo_oop_t moo_addnums (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
moo_oop_t moo_subnums (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
moo_oop_t moo_mulnums (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
moo_oop_t moo_mltnums (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
moo_oop_t moo_divnums (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
2019-01-10 07:00:17 +00:00
|
|
|
moo_oop_t y,
|
|
|
|
int modulo
|
2019-01-01 06:44:28 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
moo_oop_t moo_gtnums (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
moo_oop_t moo_genums (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
moo_oop_t moo_ltnums (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
moo_oop_t moo_lenums (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
moo_oop_t moo_eqnums (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
|
|
|
);
|
|
|
|
|
|
|
|
moo_oop_t moo_nenums (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x,
|
|
|
|
moo_oop_t y
|
|
|
|
);
|
|
|
|
|
2019-01-10 07:00:17 +00:00
|
|
|
moo_oop_t moo_negatenum (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x
|
|
|
|
);
|
|
|
|
|
2019-01-01 06:44:28 +00:00
|
|
|
moo_oop_t moo_sqrtnum (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x
|
|
|
|
);
|
|
|
|
|
|
|
|
moo_oop_t moo_absnum (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t x
|
2015-12-02 15:24:13 +00:00
|
|
|
);
|
|
|
|
|
2019-01-10 10:01:50 +00:00
|
|
|
|
|
|
|
#define MOO_NUMTOSTR_RADIXMASK MOO_INTTOSTR_RADIXMASK
|
|
|
|
#define MOO_NUMTOSTR_LOWERCASE MOO_INTTOSTR_LOWERCASE
|
|
|
|
#define MOO_NUMTOSTR_NONEWOBJ MOO_INTTOSTR_NONEWOBJ
|
|
|
|
|
|
|
|
moo_oop_t moo_numtostr (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t num,
|
|
|
|
int flagged_radix /* radix between 2 and 36 inclusive, optionally bitwise ORed of MOO_INTTOSTR_XXX bits */
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2019-05-28 08:55:13 +00:00
|
|
|
/* ========================================================================= */
|
|
|
|
/* fmt.c */
|
|
|
|
/* ========================================================================= */
|
|
|
|
int moo_fmt_object_ (
|
|
|
|
moo_fmtout_t* fmtout,
|
|
|
|
moo_oop_t oop
|
|
|
|
);
|
|
|
|
|
2019-05-29 01:35:13 +00:00
|
|
|
int moo_strfmtcallstack (
|
2018-12-21 16:40:20 +00:00
|
|
|
moo_t* moo,
|
2019-05-29 01:35:13 +00:00
|
|
|
moo_ooi_t nargs,
|
|
|
|
int rcv_is_fmtstr
|
2018-12-21 16:40:20 +00:00
|
|
|
);
|
|
|
|
|
2015-10-03 15:29:03 +00:00
|
|
|
/* ========================================================================= */
|
|
|
|
/* exec.c */
|
|
|
|
/* ========================================================================= */
|
2016-09-23 08:56:25 +00:00
|
|
|
|
2017-04-01 04:58:02 +00:00
|
|
|
moo_pfbase_t* moo_getpfnum (
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_t* moo,
|
|
|
|
const moo_ooch_t* ptr,
|
2017-04-01 04:58:02 +00:00
|
|
|
moo_oow_t len,
|
|
|
|
moo_ooi_t* pfnum
|
2015-10-03 15:29:03 +00:00
|
|
|
);
|
2015-06-11 12:09:10 +00:00
|
|
|
|
2019-06-22 14:22:58 +00:00
|
|
|
void moo_clearmethodcache (
|
|
|
|
moo_t* moo
|
|
|
|
);
|
2019-10-18 06:42:16 +00:00
|
|
|
|
|
|
|
moo_oop_method_t moo_findmethod_noseterr (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t receiver,
|
|
|
|
moo_oop_char_t selector,
|
|
|
|
int super
|
|
|
|
);
|
|
|
|
|
2017-12-08 15:28:51 +00:00
|
|
|
moo_oop_method_t moo_findmethod (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_t receiver,
|
2019-06-22 02:02:59 +00:00
|
|
|
moo_oop_char_t selector,
|
2017-12-08 15:28:51 +00:00
|
|
|
int super
|
|
|
|
);
|
2016-11-29 05:25:08 +00:00
|
|
|
|
2018-10-12 09:09:45 +00:00
|
|
|
moo_oop_method_t moo_findmethodinclass (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_class_t _class,
|
|
|
|
int mth_type,
|
|
|
|
const moo_oocs_t* name
|
|
|
|
);
|
|
|
|
|
|
|
|
moo_oop_method_t moo_findmethodinclasschain (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_oop_class_t _class,
|
|
|
|
int mth_type,
|
|
|
|
const moo_oocs_t* name
|
|
|
|
);
|
|
|
|
|
2016-11-29 05:25:08 +00:00
|
|
|
/* ========================================================================= */
|
2017-03-19 14:18:37 +00:00
|
|
|
/* moo.c */
|
2016-11-29 05:25:08 +00:00
|
|
|
/* ========================================================================= */
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_mod_data_t* moo_openmod (
|
|
|
|
moo_t* moo,
|
|
|
|
const moo_ooch_t* name,
|
2017-03-19 14:18:37 +00:00
|
|
|
moo_oow_t namelen,
|
|
|
|
int hints /* 0 or bitwise-ORed of moo_mod_hint_t enumerators */
|
2016-11-29 05:25:08 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
void moo_closemod (
|
|
|
|
moo_t* moo,
|
|
|
|
moo_mod_data_t* mdp
|
2016-11-29 05:25:08 +00:00
|
|
|
);
|
|
|
|
|
2017-01-09 09:54:49 +00:00
|
|
|
int moo_importmod (
|
|
|
|
moo_t* moo,
|
2017-02-15 11:57:24 +00:00
|
|
|
moo_oop_class_t _class,
|
2017-01-09 09:54:49 +00:00
|
|
|
const moo_ooch_t* name,
|
|
|
|
moo_oow_t len
|
2016-11-29 05:25:08 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
/*
|
2019-10-25 08:44:05 +00:00
|
|
|
* The moo_querymodpf() function finds a primitive function in modules
|
2016-11-29 05:25:08 +00:00
|
|
|
* with a full primitive identifier.
|
|
|
|
*/
|
2019-10-25 08:44:05 +00:00
|
|
|
moo_pfbase_t* moo_querymodpf (
|
2017-01-09 09:54:49 +00:00
|
|
|
moo_t* moo,
|
|
|
|
const moo_ooch_t* pfid,
|
2018-05-07 16:52:51 +00:00
|
|
|
moo_oow_t pfidlen,
|
|
|
|
moo_mod_t** mod
|
2016-11-29 05:25:08 +00:00
|
|
|
);
|
|
|
|
|
2019-10-25 08:44:05 +00:00
|
|
|
moo_pvbase_t* moo_querymodpv (
|
|
|
|
moo_t* moo,
|
|
|
|
const moo_ooch_t* pvid,
|
|
|
|
moo_oow_t pvidlen,
|
|
|
|
moo_mod_t** mod
|
|
|
|
);
|
2016-11-29 05:25:08 +00:00
|
|
|
|
2017-12-05 16:51:20 +00:00
|
|
|
/* ========================================================================= */
|
|
|
|
/* pf-basic.c */
|
|
|
|
/* ========================================================================= */
|
2018-05-07 16:52:51 +00:00
|
|
|
moo_pfrc_t moo_pf_identical (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_not_identical (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_equal (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_not_equal (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
2017-12-05 16:51:20 +00:00
|
|
|
|
2018-05-07 16:52:51 +00:00
|
|
|
moo_pfrc_t moo_pf_basic_new (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_shallow_copy (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
2017-12-05 16:51:20 +00:00
|
|
|
|
2018-05-07 16:52:51 +00:00
|
|
|
moo_pfrc_t moo_pf_class (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_basic_size (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
2019-08-17 10:08:25 +00:00
|
|
|
moo_pfrc_t moo_pf_basic_first_index (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_basic_last_index (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
2018-05-07 16:52:51 +00:00
|
|
|
moo_pfrc_t moo_pf_basic_at (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_basic_at_put (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
2019-08-17 05:28:25 +00:00
|
|
|
moo_pfrc_t moo_pf_basic_at_test_put (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
2018-05-07 16:52:51 +00:00
|
|
|
moo_pfrc_t moo_pf_basic_fill (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_basic_shift (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
2017-12-05 16:51:20 +00:00
|
|
|
|
2018-05-07 16:52:51 +00:00
|
|
|
moo_pfrc_t moo_pf_is_kind_of (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_responds_to (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
2017-12-08 15:28:51 +00:00
|
|
|
|
|
|
|
/* ========================================================================= */
|
|
|
|
/* pf-sys.c */
|
|
|
|
/* ========================================================================= */
|
2019-11-05 14:46:54 +00:00
|
|
|
moo_pfrc_t moo_pf_system_toggle_process_switching (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_halting (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_find_process_by_id (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_find_first_process (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_find_last_process (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_find_previous_process (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_find_next_process (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
|
2018-05-07 16:52:51 +00:00
|
|
|
moo_pfrc_t moo_pf_system_collect_garbage (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_pop_collectable (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
|
2019-08-15 15:55:06 +00:00
|
|
|
moo_pfrc_t moo_pf_system_get_sigfd (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_get_sig (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
2019-08-16 15:29:36 +00:00
|
|
|
moo_pfrc_t moo_pf_system_set_sig (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
2019-08-14 16:24:39 +00:00
|
|
|
|
2018-05-07 16:52:51 +00:00
|
|
|
moo_pfrc_t moo_pf_system_malloc (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_calloc (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_free (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_smptr_free (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
|
|
|
|
moo_pfrc_t moo_pf_system_get_int8 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_get_int16 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_get_int32 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_get_int64 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_get_uint8 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_get_uint16 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_get_uint32 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_get_uint64 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
|
|
|
|
moo_pfrc_t moo_pf_system_put_int8 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_put_int16 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_put_int32 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_put_int64 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_put_uint8 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_put_uint16 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_put_uint32 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_put_uint64 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
|
|
|
|
moo_pfrc_t moo_pf_system_get_bytes (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_system_put_bytes (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
|
|
|
|
|
|
|
|
moo_pfrc_t moo_pf_smptr_get_int8 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_smptr_get_int16 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_smptr_get_int32 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_smptr_get_int64 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_smptr_get_uint8 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_smptr_get_uint16 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_smptr_get_uint32 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_smptr_get_uint64 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
|
|
|
|
moo_pfrc_t moo_pf_smptr_put_int8 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_smptr_put_int16 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_smptr_put_int32 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_smptr_put_int64 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_smptr_put_uint8 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_smptr_put_uint16 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_smptr_put_uint32 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_smptr_put_uint64 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
|
|
|
|
moo_pfrc_t moo_pf_smptr_get_bytes (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_smptr_put_bytes (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
|
|
|
|
moo_pfrc_t moo_pf_smptr_as_string (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
2017-12-09 17:45:10 +00:00
|
|
|
|
2018-06-17 17:41:04 +00:00
|
|
|
|
|
|
|
/* ========================================================================= */
|
|
|
|
/* pf-utf8.c */
|
|
|
|
/* ========================================================================= */
|
|
|
|
moo_pfrc_t moo_pf_utf8_seqlen (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_utf8_to_uc (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
moo_pfrc_t moo_pf_uc_to_utf8 (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs);
|
|
|
|
|
2019-07-10 09:19:38 +00:00
|
|
|
|
2015-06-11 12:09:10 +00:00
|
|
|
/* ========================================================================= */
|
|
|
|
/* debug.c */
|
|
|
|
/* ========================================================================= */
|
2019-07-10 09:19:38 +00:00
|
|
|
/* TODO: remove the following dump functions */
|
2017-01-09 09:54:49 +00:00
|
|
|
void moo_dumpsymtab (moo_t* moo);
|
2017-05-20 02:27:48 +00:00
|
|
|
void moo_dumpdic (moo_t* moo, moo_oop_dic_t dic, const moo_bch_t* title);
|
2016-06-01 15:33:03 +00:00
|
|
|
|
2019-07-10 09:19:38 +00:00
|
|
|
int moo_addfiletodbgi (moo_t* moo, const moo_ooch_t* file_name, moo_oow_t* start_offset);
|
|
|
|
int moo_addclasstodbgi (moo_t* moo, const moo_ooch_t* class_name, moo_oow_t file_offset, moo_oow_t file_line, moo_oow_t* start_offset);
|
2019-07-12 03:38:45 +00:00
|
|
|
int moo_addmethodtodbgi (moo_t* moo, moo_oow_t file_offset, moo_oow_t class_offset, const moo_ooch_t* method_name, moo_oow_t start_line, const moo_oow_t* code_loc_ptr, moo_oow_t code_loc_len, const moo_ooch_t* text_ptr, moo_oow_t text_len, moo_oow_t* start_offset);
|
2019-07-09 15:56:34 +00:00
|
|
|
|
2019-07-10 09:19:38 +00:00
|
|
|
/* ========================================================================= */
|
|
|
|
/* comp.c */
|
|
|
|
/* ========================================================================= */
|
|
|
|
#if defined(MOO_INCLUDE_COMPILER)
|
|
|
|
const moo_ooch_t* moo_addcioname (moo_t* moo, const moo_oocs_t* name);
|
2019-07-10 15:30:08 +00:00
|
|
|
void moo_clearcionames (moo_t* moo);
|
2019-07-10 09:19:38 +00:00
|
|
|
#endif
|
|
|
|
|
2015-04-30 15:56:05 +00:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|