ELinks 0.16.1.1
dump.c File Reference
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include "elinks.h"
#include "cache/cache.h"
#include "config/options.h"
#include "document/document.h"
#include "document/html/renderer.h"
#include "document/options.h"
#include "document/renderer.h"
#include "document/view.h"
#include "intl/charsets.h"
#include "intl/libintl.h"
#include "main/select.h"
#include "main/main.h"
#include "network/connection.h"
#include "network/state.h"
#include "osdep/ascii.h"
#include "osdep/osdep.h"
#include "protocol/protocol.h"
#include "protocol/uri.h"
#include "session/download.h"
#include "session/session.h"
#include "terminal/color.h"
#include "terminal/hardio.h"
#include "terminal/terminal.h"
#include "util/memory.h"
#include "util/string.h"
#include "viewer/dump/dump.h"
#include "viewer/text/view.h"
#include "viewer/text/vs.h"
#include "dump-color-mode.h"
Include dependency graph for dump.c:

Data Structures

struct  dump_output
 A place where dumping functions write their output. More...

Macros

#define D_BUF   65536
#define FRAME_CHARS_BEGIN   0xB0
#define FRAME_CHARS_END   0xE0
#define DUMP_COLOR_MODE_16
#define DUMP_FUNCTION_COLOR   dump_16color
#define DUMP_FUNCTION_UTF8   dump_16color_utf8
#define DUMP_FUNCTION_UNIBYTE   dump_16color_unibyte
#define DUMP_COLOR_MODE_NONE
#define DUMP_FUNCTION_COLOR   dump_nocolor
#define DUMP_FUNCTION_UTF8   dump_nocolor_utf8
#define DUMP_FUNCTION_UNIBYTE   dump_nocolor_unibyte

Functions

static int is_start_of_link (struct document *document, int x, int y, int *current_link_number, struct link **ret)
static int is_end_of_link (struct document *document, int x, int y, int *current_link_number, struct link **ret)
static int write_char (unsigned char c, struct dump_output *out)
static void write_start_of_link (struct link *link, struct dump_output *out)
static void write_end_of_link (struct dump_output *out)
static int write_color_16 (unsigned char color, struct dump_output *out)
static int dump_references (struct document *document, int fd, char buf[D_BUF])
int dump_to_file (struct document *document, int fd)
static void dump_formatted (int fd, struct download *download, struct cache_entry *cached)
static int dump_source (int fd, struct download *download, struct cache_entry *cached)
static char * subst_url (char *str, struct string *url)
static void dump_print (const char *option, struct string *url)
static void dump_loading_callback (struct download *download, void *p)
static void dump_start (char *url)
void dump_next (struct string_list_item list *url_list)
struct stringadd_document_to_string (struct string *string, struct document *document)

Variables

static int dump_pos
static struct download dump_download
static int dump_redir_count = 0
static const unsigned char frame_simplify [FRAME_CHARS_END - FRAME_CHARS_BEGIN]
 Mapping from CP437 box-drawing characters to simpler CP437 characters.

Macro Definition Documentation

◆ D_BUF

#define D_BUF   65536

◆ DUMP_COLOR_MODE_16

#define DUMP_COLOR_MODE_16

◆ DUMP_COLOR_MODE_NONE

#define DUMP_COLOR_MODE_NONE

◆ DUMP_FUNCTION_COLOR [1/2]

#define DUMP_FUNCTION_COLOR   dump_16color

◆ DUMP_FUNCTION_COLOR [2/2]

#define DUMP_FUNCTION_COLOR   dump_nocolor

◆ DUMP_FUNCTION_UNIBYTE [1/2]

#define DUMP_FUNCTION_UNIBYTE   dump_16color_unibyte

◆ DUMP_FUNCTION_UNIBYTE [2/2]

#define DUMP_FUNCTION_UNIBYTE   dump_nocolor_unibyte

◆ DUMP_FUNCTION_UTF8 [1/2]

#define DUMP_FUNCTION_UTF8   dump_16color_utf8

◆ DUMP_FUNCTION_UTF8 [2/2]

#define DUMP_FUNCTION_UTF8   dump_nocolor_utf8

◆ FRAME_CHARS_BEGIN

#define FRAME_CHARS_BEGIN   0xB0

◆ FRAME_CHARS_END

#define FRAME_CHARS_END   0xE0

Function Documentation

◆ add_document_to_string()

struct string * add_document_to_string ( struct string * string,
struct document * document )

◆ dump_formatted()

void dump_formatted ( int fd,
struct download * download,
struct cache_entry * cached )
static

◆ dump_loading_callback()

void dump_loading_callback ( struct download * download,
void * p )
static

◆ dump_next()

void dump_next ( struct string_list_item list * url_list)

◆ dump_print()

void dump_print ( const char * option,
struct string * url )
static

◆ dump_references()

int dump_references ( struct document * document,
int fd,
char buf[D_BUF] )
static
Returns
0 on success, -1 on error

◆ dump_source()

int dump_source ( int fd,
struct download * download,
struct cache_entry * cached )
static

◆ dump_start()

void dump_start ( char * url)
static

◆ dump_to_file()

int dump_to_file ( struct document * document,
int fd )

◆ is_end_of_link()

int is_end_of_link ( struct document * document,
int x,
int y,
int * current_link_number,
struct link ** ret )
static

◆ is_start_of_link()

int is_start_of_link ( struct document * document,
int x,
int y,
int * current_link_number,
struct link ** ret )
static

◆ subst_url()

char * subst_url ( char * str,
struct string * url )
static

◆ write_char()

int write_char ( unsigned char c,
struct dump_output * out )
static

◆ write_color_16()

int write_color_16 ( unsigned char color,
struct dump_output * out )
static

◆ write_end_of_link()

void write_end_of_link ( struct dump_output * out)
static

◆ write_start_of_link()

void write_start_of_link ( struct link * link,
struct dump_output * out )
static

Variable Documentation

◆ dump_download

struct download dump_download
static

◆ dump_pos

int dump_pos
static

◆ dump_redir_count

int dump_redir_count = 0
static

◆ frame_simplify

const unsigned char frame_simplify[FRAME_CHARS_END - FRAME_CHARS_BEGIN]
static
Initial value:
= {
0xB1, 0xDB, 0xB1, '|' , '+' , 0xB4, 0xB9, 0xBF,
0xC5, 0xB4, 0xB3, 0xBF, 0xD9, 0xD9, 0xD9, '+' ,
'+' , '+' , '+' , '+' , '-' , '+' , 0xC3, 0xCC,
0xC0, 0xDA, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xCA,
0xC1, 0xCB, 0xC2, 0xC0, 0xC0, 0xDA, 0xDA, 0xC5,
0xC5, '+' , '+' , '#' , 0xDB, 0xDB, 0xDB, 0xDB
}

Mapping from CP437 box-drawing characters to simpler CP437 characters.

  • Map mixed light/double lines to light lines or double lines, depending on the majority; or to light lines if even.
  • Map double lines to light lines.
  • Map light and dark shades to medium, then to full blocks.
  • Map half blocks to full blocks.
  • Otherwise map to ASCII characters.