31#if MRBC_USE_FLOAT == 1
50 const int INT_BITS =
sizeof(
mrbc_int_t) * CHAR_BIT;
104#if MRBC_USE_FLOAT && MRBC_USE_MATH
132 if( (ret != 0) && ((v0 ^ v1) < 0) ) ret += v1;
183 const int INT_BITS =
sizeof(
mrbc_int_t) * CHAR_BIT;
185 if( y >= INT_BITS )
return 0;
186 if( y >= 0 )
return x << y;
187 if( y <= -INT_BITS )
return 0;
310#if MRBC_USE_STRING_UTF8
311int mrbc_utf8_encode(int32_t codepoint,
char *buf)
313 if( codepoint < 0 || codepoint > 0x10FFFF ) {
316 if( codepoint >= 0xD800 && codepoint <= 0xDFFF ) {
320 if( codepoint <= 0x7F ) {
321 buf[0] = (char)codepoint;
323 }
else if( codepoint <= 0x7FF ) {
324 buf[0] = (char)(0xC0 | (codepoint >> 6));
325 buf[1] = (char)(0x80 | (codepoint & 0x3F));
327 }
else if( codepoint <= 0xFFFF ) {
328 buf[0] = (char)(0xE0 | (codepoint >> 12));
329 buf[1] = (char)(0x80 | ((codepoint >> 6) & 0x3F));
330 buf[2] = (char)(0x80 | (codepoint & 0x3F));
333 buf[0] = (char)(0xF0 | (codepoint >> 18));
334 buf[1] = (char)(0x80 | ((codepoint >> 12) & 0x3F));
335 buf[2] = (char)(0x80 | ((codepoint >> 6) & 0x3F));
336 buf[3] = (char)(0x80 | (codepoint & 0x3F));
347#if MRBC_USE_STRING_UTF8
352 if( codepoint < 0 ) {
356 if( codepoint >= 0xD800 && codepoint <= 0xDFFF ) {
360 if( codepoint > 0x10FFFF ) {
366 if( codepoint > 0xFF ) {
371 buf[0] = (char)codepoint;
397 if( base < 2 || base > 36 ) {
447#include "_autogen_class_integer.h"
550#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.