******************************** * HPAPINE * ******************************** by Khanh-Dang NGUYEN THU-LAM (see the `AUTHORS' file for my email). HPAPINE's project page is at: ******************************** * Release notes * ******************************** HPAPINE is still in alpha stage. Please read the `TODO' file to see what doesn't work. Please read the `Changelog' file to see what changed from the previous version. ******************************** * COPYRIGHT AND LICENSE * ******************************** Most of the code of HPAPINE is copyrighted by the HP-GCC Development Team. Thus, it is protected by the GNU General Public License (see the `COPYING' file), with a special exception: > As a special exception, you may use this file as part of a free > software library without restriction. Specifically, if other files > instantiate templates or use macros or inline functions from this file, > or you compile this file and link it with other files to produce an > executable, this file does not by itself cause the resulting executable > to be covered by the GNU General Public License. This exception does > not however invalidate any other reasons why the executable file might > be covered by the GNU General Public License. All the other files are copyrighted by me and are also protected by the GNU General Public License. (However, I believe the majority of programs compiled with HPAPINE will not be distributed, so that licensing should not be an issue.) ******************************** * Installation * ******************************** You have to edit the `Makefile.inc' file first to adjust your compilation options. Then, just type "make". After the compilation process is done, the library file `lib/libhpapine.so' is created. You can then compile your programs with something like: $ gcc -Lfoo/hpapine/lib -lhpapine -Ifoo/hpapine/include bar.c -o bar ******************************** * FAQ * ******************************** Q: What is HPAPINE? A: HPAPINE is an implementation of the HPGCC's API. Usually, a HP49g+/50g program written in C is compiled by HPGCC. With HPAPINE, you can compile the same program so that it runs natively on your Unix system. Q: I am a Microsoft Windows user. How to use HPAPINE? A: You can't yet. But is shouldn't be difficult to port HPAPINE to the Microsoft Windows platform. All you have to do is only implement the routines declared in the `src/include/hpapine_gui.h' C header file. There may also be some issues about POSIX functions not implemented by the win32 API. However, I really know nothing about Windows programming. 2007-11-10: Egan Ford reported a successful compilation under Cygwin. Q: What about portability? A: HPAPINE aims to be a portable implementation that could run on a wide range of hardware. Currently, HPAPINE has only been tested (not much, through) on PC architecture (x86, 32-bit, little-endian). I have some SPARC systems at home, so I could test soon HPAPINE on a big-endian architecture. Q: Is HPAPINE free? A: Yes, it is, not only free as in free beer, but also free as in free speech. HPAPINE is protected by the GPL (version 2) which is a free license. (Please read the `COPYING' file if you don't know what the GPL is.) Most parts of the source code is copyrighted by the HPGCC's developement team. Q: What is not HPAPINE? A: HPAPINE is not an emulator. It means that if your C program is not portable (endianness issue, use of hp50g's I/O memory, etc), it will probably not work. Q: Why should I find it useful? A: Currently, there is no hp49g+/50g emulator. Even if HPAPINE is not an emulator, you can use it to debug your program with your favorite debugger. Q: What do I need to use HPAPINE? A: HPAPINE needs a standard POSIX and X11 environnement, e.g. Linux or *BSD system; you also need a C compiler. The GNU's C compiler (gcc) should work well. (At least, it does for me.) Then, compile your C program with something like gcc -I~/hpapine/include -L~/hpapine/lib -lhpapine foo.c -o foo providing that your hpapine's files stands in $HOME/hpapine. Q: What does HPAPINE mean? A: HPAPINE stands for HPGCC API Is Not an Emulator. Q: How do I interact with my HPGCC program? A: You can use RPL objects on the stack (see next question). You can also use the keyboard: - A-Z, 0-9, F1-F6, +, -, *, /, space, arrows: as expected; - Escape: ON; - Enter, Return: ENTER; - Left shift: Left-Shift; - Left Control: Right-Shift; - Tab: ALPHA. Q: How can I put RPL objects on the RPL stack? A: When your program calls a stack routine (e.g. stack_depth or one of the sat_stack_pop... routines), it waits for the stack input on the standard input. Currently, HPAPINE only supports reals, strings and lists. Just enter them as your would on your calculator. Here is a short example, using the sqrt2 program in the examples/decnumber repertory: > $ export LD_LIBRARY_PATH=$HOME/hpapine/lib > $ echo '{ "a" "list" { } } "Hi world!" 10' | ./sqrt2 > Waiting for stack input on stdin... > Stack reading: done. > > --- RPL Stack: > > 3: { "a" "list" { } } > 2: "Hi world!" > 1: 10 > > > --- RPL Stack: > > 3: { "a" "list" { } } > 2: "Hi world!" > 1: "1.414213562" > > The program displays "Waiting for stack input on stdin...", telling you that you have to provide some input. You can then input your RPL objects either using your keyboard and validate it with ^D (Ctrl-D), or using your Unix shell capabilities as in the example above. Then, the program displays "Stack reading: done.", followed by a representation of the RPL stack. When the program ends, it displays automatically the content of the stack left by the program. Here, sqrt2 took a real as an argument and computed a string with the first 10 digits of sqrt(2). Q: I always get "error while loading shared libraries: libhpapine.so: cannot open shared object file: No such file or directory". A: Your libhpapine.so file must be in your Library Loader's path. Just copy it somewhere in the LD's path, or use something like (the syntax may differ according to the shell you use): $ export LD_LIBRARY_PATH=$HOME/hpapine/lib Q: How can I help? A: Just report to the mainteners any bugs (see the `AUTHORS' file). As HPAPINE's source code is provided, you can fix the bug and send a patch.