General html support, Table support, Forms support – Comtrol eCos User Manual

Page 636

Advertising
background image

Chapter 48. Embedded HTTP Server

The macro

html_begin()

generates an HTTP header with a "text/html" content type followed by an opening

"<html>" tag.

html_end()

generates a closing "</html>" tag and calls

cyg_http_finish()

.

General HTML Support

void cyg_html_tag_begin( FILE *client, char *tag, char *attr );

void cyg_html_tag_end( FILE *client, char *tag );

#define html_tag_begin( __client, __tag, __attr )

#define html_tag_end( __client, __tag )

#define html_head( __client, __title, __meta )

#define html_body_begin( __client, __attr )

#define html_body_end( __client )

#define html_heading( __client, __level, __heading )

#define html_para_begin( __client, __attr )

#define html_url( __client, __text, __link )

#define html_image( __client, __source, __alt, __attr )

The function

cyg_html_tag_begin()

generates an opening tag with the given name. The function

cyg_html_tag_end()

generates a closing tag with the given name. The macros

html_tag_begin()

and

html_tag_end

are just wrappers for these functions.

The macro

html_head()

generates an HTML header section with

__title

as the title. The

__meta

argument

defines any meta tags that will be inserted into the header.

html_body_begin()

and

html_body_end

generate

HTML body begin and end tags.

html_heading()

generates a complete HTML header where

__level

is a numerical level, between 1 and 6, and

__heading

is the heading text.

html_para_begin()

generates a paragraph break.

html_url()

inserts a URL where

__text

is the displayed text and

__link

is the URL of the linked page.

html_image()

inserts an image tag where

__source

is the URL of the image to be included and

__alt

is the

alternative text for when the image is not displayed.

Table Support

#define html_table_begin( __client, __attr )

#define html_table_end( __client )

#define html_table_header( __client, __content, __attr )

#define html_table_row_begin( __client, __attr )

#define html_table_row_end( __client )

#define html_table_data_begin( __client, __attr )

#define html_table_data_end( __client )

html_table_begin()

starts a table and

html_table_end()

end it.

html_table_header()

generates a simple

table column header containg the string

__content

.

html_table_row_begin()

and

html_table_row_end()

begin and end a table row, and similarly

html_table_data_begin()

and

html_table_data_end()

begin and end a table entry.

532

Advertising