This commit is contained in:
Kelvin Sherlock 2019-09-01 17:46:18 -04:00
parent 0789568d06
commit 6e97295623
2 changed files with 10 additions and 16 deletions

View File

@ -11,7 +11,7 @@ Generates code to match an input string against one or more target strings.
## Usage
python3 string_compiler.py [-ilvE] [-o outfile_file] function_name [input_file]
python3 hystricomorph.py [-ilvE] [-o outfile_file] function_name [input_file]
-i case insensitive comparison
-E run input file through c pre-processor

View File

@ -155,15 +155,6 @@ def encode_string(s):
return "".join([encode_map.get(x, x) for x in s])
def usage(ex=1):
print("Usage: string_compiler [-cilvE] [-o output_file] function_name [input_file]")
print(" -c add implicit 0-terminator to strings")
print(" -i case insensitive")
print(" -l include string length in lsb of return value")
print(" -v be verbose")
print(" -E use c pre-processor")
print(" -o output_file specify output file")
sys.exit(ex)
def read_data(f, name):
@ -274,6 +265,15 @@ def init_maps():
encode_map[chr(11)] = '\\v'
def usage(ex=1):
print("Usage: hystricomorph [-cilvE] [-o output_file] function_name [input_file]")
print(" -c add implicit 0-terminator to strings")
print(" -i case insensitive")
print(" -l include string length in lsb of return value")
print(" -v be verbose")
print(" -E use c pre-processor")
print(" -o output_file specify output file")
sys.exit(ex)
def main():
global flag_i, flag_l, flag_E, flag_c
@ -284,12 +284,6 @@ def main():
argv = sys.argv[1:]
opts, args = getopt.getopt(argv, "ivo:leEc")
# flags = {}
# for k, v in opts: flags[k] = v
# # booleans
# for k in ("-i","-v","-l","-e"):
# flags[k] = k in flags
for k, v in opts:
if k == '-i': flag_i = True
elif k == '-o': flag_o = v