|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
#!/usr/bin/env python
|
|
|
|
|
from string import *
|
|
|
|
|
import os, commands, getopt, sys, platform
|
|
|
|
|
import os, getopt, sys, platform
|
|
|
|
|
|
|
|
|
|
header = '''/* Auto-generated by ptxdump.py DO NOT EDIT
|
|
|
|
|
*
|
|
|
|
@ -16,13 +16,13 @@ def FormatCharHex(d):
|
|
|
|
|
return s
|
|
|
|
|
|
|
|
|
|
def CleanFileName(f):
|
|
|
|
|
v = replace(f,"-","_")
|
|
|
|
|
v = replace(v,".ptx","")
|
|
|
|
|
v = f.replace("-","_")
|
|
|
|
|
v = v.replace(".ptx","")
|
|
|
|
|
return v
|
|
|
|
|
|
|
|
|
|
if not(len(sys.argv[1:]) >= 2):
|
|
|
|
|
print "Usage: ptx2c.py <output> <in.ptx ..> "
|
|
|
|
|
print "Description: creates a header file containing the ptx files as character array" + os.linesep
|
|
|
|
|
print("Usage: ptx2c.py <output> <in.ptx ..> ")
|
|
|
|
|
print("Description: creates a header file containing the ptx files as character array" + os.linesep)
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
|
|
out_h = sys.argv[1] + ".h"
|
|
|
|
@ -56,8 +56,8 @@ for file in sys.argv[2:]:
|
|
|
|
|
# write retrieval function
|
|
|
|
|
out.writelines("const unsigned char* SCCudaPtxDumpGetModule(const char* module){\n");
|
|
|
|
|
for file in sys.argv[2:]:
|
|
|
|
|
out.writelines('\tif (!strcmp(module, "'+replace(file,".ptx","")+'"))\n')
|
|
|
|
|
out.writelines("\t\treturn "+CleanFileName(file)+";\n")
|
|
|
|
|
out.writelines('\tif (!strcmp(module, "' + file.replace(".ptx","")+'"))\n')
|
|
|
|
|
out.writelines("\t\treturn " + CleanFileName(file)+";\n")
|
|
|
|
|
out.writelines('\tSCLogError(SC_ERR_FATAL, "Error in SCCudaPtxDumpGetModule, module %s not found. Exiting...",module);\n')
|
|
|
|
|
out.writelines("\texit(EXIT_FAILURE);\n")
|
|
|
|
|
out.writelines("};\n")
|
|
|
|
|