From 6a783002e8b17995132fc6334b4e0900c36bf9a0 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 15 Aug 2018 13:41:42 +0100 Subject: Library: Use `nsl` as library namespace. --- include/libnslayout/error.h | 46 ++++++------- include/libnslayout/nslayout.h | 142 ++++++++++++++++++++--------------------- 2 files changed, 94 insertions(+), 94 deletions(-) (limited to 'include') diff --git a/include/libnslayout/error.h b/include/libnslayout/error.h index 5e7b87a..ee8a428 100644 --- a/include/libnslayout/error.h +++ b/include/libnslayout/error.h @@ -8,8 +8,8 @@ * Layout object handling */ -#ifndef nslayout_error_h_ -#define nslayout_error_h_ +#ifndef nsl_error_h_ +#define nsl_error_h_ #ifdef __cplusplus extern "C" @@ -17,27 +17,27 @@ extern "C" #endif /** - * Number of bits in an `nslayout_error` that indicate the source of the error. + * Number of bits in an `nsl_error` that indicate the source of the error. */ -#define NSLAYOUT_ERROR_PROV 8 +#define NSL_ERROR_PROV 8 /** * Libnslayout return codes * - * NSLAYOUT_OK indicates no error. + * NSL_OK indicates no error. */ -typedef enum nslayout_error { +typedef enum nsl_error { /** No error code */ - NSLAYOUT_OK = 0, + NSL_OK = 0, /** Error provenance (bits 0..7) */ - NSLAYOUT_NSLAYOUT = (1 << 0), - NSLAYOUT_LIBDOM = (1 << 1), - NSLAYOUT_LIBCSS = (1 << 2), + NSL_NSLAYOUT = (1 << 0), + NSL_LIBDOM = (1 << 1), + NSL_LIBCSS = (1 << 2), /** LibNSLayout errors (bits 8..31) */ - NSLAYOUT_NO_MEM = (1 << NSLAYOUT_ERROR_PROV) | NSLAYOUT_NSLAYOUT, -} nslayout_error; + NSL_NO_MEM = (1 << NSL_ERROR_PROV) | NSL_NSLAYOUT, +} nsl_error; /** @@ -46,9 +46,9 @@ typedef enum nslayout_error { * \param[in] err Error code to test * \return error provenance */ -static inline nslayout_error nslayout_error_provenance(nslayout_error err) +static inline nsl_error nsl_error_provenance(nsl_error err) { - return err & ((1 << NSLAYOUT_ERROR_PROV) - 1); + return err & ((1 << NSL_ERROR_PROV) - 1); } @@ -58,9 +58,9 @@ static inline nslayout_error nslayout_error_provenance(nslayout_error err) * \param[in] err Error code to test * \return true iff error is from libnslayout */ -static inline bool nslayout_error_is_layout(nslayout_error err) +static inline bool nsl_error_is_layout(nsl_error err) { - return err & NSLAYOUT_NSLAYOUT; + return err & NSL_NSLAYOUT; } @@ -70,9 +70,9 @@ static inline bool nslayout_error_is_layout(nslayout_error err) * \param[in] err Error code to test * \return true iff error is from libdom */ -static inline bool nslayout_error_is_libdom(nslayout_error err) +static inline bool nsl_error_is_libdom(nsl_error err) { - return err & NSLAYOUT_LIBDOM; + return err & NSL_LIBDOM; } /** @@ -81,9 +81,9 @@ static inline bool nslayout_error_is_libdom(nslayout_error err) * \param[in] err Error code to test * \return true iff error is from libcss */ -static inline bool nslayout_error_is_libcss(nslayout_error err) +static inline bool nsl_error_is_libcss(nsl_error err) { - return err & NSLAYOUT_LIBCSS; + return err & NSL_LIBCSS; } /** @@ -92,7 +92,7 @@ static inline bool nslayout_error_is_libcss(nslayout_error err) * \param[in] err Error code to convert * \return libnslayout error */ -static inline nslayout_error nslayout_error_to_layout(nslayout_error err) +static inline nsl_error nsl_error_to_layout(nsl_error err) { return err; } @@ -103,7 +103,7 @@ static inline nslayout_error nslayout_error_to_layout(nslayout_error err) * \param[in] err Error code to convert * \return dom exception */ -static inline dom_exception nslayout_error_to_libdom(nslayout_error err) +static inline dom_exception nsl_error_to_libdom(nsl_error err) { return err >> 8; } @@ -114,7 +114,7 @@ static inline dom_exception nslayout_error_to_libdom(nslayout_error err) * \param[in] err Error code to convert * \return libcss error */ -static inline css_error nslayout_error_to_libcss(nslayout_error err) +static inline css_error nsl_error_to_libcss(nsl_error err) { return err >> 8; } diff --git a/include/libnslayout/nslayout.h b/include/libnslayout/nslayout.h index 62ce584..551e550 100644 --- a/include/libnslayout/nslayout.h +++ b/include/libnslayout/nslayout.h @@ -9,8 +9,8 @@ * Layout object handling */ -#ifndef nslayout_nslayout_h_ -#define nslayout_nslayout_h_ +#ifndef nsl_nslayout_h_ +#define nsl_nslayout_h_ #ifdef __cplusplus extern "C" @@ -23,45 +23,45 @@ extern "C" #include /** A client-defined replaced element structure */ -typedef struct nslayout_replaced nslayout_replaced; +typedef struct nsl_replaced nsl_replaced; /** A rectangle */ -typedef struct nslayout_rect { +typedef struct nsl_rect { int x; /**< X position of left of rect in px */ int y; /**< Y position of top of rect in px */ int w; /**< Width of rect in px */ int h; /**< Height of rect in px */ -} nslayout_rect; +} nsl_rect; /***/ -enum nslayout_dom_node_event_type { - NSLAYOUT_DOM_NODE_INSERTED, - NSLAYOUT_DOM_NODE_MODIFIED, - NSLAYOUT_DOM_NODE_REMOVED, - NSLAYOUT_DOM_NODE__COUNT, +enum nsl_dom_node_event_type { + NSL_DOM_NODE_INSERTED, + NSL_DOM_NODE_MODIFIED, + NSL_DOM_NODE_REMOVED, + NSL_DOM_NODE__COUNT, }; /** Render list */ -typedef struct nslayout_render_list { -} nslayout_render_list; +typedef struct nsl_render_list { +} nsl_render_list; /** Opaque layout tree object */ -typedef struct nslayout_layout nslayout_layout; +typedef struct nsl_layout nsl_layout; /** * A LibNSLayout request * Client calls to set replaced element intrinsic dimensions. * - * Passed to the client via nslayout_callback + * Passed to the client via nsl_callback */ -typedef struct nslayout_request { +typedef struct nsl_request { /** Request type */ enum { - NSLAYOUT_GET_RESOURCE, - NSLAYOUT_RENDER, - NSLAYOUT_SET_EXTENTS, - NSLAYOUT_GET_INTRINSIC_SIZE + NSL_GET_RESOURCE, + NSL_RENDER, + NSL_SET_EXTENTS, + NSL_GET_INTRINSIC_SIZE } type; /** Request's type-specific parameters */ union { @@ -69,27 +69,27 @@ typedef struct nslayout_request { const char *url; /**< Absolute URL */ } get_resource; struct { - nslayout_render_list *list; /**< Render list */ + nsl_render_list *list; /**< Render list */ } render; struct { unsigned int width; /**< Document width in px */ unsigned int height; /**< Document height in px */ } set_extents; struct { - nslayout_replaced *replaced; /** A replacement object */ + nsl_replaced *replaced; /** A replacement object */ } get_intrinsic_size; } request; /** Request's type-specific return values */ union { struct { - nslayout_replaced **replaced; /** Replacement object */ + nsl_replaced **replaced; /** Replacement object */ } get_resource; struct { unsigned int *width; /** Replacement object's width */ unsigned int *height; /** Replacement object's height */ } get_intrinsic_size; } response; -} nslayout_request; +} nsl_request; /** @@ -98,12 +98,12 @@ typedef struct nslayout_request { * \param[in] layout The layout requiring update for DOM change. * \param[in] node The DOM node which is concerned in the event. * \param[in] type The type of DOM change event. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -nslayout_error nslayout_dom_node_event( - nslayout_layout *layout, +nsl_error nsl_dom_node_event( + nsl_layout *layout, dom_event_target *node, - enum nslayout_dom_node_event_type type); + enum nsl_dom_node_event_type type); /** * Client calls to set node as client-replaced. @@ -111,12 +111,12 @@ nslayout_error nslayout_dom_node_event( * \param[in] layout The layout to replace an element in. * \param[in] node The DOM node which is to be replaced. * \param[in] replaced The client's replacement object to register with node. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -nslayout_error nslayout_node_event_set_replaced( - nslayout_layout *layout, +nsl_error nsl_node_event_set_replaced( + nsl_layout *layout, dom_event_target *node, - nslayout_replaced *replaced); + nsl_replaced *replaced); /** @@ -126,10 +126,10 @@ nslayout_error nslayout_node_event_set_replaced( * \param[in] node The DOM node which is to be replaced. * \param[in] width Width in pixels. * \param[in] height Height in pixels. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -nslayout_error nslayout_node_event_set_intrinsic_dimensions( - nslayout_layout *layout, +nsl_error nsl_node_event_set_intrinsic_dimensions( + nsl_layout *layout, dom_event_target *node, unsigned int width, unsigned int height); @@ -139,25 +139,25 @@ nslayout_error nslayout_node_event_set_intrinsic_dimensions( * Client calls to tell NSLayout that everything requires reselection. * * \param[in]layout The layout to who's selection context has changed. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -nslayout_error nslayout_selection_context_updated( - nslayout_layout *layout); +nsl_error nsl_selection_context_updated( + nsl_layout *layout); /** * Initialise LibNSLayout * - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -nslayout_error nslayout_init(void); +nsl_error nsl_init(void); /** * Finalise LibNSLayout * - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -nslayout_error nslayout_fini(void); +nsl_error nsl_fini(void); /** * LibNSLayout client callback function @@ -165,12 +165,12 @@ nslayout_error nslayout_fini(void); * \param[in] layout The layout we're making a request for. * \param[in] pw The client's private data for this layout. * \param[in,out] req The request details. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -typedef nslayout_error (*nslayout_callback)( - nslayout_layout *layout, +typedef nsl_error (*nsl_callback)( + nsl_layout *layout, void *pw, - nslayout_request *req); + nsl_request *req); /** * Create a Layout object for a given DOM @@ -181,24 +181,24 @@ typedef nslayout_error (*nslayout_callback)( * \param[in] cb The client's private data for this layout. * \param[in] pw The client's private data for this layout. * \param[out] layout Returns a pointer to the created layout object. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -nslayout_error nslayout_layout_create( +nsl_error nsl_layout_create( dom_document *doc, css_select_ctx *css_ctx, css_media_type *media, - nslayout_callback cb, + nsl_callback cb, void *pw, - nslayout_layout **layout); + nsl_layout **layout); /** * Destroy a Layout object * * \param[in] layout Returns a pointer to the created layout object. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -nslayout_error nslayout_layout_destroy( - nslayout_layout *layout); +nsl_error nsl_layout_destroy( + nsl_layout *layout); /** * Update the viewport for a layout @@ -211,11 +211,11 @@ nslayout_error nslayout_layout_destroy( * \param[in] viewport Viewport dimensions and offset. * \param[in] scale Rendering scale. * \param[in] dpi DPI of render target with viewport. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -nslayout_error nslayout_update_viewport( - nslayout_layout *layout, - nslayout_rect *viewport, +nsl_error nsl_update_viewport( + nsl_layout *layout, + nsl_rect *viewport, css_fixed scale, unsigned int dpi); @@ -225,12 +225,12 @@ nslayout_error nslayout_update_viewport( * \param[in] layout Layout to locate an element in. * \param[in] element Element to get area of. * \param[out] area Returns area with position relative to viewport. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -nslayout_error nslayout_element_get_location( - nslayout_layout *layout, +nsl_error nsl_element_get_location( + nsl_layout *layout, dom_element *element, - nslayout_rect *area); + nsl_rect *area); /** * Find the top-most element at a given point, in terms of z-order. @@ -239,10 +239,10 @@ nslayout_error nslayout_element_get_location( * \param[in] x Mouse x-coordinate (viewport relative). * \param[in] y Mouse y-coordinate (viewport relative). * \param[out] element Returns the element we found. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -nslayout_error nslayout_element_at_point( - nslayout_layout *layout, +nsl_error nsl_element_at_point( + nsl_layout *layout, unsigned int x, unsigned int y, dom_event_target **element); @@ -254,23 +254,23 @@ nslayout_error nslayout_element_at_point( * \param[in] element Element to mark as needing redraw. * \param[in] rel_area Area of element to redraw relative to object's top-left. * May be NULL, to redraw whole element. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -nslayout_error nslayout_layout_dirty_element( - nslayout_layout *layout, +nsl_error nsl_layout_dirty_element( + nsl_layout *layout, dom_element *element, - nslayout_rect *rel_area); + nsl_rect *rel_area); /** * Mark an area as needing redraw. * * \param[in] layout Layout to indicate redraw is required for. * \param[in] area Area to redraw relative to viewport's top-left. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -nslayout_error nslayout_layout_dirty_area( - nslayout_layout *layout, - nslayout_rect *area); +nsl_error nsl_layout_dirty_area( + nsl_layout *layout, + nsl_rect *area); #ifdef __cplusplus } -- cgit v1.2.3