[jugglemaster] Jugglemaster for Pocket PC (JMPocket)

Barton Chittenden tiger at iglou.com
Sun Jun 20 11:13:22 EDT 2004


On Sun, 20 Jun 2004, Per Johan Groland wrote:

> Hi,
>
> Since this is the first time I'm posting to the JuggleMaster mailing
> list, I'll start by introducing myself. I'm Per Johan Groland, the
> original author of jmlib. (along with Palm OS and Pocket PC ports)

Good to have you on the list, Per.

> Anyway, I recently spent some time updating the Pocket PC version
> (JMPocket) to work with the new directory structure and changes made
> to jmlib.

Very cool. I'll be downloading the new binary when you have it ready :-)

> I also thought I'd make a few comments on the changes done to jmlib:
>
> #define BMAX 630		     // max number of balls
>
> This was originally 35. Since the arrays in jmlib are all declared
> statically, this adds something in the area of 32 kB to the static
> memory requirement of jmlib. This doesn't matter on a PC of course,
> but it does matter on some of the platforms I've been trying jmlib
> on. Is it possible to add a typedef (e.g. JMLIB_BMAX_630) to make
> jmlib chose 35 balls as default rather than 630?

Excellent point. I'm not quite sure that I understand exactly how using a 
typedef would solve the problem [don't get me wrong, this is my lack of 
understanding, not your lack of insight ;-)]. I understand using something
like

#define JMLIB_BMAX_630 /* this would not be defined for PalmOS */

#ifdef JMLIB_BMAX_630
 	#define BMAX 630
#else
 	#define BMAX 35
#endif

This seems like a kluge to me. I don't like having that much stuff 
hardcoded. I think that the cleanest solution would be to have various 
arrays be dynamicly allocated, but maybe that's overkill. I dunno. I 
haven't actually compiled any of the code yet, so please take any thing I 
say with a grain of salt.

>
> the JMLib::initialize function seems to have changed quite a bit.
>
> This breaks the Pocket PC version:
>
>  srand(time(NULL));
>
> There is no time.h defined for the Pocket PC API. I'm not exactly
> sure why you want to use srand anyway, jmlib doesn't use any random
> number, right?

Au Contraire! :-)

Jmlib now has a "random" style: the site swap is parsed, and we find the 
number of throws and catches in the pattern. Then we assign a random catch 
and throw position to each toss in the pattern.

This raises a few interesting questions:

Is there a cannonical way of initializing random numbers under PalmOS, 
given that time.h is not available?

Jmlib does not currenly have any code for saving a random style which 
has beeen created. It occurs to me that this is something that will also 
have to be done somewhat abstractly, because the palm pilot does not 
directly support file IO {does it?}.

Are there other parts of the C standard library which are missing on 
PalmOS, and will need similar abstraction?

--Barton



More information about the Jugglemaster mailing list