diff --git a/src/boxes.c b/src/boxes.c index d03964e..a108b2f 100644 --- a/src/boxes.c +++ b/src/boxes.c @@ -3,7 +3,7 @@ * Date created: March 18, 1999 (Thursday, 15:09h) * Author: Thomas Jensen * tsjensen@stud.informatik.uni-erlangen.de - * Version: $Id: boxes.c,v 1.2 1999/03/19 17:44:47 tsjensen Exp tsjensen $ + * Version: $Id: boxes.c,v 1.3 1999/03/30 09:36:23 tsjensen Exp tsjensen $ * Language: ANSI C * Platforms: sunos5/sparc, for now * World Wide Web: http://home.pages.de/~jensen/boxes/ @@ -14,6 +14,10 @@ * Revision History: * * $Log: boxes.c,v $ + * Revision 1.3 1999/03/30 09:36:23 tsjensen + * ... still programming ... + * (removed setlocale() call and locale.h include) + * * Revision 1.2 1999/03/19 17:44:47 tsjensen * ... still programming ... * @@ -38,7 +42,7 @@ extern char *optarg; /* for getopt() */ extern int optind, opterr, optopt; /* for getopt() */ -#ident "$Id: boxes.c,v 1.2 1999/03/19 17:44:47 tsjensen Exp tsjensen $" +#ident "$Id: boxes.c,v 1.3 1999/03/30 09:36:23 tsjensen Exp tsjensen $" extern FILE *yyin; /* lex input file */ @@ -670,6 +674,13 @@ int read_all_input() return 1; } + /* + * Exit if there was no input at all + */ + if (input.lines == NULL || input.lines[0].text == NULL) { + return 0; + } + /* * Remove indentation */ @@ -716,7 +727,7 @@ size_t highest (const sentry_t *sarr, const int n, ...) int i; size_t max = 0; /* current maximum height */ - #if defined(DEBUG) && 1 + #if defined(DEBUG) && 0 fprintf (stderr, "highest (%d, ...)\n", n); #endif @@ -935,10 +946,20 @@ static int vert_precalc (const sentry_t *sarr, const shape_t *seite, size_t res_hspace = 0; int i; size_t j; + size_t target_width; memset (iltf, 0, (SHAPES_PER_SIDE-2) * sizeof(size_t)); *hspace = 0; + if (input.maxline >= (opt.design->minwidth - sarr[seite[0]].width - + sarr[seite[SHAPES_PER_SIDE-1]].width)) { + target_width = input.maxline; + } + else { + target_width = opt.design->minwidth - sarr[seite[0]].width - + sarr[seite[SHAPES_PER_SIDE-1]].width; + } + for (i=1; i input.maxline) + if (res_hspace > target_width) space_to_fill = 0; else - space_to_fill = input.maxline - res_hspace; + space_to_fill = target_width - res_hspace; for (j=0,vtmp=0; !j||vtmp= (opt.design->minheight - sarr[seite[0]].height - + sarr[seite[SHAPES_PER_SIDE-1]].height)) + text_height = input.anz_lines; + else { + text_height = opt.design->minheight - sarr[seite[0]].height - + sarr[seite[SHAPES_PER_SIDE-1]].height; + } + for (i=1; i input.anz_lines) + if (res_vspace > text_height) space_to_fill = 0; else - space_to_fill = input.anz_lines - res_vspace; + space_to_fill = text_height - res_vspace; for (j=0,vtmp=0; !j||vtmp