mirror of
https://github.com/lexborisov/Modest
synced 2024-11-22 05:41:32 +03:00
80 lines
2.7 KiB
C
80 lines
2.7 KiB
C
/*
|
|
Copyright (C) 2016 Alexander Borisov
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with this library; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
Author: lex.borisov@gmail.com (Alexander Borisov)
|
|
*/
|
|
|
|
#ifndef MyHTML_MyCSS_MYCSS_H
|
|
#define MyHTML_MyCSS_MYCSS_H
|
|
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#ifdef MyCSS_DEBUG
|
|
#define MyCSS_DEBUG_MESSAGE(format, ...) \
|
|
myhtml_print(stderr, "DEBUG: "format"\n", ##__VA_ARGS__)
|
|
#else
|
|
#define MyCSS_DEBUG_MESSAGE(format, ...)
|
|
#endif
|
|
|
|
#ifdef DEBUG_MODE
|
|
#define MyHTML_DEBUG_ERROR(format, ...) \
|
|
myhtml_print(stderr, "DEBUG ERROR: "format"\n", ##__VA_ARGS__)
|
|
#else
|
|
#define MyHTML_DEBUG_ERROR(format, ...)
|
|
#endif
|
|
|
|
#include "mycss/myosi.h"
|
|
#include "mycss/entry.h"
|
|
#include "mycss/tokenizer.h"
|
|
#include "myhtml/myhtml.h"
|
|
#include "myhtml/utils/mcobject_async.h"
|
|
|
|
struct mycss {
|
|
mycss_tokenizer_state_f* parse_state_func;
|
|
};
|
|
|
|
mycss_t * mycss_create(void);
|
|
mycss_status_t mycss_init(mycss_t* mycss);
|
|
mycss_t * mycss_destroy(mycss_t* mycss, bool self_destroy);
|
|
|
|
mycss_status_t mycss_parse(mycss_entry_t* entry, myhtml_encoding_t encoding, const char* css, size_t css_size);
|
|
mycss_status_t mycss_parse_chunk(mycss_entry_t* entry, const char* css, size_t css_size);
|
|
mycss_status_t mycss_parse_chunk_end(mycss_entry_t* entry);
|
|
|
|
size_t mycss_token_begin(mycss_token_t* token);
|
|
size_t mycss_token_length(mycss_token_t* token);
|
|
size_t mycss_token_position(mycss_token_t* token, size_t *return_length);
|
|
mycss_token_type_t mycss_token_type(mycss_token_t* token);
|
|
const char * mycss_token_name_by_type(mycss_token_type_t type);
|
|
size_t mycss_token_data_to_string(mycss_entry_t* entry, mycss_token_t* token, myhtml_string_t* str, bool init_string, bool case_insensitive);
|
|
|
|
myhtml_incoming_buffer_t * mycss_token_buffer_first(mycss_entry_t* entry, mycss_token_t* token);
|
|
|
|
// encoding
|
|
void mycss_encoding_set(mycss_entry_t* entry, myhtml_encoding_t encoding);
|
|
myhtml_encoding_t mycss_encoding_get(mycss_entry_t* entry);
|
|
myhtml_encoding_t mycss_encoding_check_charset_rule(const char* css, size_t size);
|
|
|
|
#ifdef __cplusplus
|
|
} /* extern "C" */
|
|
#endif
|
|
|
|
#endif
|