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
384db0d8
Commit
384db0d8
authored
Mar 28, 2013
by
Masaki Muranaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix format for new mrb_raisef().
parent
e265d7c7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
mrbgems/mruby-sprintf/src/sprintf.c
mrbgems/mruby-sprintf/src/sprintf.c
+13
-13
No files found.
mrbgems/mruby-sprintf/src/sprintf.c
View file @
384db0d8
...
...
@@ -83,7 +83,7 @@ mrb_fix2binstr(mrb_state *mrb, mrb_value x, int base)
char
d
;
if
(
base
!=
2
)
{
mrb_raisef
(
mrb
,
E_ARGUMENT_ERROR
,
"invalid radix %
d"
,
base
);
mrb_raisef
(
mrb
,
E_ARGUMENT_ERROR
,
"invalid radix %
S"
,
mrb_fixnum_value
(
base
)
);
}
if
(
val
>=
(
1
<<
10
))
...
...
@@ -148,17 +148,17 @@ mrb_fix2binstr(mrb_state *mrb, mrb_value x, int base)
#define GETARG() (!mrb_undef_p(nextvalue) ? nextvalue : \
posarg == -1 ? \
(mrb_raisef(mrb, E_ARGUMENT_ERROR, "unnumbered(%
d) mixed with numbered", nextarg
), mrb_undef_value()) : \
(mrb_raisef(mrb, E_ARGUMENT_ERROR, "unnumbered(%
S) mixed with numbered", mrb_fixnum_value(nextarg)
), mrb_undef_value()) : \
posarg == -2 ? \
(mrb_raisef(mrb, E_ARGUMENT_ERROR, "unnumbered(%
d) mixed with named", nextarg
), mrb_undef_value()) : \
(mrb_raisef(mrb, E_ARGUMENT_ERROR, "unnumbered(%
S) mixed with named", mrb_fixnum_value(nextarg)
), mrb_undef_value()) : \
(posarg = nextarg++, GETNTHARG(posarg)))
#define GETPOSARG(n) (posarg > 0 ? \
(mrb_raisef(mrb, E_ARGUMENT_ERROR, "numbered(%
d) after unnumbered(%d)", n, posarg
), mrb_undef_value()) : \
(mrb_raisef(mrb, E_ARGUMENT_ERROR, "numbered(%
S) after unnumbered(%S)", mrb_fixnum_value(n), mrb_fixnum_value(posarg)
), mrb_undef_value()) : \
posarg == -2 ? \
(mrb_raisef(mrb, E_ARGUMENT_ERROR, "numbered(%
d) after named", n
), mrb_undef_value()) : \
(mrb_raisef(mrb, E_ARGUMENT_ERROR, "numbered(%
S) after named", mrb_fixnum_value(n)
), mrb_undef_value()) : \
((n < 1) ? \
(mrb_raisef(mrb, E_ARGUMENT_ERROR, "invalid index - %
d$", n
), mrb_undef_value()) : \
(mrb_raisef(mrb, E_ARGUMENT_ERROR, "invalid index - %
S$", mrb_fixnum_value(n)
), mrb_undef_value()) : \
(posarg = -1, GETNTHARG(n))))
#define GETNTHARG(nth) \
...
...
@@ -166,9 +166,9 @@ mrb_fix2binstr(mrb_state *mrb, mrb_value x, int base)
#define GETNAMEARG(id, name, len) ( \
posarg > 0 ? \
(mrb_raisef(mrb, E_ARGUMENT_ERROR, "named%
.*s after unnumbered(%d)", (len), (name), posarg
), mrb_undef_value()) : \
(mrb_raisef(mrb, E_ARGUMENT_ERROR, "named%
S after unnumbered(%S)", mrb_str_new(mrb, (name), (len)), mrb_fixnum_value(posarg)
), mrb_undef_value()) : \
posarg == -1 ? \
(mrb_raisef(mrb, E_ARGUMENT_ERROR, "named%
.*s after numbered", (len), (name
)), mrb_undef_value()) : \
(mrb_raisef(mrb, E_ARGUMENT_ERROR, "named%
S after numbered", mrb_str_new(mrb, (name), (len)
)), mrb_undef_value()) : \
(posarg = -2, mrb_hash_fetch(mrb, get_hash(mrb, &hash, argc, argv), id, mrb_undef_value())))
#define GETNUM(n, val) \
...
...
@@ -553,7 +553,7 @@ mrb_str_format(mrb_state *mrb, int argc, const mrb_value *argv, mrb_value fmt)
retry:
switch
(
*
p
)
{
default:
mrb_raisef
(
mrb
,
E_ARGUMENT_ERROR
,
"malformed format string -
%%%c"
,
*
p
);
mrb_raisef
(
mrb
,
E_ARGUMENT_ERROR
,
"malformed format string -
\\
%%S"
,
mrb_str_new
(
mrb
,
p
,
1
)
);
break
;
case
' '
:
...
...
@@ -592,7 +592,7 @@ retry:
GETNUM
(
n
,
width
);
if
(
*
p
==
'$'
)
{
if
(
!
mrb_undef_p
(
nextvalue
))
{
mrb_raisef
(
mrb
,
E_ARGUMENT_ERROR
,
"value given twice - %
d$"
,
n
);
mrb_raisef
(
mrb
,
E_ARGUMENT_ERROR
,
"value given twice - %
S$"
,
mrb_fixnum_value
(
n
)
);
}
nextvalue
=
GETPOSARG
(
n
);
p
++
;
...
...
@@ -612,14 +612,14 @@ retry:
for
(;
p
<
end
&&
*
p
!=
term
;
)
p
++
;
if
(
id
)
{
mrb_raisef
(
mrb
,
E_ARGUMENT_ERROR
,
"name%
.*s after <%s
>"
,
(
int
)(
p
-
start
+
1
),
start
,
mrb_sym2name
(
mrb
,
id
));
mrb_raisef
(
mrb
,
E_ARGUMENT_ERROR
,
"name%
S after <%S
>"
,
mrb_str_new
(
mrb
,
start
,
p
-
start
+
1
),
mrb_sym2str
(
mrb
,
id
));
}
symname
=
mrb_str_new
(
mrb
,
start
+
1
,
p
-
start
-
1
);
id
=
mrb_intern_str
(
mrb
,
symname
);
nextvalue
=
GETNAMEARG
(
mrb_symbol_value
(
id
),
start
,
(
int
)(
p
-
start
+
1
));
if
(
mrb_undef_p
(
nextvalue
))
{
mrb_raisef
(
mrb
,
E_KEY_ERROR
,
"key%
.*s not found"
,
(
int
)(
p
-
start
+
1
),
start
);
mrb_raisef
(
mrb
,
E_KEY_ERROR
,
"key%
S not found"
,
mrb_str_new
(
mrb
,
start
,
p
-
start
+
1
)
);
}
if
(
term
==
'}'
)
goto
format_s
;
p
++
;
...
...
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