diff options
Diffstat (limited to 'main.py')
-rwxr-xr-x | main.py | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -180,10 +180,8 @@ class Argparser(object): parser.add_argument("--verbose", action="store_true", help="verbose", default=False) # TODO parser.add_argument("--forcenullterm", action="store_true", help="terminate all strings with null even if they are not originally null-terminated", default=False) - parser.add_argument("--strbuffersize", type=int, help="the size of the buffer for string reads", default=100) - parser.add_argument("--strbuffgrowfactor", type=float, help="the factor by which the strbuffer will grow", default=1.6) - parser.add_argument("--voidbuffersize", type=int, help="the size of the buffer for void* buffer", default=100) - parser.add_argument("--voidbuffgrowfactor", type=float, help="the factor by which the voidbuffer will grow", default=1.6) + parser.add_argument("--voidtraininitsize", type=int, help="the size of the void train, an integer", default=100) + parser.add_argument("--voidtrainfactor", type=float, help="the factor by which the voidtrain will grow, a float", default=2.0) parser.add_argument("--singlefile", action="store_true", help="the generated code will be put in a single file", default=False) parser.add_argument("--calloc", action="store_true", help="use calloc instead of malloc, defaults to false", default=False) parser.add_argument("--singlefilename", type=str, help="name of the single file") @@ -664,8 +662,8 @@ class CodeGen(object): struct_source_c.write(text.c_read_leb_u_def + "\n") struct_source_c.write(text.c_read_leb_s_def + "\n") struct_source_c.write(text.c_read_until_delimiter + "\n") - if self.argparser.args.calloc: struct_source_c.write(text.c_void_manager.replace("CCC", "ft_calloc") + "\n") - else: struct_source_c.write(text.c_void_manager.replace("CCC", "malloc") + "\n") + if self.argparser.args.calloc: struct_source_c.write(text.c_void_manager.replace("CCC", "ft_calloc").replace("XXX", repr(self.argparser.args.voidtraininitsize)).replace("YYY", repr(self.argparser.args.voidtrainfactor)) + "\n") + else: struct_source_c.write(text.c_void_manager.replace("CCC", "malloc").replace("XXX", repr(self.argparser.args.voidtraininitsize)).replace("YYY", repr(self.argparser.args.voidtrainfactor)) + "\n") struct_source.write("extern void** void_train;\n") struct_source.write("extern uint64_t current_void_size;\n") struct_source.write("extern uint64_t current_void_count;\n") |