source: EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/istruct.h@ 331

Last change on this file since 331 was 331, checked in by coas-nagasima, 6 years ago

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr
File size: 897 bytes
Line 
1/*
2** mruby/istruct.h - Inline structures
3**
4** See Copyright Notice in mruby.h
5*/
6
7#ifndef MRUBY_ISTRUCT_H
8#define MRUBY_ISTRUCT_H
9
10#include "common.h"
11#include <string.h>
12
13/**
14 * Inline structures that fit in RVALUE
15 *
16 * They cannot have finalizer, and cannot have instance variables.
17 */
18MRB_BEGIN_DECL
19
20#define ISTRUCT_DATA_SIZE (sizeof(void*) * 3)
21
22struct RIstruct {
23 MRB_OBJECT_HEADER;
24 char inline_data[ISTRUCT_DATA_SIZE];
25};
26
27#define RISTRUCT(obj) ((struct RIstruct*)(mrb_ptr(obj)))
28#define ISTRUCT_PTR(obj) (RISTRUCT(obj)->inline_data)
29
30MRB_INLINE mrb_int mrb_istruct_size()
31{
32 return ISTRUCT_DATA_SIZE;
33}
34
35MRB_INLINE void* mrb_istruct_ptr(mrb_value object)
36{
37 return ISTRUCT_PTR(object);
38}
39
40MRB_INLINE void mrb_istruct_copy(mrb_value dest, mrb_value src)
41{
42 memcpy(ISTRUCT_PTR(dest), ISTRUCT_PTR(src), ISTRUCT_DATA_SIZE);
43}
44
45MRB_END_DECL
46
47#endif /* MRUBY_ISTRUCT_H */
Note: See TracBrowser for help on using the repository browser.