Skip to content

Commit

Permalink
deprecate language.{init,finalize} and resultsym argument
Browse files Browse the repository at this point in the history
in favor of Store
  • Loading branch information
bmyerz committed Jun 19, 2014
1 parent e90c8e6 commit 72d7d12
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 33 deletions.
11 changes: 2 additions & 9 deletions raco/clang.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,13 @@ def assignment(cls, x, y):
return "%s = %s;" % (x, y)

@staticmethod
def initialize(resultsym):
return ""

@staticmethod
def body(compileResult, resultsym):
def body(compileResult):
queryexec = compileResult.getExecutionCode()
initialized = compileResult.getInitCode()
declarations = compileResult.getDeclCode()
resultsym = "__result__"
return base_template % locals()

@staticmethod
def finalize(resultsym):
return ""

@staticmethod
def pipeline_wrap(ident, code, attrs):
# TODO: timer, etc
Expand Down
11 changes: 4 additions & 7 deletions raco/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,19 @@ def compile(expr):
assert isinstance(expr, algebra.Parallel), "expected Parallel toplevel only" # noqa
assert len(expr.children()) == 1, "expected single expression only"
store_expr = expr.children()[0]
assert isinstance(store_expr, algebra.Store)
assert len(store_expr.children()) == 1, "expected single expression only" # noqa

only_expr = store_expr.children()[0]

lang = only_expr.language
# TODO: refactor lang to remove resultsym arguments?
init = lang.initialize(None)

# TODO cleanup this dispatch to be transparent
if isinstance(only_expr, Pipelined):
body = lang.body(only_expr.compilePipeline(), None)
body = lang.body(only_expr.compilePipeline())
else:
body = lang.body(only_expr.compile(None))
body = lang.body(expr)

final = lang.finalize(None)
exprcode.append(emit(init, body, final))
exprcode.append(emit(body))
return emit(*exprcode)


Expand Down
11 changes: 2 additions & 9 deletions raco/grappalang.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,13 @@ def assignment(cls, x, y):
return "%s = %s;" % (x, y)

@staticmethod
def initialize(resultsym):
return ""

@staticmethod
def body(compileResult, resultsym):
def body(compileResult):
queryexec = compileResult.getExecutionCode()
initialized = compileResult.getInitCode()
declarations = compileResult.getDeclCode()
resultsym = "__result__"
return base_template % locals()

@staticmethod
def finalize(resultsym):
return ""

@staticmethod
def log(txt):
return """LOG(INFO) << "%s";\n""" % txt
Expand Down
8 changes: 0 additions & 8 deletions raco/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,10 @@ def preamble(query=None, plan=None):
def postamble(query=None, plan=None):
return ""

@staticmethod
def initialize(resultsym):
return ""

@staticmethod
def body(compileResult):
return compileResult

@staticmethod
def finalize(resultsym, body=""):
return ""

@classmethod
def compile_stringliteral(cls, value):
return '"%s"' % value
Expand Down

0 comments on commit 72d7d12

Please sign in to comment.