import os
if len(sys.argv) != 3:
- print "Invalid argument {}".format(sys.argv)
- print "use {} spec_file_name output_file_name".format(sys.argv[0])
+ print "Invalid argument {0}".format(sys.argv)
+ print "use {0} spec_file_name output_file_name".format(sys.argv[0])
raise
all_vector = 1,2,3,4,8,16
return ret
def init_from_line(self, t):
- self.append('//{}'.format(t))
+ self.append('//{0}'.format(t))
line = filter(None, re.split(',| |\(', t.rstrip(')\n')))
self.paramCount = 0
stripped = 0
return
if (n == 0):
- formatStr = 'INLINE_OVERLOADABLE {}{} {} ('.format(vtype[0], vtype[1], self.functionName)
+ formatStr = 'INLINE_OVERLOADABLE {0}{1} {2} ('.format(vtype[0], vtype[1], self.functionName)
else:
formatStr += ', '
pointerStr = ''
if ptype[1] != 1:
- formatStr += '{}{} {}param{}'.format(ptype[0], ptype[1], pointerStr, n)
+ formatStr += '{0}{1} {2}param{3}'.format(ptype[0], ptype[1], pointerStr, n)
else:
- formatStr += '{} {}param{}'.format(ptype[0], pointerStr, n)
+ formatStr += '{0} {1}param{2}'.format(ptype[0], pointerStr, n)
formatStr += ')'
- formatStr = self.append(formatStr, '{{return ({}{})('.format(vtype[0], vtype[1]))
+ formatStr = self.append(formatStr, '{{return ({0}{1})('.format(vtype[0], vtype[1]))
self.indent = len(formatStr)
for j in range(0, vtype[1]):
if (j != 0):
if self.prefix == 'relational' and self.functionName != 'bitselect' and self.functionName != 'select':
formatStr += '-'
- formatStr += '{}('.format(self.functionName)
+ formatStr += '{0}('.format(self.functionName)
for n in range(0, self.paramCount):
if n != 0:
formatStr += ', '
raise "parameter is not a scalar but has different width with result value."
if isPointer(ptype):
formatStr += '&'
- formatStr += 'param{}'.format(n)
+ formatStr += 'param{0}'.format(n)
continue
if (isPointer(ptype)):
- formatStr += '({} {} *)param{} + {:2d}'.format(ptype[2], ptype[0], n, j)
+ formatStr += '({0} {1} *)param{2} + {3:2d}'.format(ptype[2], ptype[0], n, j)
else:
if (self.functionName == 'select' and n == 2):
formatStr += '({0})(param{1}.s{2:x} & (({0})1 << (sizeof({0})*8 - 1)))'.format(ptype[0], n, j)
else:
- formatStr += 'param{}.s{:x}'.format(n, j)
+ formatStr += 'param{0}.s{1:x}'.format(n, j)
formatStr += ')'
def output(self, outFile):
for line in self.outputStr:
- outFile.write('{}\n'.format(line))
+ outFile.write('{0}\n'.format(line))
def gen_proto_str(self):
check_type([self.valueTypeStr] + self.paramTypeStrs)
safeUnlink(headerFileName)
tempHeader = open(tempHeaderFileName, 'w')
-tempHeader.write("//This file is autogenerated by {}.\n".format(sys.argv[0]))
+tempHeader.write("//This file is autogenerated by {0}.\n".format(sys.argv[0]))
tempHeader.write("//Don't modify it manually.\n")
functionProto = builtinProto()
continue
if line[0] == '#':
if line[1] == '#':
- sectionHeader = "//{} builtin functions".format(line[2:].rstrip())
+ sectionHeader = "//{0} builtin functions".format(line[2:].rstrip())
sectionPrefix=(line[2:].split())[0]
continue
functionProto.init(sectionHeader, sectionPrefix)