31#if MRBC_USE_FLOAT == 1
93#if MRBC_USE_FLOAT && MRBC_USE_MATH
121 if( (ret != 0) && ((v0 ^ v1) < 0) ) ret += v1;
172 const int INT_BITS =
sizeof(
mrbc_int_t) * CHAR_BIT;
174 if( y >= INT_BITS )
return 0;
175 if( y >= 0 )
return x << y;
176 if( y <= -INT_BITS )
return 0;
299#if MRBC_USE_STRING_UTF8
300int mrbc_utf8_encode(int32_t codepoint,
char *buf)
302 if( codepoint < 0 || codepoint > 0x10FFFF ) {
305 if( codepoint >= 0xD800 && codepoint <= 0xDFFF ) {
309 if( codepoint <= 0x7F ) {
310 buf[0] = (char)codepoint;
312 }
else if( codepoint <= 0x7FF ) {
313 buf[0] = (char)(0xC0 | (codepoint >> 6));
314 buf[1] = (char)(0x80 | (codepoint & 0x3F));
316 }
else if( codepoint <= 0xFFFF ) {
317 buf[0] = (char)(0xE0 | (codepoint >> 12));
318 buf[1] = (char)(0x80 | ((codepoint >> 6) & 0x3F));
319 buf[2] = (char)(0x80 | (codepoint & 0x3F));
322 buf[0] = (char)(0xF0 | (codepoint >> 18));
323 buf[1] = (char)(0x80 | ((codepoint >> 12) & 0x3F));
324 buf[2] = (char)(0x80 | ((codepoint >> 6) & 0x3F));
325 buf[3] = (char)(0x80 | (codepoint & 0x3F));
336#if MRBC_USE_STRING_UTF8
341 if( codepoint < 0 ) {
345 if( codepoint >= 0xD800 && codepoint <= 0xDFFF ) {
349 if( codepoint > 0x10FFFF ) {
355 if( codepoint > 0xFF ) {
360 buf[0] = (char)codepoint;
386 if( base < 2 || base > 36 ) {
436#include "_autogen_class_integer.h"
539#include "_autogen_class_float.h"
struct RObject mrbc_value
Value object. Default version.
static mrbc_int_t shift(mrbc_int_t x, mrbc_int_t y)
void mrbc_object_inspect(mrbc_vm *vm, mrbc_value v[], int argc)
mrbc_value mrbc_string_new(mrbc_vm *vm, const void *src, int len)
static mrbc_value mrbc_string_new_cstr(mrbc_vm *vm, const char *src)
int mrbc_printf_int(mrbc_printf_t *pf, mrbc_int_t value, unsigned int base)
static void mrbc_printf_end(mrbc_printf_t *pf)
struct RPrintf mrbc_printf_t
printf tiny (mruby/c) version data container.
static void mrbc_printf_init(mrbc_printf_t *pf, char *buf, int size, const char *fstr)
void mrbc_raise(struct VM *vm, struct RClass *exc_cls, const char *msg)
void mrbc_raisef(struct VM *vm, struct RClass *exc_cls, const char *fstr,...)
Include at once the necessary header files.
int mrbc_compare(const mrbc_value *v1, const mrbc_value *v2)
void mrbc_format_float(char *buf, int bufsiz, mrbc_float_t flo)
#define SET_BOOL_RETURN(n)
#define SET_INT_RETURN(n)
@ MRBC_TT_INTEGER
Integer.
#define SET_FLOAT_RETURN(n)
struct VM mrbc_vm
Virtual Machine.
Global configuration of mruby/c VM's.