class xform_expr

Specifies parts of a query expression for step_xform.query() or step_xform.query_bounds().

Represents an expression of the form (ax+b)/c, where x is an attribute attached to the memory location obtained by applying a specified access path to a specified base symbol .

May also represent a constant expression b/c.

xform_expr Details

class cs.xform_expr

Specifies parts of a query expression for step_xform.query() or step_xform.query_bounds().

__init__(_b[, _c = 1])

Constructor for a constant-valued xform_expr object with value b/c.

Parameters:
  • _b (int) – The numerator of the constant expression.
  • _c (int) – (optional) The denominator of the constant expression.
Raises:

result.ERROR_INVALID_ARGUMENT in the following cases:

  • _b is -2147483648
  • _c is -2147483648
  • _c is 0

The xform_expr object will be created with xform_expr_mode.PRE.

>>> xform_expr(5,7)
<cs.xform_expr 5 / 7>
>>> xform_expr(5)
<cs.xform_expr 5>
__init__(_base[, _ap = (, )[, _attribute = ""[, _mode =  xform_expr_mode.POST[, _a = 1[, _b = 0[, _c = 1]]]]]])

Constructor for an xform_expr object representing expression (ax + b)/c, where x is an attribute attached to some memory location.

Parameters:
  • _base (symbol) – The base for x.
  • _ap (iterable of access_path) – (optional) The access path for the memory location of which x is an attribute (based at _base)
  • _attribute (str) –

    (optional) The attribute x.

  • _mode (xform_expr_mode) – (optional) The temporal mode for evaluation of x.
  • _a (int) – (optional) The coefficient a in the expression (ax + b)/c.
  • _b (int) – (optional) The constant b in the expression (ax + b)/c.
  • _c (int) – (optional) The denominator c in the expression (ax + b)/c.
Raises:

Constructs an xform_expr object representing expression (ax + b)/c, where:

>>> foo_fn = next(p for p in project.current().procedures() if p.name()=='foo')
>>> foo_s = next(sym for sym in foo_fn.local_symbols() if sym.name()=='s')
>>> xform_expr(foo_s, [access_path.star()], 'fromend', xform_expr_mode.POST, 12, 3, 7)
<cs.xform_expr ( 12 * *s!fromend + 3 ) / 7>
>>> foo_fn = next(p for p in project.current().procedures() if p.name()=='foo')
>>> foo_s = next(sym for sym in foo_fn.local_symbols() if sym.name()=='s')
>>> xform_expr(foo_s, [access_path.star()], 'fromend', xform_expr_mode.POST, 12, 3)
<cs.xform_expr 12 * *s!fromend + 3>
>>> foo_fn = next(p for p in project.current().procedures() if p.name()=='foo')
>>> foo_s = next(sym for sym in foo_fn.local_symbols() if sym.name()=='s')
>>> xform_expr(foo_s, [access_path.star()], 'fromend', xform_expr_mode.POST, 12)
<cs.xform_expr 12 * *s!fromend>
>>> foo_fn = next(p for p in project.current().procedures() if p.name()=='foo')
>>> foo_s = next(sym for sym in foo_fn.local_symbols() if sym.name()=='s')
>>> xform_expr(foo_s, [access_path.star()], 'fromend', xform_expr_mode.POST_STRICT)
<cs.xform_expr *s!fromend>
>>> foo_fn = next(p for p in project.current().procedures() if p.name()=='foo')
>>> foo_s = next(sym for sym in foo_fn.local_symbols() if sym.name()=='s')
>>> xform_expr(foo_s, [access_path.star()], 'fromend')
<cs.xform_expr *s!fromend>
>>> foo_fn = next(p for p in project.current().procedures() if p.name()=='foo')
>>> foo_s = next(sym for sym in foo_fn.local_symbols() if sym.name()=='s')
>>> xform_expr(foo_s, [access_path.star()])
<cs.xform_expr *s>
>>> foo_fn = next(p for p in project.current().procedures() if p.name()=='foo')
>>> foo_s = next(sym for sym in foo_fn.local_symbols() if sym.name()=='s')
>>> xform_expr(foo_s)
<cs.xform_expr s>
__repr__()

Get a representation of a xform_expr object that includes information useful for debugging.

Return type:str
Returns:The string representation.
>>> v0 = xform_expr(0)
>>> repr(v0)
'<cs.xform_expr 0>'
__str__()

Get a simple string representation of a xform_expr object.

Return type:str
Returns:The string representation.
>>> v0 = xform_expr(0)
>>> str(v0)
'0'