ELinks 0.16.1.1
parse.c File Reference
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "elinks.h"
#include "config/options.h"
#include "document/css/apply.h"
#include "document/css/css.h"
#include "document/css/parser.h"
#include "document/html/parser/forms.h"
#include "document/html/parser/general.h"
#include "document/html/parser/link.h"
#include "document/html/parser/parse.h"
#include "document/html/parser/stack.h"
#include "document/html/parser.h"
#include "document/html/renderer.h"
#include "document/options.h"
#include "intl/charsets.h"
#include "util/conv.h"
#include "util/error.h"
#include "util/fastfind.h"
#include "util/memdebug.h"
#include "util/memory.h"
#include "util/string.h"
#include "document/html/internal.h"
Include dependency graph for parse.c:

Data Structures

struct  element_info

Macros

#define end_of_tag(c)
#define next_char()
#define realloc_chrs(x, l)
#define add_chr(s, l, c)
#define WIDTH_PIXELS2CHARS(width)
#define NUMBER_OF_TAGS   (sizeof_array(elements) - 1)
#define ELEMENT_RENDER_PROLOGUE

Enumerations

enum  element_type { ET_NESTABLE , ET_NON_NESTABLE , ET_NON_PAIRABLE , ET_LI }

Functions

static int atchr (unsigned char c)
int parse_element (char *e, char *eof, char **name, int *namelen, char **attr, char **end)
char * get_attr_value (char *e, const char *name, int cp, enum html_attr_flags flags)
int get_num (char *a, const char *name, int cp)
int get_num2 (char *al)
int get_width (char *a, const char *name, int limited, struct html_context *html_context)
int get_width2 (char *value, int limited, struct html_context *html_context)
char * skip_comment (char *html, char *eof)
static void tags_list_reset (void)
static struct fastfind_key_valuetags_list_next (void)
void init_tags_lookup (void)
void free_tags_lookup (void)
static char * process_element (char *name, int namelen, int endingtag, char *html, char *prev_html, char *eof, char *attr, struct html_context *html_context)
const char * count_newline_entities (const char *html, const char *eof, int *newlines_out)
void parse_html (char *html, char *eof, struct part *part, char *head, struct html_context *html_context)
static char * start_element (struct element_info *ei, char *name, int namelen, char *html, char *eof, char *attr, struct html_context *html_context)
static char * end_element (struct element_info *ei, char *name, int namelen, char *html, char *eof, char *attr, struct html_context *html_context)
void scan_http_equiv (char *s, char *eof, struct string *head, struct string *title, int cp)

Variables

static struct element_info elements []
static struct element_infointernal_pointer
static struct fastfind_index ff_tags_index = INIT_FASTFIND_INDEX("tags_lookup", tags_list_reset, tags_list_next)

Macro Definition Documentation

◆ add_chr

#define add_chr ( s,
l,
c )
Value:
do { \
if (!realloc_chrs(&(s), l)) return NULL; \
(s)[(l)++] = (c); \
} while (0)
#define realloc_chrs(x, l)
Definition parse.c:132
#define NULL
Definition explodename.c:35
const char * s
Definition general.c:826

◆ ELEMENT_RENDER_PROLOGUE

#define ELEMENT_RENDER_PROLOGUE
Value:
ln_break(html_context, ei->linebreak); \
a = get_attr_val(attr, "id", html_context->doc_cp); \
if (a) { \
mem_free(a); \
}
#define get_attr_val(e, name, cp)
Definition parse.h:47
void ln_break(struct html_context *html_context, int n)
Definition parser.c:120
@ SP_TAG
Definition renderer.h:23
Definition internal.h:43
void *(* special_f)(struct html_context *, html_special_type_T,...)
Definition internal.h:137
int doc_cp
Definition internal.h:60

◆ end_of_tag

#define end_of_tag ( c)
Value:
((c) == '>' || (c) == '<')

◆ next_char

#define next_char ( )
Value:
if (++e == eof) return -1;

◆ NUMBER_OF_TAGS

#define NUMBER_OF_TAGS   (sizeof_array(elements) - 1)

◆ realloc_chrs

#define realloc_chrs ( x,
l )
Value:
mem_align_alloc(x, l, (l) + 1, 0xFF)
#define mem_align_alloc(ptr, old, new_, mask)
Definition memory.h:148

◆ WIDTH_PIXELS2CHARS

#define WIDTH_PIXELS2CHARS ( width)
Value:
((width) + (HTML_CHAR_WIDTH - 1) / 2) / HTML_CHAR_WIDTH;
#define HTML_CHAR_WIDTH
Definition setup.h:68

Enumeration Type Documentation

◆ element_type

Enumerator
ET_NESTABLE 
ET_NON_NESTABLE 
ET_NON_PAIRABLE 
ET_LI 

Function Documentation

◆ atchr()

int atchr ( unsigned char c)
inlinestatic

◆ count_newline_entities()

const char * count_newline_entities ( const char * html,
const char * eof,
int * newlines_out )

◆ end_element()

char * end_element ( struct element_info * ei,
char * name,
int namelen,
char * html,
char * eof,
char * attr,
struct html_context * html_context )
static

◆ free_tags_lookup()

void free_tags_lookup ( void )

◆ get_attr_value()

char * get_attr_value ( char * e,
const char * name,
int cp,
enum html_attr_flags flags )

◆ get_num()

int get_num ( char * a,
const char * name,
int cp )

◆ get_num2()

int get_num2 ( char * al)

◆ get_width()

int get_width ( char * a,
const char * name,
int limited,
struct html_context * html_context )

◆ get_width2()

int get_width2 ( char * value,
int limited,
struct html_context * html_context )

◆ init_tags_lookup()

void init_tags_lookup ( void )

◆ parse_element()

int parse_element ( char * e,
char * eof,
char ** name,
int * namelen,
char ** attr,
char ** end )

◆ parse_html()

void parse_html ( char * html,
char * eof,
struct part * part,
char * head,
struct html_context * html_context )

◆ process_element()

char * process_element ( char * name,
int namelen,
int endingtag,
char * html,
char * prev_html,
char * eof,
char * attr,
struct html_context * html_context )
static

◆ scan_http_equiv()

void scan_http_equiv ( char * s,
char * eof,
struct string * head,
struct string * title,
int cp )

◆ skip_comment()

char * skip_comment ( char * html,
char * eof )

◆ start_element()

char * start_element ( struct element_info * ei,
char * name,
int namelen,
char * html,
char * eof,
char * attr,
struct html_context * html_context )
static

◆ tags_list_next()

struct fastfind_key_value * tags_list_next ( void )
static

◆ tags_list_reset()

void tags_list_reset ( void )
static

Variable Documentation

◆ elements

struct element_info elements[]
static

◆ ff_tags_index

struct fastfind_index ff_tags_index = INIT_FASTFIND_INDEX("tags_lookup", tags_list_reset, tags_list_next)
static

◆ internal_pointer

struct element_info* internal_pointer
static