~ubuntu-branches/ubuntu/natty/mathomatic/natty

« back to all changes in this revision

Viewing changes to lib/README.txt

  • Committer: Bazaar Package Importer
  • Author(s): Sandro Tosi
  • Date: 2010-05-27 23:29:55 UTC
  • mfrom: (1.1.26 upstream) (3.1.15 sid)
  • Revision ID: james.westby@ubuntu.com-20100527232955-xzvvnwdzy8c9mdji
Tags: 15.1.1-1
* New upstream release
* debian/patches/10_fix_makefile.dpatch
  - updated to new upstream code
* debian/patches/30_bts-459093_ftbfs_make_test_time.dpatch
  - updated to new upstream code

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
areas in it are global and static.
18
18
 
19
19
Compile and link *.c and ../*.c with -DLIBRARY on the C compiler command
20
 
line, to compile Mathomatic in library mode, and to create the test
21
 
application which uses this API.  This is automatically done by the make
22
 
utility input file "../makefile.lib".  To compile the library and test
23
 
program, go to the Mathomatic build directory ("cd ..") and type:
24
 
 
25
 
        make clean
26
 
        make -f makefile.lib
 
20
line, to compile Mathomatic in library mode, and to create the test/example
 
21
application which uses this API.  This is automatically done with the GNU
 
22
make utility and its input file "makefile".  To compile the library and test
 
23
program, type "make" while in this "lib" directory.
27
24
 
28
25
This will create the API test executable named "mathomatic" and the static
29
26
library "libmathomatic.a".  To run the test executable, type "./mathomatic".
30
27
To do a system install of the development library "libmathomatic.a" and C
31
28
header file "mathomatic.h", type:
32
29
 
33
 
        sudo make -f makefile.lib install
 
30
        sudo make install
34
31
 
35
 
Be sure to "make clean" again, before using a different makefile.  Just
36
 
include the file "mathomatic.h" and call the functions in "lib.c" to use this
37
 
library.  Link your program with "libmathomatic.a" by using "-lmathomatic
38
 
-lm" at the end of the ld linker command line.  "libmathomatic.a" is not
39
 
required on the target system, since it is a static library, meaning it is
40
 
included in the resulting executable.
 
32
Just include the file "mathomatic.h" and call the functions in "lib.c" to use
 
33
this library.  Link your program with "libmathomatic.a" by using
 
34
"-lmathomatic -lm" at the end of the ld linker command line.
 
35
"libmathomatic.a" is not required on the target system, since it is a static
 
36
library, meaning it is included in the resulting executable.
41
37
 
42
38
The following code provides a quick test of the library:
43
39
 
55
51
    char *output;
56
52
    matho_init();
57
53
    if (matho_process("x^2=4", &output) && output)
58
 
        free((void *) output);
 
54
        free(output);
59
55
    if (matho_process("solve x", &output)) {
60
56
        if (output) {
61
57
            printf("%s\n", output);
62
 
            free((void *) output);
 
58
            free(output);
63
59
        }
64
 
    } else {
 
60
    } else if (output) {
65
61
        printf("%s\n", output);
66
62
    }
67
63
 
68
64
The following Mathomatic commands are omitted in this library: calculate,
69
 
edit, plot, push, quit, and tally.  GNU readline functionality is not used in
70
 
the library.
 
65
edit, "factor number", plot, push, quit, and tally.  GNU readline
 
66
functionality is not used in the library.
71
67
 
72
68
Recently, the "nintegrate" and "integrate definite" commands are allowed; the
73
69
bounds of integration are specified in the two equation spaces following the