From 244ff9f08dd8c83baba4d44401eae0e8ebb58246 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 19 Jul 2015 10:34:04 +0100 Subject: Add basic buildsystem. --- src/Makefile | 11 +++++++++++ src/layout.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/layout.h | 20 ++++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 src/Makefile create mode 100644 src/layout.c create mode 100644 src/layout.h (limited to 'src') diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..7a6251d --- /dev/null +++ b/src/Makefile @@ -0,0 +1,11 @@ +# +# Makefile for libnslayout +# +# Copyright 2015 Michael Drake +# +# Released under the ISC License (see COPYING file) + +# Sources +DIR_SOURCES := layout.c + +include $(NSBUILD)/Makefile.subdir diff --git a/src/layout.c b/src/layout.c new file mode 100644 index 0000000..dab4855 --- /dev/null +++ b/src/layout.c @@ -0,0 +1,55 @@ +/* + * This file is part of LibNSLayout + * Licensed under the ISC License, http://opensource.org/licenses/ISC + * Copyright 2015 Michael Drake + */ + +#include +#include + +#include "layout.h" + + +/* Publically exported function, documented in include/libnslayout/nslayout.h */ +nslayout_error nslayout_layout_create( + dom_document *doc, + css_select_ctx *css_ctx, + css_media_type *media, + nslayout_callback *cb, + void *pw, + nslayout_layout **layout) +{ + nslayout_layout *l; + + assert(doc != NULL); + assert(css_ctx != NULL); + assert(media != NULL); + assert(cb != NULL); + assert(pw != NULL); + + l = calloc(1, sizeof(nslayout_layout)); + if (l == NULL) { + return NSLAYOUT_NO_MEM; + } + + /* TODO: Decide: ownership will probably be passed to libnslayout */ + l->doc = doc; + l->css_ctx = css_ctx; + l->media = media; + l->cb = cb; + l->pw = pw; + + *layout = l; + return NSLAYOUT_OK; +} + + +/* Publically exported function, documented in include/libnslayout/nslayout.h */ +nslayout_error nslayout_layout_destroy( + nslayout_layout *layout) +{ + /* TODO: free/unref the stuff we own in the layout */ + + free(layout); + return NSLAYOUT_OK; +} diff --git a/src/layout.h b/src/layout.h new file mode 100644 index 0000000..5b43bc6 --- /dev/null +++ b/src/layout.h @@ -0,0 +1,20 @@ +/* + * This file is part of LibNSLayout + * Licensed under the ISC License, http://opensource.org/licenses/ISC + * Copyright 2015 Michael Drake + */ + +#ifndef nslayout_layout_h_ +#define nslayout_layout_h_ + +#include + +struct nslayout_layout { + dom_document *doc; + css_select_ctx *css_ctx; + css_media_type *media; + nslayout_callback *cb; + void *pw; +}; + +#endif -- cgit v1.2.3