From: John Darrington Date: Fri, 14 Jan 2005 04:05:47 +0000 (+0000) Subject: Integrated the charts into the HTML stream. X-Git-Tag: v0.4.0~196 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c4c4a789e9c23478bce195d2ed98bab6064dfc1;p=pspp-builds.git Integrated the charts into the HTML stream. --- diff --git a/po/en_GB.po b/po/en_GB.po index a22d1009..2b46adf7 100644 --- a/po/en_GB.po +++ b/po/en_GB.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PSPP 0.3.1\n" "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n" -"POT-Creation-Date: 2005-01-09 16:22+0800\n" +"POT-Creation-Date: 2005-01-14 11:58+0800\n" "PO-Revision-Date: 2004-01-23 13:04+0800\n" "Last-Translator: John Darrington \n" "Language-Team: John Darrington \n" @@ -117,17 +117,17 @@ msgid "" "by %d lines." msgstr "" -#: src/ascii.c:390 src/devind.c:167 src/html.c:102 src/postscript.c:458 +#: src/ascii.c:390 src/devind.c:167 src/html.c:103 src/postscript.c:458 #, c-format msgid "%s: Initialization complete." msgstr "" -#: src/ascii.c:402 src/devind.c:179 src/html.c:114 src/postscript.c:471 +#: src/ascii.c:402 src/devind.c:179 src/html.c:115 src/postscript.c:471 #, c-format msgid "%s: Beginning closing..." msgstr "" -#: src/ascii.c:424 src/devind.c:184 src/html.c:119 src/postscript.c:490 +#: src/ascii.c:424 src/devind.c:184 src/html.c:120 src/postscript.c:490 #, c-format msgid "%s: Finished closing." msgstr "" @@ -219,6 +219,10 @@ msgstr "" msgid "%s - Page %d" msgstr "" +#: src/ascii.c:1646 +msgid "Charts are unsupported with ascii drivers." +msgstr "" + #: src/autorecode.c:122 #, c-format msgid "Source variable count (%d) does not match target variable count (%d)." @@ -252,48 +256,33 @@ msgstr "" msgid "Error writing temporary file: %s." msgstr "" -#: src/casefile.c:363 -#, c-format -msgid "%s: Creating temporary file: %s." -msgstr "" - -#: src/casefile.c:507 +#: src/casefile.c:478 #, c-format msgid "%s: Opening temporary file: %s." msgstr "" -#: src/casefile.c:533 +#: src/casefile.c:504 #, c-format msgid "%s: Seeking temporary file: %s." msgstr "" -#: src/casefile.c:549 +#: src/casefile.c:520 #, c-format msgid "%s: Reading temporary file: %s." msgstr "" -#: src/casefile.c:552 +#: src/casefile.c:523 #, c-format msgid "%s: Temporary file ended unexpectedly." msgstr "" -#: src/cmdline.c:141 src/cmdline.c:160 src/cmdline.c:172 src/command.c:161 +#: src/cmdline.c:142 src/cmdline.c:161 src/cmdline.c:173 src/command.c:161 #: src/set.q:415 src/set.q:417 src/set.q:956 #, c-format msgid "%s is not yet implemented." msgstr "" -#: src/cmdline.c:186 -msgid "" -"\n" -"Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.\n" -"This is free software; see the source for copying conditions. There is NO\n" -"WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -"\n" -"Written by Ben Pfaff ." -msgstr "" - -#: src/cmdline.c:248 +#: src/cmdline.c:243 #, c-format msgid "" "PSPP, a program for statistical analysis of sample data.\n" @@ -343,7 +332,7 @@ msgid "" "\n" msgstr "" -#: src/cmdline.c:286 +#: src/cmdline.c:281 #, c-format msgid "" "\n" @@ -403,7 +392,7 @@ msgid "" "to the command prompt. Use EXIT if you really want to quit." msgstr "" -#: src/command.c:626 src/command.c:757 +#: src/command.c:626 src/command.c:757 src/permissions.c:101 msgid "This command not allowed when the SAFER option is set." msgstr "" @@ -957,7 +946,7 @@ msgstr "" msgid "Only USE ALL is currently implemented." msgstr "" -#: src/descript.c:99 src/examine.q:1422 src/frequencies.q:112 src/oneway.q:396 +#: src/descript.c:99 src/examine.q:1418 src/frequencies.q:112 src/oneway.q:396 #: src/t-test.q:690 src/t-test.q:713 src/t-test.q:836 src/t-test.q:1173 msgid "Mean" msgstr "" @@ -970,11 +959,11 @@ msgstr "" msgid "Std Dev" msgstr "" -#: src/descript.c:102 src/examine.q:1500 src/frequencies.q:117 +#: src/descript.c:102 src/examine.q:1496 src/frequencies.q:117 msgid "Variance" msgstr "" -#: src/descript.c:103 src/examine.q:1607 src/frequencies.q:118 +#: src/descript.c:103 src/examine.q:1603 src/frequencies.q:118 msgid "Kurtosis" msgstr "" @@ -982,7 +971,7 @@ msgstr "" msgid "S E Kurt" msgstr "" -#: src/descript.c:105 src/examine.q:1587 src/frequencies.q:120 +#: src/descript.c:105 src/examine.q:1583 src/frequencies.q:120 msgid "Skewness" msgstr "" @@ -990,16 +979,16 @@ msgstr "" msgid "S E Skew" msgstr "" -#: src/descript.c:107 src/examine.q:1548 src/frequencies.q:122 +#: src/descript.c:107 src/examine.q:1544 src/frequencies.q:122 msgid "Range" msgstr "" -#: src/descript.c:108 src/examine.q:1525 src/frequencies.q:123 +#: src/descript.c:108 src/examine.q:1521 src/frequencies.q:123 #: src/oneway.q:408 msgid "Minimum" msgstr "" -#: src/descript.c:109 src/examine.q:1536 src/frequencies.q:124 +#: src/descript.c:109 src/examine.q:1532 src/frequencies.q:124 #: src/oneway.q:409 msgid "Maximum" msgstr "" @@ -1832,7 +1821,7 @@ msgstr "" msgid "Opening `%s': %s." msgstr "" -#: src/getline.c:335 src/html.c:331 src/postscript.c:1463 +#: src/getline.c:335 src/html.c:348 src/postscript.c:1463 #, c-format msgid "Reading `%s': %s." msgstr "" @@ -1990,51 +1979,51 @@ msgstr "" msgid "hash table:" msgstr "" -#: src/html.c:66 +#: src/html.c:67 #, c-format msgid "HTML driver initializing as `%s'..." msgstr "" -#: src/html.c:154 +#: src/html.c:171 #, c-format msgid "Unknown configuration parameter `%s' for HTML device driver." msgstr "" -#: src/html.c:237 +#: src/html.c:254 msgid "" "Cannot find HTML prologue. The use of `-vv' on the command line is " "suggested as a debugging aid." msgstr "" -#: src/html.c:242 +#: src/html.c:259 #, c-format msgid "%s: %s: Opening HTML prologue..." msgstr "" -#: src/html.c:269 src/html.c:280 src/postscript.c:1355 src/postscript.c:1366 +#: src/html.c:286 src/html.c:297 src/postscript.c:1355 src/postscript.c:1366 msgid "nobody" msgstr "" -#: src/html.c:276 src/html.c:281 src/postscript.c:1362 src/postscript.c:1367 +#: src/html.c:293 src/html.c:298 src/postscript.c:1362 src/postscript.c:1367 msgid "nowhere" msgstr "" -#: src/html.c:340 +#: src/html.c:357 #, c-format msgid "%s: HTML prologue read successfully." msgstr "" -#: src/html.c:344 +#: src/html.c:361 #, c-format msgid "%s: Error reading HTML prologue." msgstr "" -#: src/html.c:372 +#: src/html.c:389 #, c-format msgid "HTML output driver: %s: %s" msgstr "" -#: src/html.c:403 src/list.q:252 +#: src/html.c:420 src/list.q:252 #, c-format msgid "Cannot open first page on HTML device %s." msgstr "" @@ -2190,33 +2179,33 @@ msgstr "" msgid "%s without %s." msgstr "" -#: src/main.c:77 +#: src/main.c:86 msgid "Error initializing output drivers." msgstr "" -#: src/main.c:147 +#: src/main.c:156 msgid "This command not executed." msgstr "" -#: src/main.c:151 +#: src/main.c:160 msgid "" "Skipping the rest of this command. Part of this command may have been " "executed." msgstr "" -#: src/main.c:156 +#: src/main.c:165 msgid "" "Skipping the rest of this command. This command was fully executed up to " "this point." msgstr "" -#: src/main.c:161 +#: src/main.c:170 msgid "" "Trailing garbage was encountered following this command. The command was " "fully executed to this point." msgstr "" -#: src/main.c:178 +#: src/main.c:187 msgid "The rest of this command has been discarded." msgstr "" @@ -2440,6 +2429,16 @@ msgstr "" msgid "String expected." msgstr "" +#: src/mkfile.c:52 +#, c-format +msgid "%s: Creating temporary file: %s." +msgstr "" + +#: src/mkfile.c:94 +#, c-format +msgid "%s: Creating file: %s." +msgstr "" + #: src/modify-vars.c:89 msgid "" "MODIFY VARS may not be used after TEMPORARY. Temporary transformations will " @@ -2726,17 +2725,17 @@ msgstr "" msgid "Empirical with averaging" msgstr "" -#: src/permissions.c:75 +#: src/permissions.c:76 #, c-format msgid "Expecting %s or %s." msgstr "" -#: src/permissions.c:101 +#: src/permissions.c:109 #, c-format msgid "Cannot stat %s: %s" msgstr "" -#: src/permissions.c:114 +#: src/permissions.c:122 #, c-format msgid "Cannot change mode of %s: %s" msgstr "" @@ -2919,11 +2918,11 @@ msgstr "" msgid "%s: Writing portable file: %s." msgstr "" -#: src/plot-hist.c:115 +#: src/plot-hist.c:118 msgid "HISTOGRAM" msgstr "" -#: src/plot-hist.c:117 src/frequencies.q:1139 +#: src/plot-hist.c:120 src/frequencies.q:1139 msgid "Frequency" msgstr "" @@ -3723,7 +3722,7 @@ msgstr "" #: src/sysfile-info.c:531 src/vfm.c:875 src/crosstabs.q:1099 #: src/crosstabs.q:1126 src/crosstabs.q:1146 src/crosstabs.q:1168 -#: src/examine.q:1086 src/frequencies.q:1138 src/frequencies.q:1259 +#: src/examine.q:1082 src/frequencies.q:1138 src/frequencies.q:1259 msgid "Value" msgstr "" @@ -3944,32 +3943,32 @@ msgstr "" msgid "Summary." msgstr "" -#: src/crosstabs.q:802 src/examine.q:871 +#: src/crosstabs.q:802 src/examine.q:867 msgid "Cases" msgstr "" -#: src/crosstabs.q:803 src/examine.q:805 src/frequencies.q:1136 +#: src/crosstabs.q:803 src/examine.q:801 src/frequencies.q:1136 #: src/frequencies.q:1509 msgid "Valid" msgstr "" -#: src/crosstabs.q:804 src/examine.q:806 src/frequencies.q:1204 +#: src/crosstabs.q:804 src/examine.q:802 src/frequencies.q:1204 #: src/frequencies.q:1510 msgid "Missing" msgstr "" #: src/crosstabs.q:805 src/crosstabs.q:1008 src/crosstabs.q:1722 -#: src/examine.q:807 src/frequencies.q:1213 src/oneway.q:307 src/oneway.q:476 +#: src/examine.q:803 src/frequencies.q:1213 src/oneway.q:307 src/oneway.q:476 msgid "Total" msgstr "" -#: src/crosstabs.q:815 src/examine.q:883 src/frequencies.q:1508 +#: src/crosstabs.q:815 src/examine.q:879 src/frequencies.q:1508 #: src/oneway.q:395 src/t-test.q:689 src/t-test.q:712 src/t-test.q:837 #: src/t-test.q:1372 msgid "N" msgstr "" -#: src/crosstabs.q:816 src/examine.q:886 src/frequencies.q:1140 +#: src/crosstabs.q:816 src/examine.q:882 src/frequencies.q:1140 #: src/frequencies.q:1141 src/frequencies.q:1142 msgid "Percent" msgstr "" @@ -4007,7 +4006,7 @@ msgid "adj. resid." msgstr "" #: src/crosstabs.q:1098 src/crosstabs.q:1125 src/crosstabs.q:1145 -#: src/crosstabs.q:1166 src/examine.q:1317 +#: src/crosstabs.q:1166 src/examine.q:1313 msgid "Statistic" msgstr "" @@ -4190,105 +4189,105 @@ msgstr "" msgid "%s Dependent" msgstr "" -#: src/examine.q:450 src/examine.q:462 +#: src/examine.q:446 src/examine.q:458 #, c-format msgid "%s and %s are mutually exclusive" msgstr "" -#: src/examine.q:865 +#: src/examine.q:861 msgid "Case Processing Summary" msgstr "" -#: src/examine.q:1071 +#: src/examine.q:1067 msgid "Extreme Values" msgstr "" -#: src/examine.q:1087 +#: src/examine.q:1083 msgid "Case Number" msgstr "" -#: src/examine.q:1172 +#: src/examine.q:1168 msgid "Highest" msgstr "" -#: src/examine.q:1177 +#: src/examine.q:1173 msgid "Lowest" msgstr "" -#: src/examine.q:1318 src/oneway.q:398 src/oneway.q:695 +#: src/examine.q:1314 src/oneway.q:398 src/oneway.q:695 msgid "Std. Error" msgstr "" -#: src/examine.q:1320 src/oneway.q:412 +#: src/examine.q:1316 src/oneway.q:412 msgid "Descriptives" msgstr "" -#: src/examine.q:1440 src/oneway.q:403 +#: src/examine.q:1436 src/oneway.q:403 #, c-format msgid "%g%% Confidence Interval for Mean" msgstr "" -#: src/examine.q:1446 src/oneway.q:405 +#: src/examine.q:1442 src/oneway.q:405 msgid "Lower Bound" msgstr "" -#: src/examine.q:1457 src/oneway.q:406 +#: src/examine.q:1453 src/oneway.q:406 msgid "Upper Bound" msgstr "" -#: src/examine.q:1469 +#: src/examine.q:1465 msgid "5% Trimmed Mean" msgstr "" -#: src/examine.q:1480 src/frequencies.q:114 +#: src/examine.q:1476 src/frequencies.q:114 msgid "Median" msgstr "" -#: src/examine.q:1512 src/oneway.q:397 src/t-test.q:691 src/t-test.q:714 +#: src/examine.q:1508 src/oneway.q:397 src/t-test.q:691 src/t-test.q:714 #: src/t-test.q:838 src/t-test.q:1174 msgid "Std. Deviation" msgstr "" -#: src/examine.q:1560 +#: src/examine.q:1556 msgid "Interquartile Range" msgstr "" -#: src/examine.q:1716 +#: src/examine.q:1711 #, c-format msgid "Boxplot of %s vs. %s" msgstr "" -#: src/examine.q:1741 +#: src/examine.q:1736 msgid "Boxplot" msgstr "" -#: src/examine.q:1780 +#: src/examine.q:1778 #, c-format msgid "Normal Q-Q Plot of %s" msgstr "" -#: src/examine.q:1781 src/examine.q:1787 +#: src/examine.q:1779 src/examine.q:1785 msgid "Observed Value" msgstr "" -#: src/examine.q:1782 +#: src/examine.q:1780 msgid "Expected Normal" msgstr "" -#: src/examine.q:1785 +#: src/examine.q:1783 #, c-format msgid "Detrended Normal Q-Q Plot of %s" msgstr "" -#: src/examine.q:1788 +#: src/examine.q:1786 msgid "Dev from Normal" msgstr "" -#: src/examine.q:1909 src/examine.q:1931 src/frequencies.q:1520 +#: src/examine.q:1906 src/examine.q:1928 src/frequencies.q:1520 msgid "Percentiles" msgstr "" -#: src/examine.q:2056 +#: src/examine.q:2053 msgid "Tukey's Hinges" msgstr "" diff --git a/po/pspp.pot b/po/pspp.pot index 60f87f5c..376df5cc 100644 --- a/po/pspp.pot +++ b/po/pspp.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n" -"POT-Creation-Date: 2005-01-09 16:22+0800\n" +"POT-Creation-Date: 2005-01-14 11:58+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -118,17 +118,17 @@ msgid "" "by %d lines." msgstr "" -#: src/ascii.c:390 src/devind.c:167 src/html.c:102 src/postscript.c:458 +#: src/ascii.c:390 src/devind.c:167 src/html.c:103 src/postscript.c:458 #, c-format msgid "%s: Initialization complete." msgstr "" -#: src/ascii.c:402 src/devind.c:179 src/html.c:114 src/postscript.c:471 +#: src/ascii.c:402 src/devind.c:179 src/html.c:115 src/postscript.c:471 #, c-format msgid "%s: Beginning closing..." msgstr "" -#: src/ascii.c:424 src/devind.c:184 src/html.c:119 src/postscript.c:490 +#: src/ascii.c:424 src/devind.c:184 src/html.c:120 src/postscript.c:490 #, c-format msgid "%s: Finished closing." msgstr "" @@ -220,6 +220,10 @@ msgstr "" msgid "%s - Page %d" msgstr "" +#: src/ascii.c:1646 +msgid "Charts are unsupported with ascii drivers." +msgstr "" + #: src/autorecode.c:122 #, c-format msgid "Source variable count (%d) does not match target variable count (%d)." @@ -253,48 +257,33 @@ msgstr "" msgid "Error writing temporary file: %s." msgstr "" -#: src/casefile.c:363 -#, c-format -msgid "%s: Creating temporary file: %s." -msgstr "" - -#: src/casefile.c:507 +#: src/casefile.c:478 #, c-format msgid "%s: Opening temporary file: %s." msgstr "" -#: src/casefile.c:533 +#: src/casefile.c:504 #, c-format msgid "%s: Seeking temporary file: %s." msgstr "" -#: src/casefile.c:549 +#: src/casefile.c:520 #, c-format msgid "%s: Reading temporary file: %s." msgstr "" -#: src/casefile.c:552 +#: src/casefile.c:523 #, c-format msgid "%s: Temporary file ended unexpectedly." msgstr "" -#: src/cmdline.c:141 src/cmdline.c:160 src/cmdline.c:172 src/command.c:161 +#: src/cmdline.c:142 src/cmdline.c:161 src/cmdline.c:173 src/command.c:161 #: src/set.q:415 src/set.q:417 src/set.q:956 #, c-format msgid "%s is not yet implemented." msgstr "" -#: src/cmdline.c:186 -msgid "" -"\n" -"Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.\n" -"This is free software; see the source for copying conditions. There is NO\n" -"WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -"\n" -"Written by Ben Pfaff ." -msgstr "" - -#: src/cmdline.c:248 +#: src/cmdline.c:243 #, c-format msgid "" "PSPP, a program for statistical analysis of sample data.\n" @@ -344,7 +333,7 @@ msgid "" "\n" msgstr "" -#: src/cmdline.c:286 +#: src/cmdline.c:281 #, c-format msgid "" "\n" @@ -404,7 +393,7 @@ msgid "" "to the command prompt. Use EXIT if you really want to quit." msgstr "" -#: src/command.c:626 src/command.c:757 +#: src/command.c:626 src/command.c:757 src/permissions.c:101 msgid "This command not allowed when the SAFER option is set." msgstr "" @@ -958,7 +947,7 @@ msgstr "" msgid "Only USE ALL is currently implemented." msgstr "" -#: src/descript.c:99 src/examine.q:1422 src/frequencies.q:112 src/oneway.q:396 +#: src/descript.c:99 src/examine.q:1418 src/frequencies.q:112 src/oneway.q:396 #: src/t-test.q:690 src/t-test.q:713 src/t-test.q:836 src/t-test.q:1173 msgid "Mean" msgstr "" @@ -971,11 +960,11 @@ msgstr "" msgid "Std Dev" msgstr "" -#: src/descript.c:102 src/examine.q:1500 src/frequencies.q:117 +#: src/descript.c:102 src/examine.q:1496 src/frequencies.q:117 msgid "Variance" msgstr "" -#: src/descript.c:103 src/examine.q:1607 src/frequencies.q:118 +#: src/descript.c:103 src/examine.q:1603 src/frequencies.q:118 msgid "Kurtosis" msgstr "" @@ -983,7 +972,7 @@ msgstr "" msgid "S E Kurt" msgstr "" -#: src/descript.c:105 src/examine.q:1587 src/frequencies.q:120 +#: src/descript.c:105 src/examine.q:1583 src/frequencies.q:120 msgid "Skewness" msgstr "" @@ -991,16 +980,16 @@ msgstr "" msgid "S E Skew" msgstr "" -#: src/descript.c:107 src/examine.q:1548 src/frequencies.q:122 +#: src/descript.c:107 src/examine.q:1544 src/frequencies.q:122 msgid "Range" msgstr "" -#: src/descript.c:108 src/examine.q:1525 src/frequencies.q:123 +#: src/descript.c:108 src/examine.q:1521 src/frequencies.q:123 #: src/oneway.q:408 msgid "Minimum" msgstr "" -#: src/descript.c:109 src/examine.q:1536 src/frequencies.q:124 +#: src/descript.c:109 src/examine.q:1532 src/frequencies.q:124 #: src/oneway.q:409 msgid "Maximum" msgstr "" @@ -1832,7 +1821,7 @@ msgstr "" msgid "Opening `%s': %s." msgstr "" -#: src/getline.c:335 src/html.c:331 src/postscript.c:1463 +#: src/getline.c:335 src/html.c:348 src/postscript.c:1463 #, c-format msgid "Reading `%s': %s." msgstr "" @@ -1990,51 +1979,51 @@ msgstr "" msgid "hash table:" msgstr "" -#: src/html.c:66 +#: src/html.c:67 #, c-format msgid "HTML driver initializing as `%s'..." msgstr "" -#: src/html.c:154 +#: src/html.c:171 #, c-format msgid "Unknown configuration parameter `%s' for HTML device driver." msgstr "" -#: src/html.c:237 +#: src/html.c:254 msgid "" "Cannot find HTML prologue. The use of `-vv' on the command line is " "suggested as a debugging aid." msgstr "" -#: src/html.c:242 +#: src/html.c:259 #, c-format msgid "%s: %s: Opening HTML prologue..." msgstr "" -#: src/html.c:269 src/html.c:280 src/postscript.c:1355 src/postscript.c:1366 +#: src/html.c:286 src/html.c:297 src/postscript.c:1355 src/postscript.c:1366 msgid "nobody" msgstr "" -#: src/html.c:276 src/html.c:281 src/postscript.c:1362 src/postscript.c:1367 +#: src/html.c:293 src/html.c:298 src/postscript.c:1362 src/postscript.c:1367 msgid "nowhere" msgstr "" -#: src/html.c:340 +#: src/html.c:357 #, c-format msgid "%s: HTML prologue read successfully." msgstr "" -#: src/html.c:344 +#: src/html.c:361 #, c-format msgid "%s: Error reading HTML prologue." msgstr "" -#: src/html.c:372 +#: src/html.c:389 #, c-format msgid "HTML output driver: %s: %s" msgstr "" -#: src/html.c:403 src/list.q:252 +#: src/html.c:420 src/list.q:252 #, c-format msgid "Cannot open first page on HTML device %s." msgstr "" @@ -2190,33 +2179,33 @@ msgstr "" msgid "%s without %s." msgstr "" -#: src/main.c:77 +#: src/main.c:86 msgid "Error initializing output drivers." msgstr "" -#: src/main.c:147 +#: src/main.c:156 msgid "This command not executed." msgstr "" -#: src/main.c:151 +#: src/main.c:160 msgid "" "Skipping the rest of this command. Part of this command may have been " "executed." msgstr "" -#: src/main.c:156 +#: src/main.c:165 msgid "" "Skipping the rest of this command. This command was fully executed up to " "this point." msgstr "" -#: src/main.c:161 +#: src/main.c:170 msgid "" "Trailing garbage was encountered following this command. The command was " "fully executed to this point." msgstr "" -#: src/main.c:178 +#: src/main.c:187 msgid "The rest of this command has been discarded." msgstr "" @@ -2440,6 +2429,16 @@ msgstr "" msgid "String expected." msgstr "" +#: src/mkfile.c:52 +#, c-format +msgid "%s: Creating temporary file: %s." +msgstr "" + +#: src/mkfile.c:94 +#, c-format +msgid "%s: Creating file: %s." +msgstr "" + #: src/modify-vars.c:89 msgid "" "MODIFY VARS may not be used after TEMPORARY. Temporary transformations will " @@ -2726,17 +2725,17 @@ msgstr "" msgid "Empirical with averaging" msgstr "" -#: src/permissions.c:75 +#: src/permissions.c:76 #, c-format msgid "Expecting %s or %s." msgstr "" -#: src/permissions.c:101 +#: src/permissions.c:109 #, c-format msgid "Cannot stat %s: %s" msgstr "" -#: src/permissions.c:114 +#: src/permissions.c:122 #, c-format msgid "Cannot change mode of %s: %s" msgstr "" @@ -2919,11 +2918,11 @@ msgstr "" msgid "%s: Writing portable file: %s." msgstr "" -#: src/plot-hist.c:115 +#: src/plot-hist.c:118 msgid "HISTOGRAM" msgstr "" -#: src/plot-hist.c:117 src/frequencies.q:1139 +#: src/plot-hist.c:120 src/frequencies.q:1139 msgid "Frequency" msgstr "" @@ -3723,7 +3722,7 @@ msgstr "" #: src/sysfile-info.c:531 src/vfm.c:875 src/crosstabs.q:1099 #: src/crosstabs.q:1126 src/crosstabs.q:1146 src/crosstabs.q:1168 -#: src/examine.q:1086 src/frequencies.q:1138 src/frequencies.q:1259 +#: src/examine.q:1082 src/frequencies.q:1138 src/frequencies.q:1259 msgid "Value" msgstr "" @@ -3944,32 +3943,32 @@ msgstr "" msgid "Summary." msgstr "" -#: src/crosstabs.q:802 src/examine.q:871 +#: src/crosstabs.q:802 src/examine.q:867 msgid "Cases" msgstr "" -#: src/crosstabs.q:803 src/examine.q:805 src/frequencies.q:1136 +#: src/crosstabs.q:803 src/examine.q:801 src/frequencies.q:1136 #: src/frequencies.q:1509 msgid "Valid" msgstr "" -#: src/crosstabs.q:804 src/examine.q:806 src/frequencies.q:1204 +#: src/crosstabs.q:804 src/examine.q:802 src/frequencies.q:1204 #: src/frequencies.q:1510 msgid "Missing" msgstr "" #: src/crosstabs.q:805 src/crosstabs.q:1008 src/crosstabs.q:1722 -#: src/examine.q:807 src/frequencies.q:1213 src/oneway.q:307 src/oneway.q:476 +#: src/examine.q:803 src/frequencies.q:1213 src/oneway.q:307 src/oneway.q:476 msgid "Total" msgstr "" -#: src/crosstabs.q:815 src/examine.q:883 src/frequencies.q:1508 +#: src/crosstabs.q:815 src/examine.q:879 src/frequencies.q:1508 #: src/oneway.q:395 src/t-test.q:689 src/t-test.q:712 src/t-test.q:837 #: src/t-test.q:1372 msgid "N" msgstr "" -#: src/crosstabs.q:816 src/examine.q:886 src/frequencies.q:1140 +#: src/crosstabs.q:816 src/examine.q:882 src/frequencies.q:1140 #: src/frequencies.q:1141 src/frequencies.q:1142 msgid "Percent" msgstr "" @@ -4007,7 +4006,7 @@ msgid "adj. resid." msgstr "" #: src/crosstabs.q:1098 src/crosstabs.q:1125 src/crosstabs.q:1145 -#: src/crosstabs.q:1166 src/examine.q:1317 +#: src/crosstabs.q:1166 src/examine.q:1313 msgid "Statistic" msgstr "" @@ -4190,105 +4189,105 @@ msgstr "" msgid "%s Dependent" msgstr "" -#: src/examine.q:450 src/examine.q:462 +#: src/examine.q:446 src/examine.q:458 #, c-format msgid "%s and %s are mutually exclusive" msgstr "" -#: src/examine.q:865 +#: src/examine.q:861 msgid "Case Processing Summary" msgstr "" -#: src/examine.q:1071 +#: src/examine.q:1067 msgid "Extreme Values" msgstr "" -#: src/examine.q:1087 +#: src/examine.q:1083 msgid "Case Number" msgstr "" -#: src/examine.q:1172 +#: src/examine.q:1168 msgid "Highest" msgstr "" -#: src/examine.q:1177 +#: src/examine.q:1173 msgid "Lowest" msgstr "" -#: src/examine.q:1318 src/oneway.q:398 src/oneway.q:695 +#: src/examine.q:1314 src/oneway.q:398 src/oneway.q:695 msgid "Std. Error" msgstr "" -#: src/examine.q:1320 src/oneway.q:412 +#: src/examine.q:1316 src/oneway.q:412 msgid "Descriptives" msgstr "" -#: src/examine.q:1440 src/oneway.q:403 +#: src/examine.q:1436 src/oneway.q:403 #, c-format msgid "%g%% Confidence Interval for Mean" msgstr "" -#: src/examine.q:1446 src/oneway.q:405 +#: src/examine.q:1442 src/oneway.q:405 msgid "Lower Bound" msgstr "" -#: src/examine.q:1457 src/oneway.q:406 +#: src/examine.q:1453 src/oneway.q:406 msgid "Upper Bound" msgstr "" -#: src/examine.q:1469 +#: src/examine.q:1465 msgid "5% Trimmed Mean" msgstr "" -#: src/examine.q:1480 src/frequencies.q:114 +#: src/examine.q:1476 src/frequencies.q:114 msgid "Median" msgstr "" -#: src/examine.q:1512 src/oneway.q:397 src/t-test.q:691 src/t-test.q:714 +#: src/examine.q:1508 src/oneway.q:397 src/t-test.q:691 src/t-test.q:714 #: src/t-test.q:838 src/t-test.q:1174 msgid "Std. Deviation" msgstr "" -#: src/examine.q:1560 +#: src/examine.q:1556 msgid "Interquartile Range" msgstr "" -#: src/examine.q:1716 +#: src/examine.q:1711 #, c-format msgid "Boxplot of %s vs. %s" msgstr "" -#: src/examine.q:1741 +#: src/examine.q:1736 msgid "Boxplot" msgstr "" -#: src/examine.q:1780 +#: src/examine.q:1778 #, c-format msgid "Normal Q-Q Plot of %s" msgstr "" -#: src/examine.q:1781 src/examine.q:1787 +#: src/examine.q:1779 src/examine.q:1785 msgid "Observed Value" msgstr "" -#: src/examine.q:1782 +#: src/examine.q:1780 msgid "Expected Normal" msgstr "" -#: src/examine.q:1785 +#: src/examine.q:1783 #, c-format msgid "Detrended Normal Q-Q Plot of %s" msgstr "" -#: src/examine.q:1788 +#: src/examine.q:1786 msgid "Dev from Normal" msgstr "" -#: src/examine.q:1909 src/examine.q:1931 src/frequencies.q:1520 +#: src/examine.q:1906 src/examine.q:1928 src/frequencies.q:1520 msgid "Percentiles" msgstr "" -#: src/examine.q:2056 +#: src/examine.q:2053 msgid "Tukey's Hinges" msgstr "" diff --git a/src/ChangeLog b/src/ChangeLog index 80654946..b4e9b12c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,23 @@ +Mon Jan 10 14:43:45 WST 2005 John Darrington + + * ascii.c cartesian.c casefile.c chart.h devind.c + examine.q frequencies.q + html.c output.h piechart.c plot-chart.c plot-hist.c + + Integrated the chart rendering into the output stream + (currently only works for html). + + Removed gratuitous use of ifndef NO_CHARTS, and replaced with + dummy-chart.c for compiling without charts. + + * mkfile.[ch] Created. + + * som.[ch] tab.[ch]: Changed name of som_table to som_entity + Added type element so we can tell if it's a chart or a table. + + * chart.h examine.q piechart.c plot-chart.c plot-hist.c: changed the + API of charts to be more like that of tables. + Thu Jan 13 21:00:02 WST 2005 John Darrington * casefile.c main.c: Moved the SIGINT handler from casefile.c to @@ -5,7 +25,8 @@ Thu Jan 13 21:00:02 WST 2005 John Darrington Mon Jan 10 14:43:45 WST 2005 John Darrington - * casefile.c: Added a signal handler to delete temp files on SIGINT and SIGQUIT + * casefile.c: Added a signal handler to delete temp files on + SIGINT and SIGQUIT * permissions.c Inhibited the PERMISSIONS command when SAFER is on. diff --git a/src/Makefile.am b/src/Makefile.am index 354c3203..01d651d4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -55,6 +55,8 @@ chart_sources = barchart.c \ plot-chart.c \ plot-hist.c \ piechart.c +else +chart_sources = dummy-chart.c endif pspp_SOURCES = $(q_sources_c) $(chart_sources) \ @@ -82,9 +84,8 @@ pfm-write.c pfm-write.h \ pool.c pool.h postscript.c print.c recode.c \ rename-vars.c repeat.c repeat.h sample.c sel-if.c settings.h \ sfm-read.c sfm-read.h sfm-write.c sfm-write.h sfmP.h som.c som.h \ -sort.c sort.h \ -split-file.c str.c str.h subclist.c subclist.h \ -sysfile-info.c tab.c tab.h temporary.c stat.h \ +sort.c sort.h split-file.c str.c str.h subclist.c subclist.h \ +sysfile-info.c tab.c tab.h temporary.c stat.h mkfile.c mkfile.h \ title.c val.h val-labs.c value-labels.c value-labels.h \ var-labs.c var.h vars-atr.c vars-prs.c vector.c version.c version.h \ vfm.c vfm.h vfmP.h weight.c @@ -92,7 +93,6 @@ vfm.c vfm.h vfmP.h weight.c pspp_LDADD = ../lib/julcal/libjulcal.a \ ../lib/misc/libmisc.a \ - -lplot \ @LIBINTL@ version.c: diff --git a/src/ascii.c b/src/ascii.c index 4a30663f..48358d93 100644 --- a/src/ascii.c +++ b/src/ascii.c @@ -1631,6 +1631,28 @@ ascii_close_page (struct outp_driver *this) return 1; } + + +void ascii_chart_initialise(struct outp_class *c UNUSED, + struct chart *ch UNUSED); + +void ascii_chart_finalise(struct outp_class *c UNUSED, + struct chart *ch UNUSED); + + +void +ascii_chart_initialise(struct outp_class *c UNUSED, struct chart *ch ) +{ + msg(MW, _("Charts are unsupported with ascii drivers.")); + ch->lp = 0; +} + +void +ascii_chart_finalise(struct outp_class *c UNUSED, struct chart *ch UNUSED) +{ + +} + struct outp_class ascii_class = { "ascii", @@ -1669,4 +1691,7 @@ struct outp_class ascii_class = ascii_text_get_size, ascii_text_metrics, ascii_text_draw, + + ascii_chart_initialise, + ascii_chart_finalise }; diff --git a/src/cartesian.c b/src/cartesian.c index cac18400..22201e4e 100644 --- a/src/cartesian.c +++ b/src/cartesian.c @@ -53,6 +53,8 @@ write_legend(struct chart *chart, const char *heading, int n); void chart_write_xlabel(struct chart *ch, const char *label) { + if ( ! ch ) + return ; pl_savestate_r(ch->lp); @@ -69,6 +71,9 @@ chart_write_xlabel(struct chart *ch, const char *label) void chart_write_ylabel(struct chart *ch, const char *label) { + if ( ! ch ) + return ; + pl_savestate_r(ch->lp); pl_move_r(ch->lp, ch->data_bottom, ch->ordinate_right); @@ -86,6 +91,10 @@ write_legend(struct chart *chart, const char *heading, { int ds; + if ( ! chart ) + return ; + + pl_savestate_r(chart->lp); pl_filltype_r(chart->lp,1); @@ -124,13 +133,18 @@ write_legend(struct chart *chart, const char *heading, void chart_datum(struct chart *ch, int dataset UNUSED, double x, double y) { + + if ( ! ch ) + return ; + + + const double x_pos = (x - ch->x_min) * ch->abscissa_scale + ch->data_left ; const double y_pos = (y - ch->y_min) * ch->ordinate_scale + ch->data_bottom ; - pl_savestate_r(ch->lp); pl_fmarker_r(ch->lp, x_pos, y_pos, 6, 15); @@ -151,6 +165,10 @@ chart_line(struct chart *ch, double slope, double intercept, double x1, y1; double x2, y2 ; + if ( ! ch ) + return ; + + if ( lim_dim == CHART_DIM_Y ) { x1 = ( limit1 - intercept ) / slope ; diff --git a/src/casefile.c b/src/casefile.c index 5ad606a3..fdf033cb 100644 --- a/src/casefile.c +++ b/src/casefile.c @@ -339,35 +339,6 @@ flush_buffer (struct casefile *cf) } } -/* Creates a temporary file and stores its name in *FILENAME and - a file descriptor for it in *FD. Returns success. Caller is - responsible for freeing *FILENAME. */ -static int -make_temp_file (int *fd, char **filename) -{ - const char *parent_dir; - - assert (filename != NULL); - assert (fd != NULL); - - if (getenv ("TMPDIR") != NULL) - parent_dir = getenv ("TMPDIR"); - else - parent_dir = P_tmpdir; - - *filename = xmalloc (strlen (parent_dir) + 32); - sprintf (*filename, "%s%cpsppXXXXXX", parent_dir, DIR_SEPARATOR); - *fd = mkstemp (*filename); - if (*fd < 0) - { - msg (FE, _("%s: Creating temporary file: %s."), - *filename, strerror (errno)); - free (*filename); - *filename = NULL; - return 0; - } - return 1; -} /* If CF is currently stored in memory, writes it to disk. Readers, if any, retain their current positions. */ diff --git a/src/chart.h b/src/chart.h index 8d1a9146..6915358d 100644 --- a/src/chart.h +++ b/src/chart.h @@ -40,7 +40,10 @@ struct chart { #ifndef NO_CHARTS plPlotter *lp ; plPlotterParams *pl_params; +#else + void *lp; #endif + char *filename; /* The geometry of the chart See diagram at the foot of this file. @@ -77,10 +80,8 @@ struct chart { }; -int chart_initialise(struct chart *ch); - -void chart_finalise(struct chart *ch); - +struct chart * chart_create(void); +void chart_submit(struct chart *ch); double chart_rounded_tick(double tick); diff --git a/src/devind.c b/src/devind.c index ad0cbeae..96e3934b 100644 --- a/src/devind.c +++ b/src/devind.c @@ -260,7 +260,7 @@ devind_close_page (struct outp_driver *this) static void output_tab_table (struct outp_driver *, struct tab_table *); static void -devind_submit (struct outp_driver *this, struct som_table *s) +devind_submit (struct outp_driver *this, struct som_entity *s) { extern struct som_table_class tab_table_class; struct devind_driver_ext *x = this->ext; @@ -272,10 +272,10 @@ devind_submit (struct outp_driver *this, struct som_table *s) return; } - if (s->class == &tab_table_class) + assert (s->class == &tab_table_class); + + if ( s->type == SOM_TABLE ) output_tab_table (this, s->ext); - else - assert (0); } /* Write string S of length LEN to file F, escaping characters as @@ -474,4 +474,7 @@ struct outp_class devind_class = NULL, NULL, NULL, + + NULL, + NULL, }; diff --git a/src/dummy-chart.c b/src/dummy-chart.c new file mode 100644 index 00000000..9ed1c9ae --- /dev/null +++ b/src/dummy-chart.c @@ -0,0 +1,113 @@ +/* PSPP - computes sample statistics. + Copyright (C) 2005 Free Software Foundation, Inc. + Written by John Darrington + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + + +/* Stubs for plotting routines. + This module is linked only when charts are not supported */ + +#include "config.h" +#include "chart.h" + + +#ifndef NO_CHARTS +#error This file should be used only when compiling without charts. +#endif + +struct chart * +chart_create(void) +{ + return 0; +} + + +void +chart_write_title(struct chart *chart, const char *title, ...) +{ +} + + +void +chart_submit(struct chart *chart) +{ +} + + +void +chart_write_xscale(struct chart *ch, double min, double max, int ticks) +{ +} + + +void +chart_write_yscale(struct chart *ch, double smin, double smax, int ticks) +{ +} + + +void +chart_write_xlabel(struct chart *ch, const char *label) +{ +} + +void +chart_write_ylabel(struct chart *ch, const char *label) +{ +} + + +void +chart_line(struct chart *ch, double slope, double intercept, + double limit1, double limit2, enum CHART_DIM lim_dim) +{ +} + + +void +chart_datum(struct chart *ch, int dataset UNUSED, double x, double y) +{ +} + + +void +histogram_plot(const gsl_histogram *hist, + const char *factorname, + const struct normal_curve *norm, short show_normal) +{ +} + +void +boxplot_draw_yscale(struct chart *ch , double y_max, double y_min) +{ +} + +void +boxplot_draw_boxplot(struct chart *ch, + double box_centre, + double box_width, + struct metrics *m, + const char *name) +{ +} + + + +void +piechart_plot(const char *title, const struct slice *slices, int n_slices) +{ +} diff --git a/src/examine.q b/src/examine.q index 517b24f9..469b413c 100644 --- a/src/examine.q +++ b/src/examine.q @@ -264,7 +264,6 @@ output_examine(void) cmd.v_id); } -#ifndef NO_CHARTS if ( cmd.a_plot[XMN_PLT_HISTOGRAM] ) { for ( v = 0 ; v < n_dependent_vars; ++v ) @@ -280,7 +279,6 @@ output_examine(void) &normal, 0); } } -#endif } @@ -332,7 +330,6 @@ output_examine(void) if ( cmd.a_plot[XMN_PLT_NPPLOT] ) np_plot(&(*fs)->m[v], s); -#ifndef NO_CHARTS if ( cmd.a_plot[XMN_PLT_HISTOGRAM] ) { struct normal_curve normal; @@ -344,7 +341,6 @@ output_examine(void) histogram_plot((*fs)->m[v].histogram, s, &normal, 0); } -#endif } /* for ( fs .... */ @@ -1630,7 +1626,7 @@ box_plot_variables(const struct factor *fctr, struct variable **vars, int n_vars, const struct variable *id) { -#ifndef NO_CHARTS + int i; struct factor_statistics **fs ; @@ -1644,13 +1640,13 @@ box_plot_variables(const struct factor *fctr, { double y_min = DBL_MAX; double y_max = -DBL_MAX; - struct chart ch; + struct chart *ch; - chart_initialise(&ch); + ch = chart_create(); const char *s = factor_to_string(fctr, *fs, 0 ); - chart_write_title(&ch, s); + chart_write_title(ch, s); for ( i = 0 ; i < n_vars ; ++i ) { @@ -1658,18 +1654,18 @@ box_plot_variables(const struct factor *fctr, y_min = min(y_min, (*fs)->m[i].min); } - boxplot_draw_yscale(&ch, y_max, y_min); + boxplot_draw_yscale(ch, y_max, y_min); for ( i = 0 ; i < n_vars ; ++i ) { - const double box_width = (ch.data_right - ch.data_left) + const double box_width = (ch->data_right - ch->data_left) / (n_vars * 2.0 ) ; const double box_centre = ( i * 2 + 1) * box_width - + ch.data_left; + + ch->data_left; - boxplot_draw_boxplot(&ch, + boxplot_draw_boxplot(ch, box_centre, box_width, &(*fs)->m[i], var_to_string(vars[i])); @@ -1677,10 +1673,9 @@ box_plot_variables(const struct factor *fctr, } - chart_finalise(&ch); + chart_submit(ch); } -#endif } @@ -1694,17 +1689,17 @@ box_plot_group(const struct factor *fctr, int n_vars, const struct variable *id) { -#ifndef NO_CHARTS + int i; for ( i = 0 ; i < n_vars ; ++i ) { struct factor_statistics **fs ; - struct chart ch; + struct chart *ch; - chart_initialise(&ch); + ch = chart_create(); - boxplot_draw_yscale(&ch, totals[i].max, totals[i].min); + boxplot_draw_yscale(ch, totals[i].max, totals[i].min); if ( fctr ) { @@ -1713,7 +1708,7 @@ box_plot_group(const struct factor *fctr, for ( fs = fctr->fs ; *fs ; ++fs ) ++n_factors; - chart_write_title(&ch, _("Boxplot of %s vs. %s"), + chart_write_title(ch, _("Boxplot of %s vs. %s"), var_to_string(vars[i]), var_to_string(fctr->indep_var[0]) ); for ( fs = fctr->fs ; *fs ; ++fs ) @@ -1721,13 +1716,13 @@ box_plot_group(const struct factor *fctr, const char *s = factor_to_string_concise(fctr, *fs); - const double box_width = (ch.data_right - ch.data_left) + const double box_width = (ch->data_right - ch->data_left) / (n_factors * 2.0 ) ; const double box_centre = ( f++ * 2 + 1) * box_width - + ch.data_left; + + ch->data_left; - boxplot_draw_boxplot(&ch, + boxplot_draw_boxplot(ch, box_centre, box_width, &(*fs)->m[i], s); @@ -1735,21 +1730,20 @@ box_plot_group(const struct factor *fctr, } else { - const double box_width = (ch.data_right - ch.data_left) / 3.0; - const double box_centre = (ch.data_right + ch.data_left) / 2.0; + const double box_width = (ch->data_right - ch->data_left) / 3.0; + const double box_centre = (ch->data_right + ch->data_left) / 2.0; - chart_write_title(&ch, _("Boxplot")); + chart_write_title(ch, _("Boxplot")); - boxplot_draw_boxplot(&ch, + boxplot_draw_boxplot(ch, box_centre, box_width, &totals[i], var_to_string(vars[i]) ); } - chart_finalise(&ch); + chart_submit(ch); } -#endif } @@ -1758,15 +1752,14 @@ box_plot_group(const struct factor *fctr, void np_plot(const struct metrics *m, const char *factorname) { -#ifndef NO_CHARTS int i; double yfirst=0, ylast=0; /* Normal Plot */ - struct chart np_chart; + struct chart *np_chart; /* Detrended Normal Plot */ - struct chart dnp_chart; + struct chart *dnp_chart; /* The slope and intercept of the ideal normal probability line */ const double slope = 1.0 / m->stddev; @@ -1776,16 +1769,21 @@ np_plot(const struct metrics *m, const char *factorname) if ( m->n_data == 0 ) return ; - chart_initialise(&np_chart); - chart_write_title(&np_chart, _("Normal Q-Q Plot of %s"), factorname); - chart_write_xlabel(&np_chart, _("Observed Value")); - chart_write_ylabel(&np_chart, _("Expected Normal")); + np_chart = chart_create(); + dnp_chart = chart_create(); + + if ( !np_chart || ! dnp_chart ) + return ; + + chart_write_title(np_chart, _("Normal Q-Q Plot of %s"), factorname); + chart_write_xlabel(np_chart, _("Observed Value")); + chart_write_ylabel(np_chart, _("Expected Normal")); + - chart_initialise(&dnp_chart); - chart_write_title(&dnp_chart, _("Detrended Normal Q-Q Plot of %s"), + chart_write_title(dnp_chart, _("Detrended Normal Q-Q Plot of %s"), factorname); - chart_write_xlabel(&dnp_chart, _("Observed Value")); - chart_write_ylabel(&dnp_chart, _("Dev from Normal")); + chart_write_xlabel(dnp_chart, _("Observed Value")); + chart_write_ylabel(dnp_chart, _("Dev from Normal")); yfirst = gsl_cdf_ugaussian_Pinv (m->wvp[0]->rank / ( m->n + 1)); ylast = gsl_cdf_ugaussian_Pinv (m->wvp[m->n_data-1]->rank / ( m->n + 1)); @@ -1798,46 +1796,45 @@ np_plot(const struct metrics *m, const char *factorname) double x_upper = max(m->max, (ylast - intercept) / slope) ; double slack = (x_upper - x_lower) * 0.05 ; - chart_write_xscale(&np_chart, x_lower - slack, x_upper + slack, 5); + chart_write_xscale(np_chart, x_lower - slack, x_upper + slack, 5); - chart_write_xscale(&dnp_chart, m->min, m->max, 5); + chart_write_xscale(dnp_chart, m->min, m->max, 5); } - chart_write_yscale(&np_chart, yfirst, ylast, 5); + chart_write_yscale(np_chart, yfirst, ylast, 5); { - /* We have to cache the detrended data, beacause we need to - find its limits before we can plot it */ - double *d_data; - d_data = xmalloc (m->n_data * sizeof(double)); - double d_max = -DBL_MAX; - double d_min = DBL_MAX; - for ( i = 0 ; i < m->n_data; ++i ) - { - const double ns = gsl_cdf_ugaussian_Pinv (m->wvp[i]->rank / ( m->n + 1)); + /* We have to cache the detrended data, beacause we need to + find its limits before we can plot it */ + double *d_data; + d_data = xmalloc (m->n_data * sizeof(double)); + double d_max = -DBL_MAX; + double d_min = DBL_MAX; + for ( i = 0 ; i < m->n_data; ++i ) + { + const double ns = gsl_cdf_ugaussian_Pinv (m->wvp[i]->rank / ( m->n + 1)); - chart_datum(&np_chart, 0, m->wvp[i]->v.f, ns); + chart_datum(np_chart, 0, m->wvp[i]->v.f, ns); - d_data[i] = (m->wvp[i]->v.f - m->mean) / m->stddev - ns; + d_data[i] = (m->wvp[i]->v.f - m->mean) / m->stddev - ns; - if ( d_data[i] < d_min ) d_min = d_data[i]; - if ( d_data[i] > d_max ) d_max = d_data[i]; - } - chart_write_yscale(&dnp_chart, d_min, d_max, 5); + if ( d_data[i] < d_min ) d_min = d_data[i]; + if ( d_data[i] > d_max ) d_max = d_data[i]; + } + chart_write_yscale(dnp_chart, d_min, d_max, 5); - for ( i = 0 ; i < m->n_data; ++i ) - chart_datum(&dnp_chart, 0, m->wvp[i]->v.f, d_data[i]); + for ( i = 0 ; i < m->n_data; ++i ) + chart_datum(dnp_chart, 0, m->wvp[i]->v.f, d_data[i]); - free(d_data); + free(d_data); } - chart_line(&np_chart, slope, intercept, yfirst, ylast , CHART_DIM_Y); - chart_line(&dnp_chart, 0, 0, m->min, m->max , CHART_DIM_X); + chart_line(np_chart, slope, intercept, yfirst, ylast , CHART_DIM_Y); + chart_line(dnp_chart, 0, 0, m->min, m->max , CHART_DIM_X); - chart_finalise(&np_chart); - chart_finalise(&dnp_chart); -#endif + chart_submit(np_chart); + chart_submit(dnp_chart); } diff --git a/src/frequencies.q b/src/frequencies.q index b5da79bd..50b11f37 100644 --- a/src/frequencies.q +++ b/src/frequencies.q @@ -627,7 +627,7 @@ postcalc (void *aux UNUSED) dump_statistics (v, !dumped_freq_tab); -#ifndef NO_CHARTS + if ( chart == GFT_HIST) { double d[frq_n_stats]; @@ -653,7 +653,7 @@ postcalc (void *aux UNUSED) { do_piechart(v_variables[i], ft); } -#endif + cleanup_freq_tab (v); @@ -1614,7 +1614,7 @@ freq_tab_to_slice_array(const struct freq_tab *frq_tab, -#ifndef NO_CHARTS + static void do_piechart(const struct variable *var, const struct freq_tab *frq_tab) { @@ -1627,7 +1627,7 @@ do_piechart(const struct variable *var, const struct freq_tab *frq_tab) free(slices); } -#endif + /* Local Variables: diff --git a/src/html.c b/src/html.c index ea11459d..037905ea 100644 --- a/src/html.c +++ b/src/html.c @@ -40,6 +40,7 @@ #include "som.h" #include "tab.h" #include "version.h" +#include "mkfile.h" /* Prototypes. */ static int postopen (struct file_ext *); @@ -122,6 +123,22 @@ html_close_driver (struct outp_driver *this) return 1; } + +/* Link the image contained in FILENAME to the + HTML stream in file F. */ +static int +link_image (struct file_ext *f, char *filename) +{ + fprintf (f->file, + "", filename); + + if (ferror (f->file)) + return 0; + + return 1; +} + + /* Generic option types. */ enum { @@ -392,7 +409,7 @@ html_close_page (struct outp_driver *this) static void output_tab_table (struct outp_driver *, struct tab_table *); static void -html_submit (struct outp_driver *this, struct som_table *s) +html_submit (struct outp_driver *this, struct som_entity *s) { extern struct som_table_class tab_table_class; struct html_driver_ext *x = this->ext; @@ -404,10 +421,21 @@ html_submit (struct outp_driver *this, struct som_table *s) return; } - if (s->class == &tab_table_class) - output_tab_table (this, (struct tab_table *) s->ext); - else - assert (0); + assert ( s->class == &tab_table_class ) ; + + switch (s->type) + { + case SOM_TABLE: + output_tab_table ( this, (struct tab_table *) s->ext); + break; + case SOM_CHART: + link_image( &x->file, ((struct chart *)s->ext)->filename); + break; + default: + assert(0); + break; + } + } /* Write string S of length LEN to file F, escaping characters as @@ -554,6 +582,36 @@ output_tab_table (struct outp_driver *this, struct tab_table *t) fputs ("\n\n", x->file.file); } + +void html_initialise_chart(struct outp_class *c, struct chart *ch); +void html_finalise_chart(struct outp_class *c, struct chart *ch); + + +void +html_initialise_chart(struct outp_class *c UNUSED, struct chart *ch) +{ + + FILE *fp; + + make_unique_file_stream(&fp, &ch->filename); + +#ifdef NO_CHARTS + ch->lp = 0; +#else + ch->pl_params = pl_newplparams(); + ch->lp = pl_newpl_r ("png", 0, fp, stderr, ch->pl_params); +#endif + +} + +void +html_finalise_chart(struct outp_class *c UNUSED, struct chart *ch) +{ + free(ch->filename); +} + + + /* HTML driver class. */ struct outp_class html_class = { @@ -593,6 +651,10 @@ struct outp_class html_class = NULL, NULL, NULL, + + html_initialise_chart, + html_finalise_chart + }; #endif /* !NO_HTML */ diff --git a/src/mkfile.c b/src/mkfile.c new file mode 100644 index 00000000..19822f52 --- /dev/null +++ b/src/mkfile.c @@ -0,0 +1,105 @@ +/* PSPP - computes sample statistics. + Copyright (C) 2004 Free Software Foundation, Inc. + Written by Ben Pfaff . + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#include +#include +#include +#include +#include +#include + +#include "mkfile.h" +#include "error.h" +#include "alloc.h" + +/* Creates a temporary file and stores its name in *FILENAME and + a file descriptor for it in *FD. Returns success. Caller is + responsible for freeing *FILENAME. */ +int +make_temp_file (int *fd, char **filename) +{ + const char *parent_dir; + + assert (filename != NULL); + assert (fd != NULL); + + if (getenv ("TMPDIR") != NULL) + parent_dir = getenv ("TMPDIR"); + else + parent_dir = P_tmpdir; + + *filename = xmalloc (strlen (parent_dir) + 32); + sprintf (*filename, "%s%cpsppXXXXXX", parent_dir, DIR_SEPARATOR); + *fd = mkstemp (*filename); + if (*fd < 0) + { + msg (FE, _("%s: Creating temporary file: %s."), + *filename, strerror (errno)); + free (*filename); + *filename = NULL; + return 0; + } + return 1; +} + + +/* Creates a temporary file and stores its name in *FILENAME and + a file stream for it in *FP. Returns success. Caller is + responsible for freeing *FILENAME and for closing *FP */ +int +make_unique_file_stream (FILE **fp, char **filename) +{ + static int serial = 0; + const char *parent_dir; + + + /* FIXME: + Need to check for pre-existing file name. + Need also to pass in the directory instead of using /tmp + */ + + assert (filename != NULL); + assert (fp != NULL); + + if (getenv ("TMPDIR") != NULL) + parent_dir = getenv ("TMPDIR"); + else + parent_dir = P_tmpdir; + + *filename = xmalloc (strlen (parent_dir) + 32); + + + sprintf (*filename, "%s%cpspp%d.png", parent_dir, DIR_SEPARATOR, serial++); + + *fp = fopen(*filename, "w"); + + if (! *fp ) + { + msg (FE, _("%s: Creating file: %s."), *filename, strerror (errno)); + free (*filename); + *filename = NULL; + return 0; + } + + return 1; +} + + + + diff --git a/src/mkfile.h b/src/mkfile.h new file mode 100644 index 00000000..06fdf1c6 --- /dev/null +++ b/src/mkfile.h @@ -0,0 +1,35 @@ +/* PSPP - computes sample statistics. + Copyright (C) 2004 Free Software Foundation, Inc. + Written by Ben Pfaff . + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#ifndef MKFILE_H +#define MKFILE_H + + +/* Creates a temporary file and stores its name in *FILENAME and + a file descriptor for it in *FD. Returns success. Caller is + responsible for freeing *FILENAME. */ +int make_temp_file (int *fd, char **filename); + + +/* Creates a temporary file and stores its name in *FILENAME and + a file stream for it in *FP. Returns success. Caller is + responsible for freeing *FILENAME. */ +int make_unique_file_stream (FILE **fp, char **filename) ; + +#endif /* mkfile.h */ diff --git a/src/output.h b/src/output.h index 4b31f050..3309610d 100644 --- a/src/output.h +++ b/src/output.h @@ -21,6 +21,9 @@ #define output_h 1 #include "str.h" +#include "config.h" + +#include "chart.h" /* A rectangle. */ struct rect @@ -109,7 +112,7 @@ struct outp_text int w, l; /* Width, length. */ }; -struct som_table; +struct som_entity; struct outp_driver; /* Defines a class of output driver. */ @@ -135,8 +138,8 @@ struct outp_class int (*open_page) (struct outp_driver *); int (*close_page) (struct outp_driver *); - /* special != 0: Used to submit tables for output. */ - void (*submit) (struct outp_driver *, struct som_table *); + /* special != 0: Used to submit entities for output. */ + void (*submit) (struct outp_driver *, struct som_entity *); /* special != 0: Methods below need not be defined. */ @@ -166,6 +169,10 @@ struct outp_class int (*text_get_size) (struct outp_driver *, int *em_width); void (*text_metrics) (struct outp_driver *, struct outp_text *); void (*text_draw) (struct outp_driver *, struct outp_text *); + + void (*initialise_chart)(struct outp_class *, struct chart *); + void (*finialise_chart)(struct outp_class *, struct chart *); + }; /* Device types. */ diff --git a/src/piechart.c b/src/piechart.c index 35e5e0ba..d4cec929 100644 --- a/src/piechart.c +++ b/src/piechart.c @@ -47,8 +47,6 @@ draw_segment(struct chart *ch, -#ifndef NO_CHARTS - /* Draw a piechart */ void piechart_plot(const char *title, const struct slice *slices, int n_slices) @@ -56,26 +54,26 @@ piechart_plot(const char *title, const struct slice *slices, int n_slices) int i; double total_magnetude=0; - struct chart ch; + struct chart *ch; - chart_initialise(&ch); + ch = chart_create(); - const double left_label = ch.data_left + - (ch.data_right - ch.data_left)/10.0; + const double left_label = ch->data_left + + (ch->data_right - ch->data_left)/10.0; - const double right_label = ch.data_right - - (ch.data_right - ch.data_left)/10.0; + const double right_label = ch->data_right - + (ch->data_right - ch->data_left)/10.0; - const double centre_x = (ch.data_right + ch.data_left ) / 2.0 ; - const double centre_y = (ch.data_top + ch.data_bottom ) / 2.0 ; + const double centre_x = (ch->data_right + ch->data_left ) / 2.0 ; + const double centre_y = (ch->data_top + ch->data_bottom ) / 2.0 ; const double radius = min( - 5.0 / 12.0 * (ch.data_top - ch.data_bottom), - 1.0 / 4.0 * (ch.data_right - ch.data_left) + 5.0 / 12.0 * (ch->data_top - ch->data_bottom), + 1.0 / 4.0 * (ch->data_right - ch->data_left) ); - chart_write_title(&ch, title); + chart_write_title(ch, title); for (i = 0 ; i < n_slices ; ++i ) total_magnetude += slices[i].magnetude; @@ -94,7 +92,7 @@ piechart_plot(const char *title, const struct slice *slices, int n_slices) radius * cos(angle + segment_angle/2.0); /* Fill the segment */ - draw_segment(&ch, + draw_segment(ch, centre_x, centre_y, radius, angle, segment_angle, data_colour[i]); @@ -102,19 +100,19 @@ piechart_plot(const char *title, const struct slice *slices, int n_slices) /* Now add the labels */ if ( label_x < centre_x ) { - pl_line_r(ch.lp, label_x, label_y, + pl_line_r(ch->lp, label_x, label_y, left_label, label_y ); - pl_moverel_r(ch.lp,0,5); - pl_alabel_r(ch.lp,0,0,slices[i].label); + pl_moverel_r(ch->lp,0,5); + pl_alabel_r(ch->lp,0,0,slices[i].label); } else { - pl_line_r(ch.lp, + pl_line_r(ch->lp, label_x, label_y, right_label, label_y ); - pl_moverel_r(ch.lp,0,5); - pl_alabel_r(ch.lp,'r',0,slices[i].label); + pl_moverel_r(ch->lp,0,5); + pl_alabel_r(ch->lp,'r',0,slices[i].label); } angle += segment_angle; @@ -122,10 +120,10 @@ piechart_plot(const char *title, const struct slice *slices, int n_slices) } /* Draw an outline to the pie */ - pl_filltype_r(ch.lp,0); - pl_fcircle_r (ch.lp, centre_x, centre_y, radius); + pl_filltype_r(ch->lp,0); + pl_fcircle_r (ch->lp, centre_x, centre_y, radius); - chart_finalise(&ch); + chart_submit(ch); } static void @@ -211,12 +209,3 @@ draw_segment(struct chart *ch, pl_restorestate_r(ch->lp); } -#else - - -void -piechart_plot(const char *title, const struct slice *slices, int n_slices) -{ -} - -#endif diff --git a/src/plot-chart.c b/src/plot-chart.c index ddbb3608..795e3113 100644 --- a/src/plot-chart.c +++ b/src/plot-chart.c @@ -29,6 +29,9 @@ #include "chart.h" #include "str.h" +#include "alloc.h" +#include "som.h" +#include "output.h" const char *data_colour[] = { @@ -45,16 +48,27 @@ const char *data_colour[] = { -int -chart_initialise(struct chart *chart) +struct chart * +chart_create(void) { + struct chart *chart; - chart->pl_params = pl_newplparams(); + struct outp_driver *d; - chart->lp = pl_newpl_r ("X",0,stdout,stderr,chart->pl_params); + chart = xmalloc(sizeof(struct chart) ); + + for (d = outp_drivers (NULL); d; d = outp_drivers (d)) + { + assert(d->class->initialise_chart); + d->class->initialise_chart(d, chart); + break; /* KLUDGE!! */ + } + + if ( ! chart->lp ) + return 0; if (pl_openpl_r (chart->lp) < 0) /* open Plotter */ - return 1; + return 0; pl_fspace_r (chart->lp, 0.0, 0.0, 1000.0, 1000.0); /* set coordinate system */ pl_flinewidth_r (chart->lp, 0.25); /* set line thickness */ @@ -90,7 +104,7 @@ chart_initialise(struct chart *chart) chart->data_left, chart->data_bottom, chart->data_right, chart->data_top); - return 0; + return chart; } @@ -107,6 +121,8 @@ draw_tick(struct chart *chart, { const int tickSize = 10; + assert(chart); + pl_savestate_r(chart->lp); pl_move_r(chart->lp, chart->data_left, chart->data_bottom); @@ -150,6 +166,8 @@ chart_write_title(struct chart *chart, const char *title, ...) va_list ap; char buf[100]; + assert(chart); + pl_savestate_r(chart->lp); pl_ffontsize_r(chart->lp,chart->font_size * 1.5); pl_move_r(chart->lp,chart->data_left, chart->title_bottom); @@ -163,22 +181,33 @@ chart_write_title(struct chart *chart, const char *title, ...) } +extern struct som_table_class tab_table_class; void -chart_finalise(struct chart *chart) +chart_submit(struct chart *chart) { + struct som_entity s; + + assert(chart); + pl_restorestate_r(chart->lp); + s.class = &tab_table_class; + s.ext = chart; + s.type = SOM_CHART; + som_submit (&s); + if (pl_closepl_r (chart->lp) < 0) /* close Plotter */ { fprintf (stderr, "Couldn't close Plotter\n"); } - pl_deletepl_r(chart->lp); pl_deleteplparams(chart->pl_params); + free(chart); + } @@ -191,9 +220,13 @@ chart_write_xscale(struct chart *ch, double min, double max, int ticks) const double tick_interval = chart_rounded_tick( (max - min) / (double) ticks); + assert ( ch ); + + ch->x_max = ceil( max / tick_interval ) * tick_interval ; ch->x_min = floor ( min / tick_interval ) * tick_interval ; + ch->abscissa_scale = fabs(ch->data_right - ch->data_left) / fabs(ch->x_max - ch->x_min); @@ -215,6 +248,10 @@ chart_write_yscale(struct chart *ch, double smin, double smax, int ticks) const double tick_interval = chart_rounded_tick( (smax - smin) / (double) ticks); + + assert (ch) ; + + ch->y_max = ceil ( smax / tick_interval ) * tick_interval ; ch->y_min = floor ( smin / tick_interval ) * tick_interval ; diff --git a/src/plot-hist.c b/src/plot-hist.c index 7208d3fa..ebfcd3f1 100644 --- a/src/plot-hist.c +++ b/src/plot-hist.c @@ -17,6 +17,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* If you add/modify any public symbols in this file, don't forget to + change the stubs in dummy-chart.c */ + #include #include @@ -107,22 +110,22 @@ histogram_plot(const gsl_histogram *hist, int i; int bins; - struct chart ch; + struct chart *ch; bins = gsl_histogram_bins(hist); - chart_initialise(&ch); - chart_write_title(&ch, _("HISTOGRAM")); + ch = chart_create(); + chart_write_title(ch, _("HISTOGRAM")); - chart_write_ylabel(&ch, _("Frequency")); - chart_write_xlabel(&ch, factorname); + chart_write_ylabel(ch, _("Frequency")); + chart_write_xlabel(ch, factorname); - chart_write_yscale(&ch, 0, gsl_histogram_max_val(hist), 5); + chart_write_yscale(ch, 0, gsl_histogram_max_val(hist), 5); for ( i = 0 ; i < bins ; ++i ) - hist_draw_bar(&ch, hist, i); + hist_draw_bar(ch, hist, i); - histogram_write_legend(&ch, norm); + histogram_write_legend(ch, norm); if ( show_normal ) { @@ -139,25 +142,25 @@ histogram_plot(const gsl_histogram *hist, gsl_histogram_get_range(hist, bins - 1, ¬_used, &x_max); assert(range == x_max - not_used); - abscissa_scale = (ch.data_right - ch.data_left) / (x_max - x_min); - ordinate_scale = (ch.data_top - ch.data_bottom) / + abscissa_scale = (ch->data_right - ch->data_left) / (x_max - x_min); + ordinate_scale = (ch->data_top - ch->data_bottom) / gsl_histogram_max_val(hist) ; - pl_move_r(ch.lp, ch.data_left, ch.data_bottom); - for( d = ch.data_left; - d <= ch.data_right ; - d += (ch.data_right - ch.data_left) / 100.0) + pl_move_r(ch->lp, ch->data_left, ch->data_bottom); + for( d = ch->data_left; + d <= ch->data_right ; + d += (ch->data_right - ch->data_left) / 100.0) { - const double x = (d - ch.data_left) / abscissa_scale + x_min ; + const double x = (d - ch->data_left) / abscissa_scale + x_min ; const double y = norm->N * range * gsl_ran_gaussian_pdf(x - norm->mean, norm->stddev); - pl_fcont_r(ch.lp, d, ch.data_bottom + y * ordinate_scale); + pl_fcont_r(ch->lp, d, ch->data_bottom + y * ordinate_scale); } - pl_endpath_r(ch.lp); + pl_endpath_r(ch->lp); } - chart_finalise(&ch); + chart_submit(ch); } diff --git a/src/som.c b/src/som.c index c74492bc..d0867aa0 100644 --- a/src/som.c +++ b/src/som.c @@ -66,7 +66,7 @@ som_blank_line (void) static struct outp_driver *d=0; /* Table. */ -static struct som_table *t=0; +static struct som_entity *t=0; /* Flags. */ static unsigned flags; @@ -87,11 +87,11 @@ static void render_columns (void); static void render_simple (void); static void render_segments (void); -static void output_table (struct outp_driver *, struct som_table *); +static void output_entity (struct outp_driver *, struct som_entity *); /* Output table T to appropriate output devices. */ void -som_submit (struct som_table *t) +som_submit (struct som_entity *t) { #if GLOBAL_DEBUGGING static int entry; @@ -99,34 +99,40 @@ som_submit (struct som_table *t) assert (entry++ == 0); #endif - t->class->table (t); - t->class->flags (&flags); - t->class->count (&nc, &nr); - t->class->headers (&hl, &hr, &ht, &hb); + if ( t->type == SOM_TABLE) + { + t->class->table (t); + t->class->flags (&flags); + t->class->count (&nc, &nr); + t->class->headers (&hl, &hr, &ht, &hb); + #if GLOBAL_DEBUGGING - if (hl + hr > nc || ht + hb > nr) - { - printf ("headers: (l,r)=(%d,%d), (t,b)=(%d,%d) in table size (%d,%d)\n", - hl, hr, ht, hb, nc, nr); - abort (); - } - else if (hl + hr == nc) - printf ("warning: headers (l,r)=(%d,%d) in table width %d\n", hl, hr, nc); - else if (ht + hb == nr) - printf ("warning: headers (t,b)=(%d,%d) in table height %d\n", ht, hb, nr); + if (hl + hr > nc || ht + hb > nr) + { + printf ("headers: (l,r)=(%d,%d), (t,b)=(%d,%d) in table size (%d,%d)\n", + hl, hr, ht, hb, nc, nr); + abort (); + } + else if (hl + hr == nc) + printf ("warning: headers (l,r)=(%d,%d) in table width %d\n", hl, hr, nc); + else if (ht + hb == nr) + printf ("warning: headers (t,b)=(%d,%d) in table height %d\n", ht, hb, nr); #endif - t->class->columns (&cs); + t->class->columns (&cs); - if (!(flags & SOMF_NO_TITLE)) - subtable_num++; - + if (!(flags & SOMF_NO_TITLE)) + subtable_num++; + + } + { struct outp_driver *d; - + for (d = outp_drivers (NULL); d; d = outp_drivers (d)) - output_table (d, t); + output_entity (d, t); + } #if GLOBAL_DEBUGGING @@ -134,12 +140,11 @@ som_submit (struct som_table *t) #endif } -/* Output table TABLE to driver DRIVER. */ +/* Output entity ENTITY to driver DRIVER. */ static void -output_table (struct outp_driver *driver, struct som_table *table) +output_entity (struct outp_driver *driver, struct som_entity *entity) { d = driver; - t = table; assert (d->driver_open); if (!d->page_open && !d->class->open_page (d)) @@ -148,11 +153,13 @@ output_table (struct outp_driver *driver, struct som_table *table) return; } - if (d->class->special) + if (d->class->special || entity->type == SOM_CHART) { - driver->class->submit (d, t); + driver->class->submit (d, entity); return; } + + t = entity; t->class->driver (d); t->class->area (&tw, &th); diff --git a/src/som.h b/src/som.h index 9ac69c86..f3e5c8a7 100644 --- a/src/som.h +++ b/src/som.h @@ -36,11 +36,18 @@ desired, and in fact almost every operation performed by som may be overridden in a table class. */ -/* Table. */ -struct som_table +enum som_type + { + SOM_TABLE, + SOM_CHART + } ; + +/* Entity (Table or Chart) . */ +struct som_entity { struct som_table_class *class; /* Table class. */ - void *ext; /* Owned by table class. */ + enum som_type type; /* Table or Chart */ + void *ext; /* Owned by */ }; /* Group styles. */ @@ -70,7 +77,7 @@ struct outp_driver; struct som_table_class { /* Set table, driver. */ - void (*table) (struct som_table *); + void (*table) (struct som_entity *); void (*driver) (struct outp_driver *); /* Query columns and rows. */ @@ -100,7 +107,7 @@ extern int subtable_num; /* Submission. */ void som_new_series (void); -void som_submit (struct som_table *t); +void som_submit (struct som_entity *t); /* Miscellaneous. */ void som_eject_page (void); diff --git a/src/tab.c b/src/tab.c index dd901493..201f0d82 100644 --- a/src/tab.c +++ b/src/tab.c @@ -868,11 +868,12 @@ tab_flags (struct tab_table *t, unsigned flags) void tab_submit (struct tab_table *t) { - struct som_table s; + struct som_entity s; assert (t != NULL); s.class = &tab_table_class; s.ext = t; + s.type = SOM_TABLE; som_submit (&s); tab_destroy (t); } @@ -927,9 +928,11 @@ int tab_hit; /* Set the current table to TABLE. */ static void -tabi_table (struct som_table *table) +tabi_table (struct som_entity *table) { assert (table != NULL); + assert (table->type == SOM_TABLE); + t = table->ext; tab_offset (t, 0, 0);