diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-04-30 15:45:26 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-04-30 15:45:26 +0100 |
| commit | 0826777503c0279a3ffe41e494c6b0490ec06779 (patch) | |
| tree | c11812bbfb7829dfd6723466ebe359bf8402f924 /src/main/resources/org | |
| parent | c041a56e321bf0370d6b6e01ef7b12cdbe2ab8e5 (diff) | |
Move Python runtime into correct package
Diffstat (limited to 'src/main/resources/org')
4 files changed, 21 insertions, 0 deletions
diff --git a/src/main/resources/org/zwobble/couscous/backends/python/runtime/_couscous.py b/src/main/resources/org/zwobble/couscous/backends/python/runtime/_couscous.py new file mode 100644 index 0000000..6f3916c --- /dev/null +++ b/src/main/resources/org/zwobble/couscous/backends/python/runtime/_couscous.py @@ -0,0 +1,5 @@ +def _div_round_to_zero(a, b): + return -(-a // b) if (a < 0) ^ (b < 0) else a // b + +def _mod_round_to_zero(a, b): + return -(-a % b) if (a < 0) ^ (b < 0) else a % b diff --git a/src/main/resources/org/zwobble/couscous/backends/python/runtime/java/lang/Integer.py b/src/main/resources/org/zwobble/couscous/backends/python/runtime/java/lang/Integer.py new file mode 100644 index 0000000..48d6556 --- /dev/null +++ b/src/main/resources/org/zwobble/couscous/backends/python/runtime/java/lang/Integer.py @@ -0,0 +1,13 @@ +class Integer(object): + def __init__(self, value): + self._value = value + + def equals__Object__boolean(self, other): + # TODO: test this properly + return isinstance(other, Integer) and other._value == self._value + + def __str__(self): + return str(self._value) + + def __repr__(self): + return str(self)
\ No newline at end of file diff --git a/src/main/resources/org/zwobble/couscous/backends/python/runtime/java/lang/Object.py b/src/main/resources/org/zwobble/couscous/backends/python/runtime/java/lang/Object.py new file mode 100644 index 0000000..29a8fba --- /dev/null +++ b/src/main/resources/org/zwobble/couscous/backends/python/runtime/java/lang/Object.py @@ -0,0 +1 @@ +Object = object diff --git a/src/main/resources/org/zwobble/couscous/backends/python/runtime/java/lang/String.py b/src/main/resources/org/zwobble/couscous/backends/python/runtime/java/lang/String.py new file mode 100644 index 0000000..9a1e025 --- /dev/null +++ b/src/main/resources/org/zwobble/couscous/backends/python/runtime/java/lang/String.py @@ -0,0 +1,2 @@ +class String(object): + pass
\ No newline at end of file |
