mirror of
https://github.com/michaelcmartin/Ophis.git
synced 2024-11-05 02:04:43 +00:00
Merge pull request #1 from catseye/master
Fix misleading error message from .incbin and .charmapbin pragmas, add some bookkeeping
This commit is contained in:
commit
00f8586be9
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.pyc
|
3
bin/ophis
Executable file
3
bin/ophis
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
python $HOME/checkout/git/Ophis/src/ophismain.py $*
|
@ -43,9 +43,13 @@ def pragmaIncbin(ppt, line, result):
|
||||
filename = line.expect("STRING").value
|
||||
line.expect("EOL")
|
||||
if type(filename)==str:
|
||||
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:
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user