mirror of
https://github.com/ascii-boxes/boxes.git
synced 2025-03-30 23:46:02 +02:00
Added empty_side() function from boxes.c
Removed #include regexp.h
This commit is contained in:
parent
6e23417d1f
commit
0038f52681
47
src/shape.c
47
src/shape.c
@ -4,7 +4,7 @@
|
||||
* Date created: June 23, 1999 (Wednesday, 13:39h)
|
||||
* Author: Thomas Jensen
|
||||
* tsjensen@stud.informatik.uni-erlangen.de
|
||||
* Version: $Id$
|
||||
* Version: $Id: shape.c,v 1.1 1999/06/23 12:26:59 tsjensen Exp tsjensen $
|
||||
* Language: ANSI C
|
||||
* World Wide Web: http://home.pages.de/~jensen/boxes/
|
||||
* Purpose: Shape handling and information functions
|
||||
@ -12,7 +12,10 @@
|
||||
*
|
||||
* Revision History:
|
||||
*
|
||||
* $Log$
|
||||
* $Log: shape.c,v $
|
||||
* Revision 1.1 1999/06/23 12:26:59 tsjensen
|
||||
* Initial revision
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*/
|
||||
|
||||
@ -20,11 +23,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include "shape.h"
|
||||
#include "regexp.h"
|
||||
#include "boxes.h"
|
||||
|
||||
static const char rcsid_shape_c[] =
|
||||
"$Id$";
|
||||
"$Id: shape.c,v 1.1 1999/06/23 12:26:59 tsjensen Exp tsjensen $";
|
||||
|
||||
|
||||
|
||||
@ -350,4 +352,41 @@ shape_t leftmost (const int aside, const int cnt)
|
||||
|
||||
|
||||
|
||||
int empty_side (sentry_t *d, const int aside)
|
||||
/*
|
||||
* Return true if the shapes on the given side consist entirely out of
|
||||
* spaces - and spaces only, tabs are considered non-empty.
|
||||
*
|
||||
* d pointer to shape list of design to check
|
||||
* aside the box side (one of BTOP etc.)
|
||||
*
|
||||
* RETURNS: == 0 side is not empty
|
||||
* != 0 side is empty
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*/
|
||||
{
|
||||
int i;
|
||||
size_t j;
|
||||
sentry_t *cs; /* current shape */
|
||||
char *p;
|
||||
|
||||
for (i=0; i<SHAPES_PER_SIDE; ++i) {
|
||||
cs = d + sides[aside][i];
|
||||
if (isempty(cs))
|
||||
continue;
|
||||
for (j=0; j<cs->height; ++j) {
|
||||
p = cs->chars[j];
|
||||
while (*p && *p == ' ')
|
||||
++p;
|
||||
if (*p)
|
||||
return 0; /* side is not empty */
|
||||
}
|
||||
}
|
||||
|
||||
return 1; /* side is empty */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*EOF*/ /* vim: set sw=4: */
|
||||
|
Loading…
Reference in New Issue
Block a user