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
4aa9111f
Commit
4aa9111f
authored
Jun 15, 2012
by
Yukihiro Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
escape codedump strings/symbols
parent
0ef76fdb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
19 deletions
+24
-19
src/codegen.c
src/codegen.c
+24
-19
No files found.
src/codegen.c
View file @
4aa9111f
...
@@ -2050,7 +2050,7 @@ codedump(mrb_state *mrb, int n)
...
@@ -2050,7 +2050,7 @@ codedump(mrb_state *mrb, int n)
printf
(
"OP_LOADI
\t
R%d
\t
%d
\n
"
,
GETARG_A
(
c
),
GETARG_sBx
(
c
));
printf
(
"OP_LOADI
\t
R%d
\t
%d
\n
"
,
GETARG_A
(
c
),
GETARG_sBx
(
c
));
break
;
break
;
case
OP_LOADSYM
:
case
OP_LOADSYM
:
printf
(
"OP_LOADSYM
\t
R%d
\t
'%s'
\n
"
,
GETARG_A
(
c
),
printf
(
"OP_LOADSYM
\t
R%d
\t
:%s
\n
"
,
GETARG_A
(
c
),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_Bx
(
c
)]));
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_Bx
(
c
)]));
break
;
break
;
case
OP_LOADNIL
:
case
OP_LOADNIL
:
...
@@ -2066,20 +2066,20 @@ codedump(mrb_state *mrb, int n)
...
@@ -2066,20 +2066,20 @@ codedump(mrb_state *mrb, int n)
printf
(
"OP_LOADF
\t
R%d
\n
"
,
GETARG_A
(
c
));
printf
(
"OP_LOADF
\t
R%d
\n
"
,
GETARG_A
(
c
));
break
;
break
;
case
OP_GETGLOBAL
:
case
OP_GETGLOBAL
:
printf
(
"OP_GETGLOBAL
\t
R%d
\t
'%s'
\n
"
,
GETARG_A
(
c
),
printf
(
"OP_GETGLOBAL
\t
R%d
\t
:%s
\n
"
,
GETARG_A
(
c
),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_Bx
(
c
)]));
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_Bx
(
c
)]));
break
;
break
;
case
OP_SETGLOBAL
:
case
OP_SETGLOBAL
:
printf
(
"OP_SETGLOBAL
\t
'%s'
\t
R%d
\n
"
,
printf
(
"OP_SETGLOBAL
\t
:%s
\t
R%d
\n
"
,
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_Bx
(
c
)]),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_Bx
(
c
)]),
GETARG_A
(
c
));
GETARG_A
(
c
));
break
;
break
;
case
OP_GETCONST
:
case
OP_GETCONST
:
printf
(
"OP_GETCONST
\t
R%d
\t
'%s'
\n
"
,
GETARG_A
(
c
),
printf
(
"OP_GETCONST
\t
R%d
\t
:%s
\n
"
,
GETARG_A
(
c
),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_Bx
(
c
)]));
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_Bx
(
c
)]));
break
;
break
;
case
OP_SETCONST
:
case
OP_SETCONST
:
printf
(
"OP_SETCONST
\t
'%s'
\t
R%d
\n
"
,
printf
(
"OP_SETCONST
\t
:%s
\t
R%d
\n
"
,
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_Bx
(
c
)]),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_Bx
(
c
)]),
GETARG_A
(
c
));
GETARG_A
(
c
));
break
;
break
;
...
@@ -2128,7 +2128,7 @@ codedump(mrb_state *mrb, int n)
...
@@ -2128,7 +2128,7 @@ codedump(mrb_state *mrb, int n)
printf
(
"OP_JMPNOT
\t
R%d
\t
%03d
\n
"
,
GETARG_A
(
c
),
i
+
GETARG_sBx
(
c
));
printf
(
"OP_JMPNOT
\t
R%d
\t
%03d
\n
"
,
GETARG_A
(
c
),
i
+
GETARG_sBx
(
c
));
break
;
break
;
case
OP_SEND
:
case
OP_SEND
:
printf
(
"OP_SEND
\t
R%d
\t
'%s'
\t
%d
\n
"
,
GETARG_A
(
c
),
printf
(
"OP_SEND
\t
R%d
\t
:%s
\t
%d
\n
"
,
GETARG_A
(
c
),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
GETARG_C
(
c
));
GETARG_C
(
c
));
break
;
break
;
...
@@ -2183,52 +2183,52 @@ codedump(mrb_state *mrb, int n)
...
@@ -2183,52 +2183,52 @@ codedump(mrb_state *mrb, int n)
printf
(
"OP_RANGE
\t
R%d
\t
R%d
\t
%d
\n
"
,
GETARG_A
(
c
),
GETARG_B
(
c
),
GETARG_C
(
c
));
printf
(
"OP_RANGE
\t
R%d
\t
R%d
\t
%d
\n
"
,
GETARG_A
(
c
),
GETARG_B
(
c
),
GETARG_C
(
c
));
break
;
break
;
case
OP_METHOD
:
case
OP_METHOD
:
printf
(
"OP_METHOD
\t
R%d
\t
'%s'
\n
"
,
GETARG_A
(
c
),
printf
(
"OP_METHOD
\t
R%d
\t
:%s
\n
"
,
GETARG_A
(
c
),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]));
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]));
break
;
break
;
case
OP_ADD
:
case
OP_ADD
:
printf
(
"OP_ADD
\t
R%d
\t
'%s'
\t
%d
\n
"
,
GETARG_A
(
c
),
printf
(
"OP_ADD
\t
R%d
\t
:%s
\t
%d
\n
"
,
GETARG_A
(
c
),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
GETARG_C
(
c
));
GETARG_C
(
c
));
break
;
break
;
case
OP_SUB
:
case
OP_SUB
:
printf
(
"OP_SUB
\t
R%d
\t
'%s'
\t
%d
\n
"
,
GETARG_A
(
c
),
printf
(
"OP_SUB
\t
R%d
\t
:%s
\t
%d
\n
"
,
GETARG_A
(
c
),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
GETARG_C
(
c
));
GETARG_C
(
c
));
break
;
break
;
case
OP_MUL
:
case
OP_MUL
:
printf
(
"OP_MUL
\t
R%d
\t
'%s'
\t
%d
\n
"
,
GETARG_A
(
c
),
printf
(
"OP_MUL
\t
R%d
\t
:%s
\t
%d
\n
"
,
GETARG_A
(
c
),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
GETARG_C
(
c
));
GETARG_C
(
c
));
break
;
break
;
case
OP_DIV
:
case
OP_DIV
:
printf
(
"OP_DIV
\t
R%d
\t
'%s'
\t
%d
\n
"
,
GETARG_A
(
c
),
printf
(
"OP_DIV
\t
R%d
\t
:%s
\t
%d
\n
"
,
GETARG_A
(
c
),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
GETARG_C
(
c
));
GETARG_C
(
c
));
break
;
break
;
case
OP_LT
:
case
OP_LT
:
printf
(
"OP_LT
\t
R%d
\t
'%s'
\t
%d
\n
"
,
GETARG_A
(
c
),
printf
(
"OP_LT
\t
R%d
\t
:%s
\t
%d
\n
"
,
GETARG_A
(
c
),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
GETARG_C
(
c
));
GETARG_C
(
c
));
break
;
break
;
case
OP_LE
:
case
OP_LE
:
printf
(
"OP_LE
\t
R%d
\t
'%s'
\t
%d
\n
"
,
GETARG_A
(
c
),
printf
(
"OP_LE
\t
R%d
\t
:%s
\t
%d
\n
"
,
GETARG_A
(
c
),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
GETARG_C
(
c
));
GETARG_C
(
c
));
break
;
break
;
case
OP_GT
:
case
OP_GT
:
printf
(
"OP_GT
\t
R%d
\t
'%s'
\t
%d
\n
"
,
GETARG_A
(
c
),
printf
(
"OP_GT
\t
R%d
\t
:%s
\t
%d
\n
"
,
GETARG_A
(
c
),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
GETARG_C
(
c
));
GETARG_C
(
c
));
break
;
break
;
case
OP_GE
:
case
OP_GE
:
printf
(
"OP_GE
\t
R%d
\t
'%s'
\t
%d
\n
"
,
GETARG_A
(
c
),
printf
(
"OP_GE
\t
R%d
\t
:%s
\t
%d
\n
"
,
GETARG_A
(
c
),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
GETARG_C
(
c
));
GETARG_C
(
c
));
break
;
break
;
case
OP_EQ
:
case
OP_EQ
:
printf
(
"OP_EQ
\t
R%d
\t
'%s'
\t
%d
\n
"
,
GETARG_A
(
c
),
printf
(
"OP_EQ
\t
R%d
\t
:%s
\t
%d
\n
"
,
GETARG_A
(
c
),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]),
GETARG_C
(
c
));
GETARG_C
(
c
));
break
;
break
;
...
@@ -2253,7 +2253,12 @@ codedump(mrb_state *mrb, int n)
...
@@ -2253,7 +2253,12 @@ codedump(mrb_state *mrb, int n)
printf
(
"OP_APOST
\t
R%d
\t
%d
\t
%d
\n
"
,
GETARG_A
(
c
),
GETARG_B
(
c
),
GETARG_C
(
c
));
printf
(
"OP_APOST
\t
R%d
\t
%d
\t
%d
\n
"
,
GETARG_A
(
c
),
GETARG_B
(
c
),
GETARG_C
(
c
));
break
;
break
;
case
OP_STRING
:
case
OP_STRING
:
printf
(
"OP_STRING
\t
R%d
\t
'%s'
\n
"
,
GETARG_A
(
c
),
RSTRING_PTR
(
irep
->
pool
[
GETARG_Bx
(
c
)]));
{
mrb_value
s
=
irep
->
pool
[
GETARG_Bx
(
c
)];
s
=
mrb_str_dump
(
mrb
,
s
);
printf
(
"OP_STRING
\t
R%d
\t
%s
\n
"
,
GETARG_A
(
c
),
RSTRING_PTR
(
s
));
}
break
;
break
;
case
OP_STRCAT
:
case
OP_STRCAT
:
printf
(
"OP_STRCAT
\t
R%d
\t
R%d
\n
"
,
GETARG_A
(
c
),
GETARG_B
(
c
));
printf
(
"OP_STRCAT
\t
R%d
\t
R%d
\n
"
,
GETARG_A
(
c
),
GETARG_B
(
c
));
...
@@ -2266,11 +2271,11 @@ codedump(mrb_state *mrb, int n)
...
@@ -2266,11 +2271,11 @@ codedump(mrb_state *mrb, int n)
printf
(
"OP_OCLASS
\t
R%d
\n
"
,
GETARG_A
(
c
));
printf
(
"OP_OCLASS
\t
R%d
\n
"
,
GETARG_A
(
c
));
break
;
break
;
case
OP_CLASS
:
case
OP_CLASS
:
printf
(
"OP_CLASS
\t
R%d
\t
'%s'
\n
"
,
GETARG_A
(
c
),
printf
(
"OP_CLASS
\t
R%d
\t
:%s
\n
"
,
GETARG_A
(
c
),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]));
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]));
break
;
break
;
case
OP_MODULE
:
case
OP_MODULE
:
printf
(
"OP_MODULE
\t
R%d
\t
'%s'
\n
"
,
GETARG_A
(
c
),
printf
(
"OP_MODULE
\t
R%d
\t
:%s
\n
"
,
GETARG_A
(
c
),
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]));
mrb_sym2name
(
mrb
,
irep
->
syms
[
GETARG_B
(
c
)]));
break
;
break
;
case
OP_EXEC
:
case
OP_EXEC
:
...
...
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