« third_party/modest/source/mycss/stack.c
↑ Summary
third_party/modest/source/mycss/tokenizer_global.c »
| 1 | /* | ||||||||||
| 2 | Copyright (C) 2016-2017 Alexander Borisov | ||||||||||
| 3 | |||||||||||
| 4 | This library is free software; you can redistribute it and/or | ||||||||||
| 5 | modify it under the terms of the GNU Lesser General Public | ||||||||||
| 6 | License as published by the Free Software Foundation; either | ||||||||||
| 7 | version 2.1 of the License, or (at your option) any later version. | ||||||||||
| 8 | |||||||||||
| 9 | This library is distributed in the hope that it will be useful, | ||||||||||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||||||||
| 12 | Lesser General Public License for more details. | ||||||||||
| 13 | |||||||||||
| 14 | You should have received a copy of the GNU Lesser General Public | ||||||||||
| 15 | License along with this library; if not, write to the Free Software | ||||||||||
| 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||||||||
| 17 | |||||||||||
| 18 | Author: lex.borisov@gmail.com (Alexander Borisov) | ||||||||||
| 19 | */ | ||||||||||
| 20 | |||||||||||
| 21 | #include "mycss/stylesheet.h" | ||||||||||
| 22 | |||||||||||
| 23 | 0 | mycss_stylesheet_t * mycss_stylesheet_create(void) | |||||||||
| 24 | { | ||||||||||
| 25 | 0 | return (mycss_stylesheet_t*)mycore_calloc(1, sizeof(mycss_stylesheet_t)); | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 0 | mystatus_t mycss_stylesheet_init(mycss_stylesheet_t* stylesheet, mycss_entry_t* entry) | |||||||||
| 29 | { | ||||||||||
| 30 | 0 | stylesheet->entry = entry; | |||||||||
| 31 | |||||||||||
| 32 | 0 | mystatus_t status = mycss_namespace_stylesheet_init(&stylesheet->ns_stylesheet, entry); | |||||||||
| 33 | 0 | ▶ | if(status != MyCSS_STATUS_OK) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 0 | return status; | |||||||||
| 35 | |||||||||||
| 36 | 0 | return MyCSS_STATUS_OK; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 0 | mystatus_t mycss_stylesheet_clean_all(mycss_stylesheet_t* stylesheet) | |||||||||
| 40 | { | ||||||||||
| 41 | 0 | mystatus_t status = mycss_namespace_stylesheet_clean(&stylesheet->ns_stylesheet, stylesheet->entry); | |||||||||
| 42 | 0 | ▶ | if(status != MyCSS_STATUS_OK) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 0 | return status; | |||||||||
| 44 | |||||||||||
| 45 | 0 | memset(stylesheet, 0, sizeof(mycss_stylesheet_t)); | |||||||||
| 46 | |||||||||||
| 47 | 0 | return MyCSS_STATUS_OK; | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 0 | mycss_stylesheet_t * mycss_stylesheet_destroy(mycss_stylesheet_t* stylesheet, bool self_destroy) | |||||||||
| 51 | { | ||||||||||
| 52 | 0 | mycss_namespace_stylesheet_destroy(&stylesheet->ns_stylesheet, stylesheet->entry, false); | |||||||||
| 53 | |||||||||||
| 54 | 0 | ▶ | if(self_destroy) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | 0 | mycore_free(stylesheet); | |||||||||
| 56 | 0 | return NULL; | |||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | 0 | return stylesheet; | |||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | /* print */ | ||||||||||
| 63 | 0 | void mycss_stylesheet_serialization(mycss_stylesheet_t* stylesheet, mycore_callback_serialize_f callback, void* context) | |||||||||
| 64 | { | ||||||||||
| 65 | 0 | mycss_selectors_serialization_list(stylesheet->entry->selectors, stylesheet->sel_list_first, callback, context); | |||||||||
| 66 | 0 | } | |||||||||
| 67 | |||||||||||
| 68 | |||||||||||