mirror of
https://github.com/ascii-boxes/boxes.git
synced 2025-06-21 02:08:02 +02:00
Bugfix: When matching vertical side shape lines, ignore empty shape lines
This commit is contained in:
parent
0f2a1703ce
commit
2d293cb89d
24
src/remove.c
24
src/remove.c
@ -4,7 +4,7 @@
|
|||||||
* Date created: June 23, 1999 (Wednesday, 20:59h)
|
* Date created: June 23, 1999 (Wednesday, 20:59h)
|
||||||
* Author: Copyright (C) 1999 Thomas Jensen
|
* Author: Copyright (C) 1999 Thomas Jensen
|
||||||
* tsjensen@stud.informatik.uni-erlangen.de
|
* tsjensen@stud.informatik.uni-erlangen.de
|
||||||
* Version: $Id: remove.c,v 1.2 1999/06/25 18:45:33 tsjensen Exp tsjensen $
|
* Version: $Id: remove.c,v 1.3 1999/07/20 18:57:16 tsjensen Exp tsjensen $
|
||||||
* Language: ANSI C
|
* Language: ANSI C
|
||||||
* World Wide Web: http://home.pages.de/~jensen/boxes/
|
* World Wide Web: http://home.pages.de/~jensen/boxes/
|
||||||
* Purpose: Box removal, i.e. the deletion of boxes
|
* Purpose: Box removal, i.e. the deletion of boxes
|
||||||
@ -25,6 +25,11 @@
|
|||||||
* Revision History:
|
* Revision History:
|
||||||
*
|
*
|
||||||
* $Log: remove.c,v $
|
* $Log: remove.c,v $
|
||||||
|
* Revision 1.3 1999/07/20 18:57:16 tsjensen
|
||||||
|
* Added GNU GPL disclaimer
|
||||||
|
* Does not kill leading/trailing blank lines anymore when !opt.killblank
|
||||||
|
* Added include config.h
|
||||||
|
*
|
||||||
* Revision 1.2 1999/06/25 18:45:33 tsjensen
|
* Revision 1.2 1999/06/25 18:45:33 tsjensen
|
||||||
* Added initialization of mmok to please compiler
|
* Added initialization of mmok to please compiler
|
||||||
* Changed parameters of empty_side() calls to comply with new signature
|
* Changed parameters of empty_side() calls to comply with new signature
|
||||||
@ -45,7 +50,7 @@
|
|||||||
#include "remove.h"
|
#include "remove.h"
|
||||||
|
|
||||||
static const char rcsid_remove_c[] =
|
static const char rcsid_remove_c[] =
|
||||||
"$Id: remove.c,v 1.2 1999/06/25 18:45:33 tsjensen Exp tsjensen $";
|
"$Id: remove.c,v 1.3 1999/07/20 18:57:16 tsjensen Exp tsjensen $";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -74,6 +79,7 @@ static int best_match (const line_t *line,
|
|||||||
char *p; /* position found by strstr */
|
char *p; /* position found by strstr */
|
||||||
size_t cq; /* current quality */
|
size_t cq; /* current quality */
|
||||||
char *q; /* space check rover */
|
char *q; /* space check rover */
|
||||||
|
line_t chkline; /* for calls to empty_line() */
|
||||||
size_t quality;
|
size_t quality;
|
||||||
|
|
||||||
*ws = *we = *es = *ee = NULL;
|
*ws = *we = *es = *ee = NULL;
|
||||||
@ -102,6 +108,11 @@ static int best_match (const line_t *line,
|
|||||||
cs = opt.design->shape + west_side[--w];
|
cs = opt.design->shape + west_side[--w];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chkline.text = cs->chars[k];
|
||||||
|
chkline.len = cs->width;
|
||||||
|
if (empty_line (&chkline))
|
||||||
|
continue;
|
||||||
|
|
||||||
s = (char *) strdup (cs->chars[k]);
|
s = (char *) strdup (cs->chars[k]);
|
||||||
if (s == NULL) {
|
if (s == NULL) {
|
||||||
perror (PROJECT);
|
perror (PROJECT);
|
||||||
@ -166,6 +177,11 @@ static int best_match (const line_t *line,
|
|||||||
j, k, w, cs->chars[k]?cs->chars[k]:"(null)");
|
j, k, w, cs->chars[k]?cs->chars[k]:"(null)");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
chkline.text = cs->chars[k];
|
||||||
|
chkline.len = cs->width;
|
||||||
|
if (empty_line (&chkline))
|
||||||
|
continue;
|
||||||
|
|
||||||
s = (char *) strdup (cs->chars[k]);
|
s = (char *) strdup (cs->chars[k]);
|
||||||
if (s == NULL) {
|
if (s == NULL) {
|
||||||
perror (PROJECT);
|
perror (PROJECT);
|
||||||
@ -231,7 +247,7 @@ static int hmm (const int aside, const size_t follow,
|
|||||||
* ecs pointer to first char of east corner shape
|
* ecs pointer to first char of east corner shape
|
||||||
* cnt current shape to check (0 == leftmost middle shape)
|
* cnt current shape to check (0 == leftmost middle shape)
|
||||||
*
|
*
|
||||||
* Recursive helper function for detect_horiz()
|
* Recursive helper function for detect_horiz(), uses backtracking
|
||||||
*
|
*
|
||||||
* RETURNS: == 0 success
|
* RETURNS: == 0 success
|
||||||
* != 0 error
|
* != 0 error
|
||||||
@ -734,7 +750,7 @@ static design_t *detect_design()
|
|||||||
|
|
||||||
int remove_box()
|
int remove_box()
|
||||||
/*
|
/*
|
||||||
* foo
|
* Remove box from input.
|
||||||
*
|
*
|
||||||
* RETURNS: == 0 success
|
* RETURNS: == 0 success
|
||||||
* != 0 error
|
* != 0 error
|
||||||
|
Loading…
x
Reference in New Issue
Block a user