1. Re: crash_message

David Cuny writes:
> Instead, I want to be able to trigger a custom data save routine.  For
> example, if the editor aborts for some reason, the work in progress can
> be saved before the application shuts down.  The application would not
> attempt to recover from the error.
>
> -- David Cuny

I too would like to have error-handling similar to this.  I can think of
two applications in my code:

1. To restore the previous graphics mode, in case a Neil program or other
non-Euphoria-style-graphics program crashes with an error.  Often a
program will crash and the user will be left in a non-standard graphics
mode where text is displayed incorrectly or not at all.  A crash routine
would allow the program to restore the display to text mode.

2. To restore default keyboard handlers, specifically under Linux where
you can read the keyboard in raw mode or normal mode.  Under raw mode,
scan codes can be read directly from the keyboard device, where normal
mode converts them to ASCII based codes first.  Raw mode is useful for
games, etc where key presses and releases are needed to determine the
state of a key at any given time.  If a program crashes with an error
while the keyboard is in raw mode, that terminal stays in raw mode and
everything you type is messed up.

If Euphoria would support crash_routine's it would need to support more
than one, in case multiple cleanups are necessary.  When a crash occurs,
each registered crash_routine would be called in reverse-order, similar
to on_exit() in C.

Thanks,
 _______  ______  _______  ______
[    _  \[    _ ][ _   _ ][    _ ]
[/| [_] |[/| [_\][/ | | \][/| [_\]
  |  ___/  |  _]    | |     |  _]
[\| [/]  [\| [_/] [\| |/] [\| [_/]
[_____]  [______] [_____] [______]
xseal at harborside.com  ICQ:13466657
http://www.harborside.com/home/x/xseal/euphoria/

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu