Charles Boyd on Thu, 25 Aug 2011 04:50:37 +0200
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
embedding GP in GUI applications (android-port)
- To: firstname.lastname@example.org
- Subject: embedding GP in GUI applications (android-port)
- From: Charles Boyd <email@example.com>
- Date: Wed, 24 Aug 2011 22:50:10 -0400
- Delivery-date: Thu, 25 Aug 2011 04:50:37 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; bh=zK1UUAkxy/4C4OqyIU0JJnRHgYKL9GctJ54bNvMxyEU=; b=iH/LIlLl6jZd8A8Jl1FGWQu+ewfgy0pLFwa+nmpwR3W+1rz444OtRhhnFIPWeIMT7H bx3hLodtnGyYEfqdsMEDTFDwGhIp4KauyN1Lr6ZSJ7TByKvJs5s0nsH0jSTGpMAllhyO XI9Ewu0n1V+XItRgrBHeAUiIGRgbu1YtlExJk=
I have produced a statically compiled GP binary for Android, and now want to build a light graphical application to improve the usability of PARI/GP on Android.
Android applications are written in Java, and may interface with native C/C++ functions via the Java Native Interface (JNI).
Is there a relatively simple way to send commands for evaluation by GP from an external application?
For example, if it is possible to embed the GP interpreter in a C program (similar to Python embedding) -- then I could write a small wrapper library in C that interfaces with GP and then load this library in the Java GUI application via JNI. For example, this library would provide simple functions...roughly prototyped as:
// return a file descriptor for the gp process, or error status
// evaluate a gp command and return output, or error message
const char *gp_eval(const char *cmd);
// terminate the gp process, returning exit status
int gp_kill(int pid);
Any suggestions/ideas about how to do this are greatly appreciated, as always.