This is a port of the mruby/c tutorial Chapter 03 to the mbed environment.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers global.h Source File

global.h

Go to the documentation of this file.
00001 /*! @file
00002   @brief
00003   Manage global objects.
00004 
00005   <pre>
00006   Copyright (C) 2015 Kyushu Institute of Technology.
00007   Copyright (C) 2015 Shimane IT Open-innovation Center.
00008 
00009   This file is distributed under BSD 3-Clause License.
00010 
00011   </pre>
00012 */
00013 
00014 #ifndef MRBC_SRC_GLOBAL_H_
00015 #define MRBC_SRC_GLOBAL_H_
00016 
00017 #include "value.h "
00018 
00019 #ifdef __cplusplus
00020 extern "C" {
00021 #endif
00022 
00023 #define OBJECT_WITH_SYMBOL\
00024   mrb_sym sym_id;\
00025   mrb_object obj
00026 
00027 typedef struct GLOBAL_OBJECT {
00028   OBJECT_WITH_SYMBOL;
00029 } mrb_globalobject;
00030 
00031 typedef struct CONST_OBJECT {
00032   OBJECT_WITH_SYMBOL;
00033 } mrb_constobject;
00034 
00035 void global_object_add(mrb_sym sym_id, mrb_object *obj);
00036 mrb_object global_object_get(mrb_sym sym_id);
00037 
00038 void const_add(mrb_sym sym_id, mrb_object *obj);
00039 mrb_object const_get(mrb_sym sym_id);
00040 
00041 #ifdef __cplusplus
00042 }
00043 #endif
00044 #endif
00045