Charles Boyd on Tue, 04 Oct 2011 06:41:01 +0200

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

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

There is a distinction to make between the gp programm and the GP interpreter.
The gp programm is a standalone exectutable that provide an interface to the
GP interpretor which is included in libpari. In the context of a graphical
application you probably want to use the GP interpreter directly since gp mostly
provide the text-based user interface which you do not need.

This makes sense and I have applied it to my application, which has the basic design:

libpari (cross-compiled for arm-linux-androideabi) ---> libparidroid (a small wrapper library I wrote) ---> Android GUI (written in Java, makes callbacks to libparidroid using the Java Native Interface).

Yes, you can embed the GP interpretor in your C program, since the GP interpretor
is part of the libpari library. See examples/minigp.c in the distribution for
an example.

I have some questions about this:

(1) Do I need to link against libreadline/libhistory to use the gp_add_history() function (and its relatives)?

(2) What would be a typical use case of using gp_read_stream(FILE *file)?

[I am considering if it would be better/easier for my Java application to communicate with libpari through some kind of FIFO rather than making a callback each time there is some input to evaluate.]

(3) How can I return a string from pari_err() or pari_warn() when a command is entered incorrectly? Android redirects stdout to /dev/null, so the only way to give an error message is by sending a string to the Java application.

Also, is it alright if I use the PARI/GP icon from your website on the Google Code repository for this project and as the icon for PariDroid application on the phone?

I put this up some time ago on the website, but I thought I should ask for permission to do this.

Here is the link to website:


(Forgot to CC mailing list)