Sha256: 1985d528a1e5611df12ed90d74ab9444b1ddb3d2dd4a4de2960ecc10b8f41278

Contents?: true

Size: 904 Bytes

Versions: 6

Compression:

Stored size: 904 Bytes

Contents

/**
** @file mruby/istruct.h - Inline structures
**
** See Copyright Notice in mruby.h
*/

#ifndef MRUBY_ISTRUCT_H
#define MRUBY_ISTRUCT_H

#include "common.h"
#include <string.h>

/**
 * Inline structures that fit in RVALUE
 *
 * They cannot have finalizer, and cannot have instance variables.
 */
MRB_BEGIN_DECL

#define ISTRUCT_DATA_SIZE (sizeof(void*) * 3)

struct RIStruct {
  MRB_OBJECT_HEADER;
  char inline_data[ISTRUCT_DATA_SIZE];
};

#define RISTRUCT(obj)         ((struct RIStruct*)(mrb_ptr(obj)))
#define ISTRUCT_PTR(obj)      (RISTRUCT(obj)->inline_data)

MRB_INLINE mrb_int mrb_istruct_size()
{
  return ISTRUCT_DATA_SIZE;
}

MRB_INLINE void* mrb_istruct_ptr(mrb_value object)
{
  return ISTRUCT_PTR(object);
}

MRB_INLINE void mrb_istruct_copy(mrb_value dest, mrb_value src)
{
  memcpy(ISTRUCT_PTR(dest), ISTRUCT_PTR(src), ISTRUCT_DATA_SIZE);
}

MRB_END_DECL

#endif /* MRUBY_ISTRUCT_H */

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
script_core-0.2.5 ext/enterprise_script_service/mruby/include/mruby/istruct.h
script_core-0.2.4 ext/enterprise_script_service/mruby/include/mruby/istruct.h
script_core-0.2.3 ext/enterprise_script_service/mruby/include/mruby/istruct.h
script_core-0.2.2 ext/enterprise_script_service/mruby/include/mruby/istruct.h
script_core-0.2.1 ext/enterprise_script_service/mruby/include/mruby/istruct.h
script_core-0.2.0 ext/enterprise_script_service/mruby/include/mruby/istruct.h