rabbit-slide-pmq20-embedding_mruby_into_c_and_an_actual_example 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rabbit +1 -0
- data/Internet-Initiative-Japan-Inc.-logo.jpg +0 -0
- data/README.md +22 -0
- data/Rakefile +5 -0
- data/WP_20141105_06_03_25_Pro.jpg +0 -0
- data/config.yaml +22 -0
- data/main.md +160 -0
- data/mruby-ja1.png +0 -0
- data/mruby-ja2.png +0 -0
- data/mruby-product1.png +0 -0
- data/mruby-product2.png +0 -0
- data/mruby.png +0 -0
- data/pdf/embedding_mruby_into_c_and_an_actual_example-embedding_mruby_into_c_and_an_actual_example.pdf +0 -0
- metadata +70 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 984cfc13eeaf9233907304013380bc2f75c2690e
|
4
|
+
data.tar.gz: 0d4772d5a69a22d56b71a18a3a17b772996ed619
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5cace7a10dc7dd6813723f8ce3d2c8cdf35514b8680a13f6458f02c3d7062c24bd14820681219299fd673a279742abcd0be7f7a4de9c2a168fcc438f63d82dc2
|
7
|
+
data.tar.gz: e35f15b29f7743e26d34cc264aceb647033684ac413e528e42b8289d733bf11e9a1c960dab96b1b4650f445c79e288310764db20c7f566ed36b9218d47a9a215
|
data/.rabbit
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--full-screen main.md
|
Binary file
|
data/README.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Presentation
|
2
|
+
|
3
|
+
## For author
|
4
|
+
|
5
|
+
### Show
|
6
|
+
|
7
|
+
rake
|
8
|
+
|
9
|
+
### Publish
|
10
|
+
|
11
|
+
rake publish
|
12
|
+
|
13
|
+
## For viewers
|
14
|
+
|
15
|
+
### Install
|
16
|
+
|
17
|
+
gem install embedding_mruby_into_c_and_an_actual_example
|
18
|
+
|
19
|
+
### Show
|
20
|
+
|
21
|
+
rabbit embedding_mruby_into_c_and_an_actual_example.gem
|
22
|
+
|
data/Rakefile
ADDED
Binary file
|
data/config.yaml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
id: embedding_mruby_into_c_and_an_actual_example
|
3
|
+
base_name: embedding_mruby_into_c_and_an_actual_example
|
4
|
+
tags:
|
5
|
+
- mruby
|
6
|
+
- c
|
7
|
+
- ofpsvr
|
8
|
+
presentation_date:
|
9
|
+
version: 1.0.0
|
10
|
+
licenses: []
|
11
|
+
slideshare_id:
|
12
|
+
speaker_deck_id:
|
13
|
+
ustream_id:
|
14
|
+
vimeo_id:
|
15
|
+
youtube_id:
|
16
|
+
author:
|
17
|
+
markup_language: :markdown
|
18
|
+
name: P.S.V.R
|
19
|
+
email: pmq2001@gmail.com
|
20
|
+
rubygems_user: pmq20
|
21
|
+
slideshare_user: ssuser75e7be
|
22
|
+
speaker_deck_user: pmq20
|
data/main.md
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
# Embedding mruby into C and an actual example
|
2
|
+
author
|
3
|
+
: P.S.V.R
|
4
|
+
(阿里巴巴 - 孝达)
|
5
|
+
|
6
|
+
allotted-time
|
7
|
+
: 1h
|
8
|
+
|
9
|
+
theme
|
10
|
+
: debian
|
11
|
+
|
12
|
+
# mruby
|
13
|
+
|
14
|
+
![](mruby.png){:relative_height='80' reflect_ratio='0.5'}
|
15
|
+
|
16
|
+
m = _m_ atz' + e _m_ beddable + _m_ inimalistic + _m_ odular
|
17
|
+
|
18
|
+
# why mruby?
|
19
|
+
|
20
|
+
![](mruby-ja2.png){:relative_height='100'}
|
21
|
+
|
22
|
+
# purpose: boost productivities of embedded dev.
|
23
|
+
|
24
|
+
![](mruby-ja1.png){:relative_height='100'}
|
25
|
+
|
26
|
+
# who is using it?
|
27
|
+
|
28
|
+
![](mruby-product2.png){:relative_height='80'}
|
29
|
+
|
30
|
+
* 富士電機(杭州)軟件有限公司
|
31
|
+
|
32
|
+
# who is using it?
|
33
|
+
|
34
|
+
![](mruby-product1.png){:relative_height='80'}
|
35
|
+
|
36
|
+
* IIJ's router products c.f. https://github.com/iij/mruby
|
37
|
+
|
38
|
+
|
39
|
+
# who _should have been_ using it?
|
40
|
+
|
41
|
+
![](WP_20141105_06_03_25_Pro.jpg){:relative_height='80'}
|
42
|
+
|
43
|
+
* could have been more energy-efficient and inexpensive and easy-to-maintain via mruby...
|
44
|
+
|
45
|
+
# Actually...
|
46
|
+
|
47
|
+
* mruby is not only for the EMBEDDED WORLD
|
48
|
+
* mruby is for the ENTIRE C WORLD
|
49
|
+
* just knowing C is enough to get you going, you don't necessarily need embedded devices or EE degrees
|
50
|
+
|
51
|
+
# who _is_ also using it?
|
52
|
+
|
53
|
+
* `mod_mruby`:
|
54
|
+
|
55
|
+
https://github.com/matsumoto-r/mod_mruby
|
56
|
+
|
57
|
+
* `ngx_mruby`:
|
58
|
+
|
59
|
+
https://github.com/matsumoto-r/ngx_mruby
|
60
|
+
|
61
|
+
# who _is_ also using it?
|
62
|
+
|
63
|
+
* `php-mruby`:
|
64
|
+
|
65
|
+
https://github.com/chobie/php-mruby
|
66
|
+
|
67
|
+
* `ab-mruby`:
|
68
|
+
|
69
|
+
https://github.com/matsumoto-r/ab-mruby
|
70
|
+
|
71
|
+
# who _is_ also using it?
|
72
|
+
|
73
|
+
* `go-mruby`:
|
74
|
+
|
75
|
+
https://github.com/mitchellh/go-mruby
|
76
|
+
|
77
|
+
# "反主为客"
|
78
|
+
|
79
|
+
* MRI: 主Ruby 客C
|
80
|
+
* mruby: 主C 客Ruby
|
81
|
+
|
82
|
+
# "反主为客"
|
83
|
+
* MRI:
|
84
|
+
|
85
|
+
only _1_ VM per process, then add features to the VM
|
86
|
+
|
87
|
+
* mruby:
|
88
|
+
|
89
|
+
_N_ VMs per process (could be one VM per thread, no need to lock), then call VMs from C
|
90
|
+
|
91
|
+
# how to embed
|
92
|
+
|
93
|
+
* open `mrb_state`
|
94
|
+
* define business-domain ruby-classes and methods in the compile-time
|
95
|
+
* dynamically invoke ruby-classes and methods in the run-time
|
96
|
+
* close `mrb_state`
|
97
|
+
|
98
|
+
# "mrb_state"
|
99
|
+
|
100
|
+
* NO GLOBAL VARIABLES, everything are inside "mrb_state"
|
101
|
+
* refereed to by almost all functions
|
102
|
+
* [_demo_] see "typedef struct mrb_state"
|
103
|
+
|
104
|
+
# "mrb_value"
|
105
|
+
* could store pointer, integer, float, etc
|
106
|
+
* set: `mrb_fixnum_value`, `mrb_float_value`, ...
|
107
|
+
* get: `mrb_fixnum`, `mrb_float`, ...
|
108
|
+
* [_demo_] see "typedef struct mrb_value" ( x2 imple.)
|
109
|
+
|
110
|
+
# "mrb_funcall"
|
111
|
+
|
112
|
+
obj = mrb_funcall(mrb, obj, "inspect", 0);
|
113
|
+
{: lang="c"}
|
114
|
+
|
115
|
+
* call into instance method of a ruby-object
|
116
|
+
* e.g.
|
117
|
+
|
118
|
+
# there is no file I/O
|
119
|
+
* the underlying machine might not have a file system at all
|
120
|
+
* it's a seperate module _mruby-io_, if you want it
|
121
|
+
* event STD I/O is configurable
|
122
|
+
* [_demo_] see "#ifdef ENABLE_STDIO"
|
123
|
+
|
124
|
+
# "mrb_define_module"
|
125
|
+
|
126
|
+
mrb_ofpsvr = mrb_define_module(mrb, "Ofpsvr");
|
127
|
+
{: lang="c"}
|
128
|
+
|
129
|
+
* define business-domain ruby-classes
|
130
|
+
* e.g.
|
131
|
+
|
132
|
+
# "mrb_define_module_function"
|
133
|
+
|
134
|
+
mrb_define_module_function(mrb, mrb_ofpsvr, "uid", ofpsvr_uid, MRB_ARGS_REQ(1));
|
135
|
+
{: lang="c"}
|
136
|
+
|
137
|
+
* define business-domain ruby-methods
|
138
|
+
* e.g.
|
139
|
+
|
140
|
+
# "mrb_load_string"
|
141
|
+
|
142
|
+
mrb_load_string(mrb, "puts \"いまは#{Time.now}です。\"");
|
143
|
+
{: lang="c"}
|
144
|
+
|
145
|
+
* define business-domain ruby-methods
|
146
|
+
* e.g.
|
147
|
+
|
148
|
+
# Exception Handling
|
149
|
+
|
150
|
+
if (mrb->exc) {
|
151
|
+
mrb_value exception = mrb_obj_value(mrb->exc);
|
152
|
+
mrb->exc = 0;
|
153
|
+
}
|
154
|
+
{: lang="c"}
|
155
|
+
|
156
|
+
* do not forget to check `mrb-exc` when running unpredictable code!
|
157
|
+
|
158
|
+
# an actual example
|
159
|
+
|
160
|
+
* [_demo_] https://github.com/pmq20/ofpsvr
|
data/mruby-ja1.png
ADDED
Binary file
|
data/mruby-ja2.png
ADDED
Binary file
|
data/mruby-product1.png
ADDED
Binary file
|
data/mruby-product2.png
ADDED
Binary file
|
data/mruby.png
ADDED
Binary file
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rabbit-slide-pmq20-embedding_mruby_into_c_and_an_actual_example
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- P.S.V.R
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rabbit
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.0.2
|
27
|
+
description: ''
|
28
|
+
email:
|
29
|
+
- pmq2001@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".rabbit"
|
35
|
+
- Internet-Initiative-Japan-Inc.-logo.jpg
|
36
|
+
- README.md
|
37
|
+
- Rakefile
|
38
|
+
- WP_20141105_06_03_25_Pro.jpg
|
39
|
+
- config.yaml
|
40
|
+
- main.md
|
41
|
+
- mruby-ja1.png
|
42
|
+
- mruby-ja2.png
|
43
|
+
- mruby-product1.png
|
44
|
+
- mruby-product2.png
|
45
|
+
- mruby.png
|
46
|
+
- pdf/embedding_mruby_into_c_and_an_actual_example-embedding_mruby_into_c_and_an_actual_example.pdf
|
47
|
+
homepage: http://slide.rabbit-shocker.org/authors/pmq20/embedding_mruby_into_c_and_an_actual_example/
|
48
|
+
licenses: []
|
49
|
+
metadata: {}
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options: []
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
requirements: []
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 2.4.5
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: Presentation
|
70
|
+
test_files: []
|