pspp
4 years agoxml-parser-generator: Support naming sequences. vizml
Ben Pfaff [Sun, 9 Feb 2020 21:26:48 +0000 (21:26 +0000)]
xml-parser-generator: Support naming sequences.

4 years agostart moving vizml parsing into a new file
Ben Pfaff [Sun, 9 Feb 2020 19:02:59 +0000 (19:02 +0000)]
start moving vizml parsing into a new file

4 years agoRevert "temporary changes for optimizations"
Ben Pfaff [Sun, 9 Feb 2020 17:56:51 +0000 (17:56 +0000)]
Revert "temporary changes for optimizations"

This reverts commit 5aaebfb786bc3dcecee1f8f9ae4e016bd28f72c6.

4 years agotemporary changes for optimizations
Ben Pfaff [Sun, 9 Feb 2020 17:55:12 +0000 (17:55 +0000)]
temporary changes for optimizations

4 years agowork on vizml schema
Ben Pfaff [Sun, 9 Feb 2020 17:56:28 +0000 (17:56 +0000)]
work on vizml schema

4 years agovalue: Avoid compiler warning for uninitialized data.
Ben Pfaff [Sun, 9 Feb 2020 17:55:25 +0000 (17:55 +0000)]
value: Avoid compiler warning for uninitialized data.

4 years agovizml now accepts the whole corpus
Ben Pfaff [Sun, 26 Jan 2020 22:21:45 +0000 (22:21 +0000)]
vizml now accepts the whole corpus

4 years agowork on vizml
Ben Pfaff [Sun, 26 Jan 2020 05:57:02 +0000 (05:57 +0000)]
work on vizml

4 years agowork
Ben Pfaff [Sat, 11 Jan 2020 17:50:54 +0000 (17:50 +0000)]
work

4 years agosome more vizml work
Ben Pfaff [Sat, 11 Jan 2020 07:15:42 +0000 (07:15 +0000)]
some more vizml work

4 years agovizml work
Ben Pfaff [Sat, 11 Jan 2020 07:13:11 +0000 (07:13 +0000)]
vizml work

4 years agospv: Change comments in grammars from # to //.
Ben Pfaff [Sat, 11 Jan 2020 17:50:38 +0000 (17:50 +0000)]
spv: Change comments in grammars from # to //.

I want to use # in the syntax, so it can't be the comment character
anymore.

4 years agopsppire-output-window: Avoid calling gdk_window_begin_draw_frame twice.
Ben Pfaff [Fri, 10 Jan 2020 05:53:54 +0000 (05:53 +0000)]
psppire-output-window: Avoid calling gdk_window_begin_draw_frame twice.

gdk_window_begin_draw_frame() and gdk_window_end_draw_frame() have to
be paired and not recursive, but this code didn't honor that.

Thanks to Harry Thijssen and John Darrington for pointing out the
issue.

4 years agoLIST: Fix case numbering.
Ben Pfaff [Fri, 10 Jan 2020 03:26:57 +0000 (03:26 +0000)]
LIST: Fix case numbering.

Case numbering was wrong when a starting case or a step was specified.

Bug #57534.

4 years agoascii: Correct multiple bugs regarding output width.
Ben Pfaff [Thu, 9 Jan 2020 07:22:05 +0000 (07:22 +0000)]
ascii: Correct multiple bugs regarding output width.

The SET WIDTH setting was ignored.  This makes the code honor it for
output to a file.  For output to a terminal, the terminal's width is
used instead.

Honor changes to SET WIDTH as well.

The code to detect terminal size changes wasn't properly signal safe,
and it was scattered across multiple files.  This centralizes it and
makes it signal safe.

There were bugs in updates to min_hbreak in corner cases.  This fixes
them.

Thanks to Frans Houweling and John Darrington for reporting these
bugs.

4 years agoascii: Fix parsing of -O width=<n> option.
Ben Pfaff [Thu, 9 Jan 2020 07:22:49 +0000 (07:22 +0000)]
ascii: Fix parsing of -O width=<n> option.

4 years agopivot-table: Avoid ctime_r() for portability reasons.
Ben Pfaff [Wed, 1 Jan 2020 17:19:14 +0000 (17:19 +0000)]
pivot-table: Avoid ctime_r() for portability reasons.

ctime_r() isn't in mingw or Gnulib and it's best to avoid it in any
case because POSIX says it is obsolescent and it has buffer overflow
issues.

Reported by Harry Thijssen.

4 years agospv: Make parser generators compatible with python3.
Ben Pfaff [Mon, 30 Dec 2019 15:05:04 +0000 (15:05 +0000)]
spv: Make parser generators compatible with python3.

4 years agodoc: PRINT on DO REPEAT is not yet implemented.
Ben Pfaff [Mon, 30 Dec 2019 06:59:09 +0000 (06:59 +0000)]
doc: PRINT on DO REPEAT is not yet implemented.

Reported by Nolan Void.

4 years agospv: Run Python at build time via $PYTHON variable.
Ben Pfaff [Mon, 30 Dec 2019 06:42:02 +0000 (06:42 +0000)]
spv: Run Python at build time via $PYTHON variable.

This was accidentally being run as literal "python" rather than through
a variable, so it failed on systems where there is no "python" binary
but only python2 or python3.

4 years agopsppire-import-assistant: Implement quotation checkbox and combo box.
Ben Pfaff [Mon, 30 Dec 2019 06:35:16 +0000 (06:35 +0000)]
psppire-import-assistant: Implement quotation checkbox and combo box.

This seems to have been overlooked.

Bug #57457.

4 years agopspp-convert: Add options for selecting variables and controlling output.
Ben Pfaff [Mon, 30 Dec 2019 02:48:53 +0000 (02:48 +0000)]
pspp-convert: Add options for selecting variables and controlling output.

4 years agocairo: Fix font scaling.
Ben Pfaff [Sun, 29 Dec 2019 16:25:57 +0000 (16:25 +0000)]
cairo: Fix font scaling.

It's really a mystery why a 9-point font doesn't appear 9 points tall
in PDF (etc.) output, but it doesn't.  I guess we're doing something
wrong somewhere.  But until we figure out the underlying issue, we need
to scale down font sizes for PDF and not for on-screen use.

This is a slightly better fix for font sizes than the previous commit
3c15b41c036 (pivot-table: Kluge dropping default 9-point font to make
output readable.)

4 years agopivot-table: Kluge dropping default 9-point font to make output readable.
Ben Pfaff [Sun, 29 Dec 2019 15:53:25 +0000 (15:53 +0000)]
pivot-table: Kluge dropping default 9-point font to make output readable.

The default font size for SPV output is normally 9 points, but that
makes the output window hard to read.  This drops that default entirely,
which seems to make the output use a system or Pango default.  This is
probably not the right thing to do--probably we need a way to magnify
the fonts for on-screen display.

This reverts part of commit e3c3fbe8b, which wasn't intended to have a
visible effect but did because it inadvertently introduced a 9-point
default.

Reported by John Darrington.

4 years agopspp-convert: Add --labels, --recode to usage message.
Ben Pfaff [Sun, 29 Dec 2019 15:38:57 +0000 (15:38 +0000)]
pspp-convert: Add --labels, --recode to usage message.

4 years agopspp-convert: Add --labels and --recode options.
Ben Pfaff [Sun, 29 Dec 2019 07:50:47 +0000 (07:50 +0000)]
pspp-convert: Add --labels and --recode options.

Requested by Dave Trollope <dave@knowledgehound.com>.

4 years agopspp-output: Correct manpage.
Ben Pfaff [Sun, 29 Dec 2019 07:33:37 +0000 (07:33 +0000)]
pspp-output: Correct manpage.

This was a cut-and-paste error made without thinking.

4 years agoAdd support for reading and writing SPV files.
Ben Pfaff [Sat, 19 Oct 2019 05:30:43 +0000 (05:30 +0000)]
Add support for reading and writing SPV files.

4 years agopivot-table: Add support for hiding footnotes.
Ben Pfaff [Sun, 29 Dec 2019 05:46:31 +0000 (05:46 +0000)]
pivot-table: Add support for hiding footnotes.

This will get its first real user in an upcoming commit.

4 years agopivot-table: Add support for hiding the caption.
Ben Pfaff [Sun, 29 Dec 2019 05:50:39 +0000 (05:50 +0000)]
pivot-table: Add support for hiding the caption.

This will receive its first real user in an upcoming commit that adds
support for SPV files.

4 years agooutput: Refine support for footnotes, subscripts, and superscripts.
Ben Pfaff [Sun, 29 Dec 2019 05:39:50 +0000 (05:39 +0000)]
output: Refine support for footnotes, subscripts, and superscripts.

The code for all this wasn't fully plumbed through from the pivot table
code down to the drivers.  This commit fixes all that up.

4 years agotable: Factor out common code and improve comments.
Ben Pfaff [Thu, 26 Dec 2019 17:34:14 +0000 (17:34 +0000)]
table: Factor out common code and improve comments.

4 years agotable: Replace table_joined_cell by table_cell.
Ben Pfaff [Thu, 26 Dec 2019 05:50:41 +0000 (05:50 +0000)]
table: Replace table_joined_cell by table_cell.

This eliminates some special cases.

4 years agorender: Fix up layer violation in add_footnote_page().
Ben Pfaff [Thu, 26 Dec 2019 01:14:32 +0000 (01:14 +0000)]
render: Fix up layer violation in add_footnote_page().

The layering violation came from having to look up the default style
for a footer, so we fix it by forbidding footnotes from using the
default style.

4 years agotable: Get rid of TAL_* constants.
Ben Pfaff [Thu, 26 Dec 2019 01:02:43 +0000 (01:02 +0000)]
table: Get rid of TAL_* constants.

These were the same as TABLE_STROKE_* so get rid of the extras.

4 years agotable: Get rid of TAB_* for horizontal and vertical alignment.
Ben Pfaff [Thu, 26 Dec 2019 00:52:33 +0000 (00:52 +0000)]
table: Get rid of TAB_* for horizontal and vertical alignment.

Until now, either TAB_LEFT, TAB_RIGHT, etc. could be used or the
area_style mechanism could be used.  The latter has a superset of the
former's features, so this commit eliminates the former.

4 years agopivot-table: Make pivot_area_get_default_style() return a static copy.
Ben Pfaff [Thu, 26 Dec 2019 00:43:45 +0000 (00:43 +0000)]
pivot-table: Make pivot_area_get_default_style() return a static copy.

The existing callers all want to make their own copy, but an upcoming
new caller wants an existing one, so refactor the interface a bit.

4 years agotable: Add pool parameter to area_style_copy(), font_style_copy().
Ben Pfaff [Thu, 26 Dec 2019 00:41:22 +0000 (00:41 +0000)]
table: Add pool parameter to area_style_copy(), font_style_copy().

This was inconsistent since the clone functions took them but the
copy functions didn't.

4 years agotable: Move tab.h into table.h and rename tab_*() to table_*().
Ben Pfaff [Wed, 25 Dec 2019 23:21:05 +0000 (23:21 +0000)]
table: Move tab.h into table.h and rename tab_*() to table_*().

4 years agotable: Merge tab.c into table.c.
Ben Pfaff [Wed, 25 Dec 2019 23:13:35 +0000 (23:13 +0000)]
table: Merge tab.c into table.c.

4 years agotab: Merge struct tab_table into struct table.
Ben Pfaff [Wed, 25 Dec 2019 23:02:42 +0000 (23:02 +0000)]
tab: Merge struct tab_table into struct table.

4 years agotable: Require headers to be set at table creation.
Ben Pfaff [Wed, 25 Dec 2019 22:33:37 +0000 (22:33 +0000)]
table: Require headers to be set at table creation.

It used to be important for these to be adjustable, but no longer.

4 years agotable: Get rid of table_class.
Ben Pfaff [Wed, 25 Dec 2019 22:26:25 +0000 (22:26 +0000)]
table: Get rid of table_class.

There is only one provider now, so we can slowly get rid of the extra
layer.

4 years agotable: Simplify interface for number of rows and columns.
Ben Pfaff [Wed, 25 Dec 2019 21:38:49 +0000 (21:38 +0000)]
table: Simplify interface for number of rows and columns.

Nothing ever changes the number of rows or columns in a table after
initializing it anymore, so the more complicated interface is not needed.

4 years agotab: Fix overlap between table enumerations.
Ben Pfaff [Wed, 25 Dec 2019 21:28:32 +0000 (21:28 +0000)]
tab: Fix overlap between table enumerations.

These enumerations overlapped with TAB_STYLE_MASK.

4 years agotable: Get rid of table_cell destructors, which were unused.
Ben Pfaff [Wed, 25 Dec 2019 17:01:49 +0000 (17:01 +0000)]
table: Get rid of table_cell destructors, which were unused.

4 years agopivot-table: Initialize subtype, command_id for pivot tables.
Ben Pfaff [Sat, 7 Dec 2019 23:54:50 +0000 (23:54 +0000)]
pivot-table: Initialize subtype, command_id for pivot tables.

4 years agopivot-table: Make template pivot_values localized.
Ben Pfaff [Mon, 21 Oct 2019 03:04:22 +0000 (03:04 +0000)]
pivot-table: Make template pivot_values localized.

This will be used in an upcoming commit.

4 years agopivot-table: Also dump sizing info in pivot_table_dump().
Ben Pfaff [Sat, 19 Oct 2019 05:55:47 +0000 (05:55 +0000)]
pivot-table: Also dump sizing info in pivot_table_dump().

4 years agopivot-table: Minor comment and style improvements.
Ben Pfaff [Sat, 19 Oct 2019 05:53:00 +0000 (05:53 +0000)]
pivot-table: Minor comment and style improvements.

No behavioral changes.

4 years agopivot-table: Make struct pivot_cell public.
Ben Pfaff [Sat, 19 Oct 2019 05:51:10 +0000 (05:51 +0000)]
pivot-table: Make struct pivot_cell public.

4 years agopivot-table: New public functions for default area and border styles.
Ben Pfaff [Sat, 19 Oct 2019 05:49:11 +0000 (05:49 +0000)]
pivot-table: New public functions for default area and border styles.

These will have additional users in upcoming commits.

4 years agorender: Change style for footnote blocks.
Ben Pfaff [Sat, 19 Oct 2019 05:41:58 +0000 (05:41 +0000)]
render: Change style for footnote blocks.

This better matches the style output by SPSS.

4 years agodriver: Do not accumulate marked-up text.
Ben Pfaff [Sat, 19 Oct 2019 05:41:25 +0000 (05:41 +0000)]
driver: Do not accumulate marked-up text.

The output engine accumulates lines of text into blocks and outputs them
all at once.  This doesn't currently work for text with markup, so this
commit disables it.  It might be better to make it work, hence this
commit also adds an XXX marker.

4 years agotable-item: Generalize support for layer info.
Ben Pfaff [Sat, 19 Oct 2019 05:20:02 +0000 (05:20 +0000)]
table-item: Generalize support for layer info.

This adds support for an arbitrary number of layer text items and allows
the layer text items to have footnotes.

4 years agobit-vector: Add new functions for working with bit vectors.
Ben Pfaff [Mon, 2 Dec 2019 03:29:31 +0000 (03:29 +0000)]
bit-vector: Add new functions for working with bit vectors.

These will receive their first users in an upcoming commit.

4 years agozip-reader: New function zip_reader_contains_member().
Ben Pfaff [Tue, 25 Dec 2018 04:53:09 +0000 (20:53 -0800)]
zip-reader: New function zip_reader_contains_member().

This function will have its first user in an upcoming commit.

4 years agozip-reader: New function zip_member_read_all().
Ben Pfaff [Mon, 26 Nov 2018 00:20:29 +0000 (16:20 -0800)]
zip-reader: New function zip_member_read_all().

This will have its first user in an upcoming commit.

4 years agotable: Make table_collect_footnotes() not return NULL footnotes.
Ben Pfaff [Fri, 11 Oct 2019 05:09:13 +0000 (05:09 +0000)]
table: Make table_collect_footnotes() not return NULL footnotes.

This simplifies the callers a bit.

4 years agocairo: Make footnote markers smaller than normal text size.
Ben Pfaff [Fri, 11 Oct 2019 04:57:45 +0000 (04:57 +0000)]
cairo: Make footnote markers smaller than normal text size.

4 years agopivot-table: Add reference counts.
Ben Pfaff [Fri, 11 Oct 2019 04:15:45 +0000 (04:15 +0000)]
pivot-table: Add reference counts.

This will be more useful in an upcoming commit.

4 years agostring-array: New function string_array_parse().
Ben Pfaff [Sun, 8 Dec 2019 02:13:37 +0000 (02:13 +0000)]
string-array: New function string_array_parse().

This will acquire its first user in an upcoming commit.

4 years agospv-file-format: Update.
Ben Pfaff [Sun, 29 Dec 2019 04:51:50 +0000 (04:51 +0000)]
spv-file-format: Update.

4 years agoEnsure that PRAGMA_COLUMNS etc can be overridden
John Darrington [Sun, 15 Dec 2019 08:57:40 +0000 (09:57 +0100)]
Ensure that PRAGMA_COLUMNS etc can be overridden

4 years agoRemove unused #include directives
John Darrington [Sun, 15 Dec 2019 08:57:40 +0000 (09:57 +0100)]
Remove unused #include directives

4 years agoRemove trailing whitespace from files
John Darrington [Sun, 15 Dec 2019 08:57:40 +0000 (09:57 +0100)]
Remove trailing whitespace from files

4 years agospv-file-format: Improve documentation.
Ben Pfaff [Sun, 15 Dec 2019 04:26:55 +0000 (04:26 +0000)]
spv-file-format: Improve documentation.

4 years agoascii: Open output file immediately instead of deferring it.
Ben Pfaff [Sat, 14 Dec 2019 22:28:10 +0000 (22:28 +0000)]
ascii: Open output file immediately instead of deferring it.

I do not know of a good reason to defer it, and it can be surprising to
the user if there is no output file at all if there is no output.

4 years agoSmake: Add unicase/u8-totitle module.
Ben Pfaff [Sun, 8 Dec 2019 15:46:25 +0000 (15:46 +0000)]
Smake: Add unicase/u8-totitle module.

Should fix link error caused by commit 80bafa137 (i18n: New function
utf8_to_title().)

Reported by John Darrington.

4 years agocommand: Put command_ids in output into title case.
Ben Pfaff [Sat, 7 Dec 2019 19:07:11 +0000 (19:07 +0000)]
command: Put command_ids in output into title case.

This is closer to compatibility.

4 years agoi18n: New function utf8_to_title().
Ben Pfaff [Sun, 8 Dec 2019 00:51:44 +0000 (00:51 +0000)]
i18n: New function utf8_to_title().

4 years agodoc: Correct documentation for pspp-convert.
Ben Pfaff [Sat, 7 Dec 2019 23:55:24 +0000 (23:55 +0000)]
doc: Correct documentation for pspp-convert.

4 years agostring-array: Drop unused parameter from STRING_ARRAY_INITIALIZER.
Ben Pfaff [Sun, 10 Nov 2019 23:53:05 +0000 (23:53 +0000)]
string-array: Drop unused parameter from STRING_ARRAY_INITIALIZER.

This macro had no users.

4 years agospv-file-format.texi: Updates.
Ben Pfaff [Sun, 1 Dec 2019 23:52:06 +0000 (23:52 +0000)]
spv-file-format.texi: Updates.

4 years agodoc: Remove useless local variables from top-level texi files.
Ben Pfaff [Sun, 1 Dec 2019 23:52:47 +0000 (23:52 +0000)]
doc: Remove useless local variables from top-level texi files.

4 years agopspp-convert: Support decrypting SPV files.
Ben Pfaff [Sun, 1 Dec 2019 23:45:45 +0000 (23:45 +0000)]
pspp-convert: Support decrypting SPV files.

Also, now properly understands and documents the PKCS #7 padding used
for all encrypted files.

Special thanks to Alan Mead for assistance.

4 years agoDocumentation: Correct some inappropriate uses of @xref
John Darrington [Sat, 30 Nov 2019 12:49:03 +0000 (13:49 +0100)]
Documentation: Correct some inappropriate uses of @xref

4 years agoUpdate copyright notice for doc/pspp.texi
John Darrington [Sat, 30 Nov 2019 12:37:07 +0000 (13:37 +0100)]
Update copyright notice for doc/pspp.texi

4 years agoremove stray spaces from po/automake.mk
John Darrington [Fri, 29 Nov 2019 06:56:25 +0000 (07:56 +0100)]
remove stray spaces from po/automake.mk

4 years agoRemove #include <assert.h> from files which don't need it
John Darrington [Thu, 28 Nov 2019 09:09:50 +0000 (10:09 +0100)]
Remove #include <assert.h> from files which don't need it

4 years agoDelete trailing whitespace at line endings.
John Darrington [Wed, 27 Nov 2019 09:14:01 +0000 (10:14 +0100)]
Delete trailing whitespace at line endings.

4 years agoFix typos in comments
John Darrington [Sun, 24 Nov 2019 06:41:07 +0000 (07:41 +0100)]
Fix typos in comments

* src/ui/gui/memorandum.txt: Fix typo.
* tests/language/command.at: Remove doubled word.

4 years agoDocumentation: Fix various typos
John Darrington [Sun, 24 Nov 2019 06:41:07 +0000 (07:41 +0100)]
Documentation: Fix various typos

* doc/statistics.texi: Fix typos.
* doc/utilities.texi: filesystem -> file system

4 years agoRemove stray semicolon
John Darrington [Sun, 24 Nov 2019 06:41:07 +0000 (07:41 +0100)]
Remove stray semicolon

* src/ui/gui/psppire-dialog-action-select.c: Remove extra ;

4 years agoacinclude.m4: Quote arguments to AC_DEFINE
John Darrington [Sun, 24 Nov 2019 06:41:07 +0000 (07:41 +0100)]
acinclude.m4: Quote arguments to AC_DEFINE

4 years agoUpdate perl-module to GPLv3+
John Darrington [Sun, 24 Nov 2019 06:41:07 +0000 (07:41 +0100)]
Update perl-module to GPLv3+

* perl-module/PSPP.xs:
* perl-module/README:

4 years agoLOOP: Limit number of iterations when IF clauses present.
Ben Pfaff [Sun, 10 Nov 2019 18:29:17 +0000 (18:29 +0000)]
LOOP: Limit number of iterations when IF clauses present.

The LOOP command is limited by the MXLOOPS setting in some cirumstances.
Until now, if an IF clause was present, MXLOOPS was disregarded.
However, this behavior does not match SPSS behavior.  This commit makes
LOOP honor MXLOOPS even when IF is present, for compatibility.

With this commit, only the presence of an index clause makes LOOP
disregard MXLOOPS.

Thanks to Frans Houweling for reporting this bug.

4 years agoFixed incorrect syntax generated by the Select Random Cases dialog.
John Darrington [Tue, 5 Nov 2019 15:49:35 +0000 (16:49 +0100)]
Fixed incorrect syntax generated by the Select Random Cases dialog.

Reported by: Eric E Graig

4 years agopivot-table: Use ctime_r() instead of ctime(), for thread safety.
Ben Pfaff [Sat, 19 Oct 2019 05:57:32 +0000 (05:57 +0000)]
pivot-table: Use ctime_r() instead of ctime(), for thread safety.

4 years agoascii: Avoid buffer overread outputting page longer than allocated lines.
Ben Pfaff [Fri, 11 Oct 2019 04:32:31 +0000 (04:32 +0000)]
ascii: Avoid buffer overread outputting page longer than allocated lines.

This does seem like an odd case but I triggered it at one point and it
costs little to check for it.

4 years agopivot-table: Fix memory leaks in pivot_table_dump().
Ben Pfaff [Sat, 19 Oct 2019 05:46:03 +0000 (05:46 +0000)]
pivot-table: Fix memory leaks in pivot_table_dump().

# Conflicts:
# src/output/pivot-table.c

4 years agopivot-table: Fix memory leak in pivot_value_destroy().
Ben Pfaff [Mon, 21 Oct 2019 02:57:58 +0000 (02:57 +0000)]
pivot-table: Fix memory leak in pivot_value_destroy().

4 years agodriver: Fix memory leak in output_submit().
Ben Pfaff [Fri, 11 Oct 2019 05:03:54 +0000 (05:03 +0000)]
driver: Fix memory leak in output_submit().

4 years agoperl-module/automake.mk (perl_module_tarball): Make build dir writable.
John Darrington [Tue, 22 Oct 2019 09:56:42 +0000 (11:56 +0200)]
perl-module/automake.mk (perl_module_tarball): Make build dir writable.

It seems that recent perl tries to write them.

4 years agopo/Makevars: Add copyright and licence notices
John Darrington [Sat, 31 Aug 2019 13:35:03 +0000 (15:35 +0200)]
po/Makevars: Add copyright and licence notices

4 years agozip-writer: New functions for adding members.
Ben Pfaff [Fri, 11 Oct 2019 04:22:14 +0000 (04:22 +0000)]
zip-writer: New functions for adding members.

These will have additional users in an upcoming commit.

4 years agozip-reader: Improve error messages.
Ben Pfaff [Mon, 17 Jul 2017 18:38:13 +0000 (11:38 -0700)]
zip-reader: Improve error messages.

With this change, the zip-reader's error messages always include the zip
file name and, when relevant, the member name.  Otherwise it wasn't always
clear what a message liek "No such file or directory" was talking about.

4 years agozip-reader: New function zip_reader_get_member_name().
Ben Pfaff [Sun, 16 Jul 2017 03:41:08 +0000 (20:41 -0700)]
zip-reader: New function zip_reader_get_member_name().

This allows the caller to obtain a list of .zip members.

4 years agozip-reader: Don't keep .zip file open for lifetime of zip_reader.
Ben Pfaff [Sun, 16 Jul 2017 03:26:31 +0000 (20:26 -0700)]
zip-reader: Don't keep .zip file open for lifetime of zip_reader.

The zip_reader no longer uses the .zip file after it opens it, so close it
when it's no longer needed.

4 years agozip-reader: Read the whole central directory at .zip open time.
Ben Pfaff [Sun, 16 Jul 2017 03:22:10 +0000 (20:22 -0700)]
zip-reader: Read the whole central directory at .zip open time.

By reading the whole central directory when we open the .zip file, rather
than one entry at a time, we make it easier to get a list of entries and
make it available to the client.  (This will be implemented in an upcoming
commit.)

This commit also fixes memory leaks in the error case in zip_member_open().

This commit also changes the usage model.  Previously, if the caller opened
a single member more than once, all the members shared a single copy of
the member and read each other's data.  Now, each caller that opens a
member gets a separate copy and a separate file pointer.  Callers now need
to call zip_member_finish() when they're done with a member.

With this commit, the code only keeps an open FILE for a member if the
caller opened that member.  Previously, it kept an open FILE for any
member that had been encountered.