diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dom/debug.h | 4 | ||||
-rw-r--r-- | src/dom/watcher.c | 26 | ||||
-rw-r--r-- | src/dom/watcher.h | 16 | ||||
-rw-r--r-- | src/layout.c | 44 | ||||
-rw-r--r-- | src/layout.h | 6 | ||||
-rw-r--r-- | src/request.h | 72 | ||||
-rw-r--r-- | src/util/dom-str.c | 10 | ||||
-rw-r--r-- | src/util/dom-str.h | 12 | ||||
-rw-r--r-- | src/util/util.h | 8 |
9 files changed, 99 insertions, 99 deletions
diff --git a/src/dom/debug.h b/src/dom/debug.h index 7d6b186..cbe8559 100644 --- a/src/dom/debug.h +++ b/src/dom/debug.h @@ -8,8 +8,8 @@ * DOM debug */ -#ifndef nslayout_dom_debug_h_ -#define nslayout_dom_debug_h_ +#ifndef nsl_dom_debug_h_ +#define nsl_dom_debug_h_ /** Define to enable DOM trace debug output */ #undef NSL_DOM_TRACE diff --git a/src/dom/watcher.c b/src/dom/watcher.c index d515cf6..db1f8a9 100644 --- a/src/dom/watcher.c +++ b/src/dom/watcher.c @@ -113,9 +113,9 @@ fail: * * \param[in] listener The listener to destroy * \param[in] document The document that the listener was registerd for. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -static nslayout_error nsl__dom_listener_destroy( +static nsl_error nsl__dom_listener_destroy( dom_event_listener *listener, dom_document *document) { @@ -130,7 +130,7 @@ static nslayout_error nsl__dom_listener_destroy( dom_event_listener_unref(listener); - return NSLAYOUT_OK; + return NSL_OK; } @@ -139,9 +139,9 @@ static nslayout_error nsl__dom_listener_destroy( * * \param[out] listener_out Returns a dom listener for watcher's document. * \param[in] watcher DOM watcher object that listener is used for. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -static nslayout_error nsl__dom_listener_create( +static nsl_error nsl__dom_listener_create( dom_event_listener **listener_out, const struct nsl_dom_watcher *watcher) { @@ -183,7 +183,7 @@ static nslayout_error nsl__dom_listener_create( } *listener_out = listener; - return NSLAYOUT_OK; + return NSL_OK; error: nsl__dom_listener_destroy(listener, watcher->document); @@ -192,18 +192,18 @@ error: } /* Exported function, documented in src/dom/watcher.h */ -nslayout_error nsl_dom_watcher_create( +nsl_error nsl_dom_watcher_create( struct nsl_dom_watcher **watcher_out, dom_document *document, nsl_dom_watcher_cb watcher_cb, void *pw) { struct nsl_dom_watcher *watcher; - nslayout_error err; + nsl_error err; watcher = malloc(sizeof(*watcher)); if (watcher == NULL) { - return NSLAYOUT_NO_MEM; + return NSL_NO_MEM; } watcher->document = document; @@ -211,21 +211,21 @@ nslayout_error nsl_dom_watcher_create( watcher->pw = pw; err = nsl__dom_listener_create(&watcher->listener, watcher); - if (err != NSLAYOUT_OK) { + if (err != NSL_OK) { free(watcher); return err; } *watcher_out = watcher; - return NSLAYOUT_OK; + return NSL_OK; } /* Exported function, documented in src/dom/watcher.h */ -nslayout_error nsl_dom_watcher_destroy( +nsl_error nsl_dom_watcher_destroy( struct nsl_dom_watcher *watcher) { nsl__dom_listener_destroy(watcher->listener, watcher->document); free(watcher); - return NSLAYOUT_OK; + return NSL_OK; } diff --git a/src/dom/watcher.h b/src/dom/watcher.h index 0883fd2..2cfa26e 100644 --- a/src/dom/watcher.h +++ b/src/dom/watcher.h @@ -8,8 +8,8 @@ * Interface to DOM mutation watching. */ -#ifndef nslayout_dom_watcher_h_ -#define nslayout_dom_watcher_h_ +#ifndef nsl_dom_watcher_h_ +#define nsl_dom_watcher_h_ struct dom_document; struct nsl_dom_watcher; @@ -34,9 +34,9 @@ enum nsl_dom_watcher_type { * \param[in] node The target node. (Caller yields ownership.) * \param[in] node_type The type of node. * \param[in] pw The dom watcher owner's private data. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -typedef nslayout_error (*nsl_dom_watcher_cb)( +typedef nsl_error (*nsl_dom_watcher_cb)( enum nsl_dom_watcher_type type, dom_event_target *node, dom_node_type node_type, @@ -50,9 +50,9 @@ typedef nslayout_error (*nsl_dom_watcher_cb)( * \param[in] document DOM document to create watcher for. * \param[in] watcher_cb Function to call when dom modification happens. * \param[in] pw Private data passed back to `watcher_cb`. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -nslayout_error nsl_dom_watcher_create( +nsl_error nsl_dom_watcher_create( struct nsl_dom_watcher **watcher_out, dom_document *document, nsl_dom_watcher_cb watcher_cb, @@ -63,9 +63,9 @@ nslayout_error nsl_dom_watcher_create( * Destroy a document change DOM change watcher. * * \param[in] watcher DOM change watcher to destroy. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -nslayout_error nsl_dom_watcher_destroy( +nsl_error nsl_dom_watcher_destroy( struct nsl_dom_watcher *watcher); #endif diff --git a/src/layout.c b/src/layout.c index e4824bf..0c11660 100644 --- a/src/layout.c +++ b/src/layout.c @@ -22,11 +22,11 @@ /** * The layout object for a DOM document */ -struct nslayout_layout { +struct nsl_layout { dom_document *document; css_select_ctx *css_ctx; css_media_type *media; - nslayout_callback cb; + nsl_callback cb; void *pw; struct nsl_dom_watcher *watcher; @@ -34,14 +34,14 @@ struct nslayout_layout { /* Publically exported function, documented in include/libnslayout/nslayout.h */ -nslayout_error nslayout_init(void) +nsl_error nsl_init(void) { return nsl_dom_str_init(); } /* Publically exported function, documented in include/libnslayout/nslayout.h */ -nslayout_error nslayout_fini(void) +nsl_error nsl_fini(void) { return nsl_dom_str_fini(); } @@ -54,15 +54,15 @@ nslayout_error nslayout_fini(void) * \param[in] node The target node. (Caller yields ownership.) * \param[in] node_type The type of node. * \param[in] pw The layout object. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -static nslayout_error nsl_layout_dom_watcher_cb( +static nsl_error nsl_layout_dom_watcher_cb( enum nsl_dom_watcher_type type, dom_event_target *node, dom_node_type node_type, void *pw) { - nslayout_layout *layout = pw; + nsl_layout *layout = pw; UNUSED(type); UNUSED(layout); @@ -77,30 +77,30 @@ static nslayout_error nsl_layout_dom_watcher_cb( dom_node_unref(node); - return NSLAYOUT_OK; + return NSL_OK; } /* Publically exported function, documented in include/libnslayout/nslayout.h */ -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) { - nslayout_layout *l = NULL; - nslayout_error err; + nsl_layout *l = NULL; + nsl_error err; assert(doc != NULL); assert(css_ctx != NULL); assert(media != NULL); assert(cb != NULL); - l = calloc(1, sizeof(nslayout_layout)); + l = calloc(1, sizeof(nsl_layout)); if (l == NULL) { - return NSLAYOUT_NO_MEM; + return NSL_NO_MEM; } /* TODO: Decide: ownership will probably be passed to libnslayout */ @@ -112,29 +112,29 @@ nslayout_error nslayout_layout_create( err = nsl_dom_watcher_create(&l->watcher, l->document, nsl_layout_dom_watcher_cb, l); - if (err != NSLAYOUT_OK) { + if (err != NSL_OK) { return err; } *layout = l; - return NSLAYOUT_OK; + return NSL_OK; } /* Publically exported function, documented in include/libnslayout/nslayout.h */ -nslayout_error nslayout_layout_destroy( - nslayout_layout *layout) +nsl_error nsl_layout_destroy( + nsl_layout *layout) { - nslayout_error err; + nsl_error err; assert(layout != NULL); /* TODO: free/unref the stuff we own in the layout */ err = nsl_dom_watcher_destroy(layout->watcher); - if (err != NSLAYOUT_OK) { + if (err != NSL_OK) { return err; } free(layout); - return NSLAYOUT_OK; + return NSL_OK; } diff --git a/src/layout.h b/src/layout.h index d8fa3b2..22c05e4 100644 --- a/src/layout.h +++ b/src/layout.h @@ -8,9 +8,9 @@ * Layout object handling */ -#ifndef nslayout_layout_h_ -#define nslayout_layout_h_ +#ifndef nsl_layout_h_ +#define nsl_layout_h_ -struct nslayout_layout; +struct nsl_layout; #endif diff --git a/src/request.h b/src/request.h index c28468e..7c21731 100644 --- a/src/request.h +++ b/src/request.h @@ -8,8 +8,8 @@ * Client callback wrappers */ -#ifndef nslayout_request_h_ -#define nslayout_request_h_ +#ifndef nsl_request_h_ +#define nsl_request_h_ #include <libnslayout/nslayout.h> @@ -19,17 +19,17 @@ * \param[in] layout Layout object that the request concerns. * \param[in] url Absolute URL to request replaced object handle for. * \param[out] replaced Returns the replaced element content handle. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -static inline nslayout_error nsl_request_get_resource( - nslayout_layout *layout, +static inline nsl_error nsl_request_get_resource( + nsl_layout *layout, const char *url, - nslayout_replaced **replaced) + nsl_replaced **replaced) { - nslayout_error err; - nslayout_request req; + nsl_error err; + nsl_request req; - req.type = NSLAYOUT_GET_RESOURCE; + req.type = NSL_GET_RESOURCE; req.request.get_resource.url = url; err = layout->cb(layout, layout->pw, &req); @@ -44,17 +44,17 @@ static inline nslayout_error nsl_request_get_resource( * \param[in] layout Layout object that the request concerns. * \param[in] element DOM element that needs replacement object. * \param[out] replaced Returns the replaced element content handle. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -static inline nslayout_error nsl_request_create_replaced( - nslayout_layout *layout, +static inline nsl_error nsl_request_create_replaced( + nsl_layout *layout, dom_element *element, - nslayout_replaced **replaced) + nsl_replaced **replaced) { - nslayout_error err; - nslayout_request req; + nsl_error err; + nsl_request req; - req.type = NSLAYOUT_CREATE_REPLACED; + req.type = NSL_CREATE_REPLACED; req.request.create_replaced.element = element; err = layout->cb(layout, layout->pw, &req); @@ -68,16 +68,16 @@ static inline nslayout_error nsl_request_create_replaced( * * \param[in] layout Layout object being rendered. * \param[in] list Render list to render. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -static inline nslayout_error nsl_request_render( - nslayout_layout *layout, - nslayout_render_list *list) +static inline nsl_error nsl_request_render( + nsl_layout *layout, + nsl_render_list *list) { - nslayout_error err; - nslayout_request req; + nsl_error err; + nsl_request req; - req.type = NSLAYOUT_RENDER; + req.type = NSL_RENDER; req.request.render.list = list; err = layout->cb(layout, layout->pw, &req); @@ -91,17 +91,17 @@ static inline nslayout_error nsl_request_render( * \param[in] layout Layout object that the request concerns. * \param[in] width The layout's full width. * \param[in] height The layout's full height. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -static inline nslayout_error nsl_request_set_extents( - nslayout_layout *layout, +static inline nsl_error nsl_request_set_extents( + nsl_layout *layout, unsigned int width, unsigned int height) { - nslayout_error err; - nslayout_request req; + nsl_error err; + nsl_request req; - req.type = NSLAYOUT_SET_EXTENTS; + req.type = NSL_SET_EXTENTS; req.request.set_extents.width = width; req.request.set_extents.height = height; @@ -117,18 +117,18 @@ static inline nslayout_error nsl_request_set_extents( * \param[in] replaced Replaced object to get intrinsic size of. * \param[out] width Returns the replaced object's width. * \param[out] height Returns the replaced object's height. - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -static inline nslayout_error nsl_request_get_intrinsic_size( - nslayout_layout *layout, - nslayout_replaced *replaced, +static inline nsl_error nsl_request_get_intrinsic_size( + nsl_layout *layout, + nsl_replaced *replaced, unsigned int *width, unsigned int *height) { - nslayout_error err; - nslayout_request req; + nsl_error err; + nsl_request req; - req.type = NSLAYOUT_GET_INTRINSIC_SIZE; + req.type = NSL_GET_INTRINSIC_SIZE; req.request.get_intrinsic_size.replaced = replaced; err = layout->cb(layout, layout->pw, &req); diff --git a/src/util/dom-str.c b/src/util/dom-str.c index 3c0865a..db53c76 100644 --- a/src/util/dom-str.c +++ b/src/util/dom-str.c @@ -23,9 +23,9 @@ dom_string *nsl_dom_str_characterdata_modified; /* Exported function, documented in src/util/dom-str.h */ -nslayout_error nsl_dom_str_init(void) +nsl_error nsl_dom_str_init(void) { - nslayout_error err; + nsl_error err; dom_exception exc; exc = dom_string_create((const uint8_t *)"DOMNodeInserted", @@ -59,7 +59,7 @@ nslayout_error nsl_dom_str_init(void) goto out; } - err = NSLAYOUT_OK; + err = NSL_OK; out: if (exc != DOM_NO_ERR) { printf("Failed to initialise dom_str!\n"); @@ -72,7 +72,7 @@ out: /* Exported function, documented in src/util/dom-str.h */ -nslayout_error nsl_dom_str_fini(void) +nsl_error nsl_dom_str_fini(void) { dom_string_unref(nsl_dom_str_node_inserted); dom_string_unref(nsl_dom_str_node_removed); @@ -80,5 +80,5 @@ nslayout_error nsl_dom_str_fini(void) dom_string_unref(nsl_dom_str_attr_modified); dom_string_unref(nsl_dom_str_characterdata_modified); - return NSLAYOUT_OK; + return NSL_OK; } diff --git a/src/util/dom-str.h b/src/util/dom-str.h index 9ce7bb9..fb2d0ff 100644 --- a/src/util/dom-str.h +++ b/src/util/dom-str.h @@ -8,8 +8,8 @@ * Layout object handling */ -#ifndef nslayout_util_dom_str_h_ -#define nslayout_util_dom_str_h_ +#ifndef nsl_util_dom_str_h_ +#define nsl_util_dom_str_h_ extern dom_string *nsl_dom_str_node_inserted; extern dom_string *nsl_dom_str_node_removed; @@ -20,15 +20,15 @@ extern dom_string *nsl_dom_str_characterdata_modified; /** * Create the internal DOM strings * - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -nslayout_error nsl_dom_str_init(void); +nsl_error nsl_dom_str_init(void); /** * Unref the internal DOM strings * - * \return NSLAYOUT_OK on success, appropriate error otherwise. + * \return NSL_OK on success, appropriate error otherwise. */ -nslayout_error nsl_dom_str_fini(void); +nsl_error nsl_dom_str_fini(void); #endif diff --git a/src/util/util.h b/src/util/util.h index f63f40f..5bb661e 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -8,8 +8,8 @@ * Layout object handling */ -#ifndef nslayout_util_util_h_ -#define nslayout_util_util_h_ +#ifndef nsl_util_util_h_ +#define nsl_util_util_h_ #ifndef UNUSED #define UNUSED(x_) (void)(x_) @@ -19,7 +19,7 @@ #define SLEN(x_) (sizeof((x_)) - 1) #endif -#define NSL_DOM_ERR(x_) ((x_ << 8) | NSLAYOUT_LIBDOM) -#define NSL_CSS_ERR(x_) ((x_ << 8) | NSLAYOUT_LIBCSS) +#define NSL_DOM_ERR(x_) ((x_ << 8) | NSL_LIBDOM) +#define NSL_CSS_ERR(x_) ((x_ << 8) | NSL_LIBCSS) #endif |