diff --git a/src/shape.c b/src/shape.c index 14b840f..efc528a 100644 --- a/src/shape.c +++ b/src/shape.c @@ -4,7 +4,7 @@ * Date created: June 23, 1999 (Wednesday, 13:39h) * Author: Copyright (C) 1999 Thomas Jensen * tsjensen@stud.informatik.uni-erlangen.de - * Version: $Id: shape.c,v 1.2 1999/06/25 18:52:28 tsjensen Exp tsjensen $ + * Version: $Id: shape.c,v 1.3 1999/07/22 12:28:25 tsjensen Exp tsjensen $ * Language: ANSI C * World Wide Web: http://home.pages.de/~jensen/boxes/ * Purpose: Shape handling and information functions @@ -25,6 +25,10 @@ * Revision History: * * $Log: shape.c,v $ + * Revision 1.3 1999/07/22 12:28:25 tsjensen + * Added GNU GPL disclaimer + * Added include config.h + * * Revision 1.2 1999/06/25 18:52:28 tsjensen * Added empty_side() function from boxes.c * Removed #include regexp.h @@ -43,7 +47,7 @@ #include "boxes.h" static const char rcsid_shape_c[] = - "$Id: shape.c,v 1.2 1999/06/25 18:52:28 tsjensen Exp tsjensen $"; + "$Id: shape.c,v 1.3 1999/07/22 12:28:25 tsjensen Exp tsjensen $"; @@ -62,61 +66,6 @@ shape_t *sides[] = { north_side, east_side, south_side, west_side }; -int iscorner (const shape_t s) -/* - * Return true if shape s is a corner. - * -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - */ -{ - int i; - shape_t *p; - - for (i=0, p=corners; iwidth != shape2->width || shape1->height != shape2->height) { - if (shape1->width * shape1->height > shape2->width * shape2->height) - return 1; - else - return -1; - } - - for (i=0; iheight; ++i) { - int c = strcmp (shape1->chars[i], shape2->chars[i]); /* no casecmp! */ - if (c) return c; - } - - return 0; -} - - - -shape_t *both_on_side (const shape_t shape1, const shape_t shape2) -/* - * Compute the side that *both* shapes are on. - * - * RETURNS: pointer to a side list on success - * NULL on error (e.g. shape on different sides) - * -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - */ -{ - int i, j, found; - - for (i=0; i 1) { - switch (i) { - case 0: return north_side; - case 1: return east_side; - case 2: return south_side; - case 3: return west_side; - default: return NULL; - } - } - } - } - - return NULL; -} - - - -int shape_distance (const shape_t s1, const shape_t s2) -/* - * Compute distance between two shapes which are located on the same side - * of the box. E.g. shape_distance(NW,N) == 2. - * - * RETURNS: distance in steps if ok - * -1 on error - * -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - */ -{ - int i; - int distance = -1; - shape_t *workside = both_on_side (s1, s2); - - if (!workside) return -1; - if (s1 == s2) return 0; - - for (i=0; i -1) { - ++distance; - break; - } - } - else { - if (distance > -1) - ++distance; - } - } - - if (distance > 0 && distance < SHAPES_PER_SIDE) - return distance; - else - return -1; -} - - - size_t highest (const sentry_t *sarr, const int n, ...) /* * Return height (vert.) of highest shape in given list.