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
97136825
Commit
97136825
authored
Mar 04, 2013
by
Masaki Muranaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate Kernel#sprintf support from mruby core. It's moved to mrbgems.
parent
a5bc5b25
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
40 additions
and
13 deletions
+40
-13
build_config.rb
build_config.rb
+3
-0
include/mrbconf.h
include/mrbconf.h
+0
-4
mrbgems/mruby-sprintf/mrbgem.rake
mrbgems/mruby-sprintf/mrbgem.rake
+4
-0
mrbgems/mruby-sprintf/src/kernel.c
mrbgems/mruby-sprintf/src/kernel.c
+30
-0
mrbgems/mruby-sprintf/src/sprintf.c
mrbgems/mruby-sprintf/src/sprintf.c
+0
-4
mrbgems/mruby-sprintf/test/sprintf.rb
mrbgems/mruby-sprintf/test/sprintf.rb
+3
-0
src/kernel.c
src/kernel.c
+0
-5
No files found.
build_config.rb
View file @
97136825
...
...
@@ -20,6 +20,9 @@ MRuby::Build.new do |conf|
# Use standard Struct class
conf
.
gem
'mrbgems/mruby-struct'
# Use standard Kernel#sprintf method
conf
.
gem
'mrbgems/mruby-sprintf'
# Generate binaries
# conf.bins = %w(mrbc mruby mirb)
...
...
include/mrbconf.h
View file @
97136825
...
...
@@ -47,7 +47,6 @@
//#define POOL_PAGE_SIZE 16000
/* -DDISABLE_XXXX to drop following features */
//#define DISABLE_SPRINTF /* Kernel.sprintf method */
//#define DISABLE_STDIO /* use of stdio */
/* -DENABLE_XXXX to enable following features */
...
...
@@ -83,9 +82,6 @@
typedef
short
mrb_sym
;
/* define ENABLE_XXXX from DISABLE_XXX */
#ifndef DISABLE_SPRINTF
#define ENABLE_SPRINTF
#endif
#ifndef DISABLE_STDIO
#define ENABLE_STDIO
#endif
...
...
mrbgems/mruby-sprintf/mrbgem.rake
0 → 100644
View file @
97136825
MRuby
::
Gem
::
Specification
.
new
(
'mruby-sprintf'
)
do
|
spec
|
spec
.
license
=
'MIT'
spec
.
authors
=
'mruby developers'
end
mrbgems/mruby-sprintf/src/kernel.c
0 → 100644
View file @
97136825
/*
** kernel.c - Kernel module suppliment
**
** See Copyright Notice in mruby.h
*/
#include "mruby.h"
mrb_value
mrb_f_sprintf
(
mrb_state
*
mrb
,
mrb_value
obj
);
/* in sprintf.c */
void
mrb_mruby_sprintf_gem_init
(
mrb_state
*
mrb
)
{
struct
RClass
*
krn
;
if
(
mrb
->
kernel_module
==
NULL
)
{
mrb
->
kernel_module
=
mrb_define_module
(
mrb
,
"Kernel"
);
/* Might be PARANOID. */
}
krn
=
mrb
->
kernel_module
;
mrb_define_method
(
mrb
,
krn
,
"sprintf"
,
mrb_f_sprintf
,
ARGS_ANY
());
mrb_define_method
(
mrb
,
krn
,
"format"
,
mrb_f_sprintf
,
ARGS_ANY
());
}
void
mrb_mruby_sprintf_gem_final
(
mrb_state
*
mrb
)
{
/* nothing to do. */
}
mrbgems/mruby-sprintf/src/sprintf.c
View file @
97136825
...
...
@@ -6,8 +6,6 @@
#include "mruby.h"
#ifdef ENABLE_SPRINTF
#include <stdio.h>
#include <string.h>
#include "mruby/string.h"
...
...
@@ -1091,5 +1089,3 @@ fmt_setup(char *buf, size_t size, int c, int flags, int width, int prec)
*
buf
++
=
c
;
*
buf
=
'\0'
;
}
#endif
/* ENABLE_SPRINTF */
mrbgems/mruby-sprintf/test/sprintf.rb
0 → 100644
View file @
97136825
##
# Kernel#sprintf Kernel#format Test
src/kernel.c
View file @
97136825
...
...
@@ -1108,11 +1108,6 @@ mrb_init_kernel(mrb_state *mrb)
mrb_define_method
(
mrb
,
krn
,
"singleton_methods"
,
mrb_obj_singleton_methods_m
,
ARGS_ANY
());
/* 15.3.1.3.45 */
mrb_define_method
(
mrb
,
krn
,
"to_s"
,
mrb_any_to_s
,
ARGS_NONE
());
/* 15.3.1.3.46 */
#ifdef ENABLE_SPRINTF
mrb_define_method
(
mrb
,
krn
,
"sprintf"
,
mrb_f_sprintf
,
ARGS_ANY
());
/* in sprintf.c */
mrb_define_method
(
mrb
,
krn
,
"format"
,
mrb_f_sprintf
,
ARGS_ANY
());
/* in sprintf.c */
#endif
mrb_include_module
(
mrb
,
mrb
->
object_class
,
mrb
->
kernel_module
);
mrb_alias_method
(
mrb
,
mrb
->
module_class
,
mrb_intern
(
mrb
,
"dup"
),
mrb_intern
(
mrb
,
"clone"
));
}
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