gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnugo-devel] Fwd: GNU Go for Pocket PC


From: Paul Pogonyshev
Subject: [gnugo-devel] Fwd: GNU Go for Pocket PC
Date: Wed, 12 May 2004 01:14:18 +0300
User-agent: KMail/1.6.52

----------  Forwarded Message  ----------

Subject: GNU Go for Pocket PC
Date: 12 May 2004 00:20
From: "Vadim Lyakhovsky" <address@hidden>
To: "Paul Pogonyshev" <address@hidden>

Below is a translation of a subsequent Vadim's message.  The
translation is not direct and shortened.


He has ported GNU Go 3.5.6 to Pocket PC with Windows CE OS.  It plays
slowly, but he considers the time acceptable: for 26th move of a game it
spent 130 seconds on level 10, 68 secs on level 5 and 37---on level 0.

Vadim is willing to contribute the code to public domain.  Alternatively,
this message contains full description of required changes, so we can
just reproduce them ourselves.


[more literal translation]

I can compile libraries from GNU Go (i.e. engine.lib etc.) which can be
used to make a full program.  I'm willing to write such a program since
it only takes porting to PPC, not writing from scratch.

Now some technical details.  Pocket PCs use Windows CE OS (the other
system is PalmOS).  Mainly it's Windows CE 3.0.  There appeared Windows
CE 4.2, but it seems fully backward compatible.  The only means of writing
programs for both version is Microsoft - Embedded Visual Tools 3.0.  In
addition one should download Pocket PC 2002 SDK, to support ARM CPU.

API Pocket PC 2002 is similar to desktop Windows API, but lacks some
functions.  That's the reason GNU Go doesn't compile for PPC out of the
box.  I made a project based on yours (`*.ds[pw]' files) to compile
GNU Go for PPC and it basically doesn't immediatly work only because
of two functions---time() and localtime().  They are not present on
Windows CE.  The header `time.h' is absent as well.

However, there are functions performing the same task, so, to avoid
changing your sources, I made my own `time.h' in which I defined
function time() and wrote it this way:

time_t time( time_t *timer )
{
  SYSTEMTIME s;
  tm t;
  GetLocalTime( &s );
  t = wce_SystemTimeToTm(s);
  return wce_mktime( &t );
}

Now we need to have GetLocalTime(), wce_SystemTimeToTm() and wce_mktime().
I failed to declare them by including system headers since they also
define lots of other stuff and everything gets hairy.  So instead I
added their prototypes into my `time.h' directly.  That's about all.

Another issue is `io.h' which is absent on Windows CE either.  Again,
to avoid editing GNU Go sources, I just created empty `io.h' file.
Likewise `errno.h', `crtdbg.h' [what is it?] and `assert.h'.  To the
latter I had to add prototype for assert().

At this point we are done with headers.  In file `cache.c' I changed
perror() calls to printf() with `#ifndef _WIN32_WCE'.  In `printutils.c'
and `reading.c' I redefined abort() as exit(1) in a similar way.

In `sgfnode.c' in a variable declartion (inside a function)

  struct tm *loctime = localtime(&curtime);

I deleted word `struct' since it caused compiler errors [weird, huh?].

In file `gg_utils.c' in function gg_cputime() I changed string

  #elif defined(WIN32)

to

  #elif defined(WIN32)  && !defined(_WIN32_WCE)

Finally, in `config.vc' I added definition of ANSI_COLOR.  At this
point GNU Go (or more correctly, the libraries) sort of compiled,
but with a hack.

The trick is in the utility programs (i.e. `mkpat').  Here we cannot
do this, because we are crosscompiling for another processor.

Then he notes that it might be possible, but he doesn't know how to
compile utility program not for the PPC, but for the main computer,
so that VS doesn't try to execute them on PPC (where there are no
input files).

Then follows an explanation of different kinds of programs for PPC,
which I didn't quite get.  Sort of there are no console programs and
it's not all that clear if it is possible to use GTP [oh well, Windows,
you know].

So, to make a PPC version, we need to comment out `#include's of absent
headers listed above with `#ifndef _WIN32_WCE' and make other changes
he described.

Attached are 6 changed files based on version 3.5.6 and a project in
which the time functions are defined.


I guess the only way we could something out of it is with extensive
help from Trevor or somebody other who at least works on Windows.
A PPC would also be needed I guess.  But all in all it seems like a
worthy project.

Paul

Attachment: PPC 3.5.6.ZIP
Description: Zip compressed data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]