GitLab will be upgraded to the 12.10.14-ce.0 on 28 Sept 2020 at 2.00pm (AEDT) to 2.30pm (AEDT). During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to us at N110 (b) CSIT building.

Commit bafdbc7a authored by Tobias Pape's avatar Tobias Pape

Add target file and rework system exit

RPython does not like sys.exit, so we emulate it using an Exit-Exception.
Also, we add a proper target file
parent b8d3cc26
......@@ -18,7 +18,10 @@ from import Shell
import som.compiler.sourcecode_compiler as sourcecode_compiler
import os
import sys
class Exit(BaseException):
def __init__(self, code):
self.code = code
class Universe(object):
......@@ -57,7 +60,7 @@ class Universe(object):
if self._avoid_exit:
self._last_exit_code = error_code
raise Exit(error_code)
def last_exit_code(self):
return self._last_exit_code
......@@ -597,7 +600,8 @@ def main(args):
if __name__ == '__main__':
def target(*args):
return main, None
import sys
except Exit as e:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from som.vm.universe import main, Exit
from rpython.rlib import jit
#from rpython.rlib.debug import debug_start, debug_stop, debug_print
# __________ Entry points __________
def entry_point(argv):
except Exit, e:
return e.code
return 1
# _____ Define and setup target ___
def target(driver, args):
driver.exe_name = 'som'
return entry_point, None
def jitpolicy(driver):
from rpython.jit.codewriter.policy import JitPolicy
return JitPolicy()
if __name__ == '__main__':
from rpython.translator.driver import TranslationDriver
f, _ = target(TranslationDriver(), sys.argv)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment