Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
b726fc1a
Commit
b726fc1a
authored
Jun 05, 2019
by
Paul
Browse files
Formatting
parent
058470c8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
16 deletions
+14
-16
src/driver/argument_parser.hpp
src/driver/argument_parser.hpp
+4
-7
src/driver/command.hpp
src/driver/command.hpp
+2
-2
src/driver/main.cpp
src/driver/main.cpp
+8
-7
No files found.
src/driver/argument_parser.hpp
View file @
b726fc1a
...
@@ -88,8 +88,7 @@ struct argument_parser
...
@@ -88,8 +88,7 @@ struct argument_parser
static
auto
write_action
(
F
f
)
static
auto
write_action
(
F
f
)
{
{
return
[
=
](
auto
&
x
,
auto
&
arg
)
{
return
[
=
](
auto
&
x
,
auto
&
arg
)
{
arg
.
action
=
[
&
,
f
](
auto
&
self
,
const
std
::
vector
<
std
::
string
>&
params
)
arg
.
action
=
[
&
,
f
](
auto
&
self
,
const
std
::
vector
<
std
::
string
>&
params
)
{
{
f
(
self
,
x
,
params
);
f
(
self
,
x
,
params
);
return
false
;
return
false
;
};
};
...
@@ -100,8 +99,7 @@ struct argument_parser
...
@@ -100,8 +99,7 @@ struct argument_parser
static
auto
do_action
(
F
f
)
static
auto
do_action
(
F
f
)
{
{
return
[
=
](
auto
&
,
auto
&
arg
)
{
return
[
=
](
auto
&
,
auto
&
arg
)
{
arg
.
action
=
[
&
,
f
](
auto
&
self
,
const
std
::
vector
<
std
::
string
>&
)
arg
.
action
=
[
&
,
f
](
auto
&
self
,
const
std
::
vector
<
std
::
string
>&
)
{
{
f
(
self
);
f
(
self
);
return
true
;
return
true
;
};
};
...
@@ -138,7 +136,7 @@ struct argument_parser
...
@@ -138,7 +136,7 @@ struct argument_parser
std
::
cout
<<
" "
<<
arg
.
help
<<
std
::
endl
;
std
::
cout
<<
" "
<<
arg
.
help
<<
std
::
endl
;
}
}
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
if
(
not
msg
.
empty
())
if
(
not
msg
.
empty
())
std
::
cout
<<
msg
<<
std
::
endl
;
std
::
cout
<<
msg
<<
std
::
endl
;
});
});
}
}
...
@@ -153,8 +151,7 @@ struct argument_parser
...
@@ -153,8 +151,7 @@ struct argument_parser
{
{
return
[
=
](
auto
&
x
,
auto
&
arg
)
{
return
[
=
](
auto
&
x
,
auto
&
arg
)
{
arg
.
type
=
""
;
arg
.
type
=
""
;
arg
.
action
=
[
&
,
value
](
auto
&
,
const
std
::
vector
<
std
::
string
>&
)
arg
.
action
=
[
&
,
value
](
auto
&
,
const
std
::
vector
<
std
::
string
>&
)
{
{
x
=
value
;
x
=
value
;
return
false
;
return
false
;
};
};
...
...
src/driver/command.hpp
View file @
b726fc1a
...
@@ -19,7 +19,7 @@ inline auto& get_commands()
...
@@ -19,7 +19,7 @@ inline auto& get_commands()
return
m
;
return
m
;
}
}
template
<
class
T
>
template
<
class
T
>
std
::
string
command_name
()
std
::
string
command_name
()
{
{
static
const
std
::
string
&
name
=
get_type_name
<
T
>
();
static
const
std
::
string
&
name
=
get_type_name
<
T
>
();
...
...
src/driver/main.cpp
View file @
b726fc1a
...
@@ -6,7 +6,7 @@ struct main_command
...
@@ -6,7 +6,7 @@ struct main_command
static
std
::
string
get_command_help
()
static
std
::
string
get_command_help
()
{
{
std
::
string
result
=
"Commands:
\n
"
;
std
::
string
result
=
"Commands:
\n
"
;
for
(
const
auto
&
p
:
migraphx
::
driver
::
get_commands
())
for
(
const
auto
&
p
:
migraphx
::
driver
::
get_commands
())
result
+=
" "
+
p
.
first
+
"
\n
"
;
result
+=
" "
+
p
.
first
+
"
\n
"
;
return
result
;
return
result
;
}
}
...
@@ -18,15 +18,16 @@ struct main_command
...
@@ -18,15 +18,16 @@ struct main_command
void
run
()
{}
void
run
()
{}
};
};
int
main
(
int
argc
,
const
char
*
argv
[])
{
int
main
(
int
argc
,
const
char
*
argv
[])
{
std
::
vector
<
std
::
string
>
args
(
argv
+
1
,
argv
+
argc
);
std
::
vector
<
std
::
string
>
args
(
argv
+
1
,
argv
+
argc
);
if
(
args
.
empty
())
if
(
args
.
empty
())
return
0
;
return
0
;
auto
&&
m
=
migraphx
::
driver
::
get_commands
();
auto
&&
m
=
migraphx
::
driver
::
get_commands
();
auto
cmd
=
args
.
front
();
auto
cmd
=
args
.
front
();
if
(
m
.
count
(
cmd
)
>
0
)
if
(
m
.
count
(
cmd
)
>
0
)
{
{
m
.
at
(
cmd
)({
args
.
begin
()
+
1
,
args
.
end
()});
m
.
at
(
cmd
)({
args
.
begin
()
+
1
,
args
.
end
()});
}
}
else
else
{
{
...
...
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