Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
ad2e6d0c
Commit
ad2e6d0c
authored
May 07, 2014
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2204 from take-cheeze/kernel_fail
Implement Kernel.fail and Kernel#fail .
parents
14e5c373
2fca5f33
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
1 deletion
+31
-1
include/mruby/error.h
include/mruby/error.h
+3
-0
mrbgems/default.gembox
mrbgems/default.gembox
+3
-0
mrbgems/mruby-kernel-ext/mrbgem.rake
mrbgems/mruby-kernel-ext/mrbgem.rake
+5
-0
mrbgems/mruby-kernel-ext/src/kernel.c
mrbgems/mruby-kernel-ext/src/kernel.c
+15
-0
mrbgems/mruby-kernel-ext/test/kernel.rb
mrbgems/mruby-kernel-ext/test/kernel.rb
+4
-0
src/kernel.c
src/kernel.c
+1
-1
No files found.
include/mruby/error.h
View file @
ad2e6d0c
...
...
@@ -21,6 +21,9 @@ void mrb_print_backtrace(mrb_state *mrb);
mrb_value
mrb_exc_backtrace
(
mrb_state
*
mrb
,
mrb_value
exc
);
mrb_value
mrb_get_backtrace
(
mrb_state
*
mrb
);
/* declaration for fail method */
mrb_value
mrb_f_raise
(
mrb_state
*
,
mrb_value
);
#if defined(__cplusplus)
}
/* extern "C" { */
#endif
...
...
mrbgems/default.gembox
View file @
ad2e6d0c
...
...
@@ -64,4 +64,7 @@ MRuby::GemBox.new do |conf|
# Generate mruby command
conf.gem :core => "mruby-bin-mruby"
# Use extensional Kernel module
conf.gem :core => "mruby-kernel-ext"
end
mrbgems/mruby-kernel-ext/mrbgem.rake
0 → 100644
View file @
ad2e6d0c
MRuby
::
Gem
::
Specification
.
new
(
'mruby-kernel-ext'
)
do
|
spec
|
spec
.
license
=
'MIT'
spec
.
author
=
'mruby developers'
spec
.
summary
=
'extensional Kernel module'
end
mrbgems/mruby-kernel-ext/src/kernel.c
0 → 100644
View file @
ad2e6d0c
#include <mruby.h>
#include <mruby/error.h>
void
mrb_mruby_kernel_ext_gem_init
(
mrb_state
*
mrb
)
{
struct
RClass
*
krn
=
mrb
->
kernel_module
;
mrb_define_module_function
(
mrb
,
krn
,
"fail"
,
mrb_f_raise
,
MRB_ARGS_NONE
());
}
void
mrb_mruby_kernel_ext_gem_final
(
mrb_state
*
mrb
)
{
}
mrbgems/mruby-kernel-ext/test/kernel.rb
0 → 100644
View file @
ad2e6d0c
assert
(
'Kernel.fail, Kernel#fail'
)
do
assert_raise
(
RuntimeError
)
{
fail
}
assert_raise
(
RuntimeError
)
{
Kernel
.
fail
}
end
src/kernel.c
View file @
ad2e6d0c
...
...
@@ -924,7 +924,7 @@ mrb_obj_public_methods(mrb_state *mrb, mrb_value self)
* raise "Failed to create socket"
* raise ArgumentError, "No parameters", caller
*/
static
mrb_value
mrb_value
mrb_f_raise
(
mrb_state
*
mrb
,
mrb_value
self
)
{
mrb_value
a
[
2
],
exc
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment