Charles Boyd on Tue, 18 Oct 2011 06:00:09 +0200

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

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


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?
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?

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

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.

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)

Do you know if android platform consistently provide UMULL and whether the performance are
better than four MUL ?

I have asked about this on the android-ndk mailing list, see my post: Android/ARM UMULL support.
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.


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 application. Using an if() statement, however, works perfectly. As I understand, PARI should provide all of these functions by 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.

I currently have no logging mechanism to let me see error messages or recover from an error without exiting the application, so all I have is a guess.

This is a basic picture as to how the application works:

--(input)--> PariDroid Application takes command,
--(JNI)--> libparidroid gets the string from application,
--(wrapper)--> libpari evaluates command and returns GEN,
--(callback)--> libparidroid returns string (genToStr) to application,
--(JNI)--> PariDroid application displays output.