Bill Allombert on Tue, 18 Oct 2011 12:55:06 +0200


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

Re: Fwd: embedding GP in GUI applications (android-port)


On Mon, Oct 17, 2011 at 11:59:43PM -0400, Charles Boyd wrote:
> Hi,
> 
> Thanks for your response.
> 
> I am not sure that would work: gp_read_stream() read the file until EOF.
> >
> 
> So I would use gp_read_stream(), for example, to run a script in the
> application?

Yes.

> >  You need to divert pariErr. Create you own PariOUT object which is
> > defined in
> > paristio.h as follow:
> >
> > typedef struct PariOUT {
> >  void (*putch)(char);
> >  void (*puts)(const char*);
> >  void (*flush)(void);
> > } PariOUT;
> >
> > so define your own method
> > PariOUT droidErr = {droidputch, droidputs, droidflush};
> > and set pariErr=&droidErr
> >
> > We might provide a better solution in the future.
> >
> 
> So droidputch/droidputs/droidflush would be pointing to C functions in
> libparidroid (my wrapper around libpari), right?

Yes, and you do pariErr=&droidErr after the call to pari_init().

> There is nothing like strerr() in PARI? (This would be nice...)

I have no idea what strerr() do, sorry.

> For the website, I would suggest you modify slightly the logo (maybe just
> > add "droid" under PARI) so that people do not expect that clicking on the
> > logo
> > bring them to the PARI web site.
> >
> > For the icon, actually the logo was the icon initially so it should be
> > fine.
> >
> 
> Done.

Very nicely done, indeed!
Maybe add a direct link to the PARI website in the section
'Where can I find out more about PARI/GP?'.

> > I have written an inline arm assembly level0 kernel for PARI (a long time
> > ago), but I
> > have never commited it because at the time it was very hard to know whether
> > an
> > ARM platform has 32x32->64 unsigned multiplication (UMULL)
> 
> > Also it may be possible to add a flag to Configure to generate the android
> > pari.cfg
> > automatically, now that we know what to write.
> >
> 
> Great!
> 
> -----
> New question:
> 
> In the application, running a command that uses a for() or while() loop
> (e.g., "for(i=0,i<10,print(i))") does not work and actually crashes the

Your example is invalid. You probably want to do for(i=0,9,print(i)).

> application. Using an if() statement, however, works perfectly. As I
> understand, PARI should provide all of these functions by default...so do
> you have any idea why this might create an error?
> 
> My guess is that the problem is not actually with for() or while(), but
> using print() command.

Does print(0) works ?

Maybe you need to divert pariOut, if you do not want to output to stdout.

Cheers,
Bill.