--- a/ucx/cx/properties.h Mon Jan 06 22:22:55 2025 +0100 +++ b/ucx/cx/properties.h Tue Feb 25 21:11:00 2025 +0100 @@ -59,12 +59,6 @@ char delimiter; /** - * The character, when appearing at the end of a line, continues that line. - * This is '\' by default. - */ - // char continuation; // TODO: line continuation in properties - - /** * The first comment character. * This is '#' by default. */ @@ -81,6 +75,15 @@ * This is not set by default. */ char comment3; + + /* + * The character, when appearing at the end of a line, continues that line. + * This is '\' by default. + */ + /** + * Reserved for future use. + */ + char continuation; }; /** @@ -91,6 +94,7 @@ /** * Default properties configuration. */ +cx_attr_export extern const CxPropertiesConfig cx_properties_config_default; /** @@ -327,6 +331,7 @@ * @see cxPropertiesInitDefault() */ cx_attr_nonnull +cx_attr_export void cxPropertiesInit(CxProperties *prop, CxPropertiesConfig config); /** @@ -341,6 +346,7 @@ * @param prop the properties interface */ cx_attr_nonnull +cx_attr_export void cxPropertiesDestroy(CxProperties *prop); /** @@ -390,6 +396,7 @@ */ cx_attr_nonnull cx_attr_access_r(2, 3) +cx_attr_export int cxPropertiesFilln( CxProperties *prop, const char *buf, @@ -495,6 +502,7 @@ * @param capacity the capacity of the stack memory */ cx_attr_nonnull +cx_attr_export void cxPropertiesUseStack( CxProperties *prop, char *buf, @@ -533,6 +541,7 @@ */ cx_attr_nonnull cx_attr_nodiscard +cx_attr_export CxPropertiesStatus cxPropertiesNext( CxProperties *prop, cxstring *key, @@ -553,6 +562,7 @@ */ cx_attr_nonnull cx_attr_nodiscard +cx_attr_export CxPropertiesSink cxPropertiesMapSink(CxMap *map); /** @@ -563,6 +573,7 @@ * @see cxPropertiesLoad() */ cx_attr_nodiscard +cx_attr_export CxPropertiesSource cxPropertiesStringSource(cxstring str); /** @@ -576,6 +587,7 @@ cx_attr_nonnull cx_attr_nodiscard cx_attr_access_r(1, 2) +cx_attr_export CxPropertiesSource cxPropertiesCstrnSource(const char *str, size_t len); /** @@ -591,6 +603,7 @@ cx_attr_nonnull cx_attr_nodiscard cx_attr_cstr_arg(1) +cx_attr_export CxPropertiesSource cxPropertiesCstrSource(const char *str); /** @@ -605,6 +618,7 @@ cx_attr_nonnull cx_attr_nodiscard cx_attr_access_r(1) +cx_attr_export CxPropertiesSource cxPropertiesFileSource(FILE *file, size_t chunk_size); @@ -616,6 +630,11 @@ * the return value will be #CX_PROPERTIES_NO_ERROR. * When the source was consumed but no k/v-pairs were found, the return value * will be #CX_PROPERTIES_NO_DATA. + * In case the source data ends unexpectedly, the #CX_PROPERTIES_INCOMPLETE_DATA + * is returned. In that case you should call this function again with the same + * sink and either an updated source or the same source if the source is able to + * yield the missing data. + * * The other result codes apply, according to their description. * * @param prop the properties interface @@ -626,11 +645,13 @@ * @retval CX_PROPERTIES_READ_FAILED reading from the source failed * @retval CX_PROPERTIES_SINK_FAILED sinking the properties into the sink failed * @retval CX_PROPERTIES_NO_DATA the source did not provide any key/value pairs + * @retval CX_PROPERTIES_INCOMPLETE_DATA the source did not provide enough data * @retval CX_PROPERTIES_INVALID_EMPTY_KEY the properties data contains an illegal empty key * @retval CX_PROPERTIES_INVALID_MISSING_DELIMITER the properties data contains a line without delimiter * @retval CX_PROPERTIES_BUFFER_ALLOC_FAILED an internal allocation was necessary but failed */ cx_attr_nonnull +cx_attr_export CxPropertiesStatus cxPropertiesLoad( CxProperties *prop, CxPropertiesSink sink,