/contrib/network/netsurf/include/cursor.h |
---|
0,0 → 1,41 |
/* |
* Copyright 2009 Vincent Sanders <vince@simtec.co.uk> |
* |
* This file is part of libnsfb, http://www.netsurf-browser.org/ |
* Licenced under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* |
* This is the *internal* interface for the cursor. |
*/ |
#ifndef CURSOR_H |
#define CURSOR_H 1 |
struct nsfb_cursor_s { |
bool plotted; |
nsfb_bbox_t loc; |
/* current cursor image */ |
const nsfb_colour_t *pixel; |
int bmp_width; |
int bmp_height; |
int bmp_stride; |
int hotspot_x; |
int hotspot_y; |
/* current saved image */ |
nsfb_bbox_t savloc; |
nsfb_colour_t *sav; |
int sav_size; |
int sav_width; |
int sav_height; |
}; |
/** Plot the cursor saving the image underneath. */ |
bool nsfb_cursor_plot(nsfb_t *nsfb, struct nsfb_cursor_s *cursor); |
/** Clear the cursor restoring the image underneath */ |
bool nsfb_cursor_clear(nsfb_t *nsfb, struct nsfb_cursor_s *cursor); |
#endif /* CURSOR_H */ |
/contrib/network/netsurf/include/libnsbmp.h |
---|
0,0 → 1,112 |
/* |
* Copyright 2006 Richard Wilson <richard.wilson@netsurf-browser.org> |
* Copyright 2008 Sean Fox <dyntryx@gmail.com> |
* |
* This file is part of NetSurf's libnsbmp, http://www.netsurf-browser.org/ |
* Licenced under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
*/ |
/** \file |
* BMP file decoding (interface). |
*/ |
#ifndef libnsbmp_h_ |
#define libnsbmp_h_ |
#include <stdbool.h> |
#include <stdint.h> |
#include <stddef.h> |
/* bmp flags */ |
#define BMP_NEW 0 |
#define BMP_OPAQUE (1 << 0) /** image is opaque (as opposed to having an alpha mask) */ |
#define BMP_CLEAR_MEMORY (1 << 1) /** memory should be wiped */ |
/* error return values */ |
typedef enum { |
BMP_OK = 0, |
BMP_INSUFFICIENT_MEMORY = 1, |
BMP_INSUFFICIENT_DATA = 2, |
BMP_DATA_ERROR = 3 |
} bmp_result; |
/* encoding types */ |
typedef enum { |
BMP_ENCODING_RGB = 0, |
BMP_ENCODING_RLE8 = 1, |
BMP_ENCODING_RLE4 = 2, |
BMP_ENCODING_BITFIELDS = 3 |
} bmp_encoding; |
/* API for Bitmap callbacks |
*/ |
typedef void* (*bmp_bitmap_cb_create)(int width, int height, unsigned int state); |
typedef void (*bmp_bitmap_cb_destroy)(void *bitmap); |
typedef unsigned char* (*bmp_bitmap_cb_get_buffer)(void *bitmap); |
typedef size_t (*bmp_bitmap_cb_get_bpp)(void *bitmap); |
/* The Bitmap callbacks function table |
*/ |
typedef struct bmp_bitmap_callback_vt_s { |
bmp_bitmap_cb_create bitmap_create; /**< Create a bitmap. */ |
bmp_bitmap_cb_destroy bitmap_destroy; /**< Free a bitmap. */ |
bmp_bitmap_cb_get_buffer bitmap_get_buffer; /**< Return a pointer to the pixel data in a bitmap. */ |
bmp_bitmap_cb_get_bpp bitmap_get_bpp; /**< Find the width of a pixel row in bytes. */ |
} bmp_bitmap_callback_vt; |
typedef struct bmp_image { |
bmp_bitmap_callback_vt bitmap_callbacks; /**< callbacks for bitmap functions */ |
uint8_t *bmp_data; /** pointer to BMP data */ |
uint32_t width; /** width of BMP (valid after _analyse) */ |
uint32_t height; /** heigth of BMP (valid after _analyse) */ |
bool decoded; /** whether the image has been decoded */ |
void *bitmap; /** decoded image */ |
/** Internal members are listed below |
*/ |
uint32_t buffer_size; /** total number of bytes of BMP data available */ |
bmp_encoding encoding; /** pixel encoding type */ |
uint32_t bitmap_offset; /** offset of bitmap data */ |
uint16_t bpp; /** bits per pixel */ |
uint32_t colours; /** number of colours */ |
uint32_t *colour_table; /** colour table */ |
bool limited_trans; /** whether to use bmp's limited transparency */ |
uint32_t trans_colour; /** colour to display for "transparent" pixels when |
* using limited transparency */ |
bool reversed; /** scanlines are top to bottom */ |
bool ico; /** image is part of an ICO, mask follows */ |
bool opaque; /** true if the bitmap does not contain an alpha channel */ |
uint32_t mask[4]; /** four bitwise mask */ |
int32_t shift[4]; /** four bitwise shifts */ |
uint32_t transparent_index; /** colour representing "transparency" in the bitmap */ |
} bmp_image; |
typedef struct ico_image { |
bmp_image bmp; |
struct ico_image *next; |
} ico_image; |
typedef struct ico_collection { |
bmp_bitmap_callback_vt bitmap_callbacks; /**< callbacks for bitmap functions */ |
uint16_t width; /** width of largest BMP */ |
uint16_t height; /** heigth of largest BMP */ |
/** Internal members are listed below |
*/ |
uint8_t *ico_data; /** pointer to ICO data */ |
uint32_t buffer_size; /** total number of bytes of ICO data available */ |
ico_image *first; |
} ico_collection; |
void bmp_create(bmp_image *bmp, bmp_bitmap_callback_vt *bitmap_callbacks); |
void ico_collection_create(ico_collection *ico, |
bmp_bitmap_callback_vt *bitmap_callbacks); |
bmp_result bmp_analyse(bmp_image *bmp, size_t size, uint8_t *data); |
bmp_result bmp_decode(bmp_image *bmp); |
bmp_result bmp_decode_trans(bmp_image *bmp, uint32_t transparent_colour); |
void bmp_finalise(bmp_image *bmp); |
bmp_result ico_analyse(ico_collection *ico, size_t size, uint8_t *data); |
bmp_image *ico_find(ico_collection *ico, uint16_t width, uint16_t height); |
void ico_finalise(ico_collection *ico); |
#endif |
/contrib/network/netsurf/include/libnsfb.h |
---|
0,0 → 1,161 |
/* |
* Copyright 2009 Vincent Sanders <vince@simtec.co.uk> |
* |
* This file is part of libnsfb, http://www.netsurf-browser.org/ |
* Licenced under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* |
* This is the exported interface for the libnsfb graphics library. |
*/ |
#ifndef _LIBNSFB_H |
#define _LIBNSFB_H 1 |
#include <stdint.h> |
typedef struct nsfb_palette_s nsfb_palette_t; |
typedef struct nsfb_cursor_s nsfb_cursor_t; |
typedef struct nsfb_s nsfb_t; |
typedef struct nsfb_event_s nsfb_event_t; |
/** co-ordinate for plotting operations */ |
typedef struct nsfb_point_s { |
int x; |
int y; |
} nsfb_point_t; |
/** bounding box for plotting operations */ |
typedef struct nsfb_bbox_s { |
int x0; |
int y0; |
int x1; |
int y1; |
} nsfb_bbox_t; |
/** The type of framebuffer surface. */ |
enum nsfb_type_e { |
NSFB_SURFACE_NONE = 0, /**< No surface */ |
NSFB_SURFACE_RAM, /**< RAM surface */ |
NSFB_SURFACE_SDL, /**< SDL surface */ |
NSFB_SURFACE_LINUX, /**< Linux framebuffer surface */ |
NSFB_SURFACE_VNC, /**< VNC surface */ |
NSFB_SURFACE_ABLE, /**< ABLE framebuffer surface */ |
NSFB_SURFACE_X, /**< X windows surface */ |
NSFB_SURFACE_KOLIBRI |
}; |
enum nsfb_format_e { |
NSFB_FMT_ANY = 0, /* No specific format - use surface default */ |
NSFB_FMT_XBGR8888, /* 32bpp Blue Green Red */ |
NSFB_FMT_XRGB8888, /* 32bpp Red Green Blue */ |
NSFB_FMT_ABGR8888, /* 32bpp Alpga Blue Green Red */ |
NSFB_FMT_ARGB8888, /* 32bpp Alpga Red Green Blue */ |
NSFB_FMT_RGB888, /* 24 bpp Alpga Red Green Blue */ |
NSFB_FMT_ARGB1555, /* 16 bpp 555 */ |
NSFB_FMT_RGB565, /* 16 bpp 565 */ |
NSFB_FMT_I8, /* 8bpp indexed */ |
NSFB_FMT_I4, /* 4bpp indexed */ |
NSFB_FMT_I1, /* black and white */ |
}; |
/** Select frontend type from a name. |
* |
* @param name The name to select a frontend. |
* @return The surface type or NSFB_SURFACE_NONE if frontend with specified |
* name was not available |
*/ |
enum nsfb_type_e nsfb_type_from_name(const char *name); |
/** Create a nsfb context. |
* |
* This creates a framebuffer surface context. |
* |
* @param surface_type The type of surface to create a context for. |
*/ |
nsfb_t *nsfb_new(const enum nsfb_type_e surface_type); |
/** Initialise selected surface context. |
* |
* @param nsfb The context returned from ::nsfb_init |
*/ |
int nsfb_init(nsfb_t *nsfb); |
/** Free nsfb context. |
* |
* This shuts down and releases all resources associated with an nsfb context. |
* |
* @param nsfb The context returned from ::nsfb_new to free |
*/ |
int nsfb_free(nsfb_t *nsfb); |
/** Claim an area of screen to be redrawn. |
* |
* Informs the nsfb library that an area of screen will be directly |
* updated by the user program. This is neccisarry so the library can |
* ensure the soft cursor plotting is correctly handled. After the |
* update has been perfomed ::nsfb_update should be called. |
* |
* @param box The bounding box of the area which might be altered. |
*/ |
int nsfb_claim(nsfb_t *nsfb, nsfb_bbox_t *box); |
/** Update an area of screen which has been redrawn. |
* |
* Informs the nsfb library that an area of screen has been directly |
* updated by the user program. Some surfaces only show the update on |
* notification. The area updated does not neccisarrily have to |
* corelate with a previous ::nsfb_claim bounding box, however if the |
* redrawn area is larger than the claimed area pointer plotting |
* artifacts may occour. |
* |
* @param box The bounding box of the area which has been altered. |
*/ |
int nsfb_update(nsfb_t *nsfb, nsfb_bbox_t *box); |
/** Obtain the geometry of a nsfb context. |
* |
* @param width a variable to store the framebuffer width in or NULL |
* @param height a variable to store the framebuffer height in or NULL |
* @param format a variable to store the framebuffer format in or NULL |
*/ |
int nsfb_get_geometry(nsfb_t *nsfb, int *width, int *height, enum nsfb_format_e *format); |
/** Alter the geometry of a surface |
* |
* @param nsfb The context to alter. |
* @param width The new display width. |
* @param height The new display height. |
* @param format The desired surface format. |
*/ |
int nsfb_set_geometry(nsfb_t *nsfb, int width, int height, enum nsfb_format_e format); |
/** Set parameters a surface |
* |
* Some surface types can take additional parameters for |
* attributes. For example the linux surface uses this to allow the |
* setting of a different output device |
* |
* @param nsfb The surface to alter. |
* @param parameters The parameters for the surface. |
*/ |
int nsfb_set_parameters(nsfb_t *nsfb, const char *parameters); |
/** Obtain the buffer memory base and stride. |
* |
* @param nsfb The context to read. |
*/ |
int nsfb_get_buffer(nsfb_t *nsfb, uint8_t **ptr, int *linelen); |
/** Dump the surface to fd in PPM format |
*/ |
bool nsfb_dump(nsfb_t *nsfb, int fd); |
#endif |
/* |
* Local variables: |
* c-basic-offset: 4 |
* tab-width: 8 |
* End: |
*/ |
/contrib/network/netsurf/include/libnsfb_cursor.h |
---|
0,0 → 1,48 |
/* |
* Copyright 2009 Vincent Sanders <vince@simtec.co.uk> |
* |
* This file is part of libnsfb, http://www.netsurf-browser.org/ |
* Licenced under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* |
* This is the exported interface for the libnsfb graphics library. |
*/ |
#ifndef _LIBNSFB_CURSOR_H |
#define _LIBNSFB_CURSOR_H 1 |
/** Initialise the cursor. |
*/ |
bool nsfb_cursor_init(nsfb_t *nsfb); |
/** Set cursor parameters. |
* |
* Set a cursor bitmap, the cursor will be shown at the location set by |
* nsfb_cursor_loc_set. The pixel data may be referenced untill the cursor |
* is altered or cleared |
* |
* @param nsfb The frambuffer context |
* @param pixel The cursor bitmap data |
* @param bmp_width The width of the cursor bitmap |
* @param bmp_height The height of the cursor bitmap |
* @param bmp_stride The cursor bitmap's row stride |
* @param hotspot_x Coordinate within cursor image to place over cursor loc |
* @param hotspot_y Coordinate within cursor image to place over cursor loc |
* |
* (hot_spot_x, hot_spot_y) is from top left. (0, 0) means top left pixel of |
* cursor bitmap is to be rendered over the cursor location. |
*/ |
bool nsfb_cursor_set(nsfb_t *nsfb, const nsfb_colour_t *pixel, int bmp_width, int bmp_height, int bmp_stride, int hotspot_x, int hotspot_y); |
/** Set cursor location. |
* |
* @param nsfb The frambuffer context. |
* @param loc The location of the cursor |
*/ |
bool nsfb_cursor_loc_set(nsfb_t *nsfb, const nsfb_bbox_t *loc); |
/** get the cursor location */ |
bool nsfb_cursor_loc_get(nsfb_t *nsfb, nsfb_bbox_t *loc); |
#endif |
/contrib/network/netsurf/include/libnsfb_event.h |
---|
0,0 → 1,219 |
/* |
* Copyright 2009 Vincent Sanders <vince@simtec.co.uk> |
* |
* This file is part of libnsfb, http://www.netsurf-browser.org/ |
* Licenced under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* |
* This is the exported interface for the libnsfb graphics library. |
*/ |
#ifndef _LIBNSFB_EVENT_H |
#define _LIBNSFB_EVENT_H 1 |
enum nsfb_event_type_e { |
NSFB_EVENT_NONE, |
NSFB_EVENT_CONTROL, |
NSFB_EVENT_KEY_DOWN, |
NSFB_EVENT_KEY_UP, |
NSFB_EVENT_MOVE_RELATIVE, |
NSFB_EVENT_MOVE_ABSOLUTE, |
}; |
/** keycodes which mostly map to ascii chars */ |
enum nsfb_key_code_e { |
NSFB_KEY_UNKNOWN = 0, |
NSFB_KEY_BACKSPACE = 8, |
NSFB_KEY_TAB = 9, |
NSFB_KEY_LF = 10, |
NSFB_KEY_CLEAR = 12, |
NSFB_KEY_RETURN = 13, |
NSFB_KEY_PAUSE = 19, |
NSFB_KEY_ESCAPE = 27, |
NSFB_KEY_SPACE = 32, |
NSFB_KEY_EXCLAIM = 33, |
NSFB_KEY_QUOTEDBL = 34, |
NSFB_KEY_HASH = 35, |
NSFB_KEY_DOLLAR = 36, |
NSFB_KEY_AMPERSAND = 38, |
NSFB_KEY_QUOTE = 39, |
NSFB_KEY_LEFTPAREN = 40, |
NSFB_KEY_RIGHTPAREN = 41, |
NSFB_KEY_ASTERISK = 42, |
NSFB_KEY_PLUS = 43, |
NSFB_KEY_COMMA = 44, |
NSFB_KEY_MINUS = 45, |
NSFB_KEY_PERIOD = 46, |
NSFB_KEY_SLASH = 47, |
NSFB_KEY_0 = 48, |
NSFB_KEY_1 = 49, |
NSFB_KEY_2 = 50, |
NSFB_KEY_3 = 51, |
NSFB_KEY_4 = 52, |
NSFB_KEY_5 = 53, |
NSFB_KEY_6 = 54, |
NSFB_KEY_7 = 55, |
NSFB_KEY_8 = 56, |
NSFB_KEY_9 = 57, |
NSFB_KEY_COLON = 58, |
NSFB_KEY_SEMICOLON = 59, |
NSFB_KEY_LESS = 60, |
NSFB_KEY_EQUALS = 61, |
NSFB_KEY_GREATER = 62, |
NSFB_KEY_QUESTION = 63, |
NSFB_KEY_AT = 64, |
NSFB_KEY_LEFTBRACKET = 91, |
NSFB_KEY_BACKSLASH = 92, |
NSFB_KEY_RIGHTBRACKET = 93, |
NSFB_KEY_CARET = 94, |
NSFB_KEY_UNDERSCORE = 95, |
NSFB_KEY_BACKQUOTE = 96, |
NSFB_KEY_a = 97, |
NSFB_KEY_b = 98, |
NSFB_KEY_c = 99, |
NSFB_KEY_d = 100, |
NSFB_KEY_e = 101, |
NSFB_KEY_f = 102, |
NSFB_KEY_g = 103, |
NSFB_KEY_h = 104, |
NSFB_KEY_i = 105, |
NSFB_KEY_j = 106, |
NSFB_KEY_k = 107, |
NSFB_KEY_l = 108, |
NSFB_KEY_m = 109, |
NSFB_KEY_n = 110, |
NSFB_KEY_o = 111, |
NSFB_KEY_p = 112, |
NSFB_KEY_q = 113, |
NSFB_KEY_r = 114, |
NSFB_KEY_s = 115, |
NSFB_KEY_t = 116, |
NSFB_KEY_u = 117, |
NSFB_KEY_v = 118, |
NSFB_KEY_w = 119, |
NSFB_KEY_x = 120, |
NSFB_KEY_y = 121, |
NSFB_KEY_z = 122, |
NSFB_KEY_DELETE = 127, |
NSFB_KEY_KP0 = 256, |
NSFB_KEY_KP1 = 257, |
NSFB_KEY_KP2 = 258, |
NSFB_KEY_KP3 = 259, |
NSFB_KEY_KP4 = 260, |
NSFB_KEY_KP5 = 261, |
NSFB_KEY_KP6 = 262, |
NSFB_KEY_KP7 = 263, |
NSFB_KEY_KP8 = 264, |
NSFB_KEY_KP9 = 265, |
NSFB_KEY_KP_PERIOD = 266, |
NSFB_KEY_KP_DIVIDE = 267, |
NSFB_KEY_KP_MULTIPLY = 268, |
NSFB_KEY_KP_MINUS = 269, |
NSFB_KEY_KP_PLUS = 270, |
NSFB_KEY_KP_ENTER = 271, |
NSFB_KEY_KP_EQUALS = 272, |
NSFB_KEY_UP = 273, |
NSFB_KEY_DOWN = 274, |
NSFB_KEY_RIGHT = 275, |
NSFB_KEY_LEFT = 276, |
NSFB_KEY_INSERT = 277, |
NSFB_KEY_HOME = 278, |
NSFB_KEY_END = 279, |
NSFB_KEY_PAGEUP = 280, |
NSFB_KEY_PAGEDOWN = 281, |
/* Function keys */ |
NSFB_KEY_F1 = 282, |
NSFB_KEY_F2 = 283, |
NSFB_KEY_F3 = 284, |
NSFB_KEY_F4 = 285, |
NSFB_KEY_F5 = 286, |
NSFB_KEY_F6 = 287, |
NSFB_KEY_F7 = 288, |
NSFB_KEY_F8 = 289, |
NSFB_KEY_F9 = 290, |
NSFB_KEY_F10 = 291, |
NSFB_KEY_F11 = 292, |
NSFB_KEY_F12 = 293, |
NSFB_KEY_F13 = 294, |
NSFB_KEY_F14 = 295, |
NSFB_KEY_F15 = 296, |
/* Key state modifier keys */ |
NSFB_KEY_NUMLOCK = 300, |
NSFB_KEY_CAPSLOCK = 301, |
NSFB_KEY_SCROLLOCK = 302, |
NSFB_KEY_RSHIFT = 303, |
NSFB_KEY_LSHIFT = 304, |
NSFB_KEY_RCTRL = 305, |
NSFB_KEY_LCTRL = 306, |
NSFB_KEY_RALT = 307, |
NSFB_KEY_LALT = 308, |
NSFB_KEY_RMETA = 309, |
NSFB_KEY_LMETA = 310, |
NSFB_KEY_LSUPER = 311, |
NSFB_KEY_RSUPER = 312, |
NSFB_KEY_MODE = 313, |
NSFB_KEY_COMPOSE = 314, |
/* Miscellaneous function keys */ |
NSFB_KEY_HELP = 315, |
NSFB_KEY_PRINT = 316, |
NSFB_KEY_SYSREQ = 317, |
NSFB_KEY_BREAK = 318, |
NSFB_KEY_MENU = 319, |
NSFB_KEY_POWER = 320, |
NSFB_KEY_EURO = 321, |
NSFB_KEY_UNDO = 322, |
/* mouse buttons */ |
NSFB_KEY_MOUSE_1 = 401, |
NSFB_KEY_MOUSE_2 = 402, |
NSFB_KEY_MOUSE_3 = 403, |
NSFB_KEY_MOUSE_4 = 404, |
NSFB_KEY_MOUSE_5 = 405, |
}; |
enum nsfb_control_e { |
NSFB_CONTROL_NONE, |
NSFB_CONTROL_TIMEOUT, /* timeout event */ |
NSFB_CONTROL_QUIT, /* surface handler quit event */ |
}; |
struct nsfb_event_s { |
enum nsfb_event_type_e type; |
union { |
enum nsfb_key_code_e keycode; |
enum nsfb_control_e controlcode; |
struct { |
int x; |
int y; |
int z; |
} vector; |
} value; |
}; |
/** Process input events. |
* |
* Gather events from a frontend. |
* |
* @param nsfb The library handle. |
* @param event The event structure to fill. |
* @param timeout The number of milliseconds to wait for input, -1 is wait |
* forever, 0 returns immediately. |
* @return If the /a event structure is updated true else false. |
*/ |
bool nsfb_event(nsfb_t *nsfb, nsfb_event_t *event, int timeout); |
#endif |
/* |
* Local variables: |
* c-basic-offset: 4 |
* tab-width: 8 |
* End: |
*/ |
/contrib/network/netsurf/include/libnsfb_plot.h |
---|
0,0 → 1,169 |
/* |
* Copyright 2009 Vincent Sanders <vince@simtec.co.uk> |
* |
* This file is part of libnsfb, http://www.netsurf-browser.org/ |
* Licenced under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* |
* This is the exported plotter interface for the libnsfb graphics library. |
*/ |
#ifndef _LIBNSFB_PLOT_H |
#define _LIBNSFB_PLOT_H 1 |
/** representation of a colour. |
* |
* The colour value comprises of four components arranged in the order ABGR: |
* bits 24-31 are the alpha value and represent the opacity. 0 is |
* transparent i.e. there would be no change in the target surface if |
* this colour were to be used and 0xFF is opaque. |
* |
* bits 16-23 are the Blue component of the colour. |
* |
* bits 8-15 are the Green component of the colour. |
* |
* bits 0-7 are the Red component of the colour. |
*/ |
typedef uint32_t nsfb_colour_t; |
/** |
* Type of plot operation |
*/ |
typedef enum nsfb_plot_optype_e { |
NFSB_PLOT_OPTYPE_NONE = 0, /**< No operation */ |
NFSB_PLOT_OPTYPE_SOLID, /**< Solid colour */ |
NFSB_PLOT_OPTYPE_PATTERN, /**< Pattern plot */ |
} nsfb_plot_optype_t; |
/** pen colour and raster operation for plotting primatives. */ |
typedef struct nsfb_plot_pen_s { |
nsfb_plot_optype_t stroke_type; /**< Stroke plot type */ |
int stroke_width; /**< Width of stroke, in pixels */ |
nsfb_colour_t stroke_colour; /**< Colour of stroke */ |
uint32_t stroke_pattern; |
nsfb_plot_optype_t fill_type; /**< Fill plot type */ |
nsfb_colour_t fill_colour; /**< Colour of fill */ |
} nsfb_plot_pen_t; |
/** path operation type. */ |
typedef enum nsfb_plot_pathop_type_e { |
NFSB_PLOT_PATHOP_MOVE, |
NFSB_PLOT_PATHOP_LINE, |
NFSB_PLOT_PATHOP_QUAD, |
NFSB_PLOT_PATHOP_CUBIC, |
} nsfb_plot_pathop_type_t; |
/** path element */ |
typedef struct nsfb_plot_pathop_s { |
nsfb_plot_pathop_type_t operation; |
nsfb_point_t point; |
} nsfb_plot_pathop_t; |
/** Sets a clip rectangle for subsequent plots. |
* |
* Sets a clipping area which constrains all subsequent plotting operations. |
* The clipping area must lie within the framebuffer visible screen or false |
* will be returned and the new clipping area not set. |
*/ |
bool nsfb_plot_set_clip(nsfb_t *nsfb, nsfb_bbox_t *clip); |
/** Get the previously set clipping region. |
*/ |
bool nsfb_plot_get_clip(nsfb_t *nsfb, nsfb_bbox_t *clip); |
/** Clears plotting area to a flat colour. |
*/ |
bool nsfb_plot_clg(nsfb_t *nsfb, nsfb_colour_t c); |
/** Plots a rectangle outline. |
* |
* The line can be solid, dotted or dashed. Top left corner at (x0,y0) and |
* rectangle has given width and height. |
*/ |
bool nsfb_plot_rectangle(nsfb_t *nsfb, nsfb_bbox_t *rect, int line_width, nsfb_colour_t c, bool dotted, bool dashed); |
/** Plots a filled rectangle. Top left corner at (x0,y0), bottom |
* right corner at (x1,y1). Note: (x0,y0) is inside filled area, |
* but (x1,y1) is below and to the right. See diagram below. |
*/ |
bool nsfb_plot_rectangle_fill(nsfb_t *nsfb, nsfb_bbox_t *rect, nsfb_colour_t c); |
/** Plots a line. |
* |
* Draw a line from (x0,y0) to (x1,y1). Coordinates are at centre of line |
* width/thickness. |
*/ |
bool nsfb_plot_line(nsfb_t *nsfb, nsfb_bbox_t *line, nsfb_plot_pen_t *pen); |
/** Plots a number of lines. |
* |
* Draw a series of lines. |
*/ |
bool nsfb_plot_lines(nsfb_t *nsfb, int linec, nsfb_bbox_t *line, nsfb_plot_pen_t *pen); |
/** Plots a number of connected lines. |
* |
* Draw a series of connected lines. |
*/ |
bool nsfb_plot_polylines(nsfb_t *nsfb, int pointc, const nsfb_point_t *points, nsfb_plot_pen_t *pen); |
/** Plots a filled polygon. |
* |
* Plots a filled polygon with straight lines between points. The lines around |
* the edge of the ploygon are not plotted. The polygon is filled with a |
* non-zero winding rule. |
* |
* |
*/ |
bool nsfb_plot_polygon(nsfb_t *nsfb, const int *p, unsigned int n, nsfb_colour_t fill); |
/** Plot an ellipse. |
*/ |
bool nsfb_plot_ellipse(nsfb_t *nsfb, nsfb_bbox_t *ellipse, nsfb_colour_t c); |
/** Plot a filled ellipse. |
*/ |
bool nsfb_plot_ellipse_fill(nsfb_t *nsfb, nsfb_bbox_t *ellipse, nsfb_colour_t c); |
/** Plots an arc. |
* |
* around (x,y), from anticlockwise from angle1 to angle2. Angles are measured |
* anticlockwise from horizontal, in degrees. |
*/ |
bool nsfb_plot_arc(nsfb_t *nsfb, int x, int y, int radius, int angle1, int angle2, nsfb_colour_t c); |
/** Plots an alpha blended pixel. |
* |
* plots an alpha blended pixel. |
*/ |
bool nsfb_plot_point(nsfb_t *nsfb, int x, int y, nsfb_colour_t c); |
bool nsfb_plot_cubic_bezier(nsfb_t *nsfb, nsfb_bbox_t *curve, nsfb_point_t *ctrla, nsfb_point_t *ctrlb, nsfb_plot_pen_t *pen); |
bool nsfb_plot_quadratic_bezier(nsfb_t *nsfb, nsfb_bbox_t *curve, nsfb_point_t *ctrla, nsfb_plot_pen_t *pen); |
bool nsfb_plot_path(nsfb_t *nsfb, int pathc, nsfb_plot_pathop_t *pathop, nsfb_plot_pen_t *pen); |
/** copy an area of screen |
* |
* Copy an area of the display. |
*/ |
bool nsfb_plot_copy(nsfb_t *srcfb, nsfb_bbox_t *srcbox, nsfb_t *dstfb, nsfb_bbox_t *dstbox); |
/** Plot bitmap. |
*/ |
bool nsfb_plot_bitmap(nsfb_t *nsfb, const nsfb_bbox_t *loc, const nsfb_colour_t *pixel, int bmp_width, int bmp_height, int bmp_stride, bool alpha); |
/** Plot an 8 bit glyph. |
*/ |
bool nsfb_plot_glyph8(nsfb_t *nsfb, nsfb_bbox_t *loc, const uint8_t *pixel, int pitch, nsfb_colour_t c); |
/** Plot an 1 bit glyph. |
*/ |
bool nsfb_plot_glyph1(nsfb_t *nsfb, nsfb_bbox_t *loc, const uint8_t *pixel, int pitch, nsfb_colour_t c); |
/* read rectangle into buffer */ |
bool nsfb_plot_readrect(nsfb_t *nsfb, nsfb_bbox_t *rect, nsfb_colour_t *buffer); |
#endif /* _LIBNSFB_PLOT_H */ |
/contrib/network/netsurf/include/libnsfb_plot_util.h |
---|
0,0 → 1,48 |
/* |
* Copyright 2009 Vincent Sanders <vince@simtec.co.uk> |
* |
* This file is part of libnsfb, http://www.netsurf-browser.org/ |
* Licenced under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* |
* This is the exported interface for the libnsfb graphics library. |
*/ |
#ifndef _LIBNSFB_PLOT_UTIL_H |
#define _LIBNSFB_PLOT_UTIL_H 1 |
/* alpha blend two pixels together */ |
static inline nsfb_colour_t |
nsfb_plot_ablend(nsfb_colour_t pixel, nsfb_colour_t scrpixel) |
{ |
int opacity = pixel >> 24; |
int transp = 0x100 - opacity; |
uint32_t rb, g; |
rb = ((pixel & 0xFF00FF) * opacity + |
(scrpixel & 0xFF00FF) * transp) >> 8; |
g = ((pixel & 0x00FF00) * opacity + |
(scrpixel & 0x00FF00) * transp) >> 8; |
return (rb & 0xFF00FF) | (g & 0xFF00); |
} |
bool nsfb_plot_clip(const nsfb_bbox_t * clip, nsfb_bbox_t * rect); |
bool nsfb_plot_clip_ctx(nsfb_t *nsfb, nsfb_bbox_t * rect); |
bool nsfb_plot_clip_line(const nsfb_bbox_t * clip, nsfb_bbox_t * line); |
bool nsfb_plot_clip_line_ctx(nsfb_t *nsfb, nsfb_bbox_t * line); |
/** Obtain a bounding box which is the superset of two source boxes. |
* |
*/ |
bool nsfb_plot_add_rect(const nsfb_bbox_t *box1, const nsfb_bbox_t *box2, nsfb_bbox_t *result); |
/** Find if two boxes intersect. */ |
bool nsfb_plot_bbox_intersect(const nsfb_bbox_t *box1, const nsfb_bbox_t *box2); |
#endif /* _LIBNSFB_PLOT_UTIL_H */ |
/contrib/network/netsurf/include/libnsgif.h |
---|
0,0 → 1,108 |
/* |
* Copyright 2004 Richard Wilson <richard.wilson@netsurf-browser.org> |
* Copyright 2008 Sean Fox <dyntryx@gmail.com> |
* |
* This file is part of NetSurf's libnsgif, http://www.netsurf-browser.org/ |
* Licenced under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
*/ |
/** \file |
* Progressive animated GIF file decoding (interface). |
*/ |
#ifndef _LIBNSGIF_H_ |
#define _LIBNSGIF_H_ |
#include <stdbool.h> |
#include <inttypes.h> |
/* Error return values |
*/ |
typedef enum { |
GIF_WORKING = 1, |
GIF_OK = 0, |
GIF_INSUFFICIENT_FRAME_DATA = -1, |
GIF_FRAME_DATA_ERROR = -2, |
GIF_INSUFFICIENT_DATA = -3, |
GIF_DATA_ERROR = -4, |
GIF_INSUFFICIENT_MEMORY = -5, |
GIF_FRAME_NO_DISPLAY = -6, |
GIF_END_OF_FRAME = -7 |
} gif_result; |
/* The GIF frame data |
*/ |
typedef struct gif_frame { |
bool display; /**< whether the frame should be displayed/animated */ |
unsigned int frame_delay; /**< delay (in cs) before animating the frame */ |
/** Internal members are listed below |
*/ |
unsigned int frame_pointer; /**< offset (in bytes) to the GIF frame data */ |
bool virgin; /**< whether the frame has previously been used */ |
bool opaque; /**< whether the frame is totally opaque */ |
bool redraw_required; /**< whether a forcable screen redraw is required */ |
unsigned char disposal_method; /**< how the previous frame should be disposed; affects plotting */ |
bool transparency; /**< whether we acknoledge transparency */ |
unsigned char transparency_index; /**< the index designating a transparent pixel */ |
unsigned int redraw_x; /**< x co-ordinate of redraw rectangle */ |
unsigned int redraw_y; /**< y co-ordinate of redraw rectangle */ |
unsigned int redraw_width; /**< width of redraw rectangle */ |
unsigned int redraw_height; /**< height of redraw rectangle */ |
} gif_frame; |
/* API for Bitmap callbacks |
*/ |
typedef void* (*gif_bitmap_cb_create)(int width, int height); |
typedef void (*gif_bitmap_cb_destroy)(void *bitmap); |
typedef unsigned char* (*gif_bitmap_cb_get_buffer)(void *bitmap); |
typedef void (*gif_bitmap_cb_set_opaque)(void *bitmap, bool opaque); |
typedef bool (*gif_bitmap_cb_test_opaque)(void *bitmap); |
typedef void (*gif_bitmap_cb_modified)(void *bitmap); |
/* The Bitmap callbacks function table |
*/ |
typedef struct gif_bitmap_callback_vt { |
gif_bitmap_cb_create bitmap_create; /**< Create a bitmap. */ |
gif_bitmap_cb_destroy bitmap_destroy; /**< Free a bitmap. */ |
gif_bitmap_cb_get_buffer bitmap_get_buffer; /**< Return a pointer to the pixel data in a bitmap. */ |
/** Members below are optional |
*/ |
gif_bitmap_cb_set_opaque bitmap_set_opaque; /**< Sets whether a bitmap should be plotted opaque. */ |
gif_bitmap_cb_test_opaque bitmap_test_opaque; /**< Tests whether a bitmap has an opaque alpha channel. */ |
gif_bitmap_cb_modified bitmap_modified; /**< The bitmap image has changed, so flush any persistant cache. */ |
} gif_bitmap_callback_vt; |
/* The GIF animation data |
*/ |
typedef struct gif_animation { |
gif_bitmap_callback_vt bitmap_callbacks; /**< callbacks for bitmap functions */ |
unsigned char *gif_data; /**< pointer to GIF data */ |
unsigned int width; /**< width of GIF (may increase during decoding) */ |
unsigned int height; /**< heigth of GIF (may increase during decoding) */ |
unsigned int frame_count; /**< number of frames decoded */ |
unsigned int frame_count_partial; /**< number of frames partially decoded */ |
gif_frame *frames; /**< decoded frames */ |
int decoded_frame; /**< current frame decoded to bitmap */ |
void *frame_image; /**< currently decoded image; stored as bitmap from bitmap_create callback */ |
int loop_count; /**< number of times to loop animation */ |
gif_result current_error; /**< current error type, or 0 for none*/ |
/** Internal members are listed below |
*/ |
unsigned int buffer_position; /**< current index into GIF data */ |
unsigned int buffer_size; /**< total number of bytes of GIF data available */ |
unsigned int frame_holders; /**< current number of frame holders */ |
unsigned int background_index; /**< index in the colour table for the background colour */ |
unsigned int aspect_ratio; /**< image aspect ratio (ignored) */ |
unsigned int colour_table_size; /**< size of colour table (in entries) */ |
bool global_colours; /**< whether the GIF has a global colour table */ |
unsigned int *global_colour_table; /**< global colour table */ |
unsigned int *local_colour_table; /**< local colour table */ |
} gif_animation; |
void gif_create(gif_animation *gif, gif_bitmap_callback_vt *bitmap_callbacks); |
gif_result gif_initialise(gif_animation *gif, size_t size, unsigned char *data); |
gif_result gif_decode_frame(gif_animation *gif, unsigned int frame); |
void gif_finalise(gif_animation *gif); |
#endif |
/contrib/network/netsurf/include/nsfb.h |
---|
0,0 → 1,49 |
/* |
* Copyright 2009 Vincent Sanders <vince@simtec.co.uk> |
* |
* This file is part of libnsfb, http://www.netsurf-browser.org/ |
* Licenced under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* |
* This is the internal interface for the libnsfb graphics library. |
*/ |
#ifndef _NSFB_H |
#define _NSFB_H 1 |
#include <stdint.h> |
/** NS Framebuffer context |
*/ |
struct nsfb_s { |
int width; /**< Visible width. */ |
int height; /**< Visible height. */ |
char *parameters; |
enum nsfb_format_e format; /**< Framebuffer format */ |
int bpp; /**< Bits per pixel - distinct from format */ |
uint8_t *ptr; /**< Base of video memory. */ |
int linelen; /**< length of a video line. */ |
struct nsfb_palette_s *palette; /**< palette for index modes */ |
nsfb_cursor_t *cursor; /**< cursor */ |
struct nsfb_surface_rtns_s *surface_rtns; /**< surface routines. */ |
void *surface_priv; /**< surface opaque data. */ |
nsfb_bbox_t clip; /**< current clipping rectangle for plotters */ |
struct nsfb_plotter_fns_s *plotter_fns; /**< Plotter methods */ |
}; |
#endif |
/* |
* Local variables: |
* c-basic-offset: 4 |
* tab-width: 8 |
* End: |
*/ |
/contrib/network/netsurf/include/palette.h |
---|
0,0 → 1,231 |
/* |
* Copyright 2012 Michael Drake <tlsa@netsurf-browser.org> |
* |
* This file is part of libnsfb, http://www.netsurf-browser.org/ |
* Licenced under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* |
* This is the *internal* interface for the cursor. |
*/ |
#ifndef PALETTE_H |
#define PALETTE_H 1 |
#include <stdint.h> |
#include <limits.h> |
#include "libnsfb.h" |
#include "libnsfb_plot.h" |
enum nsfb_palette_type_e { |
NSFB_PALETTE_EMPTY, /**< empty palette object */ |
NSFB_PALETTE_NSFB_8BPP, /**< libnsfb's own 8bpp palette */ |
NSFB_PALETTE_OTHER /**< any other palette */ |
}; |
struct nsfb_palette_s { |
enum nsfb_palette_type_e type; /**< Palette type */ |
uint8_t last; /**< Last used palette index */ |
nsfb_colour_t data[256]; /**< Palette for index modes */ |
bool dither; /**< Whether to use error diffusion */ |
struct { |
int width; /**< Length of error value buffer ring*/ |
int current; /**< Current pos in ring buffer*/ |
int *data; /**< Ring buffer error values */ |
int data_len; /**< Max size of ring */ |
} dither_ctx; |
}; |
/** Create an empty palette object. */ |
bool nsfb_palette_new(struct nsfb_palette_s **palette, int width); |
/** Free a palette object. */ |
void nsfb_palette_free(struct nsfb_palette_s *palette); |
/** Init error diffusion for a plot. */ |
void nsfb_palette_dither_init(struct nsfb_palette_s *palette, int width); |
/** Finalise error diffusion after a plot. */ |
void nsfb_palette_dither_fini(struct nsfb_palette_s *palette); |
/** Generate libnsfb 8bpp default palette. */ |
void nsfb_palette_generate_nsfb_8bpp(struct nsfb_palette_s *palette); |
/** Find best palette match for given colour. */ |
static inline uint8_t nsfb_palette_best_match(struct nsfb_palette_s *palette, |
nsfb_colour_t c, int *r_error, int *g_error, int *b_error) |
{ |
uint8_t best_col = 0; |
nsfb_colour_t palent; |
int col; |
int dr, dg, db; /* delta red, green blue values */ |
int cur_distance; |
int best_distance = INT_MAX; |
switch (palette->type) { |
case NSFB_PALETTE_NSFB_8BPP: |
/* Index into colour cube part */ |
dr = ((( c & 0xFF) * 5) + 128) / 256; |
dg = ((((c >> 8) & 0xFF) * 7) + 128) / 256; |
db = ((((c >> 16) & 0xFF) * 4) + 128) / 256; |
col = 40 * dr + 5 * dg + db; |
palent = palette->data[col]; |
dr = ( c & 0xFF) - ( palent & 0xFF); |
dg = ((c >> 8) & 0xFF) - ((palent >> 8 ) & 0xFF); |
db = ((c >> 16) & 0xFF) - ((palent >> 16) & 0xFF); |
cur_distance = (dr * dr) + (dg * dg) + (db * db); |
best_col = col; |
best_distance = cur_distance; |
*r_error = dr; |
*g_error = dg; |
*b_error = db; |
/* Index into grayscale part */ |
col = (( c & 0xFF) + |
((c >> 8) & 0xFF) + |
((c >> 16) & 0xFF) + (45 / 2)) / (15 * 3) - 1 + 240; |
palent = palette->data[col]; |
dr = ( c & 0xFF) - ( palent & 0xFF); |
dg = ((c >> 8) & 0xFF) - ((palent >> 8) & 0xFF); |
db = ((c >> 16) & 0xFF) - ((palent >> 16) & 0xFF); |
cur_distance = (dr * dr) + (dg * dg) + (db * db); |
if (cur_distance < best_distance) { |
best_distance = cur_distance; |
best_col = col; |
*r_error = dr; |
*g_error = dg; |
*b_error = db; |
} |
break; |
case NSFB_PALETTE_OTHER: |
/* Try all colours in palette */ |
for (col = 0; col <= palette->last; col++) { |
palent = palette->data[col]; |
dr = ( c & 0xFF) - ( palent & 0xFF); |
dg = ((c >> 8) & 0xFF) - ((palent >> 8) & 0xFF); |
db = ((c >> 16) & 0xFF) - ((palent >> 16) & 0xFF); |
cur_distance = (dr * dr) + (dg * dg) + (db * db); |
if (cur_distance < best_distance) { |
best_distance = cur_distance; |
best_col = col; |
*r_error = dr; |
*g_error = dg; |
*b_error = db; |
} |
} |
break; |
default: |
break; |
} |
return best_col; |
} |
/** Find best palette match for given colour, with error diffusion. */ |
static inline uint8_t nsfb_palette_best_match_dither( |
struct nsfb_palette_s *palette, nsfb_colour_t c) |
{ |
int r, g, b; |
int current; |
int error; |
int width = palette->dither_ctx.width; |
uint8_t best_col_index; |
if (palette == NULL) |
return 0; |
if (palette->dither == false) |
return nsfb_palette_best_match(palette, c, &r, &g, &b); |
current = palette->dither_ctx.current; |
/* Get RGB components of colour, and apply error */ |
r = ( c & 0xFF) + palette->dither_ctx.data[current ]; |
g = ((c >> 8) & 0xFF) + palette->dither_ctx.data[current + 1]; |
b = ((c >> 16) & 0xFF) + palette->dither_ctx.data[current + 2]; |
/* Clamp new RGB components to range */ |
if (r < 0) r = 0; |
if (r > 255) r = 255; |
if (g < 0) g = 0; |
if (g > 255) g = 255; |
if (b < 0) b = 0; |
if (b > 255) b = 255; |
/* Reset error diffusion slots to 0 */ |
palette->dither_ctx.data[current ] = 0; |
palette->dither_ctx.data[current + 1] = 0; |
palette->dither_ctx.data[current + 2] = 0; |
/* Rebuild colour from modified components */ |
c = r + (g << 8) + (b << 16); |
/* Get best match for pixel, and find errors for each component */ |
best_col_index = nsfb_palette_best_match(palette, c, &r, &g, &b); |
/* Advance one set of error diffusion slots */ |
current += 3; |
if (current >= width) |
current = 0; |
palette->dither_ctx.current = current; |
/* Save errors |
* |
* [*]-[N] |
* / | \ |
* [l]-[m]-[r] |
*/ |
error = current; |
/* Error for [N] (next) */ |
if (error != 0) { |
/* The pixel exists */ |
palette->dither_ctx.data[error ] += r * 7 / 16; |
palette->dither_ctx.data[error + 1] += g * 7 / 16; |
palette->dither_ctx.data[error + 2] += b * 7 / 16; |
} |
error += width - 2 * 3; |
if (error >= width) |
error -= width; |
/* Error for [l] (below, left) */ |
if (error >= 0 && error != 3) { |
/* The pixel exists */ |
palette->dither_ctx.data[error ] += r * 3 / 16; |
palette->dither_ctx.data[error + 1] += g * 3 / 16; |
palette->dither_ctx.data[error + 2] += b * 3 / 16; |
} |
error += 3; |
if (error >= width) |
error -= width; |
/* Error for [m] (below, middle) */ |
palette->dither_ctx.data[error ] += r * 5 / 16; |
palette->dither_ctx.data[error + 1] += g * 5 / 16; |
palette->dither_ctx.data[error + 2] += b * 5 / 16; |
error += 3; |
if (error >= width) |
error -= width; |
/* Error for [r] (below, right) */ |
if (error != 0) { |
/* The pixel exists */ |
palette->dither_ctx.data[error ] += r / 16; |
palette->dither_ctx.data[error + 1] += g / 16; |
palette->dither_ctx.data[error + 2] += b / 16; |
} |
return best_col_index; |
} |
#endif /* PALETTE_H */ |
/contrib/network/netsurf/include/plot.h |
---|
0,0 → 1,124 |
/** Clears plotting area to a flat colour (if needed) |
*/ |
typedef bool (nsfb_plotfn_clg_t)(nsfb_t *nsfb, nsfb_colour_t c); |
/** Plots a rectangle outline. The line can be solid, dotted or |
* dashed. Top left corner at (x0,y0) and rectangle has given |
* width and height. |
*/ |
typedef bool (nsfb_plotfn_rectangle_t)(nsfb_t *nsfb, nsfb_bbox_t *rect, int line_width, nsfb_colour_t c, bool dotted, bool dashed); |
/** Plots a line using a given pen. |
*/ |
typedef bool (nsfb_plotfn_line_t)(nsfb_t *nsfb, int linec, nsfb_bbox_t *line, nsfb_plot_pen_t *pen); |
/** Plots a filled polygon with straight lines between points. |
* The lines around the edge of the ploygon are not plotted. The |
* polygon is filled with the non-zero winding rule. |
*/ |
typedef bool (nsfb_plotfn_polygon_t)(nsfb_t *nsfb, const int *p, unsigned int n, nsfb_colour_t fill); |
/** Plots a filled rectangle. Top left corner at (x0,y0), bottom |
* right corner at (x1,y1). Note: (x0,y0) is inside filled area, |
* but (x1,y1) is below and to the right. See diagram below. |
*/ |
typedef bool (nsfb_plotfn_fill_t)(nsfb_t *nsfb, nsfb_bbox_t *rect, nsfb_colour_t c); |
/** Clipping operations. |
*/ |
typedef bool (nsfb_plotfn_clip_t)(nsfb_t *nsfb, nsfb_bbox_t *clip); |
/** Plots an arc, around (x,y), from anticlockwise from angle1 to |
* angle2. Angles are measured anticlockwise from horizontal, in |
* degrees. |
*/ |
typedef bool (nsfb_plotfn_arc_t)(nsfb_t *nsfb, int x, int y, int radius, int angle1, int angle2, nsfb_colour_t c); |
/** Plots a point. |
* |
* Plot a single alpha blended pixel. |
*/ |
typedef bool (nsfb_plotfn_point_t)(nsfb_t *nsfb, int x, int y, nsfb_colour_t c); |
/** Plot an ellipse. |
* |
* plot an ellipse outline, note if teh bounding box is square this will plot a |
* circle. |
*/ |
typedef bool (nsfb_plotfn_ellipse_t)(nsfb_t *nsfb, nsfb_bbox_t *ellipse, nsfb_colour_t c); |
/** Plot a filled ellipse. |
* |
* plot a filled ellipse, note if the bounding box is square this will plot a |
* circle. |
*/ |
typedef bool (nsfb_plotfn_ellipse_fill_t)(nsfb_t *nsfb, nsfb_bbox_t *ellipse, nsfb_colour_t c); |
/** Plot bitmap |
*/ |
typedef bool (nsfb_plotfn_bitmap_t)(nsfb_t *nsfb, const nsfb_bbox_t *loc, const nsfb_colour_t *pixel, int bmp_width, int bmp_height, int bmp_stride, bool alpha); |
/** Copy an area of screen |
* |
* Copy an area of the display. |
*/ |
typedef bool (nsfb_plotfn_copy_t)(nsfb_t *nsfb, nsfb_bbox_t *srcbox, nsfb_bbox_t *dstbox); |
/** Plot an 8 bit per pixel glyph. |
*/ |
typedef bool (nsfb_plotfn_glyph8_t)(nsfb_t *nsfb, nsfb_bbox_t *loc, const uint8_t *pixel, int pitch, nsfb_colour_t c); |
/** Plot an 1 bit per pixel glyph. |
*/ |
typedef bool (nsfb_plotfn_glyph1_t)(nsfb_t *nsfb, nsfb_bbox_t *loc, const uint8_t *pixel, int pitch, nsfb_colour_t c); |
/** Read rectangle of screen into buffer |
*/ |
typedef bool (nsfb_plotfn_readrect_t)(nsfb_t *nsfb, nsfb_bbox_t *rect, nsfb_colour_t *buffer); |
/** Plot quadratic bezier spline |
*/ |
typedef bool (nsfb_plotfn_quadratic_bezier_t)(nsfb_t *nsfb, nsfb_bbox_t *curve, nsfb_point_t *ctrla, nsfb_plot_pen_t *pen); |
/** Plot cubic bezier spline |
*/ |
typedef bool (nsfb_plotfn_cubic_bezier_t)(nsfb_t *nsfb, nsfb_bbox_t *curve, nsfb_point_t *ctrla, nsfb_point_t *ctrlb, nsfb_plot_pen_t *pen); |
typedef bool (nsfb_plotfn_polylines_t)(nsfb_t *nsfb, int pointc, const nsfb_point_t *points, nsfb_plot_pen_t *pen); |
/** plot path */ |
typedef bool (nsfb_plotfn_path_t)(nsfb_t *nsfb, int pathc, nsfb_plot_pathop_t *pathop, nsfb_plot_pen_t *pen); |
/** plotter function table. */ |
typedef struct nsfb_plotter_fns_s { |
nsfb_plotfn_clg_t *clg; |
nsfb_plotfn_rectangle_t *rectangle; |
nsfb_plotfn_line_t *line; |
nsfb_plotfn_polygon_t *polygon; |
nsfb_plotfn_fill_t *fill; |
nsfb_plotfn_clip_t *get_clip; |
nsfb_plotfn_clip_t *set_clip; |
nsfb_plotfn_ellipse_t *ellipse; |
nsfb_plotfn_ellipse_fill_t *ellipse_fill; |
nsfb_plotfn_arc_t *arc; |
nsfb_plotfn_bitmap_t *bitmap; |
nsfb_plotfn_point_t *point; |
nsfb_plotfn_copy_t *copy; |
nsfb_plotfn_glyph8_t *glyph8; |
nsfb_plotfn_glyph1_t *glyph1; |
nsfb_plotfn_readrect_t *readrect; |
nsfb_plotfn_quadratic_bezier_t *quadratic; |
nsfb_plotfn_cubic_bezier_t *cubic; |
nsfb_plotfn_path_t *path; |
nsfb_plotfn_polylines_t *polylines; |
} nsfb_plotter_fns_t; |
bool select_plotters(nsfb_t *nsfb); |
/contrib/network/netsurf/include/surface.h |
---|
0,0 → 1,65 |
/* libnsfb framebuffer surface support */ |
#include "libnsfb.h" |
#include "libnsfb_plot.h" |
#include "nsfb.h" |
/* surface default options */ |
typedef int (nsfb_surfacefn_defaults_t)(nsfb_t *nsfb); |
/* surface init */ |
typedef int (nsfb_surfacefn_init_t)(nsfb_t *nsfb); |
/* surface finalise */ |
typedef int (nsfb_surfacefn_fini_t)(nsfb_t *nsfb); |
/* surface set geometry */ |
typedef int (nsfb_surfacefn_geometry_t)(nsfb_t *nsfb, int width, int height, enum nsfb_format_e format); |
/* surface set parameters */ |
typedef int (nsfb_surfacefn_parameters_t)(nsfb_t *nsfb, const char *parameters); |
/* surface input */ |
typedef bool (nsfb_surfacefn_input_t)(nsfb_t *nsfb, nsfb_event_t *event, int timeout); |
/* surface area claim */ |
typedef int (nsfb_surfacefn_claim_t)(nsfb_t *nsfb, nsfb_bbox_t *box); |
/* surface area update */ |
typedef int (nsfb_surfacefn_update_t)(nsfb_t *nsfb, nsfb_bbox_t *box); |
/* surface cursor display */ |
typedef int (nsfb_surfacefn_cursor_t)(nsfb_t *nsfb, struct nsfb_cursor_s *cursor); |
typedef struct nsfb_surface_rtns_s { |
nsfb_surfacefn_defaults_t *defaults; |
nsfb_surfacefn_init_t *initialise; |
nsfb_surfacefn_fini_t *finalise; |
nsfb_surfacefn_geometry_t *geometry; |
nsfb_surfacefn_parameters_t *parameters; |
nsfb_surfacefn_input_t *input; |
nsfb_surfacefn_claim_t *claim; |
nsfb_surfacefn_update_t *update; |
nsfb_surfacefn_cursor_t *cursor; |
} nsfb_surface_rtns_t; |
void _nsfb_register_surface(const enum nsfb_type_e type, const nsfb_surface_rtns_t *rtns, const char *name); |
/* macro which adds a builtin command with no argument limits */ |
#define NSFB_SURFACE_DEF(__name, __type, __rtns) \ |
static void __name##_register_surface(void) __attribute__((constructor)); \ |
void __name##_register_surface(void) { \ |
_nsfb_register_surface(__type, __rtns, #__name); \ |
} |
/** Obtain routines for a surface |
* |
* Obtain a vlist of methods for a surface type. |
* |
* @param type The surface type. |
* @return A vtable of routines which teh caller must deallocate or |
* NULL on error |
*/ |
nsfb_surface_rtns_t *nsfb_surface_get_rtns(enum nsfb_type_e type); |
/contrib/network/netsurf/include/dom/bindings/hubbub/errors.h |
---|
0,0 → 1,42 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef dom_hubbub_errors_h_ |
#define dom_hubbub_errors_h_ |
typedef enum { |
DOM_HUBBUB_OK = 0, |
DOM_HUBBUB_NOMEM = 1, |
DOM_HUBBUB_BADPARM = 2, /**< Bad input parameter */ |
DOM_HUBBUB_DOM = 3, /**< DOM operation failed */ |
DOM_HUBBUB_HUBBUB_ERR = (1<<16), |
DOM_HUBBUB_HUBBUB_ERR_PAUSED = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_PAUSED), |
DOM_HUBBUB_HUBBUB_ERR_ENCODINGCHANGE = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_ENCODINGCHANGE), |
DOM_HUBBUB_HUBBUB_ERR_NOMEM = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_NOMEM), |
DOM_HUBBUB_HUBBUB_ERR_BADPARM = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_BADPARM), |
DOM_HUBBUB_HUBBUB_ERR_INVALID = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_INVALID), |
DOM_HUBBUB_HUBBUB_ERR_FILENOTFOUND = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_FILENOTFOUND), |
DOM_HUBBUB_HUBBUB_ERR_NEEDDATA = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_NEEDDATA), |
DOM_HUBBUB_HUBBUB_ERR_BADENCODING = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_BADENCODING), |
DOM_HUBBUB_HUBBUB_ERR_UNKNOWN = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_UNKNOWN), |
} dom_hubbub_error; |
#endif |
/contrib/network/netsurf/include/dom/bindings/hubbub/parser.h |
---|
0,0 → 1,101 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef dom_hubbub_parser_h_ |
#define dom_hubbub_parser_h_ |
#include <stddef.h> |
#include <inttypes.h> |
#include <hubbub/errors.h> |
#include <dom/dom.h> |
#include "errors.h" |
/** |
* Type of script completion function |
*/ |
typedef dom_hubbub_error (*dom_script)(void *ctx, struct dom_node *node); |
typedef struct dom_hubbub_parser dom_hubbub_parser; |
/* The encoding source of the document */ |
typedef enum dom_hubbub_encoding_source { |
DOM_HUBBUB_ENCODING_SOURCE_HEADER, |
DOM_HUBBUB_ENCODING_SOURCE_DETECTED, |
DOM_HUBBUB_ENCODING_SOURCE_META |
} dom_hubbub_encoding_source; |
/* The recommended way to use the parser is: |
* |
* dom_hubbub_parser_create(...); |
* dom_hubbub_parser_parse_chunk(...); |
* call _parse_chunk for all chunks of data |
* |
* After you have parsed the data, |
* |
* dom_hubbub_parser_completed(...); |
* dom_hubbub_parser_destroy(...); |
* |
* Clients must ensure that these function calls above are called in |
* the order shown. dom_hubbub_parser_create() will pass the ownership |
* of the document to the client. After that, the parser should be destroyed. |
* The client must not call any method of this parser after destruction. |
*/ |
/** |
* Parameter block for dom_hubbub_parser_create |
*/ |
typedef struct dom_hubbub_parser_params { |
const char *enc; /**< Source charset, or NULL */ |
bool fix_enc; /**< Whether fix the encoding */ |
bool enable_script; /**< Whether scripting should be enabled. */ |
dom_script script; /**< Script callback function */ |
dom_msg msg; /**< Informational message function */ |
void *ctx; /**< Pointer to client-specific private data */ |
/** default action fetcher function */ |
dom_events_default_action_fetcher daf; |
} dom_hubbub_parser_params; |
/* Create a Hubbub parser instance */ |
dom_hubbub_error dom_hubbub_parser_create(dom_hubbub_parser_params *params, |
dom_hubbub_parser **parser, |
dom_document **document); |
/* Destroy a Hubbub parser instance */ |
void dom_hubbub_parser_destroy(dom_hubbub_parser *parser); |
/* Parse a chunk of data */ |
dom_hubbub_error dom_hubbub_parser_parse_chunk(dom_hubbub_parser *parser, |
const uint8_t *data, size_t len); |
/* insert data into the parse stream but do not parse it */ |
dom_hubbub_error dom_hubbub_parser_insert_chunk(dom_hubbub_parser *parser, |
const uint8_t *data, size_t length); |
/* Notify parser that datastream is empty */ |
dom_hubbub_error dom_hubbub_parser_completed(dom_hubbub_parser *parser); |
/* Retrieve the document's encoding */ |
const char *dom_hubbub_parser_get_encoding(dom_hubbub_parser *parser, |
dom_hubbub_encoding_source *source); |
/** |
* Set the Parse pause state. |
* |
* \param parser The parser object |
* \param pause The pause state to set. |
* \return DOM_HUBBUB_OK on success, |
* DOM_HUBBUB_HUBBUB_ERR | <hubbub_error> on failure |
*/ |
dom_hubbub_error dom_hubbub_parser_pause(dom_hubbub_parser *parser, bool pause); |
#endif |
/contrib/network/netsurf/include/dom/bindings/xml/xmlerror.h |
---|
0,0 → 1,19 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef xml_xmlerror_h_ |
#define xml_xmlerror_h_ |
typedef enum { |
DOM_XML_OK = 0, |
DOM_XML_NOMEM = 1, |
DOM_XML_EXTERNAL_ERR = (1<<16), |
} dom_xml_error; |
#endif |
/contrib/network/netsurf/include/dom/bindings/xml/xmlparser.h |
---|
0,0 → 1,34 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef xml_xmlparser_h_ |
#define xml_xmlparser_h_ |
#include <stddef.h> |
#include <inttypes.h> |
#include <dom/dom.h> |
#include "xmlerror.h" |
typedef struct dom_xml_parser dom_xml_parser; |
/* Create an XML parser instance */ |
dom_xml_parser *dom_xml_parser_create(const char *enc, const char *int_enc, |
dom_msg msg, void *mctx, dom_document **document); |
/* Destroy an XML parser instance */ |
void dom_xml_parser_destroy(dom_xml_parser *parser); |
/* Parse a chunk of data */ |
dom_xml_error dom_xml_parser_parse_chunk(dom_xml_parser *parser, |
uint8_t *data, size_t len); |
/* Notify parser that datastream is empty */ |
dom_xml_error dom_xml_parser_completed(dom_xml_parser *parser); |
#endif |
/contrib/network/netsurf/include/dom/core/attr.h |
---|
0,0 → 1,147 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef dom_core_attr_h_ |
#define dom_core_attr_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/node.h> |
struct dom_element; |
struct dom_type_info; |
struct dom_node; |
struct dom_attr; |
typedef struct dom_attr dom_attr; |
/** |
* The attribute type |
*/ |
typedef enum { |
DOM_ATTR_UNSET = 0, |
DOM_ATTR_STRING, |
DOM_ATTR_BOOL, |
DOM_ATTR_SHORT, |
DOM_ATTR_INTEGER |
} dom_attr_type; |
/* DOM Attr vtable */ |
typedef struct dom_attr_vtable { |
struct dom_node_vtable base; |
dom_exception (*dom_attr_get_name)(struct dom_attr *attr, |
dom_string **result); |
dom_exception (*dom_attr_get_specified)(struct dom_attr *attr, |
bool *result); |
dom_exception (*dom_attr_get_value)(struct dom_attr *attr, |
dom_string **result); |
dom_exception (*dom_attr_set_value)(struct dom_attr *attr, |
dom_string *value); |
dom_exception (*dom_attr_get_owner_element)(struct dom_attr *attr, |
struct dom_element **result); |
dom_exception (*dom_attr_get_schema_type_info)(struct dom_attr *attr, |
struct dom_type_info **result); |
dom_exception (*dom_attr_is_id)(struct dom_attr *attr, bool *result); |
} dom_attr_vtable; |
static inline dom_exception dom_attr_get_name(struct dom_attr *attr, |
dom_string **result) |
{ |
return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)-> |
dom_attr_get_name(attr, result); |
} |
#define dom_attr_get_name(a, r) dom_attr_get_name((struct dom_attr *) (a), (r)) |
static inline dom_exception dom_attr_get_specified(struct dom_attr *attr, |
bool *result) |
{ |
return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)-> |
dom_attr_get_specified(attr, result); |
} |
#define dom_attr_get_specified(a, r) dom_attr_get_specified( \ |
(struct dom_attr *) (a), (bool *) (r)) |
static inline dom_exception dom_attr_get_value(struct dom_attr *attr, |
dom_string **result) |
{ |
return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)-> |
dom_attr_get_value(attr, result); |
} |
#define dom_attr_get_value(a, r) dom_attr_get_value((struct dom_attr *) (a), (r)) |
static inline dom_exception dom_attr_set_value(struct dom_attr *attr, |
dom_string *value) |
{ |
return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)-> |
dom_attr_set_value(attr, value); |
} |
#define dom_attr_set_value(a, v) dom_attr_set_value((struct dom_attr *) (a), (v)) |
static inline dom_exception dom_attr_get_owner_element(struct dom_attr *attr, |
struct dom_element **result) |
{ |
return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)-> |
dom_attr_get_owner_element(attr, result); |
} |
#define dom_attr_get_owner_element(a, r) dom_attr_get_owner_element(\ |
(struct dom_attr *) (a), (struct dom_element **) (r)) |
static inline dom_exception dom_attr_get_schema_type_info( |
struct dom_attr *attr, struct dom_type_info **result) |
{ |
return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)-> |
dom_attr_get_schema_type_info(attr, result); |
} |
#define dom_attr_get_schema_type_info(a, r) dom_attr_get_schema_type_info( \ |
(struct dom_attr *) (a), (struct dom_type_info **) (r)) |
static inline dom_exception dom_attr_is_id(struct dom_attr *attr, bool *result) |
{ |
return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)-> |
dom_attr_is_id(attr, result); |
} |
#define dom_attr_is_id(a, r) dom_attr_is_id((struct dom_attr *) (a), \ |
(bool *) (r)) |
/*-----------------------------------------------------------------------*/ |
/** |
* Following are our implementation specific APIs. |
* |
* These APIs are defined for the purpose that there are some attributes in |
* HTML and other DOM module whose type is not DOMString, but uint32_t or |
* boolean, for those types of attributes, clients should call one of the |
* following APIs to set it. |
* |
* When an Attr node is created, its type is unset and it can be turned into |
* any of the four types. Once the type is fixed by calling any of the four |
* APIs: |
* dom_attr_set_value |
* dom_attr_set_integer |
* dom_attr_set_short |
* dom_attr_set_bool |
* it can't be modified in future. |
* |
* For integer/short/bool type of attributes, we provide no string |
* repensentation of them, so when you call dom_attr_get_value on these |
* three type of attribute nodes, you will always get a empty dom_string. |
* If you want to do something with Attr node, you must know its type |
* firstly by calling dom_attr_get_type before you decide to call other |
* dom_attr_get_* functions. |
*/ |
dom_attr_type dom_attr_get_type(dom_attr *a); |
dom_exception dom_attr_get_integer(dom_attr *a, uint32_t *value); |
dom_exception dom_attr_set_integer(dom_attr *a, uint32_t value); |
dom_exception dom_attr_get_short(dom_attr *a, unsigned short *value); |
dom_exception dom_attr_set_short(dom_attr *a, unsigned short value); |
dom_exception dom_attr_get_bool(dom_attr *a, bool *value); |
dom_exception dom_attr_set_bool(dom_attr *a, bool value); |
/* Make a attribute node readonly */ |
void dom_attr_mark_readonly(dom_attr *a); |
#endif |
/contrib/network/netsurf/include/dom/core/cdatasection.h |
---|
0,0 → 1,12 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
*/ |
#ifndef dom_core_cdatasection_h_ |
#define dom_core_cdatasection_h_ |
typedef struct dom_cdata_section dom_cdata_section; |
#endif |
/contrib/network/netsurf/include/dom/core/characterdata.h |
---|
0,0 → 1,130 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef dom_core_characterdata_h_ |
#define dom_core_characterdata_h_ |
#include <dom/core/exceptions.h> |
#include <dom/core/node.h> |
typedef struct dom_characterdata dom_characterdata; |
/* The vtable for characterdata */ |
typedef struct dom_characterdata_vtable { |
struct dom_node_vtable base; |
dom_exception (*dom_characterdata_get_data)( |
struct dom_characterdata *cdata, |
dom_string **data); |
dom_exception (*dom_characterdata_set_data)( |
struct dom_characterdata *cdata, |
dom_string *data); |
dom_exception (*dom_characterdata_get_length)( |
struct dom_characterdata *cdata, |
uint32_t *length); |
dom_exception (*dom_characterdata_substring_data)( |
struct dom_characterdata *cdata, uint32_t offset, |
uint32_t count, dom_string **data); |
dom_exception (*dom_characterdata_append_data)( |
struct dom_characterdata *cdata, |
dom_string *data); |
dom_exception (*dom_characterdata_insert_data)( |
struct dom_characterdata *cdata, |
uint32_t offset, dom_string *data); |
dom_exception (*dom_characterdata_delete_data)( |
struct dom_characterdata *cdata, |
uint32_t offset, uint32_t count); |
dom_exception (*dom_characterdata_replace_data)( |
struct dom_characterdata *cdata, uint32_t offset, |
uint32_t count, dom_string *data); |
} dom_characterdata_vtable; |
static inline dom_exception dom_characterdata_get_data( |
struct dom_characterdata *cdata, dom_string **data) |
{ |
return ((dom_characterdata_vtable *) ((dom_node *) cdata)->vtable)-> |
dom_characterdata_get_data(cdata, data); |
} |
#define dom_characterdata_get_data(c, d) dom_characterdata_get_data( \ |
(struct dom_characterdata *) (c), (d)) |
static inline dom_exception dom_characterdata_set_data( |
struct dom_characterdata *cdata, dom_string *data) |
{ |
return ((dom_characterdata_vtable *) ((dom_node *) cdata)->vtable)-> |
dom_characterdata_set_data(cdata, data); |
} |
#define dom_characterdata_set_data(c, d) dom_characterdata_set_data( \ |
(struct dom_characterdata *) (c), (d)) |
static inline dom_exception dom_characterdata_get_length( |
struct dom_characterdata *cdata, uint32_t *length) |
{ |
return ((dom_characterdata_vtable *) ((dom_node *) cdata)->vtable)-> |
dom_characterdata_get_length(cdata, length); |
} |
#define dom_characterdata_get_length(c, l) dom_characterdata_get_length( \ |
(struct dom_characterdata *) (c), (uint32_t *) (l)) |
static inline dom_exception dom_characterdata_substring_data( |
struct dom_characterdata *cdata, uint32_t offset, |
uint32_t count, dom_string **data) |
{ |
return ((dom_characterdata_vtable *) ((dom_node *) cdata)->vtable)-> |
dom_characterdata_substring_data(cdata, offset, count, |
data); |
} |
#define dom_characterdata_substring_data(c, o, ct, d) \ |
dom_characterdata_substring_data( \ |
(struct dom_characterdata *) (c), (uint32_t) (o), \ |
(uint32_t) (ct), (d)) |
static inline dom_exception dom_characterdata_append_data( |
struct dom_characterdata *cdata, dom_string *data) |
{ |
return ((dom_characterdata_vtable *) ((dom_node *) cdata)->vtable)-> |
dom_characterdata_append_data(cdata, data); |
} |
#define dom_characterdata_append_data(c, d) dom_characterdata_append_data( \ |
(struct dom_characterdata *) (c), (d)) |
static inline dom_exception dom_characterdata_insert_data( |
struct dom_characterdata *cdata, uint32_t offset, |
dom_string *data) |
{ |
return ((dom_characterdata_vtable *) ((dom_node *) cdata)->vtable)-> |
dom_characterdata_insert_data(cdata, offset, data); |
} |
#define dom_characterdata_insert_data(c, o, d) dom_characterdata_insert_data( \ |
(struct dom_characterdata *) (c), (uint32_t) (o), (d)) |
static inline dom_exception dom_characterdata_delete_data( |
struct dom_characterdata *cdata, uint32_t offset, |
uint32_t count) |
{ |
return ((dom_characterdata_vtable *) ((dom_node *) cdata)->vtable)-> |
dom_characterdata_delete_data(cdata, offset, count); |
} |
#define dom_characterdata_delete_data(c, o, ct) dom_characterdata_delete_data(\ |
(struct dom_characterdata *) (c), (uint32_t) (o), \ |
(uint32_t) (ct)) |
static inline dom_exception dom_characterdata_replace_data( |
struct dom_characterdata *cdata, uint32_t offset, |
uint32_t count, dom_string *data) |
{ |
return ((dom_characterdata_vtable *) ((dom_node *) cdata)->vtable)-> |
dom_characterdata_replace_data(cdata, offset, count, |
data); |
} |
#define dom_characterdata_replace_data(c, o, ct, d) \ |
dom_characterdata_replace_data(\ |
(struct dom_characterdata *) (c), (uint32_t) (o),\ |
(uint32_t) (ct), (d)) |
#endif |
/contrib/network/netsurf/include/dom/core/comment.h |
---|
0,0 → 1,18 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_core_comment_h_ |
#define dom_core_comment_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/characterdata.h> |
typedef struct dom_comment dom_comment; |
#endif |
/contrib/network/netsurf/include/dom/core/doc_fragment.h |
---|
0,0 → 1,12 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
*/ |
#ifndef dom_core_documentfragment_h_ |
#define dom_core_documentfragment_h_ |
typedef struct dom_document_fragment dom_document_fragment; |
#endif |
/contrib/network/netsurf/include/dom/core/document.h |
---|
0,0 → 1,471 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef dom_core_document_h_ |
#define dom_core_document_h_ |
#include <stdbool.h> |
#include <inttypes.h> |
#include <stddef.h> |
#include <stdint.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/implementation.h> |
#include <dom/core/node.h> |
struct dom_attr; |
struct dom_cdata_section; |
struct dom_characterdata; |
struct dom_comment; |
struct dom_configuration; |
struct dom_document_fragment; |
struct dom_document_type; |
struct dom_element; |
struct dom_entity_reference; |
struct dom_node; |
struct dom_nodelist; |
struct dom_processing_instruction; |
struct dom_text; |
struct lwc_string_s; |
typedef struct dom_document dom_document; |
/** |
* Quirks mode flag |
*/ |
typedef enum dom_document_quirks_mode { |
DOM_DOCUMENT_QUIRKS_MODE_NONE, |
DOM_DOCUMENT_QUIRKS_MODE_LIMITED, |
DOM_DOCUMENT_QUIRKS_MODE_FULL |
} dom_document_quirks_mode; |
/* DOM Document vtable */ |
typedef struct dom_document_vtable { |
struct dom_node_vtable base; |
dom_exception (*dom_document_get_doctype)(struct dom_document *doc, |
struct dom_document_type **result); |
dom_exception (*dom_document_get_implementation)( |
struct dom_document *doc, |
dom_implementation **result); |
dom_exception (*dom_document_get_document_element)( |
struct dom_document *doc, struct dom_element **result); |
dom_exception (*dom_document_create_element)(struct dom_document *doc, |
dom_string *tag_name, |
struct dom_element **result); |
dom_exception (*dom_document_create_document_fragment)( |
struct dom_document *doc, |
struct dom_document_fragment **result); |
dom_exception (*dom_document_create_text_node)(struct dom_document *doc, |
dom_string *data, struct dom_text **result); |
dom_exception (*dom_document_create_comment)(struct dom_document *doc, |
dom_string *data, struct dom_comment **result); |
dom_exception (*dom_document_create_cdata_section)( |
struct dom_document *doc, dom_string *data, |
struct dom_cdata_section **result); |
dom_exception (*dom_document_create_processing_instruction)( |
struct dom_document *doc, dom_string *target, |
dom_string *data, |
struct dom_processing_instruction **result); |
dom_exception (*dom_document_create_attribute)(struct dom_document *doc, |
dom_string *name, struct dom_attr **result); |
dom_exception (*dom_document_create_entity_reference)( |
struct dom_document *doc, dom_string *name, |
struct dom_entity_reference **result); |
dom_exception (*dom_document_get_elements_by_tag_name)( |
struct dom_document *doc, dom_string *tagname, |
struct dom_nodelist **result); |
dom_exception (*dom_document_import_node)(struct dom_document *doc, |
struct dom_node *node, bool deep, |
struct dom_node **result); |
dom_exception (*dom_document_create_element_ns)( |
struct dom_document *doc, dom_string *namespace, |
dom_string *qname, struct dom_element **result); |
dom_exception (*dom_document_create_attribute_ns)( |
struct dom_document *doc, dom_string *namespace, |
dom_string *qname, struct dom_attr **result); |
dom_exception (*dom_document_get_elements_by_tag_name_ns)( |
struct dom_document *doc, dom_string *namespace, |
dom_string *localname, |
struct dom_nodelist **result); |
dom_exception (*dom_document_get_element_by_id)( |
struct dom_document *doc, dom_string *id, |
struct dom_element **result); |
dom_exception (*dom_document_get_input_encoding)( |
struct dom_document *doc, dom_string **result); |
dom_exception (*dom_document_get_xml_encoding)(struct dom_document *doc, |
dom_string **result); |
dom_exception (*dom_document_get_xml_standalone)( |
struct dom_document *doc, bool *result); |
dom_exception (*dom_document_set_xml_standalone)( |
struct dom_document *doc, bool standalone); |
dom_exception (*dom_document_get_xml_version)(struct dom_document *doc, |
dom_string **result); |
dom_exception (*dom_document_set_xml_version)(struct dom_document *doc, |
dom_string *version); |
dom_exception (*dom_document_get_strict_error_checking)( |
struct dom_document *doc, bool *result); |
dom_exception (*dom_document_set_strict_error_checking)( |
struct dom_document *doc, bool strict); |
dom_exception (*dom_document_get_uri)(struct dom_document *doc, |
dom_string **result); |
dom_exception (*dom_document_set_uri)(struct dom_document *doc, |
dom_string *uri); |
dom_exception (*dom_document_adopt_node)(struct dom_document *doc, |
struct dom_node *node, struct dom_node **result); |
dom_exception (*dom_document_get_dom_config)(struct dom_document *doc, |
struct dom_configuration **result); |
dom_exception (*dom_document_normalize)(struct dom_document *doc); |
dom_exception (*dom_document_rename_node)(struct dom_document *doc, |
struct dom_node *node, dom_string *namespace, |
dom_string *qname, struct dom_node **result); |
dom_exception (*get_quirks_mode)(dom_document *doc, |
dom_document_quirks_mode *result); |
dom_exception (*set_quirks_mode)(dom_document *doc, |
dom_document_quirks_mode quirks); |
} dom_document_vtable; |
static inline dom_exception dom_document_get_doctype(struct dom_document *doc, |
struct dom_document_type **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_get_doctype(doc, result); |
} |
#define dom_document_get_doctype(d, r) dom_document_get_doctype( \ |
(dom_document *) (d), (struct dom_document_type **) (r)) |
static inline dom_exception dom_document_get_implementation( |
struct dom_document *doc, dom_implementation **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_get_implementation(doc, result); |
} |
#define dom_document_get_implementation(d, r) dom_document_get_implementation(\ |
(dom_document *) (d), (dom_implementation **) (r)) |
static inline dom_exception dom_document_get_document_element( |
struct dom_document *doc, struct dom_element **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_get_document_element(doc, result); |
} |
#define dom_document_get_document_element(d, r) \ |
dom_document_get_document_element((dom_document *) (d), \ |
(struct dom_element **) (r)) |
static inline dom_exception dom_document_create_element( |
struct dom_document *doc, dom_string *tag_name, |
struct dom_element **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_create_element(doc, tag_name, result); |
} |
#define dom_document_create_element(d, t, r) dom_document_create_element( \ |
(dom_document *) (d), (t), \ |
(struct dom_element **) (r)) |
static inline dom_exception dom_document_create_document_fragment( |
struct dom_document *doc, |
struct dom_document_fragment **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_create_document_fragment(doc, result); |
} |
#define dom_document_create_document_fragment(d, r) \ |
dom_document_create_document_fragment((dom_document *) (d), \ |
(struct dom_document_fragment **) (r)) |
static inline dom_exception dom_document_create_text_node( |
struct dom_document *doc, dom_string *data, |
struct dom_text **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_create_text_node(doc, data, result); |
} |
#define dom_document_create_text_node(d, data, r) \ |
dom_document_create_text_node((dom_document *) (d), \ |
(data), (struct dom_text **) (r)) |
static inline dom_exception dom_document_create_comment( |
struct dom_document *doc, dom_string *data, |
struct dom_comment **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_create_comment(doc, data, result); |
} |
#define dom_document_create_comment(d, data, r) dom_document_create_comment( \ |
(dom_document *) (d), (data), \ |
(struct dom_comment **) (r)) |
static inline dom_exception dom_document_create_cdata_section( |
struct dom_document *doc, dom_string *data, |
struct dom_cdata_section **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_create_cdata_section(doc, data, result); |
} |
#define dom_document_create_cdata_section(d, data, r) \ |
dom_document_create_cdata_section((dom_document *) (d), \ |
(data), (struct dom_cdata_section **) (r)) |
static inline dom_exception dom_document_create_processing_instruction( |
struct dom_document *doc, dom_string *target, |
dom_string *data, |
struct dom_processing_instruction **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_create_processing_instruction(doc, target, |
data, result); |
} |
#define dom_document_create_processing_instruction(d, t, data, r) \ |
dom_document_create_processing_instruction( \ |
(dom_document *) (d), (t), (data), \ |
(struct dom_processing_instruction **) (r)) |
static inline dom_exception dom_document_create_attribute( |
struct dom_document *doc, dom_string *name, |
struct dom_attr **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_create_attribute(doc, name, result); |
} |
#define dom_document_create_attribute(d, n, r) dom_document_create_attribute( \ |
(dom_document *) (d), (n), \ |
(struct dom_attr **) (r)) |
static inline dom_exception dom_document_create_entity_reference( |
struct dom_document *doc, dom_string *name, |
struct dom_entity_reference **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_create_entity_reference(doc, name, |
result); |
} |
#define dom_document_create_entity_reference(d, n, r) \ |
dom_document_create_entity_reference((dom_document *) (d), \ |
(n), (struct dom_entity_reference **) (r)) |
static inline dom_exception dom_document_get_elements_by_tag_name( |
struct dom_document *doc, dom_string *tagname, |
struct dom_nodelist **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_get_elements_by_tag_name(doc, tagname, |
result); |
} |
#define dom_document_get_elements_by_tag_name(d, t, r) \ |
dom_document_get_elements_by_tag_name((dom_document *) (d), \ |
(t), (struct dom_nodelist **) (r)) |
static inline dom_exception dom_document_import_node(struct dom_document *doc, |
struct dom_node *node, bool deep, struct dom_node **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_import_node(doc, node, deep, result); |
} |
#define dom_document_import_node(d, n, deep, r) dom_document_import_node( \ |
(dom_document *) (d), (dom_node *) (n), (bool) deep, \ |
(dom_node **) (r)) |
static inline dom_exception dom_document_create_element_ns( |
struct dom_document *doc, dom_string *namespace, |
dom_string *qname, struct dom_element **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_create_element_ns(doc, namespace, |
qname, result); |
} |
#define dom_document_create_element_ns(d, n, q, r) \ |
dom_document_create_element_ns((dom_document *) (d), \ |
(n), (q), \ |
(struct dom_element **) (r)) |
static inline dom_exception dom_document_create_attribute_ns |
(struct dom_document *doc, dom_string *namespace, |
dom_string *qname, struct dom_attr **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_create_attribute_ns(doc, namespace, |
qname, result); |
} |
#define dom_document_create_attribute_ns(d, n, q, r) \ |
dom_document_create_attribute_ns((dom_document *) (d), \ |
(n), (q), (struct dom_attr **) (r)) |
static inline dom_exception dom_document_get_elements_by_tag_name_ns( |
struct dom_document *doc, dom_string *namespace, |
dom_string *localname, struct dom_nodelist **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_get_elements_by_tag_name_ns(doc, |
namespace, localname, result); |
} |
#define dom_document_get_elements_by_tag_name_ns(d, n, l, r) \ |
dom_document_get_elements_by_tag_name_ns((dom_document *) (d),\ |
(n), (l), (struct dom_nodelist **) (r)) |
static inline dom_exception dom_document_get_element_by_id( |
struct dom_document *doc, dom_string *id, |
struct dom_element **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_get_element_by_id(doc, id, result); |
} |
#define dom_document_get_element_by_id(d, i, r) \ |
dom_document_get_element_by_id((dom_document *) (d), \ |
(i), (struct dom_element **) (r)) |
static inline dom_exception dom_document_get_input_encoding( |
struct dom_document *doc, dom_string **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_get_input_encoding(doc, result); |
} |
#define dom_document_get_input_encoding(d, r) dom_document_get_input_encoding(\ |
(dom_document *) (d), (r)) |
static inline dom_exception dom_document_get_xml_encoding( |
struct dom_document *doc, dom_string **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_get_xml_encoding(doc, result); |
} |
#define dom_document_get_xml_encoding(d, r) dom_document_get_xml_encoding( \ |
(dom_document *) (d), (r)) |
static inline dom_exception dom_document_get_xml_standalone( |
struct dom_document *doc, bool *result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_get_xml_standalone(doc, result); |
} |
#define dom_document_get_xml_standalone(d, r) dom_document_get_xml_standalone(\ |
(dom_document *) (d), (bool *) (r)) |
static inline dom_exception dom_document_set_xml_standalone( |
struct dom_document *doc, bool standalone) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_set_xml_standalone(doc, standalone); |
} |
#define dom_document_set_xml_standalone(d, s) dom_document_set_xml_standalone(\ |
(dom_document *) (d), (bool) (s)) |
static inline dom_exception dom_document_get_xml_version( |
struct dom_document *doc, dom_string **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_get_xml_version(doc, result); |
} |
#define dom_document_get_xml_version(d, r) dom_document_get_xml_version( \ |
(dom_document *) (d), (r)) |
static inline dom_exception dom_document_set_xml_version( |
struct dom_document *doc, dom_string *version) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_set_xml_version(doc, version); |
} |
#define dom_document_set_xml_version(d, v) dom_document_set_xml_version( \ |
(dom_document *) (d), (v)) |
static inline dom_exception dom_document_get_strict_error_checking( |
struct dom_document *doc, bool *result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_get_strict_error_checking(doc, result); |
} |
#define dom_document_get_strict_error_checking(d, r) \ |
dom_document_get_strict_error_checking((dom_document *) (d), \ |
(bool *) (r)) |
static inline dom_exception dom_document_set_strict_error_checking( |
struct dom_document *doc, bool strict) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_set_strict_error_checking(doc, strict); |
} |
#define dom_document_set_strict_error_checking(d, s) \ |
dom_document_set_strict_error_checking((dom_document *) (d), \ |
(bool) (s)) |
static inline dom_exception dom_document_get_uri(struct dom_document *doc, |
dom_string **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_get_uri(doc, result); |
} |
#define dom_document_get_uri(d, r) dom_document_get_uri((dom_document *) (d), \ |
(r)) |
static inline dom_exception dom_document_set_uri(struct dom_document *doc, |
dom_string *uri) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_set_uri(doc, uri); |
} |
#define dom_document_set_uri(d, u) dom_document_set_uri((dom_document *) (d), \ |
(u)) |
static inline dom_exception dom_document_adopt_node(struct dom_document *doc, |
struct dom_node *node, struct dom_node **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_adopt_node(doc, node, result); |
} |
#define dom_document_adopt_node(d, n, r) dom_document_adopt_node( \ |
(dom_document *) (d), (dom_node *) (n), (dom_node **) (r)) |
static inline dom_exception dom_document_get_dom_config( |
struct dom_document *doc, struct dom_configuration **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_get_dom_config(doc, result); |
} |
#define dom_document_get_dom_config(d, r) dom_document_get_dom_config( \ |
(dom_document *) (d), (struct dom_configuration **) (r)) |
static inline dom_exception dom_document_normalize(struct dom_document *doc) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_normalize(doc); |
} |
#define dom_document_normalize(d) dom_document_normalize((dom_document *) (d)) |
static inline dom_exception dom_document_rename_node(struct dom_document *doc, |
struct dom_node *node, |
dom_string *namespace, dom_string *qname, |
struct dom_node **result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
dom_document_rename_node(doc, node, namespace, qname, |
result); |
} |
#define dom_document_rename_node(d, n, ns, q, r) dom_document_rename_node( \ |
(dom_document *) (d), (ns), \ |
(q), (dom_node **) (r)) |
static inline dom_exception dom_document_get_quirks_mode( |
dom_document *doc, dom_document_quirks_mode *result) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
get_quirks_mode(doc, result); |
} |
#define dom_document_get_quirks_mode(d, r) \ |
dom_document_get_quirks_mode((dom_document *) (d), (r)) |
static inline dom_exception dom_document_set_quirks_mode( |
dom_document *doc, dom_document_quirks_mode quirks) |
{ |
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)-> |
set_quirks_mode(doc, quirks); |
} |
#define dom_document_set_quirks_mode(d, q) \ |
dom_document_set_quirks_mode((dom_document *) (d), (q)) |
#endif |
/contrib/network/netsurf/include/dom/core/document_type.h |
---|
0,0 → 1,106 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
* Copyright 2007 James Shaw <jshaw@netsurf-browser.org> |
*/ |
#ifndef dom_core_document_type_h_ |
#define dom_core_document_type_h_ |
#include <dom/core/exceptions.h> |
#include <dom/core/node.h> |
struct dom_namednodemap; |
typedef struct dom_document_type dom_document_type; |
/* The Dom DocumentType vtable */ |
typedef struct dom_document_type_vtable { |
struct dom_node_vtable base; |
dom_exception (*dom_document_type_get_name)( |
struct dom_document_type *doc_type, |
dom_string **result); |
dom_exception (*dom_document_type_get_entities)( |
struct dom_document_type *doc_type, |
struct dom_namednodemap **result); |
dom_exception (*dom_document_type_get_notations)( |
struct dom_document_type *doc_type, |
struct dom_namednodemap **result); |
dom_exception (*dom_document_type_get_public_id)( |
struct dom_document_type *doc_type, |
dom_string **result); |
dom_exception (*dom_document_type_get_system_id)( |
struct dom_document_type *doc_type, |
dom_string **result); |
dom_exception (*dom_document_type_get_internal_subset)( |
struct dom_document_type *doc_type, |
dom_string **result); |
} dom_document_type_vtable; |
static inline dom_exception dom_document_type_get_name( |
struct dom_document_type *doc_type, dom_string **result) |
{ |
return ((dom_document_type_vtable *) ((dom_node *) (doc_type))->vtable) |
->dom_document_type_get_name(doc_type, result); |
} |
#define dom_document_type_get_name(dt, r) dom_document_type_get_name( \ |
(dom_document_type *) (dt), (r)) |
static inline dom_exception dom_document_type_get_entities( |
struct dom_document_type *doc_type, |
struct dom_namednodemap **result) |
{ |
return ((dom_document_type_vtable *) ((dom_node *) (doc_type))->vtable) |
->dom_document_type_get_entities(doc_type, result); |
} |
#define dom_document_type_get_entities(dt, r) dom_document_type_get_entities( \ |
(dom_document_type *) (dt), (struct dom_namednodemap **) (r)) |
static inline dom_exception dom_document_type_get_notations( |
struct dom_document_type *doc_type, |
struct dom_namednodemap **result) |
{ |
return ((dom_document_type_vtable *) ((dom_node *) (doc_type))->vtable) |
->dom_document_type_get_notations(doc_type, result); |
} |
#define dom_document_type_get_notations(dt, r) dom_document_type_get_notations(\ |
(dom_document_type *) (dt), (struct dom_namednodemap **) (r)) |
static inline dom_exception dom_document_type_get_public_id( |
struct dom_document_type *doc_type, |
dom_string **result) |
{ |
return ((dom_document_type_vtable *) ((dom_node *) (doc_type))->vtable) |
->dom_document_type_get_public_id(doc_type, result); |
} |
#define dom_document_type_get_public_id(dt, r) \ |
dom_document_type_get_public_id((dom_document_type *) (dt), \ |
(r)) |
static inline dom_exception dom_document_type_get_system_id( |
struct dom_document_type *doc_type, |
dom_string **result) |
{ |
return ((dom_document_type_vtable *) ((dom_node *) (doc_type))->vtable) |
->dom_document_type_get_system_id(doc_type, result); |
} |
#define dom_document_type_get_system_id(dt, r) \ |
dom_document_type_get_system_id((dom_document_type *) (dt), \ |
(r)) |
static inline dom_exception dom_document_type_get_internal_subset( |
struct dom_document_type *doc_type, |
dom_string **result) |
{ |
return ((dom_document_type_vtable *) ((dom_node *) (doc_type))->vtable) |
->dom_document_type_get_internal_subset(doc_type, |
result); |
} |
#define dom_document_type_get_internal_subset(dt, r) \ |
dom_document_type_get_internal_subset( \ |
(dom_document_type *) (dt), (r)) |
#endif |
/contrib/network/netsurf/include/dom/core/element.h |
---|
0,0 → 1,359 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef dom_core_element_h_ |
#define dom_core_element_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/node.h> |
struct dom_attr; |
struct dom_nodelist; |
struct dom_type_info; |
typedef struct dom_element dom_element; |
/* The DOMElement vtable */ |
typedef struct dom_element_vtable { |
struct dom_node_vtable base; |
dom_exception (*dom_element_get_tag_name)(struct dom_element *element, |
dom_string **name); |
dom_exception (*dom_element_get_attribute)(struct dom_element *element, |
dom_string *name, dom_string **value); |
dom_exception (*dom_element_set_attribute)(struct dom_element *element, |
dom_string *name, dom_string *value); |
dom_exception (*dom_element_remove_attribute)( |
struct dom_element *element, dom_string *name); |
dom_exception (*dom_element_get_attribute_node)( |
struct dom_element *element, dom_string *name, |
struct dom_attr **result); |
dom_exception (*dom_element_set_attribute_node)( |
struct dom_element *element, struct dom_attr *attr, |
struct dom_attr **result); |
dom_exception (*dom_element_remove_attribute_node)( |
struct dom_element *element, struct dom_attr *attr, |
struct dom_attr **result); |
dom_exception (*dom_element_get_elements_by_tag_name)( |
struct dom_element *element, dom_string *name, |
struct dom_nodelist **result); |
dom_exception (*dom_element_get_attribute_ns)( |
struct dom_element *element, |
dom_string *namespace, |
dom_string *localname, |
dom_string **value); |
dom_exception (*dom_element_set_attribute_ns)( |
struct dom_element *element, |
dom_string *namespace, dom_string *qname, |
dom_string *value); |
dom_exception (*dom_element_remove_attribute_ns)( |
struct dom_element *element, |
dom_string *namespace, |
dom_string *localname); |
dom_exception (*dom_element_get_attribute_node_ns)( |
struct dom_element *element, |
dom_string *namespace, |
dom_string *localname, struct dom_attr **result); |
dom_exception (*dom_element_set_attribute_node_ns)( |
struct dom_element *element, struct dom_attr *attr, |
struct dom_attr **result); |
dom_exception (*dom_element_get_elements_by_tag_name_ns)( |
struct dom_element *element, |
dom_string *namespace, |
dom_string *localname, |
struct dom_nodelist **result); |
dom_exception (*dom_element_has_attribute)(struct dom_element *element, |
dom_string *name, bool *result); |
dom_exception (*dom_element_has_attribute_ns)( |
struct dom_element *element, |
dom_string *namespace, |
dom_string *localname, bool *result); |
dom_exception (*dom_element_get_schema_type_info)( |
struct dom_element *element, |
struct dom_type_info **result); |
dom_exception (*dom_element_set_id_attribute)( |
struct dom_element *element, dom_string *name, |
bool is_id); |
dom_exception (*dom_element_set_id_attribute_ns)( |
struct dom_element *element, |
dom_string *namespace, |
dom_string *localname, bool is_id); |
dom_exception (*dom_element_set_id_attribute_node)( |
struct dom_element *element, |
struct dom_attr *id_attr, bool is_id); |
/* These two are for the benefit of bindings to libcss */ |
dom_exception (*dom_element_get_classes)( |
struct dom_element *element, |
lwc_string ***classes, uint32_t *n_classes); |
dom_exception (*dom_element_has_class)( |
struct dom_element *element, |
lwc_string *name, bool *match); |
} dom_element_vtable; |
static inline dom_exception dom_element_get_tag_name( |
struct dom_element *element, dom_string **name) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_get_tag_name(element, name); |
} |
#define dom_element_get_tag_name(e, n) dom_element_get_tag_name( \ |
(dom_element *) (e), (n)) |
static inline dom_exception dom_element_get_attribute( |
struct dom_element *element, dom_string *name, |
dom_string **value) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_get_attribute(element, name, value); |
} |
#define dom_element_get_attribute(e, n, v) dom_element_get_attribute( \ |
(dom_element *) (e), (n), (v)) |
static inline dom_exception dom_element_set_attribute( |
struct dom_element *element, dom_string *name, |
dom_string *value) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_set_attribute(element, name, value); |
} |
#define dom_element_set_attribute(e, n, v) dom_element_set_attribute( \ |
(dom_element *) (e), (n), (v)) |
static inline dom_exception dom_element_remove_attribute( |
struct dom_element *element, dom_string *name) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_remove_attribute(element, name); |
} |
#define dom_element_remove_attribute(e, n) dom_element_remove_attribute( \ |
(dom_element *) (e), (n)) |
static inline dom_exception dom_element_get_attribute_node( |
struct dom_element *element, dom_string *name, |
struct dom_attr **result) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_get_attribute_node(element, name, result); |
} |
#define dom_element_get_attribute_node(e, n, r) \ |
dom_element_get_attribute_node((dom_element *) (e), \ |
(n), (struct dom_attr **) (r)) |
static inline dom_exception dom_element_set_attribute_node( |
struct dom_element *element, struct dom_attr *attr, |
struct dom_attr **result) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_set_attribute_node(element, attr, result); |
} |
#define dom_element_set_attribute_node(e, a, r) \ |
dom_element_set_attribute_node((dom_element *) (e), \ |
(struct dom_attr *) (a), (struct dom_attr **) (r)) |
static inline dom_exception dom_element_remove_attribute_node( |
struct dom_element *element, struct dom_attr *attr, |
struct dom_attr **result) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_remove_attribute_node(element, attr, |
result); |
} |
#define dom_element_remove_attribute_node(e, a, r) \ |
dom_element_remove_attribute_node((dom_element *) (e), \ |
(struct dom_attr *) (a), (struct dom_attr **) (r)) |
static inline dom_exception dom_element_get_elements_by_tag_name( |
struct dom_element *element, dom_string *name, |
struct dom_nodelist **result) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_get_elements_by_tag_name(element, name, |
result); |
} |
#define dom_element_get_elements_by_tag_name(e, n, r) \ |
dom_element_get_elements_by_tag_name((dom_element *) (e), \ |
(n), (struct dom_nodelist **) (r)) |
static inline dom_exception dom_element_get_attribute_ns( |
struct dom_element *element, dom_string *namespace, |
dom_string *localname, dom_string **value) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_get_attribute_ns(element, namespace, |
localname, value); |
} |
#define dom_element_get_attribute_ns(e, n, l, v) \ |
dom_element_get_attribute_ns((dom_element *) (e), \ |
(n), (l), (v)) |
static inline dom_exception dom_element_set_attribute_ns( |
struct dom_element *element, dom_string *namespace, |
dom_string *qname, dom_string *value) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_set_attribute_ns(element, namespace, |
qname, value); |
} |
#define dom_element_set_attribute_ns(e, n, l, v) \ |
dom_element_set_attribute_ns((dom_element *) (e), \ |
(n), (l), (v)) |
static inline dom_exception dom_element_remove_attribute_ns( |
struct dom_element *element, dom_string *namespace, |
dom_string *localname) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_remove_attribute_ns(element, namespace, |
localname); |
} |
#define dom_element_remove_attribute_ns(e, n, l) \ |
dom_element_remove_attribute_ns((dom_element *) (e), \ |
(n), (l)) |
static inline dom_exception dom_element_get_attribute_node_ns( |
struct dom_element *element, dom_string *namespace, |
dom_string *localname, struct dom_attr **result) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_get_attribute_node_ns(element, namespace, |
localname, result); |
} |
#define dom_element_get_attribute_node_ns(e, n, l, r) \ |
dom_element_get_attribute_node_ns((dom_element *) (e), \ |
(n), (l), \ |
(struct dom_attr **) (r)) |
static inline dom_exception dom_element_set_attribute_node_ns( |
struct dom_element *element, struct dom_attr *attr, |
struct dom_attr **result) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_set_attribute_node_ns(element, attr, |
result); |
} |
#define dom_element_set_attribute_node_ns(e, a, r) \ |
dom_element_set_attribute_node_ns((dom_element *) (e), \ |
(struct dom_attr *) (a), (struct dom_attr **) (r)) |
static inline dom_exception dom_element_get_elements_by_tag_name_ns( |
struct dom_element *element, dom_string *namespace, |
dom_string *localname, struct dom_nodelist **result) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_get_elements_by_tag_name_ns(element, |
namespace, localname, result); |
} |
#define dom_element_get_elements_by_tag_name_ns(e, n, l, r) \ |
dom_element_get_elements_by_tag_name_ns((dom_element *) (e), \ |
(n), (l), (struct dom_nodelist **) (r)) |
static inline dom_exception dom_element_has_attribute( |
struct dom_element *element, dom_string *name, |
bool *result) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_has_attribute(element, name, result); |
} |
#define dom_element_has_attribute(e, n, r) dom_element_has_attribute( \ |
(dom_element *) (e), (n), (bool *) (r)) |
static inline dom_exception dom_element_has_attribute_ns( |
struct dom_element *element, dom_string *namespace, |
dom_string *localname, bool *result) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_has_attribute_ns(element, namespace, |
localname, result); |
} |
#define dom_element_has_attribute_ns(e, n, l, r) dom_element_has_attribute_ns(\ |
(dom_element *) (e), (n), (l), (bool *) (r)) |
static inline dom_exception dom_element_get_schema_type_info( |
struct dom_element *element, struct dom_type_info **result) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_get_schema_type_info(element, result); |
} |
#define dom_element_get_schema_type_info(e, r) \ |
dom_element_get_schema_type_info((dom_element *) (e), \ |
(struct dom_type_info **) (r)) |
static inline dom_exception dom_element_set_id_attribute( |
struct dom_element *element, dom_string *name, |
bool is_id) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_set_id_attribute(element, name, is_id); |
} |
#define dom_element_set_id_attribute(e, n, i) \ |
dom_element_set_id_attribute((dom_element *) (e), \ |
(n), (bool) (i)) |
static inline dom_exception dom_element_set_id_attribute_ns( |
struct dom_element *element, dom_string *namespace, |
dom_string *localname, bool is_id) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_set_id_attribute_ns(element, namespace, |
localname, is_id); |
} |
#define dom_element_set_id_attribute_ns(e, n, l, i) \ |
dom_element_set_id_attribute_ns((dom_element *) (e), \ |
(n), (l), (bool) (i)) |
static inline dom_exception dom_element_set_id_attribute_node( |
struct dom_element *element, struct dom_attr *id_attr, |
bool is_id) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_set_id_attribute_node(element, id_attr, |
is_id); |
} |
#define dom_element_set_id_attribute_node(e, a, i) \ |
dom_element_set_id_attribute_node((dom_element *) (e), \ |
(struct dom_attr *) (a), (bool) (i)) |
static inline dom_exception dom_element_get_classes( |
struct dom_element *element, |
lwc_string ***classes, uint32_t *n_classes) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_get_classes(element, classes, n_classes); |
} |
#define dom_element_get_classes(e, c, n) \ |
dom_element_get_classes((dom_element *) (e), \ |
(lwc_string ***) (c), (uint32_t *) (n)) |
static inline dom_exception dom_element_has_class( |
struct dom_element *element, lwc_string *name, bool *match) |
{ |
return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_element_has_class(element, name, match); |
} |
#define dom_element_has_class(e, n, m) \ |
dom_element_has_class((dom_element *) (e), \ |
(lwc_string *) (n), (bool *) (m)) |
/* Functions for implementing some libcss selection callbacks. |
* Note that they don't take a reference to the returned element, as such they |
* are UNSAFE if you require the returned element to live beyond the next time |
* the DOM gets a chance to change. */ |
dom_exception dom_element_named_ancestor_node(dom_element *element, |
lwc_string *name, dom_element **ancestor); |
dom_exception dom_element_named_parent_node(dom_element *element, |
lwc_string *name, dom_element **parent); |
dom_exception dom_element_parent_node(dom_element *element, |
dom_element **parent); |
#endif |
/contrib/network/netsurf/include/dom/core/entity_ref.h |
---|
0,0 → 1,13 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef dom_core_entityreference_h_ |
#define dom_core_entityreference_h_ |
typedef struct dom_entity_reference dom_entity_reference; |
#endif |
/contrib/network/netsurf/include/dom/core/exceptions.h |
---|
0,0 → 1,52 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef dom_core_exceptions_h_ |
#define dom_core_exceptions_h_ |
/** |
* Class of a DOM exception. |
* |
* The top 16 bits of a dom_exception are a bitfield |
* indicating which class the exception belongs to. |
*/ |
typedef enum { |
DOM_EXCEPTION_CLASS_NORMAL = 0, |
DOM_EXCEPTION_CLASS_EVENT = (1<<30), |
DOM_EXCEPTION_CLASS_INTERNAL = (1<<31) |
} dom_exception_class; |
/* The DOM spec says that this is actually an unsigned short */ |
typedef enum { |
DOM_NO_ERR = 0, |
DOM_INDEX_SIZE_ERR = 1, |
DOM_DOMSTRING_SIZE_ERR = 2, |
DOM_HIERARCHY_REQUEST_ERR = 3, |
DOM_WRONG_DOCUMENT_ERR = 4, |
DOM_INVALID_CHARACTER_ERR = 5, |
DOM_NO_DATA_ALLOWED_ERR = 6, |
DOM_NO_MODIFICATION_ALLOWED_ERR = 7, |
DOM_NOT_FOUND_ERR = 8, |
DOM_NOT_SUPPORTED_ERR = 9, |
DOM_INUSE_ATTRIBUTE_ERR = 10, |
DOM_INVALID_STATE_ERR = 11, |
DOM_SYNTAX_ERR = 12, |
DOM_INVALID_MODIFICATION_ERR = 13, |
DOM_NAMESPACE_ERR = 14, |
DOM_INVALID_ACCESS_ERR = 15, |
DOM_VALIDATION_ERR = 16, |
DOM_TYPE_MISMATCH_ERR = 17, |
DOM_UNSPECIFIED_EVENT_TYPE_ERR = DOM_EXCEPTION_CLASS_EVENT + 0, |
DOM_DISPATCH_REQUEST_ERR = DOM_EXCEPTION_CLASS_EVENT + 1, |
DOM_NO_MEM_ERR = DOM_EXCEPTION_CLASS_INTERNAL + 0, |
DOM_ATTR_WRONG_TYPE_ERR = DOM_EXCEPTION_CLASS_INTERNAL + 1 |
/* our own internal error */ |
} dom_exception; |
#endif |
/contrib/network/netsurf/include/dom/core/implementation.h |
---|
0,0 → 1,53 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef dom_core_implementation_h_ |
#define dom_core_implementation_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/events/document_event.h> |
#include <dom/functypes.h> |
struct dom_document; |
struct dom_document_type; |
typedef const char dom_implementation; |
typedef enum dom_implementation_type { |
DOM_IMPLEMENTATION_CORE = 0, |
DOM_IMPLEMENTATION_XML = (1 << 0), /* not implemented */ |
DOM_IMPLEMENTATION_HTML = (1 << 1), |
DOM_IMPLEMENTATION_ALL = DOM_IMPLEMENTATION_CORE | |
DOM_IMPLEMENTATION_XML | |
DOM_IMPLEMENTATION_HTML |
} dom_implementation_type; |
dom_exception dom_implementation_has_feature( |
const char *feature, const char *version, |
bool *result); |
dom_exception dom_implementation_create_document_type( |
const char *qname, |
const char *public_id, const char *system_id, |
struct dom_document_type **doctype); |
dom_exception dom_implementation_create_document( |
uint32_t impl_type, |
const char *namespace, const char *qname, |
struct dom_document_type *doctype, |
dom_events_default_action_fetcher daf, |
void *daf_ctx, |
struct dom_document **doc); |
dom_exception dom_implementation_get_feature( |
const char *feature, const char *version, |
void **object); |
#endif |
/contrib/network/netsurf/include/dom/core/namednodemap.h |
---|
0,0 → 1,83 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef dom_core_namednodemap_h_ |
#define dom_core_namednodemap_h_ |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
struct dom_node; |
typedef struct dom_namednodemap dom_namednodemap; |
void dom_namednodemap_ref(struct dom_namednodemap *map); |
void dom_namednodemap_unref(struct dom_namednodemap *map); |
dom_exception dom_namednodemap_get_length(struct dom_namednodemap *map, |
uint32_t *length); |
dom_exception _dom_namednodemap_get_named_item(struct dom_namednodemap *map, |
dom_string *name, struct dom_node **node); |
#define dom_namednodemap_get_named_item(m, n, r) \ |
_dom_namednodemap_get_named_item((dom_namednodemap *) (m), \ |
(n), (dom_node **) (r)) |
dom_exception _dom_namednodemap_set_named_item(struct dom_namednodemap *map, |
struct dom_node *arg, struct dom_node **node); |
#define dom_namednodemap_set_named_item(m, a, n) \ |
_dom_namednodemap_set_named_item((dom_namednodemap *) (m), \ |
(dom_node *) (a), (dom_node **) (n)) |
dom_exception _dom_namednodemap_remove_named_item( |
struct dom_namednodemap *map, dom_string *name, |
struct dom_node **node); |
#define dom_namednodemap_remove_named_item(m, n, r) \ |
_dom_namednodemap_remove_named_item((dom_namednodemap *) (m), \ |
(n), (dom_node **) (r)) |
dom_exception _dom_namednodemap_item(struct dom_namednodemap *map, |
uint32_t index, struct dom_node **node); |
#define dom_namednodemap_item(m, i, n) _dom_namednodemap_item( \ |
(dom_namednodemap *) (m), (uint32_t) (i), \ |
(dom_node **) (n)) |
dom_exception _dom_namednodemap_get_named_item_ns( |
struct dom_namednodemap *map, dom_string *namespace, |
dom_string *localname, struct dom_node **node); |
#define dom_namednodemap_get_named_item_ns(m, n, l, r) \ |
_dom_namednodemap_get_named_item_ns((dom_namednodemap *) (m), \ |
(n), (l), (dom_node **) (r)) |
dom_exception _dom_namednodemap_set_named_item_ns( |
struct dom_namednodemap *map, struct dom_node *arg, |
struct dom_node **node); |
#define dom_namednodemap_set_named_item_ns(m, a, n) \ |
_dom_namednodemap_set_named_item_ns((dom_namednodemap *) (m), \ |
(dom_node *) (a), (dom_node **) (n)) |
dom_exception _dom_namednodemap_remove_named_item_ns( |
struct dom_namednodemap *map, dom_string *namespace, |
dom_string *localname, struct dom_node **node); |
#define dom_namednodemap_remove_named_item_ns(m, n, l, r) \ |
_dom_namednodemap_remove_named_item_ns(\ |
(dom_namednodemap *) (m), (n),(l), (dom_node **) (r)) |
#endif |
/contrib/network/netsurf/include/dom/core/node.h |
---|
0,0 → 1,569 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef dom_core_node_h_ |
#define dom_core_node_h_ |
#include <inttypes.h> |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
#include <dom/events/event_target.h> |
struct dom_document; |
struct dom_nodelist; |
struct dom_namednodemap; |
struct dom_node; |
/** |
* Bits defining position of a node in a document relative to some other node |
*/ |
typedef enum { |
DOM_DOCUMENT_POSITION_DISCONNECTED = 0x01, |
DOM_DOCUMENT_POSITION_PRECEDING = 0x02, |
DOM_DOCUMENT_POSITION_FOLLOWING = 0x04, |
DOM_DOCUMENT_POSITION_CONTAINS = 0x08, |
DOM_DOCUMENT_POSITION_CONTAINED_BY = 0x10, |
DOM_DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20 |
} dom_document_position; |
/** |
* Type of node operation being notified to user_data_handler |
*/ |
typedef enum { |
DOM_NODE_CLONED = 1, |
DOM_NODE_IMPORTED = 2, |
DOM_NODE_DELETED = 3, |
DOM_NODE_RENAMED = 4, |
DOM_NODE_ADOPTED = 5 |
} dom_node_operation; |
/** |
* Type of handler function for user data registered on a DOM node |
*/ |
typedef void (*dom_user_data_handler)(dom_node_operation operation, |
dom_string *key, void *data, struct dom_node *src, |
struct dom_node *dst); |
/** |
* Type of a DOM node |
*/ |
typedef enum { |
DOM_ELEMENT_NODE = 1, |
DOM_ATTRIBUTE_NODE = 2, |
DOM_TEXT_NODE = 3, |
DOM_CDATA_SECTION_NODE = 4, |
DOM_ENTITY_REFERENCE_NODE = 5, |
DOM_ENTITY_NODE = 6, |
DOM_PROCESSING_INSTRUCTION_NODE = 7, |
DOM_COMMENT_NODE = 8, |
DOM_DOCUMENT_NODE = 9, |
DOM_DOCUMENT_TYPE_NODE = 10, |
DOM_DOCUMENT_FRAGMENT_NODE = 11, |
DOM_NOTATION_NODE = 12, |
/* And a count of the number of node types */ |
DOM_NODE_TYPE_COUNT = DOM_NOTATION_NODE |
} dom_node_type; |
typedef struct dom_node_internal dom_node_internal; |
/** |
* DOM node type |
*/ |
typedef struct dom_node { |
void *vtable; |
uint32_t refcnt; |
} dom_node; |
/* DOM node vtable */ |
typedef struct dom_node_vtable { |
dom_event_target_vtable base; |
/* pre-destruction hook */ |
dom_exception (*dom_node_try_destroy)(dom_node_internal *node); |
/* The DOM level 3 node's oprations */ |
dom_exception (*dom_node_get_node_name)(dom_node_internal *node, |
dom_string **result); |
dom_exception (*dom_node_get_node_value)(dom_node_internal *node, |
dom_string **result); |
dom_exception (*dom_node_set_node_value)(dom_node_internal *node, |
dom_string *value); |
dom_exception (*dom_node_get_node_type)(dom_node_internal *node, |
dom_node_type *result); |
dom_exception (*dom_node_get_parent_node)(dom_node_internal *node, |
dom_node_internal **result); |
dom_exception (*dom_node_get_child_nodes)(dom_node_internal *node, |
struct dom_nodelist **result); |
dom_exception (*dom_node_get_first_child)(dom_node_internal *node, |
dom_node_internal **result); |
dom_exception (*dom_node_get_last_child)(dom_node_internal *node, |
dom_node_internal **result); |
dom_exception (*dom_node_get_previous_sibling)(dom_node_internal *node, |
dom_node_internal **result); |
dom_exception (*dom_node_get_next_sibling)(dom_node_internal *node, |
dom_node_internal **result); |
dom_exception (*dom_node_get_attributes)(dom_node_internal *node, |
struct dom_namednodemap **result); |
dom_exception (*dom_node_get_owner_document)(dom_node_internal *node, |
struct dom_document **result); |
dom_exception (*dom_node_insert_before)(dom_node_internal *node, |
dom_node_internal *new_child, |
dom_node_internal *ref_child, |
dom_node_internal **result); |
dom_exception (*dom_node_replace_child)(dom_node_internal *node, |
dom_node_internal *new_child, |
dom_node_internal *old_child, |
dom_node_internal **result); |
dom_exception (*dom_node_remove_child)(dom_node_internal *node, |
dom_node_internal *old_child, |
dom_node_internal **result); |
dom_exception (*dom_node_append_child)(dom_node_internal *node, |
dom_node_internal *new_child, |
dom_node_internal **result); |
dom_exception (*dom_node_has_child_nodes)(dom_node_internal *node, |
bool *result); |
dom_exception (*dom_node_clone_node)(dom_node_internal *node, bool deep, |
dom_node_internal **result); |
dom_exception (*dom_node_normalize)(dom_node_internal *node); |
dom_exception (*dom_node_is_supported)(dom_node_internal *node, |
dom_string *feature, dom_string *version, |
bool *result); |
dom_exception (*dom_node_get_namespace)(dom_node_internal *node, |
dom_string **result); |
dom_exception (*dom_node_get_prefix)(dom_node_internal *node, |
dom_string **result); |
dom_exception (*dom_node_set_prefix)(dom_node_internal *node, |
dom_string *prefix); |
dom_exception (*dom_node_get_local_name)(dom_node_internal *node, |
dom_string **result); |
dom_exception (*dom_node_has_attributes)(dom_node_internal *node, |
bool *result); |
dom_exception (*dom_node_get_base)(dom_node_internal *node, |
dom_string **result); |
dom_exception (*dom_node_compare_document_position)( |
dom_node_internal *node, dom_node_internal *other, |
uint16_t *result); |
dom_exception (*dom_node_get_text_content)(dom_node_internal *node, |
dom_string **result); |
dom_exception (*dom_node_set_text_content)(dom_node_internal *node, |
dom_string *content); |
dom_exception (*dom_node_is_same)(dom_node_internal *node, |
dom_node_internal *other, bool *result); |
dom_exception (*dom_node_lookup_prefix)(dom_node_internal *node, |
dom_string *namespace, |
dom_string **result); |
dom_exception (*dom_node_is_default_namespace)(dom_node_internal *node, |
dom_string *namespace, bool *result); |
dom_exception (*dom_node_lookup_namespace)(dom_node_internal *node, |
dom_string *prefix, dom_string **result); |
dom_exception (*dom_node_is_equal)(dom_node_internal *node, |
dom_node_internal *other, bool *result); |
dom_exception (*dom_node_get_feature)(dom_node_internal *node, |
dom_string *feature, dom_string *version, |
void **result); |
dom_exception (*dom_node_set_user_data)(dom_node_internal *node, |
dom_string *key, void *data, |
dom_user_data_handler handler, void **result); |
dom_exception (*dom_node_get_user_data)(dom_node_internal *node, |
dom_string *key, void **result); |
} dom_node_vtable; |
/* The ref/unref methods define */ |
static inline dom_node *dom_node_ref(dom_node *node) |
{ |
if (node != NULL) |
node->refcnt++; |
return node; |
} |
#define dom_node_ref(n) dom_node_ref((dom_node *) (n)) |
static inline dom_exception dom_node_try_destroy(dom_node *node) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_try_destroy( |
(dom_node_internal *) node); |
} |
#define dom_node_try_destroy(n) dom_node_try_destroy((dom_node *) (n)) |
static inline void dom_node_unref(dom_node *node) |
{ |
if (node != NULL) { |
if (--node->refcnt == 0) |
dom_node_try_destroy(node); |
} |
} |
#define dom_node_unref(n) dom_node_unref((dom_node *) (n)) |
static inline dom_exception dom_node_get_node_name(struct dom_node *node, |
dom_string **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_get_node_name( |
(dom_node_internal *) node, result); |
} |
#define dom_node_get_node_name(n, r) dom_node_get_node_name((dom_node *) (n), (r)) |
static inline dom_exception dom_node_get_node_value(struct dom_node *node, |
dom_string **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_get_node_value( |
(dom_node_internal *) node, result); |
} |
#define dom_node_get_node_value(n, r) dom_node_get_node_value( \ |
(dom_node *) (n), (r)) |
static inline dom_exception dom_node_set_node_value(struct dom_node *node, |
dom_string *value) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_set_node_value( |
(dom_node_internal *) node, value); |
} |
#define dom_node_set_node_value(n, v) dom_node_set_node_value( \ |
(dom_node *) (n), (v)) |
static inline dom_exception dom_node_get_node_type(struct dom_node *node, |
dom_node_type *result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_get_node_type( |
(dom_node_internal *) node, result); |
} |
#define dom_node_get_node_type(n, r) dom_node_get_node_type( \ |
(dom_node *) (n), (dom_node_type *) (r)) |
static inline dom_exception dom_node_get_parent_node(struct dom_node *node, |
dom_node **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_get_parent_node( |
(dom_node_internal *) node, |
(dom_node_internal **) result); |
} |
#define dom_node_get_parent_node(n, r) dom_node_get_parent_node( \ |
(dom_node *) (n), (dom_node **) (r)) |
static inline dom_exception dom_node_get_child_nodes(struct dom_node *node, |
struct dom_nodelist **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_get_child_nodes( |
(dom_node_internal *) node, result); |
} |
#define dom_node_get_child_nodes(n, r) dom_node_get_child_nodes( \ |
(dom_node *) (n), (struct dom_nodelist **) (r)) |
static inline dom_exception dom_node_get_first_child(struct dom_node *node, |
dom_node **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_get_first_child( |
(dom_node_internal *) node, |
(dom_node_internal **) result); |
} |
#define dom_node_get_first_child(n, r) dom_node_get_first_child( \ |
(dom_node *) (n), (dom_node **) (r)) |
static inline dom_exception dom_node_get_last_child(struct dom_node *node, |
dom_node **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_get_last_child( |
(dom_node_internal *) node, |
(dom_node_internal **) result); |
} |
#define dom_node_get_last_child(n, r) dom_node_get_last_child( \ |
(dom_node *) (n), (dom_node **) (r)) |
static inline dom_exception dom_node_get_previous_sibling( |
struct dom_node *node, dom_node **result) |
{ |
return ((dom_node_vtable *) node->vtable)-> |
dom_node_get_previous_sibling( |
(dom_node_internal *) node, |
(dom_node_internal **) result); |
} |
#define dom_node_get_previous_sibling(n, r) dom_node_get_previous_sibling( \ |
(dom_node *) (n), (dom_node **) (r)) |
static inline dom_exception dom_node_get_next_sibling(struct dom_node *node, |
dom_node **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_get_next_sibling( |
(dom_node_internal *) node, |
(dom_node_internal **) result); |
} |
#define dom_node_get_next_sibling(n, r) dom_node_get_next_sibling( \ |
(dom_node *) (n), (dom_node **) (r)) |
static inline dom_exception dom_node_get_attributes(struct dom_node *node, |
struct dom_namednodemap **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_get_attributes( |
(dom_node_internal *) node, result); |
} |
#define dom_node_get_attributes(n, r) dom_node_get_attributes( \ |
(dom_node *) (n), (struct dom_namednodemap **) (r)) |
static inline dom_exception dom_node_get_owner_document(struct dom_node *node, |
struct dom_document **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_get_owner_document( |
(dom_node_internal *) node, result); |
} |
#define dom_node_get_owner_document(n, r) dom_node_get_owner_document( \ |
(dom_node *) (n), (struct dom_document **) (r)) |
static inline dom_exception dom_node_insert_before(struct dom_node *node, |
struct dom_node *new_child, struct dom_node *ref_child, |
struct dom_node **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_insert_before( |
(dom_node_internal *) node, |
(dom_node_internal *) new_child, |
(dom_node_internal *) ref_child, |
(dom_node_internal **) result); |
} |
#define dom_node_insert_before(n, nn, ref, ret) dom_node_insert_before( \ |
(dom_node *) (n), (dom_node *) (nn), (dom_node *) (ref),\ |
(dom_node **) (ret)) |
static inline dom_exception dom_node_replace_child(struct dom_node *node, |
struct dom_node *new_child, struct dom_node *old_child, |
struct dom_node **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_replace_child( |
(dom_node_internal *) node, |
(dom_node_internal *) new_child, |
(dom_node_internal *) old_child, |
(dom_node_internal **) result); |
} |
#define dom_node_replace_child(n, nn, old, ret) dom_node_replace_child( \ |
(dom_node *) (n), (dom_node *) (nn), (dom_node *) (old),\ |
(dom_node **) (ret)) |
static inline dom_exception dom_node_remove_child(struct dom_node *node, |
struct dom_node *old_child, |
struct dom_node **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_remove_child( |
(dom_node_internal *) node, |
(dom_node_internal *) old_child, |
(dom_node_internal **) result); |
} |
#define dom_node_remove_child(n, old, ret) dom_node_remove_child( \ |
(dom_node *) (n), (dom_node *) (old), (dom_node **) (ret)) |
static inline dom_exception dom_node_append_child(struct dom_node *node, |
struct dom_node *new_child, |
struct dom_node **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_append_child( |
(dom_node_internal *) node, |
(dom_node_internal *) new_child, |
(dom_node_internal **) result); |
} |
#define dom_node_append_child(n, nn, ret) dom_node_append_child( \ |
(dom_node *) (n), (dom_node *) (nn), (dom_node **) (ret)) |
static inline dom_exception dom_node_has_child_nodes(struct dom_node *node, |
bool *result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_has_child_nodes( |
(dom_node_internal *) node, result); |
} |
#define dom_node_has_child_nodes(n, r) dom_node_has_child_nodes( \ |
(dom_node *) (n), (bool *) (r)) |
static inline dom_exception dom_node_clone_node(struct dom_node *node, |
bool deep, struct dom_node **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_clone_node( |
(dom_node_internal *) node, deep, |
(dom_node_internal **) result); |
} |
#define dom_node_clone_node(n, d, r) dom_node_clone_node((dom_node *) (n), \ |
(bool) (d), (dom_node **) (r)) |
static inline dom_exception dom_node_normalize(struct dom_node *node) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_normalize( |
(dom_node_internal *) node); |
} |
#define dom_node_normalize(n) dom_node_normalize((dom_node *) (n)) |
static inline dom_exception dom_node_is_supported(struct dom_node *node, |
dom_string *feature, dom_string *version, |
bool *result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_is_supported( |
(dom_node_internal *) node, feature, |
version, result); |
} |
#define dom_node_is_supported(n, f, v, r) dom_node_is_supported( \ |
(dom_node *) (n), (f), (v), (bool *) (r)) |
static inline dom_exception dom_node_get_namespace(struct dom_node *node, |
dom_string **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_get_namespace( |
(dom_node_internal *) node, result); |
} |
#define dom_node_get_namespace(n, r) dom_node_get_namespace((dom_node *) (n), (r)) |
static inline dom_exception dom_node_get_prefix(struct dom_node *node, |
dom_string **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_get_prefix( |
(dom_node_internal *) node, result); |
} |
#define dom_node_get_prefix(n, r) dom_node_get_prefix((dom_node *) (n), (r)) |
static inline dom_exception dom_node_set_prefix(struct dom_node *node, |
dom_string *prefix) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_set_prefix( |
(dom_node_internal *) node, prefix); |
} |
#define dom_node_set_prefix(n, p) dom_node_set_prefix((dom_node *) (n), (p)) |
static inline dom_exception dom_node_get_local_name(struct dom_node *node, |
dom_string **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_get_local_name( |
(dom_node_internal *) node, result); |
} |
#define dom_node_get_local_name(n, r) dom_node_get_local_name((dom_node *) (n), (r)) |
static inline dom_exception dom_node_has_attributes(struct dom_node *node, |
bool *result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_has_attributes( |
(dom_node_internal *) node, result); |
} |
#define dom_node_has_attributes(n, r) dom_node_has_attributes( \ |
(dom_node *) (n), (bool *) (r)) |
static inline dom_exception dom_node_get_base(struct dom_node *node, |
dom_string **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_get_base( |
(dom_node_internal *) node, result); |
} |
#define dom_node_get_base(n, r) dom_node_get_base((dom_node *) (n), (r)) |
static inline dom_exception dom_node_compare_document_position( |
struct dom_node *node, struct dom_node *other, |
uint16_t *result) |
{ |
return ((dom_node_vtable *) node->vtable)-> |
dom_node_compare_document_position( |
(dom_node_internal *) node, |
(dom_node_internal *) other, result); |
} |
#define dom_node_compare_document_position(n, o, r) \ |
dom_node_compare_document_position((dom_node *) (n), \ |
(dom_node *) (o), (uint16_t *) (r)) |
static inline dom_exception dom_node_get_text_content(struct dom_node *node, |
dom_string **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_get_text_content( |
(dom_node_internal *) node, result); |
} |
#define dom_node_get_text_content(n, r) dom_node_get_text_content( \ |
(dom_node *) (n), (r)) |
static inline dom_exception dom_node_set_text_content(struct dom_node *node, |
dom_string *content) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_set_text_content( |
(dom_node_internal *) node, content); |
} |
#define dom_node_set_text_content(n, c) dom_node_set_text_content( \ |
(dom_node *) (n), (c)) |
static inline dom_exception dom_node_is_same(struct dom_node *node, |
struct dom_node *other, bool *result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_is_same( |
(dom_node_internal *) node, |
(dom_node_internal *) other, |
result); |
} |
#define dom_node_is_same(n, o, r) dom_node_is_same((dom_node *) (n), \ |
(dom_node *) (o), (bool *) (r)) |
static inline dom_exception dom_node_lookup_prefix(struct dom_node *node, |
dom_string *namespace, dom_string **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_lookup_prefix( |
(dom_node_internal *) node, namespace, result); |
} |
#define dom_node_lookup_prefix(n, ns, r) dom_node_lookup_prefix( \ |
(dom_node *) (n), (ns), (r)) |
static inline dom_exception dom_node_is_default_namespace( |
struct dom_node *node, dom_string *namespace, |
bool *result) |
{ |
return ((dom_node_vtable *) node->vtable)-> |
dom_node_is_default_namespace( |
(dom_node_internal *) node, namespace, result); |
} |
#define dom_node_is_default_namespace(n, ns, r) dom_node_is_default_namespace(\ |
(dom_node *) (n), (ns), (bool *) (r)) |
static inline dom_exception dom_node_lookup_namespace(struct dom_node *node, |
dom_string *prefix, dom_string **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_lookup_namespace( |
(dom_node_internal *) node, prefix, result); |
} |
#define dom_node_lookup_namespace(n, p, r) dom_node_lookup_namespace( \ |
(dom_node *) (n), (p), (r)) |
static inline dom_exception dom_node_is_equal(struct dom_node *node, |
struct dom_node *other, bool *result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_is_equal( |
(dom_node_internal *) node, |
(dom_node_internal *) other, |
result); |
} |
#define dom_node_is_equal(n, o, r) dom_node_is_equal((dom_node *) (n), \ |
(dom_node *) (o), (bool *) (r)) |
static inline dom_exception dom_node_get_feature(struct dom_node *node, |
dom_string *feature, dom_string *version, |
void **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_get_feature( |
(dom_node_internal *) node, feature, version, result); |
} |
#define dom_node_get_feature(n, f, v, r) dom_node_get_feature( \ |
(dom_node *) (n), (f), (v), (void **) (r)) |
static inline dom_exception dom_node_set_user_data(struct dom_node *node, |
dom_string *key, void *data, |
dom_user_data_handler handler, void **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_set_user_data( |
(dom_node_internal *) node, key, data, handler, |
result); |
} |
#define dom_node_set_user_data(n, k, d, h, r) dom_node_set_user_data( \ |
(dom_node *) (n), (k), (void *) (d), \ |
(dom_user_data_handler) h, (void **) (r)) |
static inline dom_exception dom_node_get_user_data(struct dom_node *node, |
dom_string *key, void **result) |
{ |
return ((dom_node_vtable *) node->vtable)->dom_node_get_user_data( |
(dom_node_internal *) node, key, result); |
} |
#define dom_node_get_user_data(n, k, r) dom_node_get_user_data( \ |
(dom_node *) (n), (k), (void **) (r)) |
#endif |
/contrib/network/netsurf/include/dom/core/nodelist.h |
---|
0,0 → 1,28 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef dom_core_nodelist_h_ |
#define dom_core_nodelist_h_ |
#include <dom/core/exceptions.h> |
struct dom_node; |
typedef struct dom_nodelist dom_nodelist; |
void dom_nodelist_ref(struct dom_nodelist *list); |
void dom_nodelist_unref(struct dom_nodelist *list); |
dom_exception dom_nodelist_get_length(struct dom_nodelist *list, |
uint32_t *length); |
dom_exception _dom_nodelist_item(struct dom_nodelist *list, |
uint32_t index, struct dom_node **node); |
#define dom_nodelist_item(l, i, n) _dom_nodelist_item((dom_nodelist *) (l), \ |
(uint32_t) (i), (dom_node **) (n)) |
#endif |
/contrib/network/netsurf/include/dom/core/pi.h |
---|
0,0 → 1,13 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef dom_core_processinginstruction_h_ |
#define dom_core_processinginstruction_h_ |
typedef struct dom_processing_instruction dom_processing_instruction; |
#endif |
/contrib/network/netsurf/include/dom/core/string.h |
---|
0,0 → 1,116 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef dom_string_h_ |
#define dom_string_h_ |
#include <inttypes.h> |
#include <stddef.h> |
#include <libwapcaplet/libwapcaplet.h> |
#include <dom/functypes.h> |
#include <dom/core/exceptions.h> |
typedef struct dom_string dom_string; |
struct dom_string { |
uint32_t refcnt; |
} _ALIGNED; |
/* Claim a reference on a DOM string */ |
static inline dom_string *dom_string_ref(dom_string *str) |
{ |
if (str != NULL) |
str->refcnt++; |
return str; |
} |
/* Destroy a DOM string */ |
void dom_string_destroy(dom_string *str); |
/* Release a reference on a DOM string */ |
static inline void dom_string_unref(dom_string *str) |
{ |
if ((str != NULL) && (--(str->refcnt) == 0)) { |
dom_string_destroy(str); |
} |
} |
/* Create a DOM string from a string of characters */ |
dom_exception dom_string_create(const uint8_t *ptr, size_t len, |
dom_string **str); |
dom_exception dom_string_create_interned(const uint8_t *ptr, size_t len, |
dom_string **str); |
/* Obtain an interned representation of a dom string */ |
dom_exception dom_string_intern(dom_string *str, |
struct lwc_string_s **lwcstr); |
/* Case sensitively compare two DOM strings */ |
bool dom_string_isequal(const dom_string *s1, const dom_string *s2); |
/* Case insensitively compare two DOM strings */ |
bool dom_string_caseless_isequal(const dom_string *s1, const dom_string *s2); |
/* Case sensitively compare DOM string and lwc_string */ |
bool dom_string_lwc_isequal(const dom_string *s1, lwc_string *s2); |
/* Case insensitively compare DOM string and lwc_string */ |
bool dom_string_caseless_lwc_isequal(const dom_string *s1, lwc_string *s2); |
/* Get the index of the first occurrence of a character in a dom string */ |
uint32_t dom_string_index(dom_string *str, uint32_t chr); |
/* Get the index of the last occurrence of a character in a dom string */ |
uint32_t dom_string_rindex(dom_string *str, uint32_t chr); |
/* Get the length, in characters, of a dom string */ |
uint32_t dom_string_length(dom_string *str); |
/** |
* Get the raw character data of the dom_string. |
* @note: This function is just provided for the convenience of accessing the |
* raw C string character, no change on the result string is allowed. |
*/ |
const char *dom_string_data(const dom_string *str); |
/* Get the byte length of this dom_string */ |
size_t dom_string_byte_length(const dom_string *str); |
/* Get the UCS-4 character at position index, the index should be in |
* [0, length), and length can be get by calling dom_string_length |
*/ |
dom_exception dom_string_at(dom_string *str, uint32_t index, |
uint32_t *ch); |
/* Concatenate two dom strings */ |
dom_exception dom_string_concat(dom_string *s1, dom_string *s2, |
dom_string **result); |
/* Extract a substring from a dom string */ |
dom_exception dom_string_substr(dom_string *str, |
uint32_t i1, uint32_t i2, dom_string **result); |
/* Insert data into a dom string at the given location */ |
dom_exception dom_string_insert(dom_string *target, |
dom_string *source, uint32_t offset, |
dom_string **result); |
/* Replace a section of a dom string */ |
dom_exception dom_string_replace(dom_string *target, |
dom_string *source, uint32_t i1, uint32_t i2, |
dom_string **result); |
/* Generate an uppercase version of the given string */ |
dom_exception dom_string_toupper(dom_string *source, bool ascii_only, |
dom_string **upper); |
/* Generate an lowercase version of the given string */ |
dom_exception dom_string_tolower(dom_string *source, bool ascii_only, |
dom_string **lower); |
/* Calculate a hash value from a dom string */ |
uint32_t dom_string_hash(dom_string *str); |
#endif |
/contrib/network/netsurf/include/dom/core/text.h |
---|
0,0 → 1,70 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef dom_core_text_h_ |
#define dom_core_text_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/characterdata.h> |
struct dom_characterdata; |
typedef struct dom_text dom_text; |
typedef struct dom_text_vtable { |
struct dom_characterdata_vtable base; |
dom_exception (*dom_text_split_text)(struct dom_text *text, |
uint32_t offset, struct dom_text **result); |
dom_exception (*dom_text_get_is_element_content_whitespace)( |
struct dom_text *text, bool *result); |
dom_exception (*dom_text_get_whole_text)(struct dom_text *text, |
dom_string **result); |
dom_exception (*dom_text_replace_whole_text)(struct dom_text *text, |
dom_string *content, struct dom_text **result); |
} dom_text_vtable; |
static inline dom_exception dom_text_split_text(struct dom_text *text, |
uint32_t offset, struct dom_text **result) |
{ |
return ((dom_text_vtable *) ((dom_node *) text)->vtable)-> |
dom_text_split_text(text, offset, result); |
} |
#define dom_text_split_text(t, o, r) dom_text_split_text((dom_text *) (t), \ |
(uint32_t) (o), (dom_text **) (r)) |
static inline dom_exception dom_text_get_is_element_content_whitespace( |
struct dom_text *text, bool *result) |
{ |
return ((dom_text_vtable *) ((dom_node *) text)->vtable)-> |
dom_text_get_is_element_content_whitespace(text, |
result); |
} |
#define dom_text_get_is_element_content_whitespace(t, r) \ |
dom_text_get_is_element_content_whitespace((dom_text *) (t), \ |
(bool *) (r)) |
static inline dom_exception dom_text_get_whole_text(struct dom_text *text, |
dom_string **result) |
{ |
return ((dom_text_vtable *) ((dom_node *) text)->vtable)-> |
dom_text_get_whole_text(text, result); |
} |
#define dom_text_get_whole_text(t, r) dom_text_get_whole_text((dom_text *) (t), (r)) |
static inline dom_exception dom_text_replace_whole_text(struct dom_text *text, |
dom_string *content, struct dom_text **result) |
{ |
return ((dom_text_vtable *) ((dom_node *) text)->vtable)-> |
dom_text_replace_whole_text(text, content, result); |
} |
#define dom_text_replace_whole_text(t, c, r) dom_text_replace_whole_text( \ |
(dom_text *) (t), (c), (dom_text **) (r)) |
#endif |
/contrib/network/netsurf/include/dom/core/typeinfo.h |
---|
0,0 → 1,45 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_core_typeinfo_h_ |
#define dom_core_typeinfo_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
typedef struct dom_type_info dom_type_info; |
typedef enum { |
DOM_TYPE_INFO_DERIVATION_RESTRICTION = 0x00000001, |
DOM_TYPE_INFO_DERIVATION_EXTENSION = 0x00000002, |
DOM_TYPE_INFO_DERIVATION_UNION = 0x00000004, |
DOM_TYPE_INFO_DERIVATION_LIST = 0x00000008 |
} dom_type_info_derivation_method; |
dom_exception _dom_type_info_get_type_name(dom_type_info *ti, |
dom_string **ret); |
#define dom_type_info_get_type_name(t, r) _dom_type_info_get_type_name( \ |
(dom_type_info *) (t), (r)) |
dom_exception _dom_type_info_get_type_namespace(dom_type_info *ti, |
dom_string **ret); |
#define dom_type_info_get_type_namespace(t, r) \ |
_dom_type_info_get_type_namespace((dom_type_info *) (t), (r)) |
dom_exception _dom_type_info_is_derived(dom_type_info *ti, |
dom_string *namespace, dom_string *name, |
dom_type_info_derivation_method method, bool *ret); |
#define dom_type_info_is_derived(t, s, n, m, r) _dom_type_info_is_derived(\ |
(dom_type_info *) (t), (s), (n), \ |
(dom_type_info_derivation_method) (m), (bool *) (r)) |
#endif |
/contrib/network/netsurf/include/dom/dom.h |
---|
0,0 → 1,75 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
/** \file |
* This is the top-level header file for libdom. The intention of this is |
* to allow client applications to simply include this file and get access |
* to all the libdom API. |
*/ |
#ifndef dom_dom_h_ |
#define dom_dom_h_ |
/* Base library headers */ |
#include <dom/functypes.h> |
/* DOM core headers */ |
#include <dom/core/attr.h> |
#include <dom/core/characterdata.h> |
#include <dom/core/document.h> |
#include <dom/core/document_type.h> |
#include <dom/core/element.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/implementation.h> |
#include <dom/core/namednodemap.h> |
#include <dom/core/node.h> |
#include <dom/core/cdatasection.h> |
#include <dom/core/doc_fragment.h> |
#include <dom/core/entity_ref.h> |
#include <dom/core/nodelist.h> |
#include <dom/core/string.h> |
#include <dom/core/text.h> |
#include <dom/core/pi.h> |
#include <dom/core/typeinfo.h> |
#include <dom/core/comment.h> |
/* DOM HTML headers */ |
#include <dom/html/html_collection.h> |
#include <dom/html/html_document.h> |
#include <dom/html/html_element.h> |
#include <dom/html/html_html_element.h> |
#include <dom/html/html_head_element.h> |
#include <dom/html/html_link_element.h> |
#include <dom/html/html_title_element.h> |
#include <dom/html/html_body_element.h> |
#include <dom/html/html_meta_element.h> |
#include <dom/html/html_form_element.h> |
#include <dom/html/html_input_element.h> |
#include <dom/html/html_button_element.h> |
#include <dom/html/html_text_area_element.h> |
#include <dom/html/html_opt_group_element.h> |
#include <dom/html/html_option_element.h> |
#include <dom/html/html_select_element.h> |
/* DOM Events header */ |
#include <dom/events/events.h> |
typedef enum dom_namespace { |
DOM_NAMESPACE_NULL = 0, |
DOM_NAMESPACE_HTML = 1, |
DOM_NAMESPACE_MATHML = 2, |
DOM_NAMESPACE_SVG = 3, |
DOM_NAMESPACE_XLINK = 4, |
DOM_NAMESPACE_XML = 5, |
DOM_NAMESPACE_XMLNS = 6, |
DOM_NAMESPACE_COUNT = 7 |
} dom_namespace; |
extern dom_string *dom_namespaces[DOM_NAMESPACE_COUNT]; |
#endif |
/contrib/network/netsurf/include/dom/events/custom_event.h |
---|
0,0 → 1,31 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_events_custom_event_h_ |
#define dom_events_custom_event_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
typedef struct dom_custom_event dom_custom_event; |
dom_exception _dom_custom_event_get_detail(dom_custom_event *evt, |
void **detail); |
#define dom_custom_event_get_detail(e, d) \ |
_dom_custom_event_get_detail((dom_custom_event *) (e),\ |
(void **) (d)) |
dom_exception _dom_custom_event_init_ns(dom_custom_event *evt, |
dom_string *namespace, dom_string *type, |
bool bubble, bool cancelable, void *detail); |
#define dom_custom_event_init_ns(e, n, t, b, c, d) \ |
_dom_custom_event_init_ns((dom_custom_event *) (e), \ |
(dom_string *) (n), (dom_string *) (t), \ |
(bool) (b), (bool) (c), (void *) (d)) |
#endif |
/contrib/network/netsurf/include/dom/events/document_event.h |
---|
0,0 → 1,100 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_events_document_event_h_ |
#define dom_events_document_event_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
struct dom_event; |
struct dom_document; |
typedef struct dom_document dom_document_event; |
/** |
* The callback function which is used to process the default action of any |
* event. |
* |
* As ::dom_default_action_phase defines, we have three points in our |
* implementation where these kinds of callbacks get invoked. |
* |
* When the implementation start to dispatch certain event, it firstly invoke |
* the following callback, which should process the event before the normal |
* event flow. |
* |
* Take a MousePressed event on a check box object as example: |
* 1. The 'pressed' event is generated by OS and catched by our UI code; |
* 2. The UI code dispatch the event to DOM; |
* 3. DOM trys to dispatch the event as what the spec said; |
* 4. Before the real event flow happens, DOM get the |
* dom_default_action_callback function from the |
* dom_events_default_action_fetcher with param |
* DOM_DEFAULT_ACTION_STARTED, and then call it; |
* 5. The callback function invoke some System-denpendent API to make the |
* checkbox checked and then return; |
* 6. Normal event flow goes on. |
* 7. When the implementation reach the end of the event flow, it check whether |
* the event's default action is prevented, if it is, then go to step 8, |
* else go to step 9. |
* 8. The event's default action get prevented, DOM get the |
* dom_default_action_callback function from the |
* dom_events_default_action_fetcher with param |
* DOM_DEFAULT_ACTION_PREVENTED, and then call it. |
* 8. The event's default action does not get prevented, DOM get the |
* dom_default_action_callback function from the |
* dom_events_default_action_fetcher with param |
* DOM_DEFAULT_ACTION_END, and then call it. |
* |
* @note: the point here is that we want the UI related stuff to be done |
* within the default action code. The DOM only take care of the content tree |
* and the event flow itself. |
*/ |
typedef void (*dom_default_action_callback)(struct dom_event *evt, void *pw); |
/** |
* The default action phase |
* |
* @note: we define the following three values to fetch three different types |
* of dom_default_action_callback function and their private data. |
*/ |
typedef enum { |
DOM_DEFAULT_ACTION_STARTED = 0, |
DOM_DEFAULT_ACTION_PREVENTED, |
DOM_DEFAULT_ACTION_END |
} dom_default_action_phase; |
/** |
* The default action fetcher |
* |
* \param type The type of the event |
* \param phase The phase of the default action callback |
* \param pw The return private data of the callback function |
* \return a callback function, NULL if there is none. |
*/ |
typedef dom_default_action_callback (*dom_events_default_action_fetcher) |
(dom_string *type, dom_default_action_phase phase, |
void **pw); |
dom_exception _dom_document_event_create_event(dom_document_event *de, |
dom_string *type, struct dom_event **evt); |
#define dom_document_event_create_event(d, t, e) \ |
_dom_document_event_create_event((dom_document_event *) (d), \ |
(dom_string *) (t), (struct dom_event **) (e)) |
dom_exception _dom_document_event_can_dispatch(dom_document_event *de, |
dom_string *namespace, dom_string *type, |
bool* can); |
#define dom_document_event_can_dispatch(d, n, t, c) \ |
_dom_document_event_can_dispatch((dom_document_event *) (d), \ |
(dom_string *) (n), (dom_string *) (t),\ |
(bool *) (c)) |
#endif |
/contrib/network/netsurf/include/dom/events/event.h |
---|
0,0 → 1,92 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_events_event_h_ |
#define dom_events_event_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
#include <dom/events/event_target.h> |
typedef enum { |
DOM_CAPTURING_PHASE = 1, |
DOM_AT_TARGET = 2, |
DOM_BUBBLING_PHASE = 3 |
} dom_event_flow_phase; |
typedef struct dom_event dom_event; |
/* The ref/unref methods define */ |
void _dom_event_ref(dom_event *evt); |
#define dom_event_ref(n) _dom_event_ref((dom_event *) (n)) |
void _dom_event_unref(dom_event *evt); |
#define dom_event_unref(n) _dom_event_unref((dom_event *) (n)) |
dom_exception _dom_event_get_type(dom_event *evt, dom_string **type); |
#define dom_event_get_type(e, t) _dom_event_get_type((dom_event *) (e), \ |
(dom_string **) (t)) |
dom_exception _dom_event_get_target(dom_event *evt, dom_event_target **target); |
#define dom_event_get_target(e, t) _dom_event_get_target((dom_event *) (e), \ |
(dom_event_target **) (t)) |
dom_exception _dom_event_get_current_target(dom_event *evt, |
dom_event_target **current); |
#define dom_event_get_current_target(e, c) _dom_event_get_current_target(\ |
(dom_event *) (e), (dom_event_target **) (c)) |
dom_exception _dom_event_get_bubbles(dom_event *evt, bool *bubbles); |
#define dom_event_get_bubbles(e, b) _dom_event_get_bubbles((dom_event *) (e), \ |
(bool *) (b)) |
dom_exception _dom_event_get_cancelable(dom_event *evt, bool *cancelable); |
#define dom_event_get_cancelable(e, c) _dom_event_get_cancelable(\ |
(dom_event *) (e), (bool *) (c)) |
dom_exception _dom_event_get_timestamp(dom_event *evt, |
unsigned int *timestamp); |
#define dom_event_get_timestamp(e, t) _dom_event_get_timestamp(\ |
(dom_event *) (e), (unsigned int *) (t)) |
dom_exception _dom_event_stop_propagation(dom_event *evt); |
#define dom_event_stop_propagation(e) _dom_event_stop_propagation(\ |
(dom_event *) (e)) |
dom_exception _dom_event_prevent_default(dom_event *evt); |
#define dom_event_prevent_default(e) _dom_event_prevent_default(\ |
(dom_event *) (e)) |
dom_exception _dom_event_init(dom_event *evt, dom_string *type, |
bool bubble, bool cancelable); |
#define dom_event_init(e, t, b, c) _dom_event_init((dom_event *) (e), \ |
(dom_string *) (t), (bool) (b), (bool) (c)) |
dom_exception _dom_event_get_namespace(dom_event *evt, |
dom_string **namespace); |
#define dom_event_get_namespace(e, n) _dom_event_get_namespace(\ |
(dom_event *) (e), (dom_string **) (n)) |
dom_exception _dom_event_is_custom(dom_event *evt, bool *custom); |
#define dom_event_is_custom(e, c) _dom_event_is_custom((dom_event *) (e), \ |
(bool *) (c)) |
dom_exception _dom_event_stop_immediate_propagation(dom_event *evt); |
#define dom_event_stop_immediate_propagation(e) \ |
_dom_event_stop_immediate_propagation((dom_event *) (e)) |
dom_exception _dom_event_is_default_prevented(dom_event *evt, bool *prevented); |
#define dom_event_is_default_prevented(e, p) \ |
_dom_event_is_default_prevented((dom_event *) (e), (bool *) (p)) |
dom_exception _dom_event_init_ns(dom_event *evt, dom_string *namespace, |
dom_string *type, bool bubble, bool cancelable); |
#define dom_event_init_ns(e, n, t, b, c) _dom_event_init_ns( \ |
(dom_event *) (e), (dom_string *) (n), \ |
(dom_string *) (t), (bool) (b), (bool) (c)) |
#endif |
/contrib/network/netsurf/include/dom/events/event_listener.h |
---|
0,0 → 1,27 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_events_event_listener_h_ |
#define dom_events_event_listener_h_ |
#include <dom/core/exceptions.h> |
struct dom_document; |
struct dom_event; |
typedef void (*handle_event)(struct dom_event *evt, void *pw); |
typedef struct dom_event_listener dom_event_listener; |
dom_exception dom_event_listener_create(struct dom_document *doc, |
handle_event handler, void *pw, dom_event_listener **listener); |
void dom_event_listener_ref(dom_event_listener *listener); |
void dom_event_listener_unref(dom_event_listener *listener); |
#endif |
/contrib/network/netsurf/include/dom/events/event_target.h |
---|
0,0 → 1,111 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_events_event_target_h_ |
#define dom_events_event_target_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
struct dom_event_listener; |
struct dom_event; |
/* Event target is a mixin interface, thus has no concrete implementation. |
* Subclasses must provide implementations of the event target methods. */ |
typedef struct dom_event_target { |
void *vtable; |
} dom_event_target; |
typedef struct dom_event_target_vtable { |
dom_exception (*add_event_listener)( |
dom_event_target *et, dom_string *type, |
struct dom_event_listener *listener, |
bool capture); |
dom_exception (*remove_event_listener)( |
dom_event_target *et, dom_string *type, |
struct dom_event_listener *listener, |
bool capture); |
dom_exception (*dispatch_event)( |
dom_event_target *et, |
struct dom_event *evt, bool *success); |
dom_exception (*add_event_listener_ns)( |
dom_event_target *et, |
dom_string *namespace, dom_string *type, |
struct dom_event_listener *listener, |
bool capture); |
dom_exception (*remove_event_listener_ns)( |
dom_event_target *et, |
dom_string *namespace, dom_string *type, |
struct dom_event_listener *listener, |
bool capture); |
} dom_event_target_vtable; |
static inline dom_exception dom_event_target_add_event_listener( |
dom_event_target *et, dom_string *type, |
struct dom_event_listener *listener, bool capture) |
{ |
return ((dom_event_target_vtable *) et->vtable)->add_event_listener( |
et, type, listener, capture); |
} |
#define dom_event_target_add_event_listener(et, t, l, c) \ |
dom_event_target_add_event_listener((dom_event_target *) (et),\ |
(dom_string *) (t), (struct dom_event_listener *) (l), \ |
(bool) (c)) |
static inline dom_exception dom_event_target_remove_event_listener( |
dom_event_target *et, dom_string *type, |
struct dom_event_listener *listener, bool capture) |
{ |
return ((dom_event_target_vtable *) et->vtable)->remove_event_listener( |
et, type, listener, capture); |
} |
#define dom_event_target_remove_event_listener(et, t, l, c) \ |
dom_event_target_remove_event_listener(\ |
(dom_event_target *) (et), (dom_string *) (t),\ |
(struct dom_event_listener *) (l), (bool) (c)) |
static inline dom_exception dom_event_target_dispatch_event( |
dom_event_target *et, struct dom_event *evt, bool *success) |
{ |
return ((dom_event_target_vtable *) et->vtable)->dispatch_event( |
et, evt, success); |
} |
#define dom_event_target_dispatch_event(et, e, s) \ |
dom_event_target_dispatch_event((dom_event_target *) (et),\ |
(struct dom_event *) (e), (bool *) (s)) |
static inline dom_exception dom_event_target_add_event_listener_ns( |
dom_event_target *et, |
dom_string *namespace, dom_string *type, |
struct dom_event_listener *listener, bool capture) |
{ |
return ((dom_event_target_vtable *) et->vtable)->add_event_listener_ns( |
et, namespace, type, listener, capture); |
} |
#define dom_event_target_add_event_listener_ns(et, n, t, l, c) \ |
dom_event_target_add_event_listener_ns(\ |
(dom_event_target *) (et), (dom_string *) (n),\ |
(dom_string *) (t), (struct dom_event_listener *) (l),\ |
(bool) (c)) |
static inline dom_exception dom_event_target_remove_event_listener_ns( |
dom_event_target *et, |
dom_string *namespace, dom_string *type, |
struct dom_event_listener *listener, bool capture) |
{ |
return ((dom_event_target_vtable *) et->vtable)->remove_event_listener_ns( |
et, namespace, type, listener, capture); |
} |
#define dom_event_target_remove_event_listener_ns(et, n, t, l, c) \ |
dom_event_target_remove_event_listener_ns(\ |
(dom_event_target *) (et), (dom_string *) (n),\ |
(dom_string *) (t), (struct dom_event_listener *) (l),\ |
(bool) (c)) |
#endif |
/contrib/network/netsurf/include/dom/events/events.h |
---|
0,0 → 1,25 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_events_h_ |
#define dom_events_h_ |
#include <dom/events/event.h> |
#include <dom/events/ui_event.h> |
#include <dom/events/custom_event.h> |
#include <dom/events/mouse_event.h> |
#include <dom/events/keyboard_event.h> |
#include <dom/events/mouse_wheel_event.h> |
#include <dom/events/mouse_multi_wheel_event.h> |
#include <dom/events/mutation_event.h> |
#include <dom/events/mutation_name_event.h> |
#include <dom/events/text_event.h> |
#include <dom/events/event_listener.h> |
#include <dom/events/document_event.h> |
#include <dom/events/event_target.h> |
#endif |
/contrib/network/netsurf/include/dom/events/keyboard_event.h |
---|
0,0 → 1,89 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_events_keyboard_event_h_ |
#define dom_events_keyboard_event_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
struct dom_abstract_view; |
typedef struct dom_keyboard_event dom_keyboard_event; |
typedef enum { |
DOM_KEY_LOCATION_STANDARD = 0, |
DOM_KEY_LOCATION_LEFT = 1, |
DOM_KEY_LOCATION_RIGHT = 2, |
DOM_KEY_LOCATION_NUMPAD = 3 |
} dom_key_location; |
dom_exception _dom_keyboard_event_get_key_identifier(dom_keyboard_event *evt, |
dom_string **ident); |
#define dom_keyboard_event_get_key_identifier(e, i) \ |
_dom_keyboard_event_get_key_identifier( \ |
(dom_keyboard_event *) (e), (dom_string **) (i)) |
dom_exception _dom_keyboard_event_get_key_location(dom_keyboard_event *evt, |
dom_key_location *loc); |
#define dom_keyboard_event_get_key_location(e, l) \ |
_dom_keyboard_event_get_key_location( \ |
(dom_keyboard_event *) (e), (dom_key_location *) (l)) |
dom_exception _dom_keyboard_event_get_ctrl_key(dom_keyboard_event *evt, |
bool *key); |
#define dom_keyboard_event_get_ctrl_key(e, k) _dom_keyboard_event_get_ctrl_key(\ |
(dom_keyboard_event *) (e), (bool *) (k)) |
dom_exception _dom_keyboard_event_get_shift_key(dom_keyboard_event *evt, |
bool *key); |
#define dom_keyboard_event_get_shift_key(e, k) \ |
_dom_keyboard_event_get_shift_key((dom_keyboard_event *) (e), \ |
(bool *) (k)) |
dom_exception _dom_keyboard_event_get_alt_key(dom_keyboard_event *evt, |
bool *key); |
#define dom_keyboard_event_get_alt_key(e, k) _dom_keyboard_event_get_alt_key(\ |
(dom_keyboard_event *) (e), (bool *) (k)) |
dom_exception _dom_keyboard_event_get_meta_key(dom_keyboard_event *evt, |
bool *key); |
#define dom_keyboard_event_get_meta_key(e, k) _dom_keyboard_event_get_meta_key(\ |
(dom_keyboard_event *) (e), (bool *) (k)) |
dom_exception _dom_keyboard_event_get_modifier_state(dom_keyboard_event *evt, |
dom_string *m, bool *state); |
#define dom_keyboard_event_get_modifier_state(e, m, s) \ |
_dom_keyboard_event_get_modifier_state( \ |
(dom_keyboard_event *) (e), (dom_string *) (m),\ |
(bool *) (s)) |
dom_exception _dom_keyboard_event_init(dom_keyboard_event *evt, |
dom_string *type, bool bubble, bool cancelable, |
struct dom_abstract_view *view, dom_string *key_ident, |
dom_key_location key_loc, dom_string *modifier_list); |
#define dom_keyboard_event_init(e, t, b, c, v, ki, kl, m) \ |
_dom_keyboard_event_init((dom_keyboard_event *) (e), \ |
(dom_string *) (t), (bool) (b), (bool) (c), \ |
(struct dom_abstract_view *) (v), (dom_string *) (ki), \ |
(dom_key_location) (kl), (dom_string *) (m)) |
dom_exception _dom_keyboard_event_init_ns(dom_keyboard_event *evt, |
dom_string *namespace, dom_string *type, |
bool bubble, bool cancelable, struct dom_abstract_view *view, |
dom_string *key_ident, dom_key_location key_loc, |
dom_string *modifier_list); |
#define dom_keyboard_event_init_ns(e, n, t, b, c, v, ki, kl, m) \ |
_dom_keyboard_event_init_ns((dom_keyboard_event *) (e), \ |
(dom_string *) (n), (dom_string *) (t), \ |
(bool) (b), (bool) (c), (struct dom_abstract_view *) (v), \ |
(dom_string *) (ki), (dom_key_location) (kl), \ |
(dom_string *) (m)) |
#endif |
/contrib/network/netsurf/include/dom/events/mouse_event.h |
---|
0,0 → 1,108 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_events_mouse_event_h_ |
#define dom_events_mouse_event_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
#include <dom/events/event_target.h> |
struct dom_abstract_view; |
typedef struct dom_mouse_event dom_mouse_event; |
dom_exception _dom_mouse_event_get_screen_x(dom_mouse_event *evt, |
int32_t *x); |
#define dom_mouse_event_get_screen_x(e, x) _dom_mouse_event_get_screen_x(\ |
(dom_mouse_event *) (e), (int32_t *) (x)) |
dom_exception _dom_mouse_event_get_screen_y(dom_mouse_event *evt, |
int32_t *y); |
#define dom_mouse_event_get_screen_y(e, y) _dom_mouse_event_get_screen_y(\ |
(dom_mouse_event *) (e), (int32_t *) (y)) |
dom_exception _dom_mouse_event_get_client_x(dom_mouse_event *evt, |
int32_t *x); |
#define dom_mouse_event_get_client_x(e, x) _dom_mouse_event_get_client_x(\ |
(dom_mouse_event *) (e), (int32_t *) (x)) |
dom_exception _dom_mouse_event_get_client_y(dom_mouse_event *evt, |
int32_t *y); |
#define dom_mouse_event_get_client_y(e, y) _dom_mouse_event_get_client_y(\ |
(dom_mouse_event *) (e), (int32_t *) (y)) |
dom_exception _dom_mouse_event_get_ctrl_key(dom_mouse_event *evt, |
bool *key); |
#define dom_mouse_event_get_ctrl_key(e, k) _dom_mouse_event_get_ctrl_key( \ |
(dom_mouse_event *) (e), (bool *) (k)) |
dom_exception _dom_mouse_event_get_shift_key(dom_mouse_event *evt, |
bool *key); |
#define dom_mouse_event_get_shift_key(e, k) _dom_mouse_event_get_shift_key( \ |
(dom_mouse_event *) (e), (bool *) (k)) |
dom_exception _dom_mouse_event_get_alt_key(dom_mouse_event *evt, |
bool *key); |
#define dom_mouse_event_get_alt_key(e, k) _dom_mouse_event_get_alt_key( \ |
(dom_mouse_event *) (e), (bool *) (k)) |
dom_exception _dom_mouse_event_get_meta_key(dom_mouse_event *evt, |
bool *key); |
#define dom_mouse_event_get_meta_key(e, k) _dom_mouse_event_get_meta_key( \ |
(dom_mouse_event *) (e), (bool *) (k)) |
dom_exception _dom_mouse_event_get_button(dom_mouse_event *evt, |
unsigned short *button); |
#define dom_mouse_event_get_button(e, b) _dom_mouse_event_get_button(\ |
(dom_mouse_event *) (e), (unsigned short *) (b)) |
dom_exception _dom_mouse_event_get_related_target(dom_mouse_event *evt, |
dom_event_target **et); |
#define dom_mouse_event_get_related_target(e, t) \ |
_dom_mouse_event_get_related_target((dom_mouse_event *) (e),\ |
(dom_event_target **) (t)) |
dom_exception _dom_mouse_event_get_modifier_state(dom_mouse_event *evt, |
dom_string *m, bool *state); |
#define dom_mouse_event_get_modifier_state(e, m, s) \ |
_dom_mouse_event_get_modifier_state((dom_mouse_event *) (e), \ |
(dom_string *) (m), (bool *) (s)) |
dom_exception _dom_mouse_event_init(dom_mouse_event *evt, |
dom_string *type, bool bubble, bool cancelable, |
struct dom_abstract_view *view, int32_t detail, int32_t screen_x, |
int32_t screen_y, int32_t client_x, int32_t client_y, bool ctrl, |
bool alt, bool shift, bool meta, unsigned short button, |
dom_event_target *et); |
#define dom_mouse_event_init(e, t, b, c, v, d, sx, sy, cx, cy, ctrl, alt, \ |
shift, meta, button, et) \ |
_dom_mouse_event_init((dom_mouse_event *) (e), \ |
(dom_string *) (t), (bool) (b), (bool) (c),\ |
(struct dom_abstract_view *) (v), (int32_t) (d), (int32_t) (sx), \ |
(int32_t) (sy), (int32_t) (cx), (int32_t) (cy), (bool) (ctrl),\ |
(bool) (alt), (bool) (shift), (bool) (meta), \ |
(unsigned short) (button), (dom_event_target *) (et)) |
dom_exception _dom_mouse_event_init_ns(dom_mouse_event *evt, |
dom_string *namespace, dom_string *type, |
bool bubble, bool cancelable, struct dom_abstract_view *view, |
int32_t detail, int32_t screen_x, int32_t screen_y, int32_t client_x, |
int32_t client_y, bool ctrl, bool alt, bool shift, bool meta, |
unsigned short button, dom_event_target *et); |
#define dom_mouse_event_init_ns(e, n, t, b, c, v, d, sx, sy, cx, cy, ctrl, alt,\ |
shift, meta, button, et) \ |
_dom_mouse_event_init_ns((dom_mouse_event *) (e), \ |
(dom_string *) (n), (dom_string *) (t),\ |
(bool) (b), (bool) (c), (struct dom_abstract_view *) (v),\ |
(int32_t) (d), (int32_t) (sx), (int32_t) (sy), (int32_t) (cx),\ |
(int32_t) (cy), (bool) (ctrl), (bool) (alt), (bool) (shift),\ |
(bool) (meta), (unsigned short) (button),\ |
(dom_event_target *) (et)) |
#endif |
/contrib/network/netsurf/include/dom/events/mouse_multi_wheel_event.h |
---|
0,0 → 1,56 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_events_mouse_multi_wheel_event_h_ |
#define dom_events_mouse_multi_wheel_event_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
#include <dom/events/event_target.h> |
struct dom_abstract_view; |
typedef struct dom_mouse_multi_wheel_event dom_mouse_multi_wheel_event; |
dom_exception _dom_mouse_multi_wheel_event_get_wheel_delta_x( |
dom_mouse_multi_wheel_event *evt, int32_t *x); |
#define dom_mouse_multi_wheel_event_get_wheel_delta_x(e, x) \ |
_dom_mouse_multi_wheel_event_get_wheel_delta_x( \ |
(dom_mouse_multi_wheel_event *) (e), (int32_t *) (x)) |
dom_exception _dom_mouse_multi_wheel_event_get_wheel_delta_y( |
dom_mouse_multi_wheel_event *evt, int32_t *y); |
#define dom_mouse_multi_wheel_event_get_wheel_delta_y(e, y) \ |
_dom_mouse_multi_wheel_event_get_wheel_delta_y( \ |
(dom_mouse_multi_wheel_event *) (e), (int32_t *) (y)) |
dom_exception _dom_mouse_multi_wheel_event_get_wheel_delta_z( |
dom_mouse_multi_wheel_event *evt, int32_t *z); |
#define dom_mouse_multi_wheel_event_get_wheel_delta_z(e, z) \ |
_dom_mouse_multi_wheel_event_get_wheel_delta_z( \ |
(dom_mouse_multi_wheel_event *) (e), (int32_t *) (z)) |
dom_exception _dom_mouse_multi_wheel_event_init_ns( |
dom_mouse_multi_wheel_event *evt, dom_string *namespace, |
dom_string *type, bool bubble, bool cancelable, |
struct dom_abstract_view *view, int32_t detail, int32_t screen_x, |
int32_t screen_y, int32_t client_x, int32_t client_y, |
unsigned short button, dom_event_target *et, |
dom_string *modifier_list, int32_t wheel_delta_x, |
int32_t wheel_delta_y, int32_t wheel_delta_z); |
#define dom_mouse_multi_wheel_event_init_ns(e, n, t, b, c, v, \ |
d, sx, sy, cx, cy, button, et, ml, x, y, z) \ |
_dom_mouse_multi_wheel_event_init_ns( \ |
(dom_mouse_multi_wheel_event *) (e), (dom_string *) (n),\ |
(dom_string *) (t), (bool) (b), (bool) (c), \ |
(struct dom_abstract_view *) (v), (int32_t) (d), (int32_t) (sx), \ |
(int32_t) (sy), (int32_t) (cx), (int32_t) (cy),\ |
(unsigned short) (button), (dom_event_target *) (et),\ |
(dom_string *) (ml), (int32_t) (x), (int32_t) (y), (int32_t) (z)) |
#endif |
/contrib/network/netsurf/include/dom/events/mouse_wheel_event.h |
---|
0,0 → 1,42 |
/* * This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_events_mouse_wheel_event_h_ |
#define dom_events_mouse_wheel_event_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
#include <dom/events/event_target.h> |
struct dom_abstract_view; |
typedef struct dom_mouse_wheel_event dom_mouse_wheel_event; |
dom_exception _dom_mouse_wheel_event_get_wheel_delta( |
dom_mouse_wheel_event *evt, int32_t *d); |
#define dom_mouse_wheel_event_get_wheel_delta(e, d) \ |
_dom_mouse_wheel_event_get_wheel_delta( \ |
(dom_mouse_wheel_event *) (e), (int32_t *) (d)) |
dom_exception _dom_mouse_wheel_event_init_ns( |
dom_mouse_wheel_event *evt, dom_string *namespace, |
dom_string *type, bool bubble, bool cancelable, |
struct dom_abstract_view *view, int32_t detail, int32_t screen_x, |
int32_t screen_y, int32_t client_x, int32_t client_y, |
unsigned short button, dom_event_target *et, |
dom_string *modifier_list, int32_t wheel_delta); |
#define dom_mouse_wheel_event_init_ns(e, n, t, b, c, v, \ |
d, sx, sy, cx, cy, button, et, ml, dt) \ |
_dom_mouse_wheel_event_init_ns((dom_mouse_wheel_event *) (e), \ |
(dom_string *) (n), (dom_string *) (t), \ |
(bool) (b), (bool) (c), (struct dom_abstract_view *) (v),\ |
(int32_t) (d), (int32_t) (sx), (int32_t) (sy), (int32_t) (cx), (int32_t) (cy),\ |
(unsigned short) (button), (dom_event_target *) (et),\ |
(dom_string *) (ml), (int32_t) (dt)) |
#endif |
/contrib/network/netsurf/include/dom/events/mutation_event.h |
---|
0,0 → 1,80 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_events_mutation_event_h_ |
#define dom_events_mutation_event_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
struct dom_node; |
typedef enum { |
DOM_MUTATION_MODIFICATION = 1, |
DOM_MUTATION_ADDITION = 2, |
DOM_MUTATION_REMOVAL = 3 |
} dom_mutation_type; |
typedef struct dom_mutation_event dom_mutation_event; |
dom_exception _dom_mutation_event_get_related_node(dom_mutation_event *evt, |
struct dom_node **node); |
#define dom_mutation_event_get_related_node(e, n) \ |
_dom_mutation_event_get_related_node(\ |
(dom_mutation_event *) (e), (struct dom_node **) (n)) |
dom_exception _dom_mutation_event_get_prev_value(dom_mutation_event *evt, |
dom_string **ret); |
#define dom_mutation_event_get_prev_value(e, r) \ |
_dom_mutation_event_get_prev_value((dom_mutation_event *) (e), \ |
(dom_string **) (r)) |
dom_exception _dom_mutation_event_get_new_value(dom_mutation_event *evt, |
dom_string **ret); |
#define dom_mutation_event_get_new_value(e, r) \ |
_dom_mutation_event_get_new_value((dom_mutation_event *) (e), \ |
(dom_string **) (r)) |
dom_exception _dom_mutation_event_get_attr_name(dom_mutation_event *evt, |
dom_string **ret); |
#define dom_mutation_event_get_attr_name(e, r) \ |
_dom_mutation_event_get_attr_name((dom_mutation_event *) (e), \ |
(dom_string **) (r)) |
dom_exception _dom_mutation_event_get_attr_change(dom_mutation_event *evt, |
dom_mutation_type *type); |
#define dom_mutation_event_get_attr_change(e, t) \ |
_dom_mutation_event_get_attr_change((dom_mutation_event *) (e),\ |
(dom_mutation_type *) (t)) |
dom_exception _dom_mutation_event_init(dom_mutation_event *evt, |
dom_string *type, bool bubble, bool cancelable, |
struct dom_node *node, dom_string *prev_value, |
dom_string *new_value, dom_string *attr_name, |
dom_mutation_type change); |
#define dom_mutation_event_init(e, t, b, c, n, p, nv, a, ch) \ |
_dom_mutation_event_init((dom_mutation_event *) (e), \ |
(dom_string *) (t), (bool) (b), (bool) (c), \ |
(struct dom_node *) (n), (dom_string *) (p), \ |
(dom_string *) (nv), (dom_string *) (a), \ |
(dom_mutation_type) (ch)) |
dom_exception _dom_mutation_event_init_ns(dom_mutation_event *evt, |
dom_string *namespace, dom_string *type, |
bool bubble, bool cancelable, struct dom_node *node, |
dom_string *prev_value, dom_string *new_value, |
dom_string *attr_name, dom_mutation_type change); |
#define dom_mutation_event_init_ns(e, n, t, b, c, nd, p, nv, a, ch) \ |
_dom_mutation_event_init_ns((dom_mutation_event *) (e), \ |
(dom_string *) (n), (dom_string *) (t),\ |
(bool) (b), (bool) (c), (struct dom_node *) (nd), \ |
(dom_string *) (p), (dom_string *) (nv),\ |
(dom_string *) (a), (dom_mutation_type) (ch)) |
#endif |
/contrib/network/netsurf/include/dom/events/mutation_name_event.h |
---|
0,0 → 1,54 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_events_mutation_name_event_h_ |
#define dom_events_mutation_name_event_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
struct dom_node; |
typedef struct dom_mutation_name_event dom_mutation_name_event; |
dom_exception _dom_mutation_name_event_get_prev_namespace( |
dom_mutation_name_event *evt, dom_string **namespace); |
#define dom_mutation_name_event_get_prev_namespace(e, n) \ |
_dom_mutation_name_event_get_prev_namespace(\ |
(dom_mutation_name_event *) (e), (dom_string **) (n)) |
dom_exception _dom_mutation_name_event_get_prev_node_name( |
dom_mutation_name_event *evt, dom_string **name); |
#define dom_mutation_name_event_get_prev_node_name(e, n) \ |
_dom_mutation_name_event_get_prev_node_name(\ |
(dom_mutation_name_event *) (e), (dom_string **) (n)) |
dom_exception _dom_mutation_name_event_init(dom_mutation_name_event *evt, |
dom_string *type, bool bubble, bool cancelable, |
struct dom_node *node, dom_string *prev_ns, |
dom_string *prev_name); |
#define dom_mutation_name_event_init(e, t, b, c, n, p, pn) \ |
_dom_mutation_name_event_init((dom_mutation_name_event *) (e), \ |
(dom_string *) (t), (bool) (b), (bool) (c), \ |
(struct dom_node *) (n), (dom_string *) (p), \ |
(dom_string *) (pn)) |
dom_exception _dom_mutation_name_event_init_ns(dom_mutation_name_event *evt, |
dom_string *namespace, dom_string *type, |
bool bubble, bool cancelable, struct dom_node *node, |
dom_string *prev_ns, dom_string *prev_name); |
#define dom_mutation_name_event_init_ns(e, n, t, b, c, nv, p, pn) \ |
_dom_mutation_name_event_init_ns(\ |
(dom_mutation_name_event *) (e), (dom_string *) (n),\ |
(dom_string *) (t), (bool) (b), (bool) (c),\ |
(struct dom_node *) (nv), (dom_string *) (p), \ |
(dom_string *) (pn)) |
#endif |
/contrib/network/netsurf/include/dom/events/text_event.h |
---|
0,0 → 1,41 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_events_text_event_h_ |
#define dom_events_text_event_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
struct dom_abstract_view; |
typedef struct dom_text_event dom_text_event; |
dom_exception _dom_text_event_get_data(dom_text_event *evt, |
dom_string **data); |
#define dom_text_event_get_data(e, d) _dom_text_event_get_data(\ |
(dom_text_event *) (e), (dom_string **) (d)) |
dom_exception _dom_text_event_init(dom_text_event *evt, |
dom_string *type, bool bubble, bool cancelable, |
struct dom_abstract_view *view, dom_string *data); |
#define dom_text_event_init(e, t, b, c, v, d) _dom_text_event_init( \ |
(dom_text_event *) (e), (dom_string *) (t), (bool) (b), \ |
(bool) (c), (struct dom_abstract_view *) (v),\ |
(dom_string *) (d)) |
dom_exception _dom_text_event_init_ns(dom_text_event *evt, |
dom_string *namespace_name, dom_string *type, |
bool bubble, bool cancelable, struct dom_abstract_view *view, |
dom_string *data); |
#define dom_text_event_init_ns(e, n, t, b, c, v, d) _dom_text_event_init_ns( \ |
(dom_text_event *) (e), (dom_string *) (n), \ |
(dom_string *) (t), (bool) (b), (bool) (c), \ |
(struct dom_abstract_view *) (v), (dom_string *) (d)) |
#endif |
/contrib/network/netsurf/include/dom/events/ui_event.h |
---|
0,0 → 1,45 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_events_ui_event_h_ |
#define dom_events_ui_event_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
struct dom_abstract_view; |
typedef struct dom_ui_event dom_ui_event; |
dom_exception _dom_ui_event_get_view(dom_ui_event *evt, |
struct dom_abstract_view **view); |
#define dom_ui_event_get_view(e, v) _dom_ui_event_get_view( \ |
(dom_ui_event *) (e), (struct dom_abstract_view **) (v)) |
dom_exception _dom_ui_event_get_detail(dom_ui_event *evt, |
int32_t *detail); |
#define dom_ui_event_get_detail(e, d) _dom_ui_event_get_detail(\ |
(dom_ui_event *) (e), (int32_t *) (d)) |
dom_exception _dom_ui_event_init(dom_ui_event *evt, dom_string *type, |
bool bubble, bool cancelable, struct dom_abstract_view *view, |
int32_t detail); |
#define dom_ui_event_init(e, t, b, c, v, d) _dom_ui_event_init( \ |
(dom_ui_event *) (e), (dom_string *) (t), (bool) (b), \ |
(bool) (c), (struct dom_abstract_view *) (v), (int32_t) (d)) |
dom_exception _dom_ui_event_init_ns(dom_ui_event *evt, |
dom_string *namespace, dom_string *type, |
bool bubble, bool cancelable, struct dom_abstract_view *view, |
int32_t detail); |
#define dom_ui_event_init_ns(e, n, t, b, c, v, d) _dom_ui_event_init_ns( \ |
(dom_ui_event *) (e), (dom_string *) (n), \ |
(dom_string *) (t), (bool) (b), (bool) (c), \ |
(struct dom_abstract_view *) (v), (int32_t) (d)) |
#endif |
/contrib/network/netsurf/include/dom/functypes.h |
---|
0,0 → 1,33 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef dom_functypes_h_ |
#define dom_functypes_h_ |
#include <stddef.h> |
#include <inttypes.h> |
/** |
* Severity levels for dom_msg function, based on syslog(3) |
*/ |
enum { |
DOM_MSG_DEBUG, |
DOM_MSG_INFO, |
DOM_MSG_NOTICE, |
DOM_MSG_WARNING, |
DOM_MSG_ERROR, |
DOM_MSG_CRITICAL, |
DOM_MSG_ALERT, |
DOM_MSG_EMERGENCY |
}; |
/** |
* Type of DOM message function |
*/ |
typedef void (*dom_msg)(uint32_t severity, void *ctx, const char *msg, ...); |
#endif |
/contrib/network/netsurf/include/dom/html/html_body_element.h |
---|
0,0 → 1,53 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2012 Daniel Silverstone <dsilvers@netsurf-browser.org> |
*/ |
#ifndef dom_html_body_element_h_ |
#define dom_html_body_element_h_ |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
typedef struct dom_html_body_element dom_html_body_element; |
dom_exception dom_html_body_element_get_a_link(dom_html_body_element *ele, |
dom_string **a_link); |
dom_exception dom_html_body_element_set_a_link(dom_html_body_element *ele, |
dom_string *a_link); |
dom_exception dom_html_body_element_get_v_link(dom_html_body_element *ele, |
dom_string **v_link); |
dom_exception dom_html_body_element_set_v_link(dom_html_body_element *ele, |
dom_string *v_link); |
dom_exception dom_html_body_element_get_background(dom_html_body_element *ele, |
dom_string **background); |
dom_exception dom_html_body_element_set_background(dom_html_body_element *ele, |
dom_string *background); |
dom_exception dom_html_body_element_get_bg_color(dom_html_body_element *ele, |
dom_string **bg_color); |
dom_exception dom_html_body_element_set_bg_color(dom_html_body_element *ele, |
dom_string *bg_color); |
dom_exception dom_html_body_element_get_link(dom_html_body_element *ele, |
dom_string **link); |
dom_exception dom_html_body_element_set_link(dom_html_body_element *ele, |
dom_string *link); |
dom_exception dom_html_body_element_get_text(dom_html_body_element *ele, |
dom_string **text); |
dom_exception dom_html_body_element_set_text(dom_html_body_element *ele, |
dom_string *text); |
#endif |
/contrib/network/netsurf/include/dom/html/html_button_element.h |
---|
0,0 → 1,54 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2012 Daniel Silverstone <dsilvers@netsurf-browser.org> |
*/ |
#ifndef dom_html_button_element_h_ |
#define dom_html_button_element_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
#include <dom/html/html_form_element.h> |
typedef struct dom_html_button_element dom_html_button_element; |
dom_exception dom_html_button_element_get_form( |
dom_html_button_element *button, dom_html_form_element **form); |
dom_exception dom_html_button_element_get_access_key( |
dom_html_button_element *button, dom_string **access_key); |
dom_exception dom_html_button_element_set_access_key( |
dom_html_button_element *button, dom_string *access_key); |
dom_exception dom_html_button_element_get_disabled( |
dom_html_button_element *button, bool *disabled); |
dom_exception dom_html_button_element_set_disabled( |
dom_html_button_element *button, bool disabled); |
dom_exception dom_html_button_element_get_name( |
dom_html_button_element *button, dom_string **name); |
dom_exception dom_html_button_element_set_name( |
dom_html_button_element *button, dom_string *name); |
dom_exception dom_html_button_element_get_tab_index( |
dom_html_button_element *button, int32_t *tab_index); |
dom_exception dom_html_button_element_set_tab_index( |
dom_html_button_element *button, uint32_t tab_index); |
dom_exception dom_html_button_element_get_type( |
dom_html_button_element *button, dom_string **type); |
dom_exception dom_html_button_element_get_value( |
dom_html_button_element *button, dom_string **value); |
dom_exception dom_html_button_element_set_value( |
dom_html_button_element *button, dom_string *value); |
#endif |
/contrib/network/netsurf/include/dom/html/html_collection.h |
---|
0,0 → 1,29 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_html_collection_h_ |
#define dom_html_collection_h_ |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
struct dom_node; |
typedef struct dom_html_collection dom_html_collection; |
dom_exception dom_html_collection_get_length(dom_html_collection *col, |
uint32_t *len); |
dom_exception dom_html_collection_item(dom_html_collection *col, |
uint32_t index, struct dom_node **node); |
dom_exception dom_html_collection_named_item(dom_html_collection *col, |
dom_string *name, struct dom_node **node); |
void dom_html_collection_ref(dom_html_collection *col); |
void dom_html_collection_unref(dom_html_collection *col); |
#endif |
/contrib/network/netsurf/include/dom/html/html_document.h |
---|
0,0 → 1,245 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_html_document_h_ |
#define dom_html_document_h_ |
#include <dom/core/document.h> |
#include <dom/core/exceptions.h> |
#include <dom/functypes.h> |
#include <dom/events/document_event.h> |
struct dom_element; |
struct dom_html_collection; |
struct dom_html_element; |
struct dom_nodelist; |
typedef struct dom_html_document dom_html_document; |
typedef struct dom_html_document_vtable { |
struct dom_document_vtable base; |
dom_exception (*get_title)(dom_html_document *doc, |
dom_string **title); |
dom_exception (*set_title)(dom_html_document *doc, |
dom_string *title); |
dom_exception (*get_referrer)(dom_html_document *doc, |
dom_string **referrer); |
dom_exception (*get_domain)(dom_html_document *doc, |
dom_string **domain); |
dom_exception (*get_url)(dom_html_document *doc, |
dom_string **url); |
dom_exception (*get_body)(dom_html_document *doc, |
struct dom_html_element **body); |
dom_exception (*set_body)(dom_html_document *doc, |
struct dom_html_element *body); |
dom_exception (*get_images)(dom_html_document *doc, |
struct dom_html_collection **col); |
dom_exception (*get_applets)(dom_html_document *doc, |
struct dom_html_collection **col); |
dom_exception (*get_links)(dom_html_document *doc, |
struct dom_html_collection **col); |
dom_exception (*get_forms)(dom_html_document *doc, |
struct dom_html_collection **col); |
dom_exception (*get_anchors)(dom_html_document *doc, |
struct dom_html_collection **col); |
dom_exception (*get_cookie)(dom_html_document *doc, |
dom_string **cookie); |
dom_exception (*set_cookie)(dom_html_document *doc, |
dom_string *cookie); |
dom_exception (*open)(dom_html_document *doc); |
dom_exception (*close)(dom_html_document *doc); |
dom_exception (*write)(dom_html_document *doc, |
dom_string *text); |
dom_exception (*writeln)(dom_html_document *doc, |
dom_string *text); |
dom_exception (*get_elements_by_name)(dom_html_document *doc, |
dom_string *name, struct dom_nodelist **list); |
} dom_html_document_vtable; |
static inline dom_exception dom_html_document_get_title( |
dom_html_document *doc, dom_string **title) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
get_title(doc, title); |
} |
#define dom_html_document_get_title(d, t) \ |
dom_html_document_get_title((dom_html_document *) (d), (t)) |
static inline dom_exception dom_html_document_set_title(dom_html_document *doc, |
dom_string *title) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
set_title(doc, title); |
} |
#define dom_html_document_set_title(d, t) \ |
dom_html_document_set_title((dom_html_document *) (d), (t)) |
static inline dom_exception dom_html_document_get_referrer(dom_html_document *doc, |
dom_string **referrer) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
get_referrer(doc, referrer); |
} |
#define dom_html_document_get_referrer(d, r) \ |
dom_html_document_get_referrer((dom_html_document *) (d), (r)) |
static inline dom_exception dom_html_document_get_domain(dom_html_document *doc, |
dom_string **domain) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
get_domain(doc, domain); |
} |
#define dom_html_document_get_domain(d, t) \ |
dom_html_document_get_domain((dom_html_document *) (d), (t)) |
static inline dom_exception dom_html_document_get_url(dom_html_document *doc, |
dom_string **url) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
get_url(doc, url); |
} |
#define dom_html_document_get_url(d, u) \ |
dom_html_document_get_url((dom_html_document *) (d), (u)) |
static inline dom_exception dom_html_document_get_body(dom_html_document *doc, |
struct dom_html_element **body) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
get_body(doc, body); |
} |
#define dom_html_document_get_body(d, b) \ |
dom_html_document_get_title((dom_html_document *) (d), \ |
(struct dom_html_element **) (b)) |
static inline dom_exception dom_html_document_set_body(dom_html_document *doc, |
struct dom_html_element *body) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
set_body(doc, body); |
} |
#define dom_html_document_set_body(d, b) \ |
dom_html_document_set_body((dom_html_document *) (d), \ |
(struct dom_html_element **) (b)) |
static inline dom_exception dom_html_document_get_images(dom_html_document *doc, |
struct dom_html_collection **col) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
get_images(doc, col); |
} |
#define dom_html_document_get_images(d, c) \ |
dom_html_document_get_images((dom_html_document *) (d), \ |
(struct dom_html_collection **) (c)) |
static inline dom_exception dom_html_document_get_applets(dom_html_document *doc, |
struct dom_html_collection **col) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
get_applets(doc, col); |
} |
#define dom_html_document_get_applets(d, c) \ |
dom_html_document_get_applets((dom_html_document *) (d), \ |
(struct dom_html_collection **) (c)) |
static inline dom_exception dom_html_document_get_links(dom_html_document *doc, |
struct dom_html_collection **col) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
get_links(doc, col); |
} |
#define dom_html_document_get_links(d, c) \ |
dom_html_document_get_links((dom_html_document *) (d), \ |
(struct dom_html_collection **) (c)) |
static inline dom_exception dom_html_document_get_forms(dom_html_document *doc, |
struct dom_html_collection **col) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
get_forms(doc, col); |
} |
#define dom_html_document_get_forms(d, c) \ |
dom_html_document_get_forms((dom_html_document *) (d), \ |
(struct dom_html_collection **) (c)) |
static inline dom_exception dom_html_document_get_anchors(dom_html_document *doc, |
struct dom_html_collection **col) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
get_anchors(doc, col); |
} |
#define dom_html_document_get_anchors(d, c) \ |
dom_html_document_get_title((dom_html_document *) (d), \ |
(struct dom_html_collection **) (c)) |
static inline dom_exception dom_html_document_get_cookie(dom_html_document *doc, |
dom_string **cookie) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
get_cookie(doc, cookie); |
} |
#define dom_html_document_get_cookie(d, c) \ |
dom_html_document_get_title((dom_html_document *) (d), (c)) |
static inline dom_exception dom_html_document_set_cookie(dom_html_document *doc, |
dom_string *cookie) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
set_cookie(doc, cookie); |
} |
#define dom_html_document_set_cookie(d, c) \ |
dom_html_document_set_cookie((dom_html_document *) (d), (c)) |
static inline dom_exception dom_html_document_open(dom_html_document *doc) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
open(doc); |
} |
#define dom_html_document_open(d) \ |
dom_html_document_open((dom_html_document *) (d)) |
static inline dom_exception dom_html_document_close(dom_html_document *doc) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
close(doc); |
} |
#define dom_html_document_close(d) \ |
dom_html_document_close((dom_html_document *) (d)) |
static inline dom_exception dom_html_document_write(dom_html_document *doc, |
dom_string *text) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
write(doc, text); |
} |
#define dom_html_document_write(d, t) \ |
dom_html_document_write((dom_html_document *) (d), (t)) |
static inline dom_exception dom_html_document_writeln(dom_html_document *doc, |
dom_string *text) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
writeln(doc, text); |
} |
#define dom_html_document_writeln(d, t) \ |
dom_html_document_writeln((dom_html_document *) (d), (t)) |
static inline dom_exception dom_html_document_get_elements_by_name(dom_html_document *doc, |
dom_string *name, struct dom_nodelist **list) |
{ |
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)-> |
get_elements_by_name(doc, name, list); |
} |
#define dom_html_document_get_elements_by_name(d, n, l) \ |
dom_html_document_get_element_by_name((dom_html_document *) (d), \ |
(n), (struct dom_nodelist **) (l)) |
#endif |
/contrib/network/netsurf/include/dom/html/html_element.h |
---|
0,0 → 1,131 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_html_element_h_ |
#define dom_html_element_h_ |
#include <dom/core/element.h> |
typedef struct dom_html_element dom_html_element; |
typedef struct dom_html_element_vtable { |
struct dom_element_vtable base; |
dom_exception (*dom_html_element_get_id)(struct dom_html_element *element, |
dom_string **id); |
dom_exception (*dom_html_element_set_id)(struct dom_html_element *element, |
dom_string *id); |
dom_exception (*dom_html_element_get_title)(struct dom_html_element *element, |
dom_string **title); |
dom_exception (*dom_html_element_set_title)(struct dom_html_element *element, |
dom_string *title); |
dom_exception (*dom_html_element_get_lang)(struct dom_html_element *element, |
dom_string **lang); |
dom_exception (*dom_html_element_set_lang)(struct dom_html_element *element, |
dom_string *lang); |
dom_exception (*dom_html_element_get_dir)(struct dom_html_element *element, |
dom_string **dir); |
dom_exception (*dom_html_element_set_dir)(struct dom_html_element *element, |
dom_string *dir); |
dom_exception (*dom_html_element_get_class_name)(struct dom_html_element *element, |
dom_string **class_name); |
dom_exception (*dom_html_element_set_class_name)(struct dom_html_element *element, |
dom_string *class_name); |
} dom_html_element_vtable; |
static inline dom_exception dom_html_element_get_id(struct dom_html_element *element, |
dom_string **id) |
{ |
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_html_element_get_id(element, id); |
} |
#define dom_html_element_get_id(e, id) dom_html_element_get_id( \ |
(dom_html_element *) (e), (id)) |
static inline dom_exception dom_html_element_set_id(struct dom_html_element *element, |
dom_string *id) |
{ |
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_html_element_set_id(element, id); |
} |
#define dom_html_element_set_id(e, id) dom_html_element_set_id( \ |
(dom_html_element *) (e), (id)) |
static inline dom_exception dom_html_element_get_title(struct dom_html_element *element, |
dom_string **title) |
{ |
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_html_element_get_title(element, title); |
} |
#define dom_html_element_get_title(e, title) dom_html_element_get_title( \ |
(dom_html_element *) (e), (title)) |
static inline dom_exception dom_html_element_set_title(struct dom_html_element *element, |
dom_string *title) |
{ |
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_html_element_set_title(element, title); |
} |
#define dom_html_element_set_title(e, title) dom_html_element_set_title( \ |
(dom_html_element *) (e), (title)) |
static inline dom_exception dom_html_element_get_lang(struct dom_html_element *element, |
dom_string **lang) |
{ |
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_html_element_get_lang(element, lang); |
} |
#define dom_html_element_get_lang(e, lang) dom_html_element_get_lang( \ |
(dom_html_element *) (e), (lang)) |
static inline dom_exception dom_html_element_set_lang(struct dom_html_element *element, |
dom_string *lang) |
{ |
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_html_element_set_lang(element, lang); |
} |
#define dom_html_element_set_lang(e, lang) dom_html_element_set_lang( \ |
(dom_html_element *) (e), (lang)) |
static inline dom_exception dom_html_element_get_dir(struct dom_html_element *element, |
dom_string **dir) |
{ |
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_html_element_get_dir(element, dir); |
} |
#define dom_html_element_get_dir(e, dir) dom_html_element_get_dir( \ |
(dom_html_element *) (e), (dir)) |
static inline dom_exception dom_html_element_set_dir(struct dom_html_element *element, |
dom_string *dir) |
{ |
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_html_element_set_dir(element, dir); |
} |
#define dom_html_element_set_dir(e, dir) dom_html_element_set_dir( \ |
(dom_html_element *) (e), (dir)) |
static inline dom_exception dom_html_element_get_class_name(struct dom_html_element *element, |
dom_string **class_name) |
{ |
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_html_element_get_class_name(element, class_name); |
} |
#define dom_html_element_get_class_name(e, class_name) dom_html_element_get_class_name( \ |
(dom_html_element *) (e), (class_name)) |
static inline dom_exception dom_html_element_set_class_name(struct dom_html_element *element, |
dom_string *class_name) |
{ |
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)-> |
dom_html_element_set_class_name(element, class_name); |
} |
#define dom_html_element_set_class_name(e, class_name) dom_html_element_set_class_name( \ |
(dom_html_element *) (e), (class_name)) |
#endif |
/contrib/network/netsurf/include/dom/html/html_form_element.h |
---|
0,0 → 1,57 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku.com> |
*/ |
#ifndef dom_html_form_element_h_ |
#define dom_html_form_element_h_ |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
struct dom_html_collection; |
typedef struct dom_html_form_element dom_html_form_element; |
dom_exception dom_html_form_element_get_elements(dom_html_form_element *ele, |
struct dom_html_collection **col); |
dom_exception dom_html_form_element_get_length(dom_html_form_element *ele, |
uint32_t *len); |
dom_exception dom_html_form_element_get_accept_charset( |
dom_html_form_element *ele, dom_string **accept_charset); |
dom_exception dom_html_form_element_set_accept_charset( |
dom_html_form_element *ele, dom_string *accept_charset); |
dom_exception dom_html_form_element_get_action( |
dom_html_form_element *ele, dom_string **action); |
dom_exception dom_html_form_element_set_action( |
dom_html_form_element *ele, dom_string *action); |
dom_exception dom_html_form_element_get_enctype( |
dom_html_form_element *ele, dom_string **enctype); |
dom_exception dom_html_form_element_set_enctype( |
dom_html_form_element *ele, dom_string *enctype); |
dom_exception dom_html_form_element_get_method( |
dom_html_form_element *ele, dom_string **method); |
dom_exception dom_html_form_element_set_method( |
dom_html_form_element *ele, dom_string *method); |
dom_exception dom_html_form_element_get_target( |
dom_html_form_element *ele, dom_string **target); |
dom_exception dom_html_form_element_set_target( |
dom_html_form_element *ele, dom_string *target); |
dom_exception dom_html_form_element_submit(dom_html_form_element *ele); |
dom_exception dom_html_form_element_reset(dom_html_form_element *ele); |
#endif |
/contrib/network/netsurf/include/dom/html/html_head_element.h |
---|
0,0 → 1,21 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku.com> |
*/ |
#ifndef dom_html_head_element_h_ |
#define dom_html_head_element_h_ |
#include <dom/html/html_element.h> |
typedef struct dom_html_head_element dom_html_head_element; |
dom_exception dom_html_head_element_get_profile( |
struct dom_html_head_element *element, dom_string **profile); |
dom_exception dom_html_head_element_set_profile( |
struct dom_html_head_element *element, dom_string *profile); |
#endif |
/contrib/network/netsurf/include/dom/html/html_html_element.h |
---|
0,0 → 1,22 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku.com> |
*/ |
#ifndef dom_html_html_element_h_ |
#define dom_html_html_element_h_ |
#include <dom/html/html_element.h> |
typedef struct dom_html_html_element dom_html_html_element; |
dom_exception dom_html_html_element_get_version( |
struct dom_html_html_element *element, dom_string **version); |
dom_exception dom_html_html_element_set_version( |
struct dom_html_html_element *element, dom_string *version); |
#endif |
/contrib/network/netsurf/include/dom/html/html_input_element.h |
---|
0,0 → 1,125 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2012 Daniel Silverstone <dsilvers@netsurf-browser.org> |
*/ |
#ifndef dom_html_input_element_h_ |
#define dom_html_input_element_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
#include <dom/html/html_form_element.h> |
typedef struct dom_html_input_element dom_html_input_element; |
dom_exception dom_html_input_element_get_default_value( |
dom_html_input_element *input, dom_string **default_value); |
dom_exception dom_html_input_element_set_default_value( |
dom_html_input_element *input, dom_string *default_value); |
dom_exception dom_html_input_element_get_default_checked( |
dom_html_input_element *input, bool *default_checked); |
dom_exception dom_html_input_element_set_default_checked( |
dom_html_input_element *input, bool default_checked); |
dom_exception dom_html_input_element_get_form( |
dom_html_input_element *input, dom_html_form_element **form); |
dom_exception dom_html_input_element_get_accept( |
dom_html_input_element *input, dom_string **accept); |
dom_exception dom_html_input_element_set_accept( |
dom_html_input_element *input, dom_string *accept); |
dom_exception dom_html_input_element_get_access_key( |
dom_html_input_element *input, dom_string **access_key); |
dom_exception dom_html_input_element_set_access_key( |
dom_html_input_element *input, dom_string *access_key); |
dom_exception dom_html_input_element_get_align( |
dom_html_input_element *input, dom_string **align); |
dom_exception dom_html_input_element_set_align( |
dom_html_input_element *input, dom_string *align); |
dom_exception dom_html_input_element_get_alt( |
dom_html_input_element *input, dom_string **alt); |
dom_exception dom_html_input_element_set_alt( |
dom_html_input_element *input, dom_string *alt); |
dom_exception dom_html_input_element_get_checked( |
dom_html_input_element *input, bool *checked); |
dom_exception dom_html_input_element_set_checked( |
dom_html_input_element *input, bool checked); |
dom_exception dom_html_input_element_get_disabled( |
dom_html_input_element *input, bool *disabled); |
dom_exception dom_html_input_element_set_disabled( |
dom_html_input_element *input, bool disabled); |
dom_exception dom_html_input_element_get_max_length( |
dom_html_input_element *input, int32_t *max_length); |
dom_exception dom_html_input_element_set_max_length( |
dom_html_input_element *input, uint32_t max_length); |
dom_exception dom_html_input_element_get_name( |
dom_html_input_element *input, dom_string **name); |
dom_exception dom_html_input_element_set_name( |
dom_html_input_element *input, dom_string *name); |
dom_exception dom_html_input_element_get_read_only( |
dom_html_input_element *input, bool *read_only); |
dom_exception dom_html_input_element_set_read_only( |
dom_html_input_element *input, bool read_only); |
dom_exception dom_html_input_element_get_size( |
dom_html_input_element *input, dom_string **size); |
dom_exception dom_html_input_element_set_size( |
dom_html_input_element *input, dom_string *size); |
dom_exception dom_html_input_element_get_src( |
dom_html_input_element *input, dom_string **src); |
dom_exception dom_html_input_element_set_src( |
dom_html_input_element *input, dom_string *src); |
dom_exception dom_html_input_element_get_tab_index( |
dom_html_input_element *input, int32_t *tab_index); |
dom_exception dom_html_input_element_set_tab_index( |
dom_html_input_element *input, uint32_t tab_index); |
dom_exception dom_html_input_element_get_type( |
dom_html_input_element *input, dom_string **type); |
dom_exception dom_html_input_element_get_use_map( |
dom_html_input_element *input, dom_string **use_map); |
dom_exception dom_html_input_element_set_use_map( |
dom_html_input_element *input, dom_string *use_map); |
dom_exception dom_html_input_element_get_value( |
dom_html_input_element *input, dom_string **value); |
dom_exception dom_html_input_element_set_value( |
dom_html_input_element *input, dom_string *value); |
dom_exception dom_html_input_element_blur(dom_html_input_element *ele); |
dom_exception dom_html_input_element_focus(dom_html_input_element *ele); |
dom_exception dom_html_input_element_select(dom_html_input_element *ele); |
dom_exception dom_html_input_element_click(dom_html_input_element *ele); |
#endif |
/contrib/network/netsurf/include/dom/html/html_link_element.h |
---|
0,0 → 1,72 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku.com> |
*/ |
#ifndef dom_html_link_element_h_ |
#define dom_html_link_element_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
typedef struct dom_html_link_element dom_html_link_element; |
dom_exception dom_html_link_element_get_disabled(dom_html_link_element *ele, |
bool *disabled); |
dom_exception dom_html_link_element_set_disabled(dom_html_link_element *ele, |
bool disabled); |
dom_exception dom_html_link_element_get_charset(dom_html_link_element *ele, |
dom_string **charset); |
dom_exception dom_html_link_element_set_charset(dom_html_link_element *ele, |
dom_string *charset); |
dom_exception dom_html_link_element_get_href(dom_html_link_element *ele, |
dom_string **href); |
dom_exception dom_html_link_element_set_href(dom_html_link_element *ele, |
dom_string *href); |
dom_exception dom_html_link_element_get_hreflang(dom_html_link_element *ele, |
dom_string **hreflang); |
dom_exception dom_html_link_element_set_hreflang(dom_html_link_element *ele, |
dom_string *hreflang); |
dom_exception dom_html_link_element_get_media(dom_html_link_element *ele, |
dom_string **media); |
dom_exception dom_html_link_element_set_media(dom_html_link_element *ele, |
dom_string *media); |
dom_exception dom_html_link_element_get_rel(dom_html_link_element *ele, |
dom_string **rel); |
dom_exception dom_html_link_element_set_rel(dom_html_link_element *ele, |
dom_string *rel); |
dom_exception dom_html_link_element_get_rev(dom_html_link_element *ele, |
dom_string **rev); |
dom_exception dom_html_link_element_set_rev(dom_html_link_element *ele, |
dom_string *rev); |
dom_exception dom_html_link_element_get_target(dom_html_link_element *ele, |
dom_string **target); |
dom_exception dom_html_link_element_set_target(dom_html_link_element *ele, |
dom_string *target); |
dom_exception dom_html_link_element_get_type(dom_html_link_element *ele, |
dom_string **type); |
dom_exception dom_html_link_element_set_type(dom_html_link_element *ele, |
dom_string *type); |
#endif |
/contrib/network/netsurf/include/dom/html/html_meta_element.h |
---|
0,0 → 1,40 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku.com> |
*/ |
#ifndef dom_html_meta_element_h_ |
#define dom_html_meta_element_h_ |
#include <dom/core/string.h> |
typedef struct dom_html_meta_element dom_html_meta_element; |
dom_exception dom_html_meta_element_get_content(dom_html_meta_element *ele, |
dom_string **content); |
dom_exception dom_html_meta_element_set_content(dom_html_meta_element *ele, |
dom_string *content); |
dom_exception dom_html_meta_element_get_http_equiv(dom_html_meta_element *ele, |
dom_string **http_equiv); |
dom_exception dom_html_meta_element_set_http_equiv(dom_html_meta_element *ele, |
dom_string *http_equiv); |
dom_exception dom_html_meta_element_get_name(dom_html_meta_element *ele, |
dom_string **name); |
dom_exception dom_html_meta_element_set_name(dom_html_meta_element *ele, |
dom_string *name); |
dom_exception dom_html_meta_element_get_scheme(dom_html_meta_element *ele, |
dom_string **scheme); |
dom_exception dom_html_meta_element_set_scheme(dom_html_meta_element *ele, |
dom_string *scheme); |
#endif |
/contrib/network/netsurf/include/dom/html/html_opt_group_element.h |
---|
0,0 → 1,33 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2012 Daniel Silverstone <dsilvers@netsurf-browser.org> |
*/ |
#ifndef dom_html_opt_group_element_h_ |
#define dom_html_opt_group_element_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
#include <dom/html/html_form_element.h> |
typedef struct dom_html_opt_group_element dom_html_opt_group_element; |
dom_exception dom_html_opt_group_element_get_form( |
dom_html_opt_group_element *opt_group, dom_html_form_element **form); |
dom_exception dom_html_opt_group_element_get_disabled( |
dom_html_opt_group_element *opt_group, bool *disabled); |
dom_exception dom_html_opt_group_element_set_disabled( |
dom_html_opt_group_element *opt_group, bool disabled); |
dom_exception dom_html_opt_group_element_get_label( |
dom_html_opt_group_element *opt_group, dom_string **label); |
dom_exception dom_html_opt_group_element_set_label( |
dom_html_opt_group_element *opt_group, dom_string *label); |
#endif |
/contrib/network/netsurf/include/dom/html/html_option_element.h |
---|
0,0 → 1,57 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2012 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef dom_html_option_element_h_ |
#define dom_html_option_element_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
#include <dom/html/html_form_element.h> |
typedef struct dom_html_option_element dom_html_option_element; |
dom_exception dom_html_option_element_get_form( |
dom_html_option_element *option, dom_html_form_element **form); |
dom_exception dom_html_option_element_get_default_selected( |
dom_html_option_element *option, bool *default_selected); |
dom_exception dom_html_option_element_set_default_selected( |
dom_html_option_element *option, bool default_selected); |
dom_exception dom_html_option_element_get_text( |
dom_html_option_element *option, dom_string **text); |
dom_exception dom_html_option_element_get_index( |
dom_html_option_element *option, unsigned long *index); |
dom_exception dom_html_option_element_get_disabled( |
dom_html_option_element *option, bool *disabled); |
dom_exception dom_html_option_element_set_disabled( |
dom_html_option_element *option, bool disabled); |
dom_exception dom_html_option_element_get_label( |
dom_html_option_element *option, dom_string **label); |
dom_exception dom_html_option_element_set_label( |
dom_html_option_element *option, dom_string *label); |
dom_exception dom_html_option_element_get_selected( |
dom_html_option_element *option, bool *selected); |
dom_exception dom_html_option_element_set_selected( |
dom_html_option_element *option, bool selected); |
dom_exception dom_html_option_element_get_value( |
dom_html_option_element *option, dom_string **value); |
dom_exception dom_html_option_element_set_value( |
dom_html_option_element *option, dom_string *value); |
#endif |
/contrib/network/netsurf/include/dom/html/html_select_element.h |
---|
0,0 → 1,88 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> |
*/ |
#ifndef dom_html_select_element_h_ |
#define dom_html_select_element_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/html/html_form_element.h> |
typedef struct dom_html_select_element dom_html_select_element; |
struct dom_html_options_collection; |
struct dom_html_element; |
dom_exception dom_html_select_element_get_type( |
dom_html_select_element *ele, dom_string **type); |
dom_exception dom_html_select_element_get_selected_index( |
dom_html_select_element *ele, int32_t *index); |
dom_exception dom_html_select_element_set_selected_index( |
dom_html_select_element *ele, int32_t index); |
dom_exception dom_html_select_element_get_value( |
dom_html_select_element *ele, dom_string **value); |
dom_exception dom_html_select_element_set_value( |
dom_html_select_element *ele, dom_string *value); |
dom_exception dom_html_select_element_get_length( |
dom_html_select_element *ele, uint32_t *len); |
dom_exception dom_html_select_element_set_length( |
dom_html_select_element *ele, uint32_t len); |
dom_exception dom_html_select_element_get_form( |
dom_html_select_element *ele, dom_html_form_element **form); |
dom_exception dom__html_select_element_get_options( |
dom_html_select_element *ele, |
struct dom_html_options_collection **col); |
#define dom_html_select_element_get_options(e, c) \ |
dom__html_select_element_get_options((dom_html_select_element *) (e), \ |
(struct dom_html_options_collection **) (c)) |
dom_exception dom_html_select_element_get_disabled( |
dom_html_select_element *ele, bool *disabled); |
dom_exception dom_html_select_element_set_disabled( |
dom_html_select_element *ele, bool disabled); |
dom_exception dom_html_select_element_get_multiple( |
dom_html_select_element *ele, bool *multiple); |
dom_exception dom_html_select_element_set_multiple( |
dom_html_select_element *ele, bool multiple); |
dom_exception dom_html_select_element_get_name( |
dom_html_select_element *ele, dom_string **name); |
dom_exception dom_html_select_element_set_name( |
dom_html_select_element *ele, dom_string *name); |
dom_exception dom_html_select_element_get_size( |
dom_html_select_element *ele, int32_t *size); |
dom_exception dom_html_select_element_set_size( |
dom_html_select_element *ele, int32_t size); |
dom_exception dom_html_select_element_get_tab_index( |
dom_html_select_element *ele, int32_t *tab_index); |
dom_exception dom_html_select_element_set_tab_index( |
dom_html_select_element *ele, int32_t tab_index); |
/* Functions */ |
dom_exception dom__html_select_element_add(dom_html_select_element *select, |
struct dom_html_element *ele, struct dom_html_element *before); |
#define dom_html_select_element_add(s, e, b) \ |
dom__html_select_element_add((dom_html_select_element *) (s), \ |
(struct dom_html_element *) (e), \ |
(struct dom_html_element *) (b)) |
dom_exception dom_html_select_element_remove(dom_html_select_element *ele, |
int32_t index); |
dom_exception dom_html_select_element_blur(struct dom_html_select_element *ele); |
dom_exception dom_html_select_element_focus(struct dom_html_select_element *ele); |
#endif |
/contrib/network/netsurf/include/dom/html/html_text_area_element.h |
---|
0,0 → 1,82 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2012 Daniel Silverstone <dsilvers@netsurf-browser.org> |
*/ |
#ifndef dom_html_text_area_element_h_ |
#define dom_html_text_area_element_h_ |
#include <stdbool.h> |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
#include <dom/html/html_form_element.h> |
typedef struct dom_html_text_area_element dom_html_text_area_element; |
dom_exception dom_html_text_area_element_get_default_value( |
dom_html_text_area_element *text_area, dom_string **default_value); |
dom_exception dom_html_text_area_element_set_default_value( |
dom_html_text_area_element *text_area, dom_string *default_value); |
dom_exception dom_html_text_area_element_get_form( |
dom_html_text_area_element *text_area, dom_html_form_element **form); |
dom_exception dom_html_text_area_element_get_access_key( |
dom_html_text_area_element *text_area, dom_string **access_key); |
dom_exception dom_html_text_area_element_set_access_key( |
dom_html_text_area_element *text_area, dom_string *access_key); |
dom_exception dom_html_text_area_element_get_disabled( |
dom_html_text_area_element *text_area, bool *disabled); |
dom_exception dom_html_text_area_element_set_disabled( |
dom_html_text_area_element *text_area, bool disabled); |
dom_exception dom_html_text_area_element_get_cols( |
dom_html_text_area_element *text_area, int32_t *cols); |
dom_exception dom_html_text_area_element_set_cols( |
dom_html_text_area_element *text_area, uint32_t cols); |
dom_exception dom_html_text_area_element_get_rows( |
dom_html_text_area_element *text_area, int32_t *rows); |
dom_exception dom_html_text_area_element_set_rows( |
dom_html_text_area_element *text_area, uint32_t rows); |
dom_exception dom_html_text_area_element_get_name( |
dom_html_text_area_element *text_area, dom_string **name); |
dom_exception dom_html_text_area_element_set_name( |
dom_html_text_area_element *text_area, dom_string *name); |
dom_exception dom_html_text_area_element_get_read_only( |
dom_html_text_area_element *text_area, bool *read_only); |
dom_exception dom_html_text_area_element_set_read_only( |
dom_html_text_area_element *text_area, bool read_only); |
dom_exception dom_html_text_area_element_get_tab_index( |
dom_html_text_area_element *text_area, int32_t *tab_index); |
dom_exception dom_html_text_area_element_set_tab_index( |
dom_html_text_area_element *text_area, uint32_t tab_index); |
dom_exception dom_html_text_area_element_get_type( |
dom_html_text_area_element *text_area, dom_string **type); |
dom_exception dom_html_text_area_element_get_value( |
dom_html_text_area_element *text_area, dom_string **value); |
dom_exception dom_html_text_area_element_set_value( |
dom_html_text_area_element *text_area, dom_string *value); |
dom_exception dom_html_text_area_element_blur(dom_html_text_area_element *ele); |
dom_exception dom_html_text_area_element_focus(dom_html_text_area_element *ele); |
dom_exception dom_html_text_area_element_select(dom_html_text_area_element *ele); |
#endif |
/contrib/network/netsurf/include/dom/html/html_title_element.h |
---|
0,0 → 1,23 |
/* |
* This file is part of libdom. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 Bo Yang <struggleyb.nku.com> |
*/ |
#ifndef dom_html_title_element_h_ |
#define dom_html_title_element_h_ |
#include <dom/core/exceptions.h> |
#include <dom/core/string.h> |
typedef struct dom_html_title_element dom_html_title_element; |
dom_exception dom_html_title_element_get_text(dom_html_title_element *ele, |
dom_string **text); |
dom_exception dom_html_title_element_set_text(dom_html_title_element *ele, |
dom_string *text); |
#endif |
/contrib/network/netsurf/include/hubbub/errors.h |
---|
0,0 → 1,42 |
/* |
* This file is part of Hubbub. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef hubbub_errors_h_ |
#define hubbub_errors_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <stddef.h> |
typedef enum hubbub_error { |
HUBBUB_OK = 0, /**< No error */ |
HUBBUB_REPROCESS = 1, |
HUBBUB_ENCODINGCHANGE = 2, |
HUBBUB_PAUSED = 3, /**< tokenisation is paused */ |
HUBBUB_NOMEM = 5, |
HUBBUB_BADPARM = 6, |
HUBBUB_INVALID = 7, |
HUBBUB_FILENOTFOUND = 8, |
HUBBUB_NEEDDATA = 9, |
HUBBUB_BADENCODING = 10, |
HUBBUB_UNKNOWN = 11 |
} hubbub_error; |
/* Convert a hubbub error value to a string */ |
const char *hubbub_error_to_string(hubbub_error error); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/hubbub/functypes.h |
---|
0,0 → 1,60 |
/* |
* This file is part of Hubbub. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007-8 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef hubbub_functypes_h_ |
#define hubbub_functypes_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <stdbool.h> |
#include <stdint.h> |
#include <stdlib.h> |
#include <hubbub/types.h> |
/** |
* Type of allocation function for hubbub |
* |
* The semantics of this function are the same as for realloc(). |
* |
* \param ptr Pointer to object to reallocate, or NULL for a new allocation |
* \param size Required length in bytes, or zero to free ::ptr |
* \param pw Pointer to client data |
* \return Pointer to allocated object, or NULL on failure |
*/ |
typedef void *(*hubbub_allocator_fn)(void *ptr, size_t size, void *pw); |
/** |
* Type of token handling function |
* |
* \param token Pointer to token to handle |
* \param pw Pointer to client data |
* \return HUBBUB_OK on success, appropriate error otherwise. |
*/ |
typedef hubbub_error (*hubbub_token_handler)( |
const hubbub_token *token, void *pw); |
/** |
* Type of parse error handling function |
* |
* \param line Source line on which error occurred |
* \param col Column in ::line of start of erroneous input |
* \param message Error message |
* \param pw Pointer to client data |
*/ |
typedef void (*hubbub_error_handler)(uint32_t line, uint32_t col, |
const char *message, void *pw); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/hubbub/hubbub.h |
---|
0,0 → 1,25 |
/* |
* This file is part of Hubbub. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef hubbub_h_ |
#define hubbub_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <hubbub/errors.h> |
#include <hubbub/functypes.h> |
#include <hubbub/types.h> |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/hubbub/parser.h |
---|
0,0 → 1,110 |
/* |
* This file is part of Hubbub. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007-8 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef hubbub_parser_h_ |
#define hubbub_parser_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <stdbool.h> |
#include <inttypes.h> |
#include <hubbub/errors.h> |
#include <hubbub/functypes.h> |
#include <hubbub/tree.h> |
#include <hubbub/types.h> |
typedef struct hubbub_parser hubbub_parser; |
/** |
* Hubbub parser option types |
*/ |
typedef enum hubbub_parser_opttype { |
HUBBUB_PARSER_TOKEN_HANDLER, |
HUBBUB_PARSER_ERROR_HANDLER, |
HUBBUB_PARSER_CONTENT_MODEL, |
HUBBUB_PARSER_TREE_HANDLER, |
HUBBUB_PARSER_DOCUMENT_NODE, |
HUBBUB_PARSER_ENABLE_SCRIPTING, |
HUBBUB_PARSER_PAUSE |
} hubbub_parser_opttype; |
/** |
* Hubbub parser option parameters |
*/ |
typedef union hubbub_parser_optparams { |
struct { |
hubbub_token_handler handler; |
void *pw; |
} token_handler; /**< Token handling callback */ |
struct { |
hubbub_error_handler handler; |
void *pw; |
} error_handler; /**< Error handling callback */ |
struct { |
hubbub_content_model model; |
} content_model; /**< Current content model */ |
hubbub_tree_handler *tree_handler; /**< Tree handling callbacks */ |
void *document_node; /**< Document node */ |
bool enable_scripting; /**< Whether to enable scripting */ |
bool pause_parse; /**< Pause parsing */ |
} hubbub_parser_optparams; |
/* Create a hubbub parser */ |
hubbub_error hubbub_parser_create(const char *enc, bool fix_enc, |
hubbub_allocator_fn alloc, void *pw, hubbub_parser **parser); |
/* Destroy a hubbub parser */ |
hubbub_error hubbub_parser_destroy(hubbub_parser *parser); |
/* Configure a hubbub parser */ |
hubbub_error hubbub_parser_setopt(hubbub_parser *parser, |
hubbub_parser_opttype type, |
hubbub_parser_optparams *params); |
/* Pass a chunk of data to a hubbub parser for parsing */ |
/* This data is encoded in the input charset */ |
hubbub_error hubbub_parser_parse_chunk(hubbub_parser *parser, |
const uint8_t *data, size_t len); |
/** |
* Insert a chunk of data into a hubbub parser input stream |
* |
* This data is encoded in the input charset |
* |
* Inserts the given data into the input stream ready for parsing but |
* does not cause any additional processing of the input. This is |
* useful to allow hubbub callbacks to add computed data to the input. |
* |
* \param parser Parser instance to use |
* \param data Data to parse (encoded in the input charset) |
* \param len Length, in bytes, of data |
* \return HUBBUB_OK on success, appropriate error otherwise |
*/ |
hubbub_error hubbub_parser_insert_chunk(hubbub_parser *parser, |
const uint8_t *data, size_t len); |
/* Inform the parser that the last chunk of data has been parsed */ |
hubbub_error hubbub_parser_completed(hubbub_parser *parser); |
/* Read the document charset */ |
const char *hubbub_parser_read_charset(hubbub_parser *parser, |
hubbub_charset_source *source); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/hubbub/tree.h |
---|
0,0 → 1,300 |
/* |
* This file is part of Hubbub. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef hubbub_tree_h_ |
#define hubbub_tree_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <hubbub/functypes.h> |
/** |
* Create a comment node |
* |
* \param ctx Client's context |
* \param data String content of node |
* \param result Pointer to location to receive created node |
* \return HUBBUB_OK on success, appropriate error otherwise. |
* |
* Postcondition: if successful, result's reference count must be 1. |
*/ |
typedef hubbub_error (*hubbub_tree_create_comment)(void *ctx, |
const hubbub_string *data, |
void **result); |
/** |
* Create a doctype node |
* |
* \param ctx Client's context |
* \param doctype Data for doctype node (name, public id, system id) |
* \param result Pointer to location to receive created node |
* \return HUBBUB_OK on success, appropriate error otherwise. |
* |
* Postcondition: if successful, result's reference count must be 1. |
*/ |
typedef hubbub_error (*hubbub_tree_create_doctype)(void *ctx, |
const hubbub_doctype *doctype, |
void **result); |
/** |
* Create an element node |
* |
* \param ctx Client's context |
* \param tag Data for element node (namespace, name, attributes) |
* \param result Pointer to location to receive created node |
* \return HUBBUB_OK on success, appropriate error otherwise. |
* |
* Postcondition: if successful, result's reference count must be 1. |
*/ |
typedef hubbub_error (*hubbub_tree_create_element)(void *ctx, |
const hubbub_tag *tag, |
void **result); |
/** |
* Create a text node |
* |
* \param ctx Client's context |
* \param data String content of node |
* \param result Pointer to location to receive created node |
* \return HUBBUB_OK on success, appropriate error otherwise. |
* |
* Postcondition: if successful, result's reference count must be 1. |
*/ |
typedef hubbub_error (*hubbub_tree_create_text)(void *ctx, |
const hubbub_string *data, |
void **result); |
/** |
* Increase a node's reference count |
* |
* \param ctx Client's context |
* \param node Node to reference |
* \return HUBBUB_OK on success, appropriate error otherwise. |
* |
* Postcondition: node's reference count is one larger than before |
*/ |
typedef hubbub_error (*hubbub_tree_ref_node)(void *ctx, void *node); |
/** |
* Decrease a node's reference count |
* |
* \param ctx Client's context |
* \param node Node to reference |
* \return HUBBUB_OK on success, appropriate error otherwise. |
* |
* Postcondition: If the node's reference count becomes zero, and it has no |
* parent, and it is not the document node, then it is destroyed. Otherwise, |
* the reference count is one less than before. |
*/ |
typedef hubbub_error (*hubbub_tree_unref_node)(void *ctx, void *node); |
/** |
* Append a node to the end of another's child list |
* |
* \param ctx Client's context |
* \param parent The node to append to |
* \param child The node to append |
* \param result Pointer to location to receive appended node |
* \return HUBBUB_OK on success, appropriate error otherwise. |
* |
* Postcondition: if successful, result's reference count is increased by 1 |
* |
* Important: *result may not == child (e.g. if text nodes got coalesced) |
*/ |
typedef hubbub_error (*hubbub_tree_append_child)(void *ctx, |
void *parent, |
void *child, |
void **result); |
/** |
* Insert a node into another's child list |
* |
* \param ctx Client's context |
* \param parent The node to insert into |
* \param child The node to insert |
* \param ref_child The node to insert before |
* \param result Pointer to location to receive inserted node |
* \return HUBBUB_OK on success, appropriate error otherwise. |
* |
* Postcondition: if successful, result's reference count is increased by 1 |
* |
* Important: *result may not == child (e.g. if text nodes got coalesced) |
*/ |
typedef hubbub_error (*hubbub_tree_insert_before)(void *ctx, |
void *parent, |
void *child, |
void *ref_child, |
void **result); |
/** |
* Remove a node from another's child list |
* |
* \param ctx Client context |
* \param parent The node to remove from |
* \param child The node to remove |
* \param result Pointer to location to receive removed node |
* \return HUBBUB_OK on success, appropriate error otherwise. |
* |
* Postcondition: if successful, result's reference count is increased by 1 |
*/ |
typedef hubbub_error (*hubbub_tree_remove_child)(void *ctx, |
void *parent, |
void *child, |
void **result); |
/** |
* Clone a node |
* |
* \param ctx Client's context |
* \param node The node to clone |
* \param deep True to clone entire subtree, false to clone only the node |
* \param result Pointer to location to receive clone |
* \return HUBBUB_OK on success, appropriate error otherwise. |
* |
* Postcondition: if successful, result's reference count must be 1. |
*/ |
typedef hubbub_error (*hubbub_tree_clone_node)(void *ctx, |
void *node, |
bool deep, |
void **result); |
/** |
* Move all the children of one node to another |
* |
* \param ctx Client's context |
* \param node The initial parent node |
* \param new_parent The new parent node |
* \return HUBBUB_OK on success, appropriate error otherwise. |
*/ |
typedef hubbub_error (*hubbub_tree_reparent_children)(void *ctx, |
void *node, |
void *new_parent); |
/** |
* Retrieve the parent of a node |
* |
* \param ctx Client context |
* \param node Node to retrieve the parent of |
* \param element_only True if the parent must be an element, false otherwise |
* \param result Pointer to location to receive parent node |
* \return HUBBUB_OK on success, appropriate error otherwise. |
* |
* If there is a parent node, but it is not an element node and element_only |
* is true, then act as if no parent existed. |
* |
* Postcondition: if there is a parent, then result's reference count must be |
* increased. |
*/ |
typedef hubbub_error (*hubbub_tree_get_parent)(void *ctx, |
void *node, |
bool element_only, |
void **result); |
/** |
* Determine if a node has children |
* |
* \param ctx Client's context |
* \param node The node to inspect |
* \param result Location to receive result |
* \return HUBBUB_OK on success, appropriate error otherwise. |
*/ |
typedef hubbub_error (*hubbub_tree_has_children)(void *ctx, |
void *node, |
bool *result); |
/** |
* Associate a node with a form |
* |
* \param ctx Client's context |
* \param form The form to associate with |
* \param node The node to associate |
* \return HUBBUB_OK on success, appropriate error otherwise. |
*/ |
typedef hubbub_error (*hubbub_tree_form_associate)(void *ctx, |
void *form, |
void *node); |
/** |
* Add attributes to a node |
* |
* \param ctx Client's context |
* \param node The node to add to |
* \param attributes Array of attributes to add |
* \param n_attributes Number of entries in array |
* \return HUBBUB_OK on success, appropriate error otherwise. |
*/ |
typedef hubbub_error (*hubbub_tree_add_attributes)(void *ctx, |
void *node, |
const hubbub_attribute *attributes, |
uint32_t n_attributes); |
/** |
* Notification of the quirks mode of a document |
* |
* \param ctx Client's context |
* \param mode The quirks mode |
* \return HUBBUB_OK on success, appropriate error otherwise. |
*/ |
typedef hubbub_error (*hubbub_tree_set_quirks_mode)(void *ctx, |
hubbub_quirks_mode mode); |
/** |
* Notification that a potential encoding change is required |
* |
* \param ctx Client's context |
* \param charset The new charset for the source data |
* \return HUBBUB_OK to continue using the current input handler, |
* HUBBUB_ENCODINGCHANGE to stop processing immediately and |
* return control to the client, |
* appropriate error otherwise. |
*/ |
typedef hubbub_error (*hubbub_tree_encoding_change)(void *ctx, |
const char *encname); |
/** |
* Complete script processing |
* |
* \param ctx Client's context |
* \param script The script |
* \return HUBBUB_OK on success, appropriate error otherwise. |
*/ |
typedef hubbub_error (*hubbub_tree_complete_script)(void *ctx, void *script); |
/** |
* Hubbub tree handler |
*/ |
typedef struct hubbub_tree_handler { |
hubbub_tree_create_comment create_comment; /**< Create comment */ |
hubbub_tree_create_doctype create_doctype; /**< Create doctype */ |
hubbub_tree_create_element create_element; /**< Create element */ |
hubbub_tree_create_text create_text; /**< Create text */ |
hubbub_tree_ref_node ref_node; /**< Reference node */ |
hubbub_tree_unref_node unref_node; /**< Unreference node */ |
hubbub_tree_append_child append_child; /**< Append child */ |
hubbub_tree_insert_before insert_before; /**< Insert before */ |
hubbub_tree_remove_child remove_child; /**< Remove child */ |
hubbub_tree_clone_node clone_node; /**< Clone node */ |
hubbub_tree_reparent_children reparent_children;/**< Reparent children*/ |
hubbub_tree_get_parent get_parent; /**< Get parent */ |
hubbub_tree_has_children has_children; /**< Has children? */ |
hubbub_tree_form_associate form_associate; /**< Form associate */ |
hubbub_tree_add_attributes add_attributes; /**< Add attributes */ |
hubbub_tree_set_quirks_mode set_quirks_mode; /**< Set quirks mode */ |
hubbub_tree_encoding_change encoding_change; /**< Change encoding */ |
hubbub_tree_complete_script complete_script; /**< Script Complete */ |
void *ctx; /**< Context pointer */ |
} hubbub_tree_handler; |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/hubbub/types.h |
---|
0,0 → 1,137 |
/* |
* This file is part of Hubbub. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef hubbub_types_h_ |
#define hubbub_types_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <stdbool.h> |
#include <inttypes.h> |
/** Source of charset information, in order of importance |
* A client-dictated charset will override all others. |
* A document-specified charset will override autodetection or the default */ |
typedef enum hubbub_charset_source { |
HUBBUB_CHARSET_UNKNOWN = 0, /**< Unknown */ |
HUBBUB_CHARSET_TENTATIVE = 1, /**< Charset may be changed |
* with further data */ |
HUBBUB_CHARSET_CONFIDENT = 2 /**< Charset definite */ |
} hubbub_charset_source; |
/** |
* Content model flag |
*/ |
typedef enum hubbub_content_model { |
HUBBUB_CONTENT_MODEL_PCDATA, |
HUBBUB_CONTENT_MODEL_RCDATA, |
HUBBUB_CONTENT_MODEL_CDATA, |
HUBBUB_CONTENT_MODEL_PLAINTEXT |
} hubbub_content_model; |
/** |
* Quirks mode flag |
*/ |
typedef enum hubbub_quirks_mode { |
HUBBUB_QUIRKS_MODE_NONE, |
HUBBUB_QUIRKS_MODE_LIMITED, |
HUBBUB_QUIRKS_MODE_FULL |
} hubbub_quirks_mode; |
/** |
* Type of an emitted token |
*/ |
typedef enum hubbub_token_type { |
HUBBUB_TOKEN_DOCTYPE, |
HUBBUB_TOKEN_START_TAG, |
HUBBUB_TOKEN_END_TAG, |
HUBBUB_TOKEN_COMMENT, |
HUBBUB_TOKEN_CHARACTER, |
HUBBUB_TOKEN_EOF |
} hubbub_token_type; |
/** |
* Possible namespaces |
*/ |
typedef enum hubbub_ns { |
HUBBUB_NS_NULL, |
HUBBUB_NS_HTML, |
HUBBUB_NS_MATHML, |
HUBBUB_NS_SVG, |
HUBBUB_NS_XLINK, |
HUBBUB_NS_XML, |
HUBBUB_NS_XMLNS |
} hubbub_ns; |
/** |
* Tokeniser string type |
*/ |
typedef struct hubbub_string { |
const uint8_t *ptr; /**< Pointer to data */ |
size_t len; /**< Byte length of string */ |
} hubbub_string; |
/** |
* Tag attribute data |
*/ |
typedef struct hubbub_attribute { |
hubbub_ns ns; /**< Attribute namespace */ |
hubbub_string name; /**< Attribute name */ |
hubbub_string value; /**< Attribute value */ |
} hubbub_attribute; |
/** |
* Data for doctype token |
*/ |
typedef struct hubbub_doctype { |
hubbub_string name; /**< Doctype name */ |
bool public_missing; /**< Whether the public id is missing */ |
hubbub_string public_id; /**< Doctype public identifier */ |
bool system_missing; /**< Whether the system id is missing */ |
hubbub_string system_id; /**< Doctype system identifier */ |
bool force_quirks; /**< Doctype force-quirks flag */ |
} hubbub_doctype; |
/** |
* Data for a tag |
*/ |
typedef struct hubbub_tag { |
hubbub_ns ns; /**< Tag namespace */ |
hubbub_string name; /**< Tag name */ |
uint32_t n_attributes; /**< Count of attributes */ |
hubbub_attribute *attributes; /**< Array of attribute data */ |
bool self_closing; /**< Whether the tag can have children */ |
} hubbub_tag; |
/** |
* Token data |
*/ |
typedef struct hubbub_token { |
hubbub_token_type type; /**< The token type */ |
union { |
hubbub_doctype doctype; |
hubbub_tag tag; |
hubbub_string comment; |
hubbub_string character; |
} data; /**< Type-specific data */ |
} hubbub_token; |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/libcss/computed.h |
---|
0,0 → 1,403 |
/* |
* This file is part of LibCSS |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef libcss_computed_h_ |
#define libcss_computed_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <libwapcaplet/libwapcaplet.h> |
#include <libcss/errors.h> |
#include <libcss/functypes.h> |
#include <libcss/properties.h> |
#include <libcss/types.h> |
struct css_hint; |
struct css_select_handler; |
typedef struct css_computed_counter { |
lwc_string *name; |
css_fixed value; |
} css_computed_counter; |
typedef struct css_computed_clip_rect { |
css_fixed top; |
css_fixed right; |
css_fixed bottom; |
css_fixed left; |
css_unit tunit; |
css_unit runit; |
css_unit bunit; |
css_unit lunit; |
bool top_auto; |
bool right_auto; |
bool bottom_auto; |
bool left_auto; |
} css_computed_clip_rect; |
enum css_computed_content_type { |
CSS_COMPUTED_CONTENT_NONE = 0, |
CSS_COMPUTED_CONTENT_STRING = 1, |
CSS_COMPUTED_CONTENT_URI = 2, |
CSS_COMPUTED_CONTENT_COUNTER = 3, |
CSS_COMPUTED_CONTENT_COUNTERS = 4, |
CSS_COMPUTED_CONTENT_ATTR = 5, |
CSS_COMPUTED_CONTENT_OPEN_QUOTE = 6, |
CSS_COMPUTED_CONTENT_CLOSE_QUOTE = 7, |
CSS_COMPUTED_CONTENT_NO_OPEN_QUOTE = 8, |
CSS_COMPUTED_CONTENT_NO_CLOSE_QUOTE = 9 |
}; |
typedef struct css_computed_content_item { |
uint8_t type; |
union { |
lwc_string *string; |
lwc_string *uri; |
lwc_string *attr; |
struct { |
lwc_string *name; |
uint8_t style; |
} counter; |
struct { |
lwc_string *name; |
lwc_string *sep; |
uint8_t style; |
} counters; |
} data; |
} css_computed_content_item; |
css_error css_computed_style_create(css_allocator_fn alloc, void *pw, |
css_computed_style **result); |
css_error css_computed_style_destroy(css_computed_style *style); |
css_error css_computed_style_initialise(css_computed_style *style, |
struct css_select_handler *handler, void *pw); |
css_error css_computed_style_compose(const css_computed_style *parent, |
const css_computed_style *child, |
css_error (*compute_font_size)(void *pw, |
const struct css_hint *parent, |
struct css_hint *size), |
void *pw, |
css_computed_style *result); |
/****************************************************************************** |
* Property accessors below here * |
******************************************************************************/ |
uint8_t css_computed_letter_spacing( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_outline_color( |
const css_computed_style *style, css_color *color); |
uint8_t css_computed_outline_width( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_border_spacing( |
const css_computed_style *style, |
css_fixed *hlength, css_unit *hunit, |
css_fixed *vlength, css_unit *vunit); |
uint8_t css_computed_word_spacing( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_counter_increment( |
const css_computed_style *style, |
const css_computed_counter **counters); |
uint8_t css_computed_counter_reset( |
const css_computed_style *style, |
const css_computed_counter **counters); |
uint8_t css_computed_cursor( |
const css_computed_style *style, |
lwc_string ***urls); |
uint8_t css_computed_clip( |
const css_computed_style *style, |
css_computed_clip_rect *rect); |
uint8_t css_computed_content( |
const css_computed_style *style, |
const css_computed_content_item **content); |
uint8_t css_computed_vertical_align( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_font_size( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_border_top_width( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_border_right_width( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_border_bottom_width( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_border_left_width( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_background_image( |
const css_computed_style *style, |
lwc_string **url); |
uint8_t css_computed_color( |
const css_computed_style *style, |
css_color *color); |
uint8_t css_computed_list_style_image( |
const css_computed_style *style, |
lwc_string **url); |
uint8_t css_computed_quotes( |
const css_computed_style *style, |
lwc_string ***quotes); |
uint8_t css_computed_top( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_right( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_bottom( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_left( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_border_top_color( |
const css_computed_style *style, |
css_color *color); |
uint8_t css_computed_border_right_color( |
const css_computed_style *style, |
css_color *color); |
uint8_t css_computed_border_bottom_color( |
const css_computed_style *style, |
css_color *color); |
uint8_t css_computed_border_left_color( |
const css_computed_style *style, |
css_color *color); |
uint8_t css_computed_height( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_line_height( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_background_color( |
const css_computed_style *style, |
css_color *color); |
uint8_t css_computed_z_index( |
const css_computed_style *style, |
int32_t *z_index); |
uint8_t css_computed_margin_top( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_margin_right( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_margin_bottom( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_margin_left( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_background_attachment( |
const css_computed_style *style); |
uint8_t css_computed_border_collapse( |
const css_computed_style *style); |
uint8_t css_computed_caption_side( |
const css_computed_style *style); |
uint8_t css_computed_direction( |
const css_computed_style *style); |
uint8_t css_computed_max_height( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_max_width( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_width( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_empty_cells( |
const css_computed_style *style); |
uint8_t css_computed_float( |
const css_computed_style *style); |
uint8_t css_computed_font_style( |
const css_computed_style *style); |
uint8_t css_computed_min_height( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_min_width( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_background_repeat( |
const css_computed_style *style); |
uint8_t css_computed_clear( |
const css_computed_style *style); |
uint8_t css_computed_padding_top( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_padding_right( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_padding_bottom( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_padding_left( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_overflow( |
const css_computed_style *style); |
uint8_t css_computed_position( |
const css_computed_style *style); |
uint8_t css_computed_opacity( |
const css_computed_style *style, |
css_fixed *opacity); |
uint8_t css_computed_text_transform( |
const css_computed_style *style); |
uint8_t css_computed_text_indent( |
const css_computed_style *style, |
css_fixed *length, css_unit *unit); |
uint8_t css_computed_white_space( |
const css_computed_style *style); |
uint8_t css_computed_background_position( |
const css_computed_style *style, |
css_fixed *hlength, css_unit *hunit, |
css_fixed *vlength, css_unit *vunit); |
uint8_t css_computed_display( |
const css_computed_style *style, bool root); |
uint8_t css_computed_display_static( |
const css_computed_style *style); |
uint8_t css_computed_font_variant( |
const css_computed_style *style); |
uint8_t css_computed_text_decoration( |
const css_computed_style *style); |
uint8_t css_computed_font_family( |
const css_computed_style *style, |
lwc_string ***names); |
uint8_t css_computed_border_top_style( |
const css_computed_style *style); |
uint8_t css_computed_border_right_style( |
const css_computed_style *style); |
uint8_t css_computed_border_bottom_style( |
const css_computed_style *style); |
uint8_t css_computed_border_left_style( |
const css_computed_style *style); |
uint8_t css_computed_font_weight( |
const css_computed_style *style); |
uint8_t css_computed_list_style_type( |
const css_computed_style *style); |
uint8_t css_computed_outline_style( |
const css_computed_style *style); |
uint8_t css_computed_table_layout( |
const css_computed_style *style); |
uint8_t css_computed_unicode_bidi( |
const css_computed_style *style); |
uint8_t css_computed_visibility( |
const css_computed_style *style); |
uint8_t css_computed_list_style_position( |
const css_computed_style *style); |
uint8_t css_computed_text_align( |
const css_computed_style *style); |
uint8_t css_computed_page_break_after( |
const css_computed_style *style); |
uint8_t css_computed_page_break_before( |
const css_computed_style *style); |
uint8_t css_computed_page_break_inside( |
const css_computed_style *style); |
uint8_t css_computed_orphans( |
const css_computed_style *style, |
int32_t *orphans); |
uint8_t css_computed_widows( |
const css_computed_style *style, |
int32_t *widows); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/libcss/errors.h |
---|
0,0 → 1,40 |
/* |
* This file is part of LibCSS. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef libcss_errors_h_ |
#define libcss_errors_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <stddef.h> |
typedef enum css_error { |
CSS_OK = 0, |
CSS_NOMEM = 1, |
CSS_BADPARM = 2, |
CSS_INVALID = 3, |
CSS_FILENOTFOUND = 4, |
CSS_NEEDDATA = 5, |
CSS_BADCHARSET = 6, |
CSS_EOF = 7, |
CSS_IMPORTS_PENDING = 8, |
CSS_PROPERTY_NOT_SET = 9 |
} css_error; |
/* Convert a libcss error value to a string */ |
const char *css_error_to_string(css_error error); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/libcss/font_face.h |
---|
0,0 → 1,79 |
/* |
* This file is part of LibCSS. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2011 Things Made Out Of Other Things Ltd. |
* Written by James Montgomerie <jamie@th.ingsmadeoutofotherthin.gs> |
*/ |
#ifndef libcss_font_face_h_ |
#define libcss_font_face_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <libwapcaplet/libwapcaplet.h> |
#include <libcss/errors.h> |
#include <libcss/functypes.h> |
#include <libcss/properties.h> |
#include <libcss/types.h> |
typedef enum css_font_face_format { |
CSS_FONT_FACE_FORMAT_UNSPECIFIED = 0x00, |
CSS_FONT_FACE_FORMAT_WOFF = 0x01, |
/* WOFF (Web Open Font Format); .woff */ |
CSS_FONT_FACE_FORMAT_OPENTYPE = 0x02, |
/* TrueType or OpenType; .ttf, .otf */ |
CSS_FONT_FACE_FORMAT_EMBEDDED_OPENTYPE = 0x04, |
/* Embedded OpenType; .eot */ |
CSS_FONT_FACE_FORMAT_SVG = 0x08, |
/* SVG Font; .svg, .svgz */ |
CSS_FONT_FACE_FORMAT_UNKNOWN = 0x10, |
/* Format specified, but not recognised */ |
/* We don't define CSS_FONT_FACE_SRC_FORMAT_TRUETYPE as might be |
* expected, because the CSS3 specification |
* (http://www.w3.org/TR/css3-fonts/, §4.3) says: |
* "Given the overlap in common usage between TrueType and |
* OpenType, the format hints "truetype" and "opentype" must be |
* considered as synonymous" |
* so we compute a hint of 'truetype' to css_font_face_format_opentype. |
*/ |
} css_font_face_format; |
typedef enum css_font_face_location_type { |
CSS_FONT_FACE_LOCATION_TYPE_UNSPECIFIED = 0, |
CSS_FONT_FACE_LOCATION_TYPE_LOCAL = 1, |
CSS_FONT_FACE_LOCATION_TYPE_URI = 2, |
} css_font_face_location_type; |
css_error css_font_face_get_font_family( |
const css_font_face *font_face, |
lwc_string **font_family); |
css_error css_font_face_count_srcs(const css_font_face *font_face, |
uint32_t *count); |
css_error css_font_face_get_src(const css_font_face *font_face, uint32_t index, |
const css_font_face_src **src); |
css_error css_font_face_src_get_location(const css_font_face_src *src, |
lwc_string **location); |
css_font_face_location_type css_font_face_src_location_type( |
const css_font_face_src *src); |
css_font_face_format css_font_face_src_format(const css_font_face_src *src); |
uint8_t css_font_face_font_style(const css_font_face *font_face); |
uint8_t css_font_face_font_weight(const css_font_face *font_face); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/libcss/fpmath.h |
---|
0,0 → 1,158 |
/* |
* This file is part of LibCSS. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef libcss_fpmath_h_ |
#define libcss_fpmath_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <stdint.h> |
#include <limits.h> |
/* 22:10 fixed point math */ |
#define CSS_RADIX_POINT 10 |
/* type for fixed point numbers */ |
typedef int32_t css_fixed; |
static inline css_fixed |
css_add_fixed(const css_fixed x, const css_fixed y) { |
int32_t ux = x; |
int32_t uy = y; |
int32_t res = ux + uy; |
/* Calculate overflowed result. (Don't change the sign bit of ux) */ |
ux = (ux >> 31) + INT_MAX; |
/* Force compiler to use cmovns instruction */ |
if ((int32_t) ((ux ^ uy) | ~(uy ^ res)) >= 0) { |
res = ux; |
} |
return res; |
} |
static inline css_fixed |
css_subtract_fixed(const css_fixed x, const css_fixed y) { |
int32_t ux = x; |
int32_t uy = y; |
int32_t res = ux - uy; |
ux = (ux >> 31) + INT_MAX; |
/* Force compiler to use cmovns instruction */ |
if ((int32_t)((ux ^ uy) & (ux ^ res)) < 0) { |
res = ux; |
} |
return res; |
} |
static inline css_fixed |
css_divide_fixed(const css_fixed x, const css_fixed y) { |
int64_t xx = ((int64_t)x << CSS_RADIX_POINT) / y; |
if (xx < INT_MIN) |
xx = INT_MIN; |
if (xx > INT_MAX) |
xx = INT_MAX; |
return xx; |
} |
static inline css_fixed |
css_multiply_fixed(const css_fixed x, const css_fixed y) { |
int64_t xx = ((int64_t)x * (int64_t)y) >> CSS_RADIX_POINT; |
if (xx < INT_MIN) |
xx = INT_MIN; |
if (xx > INT_MAX) |
xx = INT_MAX; |
return xx; |
} |
static inline css_fixed |
css_int_to_fixed(const int a) { |
int64_t xx = ((int64_t) a) << CSS_RADIX_POINT; |
if (xx < INT_MIN) |
xx = INT_MIN; |
if (xx > INT_MAX) |
xx = INT_MAX; |
return xx; |
} |
static inline css_fixed |
css_float_to_fixed(const float a) { |
float xx = a * (float) (1 << CSS_RADIX_POINT); |
if (xx < INT_MIN) |
xx = INT_MIN; |
if (xx > INT_MAX) |
xx = INT_MAX; |
return (css_fixed) xx; |
} |
/* Add two fixed point values */ |
#define FADD(a, b) (css_add_fixed((a), (b))) |
/* Subtract two fixed point values */ |
#define FSUB(a, b) (css_subtract_fixed((a), (b))) |
/* Multiply two fixed point values */ |
#define FMUL(a, b) (css_multiply_fixed((a), (b))) |
/* Divide two fixed point values */ |
#define FDIV(a, b) (css_divide_fixed((a), (b))) |
/* Convert a floating point value to fixed point */ |
#define FLTTOFIX(a) ((css_fixed) ((a) * (float) (1 << CSS_RADIX_POINT))) |
/* Convert a fixed point value to floating point */ |
#define FIXTOFLT(a) ((float) (a) / (float) (1 << CSS_RADIX_POINT)) |
/* Convert an integer to a fixed point value */ |
#define INTTOFIX(a) (css_int_to_fixed(a)) |
/* Convert a fixed point value to an integer */ |
#define FIXTOINT(a) ((a) >> CSS_RADIX_POINT) |
/* truncate a fixed point value */ |
#define TRUNCATEFIX(a) (a & ~((1 << CSS_RADIX_POINT)- 1 )) |
/* Useful values */ |
#define F_PI_2 0x00000648 /* 1.5708 (PI/2) */ |
#define F_PI 0x00000c91 /* 3.1415 (PI) */ |
#define F_3PI_2 0x000012d9 /* 4.7124 (3PI/2) */ |
#define F_2PI 0x00001922 /* 6.2831 (2 PI) */ |
#define F_90 0x00016800 /* 90 */ |
#define F_180 0x0002d000 /* 180 */ |
#define F_270 0x00043800 /* 270 */ |
#define F_360 0x0005a000 /* 360 */ |
#define F_0_5 0x00000200 /* 0.5 */ |
#define F_1 0x00000400 /* 1 */ |
#define F_10 0x00002800 /* 10 */ |
#define F_72 0x00012000 /* 72 */ |
#define F_100 0x00019000 /* 100 */ |
#define F_200 0x00032000 /* 200 */ |
#define F_255 0x0003FC00 /* 255 */ |
#define F_300 0x0004b000 /* 300 */ |
#define F_400 0x00064000 /* 400 */ |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/libcss/functypes.h |
---|
0,0 → 1,30 |
/* |
* This file is part of LibCSS. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007-8 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef libcss_functypes_h_ |
#define libcss_functypes_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <stdbool.h> |
#include <stdint.h> |
#include <stdlib.h> |
#include <libcss/types.h> |
/* Type of allocation function for libcss */ |
typedef void *(*css_allocator_fn)(void *ptr, size_t size, void *pw); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/libcss/hint.h |
---|
0,0 → 1,59 |
/* |
* This file is part of LibCSS |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef libcss_hint_h_ |
#define libcss_hint_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <libwapcaplet/libwapcaplet.h> |
#include <libcss/computed.h> |
#include <libcss/errors.h> |
#include <libcss/functypes.h> |
#include <libcss/types.h> |
/** |
* Length object for use in presentational hints |
*/ |
typedef struct css_hint_length { |
css_fixed value; |
css_unit unit; |
} css_hint_length; |
/** |
* Presentational hints |
*/ |
typedef struct css_hint { |
/* Ownership of all data is passed to libcss */ |
union { |
css_computed_clip_rect *clip; |
css_color color; |
css_computed_content_item *content; |
css_computed_counter *counter; |
css_fixed fixed; |
int32_t integer; |
css_hint_length length; |
struct { |
css_hint_length h; |
css_hint_length v; |
} position; |
lwc_string *string; |
lwc_string **strings; |
} data; |
uint8_t status; |
} css_hint; |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/libcss/libcss.h |
---|
0,0 → 1,32 |
/* |
* This file is part of LibCSS. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef libcss_h_ |
#define libcss_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <libwapcaplet/libwapcaplet.h> |
#include <libcss/errors.h> |
#include <libcss/types.h> |
#include <libcss/functypes.h> |
#include <libcss/computed.h> |
#include <libcss/properties.h> |
#include <libcss/select.h> |
#include <libcss/stylesheet.h> |
#include <libcss/font_face.h> |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/libcss/properties.h |
---|
0,0 → 1,753 |
/* |
* This file is part of LibCSS |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef libcss_properties_h_ |
#define libcss_properties_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
enum css_properties_e { |
CSS_PROP_AZIMUTH = 0x000, |
CSS_PROP_BACKGROUND_ATTACHMENT = 0x001, |
CSS_PROP_BACKGROUND_COLOR = 0x002, |
CSS_PROP_BACKGROUND_IMAGE = 0x003, |
CSS_PROP_BACKGROUND_POSITION = 0x004, |
CSS_PROP_BACKGROUND_REPEAT = 0x005, |
CSS_PROP_BORDER_COLLAPSE = 0x006, |
CSS_PROP_BORDER_SPACING = 0x007, |
CSS_PROP_BORDER_TOP_COLOR = 0x008, |
CSS_PROP_BORDER_RIGHT_COLOR = 0x009, |
CSS_PROP_BORDER_BOTTOM_COLOR = 0x00a, |
CSS_PROP_BORDER_LEFT_COLOR = 0x00b, |
CSS_PROP_BORDER_TOP_STYLE = 0x00c, |
CSS_PROP_BORDER_RIGHT_STYLE = 0x00d, |
CSS_PROP_BORDER_BOTTOM_STYLE = 0x00e, |
CSS_PROP_BORDER_LEFT_STYLE = 0x00f, |
CSS_PROP_BORDER_TOP_WIDTH = 0x010, |
CSS_PROP_BORDER_RIGHT_WIDTH = 0x011, |
CSS_PROP_BORDER_BOTTOM_WIDTH = 0x012, |
CSS_PROP_BORDER_LEFT_WIDTH = 0x013, |
CSS_PROP_BOTTOM = 0x014, |
CSS_PROP_CAPTION_SIDE = 0x015, |
CSS_PROP_CLEAR = 0x016, |
CSS_PROP_CLIP = 0x017, |
CSS_PROP_COLOR = 0x018, |
CSS_PROP_CONTENT = 0x019, |
CSS_PROP_COUNTER_INCREMENT = 0x01a, |
CSS_PROP_COUNTER_RESET = 0x01b, |
CSS_PROP_CUE_AFTER = 0x01c, |
CSS_PROP_CUE_BEFORE = 0x01d, |
CSS_PROP_CURSOR = 0x01e, |
CSS_PROP_DIRECTION = 0x01f, |
CSS_PROP_DISPLAY = 0x020, |
CSS_PROP_ELEVATION = 0x021, |
CSS_PROP_EMPTY_CELLS = 0x022, |
CSS_PROP_FLOAT = 0x023, |
CSS_PROP_FONT_FAMILY = 0x024, |
CSS_PROP_FONT_SIZE = 0x025, |
CSS_PROP_FONT_STYLE = 0x026, |
CSS_PROP_FONT_VARIANT = 0x027, |
CSS_PROP_FONT_WEIGHT = 0x028, |
CSS_PROP_HEIGHT = 0x029, |
CSS_PROP_LEFT = 0x02a, |
CSS_PROP_LETTER_SPACING = 0x02b, |
CSS_PROP_LINE_HEIGHT = 0x02c, |
CSS_PROP_LIST_STYLE_IMAGE = 0x02d, |
CSS_PROP_LIST_STYLE_POSITION = 0x02e, |
CSS_PROP_LIST_STYLE_TYPE = 0x02f, |
CSS_PROP_MARGIN_TOP = 0x030, |
CSS_PROP_MARGIN_RIGHT = 0x031, |
CSS_PROP_MARGIN_BOTTOM = 0x032, |
CSS_PROP_MARGIN_LEFT = 0x033, |
CSS_PROP_MAX_HEIGHT = 0x034, |
CSS_PROP_MAX_WIDTH = 0x035, |
CSS_PROP_MIN_HEIGHT = 0x036, |
CSS_PROP_MIN_WIDTH = 0x037, |
CSS_PROP_ORPHANS = 0x038, |
CSS_PROP_OUTLINE_COLOR = 0x039, |
CSS_PROP_OUTLINE_STYLE = 0x03a, |
CSS_PROP_OUTLINE_WIDTH = 0x03b, |
CSS_PROP_OVERFLOW = 0x03c, |
CSS_PROP_PADDING_TOP = 0x03d, |
CSS_PROP_PADDING_RIGHT = 0x03e, |
CSS_PROP_PADDING_BOTTOM = 0x03f, |
CSS_PROP_PADDING_LEFT = 0x040, |
CSS_PROP_PAGE_BREAK_AFTER = 0x041, |
CSS_PROP_PAGE_BREAK_BEFORE = 0x042, |
CSS_PROP_PAGE_BREAK_INSIDE = 0x043, |
CSS_PROP_PAUSE_AFTER = 0x044, |
CSS_PROP_PAUSE_BEFORE = 0x045, |
CSS_PROP_PITCH_RANGE = 0x046, |
CSS_PROP_PITCH = 0x047, |
CSS_PROP_PLAY_DURING = 0x048, |
CSS_PROP_POSITION = 0x049, |
CSS_PROP_QUOTES = 0x04a, |
CSS_PROP_RICHNESS = 0x04b, |
CSS_PROP_RIGHT = 0x04c, |
CSS_PROP_SPEAK_HEADER = 0x04d, |
CSS_PROP_SPEAK_NUMERAL = 0x04e, |
CSS_PROP_SPEAK_PUNCTUATION = 0x04f, |
CSS_PROP_SPEAK = 0x050, |
CSS_PROP_SPEECH_RATE = 0x051, |
CSS_PROP_STRESS = 0x052, |
CSS_PROP_TABLE_LAYOUT = 0x053, |
CSS_PROP_TEXT_ALIGN = 0x054, |
CSS_PROP_TEXT_DECORATION = 0x055, |
CSS_PROP_TEXT_INDENT = 0x056, |
CSS_PROP_TEXT_TRANSFORM = 0x057, |
CSS_PROP_TOP = 0x058, |
CSS_PROP_UNICODE_BIDI = 0x059, |
CSS_PROP_VERTICAL_ALIGN = 0x05a, |
CSS_PROP_VISIBILITY = 0x05b, |
CSS_PROP_VOICE_FAMILY = 0x05c, |
CSS_PROP_VOLUME = 0x05d, |
CSS_PROP_WHITE_SPACE = 0x05e, |
CSS_PROP_WIDOWS = 0x05f, |
CSS_PROP_WIDTH = 0x060, |
CSS_PROP_WORD_SPACING = 0x061, |
CSS_PROP_Z_INDEX = 0x062, |
CSS_PROP_OPACITY = 0x063, |
CSS_PROP_BREAK_AFTER = 0x064, |
CSS_PROP_BREAK_BEFORE = 0x065, |
CSS_PROP_BREAK_INSIDE = 0x066, |
CSS_PROP_COLUMN_COUNT = 0x067, |
CSS_PROP_COLUMN_FILL = 0x068, |
CSS_PROP_COLUMN_GAP = 0x069, |
CSS_PROP_COLUMN_RULE_COLOR = 0x06a, |
CSS_PROP_COLUMN_RULE_STYLE = 0x06b, |
CSS_PROP_COLUMN_RULE_WIDTH = 0x06c, |
CSS_PROP_COLUMN_SPAN = 0x06d, |
CSS_PROP_COLUMN_WIDTH = 0x06e, |
CSS_N_PROPERTIES |
}; |
enum css_background_attachment_e { |
CSS_BACKGROUND_ATTACHMENT_INHERIT = 0x0, |
CSS_BACKGROUND_ATTACHMENT_FIXED = 0x1, |
CSS_BACKGROUND_ATTACHMENT_SCROLL = 0x2 |
}; |
enum css_background_color_e { |
CSS_BACKGROUND_COLOR_INHERIT = 0x0, |
CSS_BACKGROUND_COLOR_COLOR = 0x1, |
CSS_BACKGROUND_COLOR_CURRENT_COLOR = 0x2 |
}; |
enum css_background_image_e { |
CSS_BACKGROUND_IMAGE_INHERIT = 0x0, |
/* Consult pointer in struct to determine which */ |
CSS_BACKGROUND_IMAGE_NONE = 0x1, |
CSS_BACKGROUND_IMAGE_IMAGE = 0x1 |
}; |
enum css_background_position_e { |
CSS_BACKGROUND_POSITION_INHERIT = 0x0, |
CSS_BACKGROUND_POSITION_SET = 0x1 |
}; |
enum css_background_repeat_e { |
CSS_BACKGROUND_REPEAT_INHERIT = 0x0, |
CSS_BACKGROUND_REPEAT_REPEAT_X = 0x1, |
CSS_BACKGROUND_REPEAT_REPEAT_Y = 0x2, |
CSS_BACKGROUND_REPEAT_REPEAT = 0x3, |
CSS_BACKGROUND_REPEAT_NO_REPEAT = 0x4 |
}; |
enum css_border_collapse_e { |
CSS_BORDER_COLLAPSE_INHERIT = 0x0, |
CSS_BORDER_COLLAPSE_SEPARATE = 0x1, |
CSS_BORDER_COLLAPSE_COLLAPSE = 0x2 |
}; |
enum css_border_spacing_e { |
CSS_BORDER_SPACING_INHERIT = 0x0, |
CSS_BORDER_SPACING_SET = 0x1 |
}; |
enum css_border_color_e { |
CSS_BORDER_COLOR_INHERIT = CSS_BACKGROUND_COLOR_INHERIT, |
CSS_BORDER_COLOR_COLOR = CSS_BACKGROUND_COLOR_COLOR, |
CSS_BORDER_COLOR_CURRENT_COLOR = CSS_BACKGROUND_COLOR_CURRENT_COLOR |
}; |
enum css_border_style_e { |
CSS_BORDER_STYLE_INHERIT = 0x0, |
CSS_BORDER_STYLE_NONE = 0x1, |
CSS_BORDER_STYLE_HIDDEN = 0x2, |
CSS_BORDER_STYLE_DOTTED = 0x3, |
CSS_BORDER_STYLE_DASHED = 0x4, |
CSS_BORDER_STYLE_SOLID = 0x5, |
CSS_BORDER_STYLE_DOUBLE = 0x6, |
CSS_BORDER_STYLE_GROOVE = 0x7, |
CSS_BORDER_STYLE_RIDGE = 0x8, |
CSS_BORDER_STYLE_INSET = 0x9, |
CSS_BORDER_STYLE_OUTSET = 0xa |
}; |
enum css_border_width_e { |
CSS_BORDER_WIDTH_INHERIT = 0x0, |
CSS_BORDER_WIDTH_THIN = 0x1, |
CSS_BORDER_WIDTH_MEDIUM = 0x2, |
CSS_BORDER_WIDTH_THICK = 0x3, |
CSS_BORDER_WIDTH_WIDTH = 0x4 |
}; |
enum css_bottom_e { |
CSS_BOTTOM_INHERIT = 0x0, |
CSS_BOTTOM_SET = 0x1, |
CSS_BOTTOM_AUTO = 0x2 |
}; |
enum css_break_after_e { |
CSS_BREAK_AFTER_INHERIT = 0x0, |
CSS_BREAK_AFTER_AUTO = 0x1, |
CSS_BREAK_AFTER_AVOID = 0x2, |
CSS_BREAK_AFTER_ALWAYS = 0x3, |
CSS_BREAK_AFTER_LEFT = 0x4, |
CSS_BREAK_AFTER_RIGHT = 0x5, |
CSS_BREAK_AFTER_PAGE = 0x6, |
CSS_BREAK_AFTER_COLUMN = 0x7, |
CSS_BREAK_AFTER_AVOID_PAGE = 0x8, |
CSS_BREAK_AFTER_AVOID_COLUMN = 0x9 |
}; |
enum css_break_before_e { |
CSS_BREAK_BEFORE_INHERIT = CSS_BREAK_AFTER_INHERIT, |
CSS_BREAK_BEFORE_AUTO = CSS_BREAK_AFTER_AUTO, |
CSS_BREAK_BEFORE_AVOID = CSS_BREAK_AFTER_AVOID, |
CSS_BREAK_BEFORE_ALWAYS = CSS_BREAK_AFTER_ALWAYS, |
CSS_BREAK_BEFORE_LEFT = CSS_BREAK_AFTER_LEFT, |
CSS_BREAK_BEFORE_RIGHT = CSS_BREAK_AFTER_RIGHT, |
CSS_BREAK_BEFORE_PAGE = CSS_BREAK_AFTER_PAGE, |
CSS_BREAK_BEFORE_COLUMN = CSS_BREAK_AFTER_COLUMN, |
CSS_BREAK_BEFORE_AVOID_PAGE = CSS_BREAK_AFTER_AVOID_PAGE, |
CSS_BREAK_BEFORE_AVOID_COLUMN = CSS_BREAK_AFTER_AVOID_COLUMN |
}; |
enum css_break_inside_e { |
CSS_BREAK_INSIDE_INHERIT = CSS_BREAK_AFTER_INHERIT, |
CSS_BREAK_INSIDE_AUTO = CSS_BREAK_AFTER_AUTO, |
CSS_BREAK_INSIDE_AVOID = CSS_BREAK_AFTER_AVOID, |
CSS_BREAK_INSIDE_AVOID_PAGE = CSS_BREAK_AFTER_AVOID_PAGE, |
CSS_BREAK_INSIDE_AVOID_COLUMN = CSS_BREAK_AFTER_AVOID_COLUMN |
}; |
enum css_caption_side_e { |
CSS_CAPTION_SIDE_INHERIT = 0x0, |
CSS_CAPTION_SIDE_TOP = 0x1, |
CSS_CAPTION_SIDE_BOTTOM = 0x2 |
}; |
enum css_clear_e { |
CSS_CLEAR_INHERIT = 0x0, |
CSS_CLEAR_NONE = 0x1, |
CSS_CLEAR_LEFT = 0x2, |
CSS_CLEAR_RIGHT = 0x3, |
CSS_CLEAR_BOTH = 0x4 |
}; |
enum css_clip_e { |
CSS_CLIP_INHERIT = 0x0, |
CSS_CLIP_AUTO = 0x1, |
CSS_CLIP_RECT = 0x2 |
}; |
enum css_color_e { |
CSS_COLOR_INHERIT = 0x0, |
CSS_COLOR_COLOR = 0x1 |
}; |
enum css_column_count_e { |
CSS_COLUMN_COUNT_INHERIT = 0x0, |
CSS_COLUMN_COUNT_AUTO = 0x1, |
CSS_COLUMN_COUNT_SET = 0x2 |
}; |
enum css_column_fill_e { |
CSS_COLUMN_FILL_INHERIT = 0x0, |
CSS_COLUMN_FILL_BALANCE = 0x1, |
CSS_COLUMN_FILL_AUTO = 0x2 |
}; |
enum css_column_gap_e { |
CSS_COLUMN_GAP_INHERIT = 0x0, |
CSS_COLUMN_GAP_NORMAL = 0x1, |
CSS_COLUMN_GAP_SET = 0x2 |
}; |
enum css_column_rule_color_e { |
CSS_COLUMN_RULE_COLOR_INHERIT = CSS_BACKGROUND_COLOR_INHERIT, |
CSS_COLUMN_RULE_COLOR_COLOR = CSS_BACKGROUND_COLOR_COLOR, |
CSS_COLUMN_RULE_COLOR_CURRENT_COLOR = CSS_BACKGROUND_COLOR_CURRENT_COLOR |
}; |
enum css_column_rule_style_e { |
CSS_COLUMN_RULE_STYLE_INHERIT = CSS_BORDER_STYLE_INHERIT, |
CSS_COLUMN_RULE_STYLE_NONE = CSS_BORDER_STYLE_NONE, |
CSS_COLUMN_RULE_STYLE_DOTTED = CSS_BORDER_STYLE_DOTTED, |
CSS_COLUMN_RULE_STYLE_DASHED = CSS_BORDER_STYLE_DASHED, |
CSS_COLUMN_RULE_STYLE_SOLID = CSS_BORDER_STYLE_SOLID, |
CSS_COLUMN_RULE_STYLE_DOUBLE = CSS_BORDER_STYLE_DOUBLE, |
CSS_COLUMN_RULE_STYLE_GROOVE = CSS_BORDER_STYLE_GROOVE, |
CSS_COLUMN_RULE_STYLE_RIDGE = CSS_BORDER_STYLE_RIDGE, |
CSS_COLUMN_RULE_STYLE_INSET = CSS_BORDER_STYLE_INSET, |
CSS_COLUMN_RULE_STYLE_OUTSET = CSS_BORDER_STYLE_OUTSET |
}; |
enum css_column_rule_width_e { |
CSS_COLUMN_RULE_WIDTH_INHERIT = CSS_BORDER_WIDTH_INHERIT, |
CSS_COLUMN_RULE_WIDTH_THIN = CSS_BORDER_WIDTH_THIN, |
CSS_COLUMN_RULE_WIDTH_MEDIUM = CSS_BORDER_WIDTH_MEDIUM, |
CSS_COLUMN_RULE_WIDTH_THICK = CSS_BORDER_WIDTH_THICK, |
CSS_COLUMN_RULE_WIDTH_WIDTH = CSS_BORDER_WIDTH_WIDTH |
}; |
enum css_column_span_e { |
CSS_COLUMN_SPAN_INHERIT = 0x0, |
CSS_COLUMN_SPAN_NONE = 0x1, |
CSS_COLUMN_SPAN_ALL = 0x2 |
}; |
enum css_column_width_e { |
CSS_COLUMN_WIDTH_INHERIT = 0x0, |
CSS_COLUMN_WIDTH_AUTO = 0x1, |
CSS_COLUMN_WIDTH_SET = 0x2 |
}; |
enum css_content_e { |
CSS_CONTENT_INHERIT = 0x0, |
CSS_CONTENT_NONE = 0x1, |
CSS_CONTENT_NORMAL = 0x2, |
CSS_CONTENT_SET = 0x3 |
}; |
enum css_counter_increment_e { |
CSS_COUNTER_INCREMENT_INHERIT = 0x0, |
/* Consult pointer in struct to determine which */ |
CSS_COUNTER_INCREMENT_NAMED = 0x1, |
CSS_COUNTER_INCREMENT_NONE = 0x1 |
}; |
enum css_counter_reset_e { |
CSS_COUNTER_RESET_INHERIT = 0x0, |
/* Consult pointer in struct to determine which */ |
CSS_COUNTER_RESET_NAMED = 0x1, |
CSS_COUNTER_RESET_NONE = 0x1 |
}; |
enum css_cursor_e { |
CSS_CURSOR_INHERIT = 0x00, |
/* URLs exist if pointer is non-NULL */ |
CSS_CURSOR_AUTO = 0x01, |
CSS_CURSOR_CROSSHAIR = 0x02, |
CSS_CURSOR_DEFAULT = 0x03, |
CSS_CURSOR_POINTER = 0x04, |
CSS_CURSOR_MOVE = 0x05, |
CSS_CURSOR_E_RESIZE = 0x06, |
CSS_CURSOR_NE_RESIZE = 0x07, |
CSS_CURSOR_NW_RESIZE = 0x08, |
CSS_CURSOR_N_RESIZE = 0x09, |
CSS_CURSOR_SE_RESIZE = 0x0a, |
CSS_CURSOR_SW_RESIZE = 0x0b, |
CSS_CURSOR_S_RESIZE = 0x0c, |
CSS_CURSOR_W_RESIZE = 0x0d, |
CSS_CURSOR_TEXT = 0x0e, |
CSS_CURSOR_WAIT = 0x0f, |
CSS_CURSOR_HELP = 0x10, |
CSS_CURSOR_PROGRESS = 0x11 |
}; |
enum css_direction_e { |
CSS_DIRECTION_INHERIT = 0x0, |
CSS_DIRECTION_LTR = 0x1, |
CSS_DIRECTION_RTL = 0x2 |
}; |
enum css_display_e { |
CSS_DISPLAY_INHERIT = 0x00, |
CSS_DISPLAY_INLINE = 0x01, |
CSS_DISPLAY_BLOCK = 0x02, |
CSS_DISPLAY_LIST_ITEM = 0x03, |
CSS_DISPLAY_RUN_IN = 0x04, |
CSS_DISPLAY_INLINE_BLOCK = 0x05, |
CSS_DISPLAY_TABLE = 0x06, |
CSS_DISPLAY_INLINE_TABLE = 0x07, |
CSS_DISPLAY_TABLE_ROW_GROUP = 0x08, |
CSS_DISPLAY_TABLE_HEADER_GROUP = 0x09, |
CSS_DISPLAY_TABLE_FOOTER_GROUP = 0x0a, |
CSS_DISPLAY_TABLE_ROW = 0x0b, |
CSS_DISPLAY_TABLE_COLUMN_GROUP = 0x0c, |
CSS_DISPLAY_TABLE_COLUMN = 0x0d, |
CSS_DISPLAY_TABLE_CELL = 0x0e, |
CSS_DISPLAY_TABLE_CAPTION = 0x0f, |
CSS_DISPLAY_NONE = 0x10 |
}; |
enum css_empty_cells_e { |
CSS_EMPTY_CELLS_INHERIT = 0x0, |
CSS_EMPTY_CELLS_SHOW = 0x1, |
CSS_EMPTY_CELLS_HIDE = 0x2 |
}; |
enum css_float_e { |
CSS_FLOAT_INHERIT = 0x0, |
CSS_FLOAT_LEFT = 0x1, |
CSS_FLOAT_RIGHT = 0x2, |
CSS_FLOAT_NONE = 0x3 |
}; |
enum css_font_family_e { |
CSS_FONT_FAMILY_INHERIT = 0x0, |
/* Named fonts exist if pointer is non-NULL */ |
CSS_FONT_FAMILY_SERIF = 0x1, |
CSS_FONT_FAMILY_SANS_SERIF = 0x2, |
CSS_FONT_FAMILY_CURSIVE = 0x3, |
CSS_FONT_FAMILY_FANTASY = 0x4, |
CSS_FONT_FAMILY_MONOSPACE = 0x5 |
}; |
enum css_font_size_e { |
CSS_FONT_SIZE_INHERIT = 0x0, |
CSS_FONT_SIZE_XX_SMALL = 0x1, |
CSS_FONT_SIZE_X_SMALL = 0x2, |
CSS_FONT_SIZE_SMALL = 0x3, |
CSS_FONT_SIZE_MEDIUM = 0x4, |
CSS_FONT_SIZE_LARGE = 0x5, |
CSS_FONT_SIZE_X_LARGE = 0x6, |
CSS_FONT_SIZE_XX_LARGE = 0x7, |
CSS_FONT_SIZE_LARGER = 0x8, |
CSS_FONT_SIZE_SMALLER = 0x9, |
CSS_FONT_SIZE_DIMENSION = 0xa |
}; |
enum css_font_style_e { |
CSS_FONT_STYLE_INHERIT = 0x0, |
CSS_FONT_STYLE_NORMAL = 0x1, |
CSS_FONT_STYLE_ITALIC = 0x2, |
CSS_FONT_STYLE_OBLIQUE = 0x3 |
}; |
enum css_font_variant_e { |
CSS_FONT_VARIANT_INHERIT = 0x0, |
CSS_FONT_VARIANT_NORMAL = 0x1, |
CSS_FONT_VARIANT_SMALL_CAPS = 0x2 |
}; |
enum css_font_weight_e { |
CSS_FONT_WEIGHT_INHERIT = 0x0, |
CSS_FONT_WEIGHT_NORMAL = 0x1, |
CSS_FONT_WEIGHT_BOLD = 0x2, |
CSS_FONT_WEIGHT_BOLDER = 0x3, |
CSS_FONT_WEIGHT_LIGHTER = 0x4, |
CSS_FONT_WEIGHT_100 = 0x5, |
CSS_FONT_WEIGHT_200 = 0x6, |
CSS_FONT_WEIGHT_300 = 0x7, |
CSS_FONT_WEIGHT_400 = 0x8, |
CSS_FONT_WEIGHT_500 = 0x9, |
CSS_FONT_WEIGHT_600 = 0xa, |
CSS_FONT_WEIGHT_700 = 0xb, |
CSS_FONT_WEIGHT_800 = 0xc, |
CSS_FONT_WEIGHT_900 = 0xd |
}; |
enum css_height_e { |
CSS_HEIGHT_INHERIT = 0x0, |
CSS_HEIGHT_SET = 0x1, |
CSS_HEIGHT_AUTO = 0x2 |
}; |
enum css_left_e { |
CSS_LEFT_INHERIT = 0x0, |
CSS_LEFT_SET = 0x1, |
CSS_LEFT_AUTO = 0x2 |
}; |
enum css_letter_spacing_e { |
CSS_LETTER_SPACING_INHERIT = 0x0, |
CSS_LETTER_SPACING_SET = 0x1, |
CSS_LETTER_SPACING_NORMAL = 0x2 |
}; |
enum css_line_height_e { |
CSS_LINE_HEIGHT_INHERIT = 0x0, |
CSS_LINE_HEIGHT_NUMBER = 0x1, |
CSS_LINE_HEIGHT_DIMENSION = 0x2, |
CSS_LINE_HEIGHT_NORMAL = 0x3 |
}; |
enum css_list_style_image_e { |
CSS_LIST_STYLE_IMAGE_INHERIT = 0x0, |
/* Consult pointer in struct to determine which */ |
CSS_LIST_STYLE_IMAGE_URI = 0x1, |
CSS_LIST_STYLE_IMAGE_NONE = 0x1 |
}; |
enum css_list_style_position_e { |
CSS_LIST_STYLE_POSITION_INHERIT = 0x0, |
CSS_LIST_STYLE_POSITION_INSIDE = 0x1, |
CSS_LIST_STYLE_POSITION_OUTSIDE = 0x2 |
}; |
enum css_list_style_type_e { |
CSS_LIST_STYLE_TYPE_INHERIT = 0x0, |
CSS_LIST_STYLE_TYPE_DISC = 0x1, |
CSS_LIST_STYLE_TYPE_CIRCLE = 0x2, |
CSS_LIST_STYLE_TYPE_SQUARE = 0x3, |
CSS_LIST_STYLE_TYPE_DECIMAL = 0x4, |
CSS_LIST_STYLE_TYPE_DECIMAL_LEADING_ZERO= 0x5, |
CSS_LIST_STYLE_TYPE_LOWER_ROMAN = 0x6, |
CSS_LIST_STYLE_TYPE_UPPER_ROMAN = 0x7, |
CSS_LIST_STYLE_TYPE_LOWER_GREEK = 0x8, |
CSS_LIST_STYLE_TYPE_LOWER_LATIN = 0x9, |
CSS_LIST_STYLE_TYPE_UPPER_LATIN = 0xa, |
CSS_LIST_STYLE_TYPE_ARMENIAN = 0xb, |
CSS_LIST_STYLE_TYPE_GEORGIAN = 0xc, |
CSS_LIST_STYLE_TYPE_LOWER_ALPHA = 0xd, |
CSS_LIST_STYLE_TYPE_UPPER_ALPHA = 0xe, |
CSS_LIST_STYLE_TYPE_NONE = 0xf |
}; |
enum css_margin_e { |
CSS_MARGIN_INHERIT = 0x0, |
CSS_MARGIN_SET = 0x1, |
CSS_MARGIN_AUTO = 0x2 |
}; |
enum css_max_height_e { |
CSS_MAX_HEIGHT_INHERIT = 0x0, |
CSS_MAX_HEIGHT_SET = 0x1, |
CSS_MAX_HEIGHT_NONE = 0x2 |
}; |
enum css_max_width_e { |
CSS_MAX_WIDTH_INHERIT = 0x0, |
CSS_MAX_WIDTH_SET = 0x1, |
CSS_MAX_WIDTH_NONE = 0x2 |
}; |
enum css_min_height_e { |
CSS_MIN_HEIGHT_INHERIT = 0x0, |
CSS_MIN_HEIGHT_SET = 0x1 |
}; |
enum css_min_width_e { |
CSS_MIN_WIDTH_INHERIT = 0x0, |
CSS_MIN_WIDTH_SET = 0x1 |
}; |
enum css_opacity_e { |
CSS_OPACITY_INHERIT = 0x0, |
CSS_OPACITY_SET = 0x1 |
}; |
enum css_outline_color_e { |
CSS_OUTLINE_COLOR_INHERIT = CSS_BACKGROUND_COLOR_INHERIT, |
CSS_OUTLINE_COLOR_COLOR = CSS_BACKGROUND_COLOR_COLOR, |
CSS_OUTLINE_COLOR_CURRENT_COLOR = CSS_BACKGROUND_COLOR_CURRENT_COLOR, |
CSS_OUTLINE_COLOR_INVERT = 0x3 |
}; |
enum css_outline_style_e { |
CSS_OUTLINE_STYLE_INHERIT = CSS_BORDER_STYLE_INHERIT, |
CSS_OUTLINE_STYLE_NONE = CSS_BORDER_STYLE_NONE, |
CSS_OUTLINE_STYLE_DOTTED = CSS_BORDER_STYLE_DOTTED, |
CSS_OUTLINE_STYLE_DASHED = CSS_BORDER_STYLE_DASHED, |
CSS_OUTLINE_STYLE_SOLID = CSS_BORDER_STYLE_SOLID, |
CSS_OUTLINE_STYLE_DOUBLE = CSS_BORDER_STYLE_DOUBLE, |
CSS_OUTLINE_STYLE_GROOVE = CSS_BORDER_STYLE_GROOVE, |
CSS_OUTLINE_STYLE_RIDGE = CSS_BORDER_STYLE_RIDGE, |
CSS_OUTLINE_STYLE_INSET = CSS_BORDER_STYLE_INSET, |
CSS_OUTLINE_STYLE_OUTSET = CSS_BORDER_STYLE_OUTSET |
}; |
enum css_outline_width_e { |
CSS_OUTLINE_WIDTH_INHERIT = CSS_BORDER_WIDTH_INHERIT, |
CSS_OUTLINE_WIDTH_THIN = CSS_BORDER_WIDTH_THIN, |
CSS_OUTLINE_WIDTH_MEDIUM = CSS_BORDER_WIDTH_MEDIUM, |
CSS_OUTLINE_WIDTH_THICK = CSS_BORDER_WIDTH_THICK, |
CSS_OUTLINE_WIDTH_WIDTH = CSS_BORDER_WIDTH_WIDTH |
}; |
enum css_overflow_e { |
CSS_OVERFLOW_INHERIT = 0x0, |
CSS_OVERFLOW_VISIBLE = 0x1, |
CSS_OVERFLOW_HIDDEN = 0x2, |
CSS_OVERFLOW_SCROLL = 0x3, |
CSS_OVERFLOW_AUTO = 0x4 |
}; |
enum css_orphans_e { |
CSS_ORPHANS_INHERIT = 0x0, |
CSS_ORPHANS_SET = 0x1 |
}; |
enum css_padding_e { |
CSS_PADDING_INHERIT = 0x0, |
CSS_PADDING_SET = 0x1 |
}; |
enum css_page_break_after_e { |
CSS_PAGE_BREAK_AFTER_INHERIT = CSS_BREAK_AFTER_INHERIT, |
CSS_PAGE_BREAK_AFTER_AUTO = CSS_BREAK_AFTER_AUTO, |
CSS_PAGE_BREAK_AFTER_AVOID = CSS_BREAK_AFTER_AVOID, |
CSS_PAGE_BREAK_AFTER_ALWAYS = CSS_BREAK_AFTER_ALWAYS, |
CSS_PAGE_BREAK_AFTER_LEFT = CSS_BREAK_AFTER_LEFT, |
CSS_PAGE_BREAK_AFTER_RIGHT = CSS_BREAK_AFTER_RIGHT |
}; |
enum css_page_break_before_e { |
CSS_PAGE_BREAK_BEFORE_INHERIT = CSS_BREAK_AFTER_INHERIT, |
CSS_PAGE_BREAK_BEFORE_AUTO = CSS_BREAK_AFTER_AUTO, |
CSS_PAGE_BREAK_BEFORE_AVOID = CSS_BREAK_AFTER_AVOID, |
CSS_PAGE_BREAK_BEFORE_ALWAYS = CSS_BREAK_AFTER_ALWAYS, |
CSS_PAGE_BREAK_BEFORE_LEFT = CSS_BREAK_AFTER_LEFT, |
CSS_PAGE_BREAK_BEFORE_RIGHT = CSS_BREAK_AFTER_RIGHT |
}; |
enum css_page_break_inside_e { |
CSS_PAGE_BREAK_INSIDE_INHERIT = CSS_BREAK_AFTER_INHERIT, |
CSS_PAGE_BREAK_INSIDE_AUTO = CSS_BREAK_AFTER_AUTO, |
CSS_PAGE_BREAK_INSIDE_AVOID = CSS_BREAK_AFTER_AVOID |
}; |
enum css_position_e { |
CSS_POSITION_INHERIT = 0x0, |
CSS_POSITION_STATIC = 0x1, |
CSS_POSITION_RELATIVE = 0x2, |
CSS_POSITION_ABSOLUTE = 0x3, |
CSS_POSITION_FIXED = 0x4 |
}; |
enum css_quotes_e { |
CSS_QUOTES_INHERIT = 0x0, |
/* Consult pointer in struct to determine which */ |
CSS_QUOTES_STRING = 0x1, |
CSS_QUOTES_NONE = 0x1 |
}; |
enum css_right_e { |
CSS_RIGHT_INHERIT = 0x0, |
CSS_RIGHT_SET = 0x1, |
CSS_RIGHT_AUTO = 0x2 |
}; |
enum css_table_layout_e { |
CSS_TABLE_LAYOUT_INHERIT = 0x0, |
CSS_TABLE_LAYOUT_AUTO = 0x1, |
CSS_TABLE_LAYOUT_FIXED = 0x2 |
}; |
enum css_text_align_e { |
CSS_TEXT_ALIGN_INHERIT = 0x0, |
CSS_TEXT_ALIGN_INHERIT_IF_NON_MAGIC = 0x1, |
CSS_TEXT_ALIGN_LEFT = 0x2, |
CSS_TEXT_ALIGN_RIGHT = 0x3, |
CSS_TEXT_ALIGN_CENTER = 0x4, |
CSS_TEXT_ALIGN_JUSTIFY = 0x5, |
CSS_TEXT_ALIGN_DEFAULT = 0x6, |
CSS_TEXT_ALIGN_LIBCSS_LEFT = 0x7, |
CSS_TEXT_ALIGN_LIBCSS_CENTER = 0x8, |
CSS_TEXT_ALIGN_LIBCSS_RIGHT = 0x9 |
}; |
enum css_text_decoration_e { |
CSS_TEXT_DECORATION_INHERIT = 0x00, |
CSS_TEXT_DECORATION_NONE = 0x10, |
CSS_TEXT_DECORATION_BLINK = (1<<3), |
CSS_TEXT_DECORATION_LINE_THROUGH = (1<<2), |
CSS_TEXT_DECORATION_OVERLINE = (1<<1), |
CSS_TEXT_DECORATION_UNDERLINE = (1<<0) |
}; |
enum css_text_indent_e { |
CSS_TEXT_INDENT_INHERIT = 0x0, |
CSS_TEXT_INDENT_SET = 0x1 |
}; |
enum css_text_transform_e { |
CSS_TEXT_TRANSFORM_INHERIT = 0x0, |
CSS_TEXT_TRANSFORM_CAPITALIZE = 0x1, |
CSS_TEXT_TRANSFORM_UPPERCASE = 0x2, |
CSS_TEXT_TRANSFORM_LOWERCASE = 0x3, |
CSS_TEXT_TRANSFORM_NONE = 0x4 |
}; |
enum css_top_e { |
CSS_TOP_INHERIT = 0x0, |
CSS_TOP_SET = 0x1, |
CSS_TOP_AUTO = 0x2 |
}; |
enum css_unicode_bidi_e { |
CSS_UNICODE_BIDI_INHERIT = 0x0, |
CSS_UNICODE_BIDI_NORMAL = 0x1, |
CSS_UNICODE_BIDI_EMBED = 0x2, |
CSS_UNICODE_BIDI_BIDI_OVERRIDE = 0x3 |
}; |
enum css_vertical_align_e { |
CSS_VERTICAL_ALIGN_INHERIT = 0x0, |
CSS_VERTICAL_ALIGN_BASELINE = 0x1, |
CSS_VERTICAL_ALIGN_SUB = 0x2, |
CSS_VERTICAL_ALIGN_SUPER = 0x3, |
CSS_VERTICAL_ALIGN_TOP = 0x4, |
CSS_VERTICAL_ALIGN_TEXT_TOP = 0x5, |
CSS_VERTICAL_ALIGN_MIDDLE = 0x6, |
CSS_VERTICAL_ALIGN_BOTTOM = 0x7, |
CSS_VERTICAL_ALIGN_TEXT_BOTTOM = 0x8, |
CSS_VERTICAL_ALIGN_SET = 0x9 |
}; |
enum css_visibility_e { |
CSS_VISIBILITY_INHERIT = 0x0, |
CSS_VISIBILITY_VISIBLE = 0x1, |
CSS_VISIBILITY_HIDDEN = 0x2, |
CSS_VISIBILITY_COLLAPSE = 0x3 |
}; |
enum css_white_space_e { |
CSS_WHITE_SPACE_INHERIT = 0x0, |
CSS_WHITE_SPACE_NORMAL = 0x1, |
CSS_WHITE_SPACE_PRE = 0x2, |
CSS_WHITE_SPACE_NOWRAP = 0x3, |
CSS_WHITE_SPACE_PRE_WRAP = 0x4, |
CSS_WHITE_SPACE_PRE_LINE = 0x5 |
}; |
enum css_widows_e { |
CSS_WIDOWS_INHERIT = 0x0, |
CSS_WIDOWS_SET = 0x1 |
}; |
enum css_width_e { |
CSS_WIDTH_INHERIT = 0x0, |
CSS_WIDTH_SET = 0x1, |
CSS_WIDTH_AUTO = 0x2 |
}; |
enum css_word_spacing_e { |
CSS_WORD_SPACING_INHERIT = 0x0, |
CSS_WORD_SPACING_SET = 0x1, |
CSS_WORD_SPACING_NORMAL = 0x2 |
}; |
enum css_z_index_e { |
CSS_Z_INDEX_INHERIT = 0x0, |
CSS_Z_INDEX_SET = 0x1, |
CSS_Z_INDEX_AUTO = 0x2 |
}; |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/libcss/select.h |
---|
0,0 → 1,180 |
/* |
* This file is part of LibCSS |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef libcss_select_h_ |
#define libcss_select_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <libcss/errors.h> |
#include <libcss/functypes.h> |
#include <libcss/hint.h> |
#include <libcss/types.h> |
#include <libcss/computed.h> |
typedef enum css_pseudo_element { |
CSS_PSEUDO_ELEMENT_NONE = 0, |
CSS_PSEUDO_ELEMENT_FIRST_LINE = 1, |
CSS_PSEUDO_ELEMENT_FIRST_LETTER = 2, |
CSS_PSEUDO_ELEMENT_BEFORE = 3, |
CSS_PSEUDO_ELEMENT_AFTER = 4, |
CSS_PSEUDO_ELEMENT_COUNT = 5 /**< Number of pseudo elements */ |
} css_pseudo_element; |
/** |
* Style selection result set |
*/ |
typedef struct css_select_results { |
css_allocator_fn alloc; |
void *pw; |
/** |
* Array of pointers to computed styles, |
* indexed by css_pseudo_element. If there |
* was no styling for a given pseudo element, |
* then no computed style will be created and |
* the corresponding pointer will be set to NULL |
*/ |
css_computed_style *styles[CSS_PSEUDO_ELEMENT_COUNT]; |
} css_select_results; |
typedef enum css_select_handler_version { |
CSS_SELECT_HANDLER_VERSION_1 = 1 |
} css_select_handler_version; |
typedef struct css_select_handler { |
/** ABI version of this structure */ |
uint32_t handler_version; |
css_error (*node_name)(void *pw, void *node, |
css_qname *qname); |
css_error (*node_classes)(void *pw, void *node, |
lwc_string ***classes, |
uint32_t *n_classes); |
css_error (*node_id)(void *pw, void *node, |
lwc_string **id); |
css_error (*named_ancestor_node)(void *pw, void *node, |
const css_qname *qname, void **ancestor); |
css_error (*named_parent_node)(void *pw, void *node, |
const css_qname *qname, void **parent); |
css_error (*named_sibling_node)(void *pw, void *node, |
const css_qname *qname, void **sibling); |
css_error (*named_generic_sibling_node)(void *pw, void *node, |
const css_qname *qname, void **sibling); |
css_error (*parent_node)(void *pw, void *node, void **parent); |
css_error (*sibling_node)(void *pw, void *node, void **sibling); |
css_error (*node_has_name)(void *pw, void *node, |
const css_qname *qname, bool *match); |
css_error (*node_has_class)(void *pw, void *node, |
lwc_string *name, bool *match); |
css_error (*node_has_id)(void *pw, void *node, |
lwc_string *name, bool *match); |
css_error (*node_has_attribute)(void *pw, void *node, |
const css_qname *qname, bool *match); |
css_error (*node_has_attribute_equal)(void *pw, void *node, |
const css_qname *qname, lwc_string *value, |
bool *match); |
css_error (*node_has_attribute_dashmatch)(void *pw, void *node, |
const css_qname *qname, lwc_string *value, |
bool *match); |
css_error (*node_has_attribute_includes)(void *pw, void *node, |
const css_qname *qname, lwc_string *value, |
bool *match); |
css_error (*node_has_attribute_prefix)(void *pw, void *node, |
const css_qname *qname, lwc_string *value, |
bool *match); |
css_error (*node_has_attribute_suffix)(void *pw, void *node, |
const css_qname *qname, lwc_string *value, |
bool *match); |
css_error (*node_has_attribute_substring)(void *pw, void *node, |
const css_qname *qname, lwc_string *value, |
bool *match); |
css_error (*node_is_root)(void *pw, void *node, bool *match); |
css_error (*node_count_siblings)(void *pw, void *node, |
bool same_name, bool after, int32_t *count); |
css_error (*node_is_empty)(void *pw, void *node, bool *match); |
css_error (*node_is_link)(void *pw, void *node, bool *match); |
css_error (*node_is_visited)(void *pw, void *node, bool *match); |
css_error (*node_is_hover)(void *pw, void *node, bool *match); |
css_error (*node_is_active)(void *pw, void *node, bool *match); |
css_error (*node_is_focus)(void *pw, void *node, bool *match); |
css_error (*node_is_enabled)(void *pw, void *node, bool *match); |
css_error (*node_is_disabled)(void *pw, void *node, bool *match); |
css_error (*node_is_checked)(void *pw, void *node, bool *match); |
css_error (*node_is_target)(void *pw, void *node, bool *match); |
css_error (*node_is_lang)(void *pw, void *node, |
lwc_string *lang, bool *match); |
css_error (*node_presentational_hint)(void *pw, void *node, |
uint32_t property, css_hint *hint); |
css_error (*ua_default_for_property)(void *pw, uint32_t property, |
css_hint *hint); |
css_error (*compute_font_size)(void *pw, const css_hint *parent, |
css_hint *size); |
} css_select_handler; |
/** |
* Font face selection result set |
*/ |
typedef struct css_select_font_faces_results { |
css_allocator_fn alloc; |
void *pw; |
/** |
* Array of pointers to computed font faces. |
*/ |
css_font_face **font_faces; |
uint32_t n_font_faces; |
} css_select_font_faces_results; |
css_error css_select_ctx_create(css_allocator_fn alloc, void *pw, |
css_select_ctx **result); |
css_error css_select_ctx_destroy(css_select_ctx *ctx); |
css_error css_select_ctx_append_sheet(css_select_ctx *ctx, |
const css_stylesheet *sheet, |
css_origin origin, uint64_t media); |
css_error css_select_ctx_insert_sheet(css_select_ctx *ctx, |
const css_stylesheet *sheet, uint32_t index, |
css_origin origin, uint64_t media); |
css_error css_select_ctx_remove_sheet(css_select_ctx *ctx, |
const css_stylesheet *sheet); |
css_error css_select_ctx_count_sheets(css_select_ctx *ctx, uint32_t *count); |
css_error css_select_ctx_get_sheet(css_select_ctx *ctx, uint32_t index, |
const css_stylesheet **sheet); |
css_error css_select_style(css_select_ctx *ctx, void *node, |
uint64_t media, const css_stylesheet *inline_style, |
css_select_handler *handler, void *pw, |
css_select_results **result); |
css_error css_select_results_destroy(css_select_results *results); |
css_error css_select_font_faces(css_select_ctx *ctx, |
uint64_t media, lwc_string *font_family, |
css_select_font_faces_results **result); |
css_error css_select_font_faces_results_destroy( |
css_select_font_faces_results *results); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/libcss/stylesheet.h |
---|
0,0 → 1,170 |
/* |
* This file is part of LibCSS. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef libcss_stylesheet_h_ |
#define libcss_stylesheet_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <libcss/errors.h> |
#include <libcss/types.h> |
#include <libcss/properties.h> |
/** |
* Callback to resolve an URL |
* |
* \param pw Client data |
* \param dict String internment context |
* \param base Base URI (absolute) |
* \param rel URL to resolve, either absolute or relative to base |
* \param abs Pointer to location to receive result |
* \return CSS_OK on success, appropriate error otherwise. |
*/ |
typedef css_error (*css_url_resolution_fn)(void *pw, |
const char *base, lwc_string *rel, lwc_string **abs); |
/** |
* Callback to be notified of the need for an imported stylesheet |
* |
* \param pw Client data |
* \param parent Stylesheet requesting the import |
* \param url URL of the imported sheet |
* \param media Applicable media for the imported sheet |
* \return CSS_OK on success, appropriate error otherwise |
* |
* \note This function will be invoked for notification purposes |
* only. The client may use this to trigger a parallel fetch |
* of the imported stylesheet. The imported sheet must be |
* registered with its parent using the post-parse import |
* registration API. |
*/ |
typedef css_error (*css_import_notification_fn)(void *pw, |
css_stylesheet *parent, lwc_string *url, uint64_t media); |
/** |
* Callback use to resolve system colour names to RGB values |
* |
* \param pw Client data |
* \param name System colour name |
* \param color Pointer to location to receive color value |
* \return CSS_OK on success, |
* CSS_INVALID if the name is unknown. |
*/ |
typedef css_error (*css_color_resolution_fn)(void *pw, |
lwc_string *name, css_color *color); |
/** System font callback result data. */ |
typedef struct css_system_font { |
enum css_font_style_e style; |
enum css_font_variant_e variant; |
enum css_font_weight_e weight; |
struct { |
css_fixed size; |
css_unit unit; |
} size; |
struct { |
css_fixed size; |
css_unit unit; |
} line_height; |
/* Note: must be a single family name only */ |
lwc_string *family; |
} css_system_font; |
/** |
* Callback use to resolve system font names to font values |
* |
* \param pw Client data |
* \param name System font identifier |
* \param system_font Pointer to system font descriptor to be filled |
* \return CSS_OK on success, |
* CSS_INVALID if the name is unknown. |
*/ |
typedef css_error (*css_font_resolution_fn)(void *pw, |
lwc_string *name, css_system_font *system_font); |
typedef enum css_stylesheet_params_version { |
CSS_STYLESHEET_PARAMS_VERSION_1 = 1 |
} css_stylesheet_params_version; |
/** |
* Parameter block for css_stylesheet_create() |
*/ |
typedef struct css_stylesheet_params { |
/** ABI version of this structure */ |
uint32_t params_version; |
/** The language level of the stylesheet */ |
css_language_level level; |
/** The charset of the stylesheet data, or NULL to detect */ |
const char *charset; |
/** URL of stylesheet */ |
const char *url; |
/** Title of stylesheet */ |
const char *title; |
/** Permit quirky parsing of stylesheet */ |
bool allow_quirks; |
/** This stylesheet is an inline style */ |
bool inline_style; |
/** URL resolution function */ |
css_url_resolution_fn resolve; |
/** Client private data for resolve */ |
void *resolve_pw; |
/** Import notification function */ |
css_import_notification_fn import; |
/** Client private data for import */ |
void *import_pw; |
/** Colour resolution function */ |
css_color_resolution_fn color; |
/** Client private data for color */ |
void *color_pw; |
/** Font resolution function */ |
css_font_resolution_fn font; |
/** Client private data for font */ |
void *font_pw; |
} css_stylesheet_params; |
css_error css_stylesheet_create(const css_stylesheet_params *params, |
css_allocator_fn alloc, void *alloc_pw, |
css_stylesheet **stylesheet); |
css_error css_stylesheet_destroy(css_stylesheet *sheet); |
css_error css_stylesheet_append_data(css_stylesheet *sheet, |
const uint8_t *data, size_t len); |
css_error css_stylesheet_data_done(css_stylesheet *sheet); |
css_error css_stylesheet_next_pending_import(css_stylesheet *parent, |
lwc_string **url, uint64_t *media); |
css_error css_stylesheet_register_import(css_stylesheet *parent, |
css_stylesheet *child); |
css_error css_stylesheet_get_language_level(css_stylesheet *sheet, |
css_language_level *level); |
css_error css_stylesheet_get_url(css_stylesheet *sheet, const char **url); |
css_error css_stylesheet_get_title(css_stylesheet *sheet, const char **title); |
css_error css_stylesheet_quirks_allowed(css_stylesheet *sheet, bool *allowed); |
css_error css_stylesheet_used_quirks(css_stylesheet *sheet, bool *quirks); |
css_error css_stylesheet_get_disabled(css_stylesheet *sheet, bool *disabled); |
css_error css_stylesheet_set_disabled(css_stylesheet *sheet, bool disabled); |
css_error css_stylesheet_size(css_stylesheet *sheet, size_t *size); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/libcss/types.h |
---|
0,0 → 1,138 |
/* |
* This file is part of LibCSS. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef libcss_types_h_ |
#define libcss_types_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <stdbool.h> |
#include <stdint.h> |
#include <stdlib.h> |
#include <libwapcaplet/libwapcaplet.h> |
#include <libcss/fpmath.h> |
/** |
* Source of charset information, in order of importance. |
* A client-dictated charset will override all others. |
* A document-specified charset will override autodetection or the default. |
*/ |
typedef enum css_charset_source { |
CSS_CHARSET_DEFAULT = 0, /**< Default setting */ |
CSS_CHARSET_REFERRED = 1, /**< From referring document */ |
CSS_CHARSET_METADATA = 2, /**< From linking metadata */ |
CSS_CHARSET_DOCUMENT = 3, /**< Defined in document */ |
CSS_CHARSET_DICTATED = 4 /**< Dictated by client */ |
} css_charset_source; |
/** |
* Stylesheet language level -- defines parsing rules and supported properties |
*/ |
typedef enum css_language_level { |
CSS_LEVEL_1 = 0, /**< CSS 1 */ |
CSS_LEVEL_2 = 1, /**< CSS 2 */ |
CSS_LEVEL_21 = 2, /**< CSS 2.1 */ |
CSS_LEVEL_3 = 3, /**< CSS 3 */ |
CSS_LEVEL_DEFAULT = CSS_LEVEL_21 /**< Default level */ |
} css_language_level; |
/** |
* Stylesheet media types |
*/ |
typedef enum css_media_type { |
CSS_MEDIA_AURAL = (1 << 0), |
CSS_MEDIA_BRAILLE = (1 << 1), |
CSS_MEDIA_EMBOSSED = (1 << 2), |
CSS_MEDIA_HANDHELD = (1 << 3), |
CSS_MEDIA_PRINT = (1 << 4), |
CSS_MEDIA_PROJECTION = (1 << 5), |
CSS_MEDIA_SCREEN = (1 << 6), |
CSS_MEDIA_SPEECH = (1 << 7), |
CSS_MEDIA_TTY = (1 << 8), |
CSS_MEDIA_TV = (1 << 9), |
CSS_MEDIA_ALL = CSS_MEDIA_AURAL | CSS_MEDIA_BRAILLE | |
CSS_MEDIA_EMBOSSED | CSS_MEDIA_HANDHELD | |
CSS_MEDIA_PRINT | CSS_MEDIA_PROJECTION | |
CSS_MEDIA_SCREEN | CSS_MEDIA_SPEECH | |
CSS_MEDIA_TTY | CSS_MEDIA_TV |
} css_media_type; |
/** |
* Stylesheet origin |
*/ |
typedef enum css_origin { |
CSS_ORIGIN_UA = 0, /**< User agent stylesheet */ |
CSS_ORIGIN_USER = 1, /**< User stylesheet */ |
CSS_ORIGIN_AUTHOR = 2 /**< Author stylesheet */ |
} css_origin; |
/** CSS colour -- AARRGGBB */ |
typedef uint32_t css_color; |
/* CSS unit */ |
typedef enum css_unit { |
CSS_UNIT_PX = 0x0, |
CSS_UNIT_EX = 0x1, |
CSS_UNIT_EM = 0x2, |
CSS_UNIT_IN = 0x3, |
CSS_UNIT_CM = 0x4, |
CSS_UNIT_MM = 0x5, |
CSS_UNIT_PT = 0x6, |
CSS_UNIT_PC = 0x7, |
CSS_UNIT_PCT = 0x8, /* Percentage */ |
CSS_UNIT_DEG = 0x9, |
CSS_UNIT_GRAD = 0xa, |
CSS_UNIT_RAD = 0xb, |
CSS_UNIT_MS = 0xc, |
CSS_UNIT_S = 0xd, |
CSS_UNIT_HZ = 0xe, |
CSS_UNIT_KHZ = 0xf |
} css_unit; |
/** |
* Type of a qualified name |
*/ |
typedef struct css_qname { |
/** |
* Namespace URI: |
* |
* NULL for no namespace |
* '*' for any namespace (including none) |
* URI for a specific namespace |
*/ |
lwc_string *ns; |
/** |
* Local part of qualified name |
*/ |
lwc_string *name; |
} css_qname; |
typedef struct css_stylesheet css_stylesheet; |
typedef struct css_select_ctx css_select_ctx; |
typedef struct css_computed_style css_computed_style; |
typedef struct css_font_face css_font_face; |
typedef struct css_font_face_src css_font_face_src; |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/libwapcaplet/libwapcaplet.h |
---|
0,0 → 1,254 |
/* libwapcaplet.h |
* |
* String internment and management tools. |
* |
* Copyright 2009 The NetSurf Browser Project. |
* Daniel Silverstone <dsilvers@netsurf-browser.org> |
*/ |
#ifndef libwapcaplet_h_ |
#define libwapcaplet_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <sys/types.h> |
#include <stdbool.h> |
#include <stdint.h> |
/** |
* The type of a reference counter used in libwapcaplet. |
*/ |
typedef uint32_t lwc_refcounter; |
/** |
* The type of a hash value used in libwapcaplet. |
*/ |
typedef uint32_t lwc_hash; |
/** |
* An interned string. |
* |
* NOTE: The contents of this struct are considered *PRIVATE* and may |
* change in future revisions. Do not rely on them whatsoever. |
* They're only here at all so that the ref, unref and matches etc can |
* use them. |
*/ |
typedef struct lwc_string_s { |
struct lwc_string_s ** prevptr; |
struct lwc_string_s * next; |
size_t len; |
lwc_hash hash; |
lwc_refcounter refcnt; |
struct lwc_string_s * insensitive; |
} lwc_string; |
/** |
* String iteration function |
* |
* @param str A string which has been interned. |
* @param pw The private pointer for the allocator. |
*/ |
typedef void (*lwc_iteration_callback_fn)(lwc_string *str, void *pw); |
/** |
* Result codes which libwapcaplet might return. |
*/ |
typedef enum lwc_error_e { |
lwc_error_ok = 0, /**< No error. */ |
lwc_error_oom = 1, /**< Out of memory. */ |
lwc_error_range = 2 /**< Substring internment out of range. */ |
} lwc_error; |
/** |
* Intern a string. |
* |
* Take a copy of the string data referred to by \a s and \a slen and |
* intern it. The resulting ::lwc_string can be used for simple and |
* caseless comparisons by ::lwc_string_isequal and |
* ::lwc_string_caseless_isequal respectively. |
* |
* @param s Pointer to the start of the string to intern. |
* @param slen Length of the string in characters. (Not including any |
* terminators) |
* @param ret Pointer to ::lwc_string pointer to fill out. |
* @return Result of operation, if not OK then the value pointed |
* to by \a ret will not be valid. |
* |
* @note The memory pointed to by \a s is not referenced by the result. |
* @note If the string was already present, its reference count is |
* incremented rather than allocating more memory. |
* |
* @note The returned string is currently NULL-terminated but this |
* will not necessarily be the case in future. Try not to rely |
* on it. |
*/ |
extern lwc_error lwc_intern_string(const char *s, size_t slen, |
lwc_string **ret); |
/** |
* Intern a substring. |
* |
* Intern a subsequence of the provided ::lwc_string. |
* |
* @param str String to acquire substring from. |
* @param ssoffset Substring offset into \a str. |
* @param sslen Substring length. |
* @param ret Pointer to pointer to ::lwc_string to fill out. |
* @return Result of operation, if not OK then the value |
* pointed to by \a ret will not be valid. |
*/ |
extern lwc_error lwc_intern_substring(lwc_string *str, |
size_t ssoffset, size_t sslen, |
lwc_string **ret); |
/** |
* Increment the reference count on an lwc_string. |
* |
* This increases the reference count on the given string. You should |
* use this when copying a string pointer into a persistent data |
* structure. |
* |
* @verb |
* myobject->str = lwc_string_ref(myparent->str); |
* @endverb |
* |
* @param str The string to create another reference to. |
* @return The string pointer to use in your new data structure. |
* |
* @note Use this if copying the string and intending both sides to retain |
* ownership. |
*/ |
#define lwc_string_ref(str) ({lwc_string *__lwc_s = (str); __lwc_s->refcnt++; __lwc_s;}) |
/** |
* Release a reference on an lwc_string. |
* |
* This decreases the reference count on the given ::lwc_string. |
* |
* @param str The string to unref. |
* |
* @note If the reference count reaches zero then the string will be |
* freed. (Ref count of 1 where string is its own insensitve match |
* will also result in the string being freed.) |
*/ |
#define lwc_string_unref(str) { \ |
lwc_string *__lwc_s = (str); \ |
__lwc_s->refcnt--; \ |
if ((__lwc_s->refcnt == 0) || \ |
((__lwc_s->refcnt == 1) && (__lwc_s->insensitive == __lwc_s))) \ |
lwc_string_destroy(__lwc_s); \ |
} |
/** |
* Destroy an unreffed lwc_string. |
* |
* This destroys an lwc_string whose reference count indicates that it should be. |
* |
* @param str The string to unref. |
*/ |
extern void lwc_string_destroy(lwc_string *str); |
/** |
* Check if two interned strings are equal. |
* |
* @param str1 The first string in the comparison. |
* @param str2 The second string in the comparison. |
* @param ret A pointer to a boolean to be filled out with the result. |
* @return Result of operation, if not ok then value pointed to |
* by \a ret will not be valid. |
*/ |
#define lwc_string_isequal(str1, str2, ret) \ |
((*(ret) = ((str1) == (str2))), lwc_error_ok) |
/** |
* Check if two interned strings are case-insensitively equal. |
* |
* @param str1 The first string in the comparison. |
* @param str2 The second string in the comparison. |
* @param ret A pointer to a boolean to be filled out with the result. |
* @return Result of operation, if not ok then value pointed to |
* by \a ret will not be valid. |
*/ |
#define lwc_string_caseless_isequal(_str1,_str2,_ret) ({ \ |
lwc_error __lwc_err = lwc_error_ok; \ |
lwc_string *__lwc_str1 = (_str1); \ |
lwc_string *__lwc_str2 = (_str2); \ |
bool *__lwc_ret = (_ret); \ |
\ |
if (__lwc_str1->insensitive == NULL) { \ |
__lwc_err = lwc__intern_caseless_string(__lwc_str1); \ |
} \ |
if (__lwc_err == lwc_error_ok && __lwc_str2->insensitive == NULL) { \ |
__lwc_err = lwc__intern_caseless_string(__lwc_str2); \ |
} \ |
if (__lwc_err == lwc_error_ok) \ |
*__lwc_ret = (__lwc_str1->insensitive == __lwc_str2->insensitive); \ |
__lwc_err; \ |
}) |
/** |
* Intern a caseless copy of the passed string. |
* |
* @param str The string to intern the caseless copy of. |
* |
* @return lwc_error_ok if successful, otherwise the |
* error code describing the issue., |
* |
* @note This is for "internal" use by the caseless comparison |
* macro and not for users. |
*/ |
extern lwc_error |
lwc__intern_caseless_string(lwc_string *str); |
/** |
* Retrieve the data pointer for an interned string. |
* |
* @param str The string to retrieve the data pointer for. |
* @return The C string data pointer for \a str. |
* |
* @note The data we point at belongs to the string and will |
* die with the string. Keep a ref if you need it. |
* @note You may not rely on the NULL termination of the strings |
* in future. Any code relying on it currently should be |
* modified to use ::lwc_string_length if possible. |
*/ |
#define lwc_string_data(str) ((const char *)((str)+1)) |
/** |
* Retrieve the data length for an interned string. |
* |
* @param str The string to retrieve the length of. |
* @return The length of \a str. |
*/ |
#define lwc_string_length(str) ((str)->len) |
/** |
* Retrieve (or compute if unavailable) a hash value for the content of the string. |
* |
* @param str The string to get the hash for. |
* @return The 32 bit hash of \a str. |
* |
* @note This API should only be used as a convenient way to retrieve a hash |
* value for the string. This hash value should not be relied on to be |
* unique within an invocation of the program, nor should it be relied upon |
* to be stable between invocations of the program. Never use the hash |
* value as a way to directly identify the value of the string. |
*/ |
#define lwc_string_hash_value(str) ((str)->hash) |
/** |
* Iterate the context and return every string in it. |
* |
* @param cb The callback to give the string to. |
* @param pw The private word for the callback. |
*/ |
extern void lwc_iterate_strings(lwc_iteration_callback_fn cb, void *pw); |
#ifdef __cplusplus |
} |
#endif |
#endif /* libwapcaplet_h_ */ |
/contrib/network/netsurf/include/parserutils/charset/codec.h |
---|
0,0 → 1,125 |
/* |
* This file is part of LibParserUtils. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef parserutils_charset_codec_h_ |
#define parserutils_charset_codec_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <inttypes.h> |
#include <parserutils/errors.h> |
#include <parserutils/functypes.h> |
typedef struct parserutils_charset_codec parserutils_charset_codec; |
#define PARSERUTILS_CHARSET_CODEC_NULL (0xffffffffU) |
/** |
* Charset codec error mode |
* |
* A codec's error mode determines its behaviour in the face of: |
* |
* + characters which are unrepresentable in the destination charset (if |
* encoding data) or which cannot be converted to UCS-4 (if decoding data). |
* + invalid byte sequences (both encoding and decoding) |
* |
* The options provide a choice between the following approaches: |
* |
* + draconian, "stop processing" ("strict") |
* + "replace the unrepresentable character with something else" ("loose") |
* + "attempt to transliterate, or replace if unable" ("translit") |
* |
* The default error mode is "loose". |
* |
* |
* In the "loose" case, the replacement character will depend upon: |
* |
* + Whether the operation was encoding or decoding |
* + If encoding, what the destination charset is. |
* |
* If decoding, the replacement character will be: |
* |
* U+FFFD (REPLACEMENT CHARACTER) |
* |
* If encoding, the replacement character will be: |
* |
* U+003F (QUESTION MARK) if the destination charset is not UTF-(8|16|32) |
* U+FFFD (REPLACEMENT CHARACTER) otherwise. |
* |
* |
* In the "translit" case, the codec will attempt to transliterate into |
* the destination charset, if encoding. If decoding, or if transliteration |
* fails, this option is identical to "loose". |
*/ |
typedef enum parserutils_charset_codec_errormode { |
/** Abort processing if unrepresentable character encountered */ |
PARSERUTILS_CHARSET_CODEC_ERROR_STRICT = 0, |
/** Replace unrepresentable characters with single alternate */ |
PARSERUTILS_CHARSET_CODEC_ERROR_LOOSE = 1, |
/** Transliterate unrepresentable characters, if possible */ |
PARSERUTILS_CHARSET_CODEC_ERROR_TRANSLIT = 2 |
} parserutils_charset_codec_errormode; |
/** |
* Charset codec option types |
*/ |
typedef enum parserutils_charset_codec_opttype { |
/** Set codec error mode */ |
PARSERUTILS_CHARSET_CODEC_ERROR_MODE = 1 |
} parserutils_charset_codec_opttype; |
/** |
* Charset codec option parameters |
*/ |
typedef union parserutils_charset_codec_optparams { |
/** Parameters for error mode setting */ |
struct { |
/** The desired error handling mode */ |
parserutils_charset_codec_errormode mode; |
} error_mode; |
} parserutils_charset_codec_optparams; |
/* Create a charset codec */ |
parserutils_error parserutils_charset_codec_create(const char *charset, |
parserutils_alloc alloc, void *pw, |
parserutils_charset_codec **codec); |
/* Destroy a charset codec */ |
parserutils_error parserutils_charset_codec_destroy( |
parserutils_charset_codec *codec); |
/* Configure a charset codec */ |
parserutils_error parserutils_charset_codec_setopt( |
parserutils_charset_codec *codec, |
parserutils_charset_codec_opttype type, |
parserutils_charset_codec_optparams *params); |
/* Encode a chunk of UCS-4 data into a codec's charset */ |
parserutils_error parserutils_charset_codec_encode( |
parserutils_charset_codec *codec, |
const uint8_t **source, size_t *sourcelen, |
uint8_t **dest, size_t *destlen); |
/* Decode a chunk of data in a codec's charset into UCS-4 */ |
parserutils_error parserutils_charset_codec_decode( |
parserutils_charset_codec *codec, |
const uint8_t **source, size_t *sourcelen, |
uint8_t **dest, size_t *destlen); |
/* Reset a charset codec */ |
parserutils_error parserutils_charset_codec_reset( |
parserutils_charset_codec *codec); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/parserutils/charset/mibenum.h |
---|
0,0 → 1,33 |
/* |
* This file is part of LibParserUtils. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef parserutils_charset_mibenum_h_ |
#define parserutils_charset_mibenum_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <inttypes.h> |
#include <stdbool.h> |
#include <parserutils/errors.h> |
#include <parserutils/functypes.h> |
/* Convert an encoding alias to a MIB enum value */ |
uint16_t parserutils_charset_mibenum_from_name(const char *alias, size_t len); |
/* Convert a MIB enum value into an encoding alias */ |
const char *parserutils_charset_mibenum_to_name(uint16_t mibenum); |
/* Determine if a MIB enum value represents a Unicode variant */ |
bool parserutils_charset_mibenum_is_unicode(uint16_t mibenum); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/parserutils/charset/utf16.h |
---|
0,0 → 1,47 |
/* |
* This file is part of LibParserUtils. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
/** \file |
* UTF-16 manipulation functions (interface). |
*/ |
#ifndef parserutils_charset_utf16_h_ |
#define parserutils_charset_utf16_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <inttypes.h> |
#include <parserutils/errors.h> |
parserutils_error parserutils_charset_utf16_to_ucs4(const uint8_t *s, |
size_t len, uint32_t *ucs4, size_t *clen); |
parserutils_error parserutils_charset_utf16_from_ucs4(uint32_t ucs4, |
uint8_t *s, size_t *len); |
parserutils_error parserutils_charset_utf16_length(const uint8_t *s, |
size_t max, size_t *len); |
parserutils_error parserutils_charset_utf16_char_byte_length(const uint8_t *s, |
size_t *len); |
parserutils_error parserutils_charset_utf16_prev(const uint8_t *s, |
uint32_t off, uint32_t *prevoff); |
parserutils_error parserutils_charset_utf16_next(const uint8_t *s, |
uint32_t len, uint32_t off, uint32_t *nextoff); |
parserutils_error parserutils_charset_utf16_next_paranoid(const uint8_t *s, |
uint32_t len, uint32_t off, uint32_t *nextoff); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/parserutils/charset/utf8.h |
---|
0,0 → 1,47 |
/* |
* This file is part of LibParserUtils. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
/** \file |
* UTF-8 manipulation functions (interface). |
*/ |
#ifndef parserutils_charset_utf8_h_ |
#define parserutils_charset_utf8_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <inttypes.h> |
#include <parserutils/errors.h> |
parserutils_error parserutils_charset_utf8_to_ucs4(const uint8_t *s, size_t len, |
uint32_t *ucs4, size_t *clen); |
parserutils_error parserutils_charset_utf8_from_ucs4(uint32_t ucs4, uint8_t **s, |
size_t *len); |
parserutils_error parserutils_charset_utf8_length(const uint8_t *s, size_t max, |
size_t *len); |
parserutils_error parserutils_charset_utf8_char_byte_length(const uint8_t *s, |
size_t *len); |
parserutils_error parserutils_charset_utf8_prev(const uint8_t *s, uint32_t off, |
uint32_t *prevoff); |
parserutils_error parserutils_charset_utf8_next(const uint8_t *s, uint32_t len, |
uint32_t off, uint32_t *nextoff); |
parserutils_error parserutils_charset_utf8_next_paranoid(const uint8_t *s, |
uint32_t len, uint32_t off, uint32_t *nextoff); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/parserutils/errors.h |
---|
0,0 → 1,40 |
/* |
* This file is part of LibParserUtils. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef parserutils_errors_h_ |
#define parserutils_errors_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <stddef.h> |
typedef enum parserutils_error { |
PARSERUTILS_OK = 0, |
PARSERUTILS_NOMEM = 1, |
PARSERUTILS_BADPARM = 2, |
PARSERUTILS_INVALID = 3, |
PARSERUTILS_FILENOTFOUND = 4, |
PARSERUTILS_NEEDDATA = 5, |
PARSERUTILS_BADENCODING = 6, |
PARSERUTILS_EOF = 7 |
} parserutils_error; |
/* Convert a parserutils error value to a string */ |
const char *parserutils_error_to_string(parserutils_error error); |
/* Convert a string to a parserutils error value */ |
parserutils_error parserutils_error_from_string(const char *str, size_t len); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/parserutils/functypes.h |
---|
0,0 → 1,30 |
/* |
* This file is part of LibParserUtils. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007-8 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef parserutils_functypes_h_ |
#define parserutils_functypes_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <stdbool.h> |
#include <stdint.h> |
#include <stdlib.h> |
#include <parserutils/types.h> |
/* Type of allocation function for parserutils */ |
typedef void *(*parserutils_alloc)(void *ptr, size_t size, void *pw); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/parserutils/input/inputstream.h |
---|
0,0 → 1,188 |
/* |
* This file is part of LibParserUtils. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef parserutils_input_inputstream_h_ |
#define parserutils_input_inputstream_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <stdbool.h> |
#ifndef NDEBUG |
#include <stdio.h> |
#endif |
#include <stdlib.h> |
#include <inttypes.h> |
#include <parserutils/errors.h> |
#include <parserutils/functypes.h> |
#include <parserutils/types.h> |
#include <parserutils/charset/utf8.h> |
#include <parserutils/utils/buffer.h> |
/** |
* Type of charset detection function |
*/ |
typedef parserutils_error (*parserutils_charset_detect_func)( |
const uint8_t *data, size_t len, |
uint16_t *mibenum, uint32_t *source); |
/** |
* Input stream object |
*/ |
typedef struct parserutils_inputstream |
{ |
parserutils_buffer *utf8; /**< Buffer containing UTF-8 data */ |
uint32_t cursor; /**< Byte offset of current position */ |
bool had_eof; /**< Whether EOF has been reached */ |
} parserutils_inputstream; |
/* Create an input stream */ |
parserutils_error parserutils_inputstream_create(const char *enc, |
uint32_t encsrc, parserutils_charset_detect_func csdetect, |
parserutils_alloc alloc, void *pw, |
parserutils_inputstream **stream); |
/* Destroy an input stream */ |
parserutils_error parserutils_inputstream_destroy( |
parserutils_inputstream *stream); |
/* Append data to an input stream */ |
parserutils_error parserutils_inputstream_append( |
parserutils_inputstream *stream, |
const uint8_t *data, size_t len); |
/* Insert data into stream at current location */ |
parserutils_error parserutils_inputstream_insert( |
parserutils_inputstream *stream, |
const uint8_t *data, size_t len); |
/* Slow form of css_inputstream_peek. */ |
parserutils_error parserutils_inputstream_peek_slow( |
parserutils_inputstream *stream, |
size_t offset, const uint8_t **ptr, size_t *length); |
/** |
* Look at the character in the stream that starts at |
* offset bytes from the cursor |
* |
* \param stream Stream to look in |
* \param offset Byte offset of start of character |
* \param ptr Pointer to location to receive pointer to character data |
* \param length Pointer to location to receive character length (in bytes) |
* \return PARSERUTILS_OK on success, |
* _NEEDDATA on reaching the end of available input, |
* _EOF on reaching the end of all input, |
* _BADENCODING if the input cannot be decoded, |
* _NOMEM on memory exhaustion, |
* _BADPARM if bad parameters are passed. |
* |
* Once the character pointed to by the result of this call has been advanced |
* past (i.e. parserutils_inputstream_advance has caused the stream cursor to |
* pass over the character), then no guarantee is made as to the validity of |
* the data pointed to. Thus, any attempt to dereference the pointer after |
* advancing past the data it points to is a bug. |
*/ |
static inline parserutils_error parserutils_inputstream_peek( |
parserutils_inputstream *stream, size_t offset, |
const uint8_t **ptr, size_t *length) |
{ |
parserutils_error error = PARSERUTILS_OK; |
const parserutils_buffer *utf8; |
const uint8_t *utf8_data; |
size_t len, off, utf8_len; |
if (stream == NULL || ptr == NULL || length == NULL) |
return PARSERUTILS_BADPARM; |
#ifndef NDEBUG |
#ifdef VERBOSE_INPUTSTREAM |
fprintf(stdout, "Peek: len: %zu cur: %u off: %zu\n", |
stream->utf8->length, stream->cursor, offset); |
#endif |
#ifdef RANDOMISE_INPUTSTREAM |
parserutils_buffer_randomise(stream->utf8); |
#endif |
#endif |
utf8 = stream->utf8; |
utf8_data = utf8->data; |
utf8_len = utf8->length; |
off = stream->cursor + offset; |
#define IS_ASCII(x) (((x) & 0x80) == 0) |
if (off < utf8_len) { |
if (IS_ASCII(utf8_data[off])) { |
/* Early exit for ASCII case */ |
(*length) = 1; |
(*ptr) = (utf8_data + off); |
return PARSERUTILS_OK; |
} else { |
error = parserutils_charset_utf8_char_byte_length( |
utf8_data + off, &len); |
if (error == PARSERUTILS_OK) { |
(*length) = len; |
(*ptr) = (utf8_data + off); |
return PARSERUTILS_OK; |
} else if (error != PARSERUTILS_NEEDDATA) { |
return error; |
} |
} |
} |
#undef IS_ASCII |
if (off != utf8_len && error != PARSERUTILS_NEEDDATA) |
abort(); |
return parserutils_inputstream_peek_slow(stream, offset, ptr, length); |
} |
/** |
* Advance the stream's current position |
* |
* \param stream The stream whose position to advance |
* \param bytes The number of bytes to advance |
*/ |
static inline void parserutils_inputstream_advance( |
parserutils_inputstream *stream, size_t bytes) |
{ |
if (stream == NULL) |
return; |
#if !defined(NDEBUG) && defined(VERBOSE_INPUTSTREAM) |
fprintf(stdout, "Advance: len: %zu cur: %u bytes: %zu\n", |
stream->utf8->length, stream->cursor, bytes); |
#endif |
if (bytes > stream->utf8->length - stream->cursor) |
abort(); |
if (stream->cursor == stream->utf8->length) |
return; |
stream->cursor += bytes; |
} |
/* Read the document charset */ |
const char *parserutils_inputstream_read_charset( |
parserutils_inputstream *stream, uint32_t *source); |
/* Change the document charset */ |
parserutils_error parserutils_inputstream_change_charset( |
parserutils_inputstream *stream, |
const char *enc, uint32_t source); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/parserutils/parserutils.h |
---|
0,0 → 1,25 |
/* |
* This file is part of LibParserUtils. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef parserutils_parserutils_h_ |
#define parserutils_parserutils_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <parserutils/errors.h> |
#include <parserutils/functypes.h> |
#include <parserutils/types.h> |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/parserutils/types.h |
---|
0,0 → 1,24 |
/* |
* This file is part of LibParserUtils. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef parserutils_types_h_ |
#define parserutils_types_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <stdbool.h> |
#include <inttypes.h> |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/parserutils/utils/buffer.h |
---|
0,0 → 1,50 |
/* |
* This file is part of LibParserUtils. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef parserutils_utils_buffer_h_ |
#define parserutils_utils_buffer_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <parserutils/errors.h> |
#include <parserutils/functypes.h> |
struct parserutils_buffer |
{ |
uint8_t *data; |
size_t length; |
size_t allocated; |
parserutils_alloc alloc; |
void *pw; |
}; |
typedef struct parserutils_buffer parserutils_buffer; |
parserutils_error parserutils_buffer_create(parserutils_alloc alloc, |
void *pw, parserutils_buffer **buffer); |
parserutils_error parserutils_buffer_destroy(parserutils_buffer *buffer); |
parserutils_error parserutils_buffer_append(parserutils_buffer *buffer, |
const uint8_t *data, size_t len); |
parserutils_error parserutils_buffer_insert(parserutils_buffer *buffer, |
size_t offset, const uint8_t *data, size_t len); |
parserutils_error parserutils_buffer_discard(parserutils_buffer *buffer, |
size_t offset, size_t len); |
parserutils_error parserutils_buffer_grow(parserutils_buffer *buffer); |
parserutils_error parserutils_buffer_randomise(parserutils_buffer *buffer); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/parserutils/utils/stack.h |
---|
0,0 → 1,39 |
/* |
* This file is part of LibParserUtils. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef parserutils_utils_stack_h_ |
#define parserutils_utils_stack_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <stddef.h> |
#include <parserutils/errors.h> |
#include <parserutils/functypes.h> |
struct parserutils_stack; |
typedef struct parserutils_stack parserutils_stack; |
parserutils_error parserutils_stack_create(size_t item_size, size_t chunk_size, |
parserutils_alloc alloc, void *pw, parserutils_stack **stack); |
parserutils_error parserutils_stack_destroy(parserutils_stack *stack); |
parserutils_error parserutils_stack_push(parserutils_stack *stack, |
const void *item); |
parserutils_error parserutils_stack_pop(parserutils_stack *stack, void *item); |
void *parserutils_stack_get_current(parserutils_stack *stack); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/network/netsurf/include/parserutils/utils/vector.h |
---|
0,0 → 1,45 |
/* |
* This file is part of LibParserUtils. |
* Licensed under the MIT License, |
* http://www.opensource.org/licenses/mit-license.php |
* Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org> |
*/ |
#ifndef parserutils_utils_vector_h_ |
#define parserutils_utils_vector_h_ |
#ifdef __cplusplus |
extern "C" |
{ |
#endif |
#include <stddef.h> |
#include <parserutils/errors.h> |
#include <parserutils/functypes.h> |
struct parserutils_vector; |
typedef struct parserutils_vector parserutils_vector; |
parserutils_error parserutils_vector_create(size_t item_size, |
size_t chunk_size, parserutils_alloc alloc, void *pw, |
parserutils_vector **vector); |
parserutils_error parserutils_vector_destroy(parserutils_vector *vector); |
parserutils_error parserutils_vector_append(parserutils_vector *vector, |
void *item); |
parserutils_error parserutils_vector_clear(parserutils_vector *vector); |
parserutils_error parserutils_vector_remove_last(parserutils_vector *vector); |
parserutils_error parserutils_vector_get_length(parserutils_vector *vector, size_t *length); |
const void *parserutils_vector_iterate(const parserutils_vector *vector, |
int32_t *ctx); |
const void *parserutils_vector_peek(const parserutils_vector *vector, |
int32_t ctx); |
#ifdef __cplusplus |
} |
#endif |
#endif |