Cleaned up strtoarr.py
This commit is contained in:
parent
59b1b748ff
commit
54ec66b345
1 changed files with 4 additions and 5 deletions
|
@ -3,7 +3,7 @@
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
#!/usr/bin/python3
|
|
||||||
##
|
##
|
||||||
# @file
|
# @file
|
||||||
# @brief File to create string arrays
|
# @brief File to create string arrays
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
inString = str(sys.argv[1]);
|
inString = str(sys.argv[1])
|
||||||
|
|
||||||
print("static const char {0}[{1}] = {{ ".format(sys.argv[2], len(inString)), end='')
|
print("static const char {0}[{1}] = {{ ".format(sys.argv[2], len(inString)), end='')
|
||||||
for letter in inString[:-1]:
|
for letter in inString[:-1]:
|
||||||
|
@ -27,6 +27,5 @@ for letter in inString[:-1]:
|
||||||
print("{0:#x}, ".format(p), end='')
|
print("{0:#x}, ".format(p), end='')
|
||||||
|
|
||||||
p = ord(inString[-1])
|
p = ord(inString[-1])
|
||||||
print("{0:#x} ".format(int(p)), end='')
|
print("{0:#x} ".format(int(p)) + "}; // " + inString)
|
||||||
print("}; // " + inString)
|
print("static const uint8_t {0}_len = {1};".format(sys.argv[2], len(inString)))
|
||||||
print("static const uint8_t {0}_len = {1};".format(sys.argv[2], len(inString)))
|
|
Loading…
Add table
Add a link
Reference in a new issue