X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Foutput%2Frender-test.c;h=19bb0ccfab5321a8312b015bfe466ec43e5009f6;hb=2b220b7c394c841b1420db87029556d43e39ee0f;hp=b5b505c940c0236b988d4e9eee2796739b396a78;hpb=464a7a97da808da1d8a608e9254dfaad30c9de72;p=pspp diff --git a/tests/output/render-test.c b/tests/output/render-test.c index b5b505c940..19bb0ccfab 100644 --- a/tests/output/render-test.c +++ b/tests/output/render-test.c @@ -346,7 +346,7 @@ replace_newlines (char *p) { char *q; - for (q = p; *p != '\0'; ) + for (q = p; *p != '\0';) if (*p == '\\' && p[1] == 'n') { *q++ = '\n'; @@ -386,7 +386,6 @@ read_table (FILE *stream) for (c = 0; c < nc; c++) if (table_cell_is_empty (tab, c, r)) { - unsigned int opt; char *new_line; char *text; int rs, cs; @@ -412,44 +411,47 @@ read_table (FILE *stream) cs = 1; } - opt = 0; +#define S(H) { AREA_STYLE_INITIALIZER__, .cell_style.halign = H } + static const struct area_style left_style = S (TABLE_HALIGN_LEFT); + static const struct area_style right_style = S (TABLE_HALIGN_RIGHT); + static const struct area_style center_style + = S (TABLE_HALIGN_CENTER); + + const struct area_style *style = &right_style; while (*text && strchr ("<>^,@()|", *text)) switch (*text++) { case '<': - table_vline (tab, TAL_1, c, r, r + rs - 1); + table_vline (tab, TABLE_STROKE_SOLID, c, r, r + rs - 1); break; case '>': - table_vline (tab, TAL_1, c + cs, r, r + rs - 1); + table_vline (tab, TABLE_STROKE_SOLID, c + cs, r, r + rs - 1); break; case '^': - table_hline (tab, TAL_1, c, c + cs - 1, r); + table_hline (tab, TABLE_STROKE_SOLID, c, c + cs - 1, r); break; case ',': - table_hline (tab, TAL_1, c, c + cs - 1, r + rs); + table_hline (tab, TABLE_STROKE_SOLID, c, c + cs - 1, r + rs); break; case '@': - table_box (tab, TAL_1, TAL_1, -1, -1, c, r, - c + cs - 1, r + rs - 1); + table_box (tab, TABLE_STROKE_SOLID, TABLE_STROKE_SOLID, + -1, -1, c, r, c + cs - 1, r + rs - 1); break; case '(': - opt &= ~TAB_HALIGN; - opt |= TAB_LEFT; + style = &left_style; break; case ')': - opt &= ~TAB_HALIGN; - opt |= TAB_RIGHT; + style = &right_style; break; case '|': - opt &= ~TAB_HALIGN; - opt |= TAB_CENTER; + style = ¢er_style; break; default: @@ -464,13 +466,17 @@ read_table (FILE *stream) for (i = 0; (content = strsep (&pos, "#")) != NULL; i++) if (!i) - table_joint_text (tab, c, r, c + cs - 1, r + rs - 1, opt, - content); + { + table_joint_text (tab, c, r, c + cs - 1, r + rs - 1, 0, + content); + table_add_style (tab, c, r, style); + } else { char marker[2] = { 'a' + n_footnotes, '\0' }; struct footnote *f = table_create_footnote ( - tab, n_footnotes, content, marker, NULL); + tab, n_footnotes, content, marker, + area_style_clone (tab->container, &left_style)); table_add_footnote (tab, c, r, f); n_footnotes++; }