Save work.

This commit is contained in:
Michael R Sweet
2021-04-27 21:22:34 -04:00
parent 11588ce2f5
commit e2e2192ea9
10 changed files with 672 additions and 113 deletions

View File

@@ -14,19 +14,6 @@
#include "pdfio-private.h"
//
// Array structure
//
struct _pdfio_array_s
{
pdfio_file_t *pdf; // PDF file
size_t num_values, // Number of values in use
alloc_values; // Number of allocated values
_pdfio_value_t *values; // Array of values
};
//
// Local functions...
//
@@ -167,6 +154,21 @@ pdfioArrayAppendString(
}
//
// 'pdfioArrayCopy()' - Copy an array.
//
pdfio_array_t * // O - New array or `NULL` on error
pdfioArrayCopy(pdfio_file_t *pdf, // I - PDF file
pdfio_array_t *a) // I - Original array
{
// TODO: Implement me
(void)pdf;
(void)a;
return (NULL);
}
//
// 'pdfioArrayCreate()' - Create an empty array.
//
@@ -365,6 +367,34 @@ _pdfioArrayGetValue(pdfio_array_t *a, // I - Array
}
//
// '_pdfioArrayWrite()' - Write an array to a PDF file.
//
bool // O - `true` on success, `false` otherwise
_pdfioArrayWrite(pdfio_array_t *a) // I - Array
{
pdfio_file_t *pdf = a->pdf; // PDF file
size_t i; // Looping var
_pdfio_value_t *v; // Current value
// Arrays are surrounded by square brackets ([ ... ])
if (!_pdfioFilePuts(pdf, "["))
return (false);
// Write each value...
for (i = a->num_values, v = a->values; i > 0; i --, v ++)
{
if (!_pdfioValueWrite(pdf, v))
return (false);
}
// Closing bracket...
return (_pdfioFilePuts(pdf, "]"));
}
//
// 'append_value()' - Append a value.
//