links  1.04
About: Links is a Lynx-like text WWW browser (table support and pop-up dialog boxes).
  Fossies Dox: links-1.04.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

html_tbl.c File Reference
#include "links.h"
Include dependency graph for html_tbl.c:

Go to the source code of this file.

Data Structures

struct  table_cell
 
struct  table_column
 
struct  table_dirty_workaround_for_name_clash_with_libraries_on_macos
 
struct  s_e
 

Macros

#define AL_TR   -1
 
#define VAL_TR   -1
 
#define VAL_TOP   0
 
#define VAL_MIDDLE   1
 
#define VAL_BOTTOM   2
 
#define W_AUTO   -1
 
#define W_REL   -2
 
#define F_VOID   0
 
#define F_ABOVE   1
 
#define F_BELOW   2
 
#define F_HSIDES   3
 
#define F_LHS   4
 
#define F_RHS   8
 
#define F_VSIDES   12
 
#define F_BOX   15
 
#define R_NONE   0
 
#define R_ROWS   1
 
#define R_COLS   2
 
#define R_ALL   3
 
#define R_GROUPS   4
 
#define INIT_X   8
 
#define INIT_Y   8
 
#define CELL(t, x, y)   (&(t)->cells[(y) * (t)->rx + (x)])
 
#define g_c_w(cc)
 
#define draw_frame_point(xx, yy, ii, jj)   if (H_LINE_X((ii-1), (jj)) >= 0 || H_LINE_X((ii), (jj)) >= 0 || V_LINE_X((ii), (jj-1)) >= 0 || V_LINE_X((ii), (jj)) >= 0) xset_hchar(t->p, (xx), (yy), frame_table[V_LINE((ii),(jj)-1)+3*H_LINE((ii),(jj))+9*H_LINE((ii)-1,(jj))+27*V_LINE((ii),(jj))] | ATTR_FRAME)
 
#define draw_frame_hline(xx, yy, ll, ii, jj)   if (H_LINE_X((ii), (jj)) >= 0) xset_hchars(t->p, (xx), (yy), (ll), hline_table[H_LINE((ii), (jj))] | ATTR_FRAME)
 
#define draw_frame_vline(xx, yy, ll, ii, jj)
 
#define H_LINE_X(xx, yy)   fh[(xx) + 1 + (t->x + 2) * (yy)]
 
#define V_LINE_X(xx, yy)   fv[(yy) + 1 + (t->y + 2) * (xx)]
 
#define H_LINE(xx, yy)   (H_LINE_X((xx), (yy)) == -1 ? 0 : H_LINE_X((xx), (yy)))
 
#define V_LINE(xx, yy)   (V_LINE_X((xx), (yy)) == -1 ? 0 : V_LINE_X((xx), (yy)))
 

Functions

void get_align (char *attr, int *a)
 
void get_valign (char *attr, int *a)
 
void get_c_width (char *attr, int *w, int sh)
 
struct table_dirty_workaround_for_name_clash_with_libraries_on_macosnew_table ()
 
void free_table (struct table_dirty_workaround_for_name_clash_with_libraries_on_macos *t)
 
void expand_cells (struct table_dirty_workaround_for_name_clash_with_libraries_on_macos *t, int x, int y)
 
struct table_cellnew_cell (struct table_dirty_workaround_for_name_clash_with_libraries_on_macos *t, int x, int y)
 
void new_columns (struct table_dirty_workaround_for_name_clash_with_libraries_on_macos *t, int span, int width, int align, int valign, int group)
 
void set_td_width (struct table_dirty_workaround_for_name_clash_with_libraries_on_macos *t, int x, int width, int f)
 
unsigned char * skip_table (unsigned char *html, unsigned char *eof)
 
struct table_dirty_workaround_for_name_clash_with_libraries_on_macosparse_table (unsigned char *html, unsigned char *eof, unsigned char **end, struct rgb *bgcolor, int sh, struct s_e **bad_html, int *bhp)
 
void get_cell_width (char *start, char *end, int cellpd, int w, int a, int *min, int *max, int n_link, int *n_links)
 
static void check_cell_widths (struct table_dirty_workaround_for_name_clash_with_libraries_on_macos *t)
 
void get_cell_widths (struct table_dirty_workaround_for_name_clash_with_libraries_on_macos *t)
 
void dst_width (int *p, int n, int w, int *lim)
 
int get_vline_width (struct table_dirty_workaround_for_name_clash_with_libraries_on_macos *t, int col)
 
int get_hline_width (struct table_dirty_workaround_for_name_clash_with_libraries_on_macos *t, int row)
 
int get_column_widths (struct table_dirty_workaround_for_name_clash_with_libraries_on_macos *t)
 
void get_table_width (struct table_dirty_workaround_for_name_clash_with_libraries_on_macos *t)
 
void distribute_widths (struct table_dirty_workaround_for_name_clash_with_libraries_on_macos *t, int width)
 
void check_table_widths (struct table_dirty_workaround_for_name_clash_with_libraries_on_macos *t)
 
void get_table_heights (struct table_dirty_workaround_for_name_clash_with_libraries_on_macos *t)
 
void display_complicated_table (struct table_dirty_workaround_for_name_clash_with_libraries_on_macos *t, int x, int y, int *yy)
 
void display_table_frames (struct table_dirty_workaround_for_name_clash_with_libraries_on_macos *t, int x, int y)
 
void format_table (unsigned char *attr, unsigned char *html, unsigned char *eof, unsigned char **end, void *f)
 

Variables

unsigned char frame_table [81]
 
unsigned char hline_table [3] = { 0x20, 0xc4, 0xcd }
 
unsigned char vline_table [3] = { 0x20, 0xb3, 0xba }
 

Macro Definition Documentation

◆ AL_TR

#define AL_TR   -1

Definition at line 3 of file html_tbl.c.

◆ CELL

#define CELL (   t,
  x,
 
)    (&(t)->cells[(y) * (t)->rx + (x)])

Definition at line 122 of file html_tbl.c.

◆ draw_frame_hline

#define draw_frame_hline (   xx,
  yy,
  ll,
  ii,
  jj 
)    if (H_LINE_X((ii), (jj)) >= 0) xset_hchars(t->p, (xx), (yy), (ll), hline_table[H_LINE((ii), (jj))] | ATTR_FRAME)

Definition at line 986 of file html_tbl.c.

◆ draw_frame_point

#define draw_frame_point (   xx,
  yy,
  ii,
  jj 
)    if (H_LINE_X((ii-1), (jj)) >= 0 || H_LINE_X((ii), (jj)) >= 0 || V_LINE_X((ii), (jj-1)) >= 0 || V_LINE_X((ii), (jj)) >= 0) xset_hchar(t->p, (xx), (yy), frame_table[V_LINE((ii),(jj)-1)+3*H_LINE((ii),(jj))+9*H_LINE((ii)-1,(jj))+27*V_LINE((ii),(jj))] | ATTR_FRAME)

Definition at line 983 of file html_tbl.c.

◆ draw_frame_vline

#define draw_frame_vline (   xx,
  yy,
  ll,
  ii,
  jj 
)
Value:
{ \
int qq; \
if (V_LINE_X((ii), (jj)) >= 0) for (qq = 0; qq < (ll); qq++) xset_hchar(t->p, (xx), (yy) + qq, vline_table[V_LINE((ii), (jj))] | ATTR_FRAME); }

Definition at line 989 of file html_tbl.c.

◆ F_ABOVE

#define F_ABOVE   1

Definition at line 14 of file html_tbl.c.

◆ F_BELOW

#define F_BELOW   2

Definition at line 15 of file html_tbl.c.

◆ F_BOX

#define F_BOX   15

Definition at line 20 of file html_tbl.c.

◆ F_HSIDES

#define F_HSIDES   3

Definition at line 16 of file html_tbl.c.

◆ F_LHS

#define F_LHS   4

Definition at line 17 of file html_tbl.c.

◆ F_RHS

#define F_RHS   8

Definition at line 18 of file html_tbl.c.

◆ F_VOID

#define F_VOID   0

Definition at line 13 of file html_tbl.c.

◆ F_VSIDES

#define F_VSIDES   12

Definition at line 19 of file html_tbl.c.

◆ g_c_w

#define g_c_w (   cc)
Value:
do { \
struct table_cell *c = cc; \
if (!c->start) continue; \
c->link_num = nl; \
get_cell_width(c->start, c->end, t->cellpd, 0, 0, &c->min_width, &c->max_width, nl, &nl);\
} while (0)

Definition at line 560 of file html_tbl.c.

◆ H_LINE

#define H_LINE (   xx,
  yy 
)    (H_LINE_X((xx), (yy)) == -1 ? 0 : H_LINE_X((xx), (yy)))

◆ H_LINE_X

#define H_LINE_X (   xx,
  yy 
)    fh[(xx) + 1 + (t->x + 2) * (yy)]

◆ INIT_X

#define INIT_X   8

Definition at line 71 of file html_tbl.c.

◆ INIT_Y

#define INIT_Y   8

Definition at line 72 of file html_tbl.c.

◆ R_ALL

#define R_ALL   3

Definition at line 25 of file html_tbl.c.

◆ R_COLS

#define R_COLS   2

Definition at line 24 of file html_tbl.c.

◆ R_GROUPS

#define R_GROUPS   4

Definition at line 26 of file html_tbl.c.

◆ R_NONE

#define R_NONE   0

Definition at line 22 of file html_tbl.c.

◆ R_ROWS

#define R_ROWS   1

Definition at line 23 of file html_tbl.c.

◆ V_LINE

#define V_LINE (   xx,
  yy 
)    (V_LINE_X((xx), (yy)) == -1 ? 0 : V_LINE_X((xx), (yy)))

◆ V_LINE_X

#define V_LINE_X (   xx,
  yy 
)    fv[(yy) + 1 + (t->y + 2) * (xx)]

◆ VAL_BOTTOM

#define VAL_BOTTOM   2

Definition at line 8 of file html_tbl.c.

◆ VAL_MIDDLE

#define VAL_MIDDLE   1

Definition at line 7 of file html_tbl.c.

◆ VAL_TOP

#define VAL_TOP   0

Definition at line 6 of file html_tbl.c.

◆ VAL_TR

#define VAL_TR   -1

Definition at line 5 of file html_tbl.c.

◆ W_AUTO

#define W_AUTO   -1

Definition at line 10 of file html_tbl.c.

◆ W_REL

#define W_REL   -2

Definition at line 11 of file html_tbl.c.

Function Documentation

◆ check_cell_widths()

static void check_cell_widths ( struct table_dirty_workaround_for_name_clash_with_libraries_on_macos t)
inlinestatic

◆ check_table_widths()

◆ display_complicated_table()

◆ display_table_frames()

◆ distribute_widths()

void distribute_widths ( struct table_dirty_workaround_for_name_clash_with_libraries_on_macos t,
int  width 
)

Definition at line 695 of file html_tbl.c.

References MAXINT, mem_alloc(), mem_free(), memcpy(), memset(), table_cell::mx, overalloc, and W_AUTO.

Referenced by format_table().

◆ dst_width()

void dst_width ( int *  p,
int  n,
int  w,
int *  lim 
)

Definition at line 579 of file html_tbl.c.

References n, and s.

Referenced by check_table_widths(), get_column_widths(), and get_table_heights().

◆ expand_cells()

void expand_cells ( struct table_dirty_workaround_for_name_clash_with_libraries_on_macos t,
int  x,
int  y 
)

Definition at line 174 of file html_tbl.c.

References CELL.

Referenced by new_cell().

◆ format_table()

◆ free_table()

Definition at line 162 of file html_tbl.c.

References mem_free().

Referenced by format_table().

◆ get_align()

void get_align ( char *  attr,
int *  a 
)

Definition at line 28 of file html_tbl.c.

References AL_BLOCK, AL_CENTER, AL_LEFT, AL_RIGHT, get_attr_val(), mem_free(), and strcasecmp().

Referenced by parse_table().

◆ get_c_width()

void get_c_width ( char *  attr,
int *  w,
int  sh 
)

Definition at line 53 of file html_tbl.c.

References get_attr_val(), get_width(), mem_free(), n, strlen(), strtoul(), and W_REL.

Referenced by parse_table().

◆ get_cell_width()

void get_cell_width ( char *  start,
char *  end,
int  cellpd,
int  w,
int  a,
int *  min,
int *  max,
int  n_link,
int *  n_links 
)

Definition at line 534 of file html_tbl.c.

References AL_LEFT, format_html_part(), part::link_num, mem_free(), part::x, and part::xmax.

Referenced by check_cell_widths(), and check_table_widths().

◆ get_cell_widths()

Definition at line 568 of file html_tbl.c.

References CELL, d_opt, g_c_w, and document_options::table_order.

Referenced by format_table().

◆ get_column_widths()

◆ get_hline_width()

int get_hline_width ( struct table_dirty_workaround_for_name_clash_with_libraries_on_macos t,
int  row 
)

◆ get_table_heights()

◆ get_table_width()

Definition at line 677 of file html_tbl.c.

References F_LHS, F_RHS, and get_vline_width().

Referenced by format_table().

◆ get_valign()

void get_valign ( char *  attr,
int *  a 
)

Definition at line 41 of file html_tbl.c.

References get_attr_val(), mem_free(), strcasecmp(), VAL_BOTTOM, VAL_MIDDLE, and VAL_TOP.

Referenced by parse_table().

◆ get_vline_width()

◆ new_cell()

struct table_cell* new_cell ( struct table_dirty_workaround_for_name_clash_with_libraries_on_macos t,
int  x,
int  y 
)

Definition at line 209 of file html_tbl.c.

References CELL, expand_cells(), MAXINT, mem_alloc(), mem_free(), memcpy(), memset(), overalloc, and table.

Referenced by parse_table().

◆ new_columns()

void new_columns ( struct table_dirty_workaround_for_name_clash_with_libraries_on_macos t,
int  span,
int  width,
int  align,
int  valign,
int  group 
)

◆ new_table()

Definition at line 141 of file html_tbl.c.

References DUMMY, INIT_X, INIT_Y, mem_alloc(), memset(), and table.

Referenced by parse_table().

◆ parse_table()

◆ set_td_width()

void set_td_width ( struct table_dirty_workaround_for_name_clash_with_libraries_on_macos t,
int  x,
int  width,
int  f 
)

Definition at line 270 of file html_tbl.c.

References MAXINT, mem_realloc(), n, overalloc, W_AUTO, and table_column::width.

Referenced by parse_table().

◆ skip_table()

unsigned char* skip_table ( unsigned char *  html,
unsigned char *  eof 
)

Definition at line 297 of file html_tbl.c.

References casecmp(), name, and parse_element().

Referenced by parse_table().

Variable Documentation

◆ frame_table

unsigned char frame_table[81]
Initial value:
= {
0x00, 0xb3, 0xba, 0xc4, 0xc0, 0xd3, 0xcd, 0xd4, 0xc8,
0xc4, 0xd9, 0xbd, 0xc4, 0xc1, 0xd0, 0xcd, 0xd4, 0xc8,
0xcd, 0xbe, 0xbc, 0xcd, 0xbe, 0xbc, 0xcd, 0xcf, 0xca,
0xb3, 0xb3, 0xba, 0xda, 0xc3, 0xd3, 0xd5, 0xc6, 0xc8,
0xbf, 0xb4, 0xbd, 0xc2, 0xc5, 0xd0, 0xd5, 0xc6, 0xc8,
0xb8, 0xb5, 0xbc, 0xb8, 0xb5, 0xbc, 0xd1, 0xd8, 0xca,
0xba, 0xba, 0xba, 0xd6, 0xd6, 0xc7, 0xc9, 0xc9, 0xcc,
0xb7, 0xb7, 0xb6, 0xd2, 0xd2, 0xd7, 0xc9, 0xc9, 0xcc,
0xbb, 0xbb, 0xb9, 0xbb, 0xbb, 0xb9, 0xcb, 0xcb, 0xce,
}

Definition at line 124 of file html_tbl.c.

◆ hline_table

unsigned char hline_table[3] = { 0x20, 0xc4, 0xcd }

Definition at line 138 of file html_tbl.c.

◆ vline_table

unsigned char vline_table[3] = { 0x20, 0xb3, 0xba }

Definition at line 139 of file html_tbl.c.

vline_table
unsigned char vline_table[3]
Definition: html_tbl.c:139
get_cell_width
void get_cell_width(char *start, char *end, int cellpd, int w, int a, int *min, int *max, int n_link, int *n_links)
Definition: html_tbl.c:534
V_LINE
#define V_LINE(xx, yy)
table_cell
Definition: html_tbl.c:74
V_LINE_X
#define V_LINE_X(xx, yy)
xset_hchar
void xset_hchar(struct part *p, int x, int y, unsigned c)
Definition: html_r.c:211