commit 6c1a80ba81053bb2edc896bb52c0cc384023543b
parent 4145d64035248317f7fe7cb1af6b79b1dec429fa
Author: Christos Margiolis <christos@margiolis.net>
Date: Tue, 19 May 2020 02:27:23 +0300
added some consts
Diffstat:
5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/bin/graphcurses b/bin/graphcurses
Binary files differ.
diff --git a/obj/main.o b/obj/main.o
Binary files differ.
diff --git a/src/main.c b/src/main.c
@@ -2,7 +2,7 @@
static void *f = NULL;
-static void init_curses();
+static void init_curses(void);
static void getfunc(Plane *p, char *buf);
static void validate_expression(Plane *p);
static float eval(float x);
@@ -38,13 +38,13 @@ main(int argc, char **argv)
}
endwin();
- /*evaluator_destroy(f); */
+ evaluator_destroy(f);
return 0;
}
static void
-init_curses()
+init_curses(void)
{
initscr();
cbreak();
diff --git a/src/plane.c b/src/plane.c
@@ -25,7 +25,7 @@ restore_zoom(Plane *p)
}
void
-draw_axes(Plane *p)
+draw_axes(const Plane *p)
{
int i;
float x0 = scale(0.0f, p->xmin, p->xmax, 0.0f, p->xmaxs);
@@ -48,7 +48,7 @@ draw_axes(Plane *p)
}
void
-draw_graph(Plane *p)
+draw_graph(const Plane *p)
{
float x;
float xstep;
@@ -71,14 +71,14 @@ scale(float val, float omin, float omax, float nmin, float nmax)
}
void
-getstep(Plane *p, float *xstep, float *ystep)
+getstep(const Plane *p, float *xstep, float *ystep)
{
if (*xstep) *xstep = (p->xmax - p->xmin) / (p->xmaxs + 1.0f);
if (*ystep) *ystep = (p->ymax - p->ymin) / (p->ymaxs + 1.0f);
}
void
-plot(Plane *p, float x, float y)
+plot(const Plane *p, float x, float y)
{
float xp = scale(x, p->xmin, p->xmax, 0.0f, p->xmaxs);
float yp = scale(y, p->ymin, p->ymax, p->ymaxs, 0.0f);
diff --git a/src/plane.h b/src/plane.h
@@ -26,11 +26,11 @@ extern Plane p;
void plane_init(Plane *p);
void restore_zoom(Plane *p);
-void draw_axes(Plane *p);
-void draw_graph(Plane *p);
+void draw_axes(const Plane *p);
+void draw_graph(const Plane *p);
float scale(float val, float omin, float omax, float nmin, float nmax);
-void getstep(Plane *p, float *xstep, float *ystep);
-void plot(Plane *p, float x, float y);
+void getstep(const Plane *p, float *xstep, float *ystep);
+void plot(const Plane *p, float x, float y);
void handle_zoom(Plane *p, float factor);
void shift(Plane *p, float xshift, float yshift);