Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DD4hep
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cepc
externals
mirroring
DD4hep
Commits
f5f62a29
Commit
f5f62a29
authored
9 years ago
by
Markus Frank
Browse files
Options
Downloads
Patches
Plain Diff
Fix plugin runner to properly accept arguments
parent
08c718c5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
UtilityApps/src/plugin_runner.cpp
+6
-11
6 additions, 11 deletions
UtilityApps/src/plugin_runner.cpp
UtilityApps/src/run_plugin.h
+2
-1
2 additions, 1 deletion
UtilityApps/src/run_plugin.h
with
8 additions
and
12 deletions
UtilityApps/src/plugin_runner.cpp
+
6
−
11
View file @
f5f62a29
...
@@ -28,28 +28,19 @@ namespace {
...
@@ -28,28 +28,19 @@ namespace {
//______________________________________________________________________________
//______________________________________________________________________________
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
char
plugin_runner
[
64
]
=
"plugin_runner"
;
string
plugin
;
Args
arguments
;
Args
arguments
;
vector
<
const
char
*>
options
;
options
.
push_back
(
plugin_runner
);
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
if
(
argv
[
i
][
0
]
==
'-'
)
{
if
(
argv
[
i
][
0
]
==
'-'
)
{
if
(
arguments
.
handle
(
i
,
argc
,
argv
)
)
if
(
arguments
.
handle
(
i
,
argc
,
argv
)
)
continue
;
continue
;
else
if
(
strncmp
(
argv
[
i
],
"-plugin"
,
2
)
==
0
)
plugin
=
argv
[
++
i
];
else
options
.
push_back
(
argv
[
i
]);
}
}
else
{
else
{
usage
();
usage
();
}
}
}
}
if
(
plugin
.
empty
()
)
if
(
arguments
.
plugin
s
.
empty
()
)
usage
();
usage
();
options
.
push_back
(
0
);
LCDD
&
lcdd
=
dd4hep_instance
();
LCDD
&
lcdd
=
dd4hep_instance
();
// Load compact files if required by plugin
// Load compact files if required by plugin
if
(
!
arguments
.
geo_files
.
empty
()
)
{
if
(
!
arguments
.
geo_files
.
empty
()
)
{
...
@@ -61,7 +52,11 @@ int main(int argc,char** argv) {
...
@@ -61,7 +52,11 @@ int main(int argc,char** argv) {
// Create volume manager and populate it required
// Create volume manager and populate it required
if
(
arguments
.
volmgr
)
run_plugin
(
lcdd
,
"DD4hepVolumeManager"
,
0
,
0
);
if
(
arguments
.
volmgr
)
run_plugin
(
lcdd
,
"DD4hepVolumeManager"
,
0
,
0
);
// Execute plugin
// Execute plugin
run_plugin
(
lcdd
,
plugin
.
c_str
(),(
int
)(
options
.
size
()
-
1
),(
char
**
)
&
options
[
0
]);
for
(
size_t
i
=
0
;
i
<
arguments
.
plugins
.
size
();
++
i
)
{
std
::
vector
<
const
char
*>&
plug
=
arguments
.
plugins
[
i
];
int
num_arg
=
int
(
plug
.
size
())
-
2
;
run_plugin
(
lcdd
,
plug
[
0
],
num_arg
,(
char
**
)
&
plug
[
1
]);
}
if
(
arguments
.
destroy
)
delete
&
lcdd
;
if
(
arguments
.
destroy
)
delete
&
lcdd
;
return
0
;
return
0
;
}
}
This diff is collapsed.
Click to expand it.
UtilityApps/src/run_plugin.h
+
2
−
1
View file @
f5f62a29
...
@@ -147,10 +147,11 @@ namespace {
...
@@ -147,10 +147,11 @@ namespace {
// Need to interprete plugin args here locally.....
// Need to interprete plugin args here locally.....
plugins
.
push_back
(
std
::
vector
<
const
char
*>
());
plugins
.
push_back
(
std
::
vector
<
const
char
*>
());
plugins
.
back
().
push_back
(
argv
[
++
i
]);
plugins
.
back
().
push_back
(
argv
[
++
i
]);
for
(
;
i
<
argc
;
++
i
)
{
for
(
++
i
;
i
<
argc
;
++
i
)
{
if
(
argv
[
i
][
0
]
==
'-'
)
{
--
i
;
break
;
}
if
(
argv
[
i
][
0
]
==
'-'
)
{
--
i
;
break
;
}
plugins
.
back
().
push_back
(
argv
[
i
]);
plugins
.
back
().
push_back
(
argv
[
i
]);
}
}
plugins
.
back
().
push_back
(
0
);
}
}
else
else
return
0
;
return
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment