Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VTK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Erik Palmer
VTK
Commits
28e4ac01
Commit
28e4ac01
authored
7 years ago
by
Sankhesh Jhaveri
Browse files
Options
Downloads
Patches
Plain Diff
Allow vtkEncodeString to create header without any export info
This allows the generated header to be added to executables.
parent
d5729f86
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Utilities/EncodeString/vtkEncodeString.cxx
+20
-8
20 additions, 8 deletions
Utilities/EncodeString/vtkEncodeString.cxx
with
20 additions
and
8 deletions
Utilities/EncodeString/vtkEncodeString.cxx
+
20
−
8
View file @
28e4ac01
...
...
@@ -151,12 +151,14 @@ int main(int argc,
{
std
::
string
option
;
if
(
argc
==
7
)
if
(
argc
==
5
||
argc
==
7
)
{
option
=
argv
[
4
];
}
if
(
argc
<
4
||
argc
>
7
||
(
argc
==
7
&&
option
.
compare
(
"--build-header"
)
!=
0
))
bool
buildHeader
=
false
;
if
(
argc
<
4
||
argc
>
7
||
((
argc
==
7
||
argc
==
5
)
&&
option
.
compare
(
"--build-header"
)
!=
0
))
{
cout
<<
"Encode a string in a C or C++ file from a text file."
<<
endl
;
cout
<<
"Usage: "
<<
argv
[
0
]
<<
" <output-file> <input-path> <stringname>"
...
...
@@ -164,6 +166,10 @@ int main(int argc,
<<
"Example: "
<<
argv
[
0
]
<<
" MyString.cxx MyString.txt MyGeneratedString --build-header MYSTRING_EXPORT MyHeaderDefiningExport.h"
<<
endl
;
return
1
;
}
else
if
(
argc
>
4
)
{
buildHeader
=
true
;
}
Output
ot
;
ot
.
Stream
<<
"/* DO NOT EDIT."
<<
endl
<<
" * Generated by "
<<
argv
[
0
]
<<
endl
...
...
@@ -173,8 +179,7 @@ int main(int argc,
std
::
string
input
=
argv
[
2
];
bool
outputIsC
=
output
.
find
(
".c"
,
output
.
size
()
-
2
)
!=
std
::
string
::
npos
;
bool
buildHeader
=
argc
==
7
;
std
::
string
fileName
=
GetFilenameWithoutLastExtension
(
output
);
if
(
!
ot
.
ProcessFile
(
input
.
c_str
(),
argv
[
3
],
buildHeader
,
fileName
))
...
...
@@ -202,10 +207,13 @@ int main(int argc,
<<
" */"
<<
endl
<<
"#ifndef __"
<<
fileName
<<
"_h"
<<
endl
<<
"#define __"
<<
fileName
<<
"_h"
<<
endl
<<
endl
<<
"#include
\"
"
<<
argv
[
6
]
<<
"
\"
"
<<
endl
// extra header file
<<
endl
;
if
(
argc
>
5
)
{
hs
.
Stream
<<
"#include
\"
"
<<
argv
[
6
]
<<
"
\"
"
<<
endl
// extra header file
<<
endl
;
}
if
(
outputIsC
)
{
hs
.
Stream
<<
"#ifdef __cplusplus"
<<
endl
...
...
@@ -213,7 +221,11 @@ int main(int argc,
<<
"#endif /* #ifdef __cplusplus */"
<<
endl
<<
endl
;
}
hs
.
Stream
<<
argv
[
5
]
<<
" extern const char *"
<<
argv
[
3
]
<<
";"
<<
endl
if
(
argc
>
5
)
{
hs
.
Stream
<<
argv
[
5
]
<<
" "
;
}
hs
.
Stream
<<
"extern const char *"
<<
argv
[
3
]
<<
";"
<<
endl
<<
endl
;
if
(
outputIsC
)
...
...
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