Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/gdsMill/pyx/box.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ def linealignpointvector_pt(self, a, dx, dy, px, py):
def alignvector_pt(self, a, dx, dy, alignlinevector, alignpointvector):
n = math.hypot(dx, dy)
dx, dy = dx / n, dy / n
linevectors = map(lambda (p1, p2), self=self, a=a, dx=dx, dy=dy, alignlinevector=alignlinevector:
alignlinevector(a, dx, dy, *(p1 + p2)), self.successivepoints())
linevectors = map(lambda p, self=self, a=a, dx=dx, dy=dy, alignlinevector=alignlinevector:
alignlinevector(a, dx, dy, *(p[0] + p[1])), self.successivepoints())
for linevector in linevectors:
if type(linevector) is types.TupleType:
return linevector
Expand Down
4 changes: 2 additions & 2 deletions compiler/gdsMill/pyx/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def __init__(self, box1, box2,
if alength is not None: no_lengths += 1

if no_angles + no_lengths != 2:
raise NotImplementedError, "Please specify exactly two angles or lengths"
raise NotImplementedError("Please specify exactly two angles or lengths")

# calculate necessary angles and armlengths
# always length1 and relangle1
Expand Down Expand Up @@ -301,7 +301,7 @@ def __init__(self, box1, box2,
relangle1 = acos((distance**2 + length1**2 - length2**2) / (2.0*distance*length1))
middle = self._middle_a(begin, dangle, length1, relangle1)
else:
raise NotImplementedError, "I found a strange combination of arguments"
raise NotImplementedError("I found a strange combination of arguments")

connectorpath = path.path(path.moveto_pt(*self.box1.center),
path.lineto_pt(*middle),
Expand Down
10 changes: 5 additions & 5 deletions compiler/gdsMill/pyx/deformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def is_zero(x):
return []

if debug:
print "fallback with exact zero value"
print("fallback with exact zero value")
return [(a, b)]
# >>>
def fallback_smallT(T, D, E, AB, curvA, curvB, threshold, debug):# <<<
Expand All @@ -147,7 +147,7 @@ def fallback_smallT(T, D, E, AB, curvA, curvB, threshold, debug):# <<<
abs(b*T) < threshold * q1 and abs(1.5*a*abs(a)*curvA - D) < threshold * q1 and
abs(a*T) < threshold * q2 and abs(1.5*b*abs(b)*curvB - E) < threshold * q2):
if debug:
print "fallback with T approx 0"
print("fallback with T approx 0")
return [(a, b)]
return []
# >>>
Expand All @@ -161,7 +161,7 @@ def fallback_smallcurv(T, D, E, AB, curvA, curvB, threshold, debug):# <<<
abs(1.5*b*b*curvB) < threshold * min(abs(a*T), abs(E)) and
abs(a*T - E) < threshold * min(abs(a*T), abs(E))):
if debug:
print "fallback with curvB approx 0"
print("fallback with curvB approx 0")
result.append((a, b))

# is curvA approx zero?
Expand All @@ -171,7 +171,7 @@ def fallback_smallcurv(T, D, E, AB, curvA, curvB, threshold, debug):# <<<
abs(1.5*a*a*curvA) < threshold * min(abs(b*T), abs(D)) and
abs(b*T - D) < threshold * min(abs(b*T), abs(D))):
if debug:
print "fallback with curvA approx 0"
print("fallback with curvA approx 0")
result.append((a, b))

return result
Expand Down Expand Up @@ -754,7 +754,7 @@ def deformsubpath(self, orig_nsp): # <<<
# get the next parallel piece for the normpath
try:
next_parallel_normpath = self.deformsubpathitem(next_orig_nspitem, epsilon)
except InvalidParamException, e:
except InvalidParamException as e:
invalid_nspitem_param = e.normsubpathitemparam
# split the nspitem apart and continue with pieces that do not contain
# the invalid point anymore. At the end, simply take one piece, otherwise two.
Expand Down
28 changes: 14 additions & 14 deletions compiler/gdsMill/pyx/dvifile.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class TFMError(exceptions.Exception): pass

class char_info_word:
def __init__(self, word):
self.width_index = int((word & 0xFF000000L) >> 24) #make sign-safe
self.width_index = int((word & 0xFF000000) >> 24) #make sign-safe
self.height_index = (word & 0x00F00000) >> 20
self.depth_index = (word & 0x000F0000) >> 16
self.italic_index = (word & 0x0000FC00) >> 10
Expand Down Expand Up @@ -135,10 +135,10 @@ def __init__(self, name, debug=0):
self.ne <= 256 and
self.lf == 6+self.lh+(self.ec-self.bc+1)+self.nw+self.nh+self.nd
+self.ni+self.nl+self.nk+self.ne+self.np):
raise TFMError, "error in TFM pre-header"
raise TFMError("error in TFM pre-header")

if debug:
print "lh=%d" % self.lh
print("lh=%d" % self.lh)

#
# read header
Expand All @@ -160,9 +160,9 @@ def __init__(self, name, debug=0):
self.fontfamily = None

if debug:
print "(FAMILY %s)" % self.fontfamily
print "(CODINGSCHEME %s)" % self.charcoding
print "(DESINGSIZE R %f)" % 16.0*self.designsize/16777216L
print("(FAMILY %s)" % self.fontfamily)
print("(CODINGSCHEME %s)" % self.charcoding)
print("(DESINGSIZE R %f)" % 16.0*self.designsize/16777216)

if self.lh > 17:
self.sevenbitsave = self.file.readuchar()
Expand Down Expand Up @@ -201,7 +201,7 @@ def __init__(self, name, debug=0):

if self.lh > 18:
# just ignore the rest
print self.file.read((self.lh-18)*4)
print(self.file.read((self.lh-18)*4))

#
# read char_info
Expand Down Expand Up @@ -392,9 +392,9 @@ def readfontmap(filenames):
if not (line=="" or line[0] in (" ", "%", "*", ";" , "#")):
try:
fm = fontmapping(line)
except (RuntimeError, UnsupportedPSFragment), e:
except (RuntimeError, UnsupportedPSFragment) as e:
warnings.warn("Ignoring line %i in mapping file '%s': %s" % (lineno, mappath, e))
except UnsupportedFontFormat, e:
except UnsupportedFontFormat as e:
pass
else:
fontmap[fm.texname] = fm
Expand Down Expand Up @@ -468,16 +468,16 @@ class fontinfo:

def __str__(self):
return "font %s designed at %g TeX pts used at %g TeX pts" % (self.name,
16.0*self.d/16777216L,
16.0*self.q/16777216L)
16.0*self.d/16777216,
16.0*self.q/16777216)
__repr__ = __str__

def getsize_pt(self):
""" return size of font in (PS) points """
# The factor 16L/16777216L=2**(-20) converts a fix_word (here self.q)
# The factor 16/16777216=2**(-20) converts a fix_word (here self.q)
# to the corresponding float. Furthermore, we have to convert from TeX
# points to points, hence the factor 72/72.27.
return 16L*self.q/16777216L*72/72.27
return 16*self.q/16777216*72/72.27

def _convert_tfm_to_dvi(self, length):
# doing the integer math with long integers will lead to different roundings
Expand Down Expand Up @@ -1269,7 +1269,7 @@ def __init__(self, filename, scale, tfmconv, pyxconv, fontmap, debug=0):
# of the virtual font itself. Note that realscale has
# to be a fix_word (like s)
# XXX: check rounding
reals = int(round(self.scale * (16*self.ds/16777216L) * s))
reals = int(round(self.scale * (16*self.ds/16777216) * s))

# print ("defining font %s -- VF scale: %g, VF design size: %d, relative font size: %d => real size: %d" %
# (fontname, self.scale, self.ds, s, reals)
Expand Down
2 changes: 1 addition & 1 deletion compiler/gdsMill/pyx/epsfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def processPS(self, file, writer, context, registry, bbox):
try:
epsfile=open(self.filename,"rb")
except:
raise IOError, "cannot open EPS file '%s'" % self.filename
raise IOError("cannot open EPS file '%s'" % self.filename)

file.write("BeginEPSF\n")

Expand Down
8 changes: 5 additions & 3 deletions compiler/gdsMill/pyx/font/afm.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,9 @@ def _processline_trackkern(self, line, i):
else:
raise AFMError("Unsupported key %s in kerning data section" % key)

def _processline_kernpairs(self, line, (direction, i)):
def _processline_kernpairs(self, line, arg):
direction = arg[0]
i = arg[1]
try:
key, args = line.split(None, 1)
except ValueError:
Expand Down Expand Up @@ -484,6 +486,6 @@ def parse(self):

if __name__ == "__main__":
a = AFMfile("/opt/local/share/texmf-dist/fonts/afm/yandy/lucida/lbc.afm")
print a.charmetrics[0].name
print(a.charmetrics[0].name)
a = AFMfile("/usr/share/enscript/hv.afm")
print a.charmetrics[32].name
print(a.charmetrics[32].name)
8 changes: 4 additions & 4 deletions compiler/gdsMill/pyx/font/t1font.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,9 +815,9 @@ def _cmds(self, code):
elif 251 <= x <= 254: # mid size ints
cmds.append(-((x - 251)*256) - code.pop(0) - 108)
else: # x = 255, i.e. full size ints
y = ((code.pop(0)*256l+code.pop(0))*256+code.pop(0))*256+code.pop(0)
if y > (1l << 31):
cmds.append(y - (1l << 32))
y = ((code.pop(0)*256+code.pop(0))*256+code.pop(0))*256+code.pop(0)
if y > (1 << 31):
cmds.append(y - (1 << 32))
else:
cmds.append(y)
return cmds
Expand All @@ -843,7 +843,7 @@ def _code(self, cmds):
code.append(b)
else:
if cmd < 0:
cmd += 1l << 32
cmd += 1 << 32
cmd, x4 = divmod(cmd, 256)
cmd, x3 = divmod(cmd, 256)
x1, x2 = divmod(cmd, 256)
Expand Down
2 changes: 1 addition & 1 deletion compiler/gdsMill/pyx/graph/axis/texter.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def __init__(self, plus="", minus="-",
skipexp1=None,
nomantissaexp=r"{10^{%s}}",
minusnomantissaexp=r"{-10^{%s}}",
mantissamin=tick.rational((1, 1)), mantissamax=tick.rational((10L, 1)),
mantissamin=tick.rational((1, 1)), mantissamax=tick.rational((10, 1)),
skipmantissa1=0, skipallmantissa1=1,
mantissatexter=decimal()):
r"""initializes the instance
Expand Down
2 changes: 1 addition & 1 deletion compiler/gdsMill/pyx/graph/axis/tick.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def initfromstring(self, s):
if autolong:
self.denom = 10 ** len(commaparts[1])
else:
self.denom = 10L ** len(commaparts[1])
self.denom = 10 ** len(commaparts[1])
neg = len(commaparts[0]) and commaparts[0][0] == "-"
if neg:
commaparts[0] = commaparts[0][1:]
Expand Down
4 changes: 2 additions & 2 deletions compiler/gdsMill/sram_examples/cell6tDemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@
# inputPath = "./gdsFiles/arrayLayout.gds")


print "LIB: %s" , gds_file_in
print "\nCompleted ", gds_file_out
print("LIB: %s" , gds_file_in)
print("\nCompleted ", gds_file_out)
4 changes: 2 additions & 2 deletions compiler/gdsMill/sram_examples/newcell.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,5 @@
# inputPath = "./gdsFiles/arrayLayout.gds")


print "LIB: %s" % gds_file_in
print "\nCompleted ", gds_file_out
print("LIB: %s" % gds_file_in)
print("\nCompleted ", gds_file_out)
2 changes: 1 addition & 1 deletion compiler/modules/multibank.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def compute_sizes(self):
self.central_bus_width = self.m2_pitch * self.num_control_lines + 2*self.m2_width

# A space for wells or jogging m2
self.m2_gap = max(2*drc("pwell_to_nwell"] + drc["well_enclose_active"),
self.m2_gap = max(2*drc("pwell_to_nwell") + drc("well_enclose_active"),
2*self.m2_pitch)


Expand Down