[gambit-list] Gambit and termite on an embedded system (Nintendo DS)?
Marc Feeley
feeley at iro.umontreal.ca
Mon Oct 23 00:21:22 EDT 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 22-Oct-06, at 11:11 PM, Andrew Lentvorski wrote:
> Marc Feeley wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>> On 22-Oct-06, at 9:11 AM, Marc Feeley wrote:
>>> You could modify gsi/_gsi.scm so that it does not search for the
>>> initialization file, for example you could remove:
>>>
>>> (if (##not skip-initialization-file?)
>>> (process-initialization-file))
>>>
>>> That should get you to the next problem, but I think you are getting
>>> close to a working Gambit.
>> Actually, for the moment, you can replace all of gsi/_gsi.scm with
>> the call
>> (##repl-debug-main)
>
> I think I have a repl loop firing. I appear to be in an infinite
> loop and am calling various subprocedures of _repl. ##dynamic-env-
> bind, ##continuation-ret, ##subprocedure-parent, (and a lot of
> others).
>
This sounds like you are in the dreaded "debugging the I/O" infinite
loop... there's an initial error that raises an exception, so the
REPL tries to report it but fails because of some I/O error, so the
REPL tries to report that error, and so on.
So your next step should be to make sure you can write on stdout and
read on stdin.
> This even appears to be working under the no$gba emulator.
>
> Where does it try to grab input? If I can find where it does that,
> I can substitute on of the DS touchscreen keyboard emulators for
> stdin and put together a functional console.
In lib/os_io.c you will find this call to fread:
#ifndef USE_POSIX
#ifndef USE_WIN32
{
int n;
FILE *stream = d->stream;
if (stream == 0)
stream = stdin;
if (stream == stdin)
len = 1; /* only read 1 byte at a time to prevent blocking on
tty */
if ((n = fread (buf, 1, len, stream)) == 0)
{
if (ferror (stream))
{
clearerr (stream);
return ___FIX(___UNKNOWN_ERR);
}
clearerr (stream);
}
*len_done = n;
}
#endif
#endif
Note that when reading from the console d->stream is NULL, so you can
use this condition to bypass the call to fread and do your own
thing. You can also force len to 1 (to read 1 character at a time).
There is similar code which uses fwrite to do output (there is a
single call in all of lib/os_io.c).
Marc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)
iD8DBQFFPENC//V9Zc2T/v4RAveeAKCoHjPpNAr5IL8u7pkhiHQA2FPoggCfQFXe
XsTHBYa/V77YAAR/90qwP+8=
=B3pU
-----END PGP SIGNATURE-----
More information about the Gambit-list
mailing list