summaryrefslogtreecommitdiffstats
path: root/utils/bin2c
diff options
context:
space:
mode:
authorEvan Lojewski <github@meklort.com>2020-03-21 14:44:34 -0600
committerGitHub <noreply@github.com>2020-03-21 14:44:34 -0600
commit490b5b66afc5f496287fb2db7634643ea2e17db1 (patch)
treef0ddd919c1cce2a4bdb51d5bf74264acbbebaa9b /utils/bin2c
parent70fa05c6e474997ba537adb556b44c221581b4df (diff)
downloadbcm5719-ortega-490b5b66afc5f496287fb2db7634643ea2e17db1.tar.gz
bcm5719-ortega-490b5b66afc5f496287fb2db7634643ea2e17db1.zip
clang-format: Enable additional projects and re-format. (#61)
Diffstat (limited to 'utils/bin2c')
-rw-r--r--utils/bin2c/CMakeLists.txt2
-rw-r--r--utils/bin2c/main.cpp23
2 files changed, 10 insertions, 15 deletions
diff --git a/utils/bin2c/CMakeLists.txt b/utils/bin2c/CMakeLists.txt
index bd4e965..ef931b5 100644
--- a/utils/bin2c/CMakeLists.txt
+++ b/utils/bin2c/CMakeLists.txt
@@ -53,4 +53,6 @@ simulator_add_executable(${PROJECT_NAME} ${SOURCES})
target_link_libraries(${PROJECT_NAME} PRIVATE OptParse)
include_directories(${CMAKE_SOURCE_DIR}/include)
+format_target_sources(${PROJECT_NAME})
+
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
diff --git a/utils/bin2c/main.cpp b/utils/bin2c/main.cpp
index a8da108..0132139 100644
--- a/utils/bin2c/main.cpp
+++ b/utils/bin2c/main.cpp
@@ -49,13 +49,12 @@
#include <iomanip>
#include <types.h>
-#define VERSION_STRING STRINGIFY(VERSION_MAJOR) "." STRINGIFY(VERSION_MINOR) "." STRINGIFY(VERSION_PATCH)
-
+#define VERSION_STRING STRINGIFY(VERSION_MAJOR) "." STRINGIFY(VERSION_MINOR) "." STRINGIFY(VERSION_PATCH)
using namespace std;
using optparse::OptionParser;
-string& escape(std::string& str)
+string &escape(std::string &str)
{
std::replace(str.begin(), str.end(), ' ', '_'); // No spaces allowed
std::replace(str.begin(), str.end(), '-', '_'); // Replace -'s with _'s
@@ -65,17 +64,17 @@ string& escape(std::string& str)
std::replace(str.begin(), str.end(), '[', '_'); // Replace ['s with _'s
std::replace(str.begin(), str.end(), ']', '_'); // Replace ]'s with _'s
- while(str.find("—") != std::string::npos)
+ while (str.find("—") != std::string::npos)
{
str.replace(str.find("—"), strlen("—"), "_"); // Replace @'s with _AT_'s.
}
- while(str.find("@") != std::string::npos)
- {
+ while (str.find("@") != std::string::npos)
+ {
str.replace(str.find("@"), 1, "_AT_"); // Replace @'s with _AT_'s.
}
- while(str.find("/") != std::string::npos)
+ while (str.find("/") != std::string::npos)
{
str.replace(str.find("/"), 1, "_DIV_"); // Replace /'s with _DIV_'s.
}
@@ -91,15 +90,9 @@ int main(int argc, char const *argv[])
parser.version(VERSION_STRING);
- parser.add_option("-i", "--input")
- .dest("input")
- .help("Input binary file to convert")
- .metavar("INPUT");
+ parser.add_option("-i", "--input").dest("input").help("Input binary file to convert").metavar("INPUT");
- parser.add_option("-o", "--output")
- .dest("output")
- .help("Output header file")
- .metavar("OUTPUT");
+ parser.add_option("-o", "--output").dest("output").help("Output header file").metavar("OUTPUT");
optparse::Values options = parser.parse_args(argc, argv);
vector<string> args = parser.args();
OpenPOWER on IntegriCloud