From 5392f4c2d4a6ef3d1fdd32e8dc717eb77a51e19a Mon Sep 17 00:00:00 2001 From: Cat's Eye Technologies Date: Fri, 9 Dec 2011 13:59:54 -0600 Subject: [PATCH 1/2] Add .gitignore and minimal driver shell script. --- .gitignore | 1 + bin/ophis | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 .gitignore create mode 100755 bin/ophis diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0d20b64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.pyc diff --git a/bin/ophis b/bin/ophis new file mode 100755 index 0000000..959855a --- /dev/null +++ b/bin/ophis @@ -0,0 +1,3 @@ +#!/bin/sh + +python $HOME/checkout/git/Ophis/src/ophismain.py $* From a1cc6db760078b70e1c40403e64868890cfa772c Mon Sep 17 00:00:00 2001 From: Cat's Eye Technologies Date: Fri, 9 Dec 2011 14:24:12 -0600 Subject: [PATCH 2/2] Catch IOError in .incbin and .charmapbin pragmas. --- src/Ophis/CorePragmas.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Ophis/CorePragmas.py b/src/Ophis/CorePragmas.py index f4737f5..3fcb334 100644 --- a/src/Ophis/CorePragmas.py +++ b/src/Ophis/CorePragmas.py @@ -43,9 +43,13 @@ def pragmaIncbin(ppt, line, result): filename = line.expect("STRING").value line.expect("EOL") if type(filename)==str: - f = file(filename, "rb") - bytes = f.read() - f.close() + try: + f = file(filename, "rb") + bytes = f.read() + f.close() + except IOError: + Err.log ("Could not read "+filename) + return bytes = [IR.ConstantExpr(ord(x)) for x in bytes] result.append(IR.Node(ppt, "Byte", *bytes)) @@ -72,9 +76,13 @@ def pragmaCharmapbin(ppt, line, result): filename = line.expect("STRING").value line.expect("EOL") if type(filename)==str: - f = file(filename, "rb") - bytes = f.read() - f.close() + try: + f = file(filename, "rb") + bytes = f.read() + f.close() + except IOError: + Err.log ("Could not read "+filename) + return if len(bytes)==256: currentcharmap = bytes else: