Changeset 211fd68 in mainline for tools/mkarray.py
- Timestamp:
- 2024-03-08T10:41:31Z (10 months ago)
- Branches:
- master
- Children:
- 0a411bbf
- Parents:
- cd27cd1
- git-author:
- Jiri Svoboda <jiri@…> (2024-03-07 18:41:21)
- git-committer:
- Jiri Svoboda <jiri@…> (2024-03-08 10:41:31)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/mkarray.py
rcd27cd1 r211fd68 39 39 def usage(prname): 40 40 "Print usage syntax" 41 print("%s [--deflate] <DESTINATION> < LABEL> <AS_PROLOG> <SECTION> [SOURCE ...]" % prname)41 print("%s [--deflate] <DESTINATION> <TYPENAME> <LABEL> <AS_PROLOG> <SECTION> [SOURCE ...]" % prname) 42 42 43 43 def arg_check(): 44 if (len(sys.argv) < 5):44 if (len(sys.argv) < 6): 45 45 usage(sys.argv[0]) 46 46 sys.exit() … … 66 66 67 67 dest = sys.argv[1] 68 label = sys.argv[2] 69 as_prolog = sys.argv[3] 70 section = sys.argv[4] 68 typename = sys.argv[2] 69 label = sys.argv[3] 70 as_prolog = sys.argv[4] 71 section = sys.argv[5] 71 72 72 73 timestamp = (1980, 1, 1, 0, 0, 0) … … 81 82 archive = zipfile.ZipFile("%s.zip" % dest, "w", zipfile.ZIP_STORED) 82 83 83 for src in sys.argv[ 5:]:84 for src in sys.argv[6:]: 84 85 basename = os.path.basename(src) 85 86 plainname = os.path.splitext(basename)[0] … … 147 148 data += "#include <stdbool.h>\n\n" 148 149 data += "#define %sS %u\n\n" % (label.upper(), src_cnt) 150 data += "#ifndef %sS_T_\n" % typename.upper() 151 data += "#define %sS_T_\n\n" % typename.upper() 149 152 data += "typedef struct {\n" 150 153 data += "\tconst char *name;\n" … … 153 156 data += "\tsize_t inflated;\n" 154 157 data += "\tbool compressed;\n" 155 data += "} %s_t;\n\n" % label 156 data += "extern %s_t %ss[];\n\n" % (label, label) 158 data += "} %s_t;\n\n" % typename 159 data += "#endif\n" 160 data += "extern %s_t %ss[];\n\n" % (typename, label) 157 161 data += "\n".join(header_ctx) 158 162 data += "\n\n" … … 179 183 data += ' */\n\n' 180 184 data += "#include \"%s.h\"\n\n" % dest 181 data += "%s_t %ss[] = {\n" % ( label, label)185 data += "%s_t %ss[] = {\n" % (typename, label) 182 186 data += ",\n".join(desc_ctx) 183 187 data += "\n"
Note:
See TracChangeset
for help on using the changeset viewer.