X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=web%2Fext%2Fgraph.i;fp=web%2Fext%2Fgraph.i;h=b04056ce5983fdcf7af3d746c7976afc8cca3f31;hb=978eb12a3e6725e4615e75ab090e456781b04703;hp=0000000000000000000000000000000000000000;hpb=abf0c1bf40a09aa9f6e1bff36c3afb82490f33e6;p=nms diff --git a/web/ext/graph.i b/web/ext/graph.i new file mode 100644 index 0000000..b04056c --- /dev/null +++ b/web/ext/graph.i @@ -0,0 +1,29 @@ +%module mygraph +%{ +#include "graph.c" +%} + +%inline +%{ + // Add some helper functions for C arrays + int *int_array(int size) { + return (int *) malloc(sizeof(int)*size); + } + void int_destroy(int *a) { + free(a); + } + void int_set(int *a, int i, int val) { + a[i] = val; + } + int int_get(int *a, int i) { + return a[i]; + } +%} + +graph *mygraph_new (int width, int height); +graph *mygraph_make_graph (graph *mygraph, float min_x, + float max_x, float min_y, float max_y, int tickgran); +void mygraph_cleanup (graph *mygraph); +void mygraph_to_file (graph *mygraph, char *filename); +void mygraph_plot_series (graph *mygraph, int *xvals, int *yvals, int n_vals, + float r, float g, float b);