# Path: zvm/zmachine.py
# class ZMachineError(Exception):
# class ZMachine(object):
#   def __init__(self, story, ui, debugmode=False):
#   def run(self):
# 
# Path: zvm/trivialzui.py
# class TrivialAudio(zaudio.ZAudio):
# class TrivialScreen(zscreen.ZScreen):
# class TrivialKeyboardInputStream(zstream.ZInputStream):
# class TrivialFilesystem(zfilesystem.ZFilesystem):
#   def __init__(self):
#   def play_bleep(self, bleep_type):
#   def __init__(self):
#   def split_window(self, height):
#   def select_window(self, window_num):
#   def set_cursor_position(self, x, y):
#   def erase_window(self, window=zscreen.WINDOW_LOWER,
#                    color=zscreen.COLOR_CURRENT):
#   def set_font(self, font_number):
#   def set_text_style(self, style):
#   def __show_more_prompt(self):
#   def on_input_occurred(self, newline_occurred=False):
#   def __unbuffered_write(self, string):
#   def write(self, string):
#   def __init__(self, screen):
#   def read_line(self, original_text=None, max_length=0,
#                 terminating_characters=None,
#                 timed_input_routine=None, timed_input_interval=0):
#   def read_char(self, timed_input_routine=None,
#                 timed_input_interval=0):
#   def __report_io_error(self, exception):
#   def save_game(self, data, suggested_filename=None):
#   def restore_game(self):
#   def open_transcript_file_for_writing(self):
#   def open_transcript_file_for_reading(self):
# def create_zui():
# def _win32_read_char():
# def _unix_read_char():
# def _read_char():
# def _read_line(original_text=None, terminating_characters=None):
# def _word_wrap(text, width):
#     MORE_STRING = "[MORE]"
# _INTERRUPT_CHAR = chr(3)
# _BACKSPACE_CHAR = chr(8)
# _DELETE_CHAR = chr(127)


import sys
import os.path
from zvm import zmachine, trivialzui
#!/usr/bin/env python


def usage():
    print("""Usage: %s <story file>

Run a Z-Machine story under ZVM.
""" % sys.argv[0])
    sys.exit(1)

def main():
    if len(sys.argv) != 2:
        usage()
    story_file = sys.argv[1]
    if not os.path.isfile(story_file):
        print("%s is not a file." % story_file)
        usage()
    try:
        f = open(story_file, "rb")
        story_image = f.read()
        f.close()
    except IOError:
        print("Error accessing %s" % story_file)
        sys.exit(1)


# Path: zvm/zmachine.py
# class ZMachineError(Exception):
# class ZMachine(object):
#   def __init__(self, story, ui, debugmode=False):
#   def run(self):
# 
# Path: zvm/trivialzui.py
# class TrivialAudio(zaudio.ZAudio):
# class TrivialScreen(zscreen.ZScreen):
# class TrivialKeyboardInputStream(zstream.ZInputStream):
# class TrivialFilesystem(zfilesystem.ZFilesystem):
#   def __init__(self):
#   def play_bleep(self, bleep_type):
#   def __init__(self):
#   def split_window(self, height):
#   def select_window(self, window_num):
#   def set_cursor_position(self, x, y):
#   def erase_window(self, window=zscreen.WINDOW_LOWER,
#                    color=zscreen.COLOR_CURRENT):
#   def set_font(self, font_number):
#   def set_text_style(self, style):
#   def __show_more_prompt(self):
#   def on_input_occurred(self, newline_occurred=False):
#   def __unbuffered_write(self, string):
#   def write(self, string):
#   def __init__(self, screen):
#   def read_line(self, original_text=None, max_length=0,
#                 terminating_characters=None,
#                 timed_input_routine=None, timed_input_interval=0):
#   def read_char(self, timed_input_routine=None,
#                 timed_input_interval=0):
#   def __report_io_error(self, exception):
#   def save_game(self, data, suggested_filename=None):
#   def restore_game(self):
#   def open_transcript_file_for_writing(self):
#   def open_transcript_file_for_reading(self):
# def create_zui():
# def _win32_read_char():
# def _unix_read_char():
# def _read_char():
# def _read_line(original_text=None, terminating_characters=None):
# def _word_wrap(text, width):
#     MORE_STRING = "[MORE]"
# _INTERRUPT_CHAR = chr(3)
# _BACKSPACE_CHAR = chr(8)
# _DELETE_CHAR = chr(127)


# Path: run_story.py
import sys
import os.path
from zvm import zmachine, trivialzui

#!/usr/bin/env python


def usage():
    print("""Usage: %s <story file>

Run a Z-Machine story under ZVM.
""" % sys.argv[0])
    sys.exit(1)

def main():
    if len(sys.argv) != 2:
        usage()
    story_file = sys.argv[1]
    if not os.path.isfile(story_file):
        print("%s is not a file." % story_file)
        usage()
    try:
        f = open(story_file, "rb")
        story_image = f.read()
        f.close()
    except IOError:
        print("Error accessing %s" % story_file)
        sys.exit(1)


    machine = zmachine.ZMachine(story_image,