Index: Makefile =================================================================== --- Makefile (revision 11248) +++ Makefile (revision 11249) @@ -1,3 +1,4 @@ CFLAGS = -Wall -g -ansi -pedantic -parse.o: parse.c +parse.o: parse.c uhpgl_math.h libuhpgl.h + Index: parse.c =================================================================== --- parse.c (revision 11248) +++ parse.c (revision 11249) @@ -21,19 +21,13 @@ */ #include -#include #include +#include "uhpgl_math.h" #include "libuhpgl.h" #include "parse.h" #define inst2num(s1, s2) ((((int)s1) << 8) | (int)s2) -#define CONST_PI 3.14159265358979323846 -#define RAD2DEG(r) ((r) * 180.0 / CONST_PI) -#define DEG2RAD(d) ((d) * CONST_PI / 180.0) -#define DDIST(dx, dy) sqrt((double)(dx)*(double)(dx) + (double)(dy)*(double)(dy)) - - /* Implementation idea borrowed from an old gcc */ static double ROUND(double x) { Index: uhpgl_math.h =================================================================== --- uhpgl_math.h (nonexistent) +++ uhpgl_math.h (revision 11249) @@ -0,0 +1,36 @@ +/* + libuhpgl - the micro HP-GL library + Copyright (C) 2017 Tibor 'Igor2' Palinkas + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + + This library is part of pcb-rnd: http://repo.hu/projects/pcb-rnd +*/ + +/* Math helper for internal use - not intended to be included by the + library user */ + +#ifndef LIBUHPGL_MATH_H +#define LIBUHPGL_MATH_H + +#include + +#define CONST_PI 3.14159265358979323846 +#define RAD2DEG(r) ((r) * 180.0 / CONST_PI) +#define DEG2RAD(d) ((d) * CONST_PI / 180.0) +#define DDIST(dx, dy) sqrt((double)(dx)*(double)(dx) + (double)(dy)*(double)(dy)) + +#endif